
* Introduces two new optional attributes for Subnets: * ipv6_ra_mode * ipv6_address_mode Both attributes accept the following values: * dhcpv6-stateful * dhcpv6-stateless * slaac In addition to these values, additional behaviors are specified for when only one of the attributes is set. For example, a Neutron network that uses a physical router as a gateway, that transmits ICMPv6 Router Advertisement packets to configure hosts on the network will create Neutron Subnets that have ipv6_ra_mode *not* set, and ipv6_address_mode set to 'slaac' so that Neutron will calculate EUI64 addresses for each port assigned to the subnet, and not spawn a Dnsmasq process. These attributes maintain backwards compatability with the enable_dhcp Subnet attribute, by requiring a subnet with these attributes to also have enable_dhcp set to True. DocImpact Implements bp ipv6-two-attributes Change-Id: I5b2313fff5dca1c16ff939fdc4397d7f95ba3ba5
150 lines
5.6 KiB
Python
150 lines
5.6 KiB
Python
# Copyright 2014 OneConvergence, Inc. 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.
|
|
#
|
|
|
|
"""Test Library for OneConvergencePlugin."""
|
|
|
|
import contextlib
|
|
import uuid
|
|
|
|
import mock
|
|
from oslo.config import cfg
|
|
|
|
from neutron import context
|
|
from neutron.extensions import portbindings
|
|
from neutron.manager import NeutronManager
|
|
from neutron.plugins.oneconvergence import plugin as nvsd_plugin
|
|
from neutron.tests.unit import _test_extension_portbindings as test_bindings
|
|
from neutron.tests.unit import test_db_plugin as test_plugin
|
|
from neutron.tests.unit import test_l3_plugin
|
|
|
|
PLUGIN_NAME = 'neutron.plugins.oneconvergence.plugin.OneConvergencePluginV2'
|
|
|
|
|
|
class OneConvergencePluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
|
|
_plugin_name = PLUGIN_NAME
|
|
|
|
def setUp(self):
|
|
def mocked_oneconvergence_init(self):
|
|
def side_effect(*args, **kwargs):
|
|
return {'id': str(uuid.uuid4())}
|
|
|
|
self.nvsdlib = mock.Mock()
|
|
self.nvsdlib.create_network.side_effect = side_effect
|
|
|
|
with mock.patch.object(nvsd_plugin.OneConvergencePluginV2,
|
|
'oneconvergence_init',
|
|
new=mocked_oneconvergence_init):
|
|
super(OneConvergencePluginV2TestCase,
|
|
self).setUp(self._plugin_name)
|
|
|
|
|
|
class TestOneConvergencePluginNetworksV2(test_plugin.TestNetworksV2,
|
|
OneConvergencePluginV2TestCase):
|
|
pass
|
|
|
|
|
|
class TestOneConvergencePluginSubnetsV2(test_plugin.TestSubnetsV2,
|
|
OneConvergencePluginV2TestCase):
|
|
def test_update_subnet_inconsistent_ipv6_gatewayv4(self):
|
|
self.skipTest("NVSD Plugin does not support IPV6.")
|
|
|
|
def test_create_subnet_with_v6_allocation_pool(self):
|
|
self.skipTest("NVSD Plugin does not support IPV6.")
|
|
|
|
def test_update_subnet_inconsistent_ipv6_hostroute_dst_v4(self):
|
|
self.skipTest("NVSD Plugin does not support IPV6.")
|
|
|
|
def test_update_subnet_inconsistent_ipv6_hostroute_np_v4(self):
|
|
self.skipTest("NVSD Plugin does not support IPV6.")
|
|
|
|
def test_create_subnet_ipv6_attributes(self):
|
|
self.skipTest("NVSD Plugin does not support IPV6.")
|
|
|
|
def test_create_subnet_ipv6_single_attribute_set(self):
|
|
self.skipTest("NVSD Plugin does not support IPV6.")
|
|
|
|
def test_update_subnet_ipv6_attributes(self):
|
|
self.skipTest("NVSD Plugin does not support IPV6.")
|
|
|
|
def test_update_subnet_ipv6_inconsistent_enable_dhcp(self):
|
|
self.skipTest("NVSD Plugin does not support IPV6.")
|
|
|
|
def test_update_subnet_ipv6_inconsistent_ra_attribute(self):
|
|
self.skipTest("NVSD Plugin does not support IPV6.")
|
|
|
|
def test_update_subnet_ipv6_inconsistent_address_attribute(self):
|
|
self.skipTest("NVSD Plugin does not support IPV6.")
|
|
|
|
|
|
class TestOneConvergencePluginPortsV2(test_plugin.TestPortsV2,
|
|
test_bindings.PortBindingsTestCase,
|
|
OneConvergencePluginV2TestCase):
|
|
VIF_TYPE = portbindings.VIF_TYPE_OVS
|
|
|
|
def test_requested_subnet_id_v4_and_v6(self):
|
|
self.skipTest("NVSD Plugin does not support IPV6.")
|
|
|
|
def test_port_vif_details(self):
|
|
plugin = NeutronManager.get_plugin()
|
|
with self.port(name='name') as port1:
|
|
ctx = context.get_admin_context()
|
|
port = plugin.get_port(ctx, port1['port']['id'])
|
|
self.assertEqual(port['binding:vif_type'],
|
|
portbindings.VIF_TYPE_OVS)
|
|
|
|
def test_ports_vif_details(self):
|
|
cfg.CONF.set_default('allow_overlapping_ips', True)
|
|
plugin = NeutronManager.get_plugin()
|
|
with contextlib.nested(self.port(), self.port()) as (port1, port2):
|
|
ctx = context.get_admin_context()
|
|
ports = plugin.get_ports(ctx)
|
|
self.assertEqual(len(ports), 2)
|
|
for port in ports:
|
|
self.assertEqual(port['binding:vif_type'],
|
|
portbindings.VIF_TYPE_OVS)
|
|
|
|
|
|
class TestOneConvergenceBasicGet(test_plugin.TestBasicGet,
|
|
OneConvergencePluginV2TestCase):
|
|
pass
|
|
|
|
|
|
class TestOneConvergenceV2HTTPResponse(test_plugin.TestV2HTTPResponse,
|
|
OneConvergencePluginV2TestCase):
|
|
pass
|
|
|
|
|
|
class TestOneConvergenceL3NatTestCase(test_l3_plugin.L3NatDBIntTestCase):
|
|
_plugin_name = PLUGIN_NAME
|
|
|
|
def setUp(self):
|
|
def mocked_oneconvergence_init(self):
|
|
def side_effect(*args, **kwargs):
|
|
return {'id': str(uuid.uuid4())}
|
|
|
|
self.nvsdlib = mock.Mock()
|
|
self.nvsdlib.create_network.side_effect = side_effect
|
|
|
|
ext_mgr = test_l3_plugin.L3TestExtensionManager()
|
|
|
|
with mock.patch.object(nvsd_plugin.OneConvergencePluginV2,
|
|
'oneconvergence_init',
|
|
new=mocked_oneconvergence_init):
|
|
super(TestOneConvergenceL3NatTestCase,
|
|
self).setUp(plugin=self._plugin_name, ext_mgr=ext_mgr)
|
|
|
|
def test_floatingip_with_invalid_create_port(self):
|
|
self._test_floatingip_with_invalid_create_port(self._plugin_name)
|