X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Fnbi.py;h=aa8105aa6a9255e14f624e4e40beedbe7243f874;hp=1cd61d5af1e1e643e185dbf6082e76f53c5a5272;hb=65acb4d5d56a90c9c4ff101b931f5fa6d65dcb51;hpb=0f98af53b320c8244b58d0d8751e28e157949e8e diff --git a/osm_nbi/nbi.py b/osm_nbi/nbi.py index 1cd61d5..aa8105a 100644 --- a/osm_nbi/nbi.py +++ b/osm_nbi/nbi.py @@ -20,7 +20,8 @@ from os import environ __author__ = "Alfonso Tierno " __version__ = "0.3" -version_date = "Mar 2018" +version_date = "Apr 2018" +database_version = '1.0' """ North Bound Interface (O: OSM specific; 5,X: SOL005 not implemented yet; O5: SOL005 implemented) @@ -40,6 +41,8 @@ URL: /osm GET POST / 5 X /vnfpkgm/v1 + /vnf_packages_content O O + / O O /vnf_packages O5 O5 / O5 O5 5 /package_content O5 O5 @@ -54,7 +57,11 @@ URL: /osm GET POST / O O /ns_instances 5 5 / 5 5 - TO BE COMPLETED + instantiate O5 + terminate O5 + action O + scale O5 + heal 5 /ns_lcm_op_occs 5 5 / 5 5 5 TO BE COMPLETED 5 5 @@ -193,8 +200,16 @@ class Server(object): "ns_instances_content": {"METHODS": ("GET", "POST"), "": {"METHODS": ("GET", "DELETE")} }, - "ns_instances": {"TODO": ("GET", "POST"), - "": {"TODO": ("GET", "DELETE")} + "ns_instances": {"METHODS": ("GET", "POST"), + "": {"TODO": ("GET", "DELETE"), + "scale": {"TODO": "POST"}, + "terminate": {"METHODS": "POST"}, + "instantiate": {"METHODS": "POST"}, + "action": {"METHODS": "POST"}, + } + }, + "ns_lcm_op_occs": {"METHODS": "GET", + "": {"METHODS": "GET"}, } } }, @@ -379,6 +394,24 @@ class Server(object): cherrypy.response.status = e.http_code.value return self._format_out("Welcome to OSM!", session) + @cherrypy.expose + def version(self, *args, **kwargs): + global __version__, version_date + try: + if cherrypy.request.method != "GET": + raise NbiException("Only method GET is allowed", HTTPStatus.METHOD_NOT_ALLOWED) + elif args or kwargs: + raise NbiException("Invalid URL or query string for version", HTTPStatus.METHOD_NOT_ALLOWED) + return __version__ + " " + version_date + except NbiException as e: + cherrypy.response.status = e.http_code.value + problem_details = { + "code": e.http_code.name, + "status": e.http_code.value, + "detail": str(e), + } + return self._format_out(problem_details, None) + @cherrypy.expose def token(self, method, token_id=None, kwargs=None): session = None @@ -431,19 +464,12 @@ class Server(object): } return self._format_out(problem_details, session) - @cherrypy.expose - def test2(self, args0=None, args1=None, args2=None, args3=None, *args, **kwargs): - return_text = ( - "
\n{} {} {} {} {} {} \n".format(args0, args1, args2, args3, args, kwargs))
-        return_text += "
" - return return_text - @cherrypy.expose def test(self, *args, **kwargs): thread_info = None if args and args[0] == "help": return "
\ninit\nfile/  download file\ndb-clear/table\nprune\nlogin\nlogin2\n"\
-                    "sleep/
" + "sleep/