]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Set floating IP port status to "N/A"
authorKevin Benton <blak111@gmail.com>
Wed, 17 Sep 2014 03:36:42 +0000 (20:36 -0700)
committerKevin Benton <blak111@gmail.com>
Mon, 30 Mar 2015 10:29:04 +0000 (03:29 -0700)
The status of the port associated with a floating IP
would always show as DOWN. This caused confusion to
operators that weren't aware that this is expected behavior
since the port is only used for an IP allocation.

This commit sets the port status to "N/A" to reflect the fact
that the port associated with a floating IP has no operational
status.

DocImpact
APIImpact

Closes-Bug: #1196851
Change-Id: I2f94afa001b213d61f0e5892aae2e6e6de98fe4c

neutron/common/constants.py
neutron/db/l3_db.py
neutron/plugins/ml2/plugin.py
neutron/tests/unit/ibm/test_sdnve_plugin.py
neutron/tests/unit/test_l3_plugin.py

index 185c6d0d6b77fdce6f628784dc6a181b8fbae42c..4839dde3e666fa7b364d6fa9e2f78fb1274b1464 100644 (file)
@@ -24,6 +24,7 @@ PORT_STATUS_ACTIVE = 'ACTIVE'
 PORT_STATUS_BUILD = 'BUILD'
 PORT_STATUS_DOWN = 'DOWN'
 PORT_STATUS_ERROR = 'ERROR'
+PORT_STATUS_NOTAPPLICABLE = 'N/A'
 
 FLOATINGIP_STATUS_ACTIVE = 'ACTIVE'
 FLOATINGIP_STATUS_DOWN = 'DOWN'
index a07574c95f8349bdd30fc41c85398f764e4dd385..954f01da9abff9b85769da4e92f4249ce45d9453 100644 (file)
@@ -861,6 +861,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase):
                     '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'):
index c4dfe26ca446c6ee75405d9ca02c849f9beac580..0f42741f83fbc874082b0460a220756563fb0ab8 100644 (file)
@@ -931,7 +931,8 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
 
     def _create_port_db(self, context, port):
         attrs = port[attributes.PORT]
-        attrs['status'] = const.PORT_STATUS_DOWN
+        if not attrs.get('status'):
+            attrs['status'] = const.PORT_STATUS_DOWN
 
         session = context.session
         with session.begin(subtransactions=True):
index 3edb461723a4883941e01ad9bf1acf07ef4b1242..82ba6181f19702958816867affe7f2917b7a2f4e 100644 (file)
@@ -122,3 +122,6 @@ class IBMPluginRouterTestCase(test_l3_plugin.L3NatDBIntTestCase):
                        'Client',
                        new=MockClient)):
             super(IBMPluginRouterTestCase, self).setUp(plugin=_plugin_name)
+
+    def test_floating_port_status_not_applicable(self):
+        self.skipTest('Plugin changes floating port status')
index df3945816ea10f1dcd7c04f6a62f9258ce01f029..2eb95469a5ad8df534788b5c7ea1f5492f88a3fb 100644 (file)
@@ -1658,6 +1658,13 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
             self.assertIsNotNone(body['floatingip']['fixed_ip_address'])
             self.assertIsNotNone(body['floatingip']['router_id'])
 
+    def test_floating_port_status_not_applicable(self):
+        with self.floatingip_with_assoc():
+            port_body = self._list('ports',
+               query_params='device_owner=network:floatingip')['ports'][0]
+            self.assertEqual(l3_constants.PORT_STATUS_NOTAPPLICABLE,
+                             port_body['status'])
+
     def test_floatingip_update(
         self, expected_status=l3_constants.FLOATINGIP_STATUS_ACTIVE):
         with self.port() as p: