JOB_ERROR = 255
+
def nf_get_csars():
ret = None
try:
return [1, str(sys.exc_info())]
return ret
+
def nf_get_csar(csar_id):
ret = None
try:
return [1, str(sys.exc_info())]
return ret
+
def parse_vnfd(csar_id, inputs):
ret= None
try:
return [1, str(sys.exc_info())]
return ret
+
def ns_get_csar(csar_id):
ret = None
try:
return [1, str(sys.exc_info())]
return ret
+
def parse_nsd(csar_id, inputs):
ret= None
try:
"description": "",
"properties": {
"vendor": "zte",
- "request_reclassification": False ,
+ "request_reclassification": False,
"pnf_type": "m6000s",
"version": "1.0",
"management_address": "111111",
"fps": [
{
"properties": {
- "symmetric": False ,
+ "symmetric": False,
"policy": {
"type": "ACL",
"criteria": {
"properties": {
"plugin_info": "vbrasplugin_1.0",
"vendor": "zte",
- "is_shared": False ,
+ "is_shared": False,
"adjust_vnf_capacity": True,
"name": "VFW",
"vnf_extend_type": "driver",
"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",
{
"route_id": "",
"vl_id": "ext_mnet_net",
- "route_external": False ,
+ "route_external": False,
"description": "",
"properties": {
"name": "vlan_4008_mng_net",
{
"route_id": "",
"vl_id": "ext_datanet_net",
- "route_external": False ,
+ "route_external": False,
"description": "",
"properties": {
"name": "vlan_4004_tunnel_net",
{
"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,
# See the License for the specific language governing permissions and
# limitations under the License.
+
class CatalogException(Exception):
pass
]
"""
+
def get_artifacts(asset_type):
resource = "/sdc/v1/catalog/{assetType}"
resource = resource.format(assetType=asset_type)
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)
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('/'):
import copy
import ftplib
import json
+import logging
import os
import re
import shutil
from catalog.pub.utils.toscaparser.dataentityext import DataEntityExt
+logger = logging.getLogger(__name__)
+
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 = {}
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")):
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):
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')
from toscaparser.elements.constraints import Schema
from toscaparser.common.exception import ExceptionCollector
+
class DataEntityExt(object):
'''A complex data value entity ext.'''
@staticmethod
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]