@@ -43,7 +43,8 @@ def __init__(self):
4343 "username" : "test" ,
4444 "password" : "password" ,
4545 },
46- "name" : "testphysicalnetwork"
46+ "name" : "testphysicalnetwork" ,
47+ "vlan" : "2118-2120" ,
4748 }
4849
4950
@@ -64,14 +65,21 @@ def setUpClass(cls):
6465 domainid = cls .domain .id
6566 )
6667 cls ._cleanup = [
67- # cls.account,
68+ cls .account ,
6869 ]
6970 return
7071
7172 @classmethod
7273 def tearDownClass (cls ):
7374 try :
7475 # Cleanup resources used
76+ list_physical_network_response = PhysicalNetwork .list (cls .api_client )
77+ if list_physical_network_response is not None and len (list_physical_network_response ) > 0 :
78+ physical_network = list_physical_network_response [0 ]
79+ removeGuestVlanRangeResponse = \
80+ physical_network .update (cls .api_client ,
81+ id = physical_network .id ,
82+ removevlan = cls .services ["vlan" ])
7583 cleanup_resources (cls .api_client , cls ._cleanup )
7684 except Exception as e :
7785 raise Exception ("Warning: Exception during cleanup : %s" % e )
@@ -119,12 +127,12 @@ def test_dedicateGuestVlanRange(self):
119127 physical_network_response = list_physical_network_response [0 ]
120128
121129 self .debug ("Adding guest vlan range" )
122- addGuestVlanRangeResponse = physical_network_response .update (self .apiclient , id = physical_network_response .id , vlan = "387-390" )
130+ addGuestVlanRangeResponse = physical_network_response .update (self .apiclient , id = physical_network_response .id , vlan = self . services [ "vlan" ] )
123131
124132 self .debug ("Dedicating guest vlan range" );
125133 dedicate_guest_vlan_range_response = PhysicalNetwork .dedicate (
126134 self .apiclient ,
127- "387-390" ,
135+ self . services [ "vlan" ] ,
128136 physicalnetworkid = physical_network_response .id ,
129137 account = self .account .name ,
130138 domainid = self .account .domainid
@@ -153,5 +161,3 @@ def test_dedicateGuestVlanRange(self):
153161 "Check account name is system account in listDedicatedGuestVlanRanges"
154162 )
155163
156- self .debug ("Removing guest vlan range" )
157- removeGuestVlanRangeResponse = physical_network_response .update (self .apiclient , id = physical_network_response .id , removevlan = "387-390" )
0 commit comments