From b194fd076379bbe28c6e0bc30f4334658c220874 Mon Sep 17 00:00:00 2001 From: "masoom.alam" Date: Wed, 9 Dec 2015 07:55:10 -0500 Subject: [PATCH 1/3] testing --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9803023f76d..f4a741404c7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +hi Cisco Clone of Neutron Repository with extra features which couldn't make it to upstream. From c6bfa9b16c3cff11ea91a3999d0442a75e3846d9 Mon Sep 17 00:00:00 2001 From: "masoom.alam" Date: Wed, 9 Dec 2015 08:03:10 -0500 Subject: [PATCH 2/3] removed hi --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index f4a741404c7..9803023f76d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -hi Cisco Clone of Neutron Repository with extra features which couldn't make it to upstream. From 37982903265bb40cb0d1bae5d61ccf62b1f53c20 Mon Sep 17 00:00:00 2001 From: "masoom.alam" Date: Wed, 9 Dec 2015 08:48:38 -0500 Subject: [PATCH 3/3] US33334 changed the neutron code to include the functionality of assigning an ip to a particular tenant --- neutron/common/constants.py | 1 + neutron/db/l3_db.py | 36 ++++++++++++++++++++++++++---------- neutron/extensions/l3.py | 2 +- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/neutron/common/constants.py b/neutron/common/constants.py index e424450d25a..bc37a87cb16 100644 --- a/neutron/common/constants.py +++ b/neutron/common/constants.py @@ -28,6 +28,7 @@ FLOATINGIP_STATUS_ACTIVE = 'ACTIVE' FLOATINGIP_STATUS_DOWN = 'DOWN' FLOATINGIP_STATUS_ERROR = 'ERROR' +PORT_STATUS_NOTAPPLICABLE = 'N/A' DEVICE_OWNER_ROUTER_HA_INTF = "network:router_ha_interface" DEVICE_OWNER_ROUTER_INTF = "network:router_interface" diff --git a/neutron/db/l3_db.py b/neutron/db/l3_db.py index 65898cca46a..3fa7c18bd07 100644 --- a/neutron/db/l3_db.py +++ b/neutron/db/l3_db.py @@ -777,16 +777,32 @@ def create_floatingip(self, context, floatingip, # This external port is never exposed to the tenant. # it is used purely for internal system and admin use when # managing floating IPs. - external_port = self._core_plugin.create_port(context.elevated(), { - 'port': - {'tenant_id': '', # tenant intentionally not set - 'network_id': f_net_id, - 'mac_address': attributes.ATTR_NOT_SPECIFIED, - 'fixed_ips': attributes.ATTR_NOT_SPECIFIED, - 'admin_state_up': True, - 'device_id': fip_id, - 'device_owner': DEVICE_OWNER_FLOATINGIP, - 'name': ''}}) + #external_port = self._core_plugin.create_port(context.elevated(), { + # 'port': + #{'tenant_id': '', # tenant intentionally not set + #'network_id': f_net_id, + #'mac_address': attributes.ATTR_NOT_SPECIFIED, + #'fixed_ips': attributes.ATTR_NOT_SPECIFIED, + #'admin_state_up': True, + #'device_id': fip_id, + #'device_owner': DEVICE_OWNER_FLOATINGIP, + #'name': ''}}) + port = {'tenant_id': '', # tenant intentionally not set + 'network_id': f_net_id, + 'mac_address': attributes.ATTR_NOT_SPECIFIED, + 'fixed_ips': attributes.ATTR_NOT_SPECIFIED, + 'admin_state_up': True, + 'device_id': fip_id, + 'device_owner': DEVICE_OWNER_FLOATINGIP, + 'status': l3_constants.PORT_STATUS_NOTAPPLICABLE, + 'name': ''} + + if fip.get('floating_ip_address'): + port['fixed_ips'] = [ + {'ip_address': fip['floating_ip_address']}] + + external_port = self._core_plugin.create_port(context.elevated(), + {'port': port}) # Ensure IP addresses are allocated on external port if not external_port['fixed_ips']: raise n_exc.ExternalIpAddressExhausted(net_id=f_net_id) diff --git a/neutron/extensions/l3.py b/neutron/extensions/l3.py index 1497d9fb45c..9088368e234 100644 --- a/neutron/extensions/l3.py +++ b/neutron/extensions/l3.py @@ -120,7 +120,7 @@ class RouterExternalGatewayInUseByFloatingIp(qexception.InUse): 'validate': {'type:uuid': None}, 'is_visible': True, 'primary_key': True}, - 'floating_ip_address': {'allow_post': False, 'allow_put': False, + 'floating_ip_address': {'allow_post': True, 'allow_put': False, 'validate': {'type:ip_address_or_none': None}, 'is_visible': True}, 'floating_network_id': {'allow_post': True, 'allow_put': False,