1 # -*- coding: utf-8 -*-
5 from http
import HTTPStatus
7 from copy
import copy
, deepcopy
8 from validation
import validate_input
, ValidationError
, ns_instantiate
, ns_action
, ns_scale
9 from base_topic
import BaseTopic
, EngineException
, get_iterable
10 from descriptor_topics
import DescriptorTopic
12 __author__
= "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
15 class NsrTopic(BaseTopic
):
19 def __init__(self
, db
, fs
, msg
):
20 BaseTopic
.__init
__(self
, db
, fs
, msg
)
22 def _check_descriptor_dependencies(self
, session
, descriptor
):
24 Check that the dependent descriptors exist on a new descriptor or edition
25 :param session: client session information
26 :param descriptor: descriptor to be inserted or edit
27 :return: None or raises exception
29 if not descriptor
.get("nsdId"):
31 nsd_id
= descriptor
["nsdId"]
32 if not self
.get_item_list(session
, "nsds", {"id": nsd_id
}):
33 raise EngineException("Descriptor error at nsdId='{}' references a non exist nsd".format(nsd_id
),
34 http_code
=HTTPStatus
.CONFLICT
)
37 def format_on_new(content
, project_id
=None, make_public
=False):
38 BaseTopic
.format_on_new(content
, project_id
=project_id
, make_public
=make_public
)
39 content
["_admin"]["nsState"] = "NOT_INSTANTIATED"
41 def check_conflict_on_del(self
, session
, _id
, force
=False):
44 nsr
= self
.db
.get_one("nsrs", {"_id": _id
})
45 if nsr
["_admin"].get("nsState") == "INSTANTIATED":
46 raise EngineException("nsr '{}' cannot be deleted because it is in 'INSTANTIATED' state. "
47 "Launch 'terminate' operation first; or force deletion".format(_id
),
48 http_code
=HTTPStatus
.CONFLICT
)
50 def delete(self
, session
, _id
, force
=False, dry_run
=False):
52 Delete item by its internal _id
53 :param session: contains the used login username, working project, and admin rights
54 :param _id: server internal id
55 :param force: indicates if deletion must be forced in case of conflict
56 :param dry_run: make checking but do not delete
57 :return: dictionary with deleted item _id. It raises EngineException on error: not found, conflict, ...
59 # TODO add admin to filter, validate rights
60 BaseTopic
.delete(self
, session
, _id
, force
, dry_run
=True)
64 v
= self
.db
.del_one("nsrs", {"_id": _id
})
65 self
.db
.del_list("nslcmops", {"nsInstanceId": _id
})
66 self
.db
.del_list("vnfrs", {"nsr-id-ref": _id
})
67 # set all used pdus as free
68 self
.db
.set_list("pdus", {"_admin.usage.nsr_id": _id
},
69 {"_admin.usageSate": "NOT_IN_USE", "_admin.usage": None})
70 self
._send
_msg
("deleted", {"_id": _id
})
73 def new(self
, rollback
, session
, indata
=None, kwargs
=None, headers
=None, force
=False, make_public
=False):
75 Creates a new nsr into database. It also creates needed vnfrs
76 :param rollback: list to append the created items at database in case a rollback must be done
77 :param session: contains the used login username and working project
78 :param indata: params to be used for the nsr
79 :param kwargs: used to override the indata descriptor
80 :param headers: http request headers
81 :param force: If True avoid some dependence checks
82 :param make_public: Make the created item public to all projects
83 :return: the _id of nsr descriptor created at database
87 ns_request
= self
._remove
_envelop
(indata
)
88 # Override descriptor with query string kwargs
89 self
._update
_input
_with
_kwargs
(ns_request
, kwargs
)
90 self
._validate
_input
_new
(ns_request
, force
)
94 step
= "getting nsd id='{}' from database".format(ns_request
.get("nsdId"))
95 _filter
= {"_id": ns_request
["nsdId"]}
96 _filter
.update(BaseTopic
._get
_project
_filter
(session
, write
=False, show_all
=True))
97 nsd
= self
.db
.get_one("nsds", _filter
)
101 step
= "filling nsr from input data"
103 "name": ns_request
["nsName"],
104 "name-ref": ns_request
["nsName"],
105 "short-name": ns_request
["nsName"],
106 "admin-status": "ENABLED",
108 "datacenter": ns_request
["vimAccountId"],
109 "resource-orchestrator": "osmopenmano",
110 "description": ns_request
.get("nsDescription", ""),
111 "constituent-vnfr-ref": [],
113 "operational-status": "init", # typedef ns-operational-
114 "config-status": "init", # typedef config-states
115 "detailed-status": "scheduled",
117 "orchestration-progress": {},
118 # {"networks": {"active": 0, "total": 0}, "vms": {"active": 0, "total": 0}},
121 "nsd-name-ref": nsd
["name"],
122 "operational-events": [], # "id", "timestamp", "description", "event",
123 "nsd-ref": nsd
["id"],
124 "instantiate_params": ns_request
,
125 "ns-instance-config-ref": nsr_id
,
128 # "input-parameter": xpath, value,
129 "ssh-authorized-key": ns_request
.get("key-pair-ref"),
131 ns_request
["nsr_id"] = nsr_id
135 for member_vnf
in nsd
["constituent-vnfd"]:
136 vnfd_id
= member_vnf
["vnfd-id-ref"]
137 step
= "getting vnfd id='{}' constituent-vnfd='{}' from database".format(
138 member_vnf
["vnfd-id-ref"], member_vnf
["member-vnf-index"])
139 if vnfd_id
not in needed_vnfds
:
141 vnfd
= DescriptorTopic
.get_one_by_id(self
.db
, session
, "vnfds", vnfd_id
)
143 needed_vnfds
[vnfd_id
] = vnfd
145 vnfd
= needed_vnfds
[vnfd_id
]
146 step
= "filling vnfr vnfd-id='{}' constituent-vnfd='{}'".format(
147 member_vnf
["vnfd-id-ref"], member_vnf
["member-vnf-index"])
148 vnfr_id
= str(uuid4())
152 "nsr-id-ref": nsr_id
,
153 "member-vnf-index-ref": member_vnf
["member-vnf-index"],
155 # "vnfd": vnfd, # at OSM model.but removed to avoid data duplication TODO: revise
157 "vnfd-id": vnfd
["_id"], # not at OSM model, but useful
158 "vim-account-id": None,
160 "connection-point": [],
161 "ip-address": None, # mgmt-interface filled by LCM
163 for cp
in vnfd
.get("connection-point", ()):
166 "connection-point-id": cp
.get("id"),
168 # "ip-address", "mac-address" # filled by LCM
169 # vim-id # TODO it would be nice having a vim port id
171 vnfr_descriptor
["connection-point"].append(vnf_cp
)
172 for vdu
in vnfd
["vdu"]:
174 "vdu-id-ref": vdu
["id"],
175 # TODO "name": "" Name of the VDU in the VIM
176 "ip-address": None, # mgmt-interface filled by LCM
177 # "vim-id", "flavor-id", "image-id", "management-ip" # filled by LCM
178 "internal-connection-point": [],
181 if vdu
.get("pdu-type"):
182 vdur
["pdu-type"] = vdu
["pdu-type"]
183 # TODO volumes: name, volume-id
184 for icp
in vdu
.get("internal-connection-point", ()):
187 "connection-point-id": icp
["id"],
188 "name": icp
.get("name"),
189 # "ip-address", "mac-address" # filled by LCM
190 # vim-id # TODO it would be nice having a vim port id
192 vdur
["internal-connection-point"].append(vdu_icp
)
193 for iface
in vdu
.get("interface", ()):
195 "name": iface
.get("name"),
196 # "ip-address", "mac-address" # filled by LCM
197 # vim-id # TODO it would be nice having a vim port id
199 if iface
.get("mgmt-interface"):
200 vdu_iface
["mgmt-interface"] = True
202 vdur
["interfaces"].append(vdu_iface
)
203 count
= vdu
.get("count", 1)
206 count
= int(count
) # TODO remove when descriptor serialized with payngbind
207 for index
in range(0, count
):
209 vdur
= deepcopy(vdur
)
210 vdur
["_id"] = str(uuid4())
211 vdur
["count-index"] = index
212 vnfr_descriptor
["vdur"].append(vdur
)
214 step
= "creating vnfr vnfd-id='{}' constituent-vnfd='{}' at database".format(
215 member_vnf
["vnfd-id-ref"], member_vnf
["member-vnf-index"])
218 BaseTopic
.format_on_new(vnfr_descriptor
, session
["project_id"], make_public
=make_public
)
219 self
.db
.create("vnfrs", vnfr_descriptor
)
220 rollback
.append({"topic": "vnfrs", "_id": vnfr_id
})
221 nsr_descriptor
["constituent-vnfr-ref"].append(vnfr_id
)
223 step
= "creating nsr at database"
224 self
.format_on_new(nsr_descriptor
, session
["project_id"], make_public
=make_public
)
225 self
.db
.create("nsrs", nsr_descriptor
)
226 rollback
.append({"topic": "nsrs", "_id": nsr_id
})
228 except Exception as e
:
229 self
.logger
.exception("Exception {} at NsrTopic.new()".format(e
), exc_info
=True)
230 raise EngineException("Error {}: {}".format(step
, e
))
231 except ValidationError
as e
:
232 raise EngineException(e
, HTTPStatus
.UNPROCESSABLE_ENTITY
)
234 def edit(self
, session
, _id
, indata
=None, kwargs
=None, force
=False, content
=None):
235 raise EngineException("Method edit called directly", HTTPStatus
.INTERNAL_SERVER_ERROR
)
238 class VnfrTopic(BaseTopic
):
242 def __init__(self
, db
, fs
, msg
):
243 BaseTopic
.__init
__(self
, db
, fs
, msg
)
245 def delete(self
, session
, _id
, force
=False, dry_run
=False):
246 raise EngineException("Method delete called directly", HTTPStatus
.INTERNAL_SERVER_ERROR
)
248 def edit(self
, session
, _id
, indata
=None, kwargs
=None, force
=False, content
=None):
249 raise EngineException("Method edit called directly", HTTPStatus
.INTERNAL_SERVER_ERROR
)
251 def new(self
, rollback
, session
, indata
=None, kwargs
=None, headers
=None, force
=False, make_public
=False):
252 # Not used because vnfrs are created and deleted by NsrTopic class directly
253 raise EngineException("Method new called directly", HTTPStatus
.INTERNAL_SERVER_ERROR
)
256 class NsLcmOpTopic(BaseTopic
):
259 operation_schema
= { # mapping between operation and jsonschema to validate
260 "instantiate": ns_instantiate
,
266 def __init__(self
, db
, fs
, msg
):
267 BaseTopic
.__init
__(self
, db
, fs
, msg
)
269 def _validate_input_new(self
, input, force
=False):
271 Validates input user content for a new entry. It uses jsonschema for each type or operation.
272 :param input: user input content for the new topic
273 :param force: may be used for being more tolerant
274 :return: The same input content, or a changed version of it.
277 validate_input(input, self
.schema_new
)
280 def _check_ns_operation(self
, session
, nsr
, operation
, indata
):
282 Check that user has enter right parameters for the operation
284 :param operation: it can be: instantiate, terminate, action, TODO: update, heal
285 :param indata: descriptor with the parameters of the operation
292 def check_valid_vnf_member_index(member_vnf_index
):
293 # TODO change to vnfR
294 for vnf
in nsd
["constituent-vnfd"]:
295 if member_vnf_index
== vnf
["member-vnf-index"]:
296 vnfd_id
= vnf
["vnfd-id-ref"]
297 if vnfd_id
not in vnfds
:
298 vnfds
[vnfd_id
] = self
.db
.get_one("vnfds", {"id": vnfd_id
})
299 return vnfds
[vnfd_id
]
301 raise EngineException("Invalid parameter member_vnf_index='{}' is not one of the "
302 "nsd:constituent-vnfd".format(member_vnf_index
))
304 def _check_vnf_instantiation_params(in_vnfd
, vnfd
):
306 for in_vdu
in get_iterable(in_vnfd
.get("vdu")):
307 for vdu
in get_iterable(vnfd
.get("vdu")):
308 if in_vdu
["id"] == vdu
["id"]:
309 for volume
in get_iterable(in_vdu
.get("volume")):
310 for volumed
in get_iterable(vdu
.get("volumes")):
311 if volumed
["name"] == volume
["name"]:
314 raise EngineException("Invalid parameter vnf[member-vnf-index='{}']:vdu[id='{}']:"
315 "volume:name='{}' is not present at vnfd:vdu:volumes list".
316 format(in_vnf
["member-vnf-index"], in_vdu
["id"],
318 for in_iface
in get_iterable(in_vdu
["interface"]):
319 for iface
in get_iterable(vdu
.get("interface")):
320 if in_iface
["name"] == iface
["name"]:
323 raise EngineException("Invalid parameter vnf[member-vnf-index='{}']:vdu[id='{}']:"
324 "interface[name='{}'] is not present at vnfd:vdu:interface"
325 .format(in_vnf
["member-vnf-index"], in_vdu
["id"],
329 raise EngineException("Invalid parameter vnf[member-vnf-index='{}']:vdu[id='{}'] is is not present "
330 "at vnfd:vdu".format(in_vnf
["member-vnf-index"], in_vdu
["id"]))
332 for in_ivld
in get_iterable(in_vnfd
.get("internal-vld")):
333 for ivld
in get_iterable(vnfd
.get("internal-vld")):
334 if in_ivld
["name"] == ivld
["name"] or in_ivld
["name"] == ivld
["id"]:
335 for in_icp
in get_iterable(in_ivld
["internal-connection-point"]):
336 for icp
in ivld
["internal-connection-point"]:
337 if in_icp
["id-ref"] == icp
["id-ref"]:
340 raise EngineException("Invalid parameter vnf[member-vnf-index='{}']:internal-vld[name"
341 "='{}']:internal-connection-point[id-ref:'{}'] is not present at "
342 "vnfd:internal-vld:name/id:internal-connection-point"
343 .format(in_vnf
["member-vnf-index"], in_ivld
["name"],
344 in_icp
["id-ref"], vnfd
["id"]))
347 raise EngineException("Invalid parameter vnf[member-vnf-index='{}']:internal-vld:name='{}'"
348 " is not present at vnfd '{}'".format(in_vnf
["member-vnf-index"],
349 in_ivld
["name"], vnfd
["id"]))
351 def check_valid_vim_account(vim_account
):
352 if vim_account
in vim_accounts
:
355 db_filter
= self
._get
_project
_filter
(session
, write
=False, show_all
=True)
356 db_filter
["_id"] = vim_account
357 self
.db
.get_one("vim_accounts", db_filter
)
359 raise EngineException("Invalid vimAccountId='{}' not present for the project".format(vim_account
))
360 vim_accounts
.append(vim_account
)
362 if operation
== "action":
363 # check vnf_member_index
364 if indata
.get("vnf_member_index"):
365 indata
["member_vnf_index"] = indata
.pop("vnf_member_index") # for backward compatibility
366 if not indata
.get("member_vnf_index"):
367 raise EngineException("Missing 'member_vnf_index' parameter")
368 vnfd
= check_valid_vnf_member_index(indata
["member_vnf_index"])
370 for config_primitive
in get_iterable(vnfd
.get("vnf-configuration", {}).get("config-primitive")):
371 if indata
["primitive"] == config_primitive
["name"]:
372 # check needed primitive_params are provided
373 if indata
.get("primitive_params"):
374 in_primitive_params_copy
= copy(indata
["primitive_params"])
376 in_primitive_params_copy
= {}
377 for paramd
in get_iterable(config_primitive
.get("parameter")):
378 if paramd
["name"] in in_primitive_params_copy
:
379 del in_primitive_params_copy
[paramd
["name"]]
380 elif not paramd
.get("default-value"):
381 raise EngineException("Needed parameter {} not provided for primitive '{}'".format(
382 paramd
["name"], indata
["primitive"]))
383 # check no extra primitive params are provided
384 if in_primitive_params_copy
:
385 raise EngineException("parameter/s '{}' not present at vnfd for primitive '{}'".format(
386 list(in_primitive_params_copy
.keys()), indata
["primitive"]))
389 raise EngineException("Invalid primitive '{}' is not present at vnfd".format(indata
["primitive"]))
390 if operation
== "scale":
391 vnfd
= check_valid_vnf_member_index(indata
["scaleVnfData"]["scaleByStepData"]["member-vnf-index"])
392 for scaling_group
in get_iterable(vnfd
.get("scaling-group-descriptor")):
393 if indata
["scaleVnfData"]["scaleByStepData"]["scaling-group-descriptor"] == scaling_group
["name"]:
396 raise EngineException("Invalid scaleVnfData:scaleByStepData:scaling-group-descriptor '{}' is not "
397 "present at vnfd:scaling-group-descriptor".format(
398 indata
["scaleVnfData"]["scaleByStepData"]["scaling-group-descriptor"]))
399 if operation
== "instantiate":
401 check_valid_vim_account(indata
["vimAccountId"])
402 for in_vnf
in get_iterable(indata
.get("vnf")):
403 vnfd
= check_valid_vnf_member_index(in_vnf
["member-vnf-index"])
404 _check_vnf_instantiation_params(in_vnf
, vnfd
)
405 if in_vnf
.get("vimAccountId"):
406 check_valid_vim_account(in_vnf
["vimAccountId"])
408 for in_vld
in get_iterable(indata
.get("vld")):
409 for vldd
in get_iterable(nsd
.get("vld")):
410 if in_vld
["name"] == vldd
["name"] or in_vld
["name"] == vldd
["id"]:
413 raise EngineException("Invalid parameter vld:name='{}' is not present at nsd:vld".format(
416 def _look_for_pdu(self
, session
, rollback
, vnfr
, vim_account
):
418 Look for a free PDU in the catalog matching vdur type and interfaces. Fills vdur with ip_address information
419 :param vdur: vnfr:vdur descriptor. It is modified with pdu interface info if pdu is found
420 :param member_vnf_index: used just for logging. Target vnfd of nsd
422 :return: vder_update: dictionary to update vnfr:vdur with pdu info. In addition it modified choosen pdu to set
427 for vdur_index
, vdur
in enumerate(get_iterable(vnfr
.get("vdur"))):
428 if not vdur
.get("pdu-type"):
430 pdu_type
= vdur
.get("pdu-type")
431 pdu_filter
= self
._get
_project
_filter
(session
, write
=True, show_all
=True)
432 pdu_filter
["vim.vim_accounts"] = vim_account
433 pdu_filter
["type"] = pdu_type
434 pdu_filter
["_admin.operationalState"] = "ENABLED"
435 pdu_filter
["_admin.usageSate"] = "NOT_IN_USE",
436 # TODO feature 1417: "shared": True,
438 available_pdus
= self
.db
.get_list("pdus", pdu_filter
)
439 for pdu
in available_pdus
:
440 # step 1 check if this pdu contains needed interfaces:
441 match_interfaces
= True
442 for vdur_interface
in vdur
["interfaces"]:
443 for pdu_interface
in pdu
["interfaces"]:
444 if pdu_interface
["name"] == vdur_interface
["name"]:
445 # TODO feature 1417: match per mgmt type
447 else: # no interface found for name
448 match_interfaces
= False
453 raise EngineException(
454 "No PDU of type={} found for member_vnf_index={} at vim_account={} matching interface "
455 "names".format(vdur
["vdu-id-ref"], vnfr
["member-vnf-index-ref"], pdu_type
))
459 "_admin.usageState": pdu
["_admin"]["usageState"],
460 "_admin.usage.vnfr_id": None,
461 "_admin.usage.nsr_id": None,
462 "_admin.usage.vdur": None,
464 self
.db
.set_one("pdus", {"_id": pdu
["_id"]},
465 {"_admin.usageSate": "IN_USE",
466 "_admin.usage.vnfr_id": vnfr
["_id"],
467 "_admin.usage.nsr_id": vnfr
["nsr-id-ref"],
468 "_admin.usage.vdur": vdur
["vdu-id-ref"]}
470 rollback
.append({"topic": "pdus", "_id": pdu
["_id"], "operation": "set", "content": rollback_pdu
})
472 # step 3. Fill vnfr info by filling vdur
473 vdu_text
= "vdur.{}".format(vdur_index
)
474 rollback_vnfr
[vdu_text
+ ".pdu-id"] = None
475 vnfr_update
[vdu_text
+ ".pdu-id"] = pdu
["_id"]
476 for iface_index
, vdur_interface
in enumerate(vdur
["interfaces"]):
477 for pdu_interface
in pdu
["interfaces"]:
478 if pdu_interface
["name"] == vdur_interface
["name"]:
479 iface_text
= vdu_text
+ ".interfaces.{}".format(iface_index
)
480 for k
, v
in pdu_interface
.items():
481 vnfr_update
[iface_text
+ ".{}".format(k
)] = v
482 rollback_vnfr
[iface_text
+ ".{}".format(k
)] = vdur_interface
.get(v
)
486 self
.db
.set_one("vnfrs", {"_id": vnfr
["_id"]}, vnfr_update
)
487 rollback
.append({"topic": "vnfrs", "_id": vnfr
["_id"], "operation": "set", "content": rollback_vnfr
})
490 def _update_vnfrs(self
, session
, rollback
, nsr
, indata
):
494 vnfrs
= self
.db
.get_list("vnfrs", {"nsr-id-ref": nsr_id
})
498 vnfr_update_rollback
= {}
499 member_vnf_index
= vnfr
["member-vnf-index-ref"]
500 # update vim-account-id
502 vim_account
= indata
["vimAccountId"]
503 # check instantiate parameters
504 for vnf_inst_params
in get_iterable(indata
.get("vnf")):
505 if vnf_inst_params
["member-vnf-index"] != member_vnf_index
:
507 if vnf_inst_params
.get("vimAccountId"):
508 vim_account
= vnf_inst_params
.get("vimAccountId")
510 vnfr_update
["vim-account-id"] = vim_account
511 vnfr_update_rollback
["vim-account-id"] = vnfr
.get("vim-account-id")
514 self
._look
_for
_pdu
(session
, rollback
, vnfr
, vim_account
)
515 # TODO change instantiation parameters to set network
517 def _create_nslcmop(self
, session
, nsInstanceId
, operation
, params
):
523 "operationState": "PROCESSING", # COMPLETED,PARTIALLY_COMPLETED,FAILED_TEMP,FAILED,ROLLING_BACK,ROLLED_BACK
524 "statusEnteredTime": now
,
525 "nsInstanceId": nsInstanceId
,
526 "lcmOperationType": operation
,
528 "isAutomaticInvocation": False,
529 "operationParams": params
,
530 "isCancelPending": False,
532 "self": "/osm/nslcm/v1/ns_lcm_op_occs/" + _id
,
533 "nsInstance": "/osm/nslcm/v1/ns_instances/" + nsInstanceId
,
538 def new(self
, rollback
, session
, indata
=None, kwargs
=None, headers
=None, force
=False, make_public
=False):
540 Performs a new operation over a ns
541 :param rollback: list to append created items at database in case a rollback must to be done
542 :param session: contains the used login username and working project
543 :param indata: descriptor with the parameters of the operation. It must contains among others
544 nsInstanceId: _id of the nsr to perform the operation
545 operation: it can be: instantiate, terminate, action, TODO: update, heal
546 :param kwargs: used to override the indata descriptor
547 :param headers: http request headers
548 :param force: If True avoid some dependence checks
549 :param make_public: Make the created item public to all projects
550 :return: id of the nslcmops
553 # Override descriptor with query string kwargs
554 self
._update
_input
_with
_kwargs
(indata
, kwargs
)
555 operation
= indata
["lcmOperationType"]
556 nsInstanceId
= indata
["nsInstanceId"]
558 validate_input(indata
, self
.operation_schema
[operation
])
560 _filter
= BaseTopic
._get
_project
_filter
(session
, write
=True, show_all
=False)
561 _filter
["_id"] = nsInstanceId
562 nsr
= self
.db
.get_one("nsrs", _filter
)
565 if not nsr
["_admin"].get("nsState") or nsr
["_admin"]["nsState"] == "NOT_INSTANTIATED":
566 if operation
== "terminate" and indata
.get("autoremove"):
567 # NSR must be deleted
568 return self
.delete(session
, nsInstanceId
)
569 if operation
!= "instantiate":
570 raise EngineException("ns_instance '{}' cannot be '{}' because it is not instantiated".format(
571 nsInstanceId
, operation
), HTTPStatus
.CONFLICT
)
573 if operation
== "instantiate" and not indata
.get("force"):
574 raise EngineException("ns_instance '{}' cannot be '{}' because it is already instantiated".format(
575 nsInstanceId
, operation
), HTTPStatus
.CONFLICT
)
576 self
._check
_ns
_operation
(session
, nsr
, operation
, indata
)
577 if operation
== "instantiate":
578 self
._update
_vnfrs
(session
, rollback
, nsr
, indata
)
579 nslcmop_desc
= self
._create
_nslcmop
(session
, nsInstanceId
, operation
, indata
)
580 self
.format_on_new(nslcmop_desc
, session
["project_id"], make_public
=make_public
)
581 _id
= self
.db
.create("nslcmops", nslcmop_desc
)
582 rollback
.append({"topic": "nslcmops", "_id": _id
})
583 self
.msg
.write("ns", operation
, nslcmop_desc
)
585 except ValidationError
as e
:
586 raise EngineException(e
, HTTPStatus
.UNPROCESSABLE_ENTITY
)
587 # except DbException as e:
588 # raise EngineException("Cannot get ns_instance '{}': {}".format(e), HTTPStatus.NOT_FOUND)
590 def delete(self
, session
, _id
, force
=False, dry_run
=False):
591 raise EngineException("Method delete called directly", HTTPStatus
.INTERNAL_SERVER_ERROR
)
593 def edit(self
, session
, _id
, indata
=None, kwargs
=None, force
=False, content
=None):
594 raise EngineException("Method edit called directly", HTTPStatus
.INTERNAL_SERVER_ERROR
)