aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/QemuManager.py
diff options
context:
space:
mode:
authorJan Gelety <jgelety@cisco.com>2019-09-02 23:28:30 +0200
committerJan Gelety <jgelety@cisco.com>2019-09-05 06:12:59 +0000
commit474034ac24ce89cdaa94a09ae4d9ebbd3fb0f219 (patch)
treec34dc703f3d1a4a93e404eb709c28efb5282be50 /resources/libraries/python/QemuManager.py
parenta5629ca2946f64c67fde6ce4b32c52d4173918b3 (diff)
FIX: Use vhost macs when testpmd_mac forwarding used in VM
Change-Id: I291c3dc852e7c1bde6fb6102a9168cfec9992682 Signed-off-by: Jan Gelety <jgelety@cisco.com>
Diffstat (limited to 'resources/libraries/python/QemuManager.py')
-rw-r--r--resources/libraries/python/QemuManager.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/resources/libraries/python/QemuManager.py b/resources/libraries/python/QemuManager.py
index c9b89f0905..ad205c87a5 100644
--- a/resources/libraries/python/QemuManager.py
+++ b/resources/libraries/python/QemuManager.py
@@ -18,7 +18,7 @@ from collections import OrderedDict
from resources.libraries.python.Constants import Constants
from resources.libraries.python.CpuUtils import CpuUtils
from resources.libraries.python.QemuUtils import QemuUtils
-from resources.libraries.python.topology import NodeType
+from resources.libraries.python.topology import NodeType, Topology
__all__ = ["QemuManager"]
@@ -62,10 +62,18 @@ class QemuManager(object):
name = '{node}_{qemu_id}'.format(node=node, qemu_id=qemu_id)
sock1 = '/var/run/vpp/sock-{qemu_id}-1'.format(qemu_id=qemu_id)
sock2 = '/var/run/vpp/sock-{qemu_id}-2'.format(qemu_id=qemu_id)
- vif1_mac = kwargs['tg_if1_mac'] if nf_node == 1 \
- else '52:54:00:00:{id:02x}:02'.format(id=qemu_id - 1)
- vif2_mac = kwargs['tg_if2_mac'] if nf_node == nf_nodes \
- else '52:54:00:00:{id:02x}:01'.format(id=qemu_id + 1)
+ vif1_mac = Topology.get_interface_mac(
+ self.nodes[node], 'vhost{idx}'.format(
+ idx=(nf_chain - 1) * nf_nodes * 2 + nf_node * 2 - 1)) \
+ if kwargs['vnf'] == 'testpmd_mac' \
+ else kwargs['tg_if1_mac'] if nf_node == 1 \
+ else '52:54:00:00:{id:02x}:02'.format(id=qemu_id - 1)
+ vif2_mac = Topology.get_interface_mac(
+ self.nodes[node], 'vhost{idx}'.format(
+ idx=(nf_chain - 1) * nf_nodes * 2 + nf_node * 2)) \
+ if kwargs['vnf'] == 'testpmd_mac' \
+ else kwargs['tg_if2_mac'] if nf_node == nf_nodes \
+ else '52:54:00:00:{id:02x}:01'.format(id=qemu_id + 1)
self.machines_affinity[name] = CpuUtils.get_affinity_nf(
nodes=self.nodes, node=node, nf_chains=nf_chains,