nsh.sh revision e3c64ab6
1source config.sh
2source odl_utils.sh
3source topologies/2_node_topo.sh
4
5ODL_CONFIG_FILE1="vpp1.json"
6ODL_CONFIG_FILE2="vpp2.json"
7
8if [ "$1" == "clean" ] ; then
9  2_node_topo_clean
10  exit 0
11fi
12
13if [[ $(id -u) != 0 ]]; then
14  echo "Error: run this as root."
15  exit 1
16fi
17
18function test_nsh
19{
20  2_node_topo_setup
21  rc=1
22
23  maybe_pause
24
25  cat << EOF > scripts/lisp_nsh
26create packet-generator interface pg0
27
28packet-generator new {
29  name nsh1
30  limit 1
31  node lisp-cp-lookup-nsh
32  size 64-64
33  no-recycle
34  worker 0
35  interface pg0
36  pcap ${ONE_ROOT}/tests/data_plane/vpp_lite_topo/scripts/nsh.pcap
37}
38EOF
39
40  echo "trace add af-packet-input 100" | nc 0 5002
41  echo "trace add af-packet-input 100" | nc 0 5003
42  echo "exec ${ONE_ROOT}/tests/data_plane/vpp_lite_topo/scripts/lisp_nsh" | nc 0 5002
43  echo "packet-generator enable-stream nsh1" | nc 0 5002
44
45  # add dummy node to ETR
46  echo "test one nsh add-dummy-decap-node" | nc 0 5003
47
48  # inject NSH packet to ITR
49  echo "test one nsh pcap ${ONE_ROOT}/tests/data_plane/vpp_lite_topo/scripts/nsh.pcap" | nc 0 5002
50
51  # check decap stats
52  decap_stats="`echo "show errors" | nc 0 5003 | grep "lisp gpe dummy nsh decap" | awk '{print $1}'`"
53
54  if [ "$decap_stats" == "1" ] ; then
55    rc=0  # test pass
56  fi
57
58  maybe_pause
59  2_node_topo_clean
60  print_status $rc "NSH test failed!"
61  exit $test_result
62}
63