- self._apiResource = '/netslice_instances'
- self._apiBase = '{}{}{}'.format(self._apiName,
- self._apiVersion, self._apiResource)
- endpoint = '{}/{}/{}'.format(self._apiBase, nsi['_id'], op_name)
- #print('OP_NAME: {}'.format(op_name))
- #print('OP_DATA: {}'.format(json.dumps(op_data)))
- http_code, resp = self._http.post_cmd(endpoint=endpoint, postfields_dict=op_data)
- #print('HTTP CODE: {}'.format(http_code))
- #print('RESP: {}'.format(resp))
- if http_code in (200, 201, 202, 204):
- if resp:
- resp = json.loads(resp)
- if not resp or 'id' not in resp:
- raise ClientException('unexpected response from server - {}'.format(
- resp))
- print(resp['id'])
- else:
- msg = ""
- if resp:
- try:
- msg = json.loads(resp)
- except ValueError:
- msg = resp
- raise ClientException(msg)
+ self._apiResource = "/netslice_instances"
+ self._apiBase = "{}{}{}".format(
+ self._apiName, self._apiVersion, self._apiResource
+ )
+ endpoint = "{}/{}/{}".format(self._apiBase, nsi["_id"], op_name)
+ # print('OP_NAME: {}'.format(op_name))
+ # print('OP_DATA: {}'.format(json.dumps(op_data)))
+ http_code, resp = self._http.post_cmd(
+ endpoint=endpoint, postfields_dict=op_data
+ )
+ # print('HTTP CODE: {}'.format(http_code))
+ # print('RESP: {}'.format(resp))
+ # if http_code in (200, 201, 202, 204):
+ if resp:
+ resp = json.loads(resp)
+ if not resp or "id" not in resp:
+ raise ClientException(
+ "unexpected response from server - {}".format(resp)
+ )
+ print(resp["id"])
+ # else:
+ # msg = ""
+ # if resp:
+ # try:
+ # msg = json.loads(resp)
+ # except ValueError:
+ # msg = resp
+ # raise ClientException(msg)