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',
|
||||
},
|
||||
},
|
||||
"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": {
|
||||
"name": "Test Network",
|
||||
"displaytext": "Test Network",
|
||||
"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": {
|
||||
"displaytext": "Test ISO",
|
||||
@ -176,6 +200,14 @@ class TestDeployVM(cloudstackTestCase):
|
||||
self.network_offering.update(self.apiclient, state='Enabled') # Enable Network offering
|
||||
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
|
||||
self.test_network = Network.create(
|
||||
@ -185,6 +217,14 @@ class TestDeployVM(cloudstackTestCase):
|
||||
self.account.domainid,
|
||||
)
|
||||
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:
|
||||
self.debug("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,
|
||||
domainid=self.account.domainid,
|
||||
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)
|
||||
|
||||
list_vm_response = list_virtual_machines(
|
||||
self.apiclient,
|
||||
id=self.virtual_machine.id
|
||||
@ -256,7 +296,7 @@ class TestDeployVM(cloudstackTestCase):
|
||||
existing_nic_id = vm_response.nic[0].id
|
||||
|
||||
# 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)
|
||||
# now go get the vm list?
|
||||
@ -308,8 +348,9 @@ class TestDeployVM(cloudstackTestCase):
|
||||
sawException = True
|
||||
|
||||
self.assertEqual(sawException, True, "Make sure we cannot delete the default NIC")
|
||||
|
||||
self.virtual_machine.remove_nic(self.apiclient, existing_nic_id)
|
||||
self.virtual_machine.update_default_nic(self.apiclient, existing_nic_id)
|
||||
time.sleep(5)
|
||||
self.virtual_machine.remove_nic(self.apiclient, new_nic_id)
|
||||
time.sleep(5)
|
||||
|
||||
list_vm_response = list_virtual_machines(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user