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
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'
'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'):
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):
'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')
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: