@@ -789,97 +789,3 @@ def test_09_reboot_router(self):
789789 "Check list router response for router public IP"
790790 )
791791 return
792-
793- @attr (configuration = "network.gc" )
794- @attr (tags = ["advanced" , "advancedns" , "smoke" ])
795- def test_10_network_gc (self ):
796- """Test network GC
797- """
798-
799- # Validate the following
800- # 1. stop All User VMs in the account
801- # 2. wait for network.gc.interval time"
802- # 3. After network.gc.interval, router should be stopped
803- # 4. ListRouters should return the router in Stopped state
804-
805- list_vms = list_virtual_machines (
806- self .apiclient ,
807- account = self .account .name ,
808- domainid = self .account .domainid
809- )
810- self .assertEqual (
811- isinstance (list_vms , list ),
812- True ,
813- "Check list response returns a valid list"
814- )
815- self .assertNotEqual (
816- len (list_vms ),
817- 0 ,
818- "Check length of list VM response"
819- )
820-
821- for vm in list_vms :
822- self .debug ("Stopping the VM with ID: %s" % vm .id )
823- # Stop all virtual machines associated with that account
824- cmd = stopVirtualMachine .stopVirtualMachineCmd ()
825- cmd .id = vm .id
826- self .apiclient .stopVirtualMachine (cmd )
827-
828- # Get network.gc.interval config value
829- config = list_configurations (
830- self .apiclient ,
831- name = 'network.gc.interval'
832- )
833- self .assertEqual (
834- isinstance (config , list ),
835- True ,
836- "Check list response returns a valid list"
837- )
838- gcinterval = config [0 ]
839-
840- # Get network.gc.wait config value
841- config = list_configurations (
842- self .apiclient ,
843- name = 'network.gc.wait'
844- )
845- self .assertEqual (
846- isinstance (config , list ),
847- True ,
848- "Check list response returns a valid list"
849- )
850- gcwait = config [0 ]
851-
852- total_wait = int (gcinterval .value ) + int (gcwait .value )
853- self .debug ("Waiting %s seconds for network cleanup" % str (total_wait * 2 ))
854- # Wait for wait_time * 2 time to cleanup all the resources
855- time .sleep (total_wait * 2 )
856-
857- timeout = self .services ["timeout" ]
858- while True :
859- #Check status of network router
860- list_router_response = list_routers (
861- self .apiclient ,
862- account = self .account .name ,
863- domainid = self .account .domainid
864- )
865- if isinstance (list_router_response , list ):
866- break
867- elif timeout == 0 :
868- raise Exception ("List router call failed!" )
869- time .sleep (5 )
870- timeout = timeout - 1
871-
872- self .assertEqual (
873- isinstance (list_router_response , list ),
874- True ,
875- "Check list response returns a valid list"
876- )
877- router = list_router_response [0 ]
878-
879- self .debug ("Router state after network.gc.interval: %s" % router .state )
880- self .assertEqual (
881- router .state ,
882- 'Stopped' ,
883- "Check state of the router after stopping all VMs associated"
884- )
885- return
0 commit comments