summaryrefslogtreecommitdiffstats
path: root/nfvbench/traffic_client.py
diff options
context:
space:
mode:
authorFrançois-Régis MENGUY <francoisregis.menguy@orange.com>2018-11-27 11:31:00 +0100
committerfmenguy <francoisregis.menguy@orange.com>2019-06-05 15:40:39 +0200
commit4453818e3af2143e099a5f578c4a73b25abbfe58 (patch)
tree66783c9a978916033659ed6fe0e89035c301202b /nfvbench/traffic_client.py
parenta3578fdb7496e7f1234eef4ac73086ba1d57fcf2 (diff)
Add L3 traffic management with Neutron routers
Change-Id: Ic9bff87e0d78652de28b3a756f9ebc342983cfbb Signed-off-by: fmenguy <francoisregis.menguy@orange.com>
Diffstat (limited to 'nfvbench/traffic_client.py')
-rwxr-xr-xnfvbench/traffic_client.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/nfvbench/traffic_client.py b/nfvbench/traffic_client.py
index 75c40c1..d69da0e 100755
--- a/nfvbench/traffic_client.py
+++ b/nfvbench/traffic_client.py
@@ -23,7 +23,9 @@ from attrdict import AttrDict
import bitmath
from netaddr import IPNetwork
# pylint: disable=import-error
+from trex.stl.api import Ether
from trex.stl.api import STLError
+from trex.stl.api import UDP
# pylint: enable=import-error
from log import LOG
@@ -241,6 +243,11 @@ class Device(object):
self.vnis = vnis
LOG.info("Port %d: VNIs %s", self.port, self.vnis)
+ def set_gw_ip(self, gateway_ip):
+ self.gw_ip_block = IpBlock(gateway_ip,
+ self.generator_config.gateway_ip_addrs_step,
+ self.chain_count)
+
def get_gw_ip(self, chain_index):
"""Retrieve the IP address assigned for the gateway of a given chain."""
return self.gw_ip_block.get_ip(chain_index)
@@ -611,11 +618,10 @@ class TrafficClient(object):
self.gen.stop_traffic()
self.gen.fetch_capture_packets()
self.gen.stop_capture()
-
for packet in self.gen.packet_list:
mac_id = get_mac_id(packet)
src_mac = ':'.join(["%02x" % ord(x) for x in mac_id])
- if src_mac in mac_map:
+ if src_mac in mac_map and self.is_udp(packet):
port, chain = mac_map[src_mac]
LOG.info('Received packet from mac: %s (chain=%d, port=%d)',
src_mac, chain, port)
@@ -624,9 +630,18 @@ class TrafficClient(object):
if not mac_map:
LOG.info('End-to-end connectivity established')
return
-
+ if self.config.l3_router and not self.config.no_arp:
+ # In case of L3 traffic mode, routers are not able to route traffic
+ # until VM interfaces are up and ARP requests are done
+ LOG.info('Waiting for loopback service completely started...')
+ LOG.info('Sending ARP request to assure end-to-end connectivity established')
+ self.ensure_arp_successful()
raise TrafficClientException('End-to-end connectivity cannot be ensured')
+ def is_udp(self, packet):
+ pkt = Ether(packet['binary'])
+ return UDP in pkt
+
def ensure_arp_successful(self):
"""Resolve all IP using ARP and throw an exception in case of failure."""
dest_macs = self.gen.resolve_arp()