How to use list_networks_hosted_by_one_dhcp_agent method in tempest

Best Python code snippet using tempest_python

test_agents_rbac.py

Source:test_agents_rbac.py Github

copy

Full Screen

...151 self.agents_client.delete_network_from_dhcp_agent(152 agent_id=agent_id, network_id=network_id)153 return network_id154 def _check_network_in_dhcp_agent(self, network_id, agent_id):155 networks = self.agents_client.list_networks_hosted_by_one_dhcp_agent(156 agent_id)['networks'] or []157 return network_id in [network['id'] for network in networks]158 @decorators.idempotent_id('dc84087b-4c2a-4878-8ed0-40370e19da17')159 @rbac_rule_validation.action(service="neutron",160 rule="get_dhcp-networks")161 def test_list_networks_hosted_by_one_dhcp_agent(self):162 """List networks hosted by one DHCP agent test.163 RBAC test for the neutron get_dhcp-networks policy164 """165 self.rbac_utils.switch_role(self, toggle_rbac_role=True)166 self.agents_client.list_networks_hosted_by_one_dhcp_agent(167 self.agent['id'])168 @decorators.idempotent_id('14e014ac-f355-46d3-b6d8-98f2c9ec1610')169 @rbac_rule_validation.action(service="neutron",170 rule="create_dhcp-network")171 def test_add_dhcp_agent_to_network(self):172 """Add DHCP agent to network test.173 RBAC test for the neutron create_dhcp-network policy174 """175 network_id = self._create_and_prepare_network_for_agent(176 self.agent['id'])177 self.rbac_utils.switch_role(self, toggle_rbac_role=True)178 self.agents_client.add_dhcp_agent_to_network(179 self.agent['id'], network_id=network_id)180 # Clean up is not necessary and might result in 409 being raised....

Full Screen

Full Screen

agents_client.py

Source:agents_client.py Github

copy

Full Screen

...39 return self.create_resource(uri, kwargs)40 def remove_router_from_l3_agent(self, agent_id, router_id):41 uri = '/agents/%s/l3-routers/%s' % (agent_id, router_id)42 return self.delete_resource(uri)43 def list_networks_hosted_by_one_dhcp_agent(self, agent_id):44 uri = '/agents/%s/dhcp-networks' % agent_id45 return self.list_resources(uri)46 def remove_network_from_dhcp_agent(self, agent_id, network_id):47 uri = '/agents/%s/dhcp-networks/%s' % (agent_id,48 network_id)49 return self.delete_resource(uri)50 def add_dhcp_agent_to_network(self, agent_id, **kwargs):51 # TODO(piyush): Current api-site doesn't contain this API description.52 # After fixing the api-site, we need to fix here also for putting the53 # link to api-site.54 # LP: https://bugs.launchpad.net/openstack-api-site/+bug/152621255 uri = '/agents/%s/dhcp-networks' % agent_id...

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