neutron/neutron/extensions/data_plane_status.py
Carlos Goncalves 89de63de05 Port data plane status extension implementation
Implements the port data plane status extension. Third parties
can report via Neutron API issues in the underlying data plane
affecting connectivity from/to Neutron ports.

Supported statuses:
  - None: no status being reported; default value
  - ACTIVE: all is up and running
  - DOWN: no traffic can flow from/to the Neutron port

Setting attribute available to admin or any user with specific role
(default role: data_plane_integrator).

ML2 extension driver loaded on request via configuration:

  [ml2]
  extension_drivers = data_plane_status

Related-Bug: #1598081
Related-Bug: #1575146

DocImpact: users can get status of the underlying port data plane;
attribute writable by admin users and users granted the
'data-plane-integrator' role.
APIImpact: port now has data_plane_status attr, set on port update

Implements: blueprint port-data-plane-status

Depends-On: I04eef902b3310f799b1ce7ea44ed7cf77c74da04
Change-Id: Ic9e1e3ed9e3d4b88a4292114f4cb4192ac4b3502
2017-04-11 19:56:13 +00:00

48 lines
1.5 KiB
Python

# Copyright (c) 2017 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.api.definitions import data_plane_status
from neutron_lib.api import extensions
class Data_plane_status(extensions.ExtensionDescriptor):
@classmethod
def get_name(cls):
return data_plane_status.NAME
@classmethod
def get_alias(cls):
return data_plane_status.ALIAS
@classmethod
def get_description(cls):
return data_plane_status.DESCRIPTION
@classmethod
def get_updated(cls):
return data_plane_status.UPDATED_TIMESTAMP
def get_required_extensions(self):
return data_plane_status.REQUIRED_EXTENSIONS or []
def get_optional_extensions(self):
return data_plane_status.OPTIONAL_EXTENSIONS or []
def get_extended_resources(self, version):
if version == "2.0":
return data_plane_status.RESOURCE_ATTRIBUTE_MAP
else:
return {}