mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
[Automation] fix CLOUDSTACK-2546 Failed to add second NIC to vm in KVM environment
This commit is contained in:
parent
a69101dceb
commit
4786420986
@ -79,11 +79,35 @@ class Services:
|
|||||||
"PortForwarding": 'VirtualRouter',
|
"PortForwarding": 'VirtualRouter',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"network_offering_shared": {
|
||||||
|
"name": 'Test Network offering shared',
|
||||||
|
"displaytext": 'Test Network offering Shared',
|
||||||
|
"guestiptype": 'Shared',
|
||||||
|
"supportedservices": 'Dhcp,Dns,UserData',
|
||||||
|
"traffictype": 'GUEST',
|
||||||
|
"specifyVlan" : "True",
|
||||||
|
"specifyIpRanges" : "True",
|
||||||
|
"serviceProviderList" : {
|
||||||
|
"Dhcp": 'VirtualRouter',
|
||||||
|
"Dns": 'VirtualRouter',
|
||||||
|
"UserData": 'VirtualRouter',
|
||||||
|
},
|
||||||
|
},
|
||||||
"network": {
|
"network": {
|
||||||
"name": "Test Network",
|
"name": "Test Network",
|
||||||
"displaytext": "Test Network",
|
"displaytext": "Test Network",
|
||||||
"acltype": "Account",
|
"acltype": "Account",
|
||||||
},
|
},
|
||||||
|
"network2": {
|
||||||
|
"name": "Test Network Shared",
|
||||||
|
"displaytext": "Test Network Shared",
|
||||||
|
"vlan" :1201,
|
||||||
|
"gateway" :"172.16.15.1",
|
||||||
|
"netmask" :"255.255.255.0",
|
||||||
|
"startip" :"172.16.15.21",
|
||||||
|
"endip" :"172.16.15.41",
|
||||||
|
"acltype": "Account",
|
||||||
|
},
|
||||||
# ISO settings for Attach/Detach ISO tests
|
# ISO settings for Attach/Detach ISO tests
|
||||||
"iso": {
|
"iso": {
|
||||||
"displaytext": "Test ISO",
|
"displaytext": "Test ISO",
|
||||||
@ -176,6 +200,14 @@ class TestDeployVM(cloudstackTestCase):
|
|||||||
self.network_offering.update(self.apiclient, state='Enabled') # Enable Network offering
|
self.network_offering.update(self.apiclient, state='Enabled') # Enable Network offering
|
||||||
self.services["network"]["networkoffering"] = self.network_offering.id
|
self.services["network"]["networkoffering"] = self.network_offering.id
|
||||||
|
|
||||||
|
self.network_offering_shared = NetworkOffering.create(
|
||||||
|
self.apiclient,
|
||||||
|
self.services["network_offering_shared"],
|
||||||
|
)
|
||||||
|
self.cleanup.insert(0, self.network_offering_shared)
|
||||||
|
self.network_offering_shared.update(self.apiclient, state='Enabled') # Enable Network offering
|
||||||
|
self.services["network2"]["networkoffering"] = self.network_offering_shared.id
|
||||||
|
|
||||||
################
|
################
|
||||||
### Test Network
|
### Test Network
|
||||||
self.test_network = Network.create(
|
self.test_network = Network.create(
|
||||||
@ -185,6 +217,14 @@ class TestDeployVM(cloudstackTestCase):
|
|||||||
self.account.domainid,
|
self.account.domainid,
|
||||||
)
|
)
|
||||||
self.cleanup.insert(0, self.test_network)
|
self.cleanup.insert(0, self.test_network)
|
||||||
|
self.test_network2 = Network.create(
|
||||||
|
self.apiclient,
|
||||||
|
self.services["network2"],
|
||||||
|
self.account.name,
|
||||||
|
self.account.domainid,
|
||||||
|
zoneid=self.services["network"]["zoneid"]
|
||||||
|
)
|
||||||
|
self.cleanup.insert(0, self.test_network2)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.debug("Exception during NIC test SETUP!: " + str(ex))
|
self.debug("Exception during NIC test SETUP!: " + str(ex))
|
||||||
self.assertEqual(True, False, "Exception during NIC test SETUP!: " + str(ex))
|
self.assertEqual(True, False, "Exception during NIC test SETUP!: " + str(ex))
|
||||||
@ -201,10 +241,10 @@ class TestDeployVM(cloudstackTestCase):
|
|||||||
accountid=self.account.name,
|
accountid=self.account.name,
|
||||||
domainid=self.account.domainid,
|
domainid=self.account.domainid,
|
||||||
serviceofferingid=self.service_offering.id,
|
serviceofferingid=self.service_offering.id,
|
||||||
mode=self.services['mode']
|
mode=self.services['mode'],
|
||||||
|
networkids=[self.test_network.id]
|
||||||
)
|
)
|
||||||
self.cleanup.insert(0, self.virtual_machine)
|
self.cleanup.insert(0, self.virtual_machine)
|
||||||
|
|
||||||
list_vm_response = list_virtual_machines(
|
list_vm_response = list_virtual_machines(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
id=self.virtual_machine.id
|
id=self.virtual_machine.id
|
||||||
@ -256,7 +296,7 @@ class TestDeployVM(cloudstackTestCase):
|
|||||||
existing_nic_id = vm_response.nic[0].id
|
existing_nic_id = vm_response.nic[0].id
|
||||||
|
|
||||||
# 1. add a nic
|
# 1. add a nic
|
||||||
add_response = self.virtual_machine.add_nic(self.apiclient, self.test_network.id)
|
add_response = self.virtual_machine.add_nic(self.apiclient, self.test_network2.id)
|
||||||
|
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
# now go get the vm list?
|
# now go get the vm list?
|
||||||
@ -308,8 +348,9 @@ class TestDeployVM(cloudstackTestCase):
|
|||||||
sawException = True
|
sawException = True
|
||||||
|
|
||||||
self.assertEqual(sawException, True, "Make sure we cannot delete the default NIC")
|
self.assertEqual(sawException, True, "Make sure we cannot delete the default NIC")
|
||||||
|
self.virtual_machine.update_default_nic(self.apiclient, existing_nic_id)
|
||||||
self.virtual_machine.remove_nic(self.apiclient, existing_nic_id)
|
time.sleep(5)
|
||||||
|
self.virtual_machine.remove_nic(self.apiclient, new_nic_id)
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
list_vm_response = list_virtual_machines(
|
list_vm_response = list_virtual_machines(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user