From 2de64bcc910b57d0cf2b83f155c5f467991064f8 Mon Sep 17 00:00:00 2001 From: sanjeev Date: Tue, 21 Apr 2015 17:41:38 +0530 Subject: [PATCH] Added additional verification steps to make sure that removing secondary ip from nic works fine --- .../component/test_multiple_ips_per_nic.py | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/test/integration/component/test_multiple_ips_per_nic.py b/test/integration/component/test_multiple_ips_per_nic.py index f3bc0c8b7da..f40c3210675 100644 --- a/test/integration/component/test_multiple_ips_per_nic.py +++ b/test/integration/component/test_multiple_ips_per_nic.py @@ -361,8 +361,9 @@ class TestBasicOperations(cloudstackTestCase): (virtual_machine.id, e)) return - @data(ISOLATED_NETWORK, SHARED_NETWORK, VPC_NETWORK) - @attr(tags=["advanced"]) + #@data(ISOLATED_NETWORK, SHARED_NETWORK, VPC_NETWORK) + @data(SHARED_NETWORK) + @attr(tags=["advanced", "sanj"]) def test_remove_ip_from_nic(self, value): """ Remove secondary IP from NIC of a VM""" @@ -402,6 +403,27 @@ class TestBasicOperations(cloudstackTestCase): id=virtual_machine.nic[0].id) NIC.removeIp(self.apiclient, ipaddressid=ipaddress_1.id) + #Following block is to verify + #1.Removing nic in shared network should mark allocated state to NULL in DB + #2.To make sure that re-add the same ip address to the same nic + #3.Remove the IP from the NIC + #All the above steps should succeed + if value == SHARED_NETWORK: + qresultset = self.dbclient.execute( + "select allocated from user_ip_address where public_ip_address = '%s';" + % str(ipaddress_1.ipaddress) + ) + self.assertEqual( + qresultset[0][0], + None, + "Removing IP from nic didn't release the ip address from user_ip_address table" + ) + ipaddress_2 = NIC.addIp( + self.apiclient, + id=virtual_machine.nic[0].id, + ipaddress=ipaddress_1.ipaddress + ) + NIC.removeIp(self.apiclient, ipaddressid=ipaddress_2.id) try: NIC.removeIp( self.apiclient, @@ -908,7 +930,7 @@ class TestNetworkRules(cloudstackTestCase): return @data(ISOLATED_NETWORK, SHARED_NETWORK, VPC_NETWORK) - @attr(tags=["advanced, "dvs"]) + @attr(tags=["advanced", "dvs"]) def test_disassociate_ip_mapped_to_secondary_ip_through_PF_rule( self, value):