diff options
-rw-r--r-- | INFO.yaml | 93 | ||||
-rw-r--r-- | docs/specs/logging_enablement.rst | 73 | ||||
-rw-r--r-- | multivimbroker/multivimbroker/forwarder/urls.py | 8 | ||||
-rw-r--r-- | multivimbroker/multivimbroker/forwarder/views.py | 18 | ||||
-rw-r--r-- | multivimbroker/multivimbroker/swagger/multivim.server.swagger.json | 82 |
5 files changed, 251 insertions, 23 deletions
diff --git a/INFO.yaml b/INFO.yaml new file mode 100644 index 0000000..9d2d635 --- /dev/null +++ b/INFO.yaml @@ -0,0 +1,93 @@ +--- +project: 'multicloud-framework' +project_creation_date: '2017-02-21' +project_category: '' +lifecycle_state: 'Incubation' +project_lead: &onap_multicloud_ptl + name: 'Bin Yang' + email: 'bin.yang@windriver.com' + company: 'Windriver' + id: 'biny993' + timezone: 'China/Beijing' +primary_contact: *onap_multicloud_ptl +issue_tracking: + type: 'jira' + url: 'https://jira.onap.org/projects/MULTICLOUD' + key: 'MULTICLOUD' +mailing_list: + type: 'groups.io' + url: 'lists.onap.org' + tag: '<[sub-project_name]>' +realtime_discussion: '' +meetings: + - type: 'zoom' + agenda: 'https://wiki.onap.org/pages/viewpage.action?pageId=6591499' + url: 'https://wiki.onap.org/pages/viewpage.action?pageId=6591499' + server: 'n/a' + channel: 'n/a' + repeats: 'weekly' + time: '13:00 UTC' +repositories: + - 'multicloud-framework' + - 'multicloud-openstack' + - 'multicloud-openstack-vmware' + - 'multicloud-openstack-windriver' + - 'multicloud-azure' + - 'multicloud-k8s' +committers: + - <<: *onap_multicloud_ptl + - name: 'Anbing Zhang' + email: 'zhanganbing@chinamobile.com' + company: 'China Mobile' + id: 'zhangab' + timezone: '' + - name: 'Xinhui Li' + email: 'lxinhui@vmware.com' + id: 'xinhuili' + company: 'VMware' + timezone: 'China/Beijing' + - name: 'Bin Hu' + email: 'bh526r@att.com' + company: 'ATT' + id: 'bh526r' + timezone: 'America/Palo Alto' + - name: 'Liang Ke' + email: 'lokyse@163.com' + company: 'VMWare' + id: 'liangke' + timezone: 'China/Beijing' + - name: 'yun huang' + email: 'yun.huang@windriver.com' + company: 'Windriver' + id: 'cloudhuang' + timezone: '' + - name: 'Victor Morales' + email: 'victor.morales@intel.com' + company: 'Intel' + id: 'electrocucaracha' + timezone: '' + - name: 'Ethan Lynn' + email: 'ethanlynnl@vmware.com' + company: 'VMWare' + id: 'ethanlynnl' + timezone: '' + - name: 'Huang Haibin' + email: 'haibin.huang@intel.com' + company: 'Intel' + id: 'haibin' + timezone: '' + - name: 'Sudhakar Reddy' + email: 'Sudhakar.Reddy@amdocs.com' + company: 'Amdocs' + id: 'SudhakarReddy' + timezone: '' +tsc: + approval: 'https://lists.onap.org/pipermail/onap-tsc' + changes: + - type: 'Addition' + name: 'yun huang' + name: 'Victor Morales' + name: 'Ethan Lynn' + name: 'Huang Haibin' + name: 'Sudhakar Reddy' + link: 'http://ircbot.wl.linuxfoundation.org/meetings/onap-meeting/2018/onap-meeting.2018-08-16-13.45.html' diff --git a/docs/specs/logging_enablement.rst b/docs/specs/logging_enablement.rst index a717286..1ec3df7 100644 --- a/docs/specs/logging_enablement.rst +++ b/docs/specs/logging_enablement.rst @@ -73,25 +73,54 @@ policy、output location、text output format、message level and so on, support MDC context specific logging, able to change configuration at runtime, and make logging quite fast. - - - - - - - - - - - - - - - - - - - - - - +Supporting Python3 version +------------------------- +Right now, this library only has be used in Python2 version. Python2 will not been +maintained after 2020, besides part of ONAP project have used python3 version. +It's be better to support Python2 and Python3 version + + +Markers +------- +Markers can be used to characterize log entries. They allow message that has +a specific meaning to be cheaply and easily identified in logger output, without +inherently unreliable schemes like scanning for magic strings in the text of each +log message. +Onap logging requires the emission of markers reporting entry, exit and invocation +as the execution if requests pass between ONAP components. This information is used +to generate a call graph. +Useful and commonplace, See https://stackoverflow.com/questions/4165558/best-practices-for-using-markers-in-slf4j-logback + + +colored terminal output +----------------------- +As we known, in log4j coloring is supported. It would be better to render logging messages in colors. +Bash colors refer: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors + +The standard colors(nosupport windows) list as below: ++---------------------+-------------------------+------------------------+ +| **Text color** | **Hightlight color** | **Text Attribute** | ++=====================+==================================================+ +| Black | Black | Normal | ++---------------------+--------------------------------------------------+ +| Red | Red | Bold | ++---------------------+--------------------------------------------------+ +| Green | Green | Underline | ++---------------------+--------------------------------------------------+ +| Yellow | Yellow | Blink | ++------------------------------------------------------------------------+ +| Blue | Blue | Invert | ++------------------------------------------------------------------------+ +| Purple | Purple | Hide | ++------------------------------------------------------------------------+ +| Cyan | Cyan | | ++------------------------------------------------------------------------+ +| White | White | | ++------------------------------------------------------------------------+ + + +Test +==== + +#. Unit tests with tox +#. CSIT tests, verify marker label in logging message diff --git a/multivimbroker/multivimbroker/forwarder/urls.py b/multivimbroker/multivimbroker/forwarder/urls.py index 5e1320e..b14333f 100644 --- a/multivimbroker/multivimbroker/forwarder/urls.py +++ b/multivimbroker/multivimbroker/forwarder/urls.py @@ -16,6 +16,7 @@ from django.conf.urls import url from rest_framework.urlpatterns import format_suffix_patterns +# API v0 from multivimbroker.forwarder.views import CheckCapacity from multivimbroker.forwarder.views import Extension from multivimbroker.forwarder.views import Forward @@ -34,8 +35,10 @@ from multivimbroker.forwarder.views import APIv1Registry from multivimbroker.forwarder.views import APIv1UnRegistry from multivimbroker.forwarder.views import APIv1VIMTypes from multivimbroker.forwarder.views import APIv1MultiPartView +from multivimbroker.forwarder.views import APIv1InfraWorkload urlpatterns = [ + # API v0 url(r'^api/multicloud/v0/vim_types$', VIMTypes.as_view()), url(r'^api/multicloud/v0/check_vim_capacity$', @@ -69,7 +72,7 @@ urlpatterns = [ url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)' r'/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/registry$', APIv1Registry.as_view()), - url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)i' + url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)' r'/(?P<cloud_region_id>[0-9a-zA-Z_-]+)$', APIv1UnRegistry.as_view()), url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)' @@ -81,6 +84,9 @@ urlpatterns = [ url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)' r'/(?P<cloud_region_id>[0-9a-zA-Z_-]+)', APIv1Forward.as_view()), + url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)' + r'/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/infra_workload', + APIv1InfraWorkload.as_view()), ] urlpatterns = format_suffix_patterns(urlpatterns) diff --git a/multivimbroker/multivimbroker/forwarder/views.py b/multivimbroker/multivimbroker/forwarder/views.py index ef7ab95..264692e 100644 --- a/multivimbroker/multivimbroker/forwarder/views.py +++ b/multivimbroker/multivimbroker/forwarder/views.py @@ -307,3 +307,21 @@ class APIv1MultiPartView(MultiPartView): vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) return super(APIv1MultiPartView, self).post(request, vimid) + + +class APIv1InfraWorkload(BaseServer): + + def post(self, request, cloud_owner, cloud_region_id): + vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) + return self.send(vimid, request.get_full_path(), request.body, "POST", + headers=originHeaders(request)) + + def get(self, request, cloud_owner, cloud_region_id): + vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) + return self.send(vimid, request.get_full_path(), request.body, "GET", + headers=originHeaders(request)) + + def delete(self, request, cloud_owner, cloud_region_id): + vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) + return self.send(vimid, request.get_full_path(), request.body, + "DELETE", headers=originHeaders(request)) diff --git a/multivimbroker/multivimbroker/swagger/multivim.server.swagger.json b/multivimbroker/multivimbroker/swagger/multivim.server.swagger.json index f54b481..7f949aa 100644 --- a/multivimbroker/multivimbroker/swagger/multivim.server.swagger.json +++ b/multivimbroker/multivimbroker/swagger/multivim.server.swagger.json @@ -231,6 +231,65 @@ } } } + }, + "/{vimid}/{tenantid}/servers/{serverid}/action": { + "post": { + "tags": [ + "vim servers action" + ], + "summary": "operate a server", + "description": "operate a server", + "operationId": "operate_vim_server", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "serverid", + "in": "path", + "description": "vim server id", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "body", + "description": "operate vim server request param", + "required": true, + "schema": { + "$ref": "#/definitions/OperateVimServer" + } + } + ], + "responses": { + "202": { + "description": "successful operation" + }, + "404": { + "description": "the vim id, tenant UUID or server id is wrong" + }, + "500": { + "description": "the vim server is not accessable" + } + } + } } }, "definitions": { @@ -483,6 +542,29 @@ "description": "0: Already exist 1: Newly created" } } + }, + "OperateVimServer": { + "type": "object", + "properties": { + "os-start": { + "type": "null", + "description": "the action to start a stopped server" + }, + "os-stop": { + "type": "null", + "description": "the action to stop a running server" + }, + "reboot": { + "type": "object", + "description": "The action to reboot a server", + "properties": { + "type": { + "type": "string", + "description": "the type of the reboot action: the valid values are HARD and SOFT" + } + } + } + } } } } |