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)