How to use list_floating_ips_bulk method in tempest

Best Python code snippet using tempest_python

test_floating_ips_bulk.py

Source:test_floating_ips_bulk.py Github

copy

Full Screen

...34 cls.verify_unallocated_floating_ip_range(cls.ip_range)35 @classmethod36 def verify_unallocated_floating_ip_range(cls, ip_range):37 # Verify whether configure floating IP range is not already allocated.38 body = cls.client.list_floating_ips_bulk()['floating_ip_info']39 allocated_ips_list = map(lambda x: x['address'], body)40 for ip_addr in netaddr.IPNetwork(ip_range).iter_hosts():41 if str(ip_addr) in allocated_ips_list:42 msg = ("Configured unallocated floating IP range is already "43 "allocated. Configure the correct unallocated range "44 "as 'floating_ip_range'")45 raise exceptions.InvalidConfiguration(msg)46 return47 def _delete_floating_ips_bulk(self, ip_range):48 try:49 self.client.delete_floating_ips_bulk(ip_range)50 except Exception:51 pass52 @test.idempotent_id('2c8f145f-8012-4cb8-ac7e-95a587f0e4ab')53 @test.services('network')54 def test_create_list_delete_floating_ips_bulk(self):55 # Create, List and delete the Floating IPs Bulk56 pool = 'test_pool'57 # NOTE(GMann): Reserving the IP range but those are not attached58 # anywhere. Using the below mentioned interface which is not ever59 # expected to be used. Clean Up has been done for created IP range60 interface = 'eth0'61 body = (self.client.create_floating_ips_bulk(self.ip_range,62 pool,63 interface)64 ['floating_ips_bulk_create'])65 self.addCleanup(self._delete_floating_ips_bulk, self.ip_range)66 self.assertEqual(self.ip_range, body['ip_range'])67 ips_list = self.client.list_floating_ips_bulk()['floating_ip_info']68 self.assertNotEqual(0, len(ips_list))69 for ip in netaddr.IPNetwork(self.ip_range).iter_hosts():70 self.assertIn(str(ip), map(lambda x: x['address'], ips_list))71 body = (self.client.delete_floating_ips_bulk(self.ip_range)72 ['floating_ips_bulk_delete'])...

Full Screen

Full Screen

floating_ips_bulk_client.py

Source:floating_ips_bulk_client.py Github

copy

Full Screen

...28 body = json.loads(body)29 self.validate_response(schema.create_floating_ips_bulk, resp, body)30 return service_client.ResponseBody(resp,31 body['floating_ips_bulk_create'])32 def list_floating_ips_bulk(self):33 """Returns a list of all floating IPs bulk."""34 resp, body = self.get('os-floating-ips-bulk')35 body = json.loads(body)36 self.validate_response(schema.list_floating_ips_bulk, resp, body)37 return service_client.ResponseBodyList(resp, body['floating_ip_info'])38 def delete_floating_ips_bulk(self, ip_range):39 """Deletes the provided floating IPs bulk."""40 post_body = json.dumps({'ip_range': ip_range})41 resp, body = self.put('os-floating-ips-bulk/delete', post_body)42 body = json.loads(body)43 self.validate_response(schema.delete_floating_ips_bulk, resp, body)44 data = body['floating_ips_bulk_delete']...

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