You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2013/08/27 01:32:55 UTC
[19/50] [abbrv] git commit: updated refs/heads/4.2 to a23322b
CLOUDSTACK-4144: Add free vlan to shared network in TestVMLifeCycleSharedNwVPC
Shared network has to have specifyVlan = True. So changed it to True
and aded a function to get free vlan.
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9ff40829
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9ff40829
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9ff40829
Branch: refs/heads/4.2
Commit: 9ff40829a9787df6d89fea3c41dd112554533be7
Parents: 448bfc2
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Fri Aug 23 15:40:01 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Sat Aug 24 10:05:14 2013 +0530
----------------------------------------------------------------------
.../component/test_vpc_vm_life_cycle.py | 40 ++++++++++++++++++--
1 file changed, 37 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ff40829/test/integration/component/test_vpc_vm_life_cycle.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_vm_life_cycle.py b/test/integration/component/test_vpc_vm_life_cycle.py
index e612572..9844c1f 100644
--- a/test/integration/component/test_vpc_vm_life_cycle.py
+++ b/test/integration/component/test_vpc_vm_life_cycle.py
@@ -115,8 +115,8 @@ class Services:
"traffictype": 'GUEST',
"availability": 'Optional',
"useVpc": 'on',
- "specifyIpRanges": False,
- "specifyVlan": False
+ "specifyIpRanges": True,
+ "specifyVlan": True
},
"vpc_offering": {
"name": 'VPC off',
@@ -863,10 +863,36 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
)
return
-@unittest.skip("skipped - The setup of shared network is wrong, need to be fixed ")
class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
@classmethod
+ def getFreeVlan(cls, apiclient, zoneid):
+ """
+ Find an unallocated VLAN outside the range allocated to the physical network.
+
+ @note: This does not guarantee that the VLAN is available for use in
+ the deployment's network gear
+ @return: physical_network, shared_vlan_tag
+ """
+ list_physical_networks_response = PhysicalNetwork.list(
+ apiclient,
+ zoneid=zoneid
+ )
+ assert isinstance(list_physical_networks_response, list)
+ assert len(list_physical_networks_response) > 0, "No physical networks found in zone %s" % zoneid
+
+ physical_network = list_physical_networks_response[0]
+ vlans = xsplit(physical_network.vlan, ['-', ','])
+
+ assert len(vlans) > 0
+ assert int(vlans[0]) < int(vlans[-1]), "VLAN range %s was improperly split" % physical_network.vlan
+ shared_ntwk_vlan = int(vlans[-1]) + random.randrange(1, 20)
+ if shared_ntwk_vlan > 4095:
+ shared_ntwk_vlan = int(vlans[0]) - random.randrange(1, 20)
+ assert shared_ntwk_vlan > 0, "VLAN chosen %s is invalid < 0" % shared_ntwk_vlan
+ return physical_network, shared_ntwk_vlan
+
+ @classmethod
def setUpClass(cls):
cls.api_client = super(
TestVMLifeCycleSharedNwVPC,
@@ -942,6 +968,7 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
cls.services["network_offering_no_lb"],
conservemode=False
)
+
cls.shared_nw_off = NetworkOffering.create(
cls.api_client,
cls.services["network_off_shared"],
@@ -950,6 +977,13 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
# Enable Network offering
cls.shared_nw_off.update(cls.api_client, state='Enabled')
+
+ physical_network, shared_vlan = cls.getFreeVlan(cls.api_client, cls.zone.id)
+ #create network using the shared network offering created
+ cls.services["network"]["acltype"] = "Domain"
+ cls.services["network"]["physicalnetworkid"] = physical_network.id
+ cls.services["network"]["vlan"] = shared_vlan
+
# Creating network using the network offering created
cls.network_2 = Network.create(
cls.api_client,