Move internal helpers to the class that uses them
1. if some helpers are used only by one class, then it needn't appear in scenario.manager.py. 2. if some helpers are used outside scenario.manager.py, then it shouldn't be defined as internal helpers. This is to move some internal helpers to the only class that uses them. Change-Id: I2543daea8d5e33589ebd909ec31551c77e0faaae
This commit is contained in:
parent
4dfd78a4e0
commit
afe96b8a24
|
@ -858,22 +858,6 @@ class NetworkScenarioTest(ScenarioTest):
|
|||
floating_ip['id'])
|
||||
return floating_ip
|
||||
|
||||
def _associate_floating_ip(self, floating_ip, server):
|
||||
port_id, _ = self._get_server_port_id_and_ip4(server)
|
||||
kwargs = dict(port_id=port_id)
|
||||
floating_ip = self.floating_ips_client.update_floatingip(
|
||||
floating_ip['id'], **kwargs)['floatingip']
|
||||
self.assertEqual(port_id, floating_ip['port_id'])
|
||||
return floating_ip
|
||||
|
||||
def _disassociate_floating_ip(self, floating_ip):
|
||||
""":param floating_ip: floating_ips_client.create_floatingip"""
|
||||
kwargs = dict(port_id=None)
|
||||
floating_ip = self.floating_ips_client.update_floatingip(
|
||||
floating_ip['id'], **kwargs)['floatingip']
|
||||
self.assertIsNone(floating_ip['port_id'])
|
||||
return floating_ip
|
||||
|
||||
def check_floating_ip_status(self, floating_ip, status):
|
||||
"""Verifies floatingip reaches the given status
|
||||
|
||||
|
@ -1183,12 +1167,6 @@ class NetworkScenarioTest(ScenarioTest):
|
|||
router['id'])
|
||||
return router
|
||||
|
||||
def _update_router_admin_state(self, router, admin_state_up):
|
||||
kwargs = dict(admin_state_up=admin_state_up)
|
||||
router = self.routers_client.update_router(
|
||||
router['id'], **kwargs)['router']
|
||||
self.assertEqual(admin_state_up, router['admin_state_up'])
|
||||
|
||||
def create_networks(self, networks_client=None,
|
||||
routers_client=None, subnets_client=None,
|
||||
tenant_id=None, dns_nameservers=None,
|
||||
|
|
|
@ -213,17 +213,20 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
|
|||
|
||||
def _disassociate_floating_ips(self):
|
||||
floating_ip, _ = self.floating_ip_tuple
|
||||
self._disassociate_floating_ip(floating_ip)
|
||||
self.floating_ip_tuple = Floating_IP_tuple(
|
||||
floating_ip, None)
|
||||
floating_ip = self.floating_ips_client.update_floatingip(
|
||||
floating_ip['id'], port_id=None)['floatingip']
|
||||
self.assertIsNone(floating_ip['port_id'])
|
||||
self.floating_ip_tuple = Floating_IP_tuple(floating_ip, None)
|
||||
|
||||
def _reassociate_floating_ips(self):
|
||||
floating_ip, server = self.floating_ip_tuple
|
||||
# create a new server for the floating ip
|
||||
server = self._create_server(self.network)
|
||||
self._associate_floating_ip(floating_ip, server)
|
||||
self.floating_ip_tuple = Floating_IP_tuple(
|
||||
floating_ip, server)
|
||||
port_id, _ = self._get_server_port_id_and_ip4(server)
|
||||
floating_ip = self.floating_ips_client.update_floatingip(
|
||||
floating_ip['id'], port_id=port_id)['floatingip']
|
||||
self.assertEqual(port_id, floating_ip['port_id'])
|
||||
self.floating_ip_tuple = Floating_IP_tuple(floating_ip, server)
|
||||
|
||||
def _create_new_network(self, create_gateway=False):
|
||||
self.new_net = self._create_network()
|
||||
|
@ -355,6 +358,12 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
|
|||
self.check_remote_connectivity(ssh_source, remote_ip,
|
||||
should_connect)
|
||||
|
||||
def _update_router_admin_state(self, router, admin_state_up):
|
||||
kwargs = dict(admin_state_up=admin_state_up)
|
||||
router = self.routers_client.update_router(
|
||||
router['id'], **kwargs)['router']
|
||||
self.assertEqual(admin_state_up, router['admin_state_up'])
|
||||
|
||||
@decorators.attr(type='smoke')
|
||||
@decorators.idempotent_id('f323b3ba-82f8-4db7-8ea6-6a895869ec49')
|
||||
@utils.services('compute', 'network')
|
||||
|
|
Loading…
Reference in New Issue