Best Python code snippet using tempest_python
l3agentscheduler.py
Source: l3agentscheduler.py
...56 plugin = manager.NeutronManager.get_plugin()57 policy.enforce(request.context,58 "get_%s" % L3_AGENTS,59 {})60 return plugin.list_l3_agents_hosting_router(61 request.context, kwargs['router_id'])62class L3agentscheduler(extensions.ExtensionDescriptor):63 """Extension class supporting l3 agent scheduler.64 """65 @classmethod66 def get_name(cls):67 return "L3 Agent Scheduler"68 @classmethod69 def get_alias(cls):70 return constants.L3_AGENT_SCHEDULER_EXT_ALIAS71 @classmethod72 def get_description(cls):73 return "Schedule routers among l3 agents"74 @classmethod75 def get_namespace(cls):76 return "http://docs.openstack.org/ext/l3_agent_scheduler/api/v1.0"77 @classmethod78 def get_updated(cls):79 return "2013-02-07T10:00:00-00:00"80 @classmethod81 def get_resources(cls):82 """Returns Ext Resources."""83 exts = []84 parent = dict(member_name="agent",85 collection_name="agents")86 controller = resource.Resource(RouterSchedulerController(),87 base.FAULT_MAP)88 exts.append(extensions.ResourceExtension(89 L3_ROUTERS, controller, parent))90 parent = dict(member_name="router",91 collection_name="routers")92 controller = resource.Resource(L3AgentsHostingRouterController(),93 base.FAULT_MAP)94 exts.append(extensions.ResourceExtension(95 L3_AGENTS, controller, parent))96 return exts97 def get_extended_resources(self, version):98 return {}99class InvalidL3Agent(agent.AgentNotFound):100 message = _("Agent %(id)s is not a L3 Agent or has been disabled")101class RouterHostedByL3Agent(exceptions.Conflict):102 message = _("The router %(router_id)s has been already hosted"103 " by the L3 Agent %(agent_id)s.")104class RouterSchedulingFailed(exceptions.Conflict):105 message = _("Failed scheduling router %(router_id)s to"106 " the L3 Agent %(agent_id)s.")107class RouterNotHostedByL3Agent(exceptions.Conflict):108 message = _("The router %(router_id)s is not hosted"109 " by L3 agent %(agent_id)s.")110class L3AgentSchedulerPluginBase(object):111 """REST API to operate the l3 agent scheduler.112 All of method must be in an admin context.113 """114 @abstractmethod115 def add_router_to_l3_agent(self, context, id, router_id):116 pass117 @abstractmethod118 def remove_router_from_l3_agent(self, context, id, router_id):119 pass120 @abstractmethod121 def list_routers_on_l3_agent(self, context, id):122 pass123 @abstractmethod124 def list_l3_agents_hosting_router(self, context, router_id):...
test_l3_agent_scheduler.py
Source: test_l3_agent_scheduler.py
...55 @decorators.idempotent_id('9464e5e7-8625-49c3-8fd1-89c52be59d66')56 def test_add_list_remove_router_on_l3_agent(self):57 l3_agent_ids = list()58 # First list agents which host router59 body = self.admin_client.list_l3_agents_hosting_router(60 self.router['id'])61 # Now remove router from all agents62 for agent in body['agents']:63 self.admin_client.remove_router_from_l3_agent(64 agent['id'], self.router['id'])65 # Now list agents which host router again - list should be empty66 body = self.admin_client.list_l3_agents_hosting_router(67 self.router['id'])68 self.assertEqual([], body['agents'])69 # Now add router to one of agents70 self.admin_client.add_router_to_l3_agent(71 self.agent['id'],72 router_id=self.router['id'])73 # And check that router is hosted by this agent74 body = self.admin_client.list_l3_agents_hosting_router(75 self.router['id'])76 for agent in body['agents']:77 l3_agent_ids.append(agent['id'])78 self.assertIn('agent_type', agent)79 self.assertEqual('L3 agent', agent['agent_type'])...
Check out the latest blogs from LambdaTest on this topic:
These days, development teams depend heavily on feedback from automated tests to evaluate the quality of the system they are working on.
I think that probably most development teams describe themselves as being “agile” and probably most development teams have standups, and meetings called retrospectives.There is also a lot of discussion about “agile”, much written about “agile”, and there are many presentations about “agile”. A question that is often asked is what comes after “agile”? Many testers work in “agile” teams so this question matters to us.
I routinely come across test strategy documents when working with customers. They are lengthy—100 pages or more—and packed with monotonous text that is routinely reused from one project to another. Yawn once more— the test halt and resume circumstances, the defect management procedure, entrance and exit criteria, unnecessary generic risks, and in fact, one often-used model replicates the requirements of textbook testing, from stress to systems integration.
To understand the agile testing mindset, we first need to determine what makes a team “agile.” To me, an agile team continually focuses on becoming self-organized and cross-functional to be able to complete any challenge they may face during a project.
When working on web automation with Selenium, I encountered scenarios where I needed to refresh pages from time to time. When does this happen? One scenario is that I needed to refresh the page to check that the data I expected to see was still available even after refreshing. Another possibility is to clear form data without going through each input individually.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!