use l2 adjacency api def from neutron-lib
The l2 adjacency extension's API definition was rehomed into neutron-lib with commit Iecc36b68693cc6f69765e31ed37292b4690a9b75. This patch consumes the API definition removing the rehomed code from neutron and updating references to use lib's code. NeutronLibImpact Change-Id: I55af489b4f95720d5bfac015ff454eca02609545
This commit is contained in:
parent
8eaac1f8a9
commit
4dce3f5dbb
@ -13,20 +13,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.api.definitions import l2_adjacency as apidef
|
||||
from neutron_lib.api import extensions
|
||||
|
||||
|
||||
L2_ADJACENCY = 'l2_adjacency'
|
||||
EXTENDED_ATTRIBUTES_2_0 = {
|
||||
'networks': {
|
||||
L2_ADJACENCY: {'allow_post': False,
|
||||
'allow_put': False,
|
||||
'is_visible': True}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class L2_adjacency(extensions.ExtensionDescriptor):
|
||||
class L2_adjacency(extensions.APIExtensionDescriptor):
|
||||
"""Extension class supporting L2 Adjacency for Routed Networks
|
||||
|
||||
The following class is used by neutron's extension framework
|
||||
@ -34,25 +25,4 @@ class L2_adjacency(extensions.ExtensionDescriptor):
|
||||
Routed Network, exposing the same to clients.
|
||||
No new resources have been defined by this extension.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def get_name(cls):
|
||||
return "L2 Adjacency"
|
||||
|
||||
@classmethod
|
||||
def get_alias(cls):
|
||||
return "l2_adjacency"
|
||||
|
||||
@classmethod
|
||||
def get_description(cls):
|
||||
return "Display L2 Adjacency for Neutron Networks."
|
||||
|
||||
@classmethod
|
||||
def get_updated(cls):
|
||||
return "2016-04-12T16:00:00-00:00"
|
||||
|
||||
def get_extended_resources(self, version):
|
||||
if version == "2.0":
|
||||
return EXTENDED_ATTRIBUTES_2_0
|
||||
else:
|
||||
return {}
|
||||
api_definition = apidef
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
from keystoneauth1 import loading as ks_loading
|
||||
import netaddr
|
||||
from neutron_lib.api.definitions import l2_adjacency as l2adj_apidef
|
||||
from neutron_lib.api.definitions import network as net_def
|
||||
from neutron_lib.api.definitions import port as port_def
|
||||
from neutron_lib.api.definitions import subnet as subnet_def
|
||||
@ -36,7 +37,6 @@ from neutron.db import api as db_api
|
||||
from neutron.db.models import segment as segment_model
|
||||
from neutron.db import models_v2
|
||||
from neutron.extensions import ip_allocation
|
||||
from neutron.extensions import l2_adjacency
|
||||
from neutron.extensions import segment
|
||||
from neutron.notifiers import batch_notifier
|
||||
from neutron.services.segments import db
|
||||
@ -57,7 +57,8 @@ class Plugin(db.SegmentDbMixin, segment.SegmentPluginBase):
|
||||
|
||||
_instance = None
|
||||
|
||||
supported_extension_aliases = ["segment", "ip_allocation", "l2_adjacency"]
|
||||
supported_extension_aliases = ["segment", "ip_allocation",
|
||||
l2adj_apidef.ALIAS]
|
||||
|
||||
def __init__(self):
|
||||
self.nova_updater = NovaSegmentNotifier()
|
||||
@ -72,7 +73,7 @@ class Plugin(db.SegmentDbMixin, segment.SegmentPluginBase):
|
||||
# it's a thing.
|
||||
is_adjacent = (not network_db.subnets
|
||||
or not network_db.subnets[0].segment_id)
|
||||
network_res[l2_adjacency.L2_ADJACENCY] = is_adjacent
|
||||
network_res[l2adj_apidef.L2_ADJACENCY] = is_adjacent
|
||||
|
||||
@staticmethod
|
||||
@resource_extend.extends([subnet_def.COLLECTION_NAME])
|
||||
|
@ -17,6 +17,7 @@ import copy
|
||||
from keystoneauth1 import exceptions as ks_exc
|
||||
import mock
|
||||
import netaddr
|
||||
from neutron_lib.api.definitions import l2_adjacency as l2adj_apidef
|
||||
from neutron_lib.api.definitions import portbindings
|
||||
from neutron_lib.callbacks import events
|
||||
from neutron_lib.callbacks import exceptions
|
||||
@ -39,7 +40,6 @@ from neutron.db import db_base_plugin_v2
|
||||
from neutron.db import portbindings_db
|
||||
from neutron.db import segments_db
|
||||
from neutron.extensions import ip_allocation
|
||||
from neutron.extensions import l2_adjacency
|
||||
from neutron.extensions import segment as ext_segment
|
||||
from neutron.objects import network
|
||||
from neutron.services.segments import db
|
||||
@ -843,7 +843,7 @@ class SegmentAwareIpamTestCase(SegmentTestCase):
|
||||
request = self.new_show_request('networks', network_id)
|
||||
response = self.deserialize(self.fmt, request.get_response(self.api))
|
||||
self.assertEqual(is_adjacent,
|
||||
response['network'][l2_adjacency.L2_ADJACENCY])
|
||||
response['network'][l2adj_apidef.L2_ADJACENCY])
|
||||
|
||||
|
||||
class TestSegmentAwareIpam(SegmentAwareIpamTestCase):
|
||||
|
Loading…
Reference in New Issue
Block a user