1515# specific language governing permissions and limitations
1616# under the License.
1717
18- from marvin import cloudstackTestCase
19- from marvin .cloudstackAPI import *
18+ #from marvin.cloudstackAPI import *
2019from marvin .cloudstackTestCase import cloudstackTestCase
21- from marvin .lib .base import Account
2220from marvin .lib .base import PhysicalNetwork
21+ from marvin .lib .common import setNonContiguousVlanIds , get_zone
2322from nose .plugins .attrib import attr
2423
25- class Services ():
26- def __init__ (self ):
27- self .services = {
28- "vlan" : {
29- "part" : ["4090-4091" , "4092-4095" ],
30- "full" : "4090-4095" ,
31- }
32- }
33-
34-
35- @attr (tags = ["simulator" , "advanced" , "selfservice" ])
24+ @attr (tags = ["simulator" , "advanced" , "selfservice" ], BugId = "CLOUDSTACK-6776" )
3625class TestUpdatePhysicalNetwork (cloudstackTestCase ):
3726 """
3827 Test to extend physical network vlan range
3928 """
4029 def setUp (self ):
41- self .vlan = Services ().services ["vlan" ]
4230 self .apiClient = self .testClient .getApiClient ()
31+ self .zone = get_zone (self .apiClient , self .testClient .getZoneForTests ())
32+ self .physicalnetwork , self .vlan = setNonContiguousVlanIds (self .apiClient , self .zone .id )
33+
34+ self .physicalnetworkid = self .physicalnetwork .id
35+ self .existing_vlan = self .physicalnetwork .vlan
36+
37+ if self .vlan is None :
38+ raise Exception ("Failed to set non contiguous vlan ids to test. Free some ids from \
39+ from existing physical networks at ends" )
4340
4441
4542 def test_extendPhysicalNetworkVlan (self ):
@@ -53,13 +50,13 @@ def test_extendPhysicalNetworkVlan(self):
5350 self .network = phy_networks [0 ]
5451 self .networkid = phy_networks [0 ].id
5552 self .existing_vlan = phy_networks [0 ].vlan
56- vlan1 = self .existing_vlan + "," + self .vlan ["part " ][0 ]
53+ vlan1 = self .existing_vlan + "," + self .vlan ["partial_range " ][0 ]
5754 updatePhysicalNetworkResponse = self .network .update (self .apiClient , id = self .networkid , vlan = vlan1 )
5855 self .assert_ (updatePhysicalNetworkResponse is not None ,
5956 msg = "couldn't extend the physical network with vlan %s" % vlan1 )
6057 self .assert_ (isinstance (self .network , PhysicalNetwork ))
6158
62- vlan2 = vlan1 + "," + self .vlan ["part " ][1 ]
59+ vlan2 = vlan1 + "," + self .vlan ["partial_range " ][1 ]
6360 updatePhysicalNetworkResponse2 = self .network .update (self .apiClient , id = self .networkid , vlan = vlan2 )
6461 self .assert_ (updatePhysicalNetworkResponse2 is not None ,
6562 msg = "couldn't extend the physical network with vlan %s" % vlan2 )
@@ -68,7 +65,7 @@ def test_extendPhysicalNetworkVlan(self):
6865 vlanranges = updatePhysicalNetworkResponse2 .vlan
6966 self .assert_ (vlanranges is not None ,
7067 "No VLAN ranges found on the deployment" )
71- self .assert_ (vlanranges . find ( self . vlan [ "full" ]) > 0 , "vlan ranges are not extended" )
68+ self .assert_ (str ( vlanranges ) == vlan2 , "vlan ranges are not extended" )
7269
7370
7471 def tearDown (self ):
@@ -82,6 +79,6 @@ def tearDown(self):
8279 self .network = phy_networks [0 ]
8380 self .networkid = phy_networks [0 ].id
8481 updateResponse = self .network .update (self .apiClient , id = self .networkid , vlan = self .existing_vlan )
85- self .assert_ (updateResponse .vlan .find (self .vlan ["full " ]) < 0 ,
82+ self .assert_ (updateResponse .vlan .find (self .vlan ["full_range " ]) < 0 ,
8683 "VLAN was not removed successfully" )
8784
0 commit comments