Improve ipv6 configuration

The change replaces restarting the network by reloading network
profiles. Restart of the network terminates ssh connection, so
if possible, better to avoid it. This approach is also
compatible with RHEL 8 as there's no network service anymore
and therefore can't be restarted.
The patch also brings the configured interface up by nmcli,
which works better if there already was a network profile
connected to the configured interface. nmcli makes it drop the
existing profile and use the one which was created in the test.

Change-Id: I4ea06f28c525f2631a69f759fc96b262d9100f45
Martin Kopec 4 years ago
parent 661a52ed45
commit 65c891107b

@ -166,9 +166,10 @@ class TestGettingAddress(manager.NetworkScenarioTest):
if self._sysconfig_network_scripts_dir_exists(ssh):
'echo -e "DEVICE=%(nic)s\\nIPV6INIT=yes" | '
'echo -e "DEVICE=%(nic)s\\nNAME=%(nic)s\\nIPV6INIT=yes" | '
'sudo tee /etc/sysconfig/network-scripts/ifcfg-%(nic)s; '
'sudo /sbin/service network restart' % {'nic': nic})
'sudo nmcli connection reload' % {'nic': nic})
ssh.exec_command('sudo nmcli connection up %s' % nic)
except exceptions.SSHExecCommandFailed as e:
# NOTE(slaweq): Sometimes it can happen that this SSH command
# will fail because of some error from network manager in