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:15:47 +0000
commita7d74ea1d1cf916a72881a878980a4b6868fa9ec (patch)
treeec3d986b02eb9cfda5aa4dd19529983207358d13 /resources/libraries/python/QemuManager.py
parent26560a80c1f7426c4d3c797c039a1a6fb7b60a8f (diff)
FIX: Use vhost macs when testpmd_mac forwarding used in VM
Change-Id: I291c3dc852e7c1bde6fb6102a9168cfec9992682 Signed-off-by: Jan Gelety <jgelety@cisco.com> (cherry picked from commit 474034ac24ce89cdaa94a09ae4d9ebbd3fb0f219)
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,