From 96272f4cde4e1012da820264ff91c43a9ec255c4 Mon Sep 17 00:00:00 2001 From: Bharat Kumar Date: Thu, 5 Jun 2014 11:11:38 +0530 Subject: [PATCH] CLOUDSTACK-6776: Removed hard coded vlan ids from BVT test_non_contiguous_vlan.py Conflicts: test/integration/smoke/test_non_contigiousvlan.py --- .../smoke/test_non_contigiousvlan.py | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/test/integration/smoke/test_non_contigiousvlan.py b/test/integration/smoke/test_non_contigiousvlan.py index a84e62fc392..50b48d092cd 100644 --- a/test/integration/smoke/test_non_contigiousvlan.py +++ b/test/integration/smoke/test_non_contigiousvlan.py @@ -15,31 +15,28 @@ # specific language governing permissions and limitations # under the License. -from marvin import cloudstackTestCase -from marvin.cloudstackAPI import * +#from marvin.cloudstackAPI import * from marvin.cloudstackTestCase import cloudstackTestCase -from marvin.lib.base import Account from marvin.lib.base import PhysicalNetwork +from marvin.lib.common import setNonContiguousVlanIds, get_zone from nose.plugins.attrib import attr -class Services(): - def __init__(self): - self.services = { - "vlan": { - "part": ["4090-4091", "4092-4095"], - "full": "4090-4095", - } - } - - -@attr(tags = ["simulator", "advanced", "selfservice"]) +@attr(tags = ["simulator", "advanced", "selfservice"], BugId="CLOUDSTACK-6776") class TestUpdatePhysicalNetwork(cloudstackTestCase): """ Test to extend physical network vlan range """ def setUp(self): - self.vlan = Services().services["vlan"] self.apiClient = self.testClient.getApiClient() + self.zone = get_zone(self.apiClient, self.testClient.getZoneForTests()) + self.physicalnetwork, self.vlan = setNonContiguousVlanIds(self.apiClient, self.zone.id) + + self.physicalnetworkid = self.physicalnetwork.id + self.existing_vlan = self.physicalnetwork.vlan + + if self.vlan is None: + raise Exception("Failed to set non contiguous vlan ids to test. Free some ids from \ + from existing physical networks at ends") def test_extendPhysicalNetworkVlan(self): @@ -53,13 +50,13 @@ class TestUpdatePhysicalNetwork(cloudstackTestCase): self.network = phy_networks[0] self.networkid = phy_networks[0].id self.existing_vlan = phy_networks[0].vlan - vlan1 = self.existing_vlan+","+self.vlan["part"][0] + vlan1 = self.existing_vlan+","+self.vlan["partial_range"][0] updatePhysicalNetworkResponse = self.network.update(self.apiClient, id = self.networkid, vlan = vlan1) self.assert_(updatePhysicalNetworkResponse is not None, msg="couldn't extend the physical network with vlan %s"%vlan1) self.assert_(isinstance(self.network, PhysicalNetwork)) - vlan2 = vlan1+","+self.vlan["part"][1] + vlan2 = vlan1+","+self.vlan["partial_range"][1] updatePhysicalNetworkResponse2 = self.network.update(self.apiClient, id = self.networkid, vlan = vlan2) self.assert_(updatePhysicalNetworkResponse2 is not None, msg="couldn't extend the physical network with vlan %s"%vlan2) @@ -68,7 +65,7 @@ class TestUpdatePhysicalNetwork(cloudstackTestCase): vlanranges= updatePhysicalNetworkResponse2.vlan self.assert_(vlanranges is not None, "No VLAN ranges found on the deployment") - self.assert_(vlanranges.find(self.vlan["full"]) > 0, "vlan ranges are not extended") + self.assert_(str(vlanranges) == vlan2, "vlan ranges are not extended") def tearDown(self): @@ -82,6 +79,6 @@ class TestUpdatePhysicalNetwork(cloudstackTestCase): self.network = phy_networks[0] self.networkid = phy_networks[0].id updateResponse = self.network.update(self.apiClient, id = self.networkid, vlan=self.existing_vlan) - self.assert_(updateResponse.vlan.find(self.vlan["full"]) < 0, + self.assert_(updateResponse.vlan.find(self.vlan["full_range"]) < 0, "VLAN was not removed successfully")