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
This commit is contained in:
parent
5228e6ade7
commit
475695f968
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
features:
|
||||
Added support for IPv6 default gateways to the
|
||||
NetApp driver.
|
Loading…
Reference in New Issue
Block a user