[CORD-2441] add hardware scenario on vSPGWU

Change-Id: Ia3ce632f2b23b8e4d641560d07515015fc876a78
diff --git a/xos/synchronizer/steps/sync_vspgwutenant.py b/xos/synchronizer/steps/sync_vspgwutenant.py
index 0ae14fe..d912df0 100644
--- a/xos/synchronizer/steps/sync_vspgwutenant.py
+++ b/xos/synchronizer/steps/sync_vspgwutenant.py
@@ -46,6 +46,10 @@
             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)
         else:
             return self.get_extra_attributes_for_manual(o)
 
@@ -205,6 +209,68 @@
 
         return fields
 
+    def get_values_for_hardware_scenario(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')
+
+        # 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"
+        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 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 has_instance(self, sitype, o):
         try:
             i = self.get_peer_serviceinstance_of_type(sitype, o)
@@ -226,13 +292,6 @@
         internetemulator_flag = self.has_instance(
             "SDNControllerServiceInstance", o)
 
-        # wait until vspgwc and env are comming up
-        if (not vspgwc_flag):
-            self.defer_sync(o, "Waiting for vSPGWc to come up")
-
-        if (not venb_flag):
-            self.defer_sync(o, "Waiting for vENB to come up")
-
         if vmme_flag and venb_flag and sdncontroller_flag and vspgwc_flag and internetemulator_flag:
             return 'normal_scenario'
 
@@ -245,6 +304,12 @@
         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'
+
         return 'manual'
 
     def get_peer_serviceinstance_of_type(self, sitype, o):