diff options
-rw-r--r-- | catalog/packages/nf_package.py | 2 | ||||
-rw-r--r-- | catalog/packages/ns_package.py | 2 | ||||
-rw-r--r-- | catalog/packages/tests/test_nf.py | 10 | ||||
-rw-r--r-- | catalog/packages/tests/test_ns.py | 18 | ||||
-rw-r--r-- | catalog/packages/urls.py | 2 | ||||
-rw-r--r-- | catalog/pub/config/config.py | 7 | ||||
-rw-r--r-- | catalog/pub/utils/restcall.py | 3 | ||||
-rw-r--r-- | catalog/pub/utils/values.py | 1 | ||||
-rw-r--r-- | tox.ini | 2 |
9 files changed, 18 insertions, 29 deletions
diff --git a/catalog/packages/nf_package.py b/catalog/packages/nf_package.py index a0e163a2..f4c1c60a 100644 --- a/catalog/packages/nf_package.py +++ b/catalog/packages/nf_package.py @@ -134,7 +134,7 @@ class NfDistributeThread(threading.Thread): vnfdModel=vnfd_json, localFilePath=local_file_name, vnfPackageUri=csar_name - ).save() + ).save() JobUtil.add_job_status(self.job_id, 100, "CSAR(%s) distribute successfully." % self.csar_id) diff --git a/catalog/packages/ns_package.py b/catalog/packages/ns_package.py index b8ca44e2..bd700b96 100644 --- a/catalog/packages/ns_package.py +++ b/catalog/packages/ns_package.py @@ -141,7 +141,7 @@ class NsPackage(object): sdcCsarId=csar_id, localFilePath=local_file_name, nsdModel=nsd_json - ).save() + ).save() return [0, "CSAR(%s) distributed successfully." % csar_id] diff --git a/catalog/packages/tests/test_nf.py b/catalog/packages/tests/test_nf.py index 131104cd..709ec5cb 100644 --- a/catalog/packages/tests/test_nf.py +++ b/catalog/packages/tests/test_nf.py @@ -252,7 +252,7 @@ class TestNfPackage(TestCase): resp = self.client.post("/api/catalog/v1/vnfpackages", { "csarId": "1", "vimIds": ["1"] - }, format='json') + }, format='json') self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED) def test_nf_pkg_distribute_when_csar_already_exist(self): @@ -267,13 +267,13 @@ class TestNfPackage(TestCase): @mock.patch.object(sdc, 'download_artifacts') @mock.patch.object(toscaparser, 'parse_vnfd') def test_nf_pkg_distribute_when_vnfd_already_exist(self, - mock_parse_vnfd, mock_download_artifacts, mock_call_req): + mock_parse_vnfd, mock_download_artifacts, mock_call_req): mock_parse_vnfd.return_value = json.JSONEncoder().encode(self.vnfd_data) mock_download_artifacts.return_value = "/home/hss.csar" mock_call_req.return_value = [0, json.JSONEncoder().encode([{ "uuid": "1", "toscaModelURL": "https://127.0.0.1:1234/sdc/v1/hss.csar" - }]), '200'] + }]), '200'] VnfPackageModel(vnfPackageId="2", vnfdId="zte-hss-1.0").save() NfDistributeThread(csar_id="1", vim_ids=["1"], @@ -285,13 +285,13 @@ class TestNfPackage(TestCase): @mock.patch.object(sdc, 'download_artifacts') @mock.patch.object(toscaparser, 'parse_vnfd') def test_nf_pkg_distribute_successfully(self, - mock_parse_vnfd, mock_download_artifacts, mock_call_req): + mock_parse_vnfd, mock_download_artifacts, mock_call_req): mock_parse_vnfd.return_value = json.JSONEncoder().encode(self.vnfd_data) mock_download_artifacts.return_value = "/home/hss.csar" mock_call_req.return_value = [0, json.JSONEncoder().encode([{ "uuid": "1", "toscaModelURL": "https://127.0.0.1:1234/sdc/v1/hss.csar" - }]), '200'] + }]), '200'] NfDistributeThread(csar_id="1", vim_ids=["1"], lab_vim_id="", diff --git a/catalog/packages/tests/test_ns.py b/catalog/packages/tests/test_ns.py index c5214b6b..10c0ff97 100644 --- a/catalog/packages/tests/test_ns.py +++ b/catalog/packages/tests/test_ns.py @@ -404,14 +404,14 @@ class TestNsPackage(TestCase): @mock.patch.object(restcall, 'call_req') @mock.patch.object(sdc, 'download_artifacts') @mock.patch.object(toscaparser, 'parse_nsd') - def test_ns_pkg_distribute_when_nsd_already_exists(self, - mock_parse_nsd, mock_download_artifacts, mock_call_req): + def test_ns_pkg_distribute_when_nsd_already_exists(self, + mock_parse_nsd, mock_download_artifacts, mock_call_req): mock_parse_nsd.return_value = json.JSONEncoder().encode(self.nsd_data) mock_download_artifacts.return_value = "/home/vcpe.csar" mock_call_req.return_value = [0, json.JSONEncoder().encode([{ "uuid": "1", "toscaModelURL": "https://127.0.0.1:1234/sdc/v1/vcpe.csar" - }]), '200'] + }]), '200'] NSPackageModel(nsPackageId="2", nsdId="VCPE_NS").save() resp = self.client.post("/api/catalog/v1/nspackages", {"csarId": "1"}, format='json') self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED) @@ -421,14 +421,14 @@ class TestNsPackage(TestCase): @mock.patch.object(restcall, 'call_req') @mock.patch.object(sdc, 'download_artifacts') @mock.patch.object(toscaparser, 'parse_nsd') - def test_ns_pkg_distribute_when_nf_not_distributed(self, - mock_parse_nsd, mock_download_artifacts, mock_call_req): + def test_ns_pkg_distribute_when_nf_not_distributed(self, + mock_parse_nsd, mock_download_artifacts, mock_call_req): mock_parse_nsd.return_value = json.JSONEncoder().encode(self.nsd_data) mock_download_artifacts.return_value = "/home/vcpe.csar" mock_call_req.return_value = [0, json.JSONEncoder().encode([{ "uuid": "1", "toscaModelURL": "https://127.0.0.1:1234/sdc/v1/vcpe.csar" - }]), '200'] + }]), '200'] resp = self.client.post("/api/catalog/v1/nspackages", {"csarId": "1"}, format='json') self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED) self.assertEqual("failed", resp.data["status"]) @@ -437,14 +437,14 @@ class TestNsPackage(TestCase): @mock.patch.object(restcall, 'call_req') @mock.patch.object(sdc, 'download_artifacts') @mock.patch.object(toscaparser, 'parse_nsd') - def test_ns_pkg_distribute_when_successfully(self, - mock_parse_nsd, mock_download_artifacts, mock_call_req): + def test_ns_pkg_distribute_when_successfully(self, + mock_parse_nsd, mock_download_artifacts, mock_call_req): mock_parse_nsd.return_value = json.JSONEncoder().encode(self.nsd_data) mock_download_artifacts.return_value = "/home/vcpe.csar" mock_call_req.return_value = [0, json.JSONEncoder().encode([{ "uuid": "1", "toscaModelURL": "https://127.0.0.1:1234/sdc/v1/vcpe.csar" - }]), '200'] + }]), '200'] VnfPackageModel(vnfPackageId="1", vnfdId="vcpe_vfw_zte_1_0").save() resp = self.client.post("/api/catalog/v1/nspackages", {"csarId": "1"}, format='json') self.assertEqual(resp.status_code, status.HTTP_202_ACCEPTED) diff --git a/catalog/packages/urls.py b/catalog/packages/urls.py index a2b9f9d5..f0383698 100644 --- a/catalog/packages/urls.py +++ b/catalog/packages/urls.py @@ -24,5 +24,3 @@ urlpatterns = [ url(r'^api/catalog/v1/parsernsd$', views.ns_model_parser, name='nsmodelparser_rc'), url(r'^api/catalog/v1/parservnfd$', views.vnf_model_parser, name='vnfmodelparser_rc'), ] - - diff --git a/catalog/pub/config/config.py b/catalog/pub/config/config.py index 4a3618b3..b89620d6 100644 --- a/catalog/pub/config/config.py +++ b/catalog/pub/config/config.py @@ -52,10 +52,3 @@ CATALOG_URL_PATH = None SDC_BASE_URL = "https://127.0.0.1:8443/api/sdc/v1" SDC_USER = "SDC" SDC_PASSWD = "SDC" - - - - - - - diff --git a/catalog/pub/utils/restcall.py b/catalog/pub/utils/restcall.py index 2825a0cb..df40d937 100644 --- a/catalog/pub/utils/restcall.py +++ b/catalog/pub/utils/restcall.py @@ -29,8 +29,7 @@ HTTP_404_NOTFOUND, HTTP_403_FORBIDDEN, HTTP_401_UNAUTHORIZED, HTTP_400_BADREQUES logger = logging.getLogger(__name__) -def call_req(base_url, user, passwd, auth_type, resource, method, - content='', additional_headers={}): +def call_req(base_url, user, passwd, auth_type, resource, method, content='', additional_headers={}): callid = str(uuid.uuid1()) logger.debug("[%s]call_req('%s','%s','%s',%s,'%s','%s','%s')" % ( callid, base_url, user, passwd, auth_type, resource, method, content)) diff --git a/catalog/pub/utils/values.py b/catalog/pub/utils/values.py index e3ac599e..0fd2d1ac 100644 --- a/catalog/pub/utils/values.py +++ b/catalog/pub/utils/values.py @@ -22,4 +22,3 @@ def ignore_case_get(args, key, def_val=""): if old_key.upper() == key.upper(): return args[old_key] return def_val - @@ -6,7 +6,7 @@ skipsdist = true downloadcache = ~/cache/pip [flake8] -ignore = E501,E231,E128,W291,W293,E711,E303,E701,E225,E303,E302,E126,E203,F841,E123,E125,W391 +ignore = E501,E231,E128,W291,W293,E711,E303,E701,E225,E303,E302,E126,E203,F841 exclude = ./venv-tox,./.tox [testenv] |