aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf/04_vnf.conf16
-rw-r--r--testcases/testcase.py47
-rw-r--r--vnfs/qemu/qemu.py43
3 files changed, 65 insertions, 41 deletions
diff --git a/conf/04_vnf.conf b/conf/04_vnf.conf
index 2be96859..dc15fd15 100644
--- a/conf/04_vnf.conf
+++ b/conf/04_vnf.conf
@@ -47,19 +47,19 @@ GUEST_TIMEOUT = [180, 180]
GUEST_LOOPBACK = ['testpmd', 'testpmd']
# username for guest image
-GUEST_USERNAME = ''
+GUEST_USERNAME = 'root'
# password for guest image
-GUEST_PASSWORD = ''
+GUEST_PASSWORD = 'root'
# login username prompt for guest image
GUEST_PROMPT_LOGIN = '.* login:'
# login password prompt for guest image
-GUEST_PROMPT_PASSWORD = ''
+GUEST_PROMPT_PASSWORD = 'Password: '
# standard prompt for guest image
-GUEST_PROMPT = ''
+GUEST_PROMPT = 'root.*#'
# log file for qemu
LOG_FILE_QEMU = 'qemu.log'
@@ -74,11 +74,14 @@ LOG_FILE_GUEST_CMDS = 'guest-cmds.log'
QEMU_BIN = os.path.join(QEMU_DIR, 'x86_64-softmmu/qemu-system-x86_64')
+# For 2 VNFs you may use ['eth0', 'eth2']
+GUEST_NIC1_NAME = ['eth0', 'eth0']
+GUEST_NIC2_NAME = ['eth1', 'eth1']
+
# For 2 VNFs you may use ['00:00:00:00:00:01', '00:00:00:00:00:03']
GUEST_NET1_MAC = ['00:00:00:00:00:01', '00:00:00:00:00:03']
GUEST_NET2_MAC = ['00:00:00:00:00:02', '00:00:00:00:00:04']
-
# For 2 VNFs you may use ['00:04.0', '00:04.0']
GUEST_NET1_PCI_ADDRESS = ['00:04.0', '00:04.0']
GUEST_NET2_PCI_ADDRESS = ['00:05.0', '00:05.0']
@@ -115,9 +118,6 @@ VANILLA_TGEN_PORT2_MAC = 'AA:BB:CC:DD:EE:F0'
VANILLA_BRIDGE_IP = ['1.1.1.5/16', '1.1.1.6/16']
-VANILLA_NIC1_NAME = ['eth1', 'eth3']
-VANILLA_NIC2_NAME = ['eth2', 'eth4']
-
VANILLA_NIC1_IP_CIDR = ['192.168.1.2/24', '192.168.1.4/24']
VANILLA_NIC2_IP_CIDR = ['192.168.1.3/24', '192.168.1.5/24']
diff --git a/testcases/testcase.py b/testcases/testcase.py
index 1bb7aba5..986fbe4b 100644
--- a/testcases/testcase.py
+++ b/testcases/testcase.py
@@ -18,6 +18,7 @@ import csv
import os
import logging
import subprocess
+import copy
from collections import OrderedDict
from core.results.results_constants import ResultsConstants
@@ -85,7 +86,7 @@ class TestCase(object):
self._results_dir = results_dir
# set traffic details, so they can be passed to vswitch and traffic ctls
- self._traffic = TRAFFIC_DEFAULTS.copy()
+ self._traffic = copy.deepcopy(TRAFFIC_DEFAULTS)
self._traffic.update({'traffic_type': cfg['Traffic Type'],
'flow_type': cfg.get('Flow Type', 'port'),
'bidir': cfg['biDirectional'],
@@ -96,10 +97,10 @@ class TestCase(object):
# OVS Vanilla requires guest VM MAC address and IPs to work
if 'linux_bridge' in self.guest_loopback:
- self._traffic['l2'] = {'srcmac': S.getValue('GUEST_NET2_MAC')[0],
- 'dstmac': S.getValue('GUEST_NET1_MAC')[0]}
- self._traffic['l3'] = {'srcip': S.getValue('VANILLA_TGEN_PORT1_IP'),
- 'dstip': S.getValue('VANILLA_TGEN_PORT2_IP')}
+ self._traffic['l2'].update({'srcmac': S.getValue('GUEST_NET2_MAC')[0],
+ 'dstmac': S.getValue('GUEST_NET1_MAC')[0]})
+ self._traffic['l3'].update({'srcip': S.getValue('VANILLA_TGEN_PORT1_IP'),
+ 'dstip': S.getValue('VANILLA_TGEN_PORT2_IP')})
def run(self):
"""Run the test
@@ -109,8 +110,7 @@ class TestCase(object):
self._logger.debug(self.name)
# copy sources of l2 forwarding tools into VM shared dir if needed
- if 'testpmd' in self.guest_loopback or 'l2fwd' in self.guest_loopback:
- self._copy_fwd_tools_for_guest()
+ self._copy_fwd_tools_for_guest()
self._logger.debug("Controllers:")
loader = Loader()
@@ -267,24 +267,27 @@ class TestCase(object):
while counter < self.deployment.count('v'):
guest_dir = S.getValue('GUEST_SHARE_DIR')[counter]
+ # create shared dir if it doesn't exist
if not os.path.exists(guest_dir):
os.makedirs(guest_dir)
- try:
- tasks.run_task(['rsync', '-a', '-r', '-l', r'--exclude="\.git"',
- os.path.join(S.getValue('RTE_SDK'), ''),
- os.path.join(guest_dir, 'DPDK')],
- self._logger,
- 'Copying DPDK to shared directory...',
- True)
- tasks.run_task(['rsync', '-a', '-r', '-l',
- os.path.join(S.getValue('ROOT_DIR'), 'src/l2fwd/'),
- os.path.join(guest_dir, 'l2fwd')],
- self._logger,
- 'Copying l2fwd to shared directory...',
- True)
- except subprocess.CalledProcessError:
- self._logger.error('Unable to copy DPDK and l2fwd to shared directory')
+ # copy sources into shared dir only if neccessary
+ if 'testpmd' in self.guest_loopback or 'l2fwd' in self.guest_loopback:
+ try:
+ tasks.run_task(['rsync', '-a', '-r', '-l', r'--exclude="\.git"',
+ os.path.join(S.getValue('RTE_SDK'), ''),
+ os.path.join(guest_dir, 'DPDK')],
+ self._logger,
+ 'Copying DPDK to shared directory...',
+ True)
+ tasks.run_task(['rsync', '-a', '-r', '-l',
+ os.path.join(S.getValue('ROOT_DIR'), 'src/l2fwd/'),
+ os.path.join(guest_dir, 'l2fwd')],
+ self._logger,
+ 'Copying l2fwd to shared directory...',
+ True)
+ except subprocess.CalledProcessError:
+ self._logger.error('Unable to copy DPDK and l2fwd to shared directory')
counter += 1
diff --git a/vnfs/qemu/qemu.py b/vnfs/qemu/qemu.py
index f292d7d9..bf7b1a90 100644
--- a/vnfs/qemu/qemu.py
+++ b/vnfs/qemu/qemu.py
@@ -51,8 +51,17 @@ class IVnfQemu(IVnf):
S.getValue('LOG_FILE_QEMU')) + str(self._number)
self._timeout = S.getValue('GUEST_TIMEOUT')[self._number]
self._monitor = '%s/vm%dmonitor' % ('/tmp', self._number)
- self._net1 = S.getValue('VANILLA_NIC1_NAME')[self._number]
- self._net2 = S.getValue('VANILLA_NIC2_NAME')[self._number]
+ self._net1 = get_test_param('guest_nic1_name', None)
+ if self._net1 == None:
+ self._net1 = S.getValue('GUEST_NIC1_NAME')[self._number]
+ else:
+ self._net1 = self._net1.split(',')[self._number]
+ self._net2 = get_test_param('guest_nic2_name', None)
+ if self._net2 == None:
+ self._net2 = S.getValue('GUEST_NIC2_NAME')[self._number]
+ else:
+ self._net2 = self._net2.split(',')[self._number]
+
name = 'Client%d' % self._number
vnc = ':%d' % self._number
@@ -62,7 +71,7 @@ class IVnfQemu(IVnf):
'-m', S.getValue('GUEST_MEMORY')[self._number],
'-smp', str(S.getValue('GUEST_SMP')[self._number]),
'-cpu', 'host',
- '-drive', 'if=ide,file=' +
+ '-drive', 'if=scsi,file=' +
S.getValue('GUEST_IMAGE')[self._number],
'-boot', 'c', '--enable-kvm',
'-monitor', 'unix:%s,server,nowait' % self._monitor,
@@ -74,7 +83,7 @@ class IVnfQemu(IVnf):
'-nographic', '-vnc', str(vnc), '-name', name,
'-snapshot', '-net none', '-no-reboot',
'-drive',
- 'if=ide,file=fat:rw:%s,snapshot=off' %
+ 'if=scsi,file=fat:rw:%s,snapshot=off' %
S.getValue('GUEST_SHARE_DIR')[self._number],
]
self._configure_logging()
@@ -237,9 +246,22 @@ class IVnfQemu(IVnf):
"""
Disable firewall in VM
"""
- # Disable services (F16)
- self.execute_and_wait('systemctl status iptables.service')
- self.execute_and_wait('systemctl stop iptables.service')
+ for iptables in ['iptables', 'ip6tables']:
+ # filter table
+ for chain in ['INPUT', 'FORWARD', 'OUTPUT']:
+ self.execute_and_wait("{} -t filter -P {} ACCEPT".format(iptables, chain))
+ # mangle table
+ for chain in ['PREROUTING', 'INPUT', 'FORWARD', 'OUTPUT', 'POSTROUTING']:
+ self.execute_and_wait("{} -t mangle -P {} ACCEPT".format(iptables, chain))
+ # nat table
+ for chain in ['PREROUTING', 'INPUT', 'OUTPUT', 'POSTROUTING']:
+ self.execute_and_wait("{} -t nat -P {} ACCEPT".format(iptables, chain))
+
+ # flush rules and delete chains created by user
+ for table in ['filter', 'mangle', 'nat']:
+ self.execute_and_wait("{} -t {} -F".format(iptables, table))
+ self.execute_and_wait("{} -t {} -X".format(iptables, table))
+
def _configure_testpmd(self):
"""
@@ -313,12 +335,11 @@ class IVnfQemu(IVnf):
Configure VM to perform L2 forwarding between NICs by linux bridge
"""
self._configure_disable_firewall()
- nic1_name = get_test_param('vanilla_nic1_name', self._net1)
- self.execute('ifconfig ' + nic1_name + ' ' +
+
+ self.execute('ifconfig ' + self._net1 + ' ' +
S.getValue('VANILLA_NIC1_IP_CIDR')[self._number])
- nic2_name = get_test_param('vanilla_nic2_name', self._net2)
- self.execute('ifconfig ' + nic2_name + ' ' +
+ self.execute('ifconfig ' + self._net2 + ' ' +
S.getValue('VANILLA_NIC2_IP_CIDR')[self._number])
# configure linux bridge