From fe389eea25286a067f92a55ea9ad7d73160bbb25 Mon Sep 17 00:00:00 2001 From: Reedip Date: Sat, 12 Aug 2017 06:25:32 +0000 Subject: [PATCH] Add ipv6 canonical address converter to API This patch takes care of converting of IPv6 address for gateway-ip, cidr and allocation-pools to canonical format. Closes-Bug:1531103 Change-Id: Ibef0bd9a2f7b7dd8ddccc183f17aa31e426c7fd0 --- neutron_lib/api/definitions/subnet.py | 12 ++++++++---- .../ipv6-canonical-address-13900a784f847ce3.yaml | 6 ++++++ 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/ipv6-canonical-address-13900a784f847ce3.yaml diff --git a/neutron_lib/api/definitions/subnet.py b/neutron_lib/api/definitions/subnet.py index 2cea0d4f8..b76567539 100644 --- a/neutron_lib/api/definitions/subnet.py +++ b/neutron_lib/api/definitions/subnet.py @@ -58,17 +58,21 @@ RESOURCE_ATTRIBUTE_MAP = { 'cidr': {'allow_post': True, 'allow_put': False, 'default': constants.ATTR_NOT_SPECIFIED, + 'convert_to': converters.convert_cidr_to_canonical_format, 'validate': {'type:subnet_or_none': None}, 'required_by_policy': False, 'is_visible': True}, 'gateway_ip': {'allow_post': True, 'allow_put': True, 'default': constants.ATTR_NOT_SPECIFIED, + 'convert_to': converters.convert_ip_to_canonical_format, 'validate': {'type:ip_address_or_none': None}, 'is_visible': True}, - 'allocation_pools': {'allow_post': True, 'allow_put': True, - 'default': constants.ATTR_NOT_SPECIFIED, - 'validate': {'type:ip_pools': None}, - 'is_visible': True}, + 'allocation_pools': { + 'allow_post': True, 'allow_put': True, + 'default': constants.ATTR_NOT_SPECIFIED, + 'convert_to': converters.convert_ip_to_canonical_format, + 'validate': {'type:ip_pools': None}, + 'is_visible': True}, 'dns_nameservers': {'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_none_to_empty_list, diff --git a/releasenotes/notes/ipv6-canonical-address-13900a784f847ce3.yaml b/releasenotes/notes/ipv6-canonical-address-13900a784f847ce3.yaml new file mode 100644 index 000000000..f3af7e761 --- /dev/null +++ b/releasenotes/notes/ipv6-canonical-address-13900a784f847ce3.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + The ``gateway`` , ``allocation_pools`` and ``cidr`` attributes of a Subnet with IPv6 addresses + are now converted to IPv6 canonical format to address. + `bug 1531103 `_