X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=NG-RO%2Fosm_ng_ro%2Fro_main.py;h=bd2ea9e029a434cea0049fa125c460e06b3e1d19;hb=refs%2Fchanges%2F86%2F11986%2F11;hp=c9cad85746f9c4eb55abd61d608b6a1363ec00d0;hpb=80135b928ab442c38898750b4751480205b4affc;p=osm%2FRO.git diff --git a/NG-RO/osm_ng_ro/ro_main.py b/NG-RO/osm_ng_ro/ro_main.py index c9cad857..bd2ea9e0 100644 --- a/NG-RO/osm_ng_ro/ro_main.py +++ b/NG-RO/osm_ng_ro/ro_main.py @@ -18,29 +18,30 @@ # limitations under the License. ## -import cherrypy -import time + +from codecs import getreader +import getopt +from http import HTTPStatus import json -import yaml -import osm_ng_ro.html_out as html import logging import logging.handlers -import getopt +from os import environ, path import sys +import time -from osm_ng_ro.ns import Ns, NsException -from osm_ng_ro.validation import ValidationError -from osm_ng_ro.vim_admin import VimAdminThread +import cherrypy from osm_common.dbbase import DbException from osm_common.fsbase import FsException from osm_common.msgbase import MsgException -from http import HTTPStatus -from codecs import getreader -from os import environ, path from osm_ng_ro import version as ro_version, version_date as ro_version_date +import osm_ng_ro.html_out as html +from osm_ng_ro.ns import Ns, NsException +from osm_ng_ro.validation import ValidationError +from osm_ng_ro.vim_admin import VimAdminThread +import yaml -__author__ = "Alfonso Tierno " +__author__ = "Alfonso Tierno " __version__ = "0.1." # file version, not NBI version version_date = "May 2020" @@ -82,6 +83,30 @@ valid_url_methods = { }, "ns": { "v1": { + "rebuild": { + "METHODS": ("POST",), + "ROLE_PERMISSION": "rebuild:", + "": { + "METHODS": ("POST",), + "ROLE_PERMISSION": "rebuild:id:", + }, + }, + "start": { + "METHODS": ("POST",), + "ROLE_PERMISSION": "start:", + "": { + "METHODS": ("POST",), + "ROLE_PERMISSION": "start:id:", + }, + }, + "stop": { + "METHODS": ("POST",), + "ROLE_PERMISSION": "stop:", + "": { + "METHODS": ("POST",), + "ROLE_PERMISSION": "stop:id:", + }, + }, "deploy": { "METHODS": ("GET",), "ROLE_PERMISSION": "deploy:", @@ -98,6 +123,26 @@ valid_url_methods = { }, }, }, + "recreate": { + "": { + "METHODS": ("POST"), + "ROLE_PERMISSION": "recreate:id:", + "": { + "METHODS": ("GET",), + "ROLE_PERMISSION": "recreate:id:id:", + }, + }, + }, + "migrate": { + "": { + "METHODS": ("POST"), + "ROLE_PERMISSION": "migrate:id:", + "": { + "METHODS": ("GET",), + "ROLE_PERMISSION": "migrate:id:id:", + }, + }, + }, } }, } @@ -149,6 +194,12 @@ class Server(object): "deploy:id:delete": self.ns.delete, "deploy:id:id:get": self.ns.status, "deploy:id:id:cancel:post": self.ns.cancel, + "rebuild:id:post": self.ns.rebuild_start_stop, + "start:id:post": self.ns.rebuild_start_stop, + "stop:id:post": self.ns.rebuild_start_stop, + "recreate:id:post": self.ns.recreate, + "recreate:id:id:get": self.ns.recreate_status, + "migrate:id:post": self.ns.migrate, } def _format_in(self, kwargs):