How to use _delete_networks method in tempest

Best Python code snippet using tempest_python

test_networks.py

Source:test_networks.py Github

copy

Full Screen

...201 def setUpClass(cls):202 super(BulkNetworkOpsJSON, cls).setUpClass()203 cls.network1 = cls.create_network()204 cls.network2 = cls.create_network()205 def _delete_networks(self, created_networks):206 for n in created_networks:207 resp, body = self.client.delete_network(n['id'])208 self.assertEqual(204, resp.status)209 # Asserting that the networks are not found in the list after deletion210 resp, body = self.client.list_networks()211 networks_list = list()212 for network in body['networks']:213 networks_list.append(network['id'])214 for n in created_networks:215 self.assertNotIn(n['id'], networks_list)216 def _delete_subnets(self, created_subnets):217 for n in created_subnets:218 resp, body = self.client.delete_subnet(n['id'])219 self.assertEqual(204, resp.status)...

Full Screen

Full Screen

kubernetes.py

Source:kubernetes.py Github

copy

Full Screen

...55 self._delete_ssh_key()56 self._delete_rcs()57 self._delete_pods()58 self._delete_services()59 self._delete_networks()60 self._delete_crd()61 super(KubernetesContext, self).undeploy()62 def _wait_until_running(self):63 while not all(self._check_pod_status(p) for p in self.template.pods):64 time.sleep(1)65 def _check_pod_status(self, pod):66 status = k8s_utils.read_pod_status(pod)67 LOG.debug('%s:%s', pod, status)68 if status == 'Failed':69 LOG.error('Pod %s status is failed', pod)70 raise RuntimeError71 if status != 'Running':72 return False73 return True74 def _create_services(self):75 for obj in self.template.service_objs:76 obj.create()77 def _delete_services(self):78 for obj in self.template.service_objs:79 obj.delete()80 def _create_rcs(self):81 for obj in self.template.rc_objs:82 self._create_rc(obj.get_template())83 def _create_rc(self, template):84 k8s_utils.create_replication_controller(template)85 def _delete_rcs(self):86 for rc in self.template.rcs:87 self._delete_rc(rc)88 def _delete_rc(self, rc):89 k8s_utils.delete_replication_controller(rc, skip_codes=[404])90 def _delete_pods(self):91 for pod in self.template.pods:92 self._delete_pod(pod)93 def _delete_pod(self, pod):94 k8s_utils.delete_pod(pod, skip_codes=[404])95 def _create_crd(self):96 LOG.info('Create Custom Resource Definition elements')97 for crd in self.template.crd:98 crd.create()99 def _delete_crd(self):100 LOG.info('Delete Custom Resource Definition elements')101 for crd in self.template.crd:102 crd.delete()103 def _create_networks(self): # pragma: no cover104 LOG.info('Create Network elements')105 for net in self.template.network_objs:106 net.create()107 def _delete_networks(self): # pragma: no cover108 LOG.info('Create Network elements')109 for net in self.template.network_objs:110 net.delete()111 def _get_key_path(self):112 task_id = self.name.split('-')[-1]113 k = 'files/yardstick_key-{}'.format(task_id)114 return pkg_resources.resource_filename('yardstick.resources', k)115 def _set_ssh_key(self):116 rsa_key = paramiko.RSAKey.generate(bits=BITS_LENGTH)117 LOG.info('Writing private key')118 rsa_key.write_private_key_file(self.key_path)119 LOG.info('Writing public key')120 key = '{} {}\n'.format(rsa_key.get_name(), rsa_key.get_base64())121 with open(self.public_key_path, 'w') as f:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful