fix vcpeutils
[testsuite/python-testing-utils.git] / robotframework-onap / vcpeutils / csar_parser.py
index 7440310..2adcf63 100755 (executable)
@@ -12,8 +12,8 @@ class CsarParser:
         self.logger = logging.getLogger(__name__)
         self.svc_model = {}
         self.net_models = []  # there could be multiple networks
-        self.vnf_models = [] # this version only support a single VNF in the service template
-        self.vfmodule_models = [] # this version only support a single VF module in the service template
+        self.vnf_models = []  # this version only support a single VNF in the service template
+        self.vfmodule_models = []  # this version only support a single VF module in the service template
 
     def get_service_yaml_from_csar(self, csar_file):
         """
@@ -198,7 +198,7 @@ class CsarParser:
         self.vnf_models = []    # this version only support a single VNF in the service template
         self.vfmodule_models = []   # this version only support a single VF module in the service template
 
-        svc_template = yaml.load(file(filename, 'r'))
+        svc_template = yaml.load(open(filename, 'r'), Loader=yaml.Loader)
         self.get_service_model_info(svc_template)
         self.get_vnf_and_network_model_info(svc_template)
         self.get_vfmodule_model_info(svc_template)
@@ -212,19 +212,19 @@ class CsarParser:
 
     def print_models(self):
         print('---------Service Model----------')
-        print((json.dumps(self.svc_model, indent=2, sort_keys=True)))
+        print(json.dumps(self.svc_model, indent=2, sort_keys=True))
 
         print('---------Network Model(s)----------')
         for model in self.net_models:
-            print((json.dumps(model, indent=2, sort_keys=True)))
+            print(json.dumps(model, indent=2, sort_keys=True))
 
         print('---------VNF Model(s)----------')
         for model in self.vnf_models:
-            print((json.dumps(model, indent=2, sort_keys=True)))
+            print(json.dumps(model, indent=2, sort_keys=True))
 
         print('---------VF Module Model(s)----------')
         for model in self.vfmodule_models:
-            print((json.dumps(model, indent=2, sort_keys=True)))
+            print(json.dumps(model, indent=2, sort_keys=True))
 
     def test(self):
         self.parse_csar('csar/service-Vcpesvcinfra111601-csar.csar')