Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
 ---
  mcp/config/defaults.yaml | 4 ++--
- mcp/scripts/lib.sh       | 2 +-
- 2 files changed, 3 insertions(+), 3 deletions(-)
+ 1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/mcp/config/defaults.yaml b/mcp/config/defaults.yaml
 index b841e88..17fbbfc 100644
 +    vcpus: 6
      ram: 4096
 
-diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh
-index 1848c70..c315323 100644
---- a/mcp/scripts/lib.sh
-+++ b/mcp/scripts/lib.sh
-@@ -18,7 +18,7 @@ cleanup_vms() {
-   # clean up existing nodes
-   for node in $(virsh list --name | grep -P '\w{3}\d{2}'); do
-     virsh destroy $node
--    virsh undefine $node
-+    virsh undefine --nvram $node
-   done
- }
-
 
  # Check scenario file existence
  if [[ ! -f  ../config/${DEPLOY_SCENARIO}.yaml ]]; then
 diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh
-index c315323..862fdcc 100644
+index 3ec596a..b75e47e 100644
 --- a/mcp/scripts/lib.sh
 +++ b/mcp/scripts/lib.sh
-@@ -56,6 +56,13 @@ create_vms() {
+@@ -58,6 +58,13 @@ create_vms() {
    local -n vnodes_ram=$2
    local -n vnodes_vcpus=$3
 
    # create vms with specified options
    for node in "${vnodes[@]}"; do
      virt-install --name ${node} --ram ${vnodes_ram[$node]} --vcpus ${vnodes_vcpus[$node]} --cpu host --accelerate \
-@@ -67,7 +74,8 @@ create_vms() {
+@@ -69,7 +76,8 @@ create_vms() {
      --os-type linux --os-variant none \
      --boot hd --vnc --console pty --autostart --noreboot \
      --disk path=$(pwd)/images/mcp_${node}.iso,device=cdrom \
 
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh
-index 862fdcc..251c5a5 100644
+index b75e47e..55df750 100644
 --- a/mcp/scripts/lib.sh
 +++ b/mcp/scripts/lib.sh
-@@ -65,7 +65,7 @@ create_vms() {
+@@ -67,7 +67,7 @@ create_vms() {
 
    # create vms with specified options
    for node in "${vnodes[@]}"; do
 
--- /dev/null
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Tue, 25 Jul 2017 19:11:56 +0200
+Subject: [PATCH] ci/deploy.sh: Rework bridge arguments for MCP
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ ci/deploy.sh       | 37 ++++++++++++++++++++++++++-----------
+ mcp/scripts/lib.sh | 42 ++++++++++++++++++++++++++++++------------
+ 2 files changed, 56 insertions(+), 23 deletions(-)
+
+diff --git a/ci/deploy.sh b/ci/deploy.sh
+index edf05be..864b231 100755
+--- a/ci/deploy.sh
++++ b/ci/deploy.sh
+@@ -29,13 +29,16 @@ cat << EOF
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ `basename $0`: Deploys the Fuel@OPNFV stack
+
+-usage: `basename $0` -b base-uri [-B PXE Bridge] [-f] [-F] [-H] -l lab-name -p pod-name -s deploy-scenario [-S image-dir] [-T timeout] -i iso
++usage: `basename $0` -b base-uri
++       [-B PXE Bridge [-B Mgmt Bridge [-B Internal Bridge [-B Public Bridge]]]]
++       [-f] [-F] [-H] -l lab-name -p pod-name -s deploy-scenario
++       [-S image-dir] [-T timeout] -i iso
+        -s deployment-scenario [-S optional Deploy-scenario path URI]
+        [-R optional local relen repo (containing deployment Scenarios]
+
+ OPTIONS:
+   -b  Base-uri for the stack-configuration structure
+-  -B  PXE Bridge for booting of Fuel master
++  -B  Bridge(s): 1st usage = PXE, 2nd = Mgmt, 3rd = Internal, 4th = Public
+   -d  Dry-run
+   -f  Deploy on existing Fuel master
+   -e  Do not launch environment deployment
+@@ -59,10 +62,13 @@ and provides a fairly simple mechanism to execute a deployment.
+ Input parameters to the build script is:
+ -b Base URI to the configuration directory (needs to be provided in a URI
+    style, it can be a local resource: file:// or a remote resource http(s)://)
+--B PXE Bridge for booting of Fuel master. It can be specified several times,
++-B Bridges for to be used by deploy script. It can be specified several times,
+    or as a comma separated list of bridges, or both: -B br1 -B br2,br3
+-   One NIC connected to each specified bridge will be created in the Fuel VM,
+-   in the same order as provided in the command line. The default is pxebr.
++   First occurence sets PXE Brige, next Mgmt, then Internal and Public.
++   For an empty value, the deploy script will use virsh to create the default
++   expected network (e.g. -B pxe,,,public will use existing "pxe" and "public"
++   bridges, respectively create "mgmt" and "internal").
++   The default is pxebr.
+ -d Dry-run - Produces deploy config files (config/dea.yaml and
+    config/dha.yaml), but does not execute deploy
+ -f Deploy on existing Fuel master
+@@ -112,7 +118,7 @@ clean() {
+ #
+ SCRIPT_PATH=$(readlink -f $(dirname ${BASH_SOURCE[0]}))
+ DEPLOY_DIR=$(cd ${SCRIPT_PATH}/../mcp/scripts; pwd)
+-PXE_BRIDGE=''
++OPNFV_BRIDGES=('pxe' 'mgmt' 'internal' 'public')
+ NO_HEALTH_CHECK=''
+ USE_EXISTING_FUEL=''
+ FUEL_CREATION_ONLY=''
+@@ -124,6 +130,7 @@ if ! [ -z $DEPLOY_TIMEOUT ]; then
+ else
+     DEPLOY_TIMEOUT=""
+ fi
++
+ #
+ # END of variables to customize
+ ############################################################################
+@@ -146,9 +153,17 @@ do
+             fi
+             ;;
+         B)
+-            for bridge in ${OPTARG//,/ }; do
+-                PXE_BRIDGE+=" -b $bridge"
++            OIFS=${IFS}
++            IFS=','
++            OPT_BRIDGES=($OPTARG)
++            OPNFV_BRIDGE_IDX=0
++            for bridge in ${OPT_BRIDGES[@]}; do
++                if [ -n "${bridge}" ]; then
++                    OPNFV_BRIDGES[${OPNFV_BRIDGE_IDX}]="${bridge}"
++                fi
++                OPNFV_BRIDGE_IDX=$[OPNFV_BRIDGE_IDX + 1]
+             done
++            IFS=${OIFS}
+             ;;
+         d)
+             DRY_RUN=1
+@@ -261,9 +276,9 @@ export SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i
+ # Infra setup
+ generate_ssh_key
+ prepare_vms virtual_nodes $base_image
+-create_networks
+-create_vms virtual_nodes virtual_nodes_ram virtual_nodes_vcpus
+-update_pxe_network
++create_networks OPNFV_BRIDGES
++create_vms virtual_nodes virtual_nodes_ram virtual_nodes_vcpus OPNFV_BRIDGES
++update_pxe_network OPNFV_BRIDGES
+ start_vms virtual_nodes
+ check_connection
+
+diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh
+index 55df750..ec55c6d 100644
+--- a/mcp/scripts/lib.sh
++++ b/mcp/scripts/lib.sh
+@@ -41,15 +41,19 @@ prepare_vms() {
+ }
+
+ create_networks() {
++  local -n vnode_networks=$1
+   # create required networks
+-  for net in pxe mgmt internal public; do
++  for net in "${vnode_networks[@]}"; do
+     if virsh net-info $net >/dev/null 2>&1; then
+       virsh net-destroy ${net}
+       virsh net-undefine ${net}
+     fi
+-    virsh net-define net_${net}.xml
+-    virsh net-autostart ${net}
+-    virsh net-start ${net}
++    # in case of custom network, host should already have the bridge in place
++    if [ -f net_${net}.xml ]; then
++      virsh net-define net_${net}.xml
++      virsh net-autostart ${net}
++      virsh net-start ${net}
++    fi
+   done
+ }
+
+@@ -57,6 +61,7 @@ create_vms() {
+   local -n vnodes=$1
+   local -n vnodes_ram=$2
+   local -n vnodes_vcpus=$3
++  local -n vnode_networks=$4
+
+   # AArch64: prepare arch specific arguments
+   local virt_extra_args=""
+@@ -65,13 +70,22 @@ create_vms() {
+     virt_extra_args="$virt_extra_args --video=vga"
+   fi
+
++  # prepare network args
++  net_args=""
++  for net in "${vnode_networks[@]}"; do
++    net_type="network"
++    # in case of custom network, host should already have the bridge in place
++    if [ ! -f net_${net}.xml ]; then
++      net_type="bridge"
++    fi
++    net_args="${net_args} --network ${net_type}=${net},model=virtio"
++  done
++
+   # create vms with specified options
+   for node in "${vnodes[@]}"; do
+-    virt-install --name ${node} --ram ${vnodes_ram[$node]} --vcpus ${vnodes_vcpus[$node]} --cpu host-passthrough --accelerate \
+-    --network network:pxe,model=virtio \
+-    --network network:mgmt,model=virtio \
+-    --network network:internal,model=virtio \
+-    --network network:public,model=virtio \
++    virt-install --name ${node} \
++    --ram ${vnodes_ram[$node]} --vcpus ${vnodes_vcpus[$node]} \
++    --cpu host-passthrough --accelerate ${net_args} \
+     --disk path=$(pwd)/images/mcp_${node}.qcow2,format=qcow2,bus=virtio,cache=none,io=native \
+     --os-type linux --os-variant none \
+     --boot hd --vnc --console pty --autostart --noreboot \
+@@ -82,9 +96,13 @@ create_vms() {
+ }
+
+ update_pxe_network() {
+-  # set static ip address for salt master node
+-  virsh net-update pxe add ip-dhcp-host \
+-  "<host mac='$(virsh domiflist cfg01 | awk '/pxe/ {print $5}')' name='cfg01' ip='$SALT_MASTER'/>" --live
++  local -n vnode_networks=$1
++  if virsh net-info "${vnode_networks[0]}" >/dev/null 2>&1; then
++    # set static ip address for salt master node, only if managed via virsh
++    # NOTE: below expr assume PXE network is always the first in domiflist
++    virsh net-update "${vnode_networks[0]}" add ip-dhcp-host \
++    "<host mac='$(virsh domiflist cfg01 | awk '/network/ {print $5; exit}')' name='cfg01' ip='$SALT_MASTER'/>" --live
++  fi
+ }
+
+ start_vms() {
 
--- /dev/null
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Tue, 18 Jul 2017 19:17:24 +0200
+Subject: [PATCH] network: public: Use arm-virtual2 POD config
+
+grep -e "10\.16\.0\." -R . -l | \
+  xargs sed -i \
+    -e 's/10\.16\.0\./10.0.9./g' \
+    -e 's/10\.0\.9\.254/10.0.9.200/g'
+    -e 's/10\.0\.9\.1/10.0.9.254/g'
+
+NOTE: This should be converted into a dynamic configuration read from
+the universal POD descriptor in securedlab, once that is ready.
+
+Until then, just align the public network configuration used by the
+virtual POD with the Enea lab configuration specific to arm-virtual2
+(i.e. public network on 10.0.9.0/24).
+
+NOTE: Replace the gateway at 10.16.0.1 (now 10.0.9.1) with the same
+IP address as our lab's gateway (10.0.9.254), to keep both possible
+network layouts in sync (using all virtual networks created via
+virsh, respectively our lab's static config).
+This will ensure deploys continue to work in both enviroments.
+
+Also, since our new gateway resides at 10.0.9.254, trim the DHCP pool
+range for the public network to not include that address.
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ mcp/config/states/networks                                          | 2 +-
+ mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/infra/config.yml  | 6 +++---
+ .../classes/cluster/virtual-mcp-ocata-odl/openstack/init.yml        | 2 +-
+ .../classes/cluster/virtual-mcp-ocata-ovs-dpdk/infra/config.yml     | 6 +++---
+ .../classes/cluster/virtual-mcp-ocata-ovs-dpdk/openstack/init.yml   | 2 +-
+ mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/infra/config.yml  | 6 +++---
+ .../classes/cluster/virtual-mcp-ocata-ovs/openstack/init.yml        | 2 +-
+ mcp/scripts/net_public.xml                                          | 2 +-
+ 8 files changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/mcp/config/states/networks b/mcp/config/states/networks
+index 205e0a9..df4c0bb 100755
+--- a/mcp/config/states/networks
++++ b/mcp/config/states/networks
+@@ -1,3 +1,3 @@
+ salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack compute service list; openstack network agent list; openstack stack list; openstack volume service list"
+ salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack network create --external --default --provider-network-type flat --provider-physical-network physnet1 floating_net"
+-salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack subnet create --gateway 10.16.0.1 --no-dhcp --allocation-pool start=10.16.0.130,end=10.16.0.254 --network floating_net --subnet-range 10.16.0.0/24 floating_subnet"
++salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack subnet create --gateway 10.0.9.254 --no-dhcp --allocation-pool start=10.0.9.130,end=10.0.9.200 --network floating_net --subnet-range 10.0.9.0/24 floating_subnet"
+diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/infra/config.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/infra/config.yml
+index 57c6cec..f519e22 100644
+--- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/infra/config.yml
++++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/infra/config.yml
+@@ -51,16 +51,16 @@ parameters:
+           params:
+             single_address: 172.16.10.105
+             tenant_address: 10.1.0.105
+-            external_address: 10.16.0.105
++            external_address: 10.0.9.105
+         openstack_compute_node02:
+           params:
+             single_address: 172.16.10.106
+             tenant_address: 10.1.0.106
+-            external_address: 10.16.0.106
++            external_address: 10.0.9.106
+         openstack_gateway_node01:
+           params:
+             tenant_address: 10.1.0.110
+-            external_address: 10.16.0.110
++            external_address: 10.0.9.110
+         opendaylight_control_node01:
+           classes:
+           - cluster.${_param:cluster_name}.opendaylight.control
+diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/init.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/init.yml
+index 66e5a97..98625ff 100644
+--- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/init.yml
++++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/init.yml
+@@ -6,7 +6,7 @@ parameters:
+     openstack_region: RegionOne
+     admin_email: root@localhost
+     cluster_public_protocol: http
+-    cluster_public_host: 10.16.0.101
++    cluster_public_host: 10.0.9.101
+     neutron_public_protocol: http
+     neutron_control_dvr: False
+     neutron_tenant_network_types: "flat,vxlan"
+diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/infra/config.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/infra/config.yml
+index aec6cde..b69258f 100644
+--- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/infra/config.yml
++++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/infra/config.yml
+@@ -50,17 +50,17 @@ parameters:
+           params:
+             single_address: 172.16.10.105
+             tenant_address: 10.1.0.105
+-            external_address: 10.16.0.105
++            external_address: 10.0.9.105
+             dpdk0_name: enp3s0
+             dpdk0_pci: '"0000:00:05.0"'
+         openstack_compute_node02:
+           params:
+             single_address: 172.16.10.106
+             tenant_address: 10.1.0.106
+-            external_address: 10.16.0.106
++            external_address: 10.0.9.106
+             dpdk0_name: enp3s0
+             dpdk0_pci: '"0000:00:05.0"'
+         openstack_gateway_node01:
+           params:
+             tenant_address: 10.1.0.110
+-            external_address: 10.16.0.110
++            external_address: 10.0.9.110
+diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/openstack/init.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/openstack/init.yml
+index dfc0b51..b106e86 100644
+--- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/openstack/init.yml
++++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs-dpdk/openstack/init.yml
+@@ -6,7 +6,7 @@ parameters:
+     openstack_region: RegionOne
+     admin_email: root@localhost
+     cluster_public_protocol: http
+-    cluster_public_host: 10.16.0.101
++    cluster_public_host: 10.0.9.101
+     neutron_public_protocol: http
+     neutron_control_dvr: False
+     neutron_tenant_network_types: "flat,vlan"
+diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/infra/config.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/infra/config.yml
+index 8cb0992..c8f8477 100644
+--- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/infra/config.yml
++++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/infra/config.yml
+@@ -50,13 +50,13 @@ parameters:
+           params:
+             single_address: 172.16.10.105
+             tenant_address: 10.1.0.105
+-            external_address: 10.16.0.105
++            external_address: 10.0.9.105
+         openstack_compute_node02:
+           params:
+             single_address: 172.16.10.106
+             tenant_address: 10.1.0.106
+-            external_address: 10.16.0.106
++            external_address: 10.0.9.106
+         openstack_gateway_node01:
+           params:
+             tenant_address: 10.1.0.110
+-            external_address: 10.16.0.110
++            external_address: 10.0.9.110
+diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/openstack/init.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/openstack/init.yml
+index 7079fd1..fccde1f 100644
+--- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/openstack/init.yml
++++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-ovs/openstack/init.yml
+@@ -6,7 +6,7 @@ parameters:
+     openstack_region: RegionOne
+     admin_email: root@localhost
+     cluster_public_protocol: http
+-    cluster_public_host: 10.16.0.101
++    cluster_public_host: 10.0.9.101
+     neutron_public_protocol: http
+     neutron_control_dvr: False
+     neutron_tenant_network_types: "flat,vxlan"
+diff --git a/mcp/scripts/net_public.xml b/mcp/scripts/net_public.xml
+index 61650d5..f455480 100644
+--- a/mcp/scripts/net_public.xml
++++ b/mcp/scripts/net_public.xml
+@@ -2,5 +2,5 @@
+   <name>public</name>
+   <bridge name="public"/>
+   <forward mode="nat"/>
+-  <ip address="10.16.0.1" netmask="255.255.255.0" />
++  <ip address="10.0.9.254" netmask="255.255.255.0" />
+ </network>