From 475695f96818eb5ddc1f85797fed7d0d96daabca Mon Sep 17 00:00:00 2001 From: Ben Swartzlander Date: Thu, 19 Oct 2017 15:04:51 -0400 Subject: [PATCH] Allow IPv6 gateways for the default route Remove assumption that subnets and gateways are always ipv4 in the NetApp driver. Partially implements: bp netapp-ontap-ipv6-support Change-Id: Ia26d55368aa5a08da7e0941170ed2ac23db307d4 --- .../netapp/dataontap/client/client_cmode.py | 7 ++++++- .../netapp/dataontap/client/test_client_cmode.py | 14 ++++++++++---- ...netapp-default-ipv6-route-13a9fd4959928524.yaml | 4 ++++ 3 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/netapp-default-ipv6-route-13a9fd4959928524.yaml diff --git a/manila/share/drivers/netapp/dataontap/client/client_cmode.py b/manila/share/drivers/netapp/dataontap/client/client_cmode.py index 32443c2c00..54e62695d9 100644 --- a/manila/share/drivers/netapp/dataontap/client/client_cmode.py +++ b/manila/share/drivers/netapp/dataontap/client/client_cmode.py @@ -609,7 +609,12 @@ class NetAppCmodeClient(client_base.NetAppBaseClient): raise exception.NetAppException(msg % msg_args) @na_utils.trace - def create_route(self, gateway, destination='0.0.0.0/0'): + def create_route(self, gateway, destination=None): + if not destination: + if ':' in gateway: + destination = '::/0' + else: + destination = '0.0.0.0/0' try: api_args = { 'destination': destination, diff --git a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py b/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py index d2ece0b1d7..eeb97a68ee 100644 --- a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py +++ b/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py @@ -1045,18 +1045,24 @@ class NetAppClientCmodeTestCase(test.TestCase): fake.PORT, fake.VLAN) - def test_create_route(self): + @ddt.data(('10.10.10.0/24', '10.10.10.1', False), + ('fc00::/7', 'fe80::1', False), + ('0.0.0.0/0', '10.10.10.1', True), + ('::/0', 'fe80::1', True)) + @ddt.unpack + def test_create_route(self, subnet, gateway, omit_destination): api_response = netapp_api.NaElement( fake.NET_ROUTES_CREATE_RESPONSE) expected_api_args = { - 'destination': fake.SUBNET, - 'gateway': fake.GATEWAY, + 'destination': subnet, + 'gateway': gateway, 'return-record': 'true', } self.mock_object( self.client, 'send_request', mock.Mock(return_value=api_response)) - self.client.create_route(fake.GATEWAY, destination=fake.SUBNET) + destination = None if omit_destination else subnet + self.client.create_route(gateway, destination=destination) self.client.send_request.assert_called_once_with( 'net-routes-create', expected_api_args) diff --git a/releasenotes/notes/netapp-default-ipv6-route-13a9fd4959928524.yaml b/releasenotes/notes/netapp-default-ipv6-route-13a9fd4959928524.yaml new file mode 100644 index 0000000000..142192957c --- /dev/null +++ b/releasenotes/notes/netapp-default-ipv6-route-13a9fd4959928524.yaml @@ -0,0 +1,4 @@ +--- +features: + Added support for IPv6 default gateways to the + NetApp driver.