Repository: cloudstack Updated Branches: refs/heads/4.4-forward b4cb969d9 -> 81bf37f33
CLOUDSTACK-6776: Removed hard coded vlan ids from BVT test_non_contiguous_vlan.py Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/81bf37f3 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/81bf37f3 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/81bf37f3 Branch: refs/heads/4.4-forward Commit: 81bf37f33853d95e7c4137d57a60e719963913c4 Parents: b4cb969 Author: Bharat Kumar <[email protected]> Authored: Thu Jun 5 11:11:38 2014 +0530 Committer: Girish Shilamkar <[email protected]> Committed: Thu Jun 5 11:11:38 2014 +0530 ---------------------------------------------------------------------- .../smoke/test_non_contigiousvlan.py | 33 +++++++++----------- 1 file changed, 15 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/81bf37f3/test/integration/smoke/test_non_contigiousvlan.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_non_contigiousvlan.py b/test/integration/smoke/test_non_contigiousvlan.py index 90235ec..50b48d0 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"], 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")
