blob: e0b01588fe97f6bc16b5ca3bffe0b26c8a4ec7d3 [file] [log] [blame]
Dave Barach68b0fb02017-02-28 15:15:56 -05001#!/usr/bin/env bash
2
3function topo_setup
4{
5 ip netns add vppns1
6 ip link add veth_vpp1 type veth peer name vpp1
7 ip link set dev vpp1 up
8 ip link set dev veth_vpp1 up netns vppns1
9
10 ip netns exec vppns1 \
11 bash -c "
12 ip link set dev lo up
13 ip addr add 6.0.1.2/24 dev veth_vpp1
14 "
15
16 ethtool --offload vpp1 rx off tx off
17 ip netns exec vppns1 ethtool --offload veth_vpp1 rx off tx off
18
19}
20
21function topo_clean
22{
23 ip link del dev veth_vpp1 &> /dev/null
24 ip netns del vppns1 &> /dev/null
25}
26
27if [ "$1" == "clean" ] ; then
28 topo_clean
29 exit 0
30else
31 topo_setup
32fi
33
34# to test connectivity do:
35# sudo ip netns exec vppns1 telnet 6.0.1.1 1234
36# to push traffic to the server
37# dd if=/dev/zero bs=1024K count=512 | nc 6.0.1.1
38# to listen for incoming connection from vpp
39# nc -l 1234