:param ns_request: params to be used for the nsr
:return: the _id of nsr descriptor stored at database
"""
+ rollback_index = len(rollback)
step = ""
try:
# look for nsr
step = "creating nsr at database"
self._format_new_data(session, "nsrs", nsr_descriptor)
self.db.create("nsrs", nsr_descriptor)
- rollback.insert(0, {"item": "nsrs", "_id": nsr_id})
+ rollback.insert(rollback_index, {"item": "nsrs", "_id": nsr_id})
return nsr_id
except Exception as e:
raise EngineException("Error {}: {}".format(step, e))
outdata = {"id": _id}
elif item == "ns_instances_content":
_id = self.engine.new_item(rollback, session, engine_item, indata, kwargs, force=force)
- self.engine.ns_operation(rollback, session, _id, "instantiate", {}, None)
+ self.engine.ns_operation(rollback, session, _id, "instantiate", indata, None)
self._set_location_header(topic, version, item, _id)
outdata = {"id": _id}
elif item == "ns_instances" and item2:
passwd_schema = {"type": "string", "minLength": 1, "maxLength": 60}
nameshort_schema = {"type": "string", "minLength": 1, "maxLength": 60, "pattern": "^[^,;()'\"]+$"}
name_schema = {"type": "string", "minLength": 1, "maxLength": 255, "pattern": "^[^,;()'\"]+$"}
+string_schema = {"type": "string", "minLength": 1, "maxLength": 255}
xml_text_schema = {"type": "string", "minLength": 1, "maxLength": 1000, "pattern": "^[^']+$"}
description_schema = {"type": ["string", "null"], "maxLength": 255, "pattern": "^[^'\"]+$"}
id_schema_fake = {"type": "string", "minLength": 2,
"title": "ns action instantiate input schema",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
+ "properties": {
+ "nsName": name_schema,
+ "nsDescription": description_schema,
+ "nsdId": id_schema,
+ "vimAccountId": id_schema,
+ "ssh_keys": {"type": "string"},
+ "vnf": {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "type": "object",
+ "properties": {
+ "member-vnf-index": name_schema,
+ "vimAccountId": id_schema,
+ },
+ "required": ["member-vnf-index"]
+ }
+ },
+ "vld": {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": string_schema,
+ "vim-network-name": {"OneOf": [string_schema, object_schema]},
+ "ip-profile": object_schema,
+ },
+ "required": ["name"]
+ }
+ },
+ },
+ "required": ["nsName", "nsdId", "vimAccountId"]
}
+
ns_action = { # TODO for the moment it is only contemplated the vnfd primitive execution
"title": "ns action update input schema",
"$schema": "http://json-schema.org/draft-04/schema#",
return None
except js_e.ValidationError as e:
if e.path:
- error_pos = "at '" + ":".join(e.path) + "'"
+ error_pos = "at '" + ":".join(map(str, e.path)) + "'"
else:
error_pos = ""
raise ValidationError("Format error {} '{}' ".format(error_pos, e))