</form>
"""
+html_vnfpackage_body = """<a href="/osm/vnfpkgm/v1/vnf_packages/{id}/artifacts">Artifacts </a>"""
+html_nspackage_body = """<a href="/osm/nsd/v1/ns_descriptors/{id}/artifacts">Artifacts </a>"""
+
def format(data, request, response, toke_info):
"""
if "Location" in response.headers:
body += '<a href="{}"> show </a>'.format(response.headers["Location"])
else:
+ _id = request.path_info[request.path_info.rfind("/")+1:]
body += '<a href="/osm/{}?METHOD=DELETE"> <img src="/osm/static/delete.png" height="25" width="25"> </a>'\
.format(request.path_info)
if request.path_info.startswith("/nslcm/v1/ns_instances_content/") or \
request.path_info.startswith("/nslcm/v1/ns_instances/"):
- _id = request.path_info[request.path_info.rfind("/")+1:]
body += html_nslcmop_body.format(id=_id)
elif request.path_info.startswith("/nsilcm/v1/netslice_instances_content/") or \
request.path_info.startswith("/nsilcm/v1/netslice_instances/"):
- _id = request.path_info[request.path_info.rfind("/")+1:]
body += html_nsilcmop_body.format(id=_id)
+ elif request.path_info.startswith("/vnfpkgm/v1/vnf_packages/") or \
+ request.path_info.startswith("/vnfpkgm/v1/vnf_packages_content/"):
+ body += html_vnfpackage_body.format(id=_id)
+ elif request.path_info.startswith("/nsd/v1/ns_descriptors/") or \
+ request.path_info.startswith("/nsd/v1/ns_descriptors_content/"):
+ body += html_nspackage_body.format(id=_id)
body += "<pre>" + html_escape(yaml.safe_dump(data, explicit_start=True, indent=4, default_flow_style=False)) + \
"</pre>"
elif data is None:
"nsd": {"METHODS": ("GET",), # descriptor inside package
"ROLE_PERMISSION": "nsds:id:content:"
},
- "artifacts": {"*": {"METHODS": ("GET",),
- "ROLE_PERMISSION": "nsds:id:nsd_artifact:"
- }
+ "artifacts": {"METHODS": ("GET",),
+ "ROLE_PERMISSION": "nsds:id:nsd_artifact:",
+ "*": None,
}
}
},
"vnfd": {"METHODS": ("GET", ), # descriptor inside package
"ROLE_PERMISSION": "vnfds:id:content:"
},
- "artifacts": {"*": {"METHODS": ("GET", ),
- "ROLE_PERMISSION": "vnfds:id:vnfd_artifact:"
- }
+ "artifacts": {"METHODS": ("GET", ),
+ "ROLE_PERMISSION": "vnfds:id:vnfd_artifact:",
+ "*": None,
},
"action": {"METHODS": ("POST", ),
"ROLE_PERMISSION": "vnfds:id:action:"
"nst": {"METHODS": ("GET",), # descriptor inside package
"ROLE_PERMISSION": "slice_templates:id:content:"
},
- "artifacts": {"*": {"METHODS": ("GET",),
- "ROLE_PERMISSION": "slice_templates:id:content:"
- }
+ "artifacts": {"METHODS": ("GET",),
+ "ROLE_PERMISSION": "slice_templates:id:content:",
+ "*": None
}
}
},
elif "<ID>" in reference:
reference = reference["<ID>"]
elif "*" in reference:
- reference = reference["*"]
+ # if there is content
+ if reference["*"]:
+ reference = reference["*"]
break
else:
raise NbiException("Unexpected URL item {}".format(arg), HTTPStatus.METHOD_NOT_ALLOWED)