xsnippet logotype

xsnippet

#363719, Untitled [ Python ]

by Guest
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
def run(self):
     
     networks = self.context["tenant"]["networks"]
     # pick a random network to balance the load. 
     net_idx = self.context["iteration"] % len(networks)
     network = nets[net_idx]
     
     # pick a resource to delete
     subnet_idx = self.context["iteration"] % len(network["subnets"])
     subnet = network["subnets"][subnet_idx]
     
     # this can raise a NotFound exception, if number of subnets is less then number of users
     self._delete_subnet(subnet)