|
27 | 27 | from marvin.codes import SUCCESS |
28 | 28 | from nose.plugins.attrib import attr |
29 | 29 | from time import sleep |
30 | | -from ctypes.wintypes import BOOLEAN |
| 30 | +# from ctypes.wintypes import BOOLEAN |
31 | 31 |
|
32 | 32 | class TestListInstances(cloudstackTestCase): |
33 | 33 |
|
@@ -84,7 +84,7 @@ def setUpClass(cls): |
84 | 84 | cls.api_client, |
85 | 85 | account=cls.account.name, |
86 | 86 | domainid=cls.domain.id, |
87 | | - max=-1, |
| 87 | + max= -1, |
88 | 88 | resourcetype=i |
89 | 89 | ) |
90 | 90 |
|
@@ -1924,7 +1924,7 @@ def setUpClass(cls): |
1924 | 1924 | cls.api_client, |
1925 | 1925 | account=cls.account.name, |
1926 | 1926 | domainid=cls.domain.id, |
1927 | | - max=-1, |
| 1927 | + max= -1, |
1928 | 1928 | resourcetype=i |
1929 | 1929 | ) |
1930 | 1930 | cls._cleanup.append(cls.account) |
@@ -3458,3 +3458,112 @@ def test_23_deploy_vm_multiple_securitygroups(self): |
3458 | 3458 | "Security Groups in VM are not same as created" |
3459 | 3459 | ) |
3460 | 3460 | return |
| 3461 | + |
| 3462 | + @attr(tags=["advanced", "selfservice"]) |
| 3463 | + def test_24_deploy_vm_with_static_ip_ES1662(self): |
| 3464 | + """ |
| 3465 | + @Desc: Test to verify deploy VM with static ip address assignment |
| 3466 | + @Steps: |
| 3467 | + Step1: Create a network for the user |
| 3468 | + Step2: List the network and check that it is created for the user |
| 3469 | + Step3: Deploy vm with ip address in the above network |
| 3470 | + Step4: List the vm and verify the ip address in the response |
| 3471 | + """ |
| 3472 | + # Listing Network Offerings |
| 3473 | + network_offerings_list = NetworkOffering.list( |
| 3474 | + self.apiClient, |
| 3475 | + forvpc="false", |
| 3476 | + guestiptype="Isolated", |
| 3477 | + state="Enabled", |
| 3478 | + supportedservices="SourceNat", |
| 3479 | + zoneid=self.zone.id |
| 3480 | + ) |
| 3481 | + status = validateList(network_offerings_list) |
| 3482 | + self.assertEquals( |
| 3483 | + PASS, |
| 3484 | + status[0], |
| 3485 | + "Isolated Network Offerings with sourceNat enabled are not found" |
| 3486 | + ) |
| 3487 | + """ |
| 3488 | + Create Isolated netwrok with ip range |
| 3489 | + """ |
| 3490 | + self.services["network"]["startip"] = "10.1.1.2" |
| 3491 | + self.services["network"]["endip"] = "10.1.1.254" |
| 3492 | + self.services["network"]["gateway"] = "10.1.1.1" |
| 3493 | + self.services["network"]["netmask"] = "255.255.255.0" |
| 3494 | + vm_ip = "10.1.1.10" |
| 3495 | + """ |
| 3496 | + Creating isolated/guest network with ip range |
| 3497 | + """ |
| 3498 | + network = Network.create( |
| 3499 | + self.userapiclient, |
| 3500 | + self.services["network"], |
| 3501 | + accountid=self.account.name, |
| 3502 | + domainid=self.domain.id, |
| 3503 | + networkofferingid=network_offerings_list[0].id, |
| 3504 | + zoneid=self.zone.id |
| 3505 | + ) |
| 3506 | + self.assertIsNotNone( |
| 3507 | + network, |
| 3508 | + "Network creation failed" |
| 3509 | + ) |
| 3510 | + # Deploying a VM |
| 3511 | + vm_created = VirtualMachine.create( |
| 3512 | + self.userapiclient, |
| 3513 | + self.services["virtual_machine"], |
| 3514 | + accountid=self.account.name, |
| 3515 | + domainid=self.account.domainid, |
| 3516 | + networkids=network.id, |
| 3517 | + ipaddress=vm_ip, |
| 3518 | + serviceofferingid=self.service_offering.id, |
| 3519 | + ) |
| 3520 | + self.assertIsNotNone( |
| 3521 | + vm_created, |
| 3522 | + "VM creation failed" |
| 3523 | + ) |
| 3524 | + # self.cleanup.append(vm_created) |
| 3525 | + self.cleanup.append(network) |
| 3526 | + # Listing all the VMs for a user again |
| 3527 | + vm_response = VirtualMachine.list( |
| 3528 | + self.userapiclient, |
| 3529 | + id=vm_created.id, |
| 3530 | + ) |
| 3531 | + status = validateList(vm_response) |
| 3532 | + self.assertEquals( |
| 3533 | + PASS, |
| 3534 | + status[0], |
| 3535 | + "vm list returned invalid response" |
| 3536 | + ) |
| 3537 | + # Verifying that the size of the list is 1 |
| 3538 | + self.assertEquals( |
| 3539 | + 1, |
| 3540 | + len(vm_response), |
| 3541 | + "VM list count is not matching" |
| 3542 | + ) |
| 3543 | + # Verifying that the NIC's in VM created are same as provided |
| 3544 | + vm_nics = vm_created.nic |
| 3545 | + status = validateList(vm_nics) |
| 3546 | + self.assertEquals( |
| 3547 | + PASS, |
| 3548 | + status[0], |
| 3549 | + "vm list returned invalid response for vm nics" |
| 3550 | + ) |
| 3551 | + # Verifying that the size of nics is 1 |
| 3552 | + self.assertEquals( |
| 3553 | + 1, |
| 3554 | + len(vm_nics), |
| 3555 | + "VM is created with more than one nic which is not expected" |
| 3556 | + ) |
| 3557 | + """ |
| 3558 | + Verifying that NIC IP address is as expected |
| 3559 | + """ |
| 3560 | + self.assertEquals( |
| 3561 | + str(vm_nics[0].ipaddress), |
| 3562 | + vm_ip, |
| 3563 | + "VM is not created with static ip address used in vm deployment" |
| 3564 | + ) |
| 3565 | + try: |
| 3566 | + vm_created.delete(self.apiClient, expunge=True) |
| 3567 | + except Exception as e: |
| 3568 | + raise Exception("Warning: Exception in expunging vm : %s" % e) |
| 3569 | + return |
0 commit comments