Automaticall set router interface port status to active

In Dragonflow, the router interface port is virtual, i.e. it does not really
exist. Therefore, no wiring is needed for it. Therefore, its status can
be automatically set to active.

Change-Id: Id0e40752f0b8439ca9609b8fe7236ce2153cd5a8
Closes-Bug: #1452274
This commit is contained in:
Omer Anson 2017-12-26 17:46:16 +02:00
parent 746e80df55
commit d0046a0380
2 changed files with 15 additions and 0 deletions

View File

@ -248,6 +248,9 @@ class DFL3AgentlessRouterPlugin(service_base.ServicePluginBase,
lrouter.add_router_port(logical_router_port)
self.nb_api.update(lrouter)
self.core_plugin.update_port_status(context,
port['id'],
const.PORT_STATUS_ACTIVE)
return router_port_info
@lock_db.wrap_db_lock(lock_db.RESOURCE_ROUTER_UPDATE_OR_DELETE)

View File

@ -123,6 +123,18 @@ class TestDFL3RouterPlugin(test_mech_driver.DFMechanismDriverTestCase,
lrouter.version = router_without_int['revision_number']
self.nb_api.update.assert_called_once_with(lrouter)
def test_router_interface_status(self):
router, lrouter = self._test_create_router_revision()
with self.subnet() as s:
data = {'subnet_id': s['subnet']['id']}
router_port_info = self.l3p.add_router_interface(self.context,
router['id'],
data)
port_id = router_port_info['port_id']
port = self.driver.get_port(self.context, port_id)
self.assertEqual(constants.PORT_STATUS_ACTIVE, port['status'])
def _test_create_floatingip_revision(self):
kwargs = {'arg_list': ('router:external',),
'router:external': True}