diff options
author | 2019-05-04 15:51:36 -0400 | |
---|---|---|
committer | 2019-05-04 16:33:51 -0400 | |
commit | 158df8f73cb2988031cd408939681d3ade443b2f (patch) | |
tree | aaa0faca916a105adef1eb734d3e7dd528cfb7a3 /robotframework-onap/vcpeutils/csar_parser.py | |
parent | 8ad85420e45ffeafb536de55b31ad68c0d03c986 (diff) |
fix vcpeutils
removed relative imports and using the preferred method of importing.
use the open instead of file method to get files
use the new pyaml method that specifies the loader
use builtins.basestring for unicode and nonunicode comparison
use the correct method to call the robot framework logger warn
adding in unit tests for things to make sure they work
Change-Id: I15da74ff66988ef2610ada3ae21a1c6104c26c35
Issue-ID: INT-1061
Signed-off-by: DR695H <dr695h@att.com>
Diffstat (limited to 'robotframework-onap/vcpeutils/csar_parser.py')
-rwxr-xr-x | robotframework-onap/vcpeutils/csar_parser.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/robotframework-onap/vcpeutils/csar_parser.py b/robotframework-onap/vcpeutils/csar_parser.py index 7440310..2adcf63 100755 --- a/robotframework-onap/vcpeutils/csar_parser.py +++ b/robotframework-onap/vcpeutils/csar_parser.py @@ -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') |