From 676362e1714afe4e7bb1557828580e710670b602 Mon Sep 17 00:00:00 2001 From: Andrej Kozemcak Date: Wed, 11 May 2016 10:57:58 +0200 Subject: Create LISP test for csit_topology and for vpp_lite_topology Change-Id: If0a886c761a41c9914c10d2ae3abf9f7711151c6 Signed-off-by: Andrej Kozemcak --- tests/data_plane/configs/odl/add_ipv4_odl1.txt | 29 +++++ tests/data_plane/configs/odl/add_ipv4_odl2.txt | 29 +++++ tests/data_plane/configs/odl/add_ipv6_odl1.txt | 29 +++++ tests/data_plane/configs/odl/add_ipv6_odl2.txt | 29 +++++ tests/data_plane/configs/odl/replace_ipv4_odl2.txt | 29 +++++ tests/data_plane/configs/odl/replace_ipv6_odl2.txt | 29 +++++ tests/data_plane/configs/vpp_csit_config/vpp1.conf | 10 ++ .../data_plane/configs/vpp_csit_config/vpp1_6.conf | 10 ++ tests/data_plane/configs/vpp_csit_config/vpp2.conf | 9 ++ .../data_plane/configs/vpp_csit_config/vpp2_6.conf | 9 ++ .../configs/vpp_csit_config/vpp2_reconf.conf | 3 + .../configs/vpp_csit_config/vpp2_reconf_6.conf | 3 + tests/data_plane/configs/vpp_lite_config/vpp1.conf | 13 +++ .../data_plane/configs/vpp_lite_config/vpp1_6.conf | 13 +++ .../configs/vpp_lite_config/vpp1_ip4_6.conf | 17 +++ tests/data_plane/configs/vpp_lite_config/vpp2.conf | 13 +++ .../data_plane/configs/vpp_lite_config/vpp2_6.conf | 13 +++ .../configs/vpp_lite_config/vpp2_ip4_6.conf | 17 +++ tests/data_plane/csit_topo/README | 9 ++ tests/data_plane/csit_topo/lisp_ip4.sh | 45 ++++++++ tests/data_plane/csit_topo/lisp_ip6.sh | 45 ++++++++ tests/data_plane/csit_topo/lisp_test.sh | 112 +++++++++++++++++++ tests/data_plane/vpp_lite_topo/README | 15 +++ tests/data_plane/vpp_lite_topo/lisp_ip4.sh | 47 ++++++++ tests/data_plane/vpp_lite_topo/lisp_ip6.sh | 47 ++++++++ tests/data_plane/vpp_lite_topo/lisp_test.sh | 122 +++++++++++++++++++++ 26 files changed, 746 insertions(+) create mode 100644 tests/data_plane/configs/odl/add_ipv4_odl1.txt create mode 100644 tests/data_plane/configs/odl/add_ipv4_odl2.txt create mode 100644 tests/data_plane/configs/odl/add_ipv6_odl1.txt create mode 100644 tests/data_plane/configs/odl/add_ipv6_odl2.txt create mode 100644 tests/data_plane/configs/odl/replace_ipv4_odl2.txt create mode 100644 tests/data_plane/configs/odl/replace_ipv6_odl2.txt create mode 100644 tests/data_plane/configs/vpp_csit_config/vpp1.conf create mode 100644 tests/data_plane/configs/vpp_csit_config/vpp1_6.conf create mode 100644 tests/data_plane/configs/vpp_csit_config/vpp2.conf create mode 100644 tests/data_plane/configs/vpp_csit_config/vpp2_6.conf create mode 100644 tests/data_plane/configs/vpp_csit_config/vpp2_reconf.conf create mode 100644 tests/data_plane/configs/vpp_csit_config/vpp2_reconf_6.conf create mode 100644 tests/data_plane/configs/vpp_lite_config/vpp1.conf create mode 100644 tests/data_plane/configs/vpp_lite_config/vpp1_6.conf create mode 100644 tests/data_plane/configs/vpp_lite_config/vpp1_ip4_6.conf create mode 100644 tests/data_plane/configs/vpp_lite_config/vpp2.conf create mode 100644 tests/data_plane/configs/vpp_lite_config/vpp2_6.conf create mode 100644 tests/data_plane/configs/vpp_lite_config/vpp2_ip4_6.conf create mode 100644 tests/data_plane/csit_topo/README create mode 100644 tests/data_plane/csit_topo/lisp_ip4.sh create mode 100644 tests/data_plane/csit_topo/lisp_ip6.sh create mode 100755 tests/data_plane/csit_topo/lisp_test.sh create mode 100644 tests/data_plane/vpp_lite_topo/README create mode 100644 tests/data_plane/vpp_lite_topo/lisp_ip4.sh create mode 100644 tests/data_plane/vpp_lite_topo/lisp_ip6.sh create mode 100755 tests/data_plane/vpp_lite_topo/lisp_test.sh diff --git a/tests/data_plane/configs/odl/add_ipv4_odl1.txt b/tests/data_plane/configs/odl/add_ipv4_odl1.txt new file mode 100644 index 0000000..7544187 --- /dev/null +++ b/tests/data_plane/configs/odl/add_ipv4_odl1.txt @@ -0,0 +1,29 @@ +{ + "input": { + "mapping-record": { + "recordTtl": 1440, + "action": "NoAction", + "authoritative": true, + "eid": { + "address-type": "ietf-lisp-address-types:ipv4-prefix-afi", + "ipv4-prefix": "6.0.1.0/24" + }, + "LocatorRecord": [ + { + "locator-id": "ISP1", + "priority": 1, + "weight": 1, + "multicastPriority": 255, + "multicastWeight": 0, + "localLocator": true, + "rlocProbed": false, + "routed": true, + "rloc": { + "address-type": "ietf-lisp-address-types:ipv4-afi", + "ipv4": "6.0.3.1" + } + } + ] + } + } +} diff --git a/tests/data_plane/configs/odl/add_ipv4_odl2.txt b/tests/data_plane/configs/odl/add_ipv4_odl2.txt new file mode 100644 index 0000000..645432c --- /dev/null +++ b/tests/data_plane/configs/odl/add_ipv4_odl2.txt @@ -0,0 +1,29 @@ +{ + "input": { + "mapping-record": { + "recordTtl": 1440, + "action": "NoAction", + "authoritative": true, + "eid": { + "address-type": "ietf-lisp-address-types:ipv4-prefix-afi", + "ipv4-prefix": "6.0.2.0/24" + }, + "LocatorRecord": [ + { + "locator-id": "ISP1", + "priority": 1, + "weight": 1, + "multicastPriority": 255, + "multicastWeight": 0, + "localLocator": true, + "rlocProbed": false, + "routed": true, + "rloc": { + "address-type": "ietf-lisp-address-types:ipv4-afi", + "ipv4": "6.0.3.2" + } + } + ] + } + } +} diff --git a/tests/data_plane/configs/odl/add_ipv6_odl1.txt b/tests/data_plane/configs/odl/add_ipv6_odl1.txt new file mode 100644 index 0000000..a367262 --- /dev/null +++ b/tests/data_plane/configs/odl/add_ipv6_odl1.txt @@ -0,0 +1,29 @@ +{ + "input": { + "mapping-record": { + "recordTtl": 1440, + "action": "NoAction", + "authoritative": true, + "eid": { + "address-type": "ietf-lisp-address-types:ipv6-prefix-afi", + "ipv6-prefix": "6:0:1::0/48" + }, + "LocatorRecord": [ + { + "locator-id": "ISP1", + "priority": 1, + "weight": 1, + "multicastPriority": 255, + "multicastWeight": 0, + "localLocator": true, + "rlocProbed": false, + "routed": true, + "rloc": { + "address-type": "ietf-lisp-address-types:ipv6-afi", + "ipv6": "6:0:3::1" + } + } + ] + } + } +} diff --git a/tests/data_plane/configs/odl/add_ipv6_odl2.txt b/tests/data_plane/configs/odl/add_ipv6_odl2.txt new file mode 100644 index 0000000..3f5afd7 --- /dev/null +++ b/tests/data_plane/configs/odl/add_ipv6_odl2.txt @@ -0,0 +1,29 @@ +{ + "input": { + "mapping-record": { + "recordTtl": 1440, + "action": "NoAction", + "authoritative": true, + "eid": { + "address-type": "ietf-lisp-address-types:ipv6-prefix-afi", + "ipv6-prefix": "6:0:2::0/48" + }, + "LocatorRecord": [ + { + "locator-id": "ISP1", + "priority": 1, + "weight": 1, + "multicastPriority": 255, + "multicastWeight": 0, + "localLocator": true, + "rlocProbed": false, + "routed": true, + "rloc": { + "address-type": "ietf-lisp-address-types:ipv6-afi", + "ipv6": "6:0:3::2" + } + } + ] + } + } +} diff --git a/tests/data_plane/configs/odl/replace_ipv4_odl2.txt b/tests/data_plane/configs/odl/replace_ipv4_odl2.txt new file mode 100644 index 0000000..089516b --- /dev/null +++ b/tests/data_plane/configs/odl/replace_ipv4_odl2.txt @@ -0,0 +1,29 @@ +{ + "input": { + "mapping-record": { + "recordTtl": 1440, + "action": "NoAction", + "authoritative": true, + "eid": { + "address-type": "ietf-lisp-address-types:ipv4-prefix-afi", + "ipv4-prefix": "6.0.2.0/24" + }, + "LocatorRecord": [ + { + "locator-id": "ISP1", + "priority": 1, + "weight": 1, + "multicastPriority": 255, + "multicastWeight": 0, + "localLocator": true, + "rlocProbed": false, + "routed": true, + "rloc": { + "address-type": "ietf-lisp-address-types:ipv4-afi", + "ipv4": "6.0.3.20" + } + } + ] + } + } +} diff --git a/tests/data_plane/configs/odl/replace_ipv6_odl2.txt b/tests/data_plane/configs/odl/replace_ipv6_odl2.txt new file mode 100644 index 0000000..e61d6fc --- /dev/null +++ b/tests/data_plane/configs/odl/replace_ipv6_odl2.txt @@ -0,0 +1,29 @@ +{ + "input": { + "mapping-record": { + "recordTtl": 1440, + "action": "NoAction", + "authoritative": true, + "eid": { + "address-type": "ietf-lisp-address-types:ipv6-prefix-afi", + "ipv6-prefix": "6:0:2::0/48" + }, + "LocatorRecord": [ + { + "locator-id": "ISP1", + "priority": 1, + "weight": 1, + "multicastPriority": 255, + "multicastWeight": 0, + "localLocator": true, + "rlocProbed": false, + "routed": true, + "rloc": { + "address-type": "ietf-lisp-address-types:ipv6-afi", + "ipv6": "6:0:3::20" + } + } + ] + } + } +} diff --git a/tests/data_plane/configs/vpp_csit_config/vpp1.conf b/tests/data_plane/configs/vpp_csit_config/vpp1.conf new file mode 100644 index 0000000..c5ddcb3 --- /dev/null +++ b/tests/data_plane/configs/vpp_csit_config/vpp1.conf @@ -0,0 +1,10 @@ +exec set int ip address GigabitEthernet0/9/0 6.0.1.1/24 +exec set int state GigabitEthernet0/9/0 up +exec set int ip address GigabitEthernet0/a/0 6.0.3.1/24 +exec set int state GigabitEthernet0/a/0 up +lisp_enable_disable enable + +lisp_add_del_map_resolver 6.0.3.100 +lisp_add_del_locator_set locator-set ls1 +lisp_add_del_locator locator-set ls1 iface GigabitEthernet0/a/0 p 1 w 2 +lisp_add_del_local_eid eid 6.0.1.0/24 locator-set ls1 \ No newline at end of file diff --git a/tests/data_plane/configs/vpp_csit_config/vpp1_6.conf b/tests/data_plane/configs/vpp_csit_config/vpp1_6.conf new file mode 100644 index 0000000..d14acc4 --- /dev/null +++ b/tests/data_plane/configs/vpp_csit_config/vpp1_6.conf @@ -0,0 +1,10 @@ +exec set int ip address GigabitEthernet0/9/0 6:0:1::1/64 +exec set int state GigabitEthernet0/9/0 up +exec set int ip address GigabitEthernet0/a/0 6:0:3::1/64 +exec set int state GigabitEthernet0/a/0 up +lisp_enable_disable enable + +lisp_add_del_map_resolver 6:0:3::100 +lisp_add_del_locator_set locator-set ls1 +lisp_add_del_locator locator-set ls1 iface GigabitEthernet0/a/0 p 1 w 2 +lisp_add_del_local_eid eid 6:0:1::0/64 locator-set ls1 \ No newline at end of file diff --git a/tests/data_plane/configs/vpp_csit_config/vpp2.conf b/tests/data_plane/configs/vpp_csit_config/vpp2.conf new file mode 100644 index 0000000..32d1be5 --- /dev/null +++ b/tests/data_plane/configs/vpp_csit_config/vpp2.conf @@ -0,0 +1,9 @@ +exec set int ip address GigabitEthernet0/9/0 6.0.2.1/24 +exec set int state GigabitEthernet0/9/0 up +exec set int ip address GigabitEthernet0/a/0 6.0.3.2/24 +exec set int state GigabitEthernet0/a/0 up +lisp_enable_disable enable +lisp_add_del_map_resolver 6.0.3.100 +lisp_add_del_locator_set locator-set ls1 +lisp_add_del_locator locator-set ls1 iface GigabitEthernet0/a/0 p 1 w 2 +lisp_add_del_local_eid eid 6.0.2.0/24 locator-set ls1 \ No newline at end of file diff --git a/tests/data_plane/configs/vpp_csit_config/vpp2_6.conf b/tests/data_plane/configs/vpp_csit_config/vpp2_6.conf new file mode 100644 index 0000000..8bb999d --- /dev/null +++ b/tests/data_plane/configs/vpp_csit_config/vpp2_6.conf @@ -0,0 +1,9 @@ +exec set int ip address GigabitEthernet0/9/0 6:0:2::1/64 +exec set int state GigabitEthernet0/9/0 up +exec set int ip address GigabitEthernet0/a/0 6:0:3::2/64 +exec set int state GigabitEthernet0/a/0 up +lisp_enable_disable enable +lisp_add_del_map_resolver 6:0:3::100 +lisp_add_del_locator_set locator-set ls1 +lisp_add_del_locator locator-set ls1 iface GigabitEthernet0/a/0 p 1 w 2 +lisp_add_del_local_eid eid 6:0:2::0/64 locator-set ls1 \ No newline at end of file diff --git a/tests/data_plane/configs/vpp_csit_config/vpp2_reconf.conf b/tests/data_plane/configs/vpp_csit_config/vpp2_reconf.conf new file mode 100644 index 0000000..fec4070 --- /dev/null +++ b/tests/data_plane/configs/vpp_csit_config/vpp2_reconf.conf @@ -0,0 +1,3 @@ +exec set int ip address del GigabitEthernet0/a/0 6.0.3.2/24 +exec set int ip address GigabitEthernet0/a/0 6.0.3.20/24 +exec set int state GigabitEthernet0/a/0 up \ No newline at end of file diff --git a/tests/data_plane/configs/vpp_csit_config/vpp2_reconf_6.conf b/tests/data_plane/configs/vpp_csit_config/vpp2_reconf_6.conf new file mode 100644 index 0000000..6cc6b13 --- /dev/null +++ b/tests/data_plane/configs/vpp_csit_config/vpp2_reconf_6.conf @@ -0,0 +1,3 @@ +exec set int ip address del GigabitEthernet0/a/0 6:0:3::2/64 +exec set int ip address GigabitEthernet0/a/0 6:0:3::20/64 +exec set int state GigabitEthernet0/a/0 up diff --git a/tests/data_plane/configs/vpp_lite_config/vpp1.conf b/tests/data_plane/configs/vpp_lite_config/vpp1.conf new file mode 100644 index 0000000..5648c20 --- /dev/null +++ b/tests/data_plane/configs/vpp_lite_config/vpp1.conf @@ -0,0 +1,13 @@ +create host-interface name vpp1 +set int state host-vpp1 up +set int ip address host-vpp1 6.0.1.1/24 + +create host-interface name intervpp1 +set int state host-intervpp1 up +set int ip address host-intervpp1 6.0.3.1/24 + +lisp enable + +lisp locator-set add ls1 iface host-intervpp1 p 1 w 1 +lisp eid-table add eid 6.0.1.0/24 locator-set ls1 +lisp map-resolver add 6.0.3.100 diff --git a/tests/data_plane/configs/vpp_lite_config/vpp1_6.conf b/tests/data_plane/configs/vpp_lite_config/vpp1_6.conf new file mode 100644 index 0000000..b064a57 --- /dev/null +++ b/tests/data_plane/configs/vpp_lite_config/vpp1_6.conf @@ -0,0 +1,13 @@ +create host-interface name vpp1 +set int state host-vpp1 up +set int ip address host-vpp1 6:0:1::1/64 + +create host-interface name intervpp1 +set int state host-intervpp1 up +set int ip address host-intervpp1 6:0:3::1/64 + +lisp enable + +lisp locator-set add ls1 iface host-intervpp1 p 1 w 1 +lisp eid-table add eid 6:0:1::0/64 locator-set ls1 +lisp map-resolver add 6:0:3::100 diff --git a/tests/data_plane/configs/vpp_lite_config/vpp1_ip4_6.conf b/tests/data_plane/configs/vpp_lite_config/vpp1_ip4_6.conf new file mode 100644 index 0000000..9cef140 --- /dev/null +++ b/tests/data_plane/configs/vpp_lite_config/vpp1_ip4_6.conf @@ -0,0 +1,17 @@ +create host-interface name vpp1 +set int state host-vpp1 up +set int ip address host-vpp1 6.0.1.1/24 +set int ip address host-vpp1 6:0:1::1/64 + +create host-interface name intervpp1 +set int state host-intervpp1 up +set int ip address host-intervpp1 6.0.3.1/24 +set int ip address host-intervpp1 6:0:3::1/64 + +lisp enable + +lisp locator-set add ls1 iface host-intervpp1 p 1 w 1 +lisp eid-table add eid 6.0.1.0/24 locator-set ls1 +lisp eid-table add eid 6:0:1::0/64 locator-set ls1 +lisp map-resolver add 6.0.3.100 +lisp map-resolver add 6:0:3::100 diff --git a/tests/data_plane/configs/vpp_lite_config/vpp2.conf b/tests/data_plane/configs/vpp_lite_config/vpp2.conf new file mode 100644 index 0000000..1bac043 --- /dev/null +++ b/tests/data_plane/configs/vpp_lite_config/vpp2.conf @@ -0,0 +1,13 @@ +create host-interface name vpp2 +set int state host-vpp2 up +set int ip address host-vpp2 6.0.2.1/24 + +create host-interface name intervpp2 +set int state host-intervpp2 up +set int ip address host-intervpp2 6.0.3.2/24 + +lisp enable + +lisp locator-set add ls1 iface host-intervpp2 p 1 w 1 +lisp eid-table add eid 6.0.2.0/24 locator-set ls1 +lisp map-resolver add 6.0.3.100 diff --git a/tests/data_plane/configs/vpp_lite_config/vpp2_6.conf b/tests/data_plane/configs/vpp_lite_config/vpp2_6.conf new file mode 100644 index 0000000..d8ace86 --- /dev/null +++ b/tests/data_plane/configs/vpp_lite_config/vpp2_6.conf @@ -0,0 +1,13 @@ +create host-interface name vpp2 +set int state host-vpp2 up +set int ip address host-vpp2 6:0:2::1/64 + +create host-interface name intervpp2 +set int state host-intervpp2 up +set int ip address host-intervpp2 6:0:3::2/64 + +lisp enable + +lisp locator-set add ls1 iface host-intervpp2 p 1 w 1 +lisp eid-table add eid 6:0:2::0/64 locator-set ls1 +lisp map-resolver add 6:0:3::100 diff --git a/tests/data_plane/configs/vpp_lite_config/vpp2_ip4_6.conf b/tests/data_plane/configs/vpp_lite_config/vpp2_ip4_6.conf new file mode 100644 index 0000000..7c845f6 --- /dev/null +++ b/tests/data_plane/configs/vpp_lite_config/vpp2_ip4_6.conf @@ -0,0 +1,17 @@ +create host-interface name vpp2 +set int state host-vpp2 up +set int ip address host-vpp2 6.0.2.1/24 +set int ip address host-vpp2 6:0:2::1/64 + +create host-interface name intervpp2 +set int state host-intervpp2 up +set int ip address host-intervpp2 6.0.3.2/24 +set int ip address host-intervpp2 6:0:3::2/64 + +lisp enable + +lisp locator-set add ls1 iface host-intervpp2 p 1 w 1 +lisp eid-table add eid 6.0.2.0/24 locator-set ls1 +lisp eid-table add eid 6:0:2::0/64 locator-set ls1 +lisp map-resolver add 6.0.3.100 +lisp map-resolver add 6:0:3::100 diff --git a/tests/data_plane/csit_topo/README b/tests/data_plane/csit_topo/README new file mode 100644 index 0000000..6d2f10d --- /dev/null +++ b/tests/data_plane/csit_topo/README @@ -0,0 +1,9 @@ +# example use +# Test ip4 topology +./lisp_test.sh or ./lisp_test ip4 + +# Test ip6 topology +./lisp_test ip6 + +# Test ip4 and ip6 topology +./lisp_test all diff --git a/tests/data_plane/csit_topo/lisp_ip4.sh b/tests/data_plane/csit_topo/lisp_ip4.sh new file mode 100644 index 0000000..55c8a91 --- /dev/null +++ b/tests/data_plane/csit_topo/lisp_ip4.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +function ping_lisp { + local RESULTS + RESULTS=$(ssh_tg "ping -c 10 6.0.2.2") + if [ $? -ne 0 ] ; then + echo "Can not ping other machine" + ssh_vpp1 "sudo rm -r ${TMP_DIR}" + ssh_vpp2 "sudo rm -r ${TMP_DIR}" + exit -1 + fi +} + +curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:add-mapping \ + -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_ADD_CONFIG1}" \ + -u ${ODL_USER}:${ODL_PASSWD} +curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:add-mapping \ + -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_ADD_CONFIG2}" \ + -u ${ODL_USER}:${ODL_PASSWD} + +rsync -avz ${VPP_CONFIG_DIR}${VPP_CONFIG1} ${USER}@${VPP1_IP}:${TMP_DIR}/vpp1.conf +rsync -avz ${VPP_CONFIG_DIR}${VPP_CONFIG2} ${USER}@${VPP2_IP}:${TMP_DIR}/vpp2.conf + +ssh_vpp1 "sudo vpp_api_test < ${TMP_DIR}/vpp1.conf" +ssh_vpp2 "sudo vpp_api_test < ${TMP_DIR}/vpp2.conf" + +ssh_tg "sudo ip addr add 6.0.1.2/24 dev ${TG_INT1}" +ssh_tg "sudo ip link set ${TG_INT1} up" +ssh_tg "sudo ip route add 6.0.2.0/24 via 6.0.1.1" +ssh_tg "sudo ip netns exec net2 ip addr add 6.0.2.2/24 dev ${TG_INT2}" +ssh_tg "sudo ip netns exec net2 ip link set lo up" +ssh_tg "sudo ip netns exec net2 ip link set ${TG_INT2} up" +ssh_tg "sudo ip netns exec net2 ip route add 6.0.1.0/24 via 6.0.2.1" + +ping_lisp + +rsync -avz ${VPP_CONFIG_DIR}${VPP_RECONF2} ${USER}@${VPP2_IP}:${TMP_DIR}/vpp2_reconf.conf + +ssh_vpp2 "sudo vpp_api_test < ${TMP_DIR}/vpp2_reconf.conf" + +curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:update-mapping \ + -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_REPLACE_CONFIG2}" \ + -u ${ODL_USER}:${ODL_PASSWD} + +ping_lisp diff --git a/tests/data_plane/csit_topo/lisp_ip6.sh b/tests/data_plane/csit_topo/lisp_ip6.sh new file mode 100644 index 0000000..eb0c172 --- /dev/null +++ b/tests/data_plane/csit_topo/lisp_ip6.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +function ping_lisp6 { + local RESULTS + RESULTS=$(ssh_tg "ping6 -c 10 6:0:2::2") + if [ $? -ne 0 ] ; then + echo "Can not ping other machine" + ssh_vpp1 "sudo rm -r ${TMP_DIR}" + ssh_vpp2 "sudo rm -r ${TMP_DIR}" + exit -1 + fi +} + +curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:add-mapping \ + -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_ADD_CONFIG1_6}" \ + -u ${ODL_USER}:${ODL_PASSWD} +curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:add-mapping \ + -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_ADD_CONFIG2_6}" \ + -u ${ODL_USER}:${ODL_PASSWD} + +rsync -avz ${VPP_CONFIG_DIR}${VPP_CONFIG1_6} ${USER}@${VPP1_IP}:${TMP_DIR}/vpp1_6.conf +rsync -avz ${VPP_CONFIG_DIR}${VPP_CONFIG2_6} ${USER}@${VPP2_IP}:${TMP_DIR}/vpp2_6.conf + +ssh_vpp1 "sudo vpp_api_test < ${TMP_DIR}/vpp1_6.conf" +ssh_vpp2 "sudo vpp_api_test < ${TMP_DIR}/vpp2_6.conf" + +ssh_tg "sudo ip addr add 6:0:1::2/64 dev ${TG_INT1}" +ssh_tg "sudo ip link set ${TG_INT1} up" +ssh_tg "sudo ip route add 6:0:2::0/64 via 6:0:1::1 || exit 0" +ssh_tg "sudo ip netns exec net2 ip addr add 6:0:2::2/64 dev ${TG_INT2}" +ssh_tg "sudo ip netns exec net2 ip link set lo up" +ssh_tg "sudo ip netns exec net2 ip link set ${TG_INT2} up" +ssh_tg "sudo ip netns exec net2 ip route add 6:0:1::/64 via 6:0:2::1" + +ping_lisp6 + +rsync -avz ${VPP_CONFIG_DIR}${VPP_RECONF2_6} ${USER}@${VPP2_IP}:${TMP_DIR}/vpp2_reconf_6.conf + +ssh_vpp2 "sudo vpp_api_test < ${TMP_DIR}/vpp2_reconf_6.conf" + +curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:update-mapping \ + -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_REPLACE_CONFIG2_6}" \ + -u ${ODL_USER}:${ODL_PASSWD} + +ping_lisp6 diff --git a/tests/data_plane/csit_topo/lisp_test.sh b/tests/data_plane/csit_topo/lisp_test.sh new file mode 100755 index 0000000..303b6fc --- /dev/null +++ b/tests/data_plane/csit_topo/lisp_test.sh @@ -0,0 +1,112 @@ +#!/usr/bin/env bash +# +# +# +------+ +-----+ +# | | VPP1_INT TG_INT1 | | +# | VPP1 +-------------------+ TG | +# | | | | +# | | | | +# +--+---+ +--+--+ +# | VPP1_INT | TG_INT2 +# ODL_INT | | +# ODL -------| | +# | VPP2_INT | +# +--+---+ | +# | | VPP2_INT | +# | VPP2 +----------------------+ +# | | +# | | +# +------+ + +set -x + +USER="csit" +ODL_USER="admin" +ODL_PASSWD="admin" +VPP1_IP="192.168.255.101" +VPP2_IP="192.168.255.102" +TG_IP="192.168.255.100" +ODL_IP="192.168.255.10" +ODL_PORT="8181" +TMP_DIR="/tmp/vpp_${RANDOM}_lisp_test" +TG_INT1="eth2" +TG_INT2="eth3" +ODL_M_USER="user" +ODL_INT="eth2" +VPP_CONFIG_DIR="../configs/vpp_csit_config/" +VPP_CONFIG1="vpp1.conf" +VPP_CONFIG1_6="vpp1_6.conf" +VPP_CONFIG2="vpp2.conf" +VPP_CONFIG2_6="vpp2_6.conf" +VPP_RECONF2="vpp2_reconf.conf" +VPP_RECONF2_6="vpp2_reconf_6.conf" +ODL_CONFIG_DIR="../configs/odl/" +ODL_ADD_CONFIG1="add_ipv4_odl1.txt" +ODL_ADD_CONFIG1_6="add_ipv6_odl1.txt" +ODL_ADD_CONFIG2="add_ipv4_odl2.txt" +ODL_ADD_CONFIG2_6="add_ipv6_odl2.txt" +ODL_REPLACE_CONFIG2="replace_ipv4_odl2.txt" +ODL_REPLACE_CONFIG2_6="replace_ipv6_odl2.txt" + +function ssh_vpp1 { + ssh ${USER}@${VPP1_IP} ${@} || exit +} + +function ssh_vpp2 { + ssh ${USER}@${VPP2_IP} ${@} || exit +} + +function ssh_tg { + ssh ${USER}@${TG_IP} ${@} || exit +} + +function ssh_odl { + ssh ${ODL_M_USER}@${ODL_IP} ${@} || exit +} + +curl -X DELETE http://${ODL_IP}:${ODL_PORT}/restconf/config/odl-mappingservice:mapping-database/ -u ${ODL_USER}:${ODL_PASSWD} + +ssh_tg "sudo ip netns del net2 &> /dev/null || exit 0" +ssh_tg "sudo ip addr flush dev ${TG_INT1} &> /dev/null || exit 0" +ssh_tg "sudo ip route del 6.0.2.0/24 via 6.0.1.1 || exit 0" +ssh_tg "sudo ip route del 6:0:2::0/64 via 6:0:1::1 || exit 0" + +ssh_odl "sudo ip addr flush dev ${ODL_INT} &> /dev/null || exit 0" +ssh_odl "sudo ip addr add 6.0.3.100/24 dev ${ODL_INT}" +ssh_odl "sudo ip addr add 6:0:3::100/64 dev ${ODL_INT}" + +ssh_odl "sudo ethtool --offload ${ODL_INT} rx off tx off" + +ssh_vpp1 "sudo stop vpp; exit 0" +ssh_vpp2 "sudo stop vpp; exit 0" + +ssh_vpp1 "sudo start vpp; exit 0" +ssh_vpp2 "sudo start vpp; exit 0" + +ssh_vpp1 "mkdir ${TMP_DIR}" +ssh_vpp2 "mkdir ${TMP_DIR}" + +ssh_tg "sudo ip netns add net2" +ssh_tg "sudo ip link set dev ${TG_INT2} netns net2" + +if [ "$#" == 0 ] || [ "$1" == "ip4" ] ; then + source lisp_ip4.sh +fi + +if [ "$1" == "ip6" ] ; then + source lisp_ip6.sh +fi + +if [ "$1" == "all" ] ; then + source lisp_ip4.sh + source lisp_ip6.sh + + ping_lisp + ping_lisp6 +fi + +#clean tmp file +ssh_vpp1 "sudo rm -r ${TMP_DIR}" +ssh_vpp2 "sudo rm -r ${TMP_DIR}" + +echo "Success" \ No newline at end of file diff --git a/tests/data_plane/vpp_lite_topo/README b/tests/data_plane/vpp_lite_topo/README new file mode 100644 index 0000000..a7ab39e --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/README @@ -0,0 +1,15 @@ +# Test require program expect + - install expect + aptitude install expect + +Please before use, set variable VPP_LITE_BIN to your vpp_lite in file lisp_test.sh + +# example use +# Test ip4 topology +./lisp_test.sh or ./lisp_test ip4 + +# Test ip6 topology +./lisp_test ip6 + +# Test ip4 and ip6 topology +./lisp_test all diff --git a/tests/data_plane/vpp_lite_topo/lisp_ip4.sh b/tests/data_plane/vpp_lite_topo/lisp_ip4.sh new file mode 100644 index 0000000..f817a96 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/lisp_ip4.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +function ping_lisp { + sudo ip netns exec vppns1 ping -c 10 6.0.2.2 + if [ $? -ne 0 ] ; then + echo "Can not ping other machine" + exit -1 + fi +} + +sudo ip netns exec vppns1 \ + bash -c " + ip link set dev lo up + ip addr add 6.0.1.2/24 dev veth_vpp1 + ip route add 6.0.2.0/24 via 6.0.1.1 +" + +sudo ip netns exec vppns2 \ + bash -c " + ip link set dev lo up + ip addr add 6.0.2.2/24 dev veth_vpp2 + ip route add 6.0.1.0/24 via 6.0.2.1 +" + +curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:add-mapping \ + -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_ADD_CONFIG1}" \ + -u ${ODL_USER}:${ODL_PASSWD} +curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:add-mapping \ + -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_ADD_CONFIG2}" \ + -u ${ODL_USER}:${ODL_PASSWD} + +ping_lisp + +expect << EOF +spawn telnet localhost 5003 +expect -re ".*>" +send "set int ip address del host-intervpp2 6.0.3.2/24\r" +expect -re ".*>" +send "set int ip address host-intervpp2 6.0.3.20/24\r" +expect -re ".*>" +EOF + +curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:update-mapping \ + -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_REPLACE_CONFIG2}" \ + -u ${ODL_USER}:${ODL_PASSWD} + +ping_lisp diff --git a/tests/data_plane/vpp_lite_topo/lisp_ip6.sh b/tests/data_plane/vpp_lite_topo/lisp_ip6.sh new file mode 100644 index 0000000..c49ecbf --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/lisp_ip6.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +function ping_lisp6 { + sudo ip netns exec vppns1 ping6 -c 10 6:0:2::2 + if [ $? -ne 0 ] ; then + echo "Can not ping other machine" + exit -1 + fi +} + +sudo ip netns exec vppns1 \ + bash -c " + ip link set dev lo up + ip addr add 6:0:1::2/64 dev veth_vpp1 + ip route add 6:0:2::0/64 via 6:0:1::1 +" + +sudo ip netns exec vppns2 \ + bash -c " + ip link set dev lo up + ip addr add 6:0:2::2/64 dev veth_vpp2 + ip route add 6:0:1::0/64 via 6:0:2::1 +" + +curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:add-mapping \ + -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_ADD_CONFIG1_6}" \ + -u ${ODL_USER}:${ODL_PASSWD} +curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:add-mapping \ + -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_ADD_CONFIG2_6}" \ + -u ${ODL_USER}:${ODL_PASSWD} + +ping_lisp6 + +expect << EOF +spawn telnet localhost 5003 +expect -re ".*>" +send "set int ip address del host-intervpp2 6:0:3::2/64\r" +expect -re ".*>" +send "set int ip address host-intervpp2 6:0:3::20/64\r" +expect -re ".*>" +EOF + +curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:update-mapping \ + -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_REPLACE_CONFIG2_6}" \ + -u ${ODL_USER}:${ODL_PASSWD} + +ping_lisp6 diff --git a/tests/data_plane/vpp_lite_topo/lisp_test.sh b/tests/data_plane/vpp_lite_topo/lisp_test.sh new file mode 100755 index 0000000..9d33283 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/lisp_test.sh @@ -0,0 +1,122 @@ +#!/usr/bin/env bash + +set -x + +# path to vpp executable and configurations folder +# VPP_LITE_BIN=/vpp/build-root/install-vpp_lite_debug-native/vpp/bin/vpp +VPP_LITE_BIN=/home/csit/lisp_vpp/build-root/install-vpp_lite_debug-native/vpp/bin/vpp +VPP_LITE_CONF=`pwd`"/../configs/vpp_lite_config/" +VPP1_CONF="vpp1.conf" +VPP2_CONF="vpp2.conf" +ODL_CONFIG_DIR="../configs/odl/" +ODL_ADD_CONFIG1="add_ipv4_odl1.txt" +ODL_ADD_CONFIG1_6="add_ipv6_odl1.txt" +ODL_ADD_CONFIG2="add_ipv4_odl2.txt" +ODL_ADD_CONFIG2_6="add_ipv6_odl2.txt" +ODL_REPLACE_CONFIG2="replace_ipv4_odl2.txt" +ODL_REPLACE_CONFIG2_6="replace_ipv6_odl2.txt" + +ODL_USER="admin" +ODL_PASSWD="admin" +ODL_IP="127.0.0.1" +ODL_PORT="8181" + +# make sure there are no vpp instances running +sudo pkill vpp + +# delete previous incarnations if they exist +sudo ip netns exec intervppns ifconfig vppbr down +sudo ip netns exec intervppns brctl delbr vppbr +sudo ip link del dev veth_vpp1 &> /dev/null +sudo ip link del dev veth_vpp2 &> /dev/null +sudo ip link del dev veth_intervpp1 &> /dev/null +sudo ip link del dev veth_intervpp2 &> /dev/null +sudo ip link del dev veth_odl &> /dev/null +sudo ip netns del vppns1 &> /dev/null +sudo ip netns del vppns2 &> /dev/null +sudo ip netns del intervppns &> /dev/null + +if [ "$1" == "clean" ] ; then + exit 0; +fi + +# create vpp to clients and inter-vpp namespaces +sudo ip netns add vppns1 +sudo ip netns add vppns2 +sudo ip netns add intervppns + +# create vpp and odl interfaces and set them in intervppns +sudo ip link add veth_intervpp1 type veth peer name intervpp1 +sudo ip link add veth_intervpp2 type veth peer name intervpp2 +sudo ip link add veth_odl type veth peer name odl +sudo ip link set dev intervpp1 up +sudo ip link set dev intervpp2 up +sudo ip link set dev odl up +sudo ip link set dev veth_intervpp1 up netns intervppns +sudo ip link set dev veth_intervpp2 up netns intervppns +sudo ip link set dev veth_odl up netns intervppns + +# create bridge in intervppns and add vpp and odl interfaces +sudo ip netns exec intervppns brctl addbr vppbr +sudo ip netns exec intervppns brctl addif vppbr veth_intervpp1 +sudo ip netns exec intervppns brctl addif vppbr veth_intervpp2 +sudo ip netns exec intervppns brctl addif vppbr veth_odl +sudo ip netns exec intervppns ifconfig vppbr up + +# create and configure 1st veth client to vpp pair +sudo ip link add veth_vpp1 type veth peer name vpp1 +sudo ip link set dev vpp1 up +sudo ip link set dev veth_vpp1 up netns vppns1 + +# create and configure 2nd veth client to vpp pair +sudo ip link add veth_vpp2 type veth peer name vpp2 +sudo ip link set dev vpp2 up +sudo ip link set dev veth_vpp2 up netns vppns2 + +# set odl iface ip and disable checksum offloading +sudo ip addr add 6.0.3.100/24 dev odl +sudo ip addr add 6:0:3::100/64 dev odl +sudo ethtool --offload odl rx off tx off + +if [ "$1" == "ip6" ] ; then + VPP1_CONF="vpp1_6.conf" + VPP2_CONF="vpp2_6.conf" +fi + +if [ "$1" == "all" ] ; then + VPP1_CONF="vpp1_ip4_6.conf" + VPP2_CONF="vpp2_ip4_6.conf" +fi + +# start vpp1 and vpp2 in separate chroot +sudo $VPP_LITE_BIN \ + unix { log /tmp/vpp1.log cli-listen \ + localhost:5002 full-coredump \ + exec $VPP_LITE_CONF/${VPP1_CONF} } \ + api-trace { on } chroot {prefix xtr1} + +sudo $VPP_LITE_BIN \ + unix { log /tmp/vpp2.log cli-listen \ + localhost:5003 full-coredump \ + exec $VPP_LITE_CONF/${VPP2_CONF}} \ + api-trace { on } chroot {prefix xtr2} + + +if [ "$#" == 0 ] || [ "$1" == "ip4" ] ; then + source lisp_ip4.sh +fi + +if [ "$1" == "ip6" ] ; then + source lisp_ip6.sh +fi + +if [ "$1" == "all" ] ; then + source lisp_ip4.sh + source lisp_ip6.sh + + ping_lisp + ping_lisp6 +fi + +echo "Success" + -- cgit 1.2.3-korg