How to use guest_has_address method in tempest

Best Python code snippet using tempest_python

test_ipv6.py

Source:test_ipv6.py Github

copy

Full Screen

...122 cls.create_pingable_secgroup_rule(secgroup_id=cls.secgroup['id'])123 def _test_ipv6_address_configured(self, ssh_client, vm, ipv6_port):124 ipv6_address = ipv6_port['fixed_ips'][0]['ip_address']125 ip_command = ip.IPCommand(ssh_client)126 def guest_has_address(expected_address):127 ip_addresses = [a.address for a in ip_command.list_addresses()]128 for ip_address in ip_addresses:129 if expected_address in ip_address:130 return True131 return False132 # Set NIC with IPv6 to be UP and wait until IPv6 address133 # will be configured on this NIC134 turn_nic6_on(ssh_client, ipv6_port, False)135 # And check if IPv6 address will be properly configured136 # on this NIC137 try:138 utils.wait_until_true(139 lambda: guest_has_address(ipv6_address),140 timeout=60)141 except utils.WaitTimeout:142 LOG.debug('Timeout without NM configuration')143 except (lib_exc.SSHTimeout,144 ssh_exc.AuthenticationException) as ssh_e:145 LOG.debug(ssh_e)146 self._log_console_output([vm])147 self._log_local_network_status()148 raise149 if not guest_has_address(ipv6_address):150 try:151 # Set NIC with IPv6 to be UP and wait until IPv6 address152 # will be configured on this NIC153 turn_nic6_on(ssh_client, ipv6_port)154 # And check if IPv6 address will be properly configured155 # on this NIC156 utils.wait_until_true(157 lambda: guest_has_address(ipv6_address),158 timeout=90,159 exception=RuntimeError(160 "Timed out waiting for IP address {!r} to be "161 "configured in the VM {!r}.".format(ipv6_address,162 vm['id'])))163 except (lib_exc.SSHTimeout,164 ssh_exc.AuthenticationException) as ssh_e:165 LOG.debug(ssh_e)166 self._log_console_output([vm])167 self._log_local_network_status()168 raise169 def _test_ipv6_hotplug(self, ra_mode, address_mode):170 ipv6_networks = [self.create_network() for _ in range(2)]171 for net in ipv6_networks:...

Full Screen

Full Screen

test_network_v6.py

Source:test_network_v6.py Github

copy

Full Screen

...101 def _prepare_and_test(self, address6_mode):102 self.prepare_network(address6_mode=address6_mode)103 ssh1, srv1 = self.prepare_server()104 ssh2, srv2 = self.prepare_server()105 def guest_has_address(ssh, addr):106 return addr in ssh.get_ip_list()107 srv1_v6_addr_assigned = functools.partial(108 guest_has_address, ssh1, srv1['accessIPv6'])109 srv2_v6_addr_assigned = functools.partial(110 guest_has_address, ssh2, srv2['accessIPv6'])111 result = ssh1.get_ip_list()112 self.assertIn(srv1['accessIPv4'], result)113 # v6 should be configured since the image supports it114 # It can take time for ipv6 automatic address to get assigned115 self.assertTrue(116 test.call_until_true(srv1_v6_addr_assigned,117 CONF.compute.ping_timeout, 1))118 result = ssh2.get_ip_list()119 self.assertIn(srv2['accessIPv4'], result)...

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