[CORD-2554] update playbook according to new spgwu image

Change-Id: I0333d966025213f3115a4b928daf11d8f80d427e
diff --git a/xos/synchronizer/steps/roles/build_and_run/tasks/main.yml b/xos/synchronizer/steps/roles/build_and_run_4_1/tasks/main.yml
similarity index 79%
rename from xos/synchronizer/steps/roles/build_and_run/tasks/main.yml
rename to xos/synchronizer/steps/roles/build_and_run_4_1/tasks/main.yml
index 44167c2..32f7813 100644
--- a/xos/synchronizer/steps/roles/build_and_run/tasks/main.yml
+++ b/xos/synchronizer/steps/roles/build_and_run_4_1/tasks/main.yml
@@ -19,16 +19,16 @@
   become: yes
   template:
     src=run_with_log.sh.j2
-    dest="{{source_path}}/dp/run_with_log.sh" owner=root group=root mode=755
+    dest="{{source_path_4_1}}/dp/run_with_log.sh" owner=root group=root mode=755
 
 - name: build and run vspgwu
   become: yes
   shell: "{{ item }}"
   args:
-    chdir: "{{ source_path }}/dp"
+    chdir: "{{ source_path_4_1 }}/dp"
   environment:
-    NG_CORE: "{{ source_path }}"
-    RTE_SDK: "{{ source_path }}/dpdk"
+    NG_CORE: "{{ source_path_4_1 }}"
+    RTE_SDK: "{{ source_path_4_1 }}/dpdk"
     RTE_TARGET: "x86_64-native-linuxapp-gcc"
     HYPERSCANDIR: "/root/ngic/hyperscan-4.1.0"
   with_items:
@@ -39,4 +39,4 @@
 # Finish
 - name: write flag
   become: yes
-  shell: "echo 1 > {{source_path}}/dp/finish_flag_build_and_run"
+  shell: "echo 1 > {{source_path_4_1}}/dp/finish_flag_build_and_run"
diff --git a/xos/synchronizer/steps/roles/build_and_run/templates/run_with_log.sh.j2 b/xos/synchronizer/steps/roles/build_and_run_4_1/templates/run_with_log.sh.j2
similarity index 100%
rename from xos/synchronizer/steps/roles/build_and_run/templates/run_with_log.sh.j2
rename to xos/synchronizer/steps/roles/build_and_run_4_1/templates/run_with_log.sh.j2
diff --git a/xos/synchronizer/steps/roles/build_and_run/tasks/main.yml b/xos/synchronizer/steps/roles/build_and_run_5_0/tasks/main.yml
similarity index 71%
copy from xos/synchronizer/steps/roles/build_and_run/tasks/main.yml
copy to xos/synchronizer/steps/roles/build_and_run_5_0/tasks/main.yml
index 44167c2..3665756 100644
--- a/xos/synchronizer/steps/roles/build_and_run/tasks/main.yml
+++ b/xos/synchronizer/steps/roles/build_and_run_5_0/tasks/main.yml
@@ -14,23 +14,23 @@
 
 ---
 
-# Make shell script to run vSPGW-C with log
+# Make shell script to run vSPGW-U with log
 - name: make run with log file
   become: yes
   template:
     src=run_with_log.sh.j2
-    dest="{{source_path}}/dp/run_with_log.sh" owner=root group=root mode=755
+    dest="{{source_path_5_0}}/dp/run_with_log.sh" owner=root group=root mode=755
 
 - name: build and run vspgwu
   become: yes
   shell: "{{ item }}"
   args:
-    chdir: "{{ source_path }}/dp"
+    chdir: "{{ source_path_5_0 }}/dp"
   environment:
-    NG_CORE: "{{ source_path }}"
-    RTE_SDK: "{{ source_path }}/dpdk"
+    NG_CORE: "{{ source_path_5_0 }}"
+    RTE_SDK: "{{ source_path_5_0 }}/dpdk"
     RTE_TARGET: "x86_64-native-linuxapp-gcc"
-    HYPERSCANDIR: "/root/ngic/hyperscan-4.1.0"
+    HYPERSCANDIR: "{{ source_path_5_0 }}/hyperscan-4.1.0"
   with_items:
     - make clean
     - make
@@ -39,4 +39,4 @@
 # Finish
 - name: write flag
   become: yes
-  shell: "echo 1 > {{source_path}}/dp/finish_flag_build_and_run"
+  shell: "echo 1 > {{source_path_5_0}}/dp/finish_flag_build_and_run"
diff --git a/xos/synchronizer/steps/roles/build_and_run_5_0/templates/run_with_log.sh.j2 b/xos/synchronizer/steps/roles/build_and_run_5_0/templates/run_with_log.sh.j2
new file mode 100644
index 0000000..49e12cf
--- /dev/null
+++ b/xos/synchronizer/steps/roles/build_and_run_5_0/templates/run_with_log.sh.j2
@@ -0,0 +1,16 @@
+#! /bin/bash
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+./vdev_run.sh > results &
\ No newline at end of file
diff --git a/xos/synchronizer/steps/roles/interface_config/tasks/main.yml b/xos/synchronizer/steps/roles/interface_config_4_1/tasks/main.yml
similarity index 82%
rename from xos/synchronizer/steps/roles/interface_config/tasks/main.yml
rename to xos/synchronizer/steps/roles/interface_config_4_1/tasks/main.yml
index 5f25326..67e9f4c 100644
--- a/xos/synchronizer/steps/roles/interface_config/tasks/main.yml
+++ b/xos/synchronizer/steps/roles/interface_config_4_1/tasks/main.yml
@@ -22,13 +22,13 @@
   become: yes
   template:
     src=interface.cfg.j2
-    dest="{{source_path}}/config/interface.cfg" owner=root group=root mode=755
+    dest="{{source_path_4_1}}/config/interface.cfg" owner=root group=root mode=755
 
 - name: make static_arp config file
   become: yes
   template:
     src=static_arp.cfg.j2
-    dest="{{source_path}}/config/static_arp.cfg" owner=root group=root mode=755
+    dest="{{source_path_4_1}}/config/static_arp.cfg" owner=root group=root mode=755
 
 - name: get date
   shell: date +"%Y-%m-%d_%H-%M"
@@ -62,14 +62,14 @@
   become: yes
   template:
     src=dp_config.cfg.j2
-    dest="{{source_path}}/config/dp_config.cfg" owner=root group=root mode=755
+    dest="{{source_path_4_1}}/config/dp_config.cfg" owner=root group=root mode=755
 
 - name: change Makefile.j2
   become: yes
   template:
     src=Makefile.j2
-    dest="{{source_path}}/dp/Makefile" owner=root group=root mode=755
+    dest="{{source_path_4_1}}/dp/Makefile" owner=root group=root mode=755
 
 - name: write flag for interface_config
   become: yes
-  shell: "echo 1 > {{source_path}}/dp/finish_flag_interface_config"
\ No newline at end of file
+  shell: "echo 1 > {{source_path_4_1}}/dp/finish_flag_interface_config"
\ No newline at end of file
diff --git a/xos/synchronizer/steps/roles/interface_config/templates/Makefile.j2 b/xos/synchronizer/steps/roles/interface_config_4_1/templates/Makefile.j2
similarity index 100%
rename from xos/synchronizer/steps/roles/interface_config/templates/Makefile.j2
rename to xos/synchronizer/steps/roles/interface_config_4_1/templates/Makefile.j2
diff --git a/xos/synchronizer/steps/roles/interface_config/templates/dp_config.cfg.j2 b/xos/synchronizer/steps/roles/interface_config_4_1/templates/dp_config.cfg.j2
similarity index 100%
rename from xos/synchronizer/steps/roles/interface_config/templates/dp_config.cfg.j2
rename to xos/synchronizer/steps/roles/interface_config_4_1/templates/dp_config.cfg.j2
diff --git a/xos/synchronizer/steps/roles/interface_config/templates/interface.cfg.j2 b/xos/synchronizer/steps/roles/interface_config_4_1/templates/interface.cfg.j2
similarity index 100%
rename from xos/synchronizer/steps/roles/interface_config/templates/interface.cfg.j2
rename to xos/synchronizer/steps/roles/interface_config_4_1/templates/interface.cfg.j2
diff --git a/xos/synchronizer/steps/roles/interface_config/templates/static_arp.cfg.j2 b/xos/synchronizer/steps/roles/interface_config_4_1/templates/static_arp.cfg.j2
similarity index 100%
rename from xos/synchronizer/steps/roles/interface_config/templates/static_arp.cfg.j2
rename to xos/synchronizer/steps/roles/interface_config_4_1/templates/static_arp.cfg.j2
diff --git a/xos/synchronizer/steps/roles/interface_config/tasks/main.yml b/xos/synchronizer/steps/roles/interface_config_5_0/tasks/main.yml
similarity index 64%
copy from xos/synchronizer/steps/roles/interface_config/tasks/main.yml
copy to xos/synchronizer/steps/roles/interface_config_5_0/tasks/main.yml
index 5f25326..5109beb 100644
--- a/xos/synchronizer/steps/roles/interface_config/tasks/main.yml
+++ b/xos/synchronizer/steps/roles/interface_config_5_0/tasks/main.yml
@@ -11,6 +11,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+#sudo lshw -businfo -c network | grep ens3 | awk '{print $1}' | awk -F '@' '{print $2}'
 
 ---
 
@@ -18,18 +19,6 @@
   become: yes
   shell: "echo 127.0.1.1       $(cat /etc/hostname) >> /etc/hosts"
 
-- name: make interface config file
-  become: yes
-  template:
-    src=interface.cfg.j2
-    dest="{{source_path}}/config/interface.cfg" owner=root group=root mode=755
-
-- name: make static_arp config file
-  become: yes
-  template:
-    src=static_arp.cfg.j2
-    dest="{{source_path}}/config/static_arp.cfg" owner=root group=root mode=755
-
 - name: get date
   shell: date +"%Y-%m-%d_%H-%M"
   register: tmp_date
@@ -58,18 +47,42 @@
     sgi_mac: "{{ tmp_sgi_mac.stdout }}"
     date: "{{ tmp_date.stdout }}"
 
+- name: get enumeration number for port_0
+  become: yes
+  shell: "lshw -businfo -c network | grep {{ port_0 }} | awk '{print $1}' | awk -F '@' '{print $2}'"
+  register: tmp_enum_port_0
+
+- name: get enumeration number for port_1
+  become: yes
+  shell: "lshw -businfo -c network | grep {{ port_1 }} | awk '{print $1}' | awk -F '@' '{print $2}'"
+  register: tmp_enum_port_1
+
+- name: assign enumeration numbers into each variable
+  set_fact:
+    enum_port_0: "{{ tmp_enum_port_0.stdout }}"
+    enum_port_1: "{{ tmp_enum_port_1.stdout }}"
+
+- name: make interface config file
+  become: yes
+  template:
+    src=interface.cfg.j2
+    dest="{{source_path_5_0}}/config/interface.cfg" owner=root group=root mode=755
+
+- name: make static_arp config file
+  become: yes
+  template:
+    src=static_arp.cfg.j2
+    dest="{{source_path_5_0}}/config/static_arp.cfg" owner=root group=root mode=755
+
 - name: make dp_config config file
   become: yes
   template:
     src=dp_config.cfg.j2
-    dest="{{source_path}}/config/dp_config.cfg" owner=root group=root mode=755
+    dest="{{source_path_5_0}}/config/dp_config.cfg" owner=root group=root mode=755
 
-- name: change Makefile.j2
+# Make shell script to run ngic
+- name: make vdev_run script
   become: yes
   template:
-    src=Makefile.j2
-    dest="{{source_path}}/dp/Makefile" owner=root group=root mode=755
-
-- name: write flag for interface_config
-  become: yes
-  shell: "echo 1 > {{source_path}}/dp/finish_flag_interface_config"
\ No newline at end of file
+    src=vdev_run.sh.j2
+    dest="{{source_path_5_0}}/dp/vdev_run.sh" owner=root group=root mode=755
\ No newline at end of file
diff --git a/xos/synchronizer/steps/roles/interface_config_5_0/templates/dp_config.cfg.j2 b/xos/synchronizer/steps/roles/interface_config_5_0/templates/dp_config.cfg.j2
new file mode 100644
index 0000000..f350202
--- /dev/null
+++ b/xos/synchronizer/steps/roles/interface_config_5_0/templates/dp_config.cfg.j2
@@ -0,0 +1,20 @@
+NOW={{ date }}
+FILE="logs/dp_{{ date }}.log"
+
+#dp configure parameter selections
+#SPGW_CFG:: SGWU=01; PGWU=02; SPGWU=03
+
+#####[SPGWU]#####
+SPGW_CFG=03
+S1U_PORT={{ enum_port_0 }}
+SGI_PORT={{ enum_port_0 }}
+S1U_IP={{ s1u_ip }}
+S1U_MAC={{ s1u_mac }}
+SGI_IP={{ sgi_ip }}
+SGI_MAC={{ sgi_mac }}
+
+NUM_WORKER=1
+MEMORY=4096
+
+#Set 1 to enabled numa, otherwise set to 0
+NUMA=1
diff --git a/xos/synchronizer/steps/roles/interface_config_5_0/templates/interface.cfg.j2 b/xos/synchronizer/steps/roles/interface_config_5_0/templates/interface.cfg.j2
new file mode 100644
index 0000000..e922fec
--- /dev/null
+++ b/xos/synchronizer/steps/roles/interface_config_5_0/templates/interface.cfg.j2
@@ -0,0 +1,52 @@
+; Copyright (c) 2017 Intel Corporation
+;
+; Licensed under the Apache License, Version 2.0 (the "License");
+; you may not use this file except in compliance with the License.
+; You may obtain a copy of the License at
+;
+;      http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+
+; scenario: {{ scenario }}
+
+[0]
+; please refer to INSTALL.MD for complete description of these parameters
+zmq_protocol = tcp
+
+; zmq publisher and subscriber ip:port. To be configured to an available ip
+; on the FPC Host. The port values are defined by the FPC Project.
+; These values are unused when DSDN_ODL_BUILD CFLAG not defined in
+; ng-core_cfg.mk
+zmq_sub_ip = {{ zmq_sub_ip }}
+zmq_sub_port = 5560
+zmq_pub_ip = {{ zmq_pub_ip }}
+zmq_pub_port = 5559
+
+; DP and CP communication ip:port: To be configured to available ip:ports on
+; the DP and CP Hosts respectively. Used for messages to communicate over UDP
+; including table creation, table entries; and when DSDN_ODL_BUILD CFLAG is NOT
+; defined, session establishment, modification, deletion, etc.
+dp_comm_ip = {{ dp_comm_ip }}
+dp_comm_port = 20
+cp_comm_ip = {{ cp_comm_ip }}
+cp_comm_port = 21
+
+; FPC ip:port: To be configured to an available IP of FPC host. The fpc_port
+; is defined by the FPC project.
+; These values are unused when DSDN_ODL_BUILD CFLAG not defined in
+; ng-core_cfg.mk
+fpc_ip = {{ fpc_ip }}
+fpc_port = 8070
+fpc_topology_port = 8181
+
+; The CP Northbound server ip:port: May be configured to any available ip:port
+; on the CP Host.
+; These values are unused when DSDN_ODL_BUILD CFLAG not defined in
+; ng-core_cfg.mk
+cp_nb_ip = {{ cp_nb_server_ip }}
+cp_nb_port = 9997
diff --git a/xos/synchronizer/steps/roles/interface_config_5_0/templates/static_arp.cfg.j2 b/xos/synchronizer/steps/roles/interface_config_5_0/templates/static_arp.cfg.j2
new file mode 100644
index 0000000..93aef13
--- /dev/null
+++ b/xos/synchronizer/steps/roles/interface_config_5_0/templates/static_arp.cfg.j2
@@ -0,0 +1,24 @@
+; Copyright (c) 2017 Intel Corporation
+;
+; Licensed under the Apache License, Version 2.0 (the "License");
+; you may not use this file except in compliance with the License.
+; You may obtain a copy of the License at
+;
+;      http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+
+; static arp entries are per port; syntax:
+; ipv4 [ipv4] = ethernet mac address
+
+[sgi]
+;14.3.1.93 14.3.1.93 = 00:00:00:00:fc:00
+{{ as_sgi_ip }} {{ as_sgi_ip }} = {{ as_sgi_mac }}
+
+[s1u]
+;101.3.1.101 101.3.1.180 = 68:05:CA:30:E5:B8
+{{ enb_s1u_ip }} {{ enb_s1u_ip }} = {{ enb_s1u_mac }}
\ No newline at end of file
diff --git a/xos/synchronizer/steps/roles/interface_config_5_0/templates/vdev_run.sh.j2 b/xos/synchronizer/steps/roles/interface_config_5_0/templates/vdev_run.sh.j2
new file mode 100755
index 0000000..7992a12
--- /dev/null
+++ b/xos/synchronizer/steps/roles/interface_config_5_0/templates/vdev_run.sh.j2
@@ -0,0 +1,120 @@
+#! /bin/bash
+# Copyright (c) 2017 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+source ../config/dp_config.cfg
+source ../config/cdr.cfg
+
+APP_PATH="./build"
+APP="ngic_dataplane"
+LOG_LEVEL=1
+COREMASK="0xfe"
+
+if [ "${SPGW_CFG}" == "01" ]; then
+
+	ARGS="-c $COREMASK -n 4 --socket-mem $MEMORY,0	\
+				--file-prefix dp	\
+				-w $S1U_PORT -w $S5S8_SGWU_PORT --	\
+				--s1u_ip $S1U_IP	\
+				--s1u_mac $S1U_MAC	\
+				--s5s8_sgwu_ip $S5S8_SGWU_IP	\
+				--s5s8_sgwu_mac $S5S8_SGWU_MAC	\
+				--num_workers $NUM_WORKER 	\
+				--log $LOG_LEVEL	\
+				--numa $NUMA	\
+				--spgw_cfg $SPGW_CFG"
+
+elif [ "${SPGW_CFG}" == "02" ]; then
+
+	ARGS="-c $COREMASK -n 4 --socket-mem $MEMORY,0 	\
+				--file-prefix dp	\
+				-w $S5S8_PGWU_PORT -w $SGI_PORT	--	\
+				--s5s8_pgwu_ip $S5S8_PGWU_IP	\
+				--s5s8_pgwu_mac $S5S8_PGWU_MAC	\
+				--sgi_ip $SGI_IP	\
+				--sgi_mac $SGI_MAC	\
+				--num_workers $NUM_WORKER	\
+				--log $LOG_LEVEL	\
+				--numa $NUMA	\
+				--spgw_cfg $SPGW_CFG"
+
+elif [ "${SPGW_CFG}" == "03" ]; then
+#WK: S1U=eth_af_packet0; SGi=eth_af_packet1; Change eth1, eth2 accordingly
+	ARGS="-c $COREMASK -n 4 --socket-mem $MEMORY,0 	\
+				--file-prefix dp	\
+				--vdev=eth_af_packet0,iface={{ port_0 }}	\
+				--vdev=eth_af_packet1,iface={{ port_1 }} --	\
+				--s1u_ip $S1U_IP	\
+				--s1u_mac $S1U_MAC	\
+				--sgi_ip $SGI_IP	\
+				--sgi_mac $SGI_MAC	\
+				--num_workers $NUM_WORKER	\
+				--log $LOG_LEVEL	\
+				--numa $NUMA	\
+				--spgw_cfg $SPGW_CFG"
+fi
+
+
+if [ -n "${S1U_GW_IP}" ]; then
+	ARGS="$ARGS --s1u_gw_ip $S1U_GW_IP"
+	if [ -n "${S1U_MASK}" ]; then
+		ARGS="$ARGS --s1u_mask $S1U_MASK"
+	fi
+fi
+
+if [ -n "${SGI_GW_IP}" ]; then
+	ARGS="$ARGS --sgi_gw_ip $SGI_GW_IP"
+	if [ -n "${SGI_MASK}" ]; then
+		ARGS="$ARGS --sgi_mask $SGI_MASK"
+	fi
+fi
+
+if [ -n "${CDR_PATH}" ]; then
+	ARGS="$ARGS --cdr_path $CDR_PATH"
+fi
+
+if [ -n "${MASTER_CDR}" ]; then
+	ARGS="$ARGS --master_cdr $MASTER_CDR"
+fi
+
+echo $ARGS | sed -e $'s/--/\\\n\\t--/g'
+
+USAGE=$"Usage: run.sh [ debug | log ]
+	debug:	executes $APP under gdb
+	log:	executes $APP with logging enabled to date named file under
+		$APP_PATH/logs. Requires Control-C to exit even if $APP exits"
+
+if [ -z "$1" ]; then
+
+	$APP_PATH/$APP $ARGS
+
+elif [ "$1" == "log" ]; then
+
+	if [ "$#" -eq "2" ]; then
+		FILE="${FILE/.log/.$2.log}"
+		echo "logging as $FILE"
+	fi
+	trap "killall $APP; exit" SIGINT
+	stdbuf -oL -eL $APP_PATH/$APP $ARGS </dev/null &>$FILE & tail -f $FILE
+	#valgrind --tool=memcheck --leak-check=full --log-file="sgwu_dp1.logs" $APP_PATH/$APP $ARGS
+
+elif [ "$1" == "debug" ]; then
+
+	GDB_EX="-ex 'set print pretty on' "
+	echo $GDB_EX
+	gdb $GDB_EX --args $APP_PATH/$APP $ARGS
+
+else
+	echo "$USAGE"
+fi
diff --git a/xos/synchronizer/steps/sync_vspgwutenant.py b/xos/synchronizer/steps/sync_vspgwutenant.py
index d912df0..33042e1 100644
--- a/xos/synchronizer/steps/sync_vspgwutenant.py
+++ b/xos/synchronizer/steps/sync_vspgwutenant.py
@@ -38,25 +38,18 @@
 
         scenario = self.get_scenario(o)
 
-        if scenario == 'normal_scenario':
-            return self.get_values_for_normal_scenario(o)
-        elif scenario == 'normal_scenario_without_sdncontroller':
-            return self.get_values_for_normal_scenario_wo_sdncontroller(o)
-        elif scenario == 'emulator_scenario':
-            return self.get_values_for_emulator_scenario(o)
-        elif scenario == 'emulator_scenario_without_sdncontroller':
-            return self.get_values_for_emulator_scenario_wo_sdncontroller(o)
-        elif scenario == 'hardware_scenario':
-            return self.get_values_for_hardware_scenario(o)
-        elif scenario == 'hardware_scenario_without_sdncontroller':
-            return self.get_values_for_hardware_scenario_wo_sdncontroller(o)
+        if scenario == 'cord_4_1_scenario':
+            return self.get_values_for_CORD_4_1(o)
+        elif scenario == 'cord_5_0_scenario':
+            return self.get_values_for_CORD_5_0(o)
         else:
             return self.get_extra_attributes_for_manual(o)
 
     # fields for manual case
     def get_extra_attributes_for_manual(self, o):
         fields = {}
-        fields['scenario'] = self.get_scenario(o)
+        fields['scenario'] = "manual"
+        fields['cord_version'] = "manual"
         # for interface.cfg file
         fields['zmq_sub_ip'] = "manual"
         fields['zmq_pub_ip'] = "manual"
@@ -77,110 +70,10 @@
 
         return fields
 
-    def get_values_for_normal_scenario(self, o):
+    def get_values_for_CORD_4_1(self, o):
         fields = {}
-        fields['scenario'] = "normal_scenario"
-        # for interface.cfg file
-        fields['zmq_sub_ip'] = self.get_ip_address_from_peer_service_instance(
-            'sbi_network', "SDNControllerServiceInstance", o, 'zmq_sub_ip')
-        fields['zmq_pub_ip'] = self.get_ip_address_from_peer_service_instance(
-            'sbi_network', "SDNControllerServiceInstance", o, 'zmq_pub_ip')
-        fields['dp_comm_ip'] = self.get_ip_address_from_peer_service_instance_instance(
-            'sbi_network', o, o, 'dp_comm_ip')
-        fields['cp_comm_ip'] = self.get_ip_address_from_peer_service_instance(
-            'nbi_network', "VSPGWCTenant", o, 'cp_comm_ip')
-        fields['fpc_ip'] = self.get_ip_address_from_peer_service_instance(
-            'nbi_network', "SDNControllerServiceInstance", o, 'fpc_ip')
-        fields['cp_nb_server_ip'] = self.get_ip_address_from_peer_service_instance(
-            'nbi_network', "VSPGWCTenant", o, 'cp_nb_server_ip')
-
-        # for dp_config.cfg file
-        fields['s1u_ip'] = self.get_ip_address_from_peer_service_instance_instance(
-            's1u_network', o, o, 's1u_ip')
-        fields['sgi_ip'] = self.get_ip_address_from_peer_service_instance_instance(
-            'sgi_network', o, o, 'sgi_ip')
-
-        # for static_arp.cfg file
-        fields['as_sgi_ip'] = self.get_ip_address_from_peer_service_instance(
-            'sgi_network', "InternetEmulatorServiceInstance", o, 'as_sgi_ip')
-        fields['as_sgi_mac'] = self.get_mac_address_from_peer_service_instance(
-            'sgi_network', "InternetEmulatorServiceInstance", o, 'as_sgi_mac')
-        fields['enb_s1u_ip'] = self.get_ip_address_from_peer_service_instance(
-            's1u_network', "VENBServiceInstance", o, 'enb_s1u_ip')
-        fields['enb_s1u_mac'] = self.get_mac_address_from_peer_service_instance(
-            's1u_network', "VENBServiceInstance", o, 'enb_s1u_mac')
-
-        return fields
-
-    def get_values_for_normal_scenario_wo_sdncontroller(self, o):
-        fields = {}
-        fields['scenario'] = "normal_scenario_without_sdncontroller"
-        # for interface.cfg file
-        fields['zmq_sub_ip'] = "127.0.0.1"
-        fields['zmq_pub_ip'] = "127.0.0.1"
-        fields['dp_comm_ip'] = self.get_ip_address_from_peer_service_instance_instance(
-            'spgw_network', o, o, 'dp_comm_ip')
-        fields['cp_comm_ip'] = self.get_ip_address_from_peer_service_instance(
-            'spgw_network', "VSPGWCTenant", o, 'cp_comm_ip')
-        fields['fpc_ip'] = "127.0.0.1"
-        fields['cp_nb_server_ip'] = "127.0.0.1"
-
-        # for cp_config.cfg file
-        fields['s1u_ip'] = self.get_ip_address_from_peer_service_instance_instance(
-            's1u_network', o, o, 's1u_ip')
-        fields['sgi_ip'] = self.get_ip_address_from_peer_service_instance_instance(
-            'sgi_network', o, o, 'sgi_ip')
-
-        # for static_arp.cfg file
-        fields['as_sgi_ip'] = self.get_ip_address_from_peer_service_instance(
-            'sgi_network', "InternetEmulatorServiceInstance", o, 'as_sgi_ip')
-        fields['as_sgi_mac'] = self.get_mac_address_from_peer_service_instance(
-            'sgi_network', "InternetEmulatorServiceInstance", o, 'as_sgi_mac')
-        fields['enb_s1u_ip'] = self.get_ip_address_from_peer_service_instance(
-            's1u_network', "VENBServiceInstance", o, 'enb_s1u_ip')
-        fields['enb_s1u_mac'] = self.get_mac_address_from_peer_service_instance(
-            's1u_network', "VENBServiceInstance", o, 'enb_s1u_mac')
-
-        return fields
-
-    def get_values_for_emulator_scenario(self, o):
-        fields = {}
-        fields['scenario'] = "emulator_scenario"
-        # for interface.cfg file
-        fields['zmq_sub_ip'] = self.get_ip_address_from_peer_service_instance(
-            'sbi_network', "SDNControllerServiceInstance", o, 'zmq_sub_ip')
-        fields['zmq_pub_ip'] = self.get_ip_address_from_peer_service_instance(
-            'sbi_network', "SDNControllerServiceInstance", o, 'zmq_pub_ip')
-        fields['dp_comm_ip'] = self.get_ip_address_from_peer_service_instance_instance(
-            'sbi_network', o, o, 'dp_comm_ip')
-        fields['cp_comm_ip'] = self.get_ip_address_from_peer_service_instance(
-            'nbi_network', "VSPGWCTenant", o, 'cp_comm_ip')
-        fields['fpc_ip'] = self.get_ip_address_from_peer_service_instance(
-            'nbi_network', "SDNControllerServiceInstance", o, 'fpc_ip')
-        fields['cp_nb_server_ip'] = self.get_ip_address_from_peer_service_instance(
-            'nbi_network', "VSPGWCTenant", o, 'cp_nb_server_ip')
-
-        # for dp_config.cfg file
-        fields['s1u_ip'] = self.get_ip_address_from_peer_service_instance_instance(
-            's1u_network', o, o, 's1u_ip')
-        fields['sgi_ip'] = self.get_ip_address_from_peer_service_instance_instance(
-            'sgi_network', o, o, 'sgi_ip')
-
-        # for static_arp.cfg file
-        fields['as_sgi_ip'] = self.get_ip_address_from_peer_service_instance(
-            'sgi_network', "VENBServiceInstance", o, 'as_sgi_ip')
-        fields['as_sgi_mac'] = self.get_mac_address_from_peer_service_instance(
-            'sgi_network', "VENBServiceInstance", o, 'as_sgi_mac')
-        fields['enb_s1u_ip'] = self.get_ip_address_from_peer_service_instance(
-            's1u_network', "VENBServiceInstance", o, 'enb_s1u_ip')
-        fields['enb_s1u_mac'] = self.get_mac_address_from_peer_service_instance(
-            's1u_network', "VENBServiceInstance", o, 'enb_s1u_mac')
-
-        return fields
-
-    def get_values_for_emulator_scenario_wo_sdncontroller(self, o):
-        fields = {}
-        fields['scenario'] = "emulator_scenario_without_sdncontroller"
+        fields['cord_version'] = "4.1"
+        fields['scenario'] = "cord_4_1_scenario"
         # for interface.cfg file
         fields['zmq_sub_ip'] = "127.0.0.1"
         fields['zmq_pub_ip'] = "127.0.0.1"
@@ -209,42 +102,11 @@
 
         return fields
 
-    def get_values_for_hardware_scenario(self, o):
+    def get_values_for_CORD_5_0(self, o):
         fields = {}
-        fields['scenario'] = "hardware_scenario"
-        # for interface.cfg file
-        fields['zmq_sub_ip'] = self.get_ip_address_from_peer_service_instance(
-            'sbi_network', "SDNControllerServiceInstance", o, 'zmq_sub_ip')
-        fields['zmq_pub_ip'] = self.get_ip_address_from_peer_service_instance(
-            'sbi_network', "SDNControllerServiceInstance", o, 'zmq_pub_ip')
-        fields['dp_comm_ip'] = self.get_ip_address_from_peer_service_instance_instance(
-            'sbi_network', o, o, 'dp_comm_ip')
-        fields['cp_comm_ip'] = self.get_ip_address_from_peer_service_instance(
-            'nbi_network', "VSPGWCTenant", o, 'cp_comm_ip')
-        fields['fpc_ip'] = self.get_ip_address_from_peer_service_instance(
-            'nbi_network', "SDNControllerServiceInstance", o, 'fpc_ip')
-        fields['cp_nb_server_ip'] = self.get_ip_address_from_peer_service_instance(
-            'nbi_network', "VSPGWCTenant", o, 'cp_nb_server_ip')
+        fields['cord_version'] = "5.0"
+        fields['scenario'] = "cord_5_0_scenario"
 
-        # for dp_config.cfg file
-        fields['s1u_ip'] = self.get_ip_address_from_peer_service_instance_instance(
-            'flat_network_s1u', o, o, 's1u_ip')
-        fields['sgi_ip'] = self.get_ip_address_from_peer_service_instance_instance(
-            'sgi_network', o, o, 'sgi_ip')
-
-        # for static_arp.cfg file
-        fields['as_sgi_ip'] = "manual"
-        fields['as_sgi_mac'] = "manual"
-        fields['enb_s1u_ip'] = self.get_ip_address_from_peer_service_instance(
-            'flat_network_s1u', "VMMETenant", o, 'enb_s1u_ip')
-        fields['enb_s1u_mac'] = self.get_mac_address_from_peer_service_instance(
-            'flat_network_s1u', "VMMETenant", o, 'enb_s1u_mac')
-
-        return fields
-
-    def get_values_for_hardware_scenario_wo_sdncontroller(self, o):
-        fields = {}
-        fields['scenario'] = "hardware_scenario_without_sdncontroller"
         # for interface.cfg file
         fields['zmq_sub_ip'] = "127.0.0.1"
         fields['zmq_pub_ip'] = "127.0.0.1"
@@ -255,19 +117,22 @@
         fields['fpc_ip'] = "127.0.0.1"
         fields['cp_nb_server_ip'] = "127.0.0.1"
 
-        # for dp_config.cfg file
+        # for cp_config.cfg file
         fields['s1u_ip'] = self.get_ip_address_from_peer_service_instance_instance(
-            'flat_network_s1u', o, o, 's1u_ip')
+            's1u_network', o, o, 's1u_ip')
         fields['sgi_ip'] = self.get_ip_address_from_peer_service_instance_instance(
             'sgi_network', o, o, 'sgi_ip')
 
         # for static_arp.cfg file
-        fields['as_sgi_ip'] = "manual"
-        fields['as_sgi_mac'] = "manual"
-        fields['enb_s1u_ip'] = self.get_ip_address_from_peer_service_instance(
-            'flat_network_s1u', "VMMETenant", o, 'enb_s1u_ip')
-        fields['enb_s1u_mac'] = self.get_mac_address_from_peer_service_instance(
-            'flat_network_s1u', "VMMETenant", o, 'enb_s1u_mac')
+        internetemulator_flag = self.has_instance("InternetEmulatorServiceInstance", o)
+        if (internetemulator_flag):
+            fields['as_sgi_ip'] = self.get_ip_address_from_peer_service_instance('sgi_network', "InternetEmulatorServiceInstance", o, 'as_sgi_ip')
+            fields['as_sgi_mac'] = self.get_mac_address_from_peer_service_instance('sgi_network', "InternetEmulatorServiceInstance", o, 'as_sgi_mac')
+        else:
+            fields['as_sgi_ip'] = o.appserver_ip_addr
+            fields['as_sgi_mac'] = o.appserver_mac_addr
+        fields['enb_s1u_ip'] = o.enodeb_ip_addr # write down eNB IP address manually (S1U)
+        fields['enb_s1u_mac'] = o.enodeb_mac_addr # write down eNB MAC address manually (S1U)
 
         return fields
 
@@ -290,25 +155,27 @@
             "SDNControllerServiceInstance", o)
         vspgwc_flag = self.has_instance("VSPGWCTenant", o)
         internetemulator_flag = self.has_instance(
-            "SDNControllerServiceInstance", o)
+            "InternetEmulatorServiceInstance", o)
+        vhss_flag = self.has_instance("VHSSTenant", o)
+        hssdb_flag = self.has_instance("HSSDBServiceInstance", o)
 
-        if vmme_flag and venb_flag and sdncontroller_flag and vspgwc_flag and internetemulator_flag:
-            return 'normal_scenario'
+        if (o.blueprint == "build") or (o.blueprint == "MCORD 4.1"):
+            if not venb_flag:
+                self.defer_sync(o, "Waiting for eNB image to become available")
+            if not vspgwc_flag:
+                self.defer_sync(o, "Waiting for SPGWC image to become available")
+            return 'cord_4_1_scenario'
 
-        if vmme_flag and venb_flag and (not sdncontroller_flag) and vspgwc_flag and internetemulator_flag:
-            return 'normal_scenario_without_sdncontroller'
-
-        if (not vmme_flag) and venb_flag and sdncontroller_flag and vspgwc_flag and (not internetemulator_flag):
-            return 'emulator_scenario'
-
-        if (not vmme_flag) and venb_flag and (not sdncontroller_flag) and vspgwc_flag and (not internetemulator_flag):
-            return 'emulator_scenario_without_sdncontroller'
-
-        if vmme_flag and sdncontroller_flag and vspgwc_flag and (not internetemulator_flag):
-            return 'hardware_scenario'
-
-        if vmme_flag and (not sdncontroller_flag) and vspgwc_flag and (not internetemulator_flag):
-            return 'hardware_scenario_without_sdncontroller'
+        if (o.blueprint == "mcord_5") or (o.blueprint == "MCORD 5"):
+            if not hssdb_flag:
+                self.defer_sync(o, "Waiting for HSS_DB image to become available")
+            if not vhss_flag:
+                self.defer_sync(o, "Waiting for vHSS image to become available")
+            if not vmme_flag:
+                self.defer_sync(o, "Waiting for vMME image to become available")
+            if not vspgwc_flag:
+                self.defer_sync(o, "Waiting for vSPGWC image to become available")
+            return 'cord_5_0_scenario'
 
         return 'manual'
 
diff --git a/xos/synchronizer/steps/vspgwutenant_playbook.yaml b/xos/synchronizer/steps/vspgwutenant_playbook.yaml
index 0d0a429..f04a5b4 100644
--- a/xos/synchronizer/steps/vspgwutenant_playbook.yaml
+++ b/xos/synchronizer/steps/vspgwutenant_playbook.yaml
@@ -21,7 +21,8 @@
   become_user: root
   become_method: sudo
   vars:
-    - source_path: /root/ngic
+    - source_path_4_1: /root/ngic
+    - source_path_5_0: /home/ngic/ngic
     - zmq_sub_ip: {{ zmq_sub_ip }}
     - zmq_pub_ip: {{ zmq_pub_ip }}
     - dp_comm_ip: {{ dp_comm_ip }}
@@ -35,9 +36,12 @@
     - as_sgi_mac: {{ as_sgi_mac }}
     - enb_s1u_ip: {{ enb_s1u_ip }}
     - enb_s1u_mac: {{ enb_s1u_mac }}
+    - cord_version: {{ cord_version }}
 
   roles:
-    - interface_config
-    #- build_and_run #Temporally comment out until epc-service is completed.
+    - { role: interface_config_4_1, when: cord_version == "4.1" }
+    - { role: build_and_run_4_1, when: cord_version == "4.1" }
+    - { role: interface_config_5_0, when: cord_version == "5.0" }
+    - { role: build_and_run_5_0, when: cord_version == "5.0" }
 
 
diff --git a/xos/vspgwu.xproto b/xos/vspgwu.xproto
index 64c07d9..a914988 100644
--- a/xos/vspgwu.xproto
+++ b/xos/vspgwu.xproto
@@ -16,6 +16,11 @@
 message VSPGWUTenant (TenantWithContainer){
     option verbose_name = "Virtual Serving Gateway User Plane Service Instance";
 
-    optional manytoone vspgwu_vendor->VSPGWUVendor:vendor_tenants = 1 [help_text = "select vendor of choice, leave blank for slice default", db_index = True, null = True, blank = True]; 
+    optional manytoone vspgwu_vendor->VSPGWUVendor:vendor_tenants = 1 [help_text = "select vendor of choice, leave blank for slice default", db_index = True, null = True, blank = True];
+    optional string enodeb_ip_addr = 2 [help_text = "external eNodeB IP address (for 5.0)", default = "127.0.0.1", max_length = 32, null = True, db_index = False, blank = True];
+    optional string enodeb_mac_addr = 3 [help_text = "external eNodeB MAC address (for 5.0)", default = "11:11:11:11:11:11", max_length = 32, null = True, db_index = False, blank = True];
+    optional string appserver_ip_addr = 4 [help_text = "external app server IP address (for 5.0)", default = "127.0.0.1", max_length = 32, null = True, db_index = False, blank = True];
+    optional string appserver_mac_addr = 5 [help_text = "external app server MAC address (for 5.0)", default = "11:11:11:11:11:11", max_length = 32, null = True, db_index = False, blank = True];
+    optional string blueprint = 6 [help_text = "name of blueprint", default = "manual", max_length = 32, null = True, db_index = False, blank = True];
 }