message="failed to create ns: {} nsd: {}\nerror:\n{}".format(
nsr_name,
nsd_name,
- exc.message)
+ str(exc))
raise ClientException(message)
def list_op(self, name, filter=None):
except ClientException as exc:
message="failed to get operation list of NS {}:\nerror:\n{}".format(
name,
- exc.message)
+ str(exc))
raise ClientException(message)
def get_op(self, operationId):
except ClientException as exc:
message="failed to get status of operation {}:\nerror:\n{}".format(
operationId,
- exc.message)
+ str(exc))
raise ClientException(message)
- def exec_op(self, name, op_name, op_data=None, wait=False):
+ def exec_op(self, name, op_name, op_data=None, wait=False, ):
"""Executes an operation on a NS
"""
- ns = self.get(name)
try:
+ ns = self.get(name)
self._apiResource = '/ns_instances'
self._apiBase = '{}{}{}'.format(self._apiName,
self._apiVersion, self._apiResource)
# Wait for status for NS instance action
# For the 'action' operation, 'id' is used
self._wait(resp.get('id'))
- print(resp['id'])
+ return resp['id']
else:
msg = ""
if resp:
except ClientException as exc:
message="failed to exec operation {}:\nerror:\n{}".format(
name,
- exc.message)
+ str(exc))
raise ClientException(message)
def scale_vnf(self, ns_name, vnf_name, scaling_group, scale_in, scale_out, wait=False):
"member-vnf-index": vnf_name,
"scaling-group-descriptor": scaling_group,
}
- self.exec_op(ns_name, op_name='scale', op_data=op_data, wait=wait)
+ op_id = self.exec_op(ns_name, op_name='scale', op_data=op_data, wait=wait)
+ print(str(op_id))
except ClientException as exc:
message="failed to scale vnf {} of ns {}:\nerror:\n{}".format(
- vnf_name, ns_name, exc.message)
+ vnf_name, ns_name, str(exc))
raise ClientException(message)
def create_alarm(self, alarm):
except ClientException as exc:
message="failed to create alarm: alarm {}\n{}".format(
alarm,
- exc.message)
+ str(exc))
raise ClientException(message)
def delete_alarm(self, name):
except ClientException as exc:
message="failed to delete alarm: alarm {}\n{}".format(
name,
- exc.message)
+ str(exc))
raise ClientException(message)
def export_metric(self, metric):
except ClientException as exc:
message="failed to export metric: metric {}\n{}".format(
metric,
- exc.message)
+ str(exc))
raise ClientException(message)
def get_field(self, ns_name, field):