Revert "Remove get_node_with_dhcp method"

This reverts commit 3431eb870a.

Closes-bug: #1493228
Change-Id: Id3ed8e15fc33c545658a4b51c749bb6ee6a2383a
This commit is contained in:
Artem Panchenko 2015-09-09 22:56:43 +00:00
parent 7f14cdc2e3
commit b423cab215

View File

@ -34,6 +34,16 @@ from fuelweb_test.tests import base_test_case
class TestNeutronFailover(base_test_case.TestBasic): class TestNeutronFailover(base_test_case.TestBasic):
"""TestNeutronFailover.""" # TODO documentation """TestNeutronFailover.""" # TODO documentation
@classmethod
@logwrap
def get_node_with_dhcp(cls, self, os_conn, net_id):
node = os_conn.get_node_with_dhcp_for_network(net_id)[0]
node_fqdn = self.fuel_web.get_fqdn_by_hostname(node)
logger.debug('node name with dhcp is {0}'.format(node))
devops_node = self.fuel_web.find_devops_node_by_nailgun_fqdn(
node_fqdn, self.env.d_env.nodes().slaves[0:6])
return devops_node
@classmethod @classmethod
@logwrap @logwrap
def get_node_with_l3(cls, self, node_with_l3): def get_node_with_l3(cls, self, node_with_l3):
@ -159,11 +169,9 @@ class TestNeutronFailover(base_test_case.TestBasic):
os_conn = os_actions.OpenStackActions( os_conn = os_actions.OpenStackActions(
self.fuel_web.get_public_vip(cluster_id)) self.fuel_web.get_public_vip(cluster_id))
# Get remote to the controller with running DHCP agent for net04
net_id = os_conn.get_network('net04')['id'] net_id = os_conn.get_network('net04')['id']
devops_node = self.get_node_with_dhcp(self, os_conn, net_id)
# any controller could be used as devops_node
devops_node = self.env.d_env.nodes().slaves[0]
_ip = self.fuel_web.get_nailgun_node_by_name(devops_node.name)['ip'] _ip = self.fuel_web.get_nailgun_node_by_name(devops_node.name)['ip']
remote = self.env.d_env.get_ssh_to_remote(_ip) remote = self.env.d_env.get_ssh_to_remote(_ip)
@ -230,10 +238,11 @@ class TestNeutronFailover(base_test_case.TestBasic):
os_conn = os_actions.OpenStackActions( os_conn = os_actions.OpenStackActions(
self.fuel_web.get_public_vip(cluster_id)) self.fuel_web.get_public_vip(cluster_id))
# Get remote to the controller with running DHCP agent for net04
net_id = os_conn.get_network('net04')['id'] net_id = os_conn.get_network('net04')['id']
devops_node = self.get_node_with_dhcp(self, os_conn, net_id)
# any controller could be used _ip = self.fuel_web.get_nailgun_node_by_name(devops_node.name)['ip']
remote = self.fuel_web.get_ssh_for_node("slave-01") remote = self.env.d_env.get_ssh_to_remote(_ip)
dhcp_namespace = ''.join(remote.execute('ip netns | grep {0}'.format( dhcp_namespace = ''.join(remote.execute('ip netns | grep {0}'.format(
net_id))['stdout']).rstrip() net_id))['stdout']).rstrip()
@ -304,12 +313,12 @@ class TestNeutronFailover(base_test_case.TestBasic):
self.fuel_web.get_public_vip(cluster_id)) self.fuel_web.get_public_vip(cluster_id))
net_id = os_conn.get_network('net04')['id'] net_id = os_conn.get_network('net04')['id']
# Get remote to the current l3 router
router_id = os_conn.get_routers_ids()[0] router_id = os_conn.get_routers_ids()[0]
node_with_l3 = os_conn.get_l3_agent_hosts(router_id)[0]
d_node = self.fuel_web.get_devops_node_by_nailgun_fqdn(node_with_l3) # Get remote to the controller with running DHCP agent for net04
remote = self.fuel_web.get_ssh_for_node(d_node.name) devops_node = self.get_node_with_dhcp(self, os_conn, net_id)
_ip = self.fuel_web.get_nailgun_node_by_name(devops_node.name)['ip']
remote = self.env.d_env.get_ssh_to_remote(_ip)
dhcp_namespace = ''.join(remote.execute('ip netns | grep {0}'.format( dhcp_namespace = ''.join(remote.execute('ip netns | grep {0}'.format(
net_id))['stdout']).rstrip() net_id))['stdout']).rstrip()