How to use _prepare_and_test method in tempest

Best Python code snippet using tempest_python

test_network_v6.py

Source:test_network_v6.py Github

copy

Full Screen

...121 "ports: %s")122 % (self.network_v6, ports))123 mac6 = ports[0]124 ssh.set_nic_state(ssh.get_nic_name(mac6))125 def _prepare_and_test(self, address6_mode, n_subnets6=1, dualnet=False):126 net_list = self.prepare_network(address6_mode=address6_mode,127 n_subnets6=n_subnets6,128 dualnet=dualnet)129 sshv4_1, ips_from_api_1, sid1 = self.prepare_server(networks=net_list)130 sshv4_2, ips_from_api_2, sid2 = self.prepare_server(networks=net_list)131 def guest_has_address(ssh, addr):132 return addr in ssh.get_ip_list()133 # Turn on 2nd NIC for Cirros when dualnet134 if dualnet:135 self.turn_nic6_on(sshv4_1, sid1)136 self.turn_nic6_on(sshv4_2, sid2)137 # get addresses assigned to vNIC as reported by 'ip address' utility138 ips_from_ip_1 = sshv4_1.get_ip_list()139 ips_from_ip_2 = sshv4_2.get_ip_list()140 self.assertIn(ips_from_api_1['4'], ips_from_ip_1)141 self.assertIn(ips_from_api_2['4'], ips_from_ip_2)142 for i in range(n_subnets6):143 # v6 should be configured since the image supports it144 # It can take time for ipv6 automatic address to get assigned145 srv1_v6_addr_assigned = functools.partial(146 guest_has_address, sshv4_1, ips_from_api_1['6'][i])147 srv2_v6_addr_assigned = functools.partial(148 guest_has_address, sshv4_2, ips_from_api_2['6'][i])149 self.assertTrue(test.call_until_true(srv1_v6_addr_assigned,150 CONF.validation.ping_timeout, 1))151 self.assertTrue(test.call_until_true(srv2_v6_addr_assigned,152 CONF.validation.ping_timeout, 1))153 self._check_connectivity(sshv4_1, ips_from_api_2['4'])154 self._check_connectivity(sshv4_2, ips_from_api_1['4'])155 for i in range(n_subnets6):156 self._check_connectivity(sshv4_1,157 ips_from_api_2['6'][i])158 self._check_connectivity(sshv4_1,159 self.subnets_v6[i].gateway_ip)160 self._check_connectivity(sshv4_2,161 ips_from_api_1['6'][i])162 self._check_connectivity(sshv4_2,163 self.subnets_v6[i].gateway_ip)164 def _check_connectivity(self, source, dest):165 self.assertTrue(166 self._check_remote_connectivity(source, dest),167 "Timed out waiting for %s to become reachable from %s" %168 (dest, source.ssh_client.host)169 )170 @test.idempotent_id('2c92df61-29f0-4eaa-bee3-7c65bef62a43')171 @test.services('compute', 'network')172 def test_slaac_from_os(self):173 self._prepare_and_test(address6_mode='slaac')174 @test.idempotent_id('d7e1f858-187c-45a6-89c9-bdafde619a9f')175 @test.services('compute', 'network')176 def test_dhcp6_stateless_from_os(self):177 self._prepare_and_test(address6_mode='dhcpv6-stateless')178 @test.idempotent_id('7ab23f41-833b-4a16-a7c9-5b42fe6d4123')179 @test.services('compute', 'network')180 def test_multi_prefix_dhcpv6_stateless(self):181 self._prepare_and_test(address6_mode='dhcpv6-stateless', n_subnets6=2)182 @test.idempotent_id('dec222b1-180c-4098-b8c5-cc1b8342d611')183 @test.services('compute', 'network')184 def test_multi_prefix_slaac(self):185 self._prepare_and_test(address6_mode='slaac', n_subnets6=2)186 @test.idempotent_id('b6399d76-4438-4658-bcf5-0d6c8584fde2')187 @test.services('compute', 'network')188 def test_dualnet_slaac_from_os(self):189 self._prepare_and_test(address6_mode='slaac', dualnet=True)190 @test.idempotent_id('76f26acd-9688-42b4-bc3e-cd134c4cb09e')191 @test.services('compute', 'network')192 def test_dualnet_dhcp6_stateless_from_os(self):193 self._prepare_and_test(address6_mode='dhcpv6-stateless', dualnet=True)194 @test.idempotent_id('cf1c4425-766b-45b8-be35-e2959728eb00')195 @test.services('compute', 'network')196 def test_dualnet_multi_prefix_dhcpv6_stateless(self):197 self._prepare_and_test(address6_mode='dhcpv6-stateless', n_subnets6=2,198 dualnet=True)199 @test.idempotent_id('9178ad42-10e4-47e9-8987-e02b170cc5cd')200 @test.services('compute', 'network')201 def test_dualnet_multi_prefix_slaac(self):202 self._prepare_and_test(address6_mode='slaac', n_subnets6=2,...

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