Updates for ssl sdc
[integration.git] / test / vcpe / vcpe.py
index f9c1778..3221d48 100755 (executable)
@@ -1,6 +1,9 @@
 #! /usr/bin/python
-import sys
+
 import logging
+logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s %(name)s.%(funcName)s(): %(message)s')
+
+import sys
 from vcpecommon import *
 import sdcutils
 import soutils
@@ -57,7 +60,6 @@ def create_one_service(vcpecommon, csar_file, vnf_template_file, preload_dict, s
 
 
 def deploy_brg_only():
-    logging.basicConfig(level=logging.INFO, format='%(message)s')
     logger = logging.getLogger(__name__)
 
     vcpecommon = VcpeCommon()
@@ -153,9 +155,6 @@ def deploy_custom_service():
 
 
 def closed_loop(lossrate=0):
-    if lossrate > 0:
-        while 'y' != raw_input('Please enter docker container "drools" in Policy VM and type "policy stop". Then enter y here: ').lower():
-            continue
     nodes = ['brg', 'mux']
     logger = logging.getLogger('__name__')
     vcpecommon = VcpeCommon(nodes)
@@ -172,7 +171,7 @@ def closed_loop(lossrate=0):
     time.sleep(2)
     vcpecommon.set_vgmux_packet_loss_rate(lossrate, vcpecommon.load_vgmux_vnf_name())
     if lossrate > 0:
-        print('Please enter docker container "drools" in Policy VM and type "policy start". Then observe vGMUX being restarted.')
+        print('Now please observe vGMUX being restarted')
 
 
 def init_so_sdnc():
@@ -183,10 +182,22 @@ def init_so_sdnc():
     vgw_vfmod_name_index=  0
     vcpecommon.save_object(vgw_vfmod_name_index, vcpecommon.vgw_vfmod_name_index_file)
 
-def download_vcpe_service_templates():
+
+def init():
     vcpecommon = VcpeCommon()
+    init_sdc(vcpecommon)
+    download_vcpe_service_templates(vcpecommon)
+
+
+def init_sdc(vcpecommon):
     sdc = sdcutils.SdcUtils(vcpecommon)
-    sdc.get_service_list()
+    sdc.create_allotted_resource_subcategory('BRG')
+
+
+def download_vcpe_service_templates(vcpecommon):
+    sdc = sdcutils.SdcUtils(vcpecommon)
+    sdc.download_vcpe_service_template()
+
 
 def tmp_sniro():
     logger = logging.getLogger(__name__)
@@ -197,13 +208,13 @@ def tmp_sniro():
     # Setting up SNIRO
     config_sniro(vcpecommon, svc_instance_uuid['gmux'], svc_instance_uuid['brg'])
 
+
 def test(): 
     vcpecommon = VcpeCommon()
     print("oom-k8s-04 public ip: %s" % (vcpecommon.get_vm_public_ip_by_nova('oom-k8s-04')))
 
-if __name__ == '__main__':
-    logging.basicConfig(level=logging.DEBUG, format='%(message)s')
 
+if __name__ == '__main__':
     print('----------------------------------------------------------------------------------------------------')
     print(' vcpe.py:            Brief info about this program')
 #    print(' vcpe.py sdc:        Onboard VNFs, design and distribute vCPE services (under development)')
@@ -220,9 +231,7 @@ if __name__ == '__main__':
     if sys.argv[1] == 'sdc':
         print('Under development')
     elif sys.argv[1] == 'init':
-        if 'y' == raw_input('Ready to add customer service data to SDNC and SO DBs? This is needed only once.'
-                            'y/n: ').lower():
-            download_vcpe_service_templates()
+            init()
             init_so_sdnc()
     elif sys.argv[1] == 'infra':
         if 'y' == raw_input('Ready to deploy infrastructure? y/n: ').lower():