Cleaned up class variable scope issue.
self.router was used as a local variable to a few functions.
Change-Id: I3d6aa0731a227c255ad9966ea3c5052a2fa4898d
Closes-Bug: #1482299
diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py
index 78b51c8..1308414 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -277,11 +277,11 @@
test_routes = []
routes_num = 5
# Create a router
- self.router = self._create_router(
+ router = self._create_router(
data_utils.rand_name('router-'), True)
self.addCleanup(
self._delete_extra_routes,
- self.router['id'])
+ router['id'])
# Update router extra route, second ip of the range is
# used as next hop
for i in range(routes_num):
@@ -290,7 +290,7 @@
next_cidr = next_cidr.next()
# Add router interface with subnet id
- self.create_router_interface(self.router['id'], subnet['id'])
+ self.create_router_interface(router['id'], subnet['id'])
cidr = netaddr.IPNetwork(subnet['cidr'])
next_hop = str(cidr[2])
@@ -300,9 +300,9 @@
)
test_routes.sort(key=lambda x: x['destination'])
- extra_route = self.client.update_extra_routes(self.router['id'],
+ extra_route = self.client.update_extra_routes(router['id'],
test_routes)
- show_body = self.client.show_router(self.router['id'])
+ show_body = self.client.show_router(router['id'])
# Assert the number of routes
self.assertEqual(routes_num, len(extra_route['router']['routes']))
self.assertEqual(routes_num, len(show_body['router']['routes']))
@@ -327,13 +327,13 @@
@test.idempotent_id('a8902683-c788-4246-95c7-ad9c6d63a4d9')
def test_update_router_admin_state(self):
- self.router = self._create_router(data_utils.rand_name('router-'))
- self.assertFalse(self.router['admin_state_up'])
+ router = self._create_router(data_utils.rand_name('router-'))
+ self.assertFalse(router['admin_state_up'])
# Update router admin state
- update_body = self.client.update_router(self.router['id'],
+ update_body = self.client.update_router(router['id'],
admin_state_up=True)
self.assertTrue(update_body['router']['admin_state_up'])
- show_body = self.client.show_router(self.router['id'])
+ show_body = self.client.show_router(router['id'])
self.assertTrue(show_body['router']['admin_state_up'])
@test.attr(type='smoke')