diff options
-rw-r--r-- | catalog/packages/tests/test_nf.py | 10 | ||||
-rw-r--r-- | catalog/packages/tests/test_ns.py | 4 | ||||
-rw-r--r-- | catalog/pub/database/models.py | 18 | ||||
-rw-r--r-- | catalog/pub/msapi/sdc.py | 2 | ||||
-rw-r--r-- | catalog/pub/utils/toscaparser/basemodel.py | 12 | ||||
-rw-r--r-- | catalog/pub/utils/toscaparser/vnfdmodel.py | 4 | ||||
-rw-r--r-- | tox.ini | 2 |
7 files changed, 30 insertions, 22 deletions
diff --git a/catalog/packages/tests/test_nf.py b/catalog/packages/tests/test_nf.py index 30c7e02c..6e3fc118 100644 --- a/catalog/packages/tests/test_nf.py +++ b/catalog/packages/tests/test_nf.py @@ -315,7 +315,15 @@ class TestNfPackage(TestCase): resp = self.client.get("/api/catalog/v1/vnfpackages") self.assertEqual(resp.status_code, status.HTTP_200_OK) - self.assertEqual({"csars": [{"csarId":"3", "vnfdId": "4"}]}, resp.data) + expect_data = { + "csars": [ + { + "csarId": "3", + "vnfdId": "4" + } + ] + } + self.assertEqual(expect_data, resp.data) def test_nf_pkg_get_one(self): VnfPackageModel(vnfPackageId="4", vnfdId="5", vnfVendor="6", diff --git a/catalog/packages/tests/test_ns.py b/catalog/packages/tests/test_ns.py index d8894c1d..f76886c9 100644 --- a/catalog/packages/tests/test_ns.py +++ b/catalog/packages/tests/test_ns.py @@ -92,7 +92,7 @@ class TestNsPackage(TestCase): "version": "1.0", "management_address": "111111", "id": "m6000_s", - "nsh_aware": False + "nsh_aware": False } } ], @@ -216,7 +216,7 @@ class TestNsPackage(TestCase): "vnfd_version": "1.0.0", "externalPluginManageNetworkName": "vlan_4007_plugin_net", "id": "vcpe_vfw_zte_1_0", - "request_reclassification": False + "request_reclassification": False }, "dependencies": [ { diff --git a/catalog/pub/database/models.py b/catalog/pub/database/models.py index 50976f71..858c48d6 100644 --- a/catalog/pub/database/models.py +++ b/catalog/pub/database/models.py @@ -20,11 +20,11 @@ class NSPackageModel(models.Model): nsPackageUri = models.CharField(db_column='NSPACKAGEURI', max_length=300, null=True, blank=True) checksum = models.CharField(db_column='CHECKSUM', max_length=50, null=True, blank=True) # checksum sdcCsarId = models.CharField(db_column='SDCCSARID', max_length=50, null=True, blank=True) # SdcCSARUri - operationalState = models.CharField(db_column='OPERATIONALSTATE', max_length=20, blank=True,null=True) # operationalState + operationalState = models.CharField(db_column='OPERATIONALSTATE', max_length=20, blank=True, null=True) # operationalState usageState = models.CharField(db_column='USAGESTATE', max_length=20, blank=True, null=True) # usageState deletionPending = models.CharField(db_column='DELETIONPENDING', max_length=20, blank=True, null=True) # deletionPending - nsdId = models.CharField(db_column='NSDID', max_length=50,blank=True, null=True) - nsdName = models.CharField(db_column='NSDNAME', max_length=50,blank=True, null=True) + nsdId = models.CharField(db_column='NSDID', max_length=50, blank=True, null=True) + nsdName = models.CharField(db_column='NSDNAME', max_length=50, blank=True, null=True) nsdDesginer = models.CharField(db_column='NSDDESIGNER', max_length=50, null=True, blank=True) nsdDescription = models.CharField(db_column='NSDDESCRIPTION', max_length=100, null=True, blank=True) nsdVersion = models.CharField(db_column='NSDVERSION', max_length=20, null=True, blank=True) @@ -42,14 +42,14 @@ class VnfPackageModel(models.Model): vnfPackageUri = models.CharField(db_column='VNFPACKAGEURI', max_length=300, null=True, blank=True) # downloadUri SdcCSARUri = models.CharField(db_column='SDCCSARURI', max_length=300, null=True, blank=True) # SdcCSARUri checksum = models.CharField(db_column='CHECKSUM', max_length=50, null=True, blank=True) # checksum - operationalState = models.CharField(db_column='OPERATIONALSTATE', max_length=20, blank=True,null=True) # operationalState + operationalState = models.CharField(db_column='OPERATIONALSTATE', max_length=20, blank=True, null=True) # operationalState usageState = models.CharField(db_column='USAGESTATE', max_length=20, blank=True, null=True) # usageState deletionPending = models.CharField(db_column='DELETIONPENDING', max_length=20, blank=True, null=True) # deletionPending - vnfdId = models.CharField(db_column='VNFDID', max_length=50,blank=True, null=True) # vnfdId - vnfVendor = models.CharField(db_column='VENDOR', max_length=50,blank=True, null=True) # vnfProvider - vnfdProductName = models.CharField(db_column='VNFDPRODUCTNAME', max_length=50,blank=True, null=True) # vnfProductName - vnfdVersion = models.CharField(db_column='VNFDVERSION', max_length=20,blank=True, null=True) # vnfdVersion - vnfSoftwareVersion = models.CharField(db_column='VNFSOFTWAREVERSION', max_length=20,blank=True, null=True) # vnfSoftwareVersion + vnfdId = models.CharField(db_column='VNFDID', max_length=50, blank=True, null=True) # vnfdId + vnfVendor = models.CharField(db_column='VENDOR', max_length=50, blank=True, null=True) # vnfProvider + vnfdProductName = models.CharField(db_column='VNFDPRODUCTNAME', max_length=50, blank=True, null=True) # vnfProductName + vnfdVersion = models.CharField(db_column='VNFDVERSION', max_length=20, blank=True, null=True) # vnfdVersion + vnfSoftwareVersion = models.CharField(db_column='VNFSOFTWAREVERSION', max_length=20, blank=True, null=True) # vnfSoftwareVersion userDefinedData = models.TextField(db_column='USERDEFINEDDATA', max_length=1024, blank=True, null=True) # userDefinedData localFilePath = models.CharField(db_column='LOCALFILEPATH', max_length=300, null=True, blank=True) vnfdModel = models.TextField(db_column='VNFDMODEL', max_length=65535, blank=True, null=True) # vnfd diff --git a/catalog/pub/msapi/sdc.py b/catalog/pub/msapi/sdc.py index 059adae7..8cf56324 100644 --- a/catalog/pub/msapi/sdc.py +++ b/catalog/pub/msapi/sdc.py @@ -22,7 +22,7 @@ from catalog.pub.config.config import SDC_BASE_URL, SDC_USER, SDC_PASSWD logger = logging.getLogger(__name__) -ASSETTYPE_RESOURCES = "resources" +ASSETTYPE_RESOURCES = "resources" ASSETTYPE_SERVICES = "services" diff --git a/catalog/pub/utils/toscaparser/basemodel.py b/catalog/pub/utils/toscaparser/basemodel.py index 61be0d3c..91dfc7d8 100644 --- a/catalog/pub/utils/toscaparser/basemodel.py +++ b/catalog/pub/utils/toscaparser/basemodel.py @@ -49,7 +49,7 @@ class BaseInfoModel(object): valid_params = {} if params and len(params) > 0: tmp = self._create_tosca_template(path, None) - for key,value in params.items(): + for key, value in params.items(): if hasattr(tmp, 'inputs') and len(tmp.inputs) > 0: for input_def in tmp.inputs: if (input_def.name == key): @@ -195,19 +195,19 @@ class BaseInfoModel(object): def buildCapabilities(self, nodeTemplate, inputs, ret): capabilities = json.dumps(nodeTemplate.entity_tpl.get('capabilities', None)) - match = re.findall(r'\{"get_input":\s*"([\w|\-]+)"\}',capabilities) + match = re.findall(r'\{"get_input":\s*"([\w|\-]+)"\}', capabilities) for m in match: aa = [input_def for input_def in inputs if m == input_def.name][0] - capabilities = re.sub(r'\{"get_input":\s*"([\w|\-]+)"\}', json.dumps(aa.default), capabilities,1) + capabilities = re.sub(r'\{"get_input":\s*"([\w|\-]+)"\}', json.dumps(aa.default), capabilities, 1) if capabilities != 'null': ret['capabilities'] = json.loads(capabilities) def buildArtifacts(self, nodeTemplate, inputs, ret): artifacts = json.dumps(nodeTemplate.entity_tpl.get('artifacts', None)) - match = re.findall(r'\{"get_input":\s*"([\w|\-]+)"\}',artifacts) + match = re.findall(r'\{"get_input":\s*"([\w|\-]+)"\}', artifacts) for m in match: aa = [input_def for input_def in inputs if m == input_def.name][0] - artifacts = re.sub(r'\{"get_input":\s*"([\w|\-]+)"\}', json.dumps(aa.default), artifacts,1) + artifacts = re.sub(r'\{"get_input":\s*"([\w|\-]+)"\}', json.dumps(aa.default), artifacts, 1) if artifacts != 'null': ret['artifacts'] = json.loads(artifacts) @@ -267,7 +267,7 @@ class BaseInfoModel(object): for item in node['requirements']: for key, value in item.items(): if key.upper().find('VIRTUALLINK') >= 0: - rets.append({"key_name":key, "vl_id":self.get_requirement_node_name(value)}) + rets.append({"key_name": key, "vl_id": self.get_requirement_node_name(value)}) return rets def _verify_value(self, value, inputs, parsed_params): diff --git a/catalog/pub/utils/toscaparser/vnfdmodel.py b/catalog/pub/utils/toscaparser/vnfdmodel.py index c4d37172..80722f7f 100644 --- a/catalog/pub/utils/toscaparser/vnfdmodel.py +++ b/catalog/pub/utils/toscaparser/vnfdmodel.py @@ -295,8 +295,8 @@ class EtsiVnfdInfoModel(EtsiNsdInfoModel): policies = [] scaling_policies = self.get_scaling_policies(top_policies) healing_policies = self.get_healing_policies(top_policies) - policies.append({"scaling":scaling_policies, 'healing':healing_policies}) + policies.append({"scaling": scaling_policies, 'healing': healing_policies}) return policies def get_healing_policies(self, top_policies): - return self.get_policies_by_keyword(top_policies,'.HEALING') + return self.get_policies_by_keyword(top_policies, '.HEALING') @@ -6,7 +6,7 @@ skipsdist = true downloadcache = ~/cache/pip [flake8] -ignore = E501,E231,W291 +ignore = E501 exclude = ./venv-tox,./.tox [testenv] |