aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog/packages/nf_package.py3
-rw-r--r--catalog/packages/ns_package.py2
-rw-r--r--catalog/packages/tests/test_ns.py16
-rw-r--r--catalog/pub/exceptions.py1
-rw-r--r--catalog/pub/msapi/sdc.py1
-rw-r--r--catalog/pub/utils/restcall.py2
-rw-r--r--catalog/pub/utils/toscaparser/basemodel.py18
-rw-r--r--catalog/pub/utils/toscaparser/dataentityext.py1
-rw-r--r--tox.ini2
9 files changed, 30 insertions, 16 deletions
diff --git a/catalog/packages/nf_package.py b/catalog/packages/nf_package.py
index f4c1c60a..b6524c8e 100644
--- a/catalog/packages/nf_package.py
+++ b/catalog/packages/nf_package.py
@@ -32,6 +32,7 @@ logger = logging.getLogger(__name__)
JOB_ERROR = 255
+
def nf_get_csars():
ret = None
try:
@@ -43,6 +44,7 @@ def nf_get_csars():
return [1, str(sys.exc_info())]
return ret
+
def nf_get_csar(csar_id):
ret = None
try:
@@ -54,6 +56,7 @@ def nf_get_csar(csar_id):
return [1, str(sys.exc_info())]
return ret
+
def parse_vnfd(csar_id, inputs):
ret= None
try:
diff --git a/catalog/packages/ns_package.py b/catalog/packages/ns_package.py
index bd700b96..32de239d 100644
--- a/catalog/packages/ns_package.py
+++ b/catalog/packages/ns_package.py
@@ -72,6 +72,7 @@ def ns_get_csars():
return [1, str(sys.exc_info())]
return ret
+
def ns_get_csar(csar_id):
ret = None
try:
@@ -83,6 +84,7 @@ def ns_get_csar(csar_id):
return [1, str(sys.exc_info())]
return ret
+
def parse_nsd(csar_id, inputs):
ret= None
try:
diff --git a/catalog/packages/tests/test_ns.py b/catalog/packages/tests/test_ns.py
index 10c0ff97..21a1059f 100644
--- a/catalog/packages/tests/test_ns.py
+++ b/catalog/packages/tests/test_ns.py
@@ -87,7 +87,7 @@ class TestNsPackage(TestCase):
"description": "",
"properties": {
"vendor": "zte",
- "request_reclassification": False ,
+ "request_reclassification": False,
"pnf_type": "m6000s",
"version": "1.0",
"management_address": "111111",
@@ -99,7 +99,7 @@ class TestNsPackage(TestCase):
"fps": [
{
"properties": {
- "symmetric": False ,
+ "symmetric": False,
"policy": {
"type": "ACL",
"criteria": {
@@ -201,7 +201,7 @@ class TestNsPackage(TestCase):
"properties": {
"plugin_info": "vbrasplugin_1.0",
"vendor": "zte",
- "is_shared": False ,
+ "is_shared": False,
"adjust_vnf_capacity": True,
"name": "VFW",
"vnf_extend_type": "driver",
@@ -210,7 +210,7 @@ class TestNsPackage(TestCase):
"csarProvider": "ZTE",
"version": "1.0",
"nsh_aware": True,
- "cross_dc": False ,
+ "cross_dc": False,
"vnf_type": "VFW",
"vmnumber_overquota_alarm": True,
"vnfd_version": "1.0.0",
@@ -246,7 +246,7 @@ class TestNsPackage(TestCase):
{
"route_id": "",
"vl_id": "ext_mnet_net",
- "route_external": False ,
+ "route_external": False,
"description": "",
"properties": {
"name": "vlan_4008_mng_net",
@@ -265,7 +265,7 @@ class TestNsPackage(TestCase):
{
"route_id": "",
"vl_id": "ext_datanet_net",
- "route_external": False ,
+ "route_external": False,
"description": "",
"properties": {
"name": "vlan_4004_tunnel_net",
@@ -284,12 +284,12 @@ class TestNsPackage(TestCase):
{
"route_id": "",
"vl_id": "sfc_data_network",
- "route_external": False ,
+ "route_external": False,
"description": "",
"properties": {
"name": "sfc_data_network",
"dhcp_enabled": True,
- "is_predefined": False ,
+ "is_predefined": False,
"location_info": {
"tenant": "admin",
"vimid": 2,
diff --git a/catalog/pub/exceptions.py b/catalog/pub/exceptions.py
index 876cf07a..c994b46e 100644
--- a/catalog/pub/exceptions.py
+++ b/catalog/pub/exceptions.py
@@ -12,5 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+
class CatalogException(Exception):
pass
diff --git a/catalog/pub/msapi/sdc.py b/catalog/pub/msapi/sdc.py
index 7a046396..56fa2901 100644
--- a/catalog/pub/msapi/sdc.py
+++ b/catalog/pub/msapi/sdc.py
@@ -58,6 +58,7 @@ sample of return value
]
"""
+
def get_artifacts(asset_type):
resource = "/sdc/v1/catalog/{assetType}"
resource = resource.format(assetType=asset_type)
diff --git a/catalog/pub/utils/restcall.py b/catalog/pub/utils/restcall.py
index df40d937..0618755b 100644
--- a/catalog/pub/utils/restcall.py
+++ b/catalog/pub/utils/restcall.py
@@ -86,6 +86,7 @@ def req_by_msb(resource, method, content=''):
base_url = "http://%s:%s/" % (MSB_SERVICE_IP, MSB_SERVICE_PORT)
return call_req(base_url, "", "", rest_no_auth, resource, method, content)
+
def upload_by_msb(resource, method, file_data={}):
headers = {'Content-Type': 'application/octet-stream'}
full_url = "http://%s:%s/%s" % (MSB_SERVICE_IP, MSB_SERVICE_PORT, resource)
@@ -99,6 +100,7 @@ def upload_by_msb(resource, method, file_data={}):
logger.debug("resp_body=%s", resp_body)
return [0, resp_body, resp_status]
+
def combine_url(base_url, resource):
full_url = None
if base_url.endswith('/') and resource.startswith('/'):
diff --git a/catalog/pub/utils/toscaparser/basemodel.py b/catalog/pub/utils/toscaparser/basemodel.py
index 1d6d4865..7a453ecd 100644
--- a/catalog/pub/utils/toscaparser/basemodel.py
+++ b/catalog/pub/utils/toscaparser/basemodel.py
@@ -15,6 +15,7 @@
import copy
import ftplib
import json
+import logging
import os
import re
import shutil
@@ -26,6 +27,8 @@ from toscaparser.tosca_template import ToscaTemplate
from catalog.pub.utils.toscaparser.dataentityext import DataEntityExt
+logger = logging.getLogger(__name__)
+
class BaseInfoModel(object):
@@ -39,8 +42,8 @@ class BaseInfoModel(object):
if file_name != None and file_name != path and os.path.exists(file_name):
try:
os.remove(file_name)
- except Exception, e:
- pass
+ except Exception as e:
+ logger.error("Failed to parse package, error: %s", e.message)
def _validate_input_params(self, path, params):
valid_params = {}
@@ -66,8 +69,8 @@ class BaseInfoModel(object):
if tosca_tpl != None and hasattr(tosca_tpl, "temp_dir") and os.path.exists(tosca_tpl.temp_dir):
try:
shutil.rmtree(tosca_tpl.temp_dir)
- except Exception, e:
- pass
+ except Exception as e:
+ logger.error("Failed to create tosca template, error: %s", e.message)
def _check_download_file(self, path):
if (path.startswith("ftp") or path.startswith("sftp")):
@@ -189,7 +192,7 @@ class BaseInfoModel(object):
if (isinstance(req_value, dict)):
if ('node' in req_value and req_value['node'] not in node_template.templates):
continue # No target requirement for aria parser, not add to result.
- rets.append({req_name : req_value})
+ rets.append({req_name: req_value})
return rets
def buildCapabilities(self, nodeTemplate, inputs, ret):
@@ -227,8 +230,9 @@ class BaseInfoModel(object):
return node['nodeType'].upper().find('.CP.') >= 0 or node['nodeType'].upper().endswith('.CP')
def isVl(self, node):
- return node['nodeType'].upper().find('.VIRTUALLINK.') >= 0 or node['nodeType'].upper().find('.VL.') >= 0 or \
- node['nodeType'].upper().endswith('.VIRTUALLINK') or node['nodeType'].upper().endswith('.VL')
+ isvl = node['nodeType'].upper().find('.VIRTUALLINK.') >= 0 or node['nodeType'].upper().find('.VL.') >= 0
+ isvl = isvl or node['nodeType'].upper().endswith('.VIRTUALLINK') or node['nodeType'].upper().endswith('.VL')
+ return isvl
def isService(self, node):
return node['nodeType'].upper().find('.SERVICE.') >= 0 or node['nodeType'].upper().endswith('.SERVICE')
diff --git a/catalog/pub/utils/toscaparser/dataentityext.py b/catalog/pub/utils/toscaparser/dataentityext.py
index 7db31c74..67e8757b 100644
--- a/catalog/pub/utils/toscaparser/dataentityext.py
+++ b/catalog/pub/utils/toscaparser/dataentityext.py
@@ -16,6 +16,7 @@ from toscaparser.dataentity import DataEntity
from toscaparser.elements.constraints import Schema
from toscaparser.common.exception import ExceptionCollector
+
class DataEntityExt(object):
'''A complex data value entity ext.'''
@staticmethod
diff --git a/tox.ini b/tox.ini
index fb9bdcd9..da52a38b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -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
+ignore = E501,E231,E128,W291,W293,E711,E303,E701,E225,E303
exclude = ./venv-tox,./.tox
[testenv]