indata["_admin"]["projects_read"] = [session["project_id"]]
if not indata["_admin"].get("projects_write"):
indata["_admin"]["projects_write"] = [session["project_id"]]
+ if item == "nsds":
+ # transform constituent-vnfd:member-vnf-index to string
+ if indata.get("constituent-vnfd"):
+ for constituent_vnfd in indata["constituent-vnfd"]:
+ if "member-vnf-index" in constituent_vnfd:
+ constituent_vnfd["member-vnf-index"] = str(constituent_vnfd["member-vnf-index"])
if item in ("vnfds", "nsds"):
indata["_admin"]["onboardingState"] = "CREATED"
indata["_admin"]["operationalState"] = "DISABLED"
"<ID>": {"METHODS": ("GET", "DELETE")}
},
"vims": {"METHODS": ("GET", "POST"),
- "<ID>": {"METHODS": ("GET", "DELETE")}
+ "<ID>": {"METHODS": ("GET", "DELETE", "PATCH", "PUT")}
},
"vim_accounts": {"METHODS": ("GET", "POST"),
- "<ID>": {"METHODS": ("GET", "DELETE", "PATCH")}
+ "<ID>": {"METHODS": ("GET", "DELETE", "PATCH", "PUT")}
},
"sdns": {"METHODS": ("GET", "POST"),
- "<ID>": {"METHODS": ("GET", "DELETE", "PATCH")}
+ "<ID>": {"METHODS": ("GET", "DELETE", "PATCH", "PUT")}
},
}
},
if engine_item in ("vim_accounts", "sdns"):
cherrypy.response.status = HTTPStatus.ACCEPTED.value
- elif method == "PUT":
+ elif method in ("PUT", "PATCH"):
if not indata and not kwargs:
raise NbiException("Nothing to update. Provide payload and/or query string",
HTTPStatus.BAD_REQUEST)
- if item2 in ("nsd_content", "package_content"):
+ if item2 in ("nsd_content", "package_content") and method == "PUT":
completed = self.engine.upload_content(session, engine_item, _id, indata, kwargs,
cherrypy.request.headers)
if not completed:
outdata = None
else:
outdata = {"id": self.engine.edit_item(session, engine_item, _id, indata, kwargs, force=force)}
- elif method == "PATCH":
- if not indata and not kwargs:
- raise NbiException("Nothing to update. Provide payload and/or query string",
- HTTPStatus.BAD_REQUEST)
- outdata = {"id": self.engine.edit_item(session, engine_item, _id, indata, kwargs, force=force)}
else:
raise NbiException("Method {} not allowed".format(method), HTTPStatus.METHOD_NOT_ALLOWED)
return self._format_out(outdata, session, _format)
basepython = python3
deps = flake8
commands =
- flake8 setup.py --max-line-length 120 --exclude .svn,CVS,.gz,.git,__pycache__,.tox,local,temp
+ flake8 setup.py --max-line-length 120 --exclude .svn,CVS,.gz,.git,__pycache__,.tox,local,temp --ignore W291,W293
[testenv:build]
basepython = python3