2016-02-09 04:42:21 +00:00
|
|
|
import pytest
|
|
|
|
import rostest.util as u
|
|
|
|
from rostest.util import SSH
|
|
|
|
|
2016-04-01 18:00:42 +00:00
|
|
|
pytestmark = pytest.mark.skipif(u.arch != 'amd64', reason='amd64 network setup impossible to replicate for arm64')
|
2016-02-09 04:42:21 +00:00
|
|
|
|
|
|
|
cloud_config_path = './tests/integration/assets/test_09/cloud-config.yml'
|
|
|
|
|
2016-04-01 18:00:42 +00:00
|
|
|
net_args_arch = {'amd64': ['-net', 'nic,vlan=0,model=virtio'],
|
|
|
|
'arm64': ['-device', 'virtio-net-device']}
|
|
|
|
net_args_arch['arm'] = net_args_arch['arm64']
|
|
|
|
net_args = net_args_arch[u.arch]
|
|
|
|
|
2016-02-09 04:42:21 +00:00
|
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
|
|
def qemu(request):
|
2016-04-01 18:00:42 +00:00
|
|
|
q = u.run_qemu(request,
|
|
|
|
run_args=['--cloud-config', cloud_config_path] +
|
|
|
|
net_args + net_args + net_args + net_args + net_args + net_args + net_args)
|
2016-02-09 04:42:21 +00:00
|
|
|
u.flush_out(q.stdout)
|
|
|
|
return q
|
|
|
|
|
|
|
|
|
2016-04-10 23:38:07 +00:00
|
|
|
def test_network_interfaces_conf(qemu):
|
2016-04-01 01:56:18 +00:00
|
|
|
SSH(qemu).check_call('''cat > test-merge << "SCRIPT"
|
2016-02-09 04:42:21 +00:00
|
|
|
set -x -e
|
|
|
|
|
|
|
|
ip link show dev br0
|
|
|
|
ip link show dev br0.100 | grep br0.100@br0
|
|
|
|
ip link show dev eth1.100 | grep 'master br0'
|
|
|
|
ip link show dev eth6 | grep 'master bond0'
|
|
|
|
ip link show dev eth7 | grep 'master bond0'
|
|
|
|
[ "$(</sys/class/net/bond0/bonding/mode)" = "active-backup 1" ]
|
|
|
|
|
|
|
|
SCRIPT
|
|
|
|
sudo bash test-merge
|
|
|
|
'''.strip())
|
2016-02-10 21:40:51 +00:00
|
|
|
|
|
|
|
|
2016-04-10 23:38:07 +00:00
|
|
|
def test_network_dns_conf(qemu):
|
|
|
|
SSH(qemu).check_call('''cat > test-merge << "SCRIPT"
|
|
|
|
set -x -e
|
|
|
|
|
|
|
|
cat /etc/resolv.conf | grep "search mydomain.com example.com"
|
|
|
|
cat /etc/resolv.conf | grep "nameserver 208.67.222.123"
|
|
|
|
cat /etc/resolv.conf | grep "nameserver 208.67.220.123"
|
|
|
|
|
|
|
|
SCRIPT
|
|
|
|
sudo bash test-merge
|
|
|
|
'''.strip())
|