Fix error trace induced by dhcp test actions
Once the agent is removed, we are unable to deallocate
dhcp resources for the port until the entire network is
torn down; this is fine, but by doing so we cause Neutron
Server to emit a log error.
This patch simply deletes the port before doing the
disassociation, however a cleaner way to deal with this
would be to avoid relying on port creation to trigger a
network scheduling, though, this would require a more
elaborated fix.
Closes-bug: 1292242
Change-Id: I187d8dd707d67eb39446a5558913331310bd1f47
diff --git a/tempest/api/network/admin/test_dhcp_agent_scheduler.py b/tempest/api/network/admin/test_dhcp_agent_scheduler.py
index ecd992a..0e601d1 100644
--- a/tempest/api/network/admin/test_dhcp_agent_scheduler.py
+++ b/tempest/api/network/admin/test_dhcp_agent_scheduler.py
@@ -26,7 +26,7 @@
msg = "dhcp_agent_scheduler extension not enabled."
raise cls.skipException(msg)
# Create a network and make sure it will be hosted by a
- # dhcp agent.
+ # dhcp agent: this is done by creating a regular port
cls.network = cls.create_network()
cls.subnet = cls.create_subnet(cls.network)
cls.cidr = cls.subnet['cidr']
@@ -60,6 +60,9 @@
@test.attr(type='smoke')
def test_remove_network_from_dhcp_agent(self):
+ # The agent is now bound to the network, we can free the port
+ self.client.delete_port(self.port['id'])
+ self.ports.remove(self.port)
resp, body = self.admin_client.list_dhcp_agent_hosting_network(
self.network['id'])
agents = body['agents']