mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-8255: Adding secondary IP to correct ethernet interface present on the VM
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
This commit is contained in:
parent
d552eb42b5
commit
e66ceaa254
|
|
@ -112,6 +112,14 @@ class TestAssignLBRule(cloudstackTestCase):
|
|||
cls.testdata["virtual_machine"]["template"] = template.id
|
||||
cls._cleanup = []
|
||||
try:
|
||||
cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
|
||||
# As Hyperv is GUI based VM, it requires more resources to be
|
||||
# able to SSH properly to it
|
||||
if cls.hypervisor.lower() == 'hyperv':
|
||||
cls.testdata["service_offering"]["name"] = "Medium Instance"
|
||||
cls.testdata["service_offering"]["memory"] = "1024"
|
||||
cls.testdata["service_offering"]["cpuspeed"] = "1024"
|
||||
|
||||
cls.service_offering = ServiceOffering.create(
|
||||
cls.api_client,
|
||||
cls.testdata["service_offering"])
|
||||
|
|
@ -431,6 +439,14 @@ class TestFailureScenarios(cloudstackTestCase):
|
|||
cls._cleanup = []
|
||||
|
||||
try:
|
||||
cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
|
||||
# As Hyperv is GUI based VM, it requires more resources to be
|
||||
# able to SSH properly to it
|
||||
if cls.hypervisor.lower() == 'hyperv':
|
||||
cls.testdata["service_offering"]["name"] = "Medium Instance"
|
||||
cls.testdata["service_offering"]["memory"] = "1024"
|
||||
cls.testdata["service_offering"]["cpuspeed"] = "1024"
|
||||
|
||||
cls.service_offering = ServiceOffering.create(
|
||||
cls.api_client,
|
||||
cls.testdata["service_offering"])
|
||||
|
|
@ -686,6 +702,14 @@ class TestListLBRuleInstances(cloudstackTestCase):
|
|||
cls._cleanup = []
|
||||
|
||||
try:
|
||||
cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
|
||||
# As Hyperv is GUI based VM, it requires more resources to be
|
||||
# able to SSH properly to it
|
||||
if cls.hypervisor.lower() == 'hyperv':
|
||||
cls.testdata["service_offering"]["name"] = "Medium Instance"
|
||||
cls.testdata["service_offering"]["memory"] = "1024"
|
||||
cls.testdata["service_offering"]["cpuspeed"] = "1024"
|
||||
|
||||
cls.service_offering = ServiceOffering.create(
|
||||
cls.api_client,
|
||||
cls.testdata["service_offering"])
|
||||
|
|
@ -869,6 +893,14 @@ class TestLbRuleFunctioning(cloudstackTestCase):
|
|||
cls._cleanup = []
|
||||
|
||||
try:
|
||||
cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
|
||||
# As Hyperv is GUI based VM, it requires more resources to be
|
||||
# able to SSH properly to it
|
||||
if cls.hypervisor.lower() == 'hyperv':
|
||||
cls.testdata["service_offering"]["name"] = "Medium Instance"
|
||||
cls.testdata["service_offering"]["memory"] = "1024"
|
||||
cls.testdata["service_offering"]["cpuspeed"] = "1024"
|
||||
|
||||
cls.service_offering = ServiceOffering.create(
|
||||
cls.api_client,
|
||||
cls.testdata["service_offering"])
|
||||
|
|
@ -933,14 +965,28 @@ class TestLbRuleFunctioning(cloudstackTestCase):
|
|||
self.virtual_machine.username,
|
||||
self.virtual_machine.password
|
||||
)
|
||||
cmd = "ip addr add {0}/24 broadcast {0} dev eth0".format(
|
||||
self.secondaryip.ipaddress)
|
||||
response = sshClient.execute("netstat -i")
|
||||
# Sample Reponse:
|
||||
# [u'Kernel Interface table',
|
||||
# u'Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg',
|
||||
# u'eth2 1500 0 29 0 0 0 38 0 0 0 BMRU',
|
||||
# u'lo 16436 0 4 0 0 0 4 0 0
|
||||
# 0 LRU']}
|
||||
|
||||
# We need to extract default interface out of the response
|
||||
defaultEthernetDevice = str(response[2].split()[0])
|
||||
|
||||
cmd = "ip addr add {0}/24 broadcast {0} dev {1}".format(
|
||||
self.secondaryip.ipaddress, defaultEthernetDevice)
|
||||
sshClient.execute(cmd)
|
||||
sshClient.execute("ip addr show")
|
||||
|
||||
# Deleting NAT rule after configuring secondary IP
|
||||
nat_rule.delete(self.apiclient)
|
||||
|
||||
self.testdata["lbrule"]["publicport"] = 22
|
||||
self.testdata["lbrule"]["privateport"] = 22
|
||||
|
||||
self.lb_rule = LoadBalancerRule.create(
|
||||
self.apiclient,
|
||||
self.testdata["lbrule"],
|
||||
|
|
@ -1361,6 +1407,14 @@ class TestNetworkOperations(cloudstackTestCase):
|
|||
cls._cleanup = []
|
||||
|
||||
try:
|
||||
cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
|
||||
# As Hyperv is GUI based VM, it requires more resources to be
|
||||
# able to SSH properly to it
|
||||
if cls.hypervisor.lower() == 'hyperv':
|
||||
cls.testdata["service_offering"]["name"] = "Medium Instance"
|
||||
cls.testdata["service_offering"]["memory"] = "1024"
|
||||
cls.testdata["service_offering"]["cpuspeed"] = "1024"
|
||||
|
||||
cls.service_offering = ServiceOffering.create(
|
||||
cls.api_client,
|
||||
cls.testdata["service_offering"])
|
||||
|
|
@ -1424,14 +1478,28 @@ class TestNetworkOperations(cloudstackTestCase):
|
|||
self.virtual_machine.username,
|
||||
self.virtual_machine.password
|
||||
)
|
||||
cmd = "ip addr add {0}/24 broadcast {0} dev eth0".format(
|
||||
self.secondaryip.ipaddress)
|
||||
response = sshClient.execute("netstat -i")
|
||||
# Sample Reponse:
|
||||
# [u'Kernel Interface table',
|
||||
# u'Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg',
|
||||
# u'eth2 1500 0 29 0 0 0 38 0 0 0 BMRU',
|
||||
# u'lo 16436 0 4 0 0 0 4 0 0
|
||||
# 0 LRU']}
|
||||
|
||||
# We need to extract default interface out of the response
|
||||
defaultEthernetDevice = str(response[2].split()[0])
|
||||
|
||||
cmd = "ip addr add {0}/24 broadcast {0} dev {1}".format(
|
||||
self.secondaryip.ipaddress, defaultEthernetDevice)
|
||||
sshClient.execute(cmd)
|
||||
sshClient.execute("ip addr show")
|
||||
|
||||
# Deleting NAT rule after configuring secondary IP
|
||||
nat_rule.delete(self.apiclient)
|
||||
|
||||
self.testdata["lbrule"]["publicport"] = 22
|
||||
self.testdata["lbrule"]["privateport"] = 22
|
||||
|
||||
self.lb_rule = LoadBalancerRule.create(
|
||||
self.apiclient,
|
||||
self.testdata["lbrule"],
|
||||
|
|
@ -1775,7 +1843,7 @@ class TestExternalLoadBalancer(cloudstackTestCase):
|
|||
cls.testdata["virtual_machine"]["template"] = template.id
|
||||
cls._cleanup = []
|
||||
cls.testdata["configurableData"]\
|
||||
["netscaler"]["lbdevicededicated"] = False
|
||||
["netscaler"]["lbdevicededicated"] = False
|
||||
|
||||
try:
|
||||
cls.netscaler = add_netscaler(
|
||||
|
|
@ -1787,6 +1855,14 @@ class TestExternalLoadBalancer(cloudstackTestCase):
|
|||
raise unittest.SkipTest("Failed to add netscaler device: %s" % e)
|
||||
|
||||
try:
|
||||
cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
|
||||
# As Hyperv is GUI based VM, it requires more resources to be
|
||||
# able to SSH properly to it
|
||||
if cls.hypervisor.lower() == 'hyperv':
|
||||
cls.testdata["service_offering"]["name"] = "Medium Instance"
|
||||
cls.testdata["service_offering"]["memory"] = "1024"
|
||||
cls.testdata["service_offering"]["cpuspeed"] = "1024"
|
||||
|
||||
cls.service_offering = ServiceOffering.create(
|
||||
cls.api_client,
|
||||
cls.testdata["service_offering"])
|
||||
|
|
@ -1896,14 +1972,28 @@ class TestExternalLoadBalancer(cloudstackTestCase):
|
|||
self.virtual_machine.username,
|
||||
self.virtual_machine.password
|
||||
)
|
||||
cmd = "ip addr add {0}/24 broadcast {0} dev eth0".format(
|
||||
secondaryip.ipaddress)
|
||||
response = sshClient.execute("netstat -i")
|
||||
# Sample Reponse:
|
||||
# [u'Kernel Interface table',
|
||||
# u'Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg',
|
||||
# u'eth2 1500 0 29 0 0 0 38 0 0 0 BMRU',
|
||||
# u'lo 16436 0 4 0 0 0 4 0 0 0
|
||||
# LRU']}
|
||||
|
||||
# We need to extract default interface out of the response
|
||||
defaultEthernetDevice = str(response[2].split()[0])
|
||||
|
||||
cmd = "ip addr add {0}/24 broadcast {0} dev {1}".format(
|
||||
self.secondaryip.ipaddress, defaultEthernetDevice)
|
||||
sshClient.execute(cmd)
|
||||
sshClient.execute("ip addr show")
|
||||
|
||||
# Deleting NAT rule after configuring secondary IP
|
||||
nat_rule.delete(self.apiclient)
|
||||
|
||||
self.testdata["lbrule"]["publicport"] = 22
|
||||
self.testdata["lbrule"]["privateport"] = 22
|
||||
|
||||
lb_rule = LoadBalancerRule.create(
|
||||
self.apiclient,
|
||||
self.testdata["lbrule"],
|
||||
|
|
|
|||
Loading…
Reference in New Issue