diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2018-04-30 09:03:13 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2018-05-02 09:55:56 +0000 |
commit | 30b088af1c187d7d3abd65030089c2a56f5cf95b (patch) | |
tree | ee427c54a6885d644c69a300407445fefff24628 /examples | |
parent | 4b8bef208fc37b09008e3333db9d262d56b94192 (diff) |
Move docker files to examples directory
Change-Id: Ib2eb3dbae76a1e9b5d98ce9e0d5eea9adba280cf
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
(cherry picked from commit e4c58493ce5265ea0d1e17d160c339401c406186)
Diffstat (limited to 'examples')
35 files changed, 1806 insertions, 0 deletions
diff --git a/examples/docker/Dockerfile b/examples/docker/Dockerfile new file mode 100755 index 000000000..2decc50c2 --- /dev/null +++ b/examples/docker/Dockerfile @@ -0,0 +1,26 @@ +FROM ubuntu:16.04 + +WORKDIR /hc2vpp + +ADD . /hc2vpp + +RUN apt-get update && apt-get install -y \ + # Utils + iproute2 iputils-ping net-tools vim-tiny jshon telnet \ + # VPP package dependencies + libnuma1 libssl1.0.0 libmbedcrypto0 libmbedtls10 libmbedx509-0 \ + # Honeycomb package dependencies + openjdk-8-jre-headless \ + +# Install packages +&& dpkg -i packages/vpp-lib_*.deb \ +&& dpkg -i packages/vpp_*.deb \ +&& dpkg -i packages/vpp-plugins_*.deb \ +&& dpkg -i packages/honeycomb_*.deb \ + +# Disable DPDK for PCI devices +&& echo "dpdk {\n no-pci\n}" >> /etc/vpp/startup.conf \ + +# Reduce image size +&& rm -rf /var/lib/apt/lists/* `# clear apt cache` \ +&& rm -rf packages diff --git a/examples/docker/Readme.txt b/examples/docker/Readme.txt new file mode 100644 index 000000000..9022befe5 --- /dev/null +++ b/examples/docker/Readme.txt @@ -0,0 +1,18 @@ +HC2VPP Docker image building&testing instructions +--------------------------------------------------- + +1) Copy vpp and hc2vpp packages to docker/packages dir + +2) Build hc2vpp image +./create_image.sh + +3) Create & start container +./start_hc2vpp_container.sh vpp1 + +4) Start vpp & honeycomb +docker exec -it vpp1 bash +./vpp/start.sh +./honeycomb/start.sh + +5) Test +./test/show_interfaces_state.sh vpp1 diff --git a/examples/docker/bgp_demo/Readme.txt b/examples/docker/bgp_demo/Readme.txt new file mode 100644 index 000000000..896a6f7c8 --- /dev/null +++ b/examples/docker/bgp_demo/Readme.txt @@ -0,0 +1,42 @@ +BGP demo +--------------------------------------------------- + +Provides examples of BGP config using Honeycomb +two VPP nodes (docker containers). + +Configuration was tested using VPP 18.01 and hc2vpp 1.18.01. + +1) Create & start containers (requires hc2vpp image) +sudo ./build_topology.sh + +3) Run vpp and honeycomb with preconfigured veth interfaces + +Either manually connect +docker exec -it vpp1 bash +docker exec -it vpp2 bash + +and then run vpp and honeycomb on vpp1 and vpp2 respectively: +/hc2vpp/mpls_demo/init/vpp.sh 1 +/hc2vpp/mpls_demo/init/vpp.sh 2 + +or run everything via script (uses xfce4-terminal): +./run_terminals.sh + +After vpp and honeycomb stars, +you should be able to ping vpp2 from vpp1. + +Either using vppctl: +vppctl ping 10.12.1.2 + +or directly (we are using tuntap): +ping 10.12.1.2 + +4) Use postman_collection.json for BGP configuration examples + +First configure loop0 interface on vpp2. + +Then configure eBGP peers on vpp1 and vpp2 +and program route to loop0 using application peer from vpp2. + +Now loop0 is reachable from vpp1: +vppctl ping 10.100.1.1 diff --git a/examples/docker/bgp_demo/build_topology.sh b/examples/docker/bgp_demo/build_topology.sh new file mode 100755 index 000000000..c532916a3 --- /dev/null +++ b/examples/docker/bgp_demo/build_topology.sh @@ -0,0 +1,27 @@ +#!/bin/bash +source ../utils.sh + +if [[ $UID != 0 ]]; then + echo "Please run this script with sudo:" + echo "sudo $0 $*" + exit 1 +fi + +# Cleanup +../remove_hc2vpp_containers.sh + +# Create directory for storing network namespaces +mkdir -p /var/run/netns + +# Build topology +# +# vpp1 – vpp2 +# +create_container vpp1 hc2vpp +create_container vpp2 hc2vpp + +start_container vpp1 +start_container vpp2 + +# Connect containers using veth interfaces +create_link vpp1 veth12 veth21 vpp2 diff --git a/examples/docker/bgp_demo/init/init.sh b/examples/docker/bgp_demo/init/init.sh new file mode 100755 index 000000000..8ed4cd25c --- /dev/null +++ b/examples/docker/bgp_demo/init/init.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# Starts and initializes vpp. +# Then starts honeycomb +# + +NODE_ID=$1 +NODE_NAME=vpp$1 + +echo "Enable tuntap interface in startup.conf" +echo -e "tuntap {\n enable\n}\n" >> /etc/vpp/startup.conf + +/hc2vpp/vpp/start.sh & VPP_PID=$! +echo "Waiting 5s for vpp to start" +sleep 5 +VPP_VERSION=$(vppctl show version) +if [ "${VPP_VERSION}" != "" ] +then + echo "VPP started successfully. Version:" + echo "${VPP_VERSION}" +else + echo "VPP failed to start. Stopping initialization script." + exit 1 +fi + +# Configure veth interfaces using VPP CLI +# (not fully supported by hc2vpp 18.01) +echo "Configuring vpp" +vppctl exec /hc2vpp/bgp_demo/init/$NODE_NAME.cmd + +# Update address of interface BGP is listening on +IP="10.12.1.${NODE_ID}" +jshon -s $IP -i "bgp-binding-address" -I -F /opt/honeycomb/config/bgp.json + +# Set AS number +AS_NUMBER=$((65000+NODE_ID)) +jshon -n $AS_NUMBER -i "bgp-as-number" -I -F /opt/honeycomb/config/bgp.json + +# Update module configuration +# Enables BGP and disables some of the modules not used in the example +cp /hc2vpp/bgp_demo/init/*-module-config /opt/honeycomb/modules + +echo "Starting honeycomb" +/hc2vpp/honeycomb/start.sh diff --git a/examples/docker/bgp_demo/init/io-fd-hc2vpp-integration_vpp-integration-distribution_1-18-01-SNAPSHOT-module-config b/examples/docker/bgp_demo/init/io-fd-hc2vpp-integration_vpp-integration-distribution_1-18-01-SNAPSHOT-module-config new file mode 100644 index 000000000..f236d4eab --- /dev/null +++ b/examples/docker/bgp_demo/init/io-fd-hc2vpp-integration_vpp-integration-distribution_1-18-01-SNAPSHOT-module-config @@ -0,0 +1,27 @@ +// This is list of hc2vpp modules based on configuration file from /opt/honeycomb/modules +// +// BGP modules (disabled by default) were enabled. +// Modules not used in the demo were disabled to reduce footprint. +// +io.fd.hc2vpp.common.integration.VppCommonModule +io.fd.hc2vpp.management.VppManagementModule +// io.fd.hc2vpp.lisp.LispModule +// io.fd.hc2vpp.lisp.gpe.GpeModule +io.fd.hc2vpp.v3po.V3poModule +// io.fd.hc2vpp.iface.role.InterfaceRoleModule +io.fd.hc2vpp.l3.InterfaceL3Module +io.fd.hc2vpp.l3.SubInterfaceL3Module +// io.fd.hc2vpp.l3.ProxyArpModule +io.fd.hc2vpp.vpp.classifier.VppClassifierModule +// io.fd.hc2vpp.vpp.classifier.InterfaceClassifierAclModule +// io.fd.hc2vpp.vpp.classifier.SubInterfaceClassifierAclModule +// io.fd.hc2vpp.nat.NatModule +io.fd.hc2vpp.routing.RoutingModule +// io.fd.hc2vpp.acl.AclModule +// io.fd.hc2vpp.dhcp.DhcpModule +// io.fd.hc2vpp.policer.PolicerModule +io.fd.hc2vpp.mpls.MplsModule +// io.fd.hc2vpp.vppnsh.impl.VppNshModule +// io.fd.hc2vpp.vppioam.impl.VppIoamModule +io.fd.hc2vpp.bgp.inet.BgpInetModule +io.fd.hc2vpp.bgp.prefix.sid.BgpPrefixSidModule
\ No newline at end of file diff --git a/examples/docker/bgp_demo/init/io-fd-honeycomb_minimal-distribution_1-18-01-SNAPSHOT-module-config b/examples/docker/bgp_demo/init/io-fd-honeycomb_minimal-distribution_1-18-01-SNAPSHOT-module-config new file mode 100644 index 000000000..476a1a1a5 --- /dev/null +++ b/examples/docker/bgp_demo/init/io-fd-honeycomb_minimal-distribution_1-18-01-SNAPSHOT-module-config @@ -0,0 +1,24 @@ +// This is list of honeycomb modules based on configuration file from /opt/honeycomb/modules +// +// BGP modules (disabled by default) used in the demo were enabled. +// +io.fd.honeycomb.infra.distro.schema.YangBindingProviderModule +io.fd.honeycomb.infra.distro.schema.SchemaModule +io.fd.honeycomb.infra.distro.data.ConfigAndOperationalPipelineModule +io.fd.honeycomb.infra.distro.data.context.ContextPipelineModule +io.fd.honeycomb.infra.distro.initializer.InitializerPipelineModule +io.fd.honeycomb.northbound.CredentialsModule +io.fd.honeycomb.northbound.netconf.NetconfModule +io.fd.honeycomb.northbound.netconf.NetconfReadersModule +io.fd.honeycomb.northbound.restconf.RestconfModule +io.fd.honeycomb.infra.distro.cfgattrs.CfgAttrsModule +io.fd.honeycomb.infra.bgp.BgpModule +io.fd.honeycomb.infra.bgp.BgpReadersModule +io.fd.honeycomb.infra.bgp.BgpWritersModule +// io.fd.honeycomb.northbound.bgp.extension.EvpnModule +io.fd.honeycomb.northbound.bgp.extension.InetModule +// io.fd.honeycomb.northbound.bgp.extension.L3VpnV4Module +// io.fd.honeycomb.northbound.bgp.extension.L3VpnV6Module +io.fd.honeycomb.northbound.bgp.extension.LabeledUnicastModule +// io.fd.honeycomb.northbound.bgp.extension.LinkstateModule +// io.fd.honeycomb.footprint.FootprintModule
\ No newline at end of file diff --git a/examples/docker/bgp_demo/init/vpp1.cmd b/examples/docker/bgp_demo/init/vpp1.cmd new file mode 100644 index 000000000..5760f167b --- /dev/null +++ b/examples/docker/bgp_demo/init/vpp1.cmd @@ -0,0 +1,4 @@ +create host-interface name veth12 +set int state host-veth12 up +set int ip address host-veth12 10.12.1.1/24 +set interface unnumbered tuntap-0 use host-veth12 diff --git a/examples/docker/bgp_demo/init/vpp2.cmd b/examples/docker/bgp_demo/init/vpp2.cmd new file mode 100644 index 000000000..07f2005e0 --- /dev/null +++ b/examples/docker/bgp_demo/init/vpp2.cmd @@ -0,0 +1,4 @@ +create host-interface name veth21 +set int state host-veth21 up +set int ip address host-veth21 10.12.1.2/24 +set interface unnumbered tuntap-0 use host-veth21 diff --git a/examples/docker/bgp_demo/postman_collection.json b/examples/docker/bgp_demo/postman_collection.json new file mode 100644 index 000000000..545a9d78c --- /dev/null +++ b/examples/docker/bgp_demo/postman_collection.json @@ -0,0 +1,299 @@ +{ + "id": "c632c61d-2681-b9ea-23b7-124a1f228e46", + "name": "Hc2vpp2 BGP configuration examples", + "description": "Examples of BGP configration based on \nhttp://docs.opendaylight.org/en/stable-boron/user-guide/bgp-user-guide.html", + "order": [], + "folders": [ + { + "id": "87048983-134d-ae10-16a1-c28b3e6cfe67", + "name": "vpp1", + "description": "", + "order": [ + "1af04e52-88fe-eda0-c175-203d6cdd6ea8", + "6c8a9854-1eec-bdcd-2a7e-fb2dadd79f1d", + "33d6cc8b-80d7-4493-ab29-a5d4df4f9709", + "fc913f70-aaa5-fed6-fe00-dc93ed59ffb2", + "36627e62-925f-3de7-7943-d10402ceb160" + ], + "owner": 0 + }, + { + "id": "f294a1aa-4a81-0271-3d70-db7627278200", + "name": "vpp2", + "description": "", + "order": [ + "e5d0baab-866f-4327-8c45-53587edb8e42", + "6dd77ec0-b213-adcc-9456-6e27b6455496", + "e3954b49-2f90-4868-a388-2c58b7951afe", + "79912b82-12fb-9210-6257-bbf0f4c05a7e", + "2026a32e-3f9e-3da4-1e68-6a659d91b557", + "b7339b36-1c6a-bad6-707a-cc010e5d8e7d", + "53b4f9f5-54e6-cd98-cec5-ad925d6c561d", + "90d5c0b1-572b-924e-2ccb-e5cd61b8e1e0" + ], + "owner": 0, + "collectionId": "c632c61d-2681-b9ea-23b7-124a1f228e46" + } + ], + "timestamp": 1515051953592, + "owner": 0, + "public": false, + "requests": [ + { + "id": "1af04e52-88fe-eda0-c175-203d6cdd6ea8", + "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n", + "url": "https://172.17.0.2:8445/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/hc-bgp-instance/bgp/bgp-openconfig-extensions:neighbors/neighbor/10.12.1.2", + "preRequestScript": null, + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1515414858820, + "name": "Add eBGP peer configured on vpp2", + "description": "Based on http://docs.opendaylight.org/en/stable-nitrogen/user-guide/bgp-user-guide.html#external-peering-configuration", + "collectionId": "c632c61d-2681-b9ea-23b7-124a1f228e46", + "responses": [], + "rawModeData": "{\n \"neighbor\": {\n \"neighbor-address\": \"10.12.1.2\",\n \"timers\": {\n \"config\": {\n \"hold-time\": 90,\n \"connect-retry\": 10\n }\n },\n \"config\": {\n \"peer-type\": \"EXTERNAL\",\n \"peer-as\": \"65002\"\n },\n \"transport\": {\n \"config\": {\n \"remote-port\": 1790,\n \"passive-mode\": true\n }\n },\n \"afi-safis\": {\n \"afi-safi\": [\n {\n \"afi-safi-name\": \"openconfig-bgp-types:IPV4-UNICAST\",\n \"receive\": true,\n \"send-max\": 0\n },\n {\n \"afi-safi-name\": \"openconfig-bgp-types:IPV4-LABELLED-UNICAST\",\n \"receive\": true,\n \"send-max\": 0\n }\n ]\n }\n }\n}" + }, + { + "id": "2026a32e-3f9e-3da4-1e68-6a659d91b557", + "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n", + "url": "https://172.17.0.3:8445/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/hc-bgp-instance/bgp/bgp-openconfig-extensions:neighbors/neighbor/10.25.1.9", + "preRequestScript": null, + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1515415282689, + "name": "Add application peer", + "description": "", + "collectionId": "c632c61d-2681-b9ea-23b7-124a1f228e46", + "responses": [], + "rawModeData": "{\n \"neighbor\": {\n \"neighbor-address\": \"10.25.1.9\",\n \"config\": {\n \"peer-group\": \"application-peers\"\n },\n \"afi-safis\": {\n \"afi-safi\": [\n {\n \"afi-safi-name\": \"openconfig-bgp-types:IPV4-UNICAST\",\n \"receive\": true,\n \"send-max\": 0\n },\n {\n \"afi-safi-name\": \"openconfig-bgp-types:IPV4-LABELLED-UNICAST\",\n \"receive\": true,\n \"send-max\": 0\n }\n ]\n }\n }\n}" + }, + { + "id": "33d6cc8b-80d7-4493-ab29-a5d4df4f9709", + "headers": "Content-Type: application/xml\nAuthorization: Basic YWRtaW46YWRtaW4=\n", + "url": "https://172.17.0.2:8445/restconf/operational/bgp-rib:bgp-rib/rib/hc-bgp-instance/loc-rib", + "pathVariables": {}, + "preRequestScript": null, + "method": "GET", + "collectionId": "c632c61d-2681-b9ea-23b7-124a1f228e46", + "data": [], + "dataMode": "raw", + "name": "Show Loc-RIB of vpp1", + "description": "", + "descriptionFormat": "html", + "time": 1515415010644, + "version": 2, + "responses": [], + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "folder": "87048983-134d-ae10-16a1-c28b3e6cfe67", + "rawModeData": "<neighbor xmlns=\"urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions\">\n <neighbor-address>10.25.1.9</neighbor-address>\n <config>\n <peer-group>application-peers</peer-group>\n </config>\n</neighbor>" + }, + { + "id": "36627e62-925f-3de7-7943-d10402ceb160", + "headers": "Content-Type: application/xml\nAuthorization: Basic YWRtaW46YWRtaW4=\n", + "url": "https://172.17.0.2:8445/restconf/operational/bgp-rib:bgp-rib/rib/hc-bgp-instance", + "preRequestScript": null, + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1515417781413, + "name": "Show HC BGP state on vpp1", + "description": "", + "collectionId": "c632c61d-2681-b9ea-23b7-124a1f228e46", + "rawModeData": "<neighbor xmlns=\"urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions\">\n <neighbor-address>192.0.2.1</neighbor-address>\n <timers>\n <config>\n <hold-time>90</hold-time>\n <connect-retry>10</connect-retry>\n </config>\n </timers>\n <transport>\n <config>\n <remote-port>179</remote-port>\n <passive-mode>false</passive-mode>\n </config>\n </transport>\n <config>\n <peer-type>INTERNAL</peer-type>\n </config>\n</neighbor>" + }, + { + "id": "53b4f9f5-54e6-cd98-cec5-ad925d6c561d", + "headers": "Content-Type: application/xml\nAuthorization: Basic YWRtaW46YWRtaW4=\n", + "url": "https://172.17.0.3:8445/restconf/config/openconfig-network-instance:network-instances/", + "preRequestScript": null, + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1515417814797, + "name": "Show BGP configuration on vpp2", + "description": "", + "collectionId": "c632c61d-2681-b9ea-23b7-124a1f228e46", + "responses": [], + "rawModeData": "<neighbor xmlns=\"urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions\">\n <neighbor-address>192.0.2.1</neighbor-address>\n <timers>\n <config>\n <hold-time>90</hold-time>\n <connect-retry>10</connect-retry>\n </config>\n </timers>\n <transport>\n <config>\n <remote-port>179</remote-port>\n <passive-mode>false</passive-mode>\n </config>\n </transport>\n <config>\n <peer-type>INTERNAL</peer-type>\n </config>\n</neighbor>" + }, + { + "id": "6c8a9854-1eec-bdcd-2a7e-fb2dadd79f1d", + "headers": "Content-Type: application/xml\nAuthorization: Basic YWRtaW46YWRtaW4=\n", + "url": "https://172.17.0.2:8445/restconf/operational/bgp-rib:bgp-rib/rib/hc-bgp-instance/peer/bgp:%2F%2F10.12.1.2", + "preRequestScript": null, + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1515414946071, + "name": "Show vpp2 peer state", + "description": "", + "collectionId": "c632c61d-2681-b9ea-23b7-124a1f228e46", + "responses": [], + "rawModeData": "<neighbor xmlns=\"urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions\">\n <neighbor-address>192.0.2.1</neighbor-address>\n <timers>\n <config>\n <hold-time>90</hold-time>\n <connect-retry>10</connect-retry>\n </config>\n </timers>\n <transport>\n <config>\n <remote-port>179</remote-port>\n <passive-mode>false</passive-mode>\n </config>\n </transport>\n <config>\n <peer-type>INTERNAL</peer-type>\n </config>\n</neighbor>" + }, + { + "id": "6dd77ec0-b213-adcc-9456-6e27b6455496", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.3:8445/restconf/operational/ietf-interfaces:interfaces-state/interface/loop0", + "preRequestScript": "", + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1515419116647, + "name": "Show loop0 state", + "description": "", + "collectionId": "c632c61d-2681-b9ea-23b7-124a1f228e46", + "responses": [], + "rawModeData": "{\n \"interface\": [\n {\n \"name\": \"loop0\",\n \"enabled\": true,\n \"type\": \"v3po:loopback\",\n \"ietf-ip:ipv4\": {\n \"address\": [\n {\n \"ip\": \"10.100.1.1\",\n \"prefix-length\": 24\n }\n ]\n },\n \"v3po:ethernet\": {\n \"mtu\": 9216\n }\n }\n ]\n}" + }, + { + "id": "79912b82-12fb-9210-6257-bbf0f4c05a7e", + "headers": "Content-Type: application/xml\nAuthorization: Basic YWRtaW46YWRtaW4=\n", + "url": "https://172.17.0.3:8445/restconf/operational/bgp-rib:bgp-rib/rib/hc-bgp-instance/peer/bgp:%2F%2F10.12.1.1", + "preRequestScript": null, + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1515414975231, + "name": "Show vpp1 peer state", + "description": "", + "collectionId": "c632c61d-2681-b9ea-23b7-124a1f228e46", + "responses": [], + "rawModeData": "<neighbor xmlns=\"urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions\">\n <neighbor-address>192.0.2.1</neighbor-address>\n <timers>\n <config>\n <hold-time>90</hold-time>\n <connect-retry>10</connect-retry>\n </config>\n </timers>\n <transport>\n <config>\n <remote-port>179</remote-port>\n <passive-mode>false</passive-mode>\n </config>\n </transport>\n <config>\n <peer-type>INTERNAL</peer-type>\n </config>\n</neighbor>" + }, + { + "id": "90d5c0b1-572b-924e-2ccb-e5cd61b8e1e0", + "headers": "Content-Type: application/xml\nAuthorization: Basic YWRtaW46YWRtaW4=\n", + "url": "https://172.17.0.3:8445/restconf/operational/bgp-rib:bgp-rib/rib/hc-bgp-instance", + "preRequestScript": null, + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1515417838727, + "name": "Show HC BGP state on vpp2", + "description": "", + "collectionId": "c632c61d-2681-b9ea-23b7-124a1f228e46", + "rawModeData": "<neighbor xmlns=\"urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions\">\n <neighbor-address>192.0.2.1</neighbor-address>\n <timers>\n <config>\n <hold-time>90</hold-time>\n <connect-retry>10</connect-retry>\n </config>\n </timers>\n <transport>\n <config>\n <remote-port>179</remote-port>\n <passive-mode>false</passive-mode>\n </config>\n </transport>\n <config>\n <peer-type>INTERNAL</peer-type>\n </config>\n</neighbor>" + }, + { + "id": "b7339b36-1c6a-bad6-707a-cc010e5d8e7d", + "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n", + "url": "https://172.17.0.3:8445/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/bgp-inet:ipv4-routes/ipv4-route/10.100.1.1%2F24/0", + "preRequestScript": null, + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1515419061792, + "name": "Announce route to loop0", + "description": "", + "collectionId": "c632c61d-2681-b9ea-23b7-124a1f228e46", + "responses": [], + "rawModeData": "{\n \"bgp-inet:ipv4-route\": [\n {\n \"prefix\": \"10.100.1.1/24\",\n \"path-id\": 0,\n \"attributes\": {\n \"origin\": {\n \"value\": \"igp\"\n },\n \"as-path\": {},\n \"local-pref\": {\n \"pref\": 100\n },\n \"ipv4-next-hop\": {\n \"global\": \"10.12.1.2\"\n }\n }\n }\n ]\n}" + }, + { + "id": "e3954b49-2f90-4868-a388-2c58b7951afe", + "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n", + "url": "https://172.17.0.3:8445/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/hc-bgp-instance/bgp/bgp-openconfig-extensions:neighbors/neighbor/10.12.1.1", + "preRequestScript": null, + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1515414866281, + "name": "Add eBGP peer configured on vpp1", + "description": "Based on http://docs.opendaylight.org/en/stable-nitrogen/user-guide/bgp-user-guide.html#external-peering-configuration", + "collectionId": "c632c61d-2681-b9ea-23b7-124a1f228e46", + "responses": [], + "rawModeData": "{\n \"neighbor\": {\n \"neighbor-address\": \"10.12.1.1\",\n \"timers\": {\n \"config\": {\n \"hold-time\": 90,\n \"connect-retry\": 10\n }\n },\n \"config\": {\n \"peer-type\": \"EXTERNAL\",\n \"peer-as\": \"65001\"\n },\n \"transport\": {\n \"config\": {\n \"remote-port\": 1790,\n \"passive-mode\": false\n }\n },\n \"afi-safis\": {\n \"afi-safi\": [\n {\n \"afi-safi-name\": \"openconfig-bgp-types:IPV4-UNICAST\",\n \"receive\": true,\n \"send-max\": 0\n },\n {\n \"afi-safi-name\": \"openconfig-bgp-types:IPV4-LABELLED-UNICAST\",\n \"receive\": true,\n \"send-max\": 0\n }\n ]\n }\n }\n}" + }, + { + "id": "e5d0baab-866f-4327-8c45-53587edb8e42", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.3:8445/restconf/config/ietf-interfaces:interfaces/interface/loop0", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1515420990010, + "name": "Configure loop0", + "description": "", + "collectionId": "c632c61d-2681-b9ea-23b7-124a1f228e46", + "responses": [], + "rawModeData": "{\n \"interface\": [\n {\n \"name\": \"loop0\",\n \"enabled\": true,\n \"type\": \"v3po:loopback\",\n \"ietf-ip:ipv4\": {\n \"address\": [\n {\n \"ip\": \"10.100.1.1\",\n \"prefix-length\": 24\n }\n ]\n },\n \"loopback\": {\n \"mac\" : \"aa:bb:cc:dd:ee:ff\"\n }\n }\n ]\n}" + }, + { + "id": "fc913f70-aaa5-fed6-fe00-dc93ed59ffb2", + "headers": "Content-Type: application/xml\nAuthorization: Basic YWRtaW46YWRtaW4=\n", + "url": "https://172.17.0.2:8445/restconf/config/openconfig-network-instance:network-instances/", + "pathVariables": {}, + "preRequestScript": null, + "method": "GET", + "collectionId": "c632c61d-2681-b9ea-23b7-124a1f228e46", + "data": [], + "dataMode": "raw", + "name": "Show BGP configuration on vpp1", + "description": "", + "descriptionFormat": "html", + "time": 1515415028428, + "version": 2, + "responses": [], + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "folder": "87048983-134d-ae10-16a1-c28b3e6cfe67", + "rawModeData": "<neighbor xmlns=\"urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions\">\n <neighbor-address>192.0.2.1</neighbor-address>\n <timers>\n <config>\n <hold-time>90</hold-time>\n <connect-retry>10</connect-retry>\n </config>\n </timers>\n <transport>\n <config>\n <remote-port>179</remote-port>\n <passive-mode>false</passive-mode>\n </config>\n </transport>\n <config>\n <peer-type>INTERNAL</peer-type>\n </config>\n</neighbor>" + } + ] +}
\ No newline at end of file diff --git a/examples/docker/bgp_demo/run_terminals.sh b/examples/docker/bgp_demo/run_terminals.sh new file mode 100755 index 000000000..e2f7e3e12 --- /dev/null +++ b/examples/docker/bgp_demo/run_terminals.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Opens connections to hc2vpp containers + +xfce4-terminal --title=vpp1 --command="docker exec -it vpp1 \ + bash -c '/hc2vpp/bgp_demo/init/init.sh 1; exec $SHELL'" + +xfce4-terminal --title=vpp2 --command="docker exec -it vpp2 \ + bash -c '/hc2vpp/bgp_demo/init/init.sh 2; exec $SHELL'" diff --git a/examples/docker/copy_packages.sh b/examples/docker/copy_packages.sh new file mode 100755 index 000000000..555907efb --- /dev/null +++ b/examples/docker/copy_packages.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +rm packages/*.deb + +# Copies locally-built vpp and hc2vpp packages +cp ~/vpp/build-root/*.deb ../packaging/deb/xenial/*.deb packages/
\ No newline at end of file diff --git a/examples/docker/create_image.sh b/examples/docker/create_image.sh new file mode 100755 index 000000000..e00a48cd6 --- /dev/null +++ b/examples/docker/create_image.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# Build docker image with vpp and hc2vpp installed +docker build -t hc2vpp -f Dockerfile . diff --git a/examples/docker/honeycomb/kill.sh b/examples/docker/honeycomb/kill.sh new file mode 100755 index 000000000..5d6d40bcb --- /dev/null +++ b/examples/docker/honeycomb/kill.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +/opt/honeycomb/honeycomb-kill diff --git a/examples/docker/honeycomb/start.sh b/examples/docker/honeycomb/start.sh new file mode 100755 index 000000000..3aca79dd8 --- /dev/null +++ b/examples/docker/honeycomb/start.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# Start honeycomb in background +/opt/honeycomb/honeycomb-start diff --git a/examples/docker/mpls_demo/Readme.txt b/examples/docker/mpls_demo/Readme.txt new file mode 100644 index 000000000..b78a8dc88 --- /dev/null +++ b/examples/docker/mpls_demo/Readme.txt @@ -0,0 +1,36 @@ +MPLS SR demo +--------------------------------------------------- + +Provides examples of MPLS SR config using Honeycomb +for the following topology: + + A + / + vpp1 – vpp2 – vpp4 + \ // \ + –– vpp3 –– B + +Each vpp node represents docker container +with honeycomb running. + +A and B represent egrees nodes modeled using tap interfaces. + +1) Create & start containers (requires hc2vpp image) +sudo ./build_topology.sh + +3) Run vpp and honeycomb with preconfigured veth interfaces + +Either manually connect +docker exec -it vpp1 bash +docker exec -it vpp2 bash +... + +and then run vpp and honeycomb: +/hc2vpp/mpls_demo/init/vpp.sh vpp1 +/hc2vpp/mpls_demo/init/vpp.sh vpp2 +... + +or run everything via script (uses xfce4-terminal): +./run_terminals.sh + +4) Use postman_collection.json for MPLS configuration examples diff --git a/examples/docker/mpls_demo/build_topology.sh b/examples/docker/mpls_demo/build_topology.sh new file mode 100755 index 000000000..5764ebf1b --- /dev/null +++ b/examples/docker/mpls_demo/build_topology.sh @@ -0,0 +1,37 @@ +#!/bin/bash +source ../utils.sh + +if [[ $UID != 0 ]]; then + echo "Please run this script with sudo:" + echo "sudo $0 $*" + exit 1 +fi + +# Cleanup +../remove_hc2vpp_containers.sh + +# Create directory for storing network namespaces +mkdir -p /var/run/netns + +# Build topology +# +# vpp1 – vpp2 – vpp4 +# \ // +# –– vpp3 –– +# +create_container vpp1 hc2vpp +create_container vpp2 hc2vpp +create_container vpp3 hc2vpp +create_container vpp4 hc2vpp + +start_container vpp1 +start_container vpp2 +start_container vpp3 +start_container vpp4 + +# Connect containers using veth interfaces +create_link vpp1 veth12 veth21 vpp2 +create_link vpp1 veth13 veth31 vpp3 +create_link vpp2 veth24 veth42 vpp4 +create_link vpp3 veth341 veth431 vpp4 +create_link vpp3 veth342 veth432 vpp4 diff --git a/examples/docker/mpls_demo/init/vpp.sh b/examples/docker/mpls_demo/init/vpp.sh new file mode 100755 index 000000000..f12cb0a32 --- /dev/null +++ b/examples/docker/mpls_demo/init/vpp.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Starts and initializes vpp. +# Then starts honeycomb +# +# $1 - node name +# + +/hc2vpp/vpp/start.sh +echo "Waiting for vpp to start" +sleep 5 + +# Configure veth interfaces +# (not yet fully supported by honeycomb) +echo "Configuring vpp" +vppctl exec /hc2vpp/mpls_demo/init/$1.cmd + +echo "Starting honeycomb" +/hc2vpp/honeycomb/start.sh diff --git a/examples/docker/mpls_demo/init/vpp1.cmd b/examples/docker/mpls_demo/init/vpp1.cmd new file mode 100644 index 000000000..074c0a175 --- /dev/null +++ b/examples/docker/mpls_demo/init/vpp1.cmd @@ -0,0 +1,7 @@ +create host-interface name veth12 +set int state host-veth12 up +set int ip address host-veth12 10.12.1.1/24 + +create host-interface name veth13 +set int state host-veth13 up +set int ip address host-veth13 10.13.1.1/24 diff --git a/examples/docker/mpls_demo/init/vpp2.cmd b/examples/docker/mpls_demo/init/vpp2.cmd new file mode 100644 index 000000000..e9cac61a1 --- /dev/null +++ b/examples/docker/mpls_demo/init/vpp2.cmd @@ -0,0 +1,7 @@ +create host-interface name veth21 +set int state host-veth21 up +set int ip address host-veth21 10.12.1.2/24 + +create host-interface name veth24 +set int state host-veth24 up +set int ip address host-veth24 10.24.1.2/24 diff --git a/examples/docker/mpls_demo/init/vpp3.cmd b/examples/docker/mpls_demo/init/vpp3.cmd new file mode 100644 index 000000000..7e5a6231d --- /dev/null +++ b/examples/docker/mpls_demo/init/vpp3.cmd @@ -0,0 +1,11 @@ +create host-interface name veth31 +set int state host-veth31 up +set int ip address host-veth31 10.13.1.3/24 + +create host-interface name veth341 +set int state host-veth341 up +set int ip address host-veth341 10.34.1.3/24 + +create host-interface name veth342 +set int state host-veth342 up +set int ip address host-veth342 10.34.2.3/24 diff --git a/examples/docker/mpls_demo/init/vpp4.cmd b/examples/docker/mpls_demo/init/vpp4.cmd new file mode 100644 index 000000000..b3a69eec9 --- /dev/null +++ b/examples/docker/mpls_demo/init/vpp4.cmd @@ -0,0 +1,11 @@ +create host-interface name veth42 +set int state host-veth42 up +set int ip address host-veth42 10.24.1.4/24 + +create host-interface name veth431 +set int state host-veth431 up +set int ip address host-veth431 10.34.1.4/24 + +create host-interface name veth432 +set int state host-veth432 up +set int ip address host-veth432 10.34.2.4/24 diff --git a/examples/docker/mpls_demo/postman_collection.json b/examples/docker/mpls_demo/postman_collection.json new file mode 100644 index 000000000..6c8d5cc54 --- /dev/null +++ b/examples/docker/mpls_demo/postman_collection.json @@ -0,0 +1,997 @@ +{ + "id": "775eb149-1920-2405-14f1-0a578e6dfa17", + "name": "Honeycomb SR MPLS", + "description": "Examples of configuring some basic MPLS SR scenariou using hc2vpp", + "order": [], + "folders": [ + { + "id": "43395a46-591f-06e1-c6f7-2d3be218f4b7", + "name": "vpp1", + "description": "", + "order": [ + "16657be6-c235-6e55-46aa-bfcd9509c677", + "563861ed-4363-071e-9bd5-eaff5eb8c98b", + "2cf9511c-b24b-b79e-d73a-2c22b1ad0399", + "c013c45c-91d1-1a3b-f79d-70b3b64b9e80", + "8822aefb-a139-52a4-b013-d27e34038e3b", + "6180b672-0422-1c86-6982-213d297f644e", + "7c820a89-b5b6-de2d-a24e-272e8652132e", + "5f3d1085-288d-b0cd-d0fc-4c9d5e56bb97", + "b884638e-79a4-525b-45aa-82833fdd1dfb", + "aeb31fa2-4e55-2d4f-eb86-09ee2cf61d18", + "786bf7e9-315d-4367-6bab-044f197182f4", + "c6f22ad3-fb95-f8d5-59ae-46bb1187161d", + "21677d79-6b69-ec38-6547-9aaace9a2a22" + ], + "owner": 0, + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17" + }, + { + "id": "527edbd2-7633-b78f-eef0-f8286979c6ea", + "name": "vpp2", + "description": "", + "order": [ + "8207832c-31f7-3a6c-635d-84acb0dc5aec", + "b9f4ce2e-514f-5bbc-adf1-8a21e9930f0c", + "45abf6ec-633c-24da-ba25-47e918e6de6c", + "c81edfa7-eed8-7034-2b2f-b51d1790769b", + "7db6d85d-ece1-aac3-d22f-d0d1a235cafc", + "747b2251-395e-610b-7645-9a41b0b64488", + "1454328e-2d83-bc67-7a8f-271d11fc18cb", + "336475cb-227c-e04d-5726-c7fcfd87dbaa", + "c8669e95-8c4f-4ab7-2c4a-676349929ecc" + ], + "owner": 0, + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17" + }, + { + "id": "ef180850-5af2-a60b-eeca-85252e9ce8ec", + "name": "vpp3", + "description": "", + "order": [ + "119ec4e0-605d-08b4-fec1-cf4a131ad000", + "13c7a902-2a09-dbcb-15e2-44bad8fef7db", + "dcbbd269-63b7-910c-a710-4ad8fd0573ee", + "c3f46171-f7c7-f959-ef2d-2c0c7a2b42c9", + "cca562e5-6677-83b3-c694-e2852ae34582", + "21db6249-27ed-7f90-07c3-0596d703916f", + "0fb225aa-cb57-8823-6b10-fe11bfa5b722", + "d968a2a2-8c53-528e-31a7-4d34e85c3fd9", + "5e1eb658-1b3d-7033-3f76-3077d62550b4", + "608eb5d9-ec75-80f8-5f68-ad8393fbaa06", + "cc6688cb-9b65-e4d0-4985-d4d9dec14ca6" + ], + "owner": 0, + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17" + }, + { + "id": "d51a02ef-c70d-b9cf-496f-9f4bd807476e", + "name": "vpp4", + "description": "", + "order": [ + "d1f8d9e4-9546-1aae-2b86-b88a5baa53e4", + "0cb9c591-37ea-1f32-403b-a28097796e37", + "045b4a83-98da-a106-a82c-066e4ee6538f", + "2fab46ad-11bd-4d1f-acee-612e03b5c6a2", + "36bd3b64-d122-4f11-69e1-99848539cc47", + "9d7d5222-0fdb-5779-1afd-34d2991d7de7", + "d98ec90f-b870-6ab7-ce74-46b78e4c4615", + "fc075349-ef0d-a0cc-dd7e-1de162c42c64", + "33de5e94-c1fd-96bc-e5e0-3bd586c87886", + "51b46690-bab5-dcfc-bb2e-8b61f666adda", + "c8e47113-0a93-33c7-d2e3-872a831aa0aa", + "51d3fcb9-bbf8-0a54-8d1a-c50372554a45" + ], + "owner": 0, + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17" + } + ], + "timestamp": 1511524812433, + "owner": 0, + "public": false, + "requests": [ + { + "id": "045b4a83-98da-a106-a82c-066e4ee6538f", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.5:8445/restconf/config/ietf-interfaces:interfaces/interface/A", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511854983587, + "name": "Configure tap for host A", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"A\",\r\n \"description\": \"Host A\",\r\n \"type\": \"v3po:tap\",\r\n \"tap\" : {\r\n \"tap-name\" : \"A\"\r\n },\r\n \"ipv4\" : {\r\n \t\"address\" : [{\r\n \t\t\"ip\" : \"10.100.1.1\",\r\n \t\t\"prefix-length\" : \"24\"\r\n \t}]\r\n }\r\n }\r\n ]\r\n \r\n}" + }, + { + "id": "0cb9c591-37ea-1f32-403b-a28097796e37", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.5:8445/restconf/operational/ietf-interfaces:interfaces-state/", + "preRequestScript": "", + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511784764401, + "name": "List ifcs - oper", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" + }, + { + "id": "0fb225aa-cb57-8823-6b10-fe11bfa5b722", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.4:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/lsp2", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511801165058, + "name": "Swap 104 and forward via veth341", + "description": "Corresponding CLI command:\n\nmpls local-label add eos 104 via 10.34.1.4 host-veth341 out-labels 104\n\n\nCan be verified via CLI using:\n\nshow mpls fib 104", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"static-lsp\": [\n {\n \"name\": \"lsp2\",\n \"config\": {\n \"in-segment\": {\n \"incoming-label\": 104\n },\n \"operation\": \"swap-and-forward\",\n \"next-hop\": \"10.34.1.4\",\n \"outgoing-label\": 104,\n \"outgoing-interface\": \"host-veth341\"\n }\n }\n ]\n}" + }, + { + "id": "119ec4e0-605d-08b4-fec1-cf4a131ad000", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.4:8445/restconf/config/ietf-interfaces:interfaces/", + "preRequestScript": "", + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511787251902, + "name": "List ifcs - cfg", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" + }, + { + "id": "13c7a902-2a09-dbcb-15e2-44bad8fef7db", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.4:8445/restconf/operational/ietf-interfaces:interfaces-state/", + "preRequestScript": "", + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511787294881, + "name": "List ifcs - oper", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" + }, + { + "id": "1454328e-2d83-bc67-7a8f-271d11fc18cb", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.3:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/lsp3", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511879008223, + "name": "Pop 102 and IPv4 lookup", + "description": "In case 102 is the last label,\npop it and check if we have route for destination.", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"static-lsp\": [\n {\n \"name\": \"lsp3\",\n \"config\": {\n \"in-segment\": {\n \"incoming-label\": 102\n },\n \"operation\": \"pop-and-lookup\",\n \"vpp-mpls:label-lookup\" : {\n \"type\": \"ipv4\",\n \"ip4-lookup-in-table\": 0\n }\n }\n }\n ]\n}" + }, + { + "id": "16657be6-c235-6e55-46aa-bfcd9509c677", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.2:8445/restconf/config/ietf-interfaces:interfaces/", + "preRequestScript": "", + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511561704894, + "name": "List ifcs - cfg", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "" + }, + { + "id": "21677d79-6b69-ec38-6547-9aaace9a2a22", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.2:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls", + "preRequestScript": "", + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511781091941, + "name": "Get mpls (cfg)", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "" + }, + { + "id": "21db6249-27ed-7f90-07c3-0596d703916f", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.4:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/lsp1", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511801154966, + "name": "Pop 103 and MPLS lookup", + "description": "Corresponding CLI command:\n\nmpls local-label add non-eos 103 mpls-lookup-in-table 0\n\n\nCan be verified via CLI using:\n\nshow mpls fib 103", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"static-lsp\": [\n {\n \"name\": \"lsp1\",\n \"config\": {\n \"in-segment\": {\n \"incoming-label\": 103\n },\n \"operation\": \"pop-and-lookup\",\n \"vpp-mpls:label-lookup\" : {\n \"type\": \"mpls\",\n \"mpls-lookup-in-table\": 0\n }\n }\n }\n ]\n}" + }, + { + "id": "2cf9511c-b24b-b79e-d73a-2c22b1ad0399", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.2:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/interface/host-veth12", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511782604060, + "name": "Enable mpls on host-veth12", + "description": "Correspondig CLI command:\n\nset interface mpls host-veth12 enable", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"interface\": [\n {\n \"name\": \"host-veth12\",\n \"config\": {\n \"enabled\": \"true\"\n }\n }\n ]\n}" + }, + { + "id": "2fab46ad-11bd-4d1f-acee-612e03b5c6a2", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.5:8445/restconf/config/ietf-interfaces:interfaces/interface/B", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511855043182, + "name": "Configure tap for host B", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"B\",\r\n \"description\": \"Host B\",\r\n \"type\": \"v3po:tap\",\r\n \"tap\" : {\r\n \"tap-name\" : \"B\"\r\n },\r\n \"ipv4\" : {\r\n \t\"address\" : [{\r\n \t\t\"ip\" : \"10.200.1.1\",\r\n \t\t\"prefix-length\" : \"24\"\r\n \t}]\r\n }\r\n }\r\n ]\r\n \r\n}" + }, + { + "id": "336475cb-227c-e04d-5726-c7fcfd87dbaa", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.3:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/trafficToB", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511879106545, + "name": "Send traffic to B via 104", + "description": "Simulates route that could be received via BGP.", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"static-lsp\": [\n {\n \"name\": \"trafficToB\",\n \"config\": {\n \"in-segment\": {\n \"ip-prefix\": \"10.200.1.1/24\"\n },\n \"operation\": \"impose-and-forward\",\n \"paths\": [\n {\n \"path-index\": 0,\n \"next-hop\": \"10.24.1.4\",\n \"outgoing-labels\": [\n 104\n ],\n \"outgoing-interface\": \"host-veth24\"\n }\n ]\n }\n }\n ]\n}" + }, + { + "id": "33de5e94-c1fd-96bc-e5e0-3bd586c87886", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.5:8445/restconf/config/hc2vpp-ietf-routing:routing/routing-instance/vpp-routing-instance/routing-protocols/routing-protocol/learned-protocol-0", + "preRequestScript": null, + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511791932269, + "name": "Create config for vrf0", + "description": "Hc2vpp by default stores it under learned-protocol-0", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n\t\"routing-protocol\":[\n\t\t{\n\t\t\t\"name\":\"learned-protocol-0\",\n\t\t\t\"enabled\":\"true\",\n\t\t\t\"type\":\"static\",\n\t\t\t\"vpp-protocol-attributes\": {\n\t \"primary-vrf\": 0\n }\n\t\t}\t\n\t]\n}" + }, + { + "id": "36bd3b64-d122-4f11-69e1-99848539cc47", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.5:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/interface/host-veth42", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511784773818, + "name": "Enable mpls on host-veth42", + "description": "Correspondig CLI command:\n\nset interface mpls host-veth42 enable", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"interface\": [\n {\n \"name\": \"host-veth42\",\n \"config\": {\n \"enabled\": \"true\"\n }\n }\n ]\n}" + }, + { + "id": "45abf6ec-633c-24da-ba25-47e918e6de6c", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.3:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/interface/host-veth21", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511783000679, + "name": "Enable mpls on host-veth21 interface", + "description": "Correspondig CLI command:\n\nset interface mpls host-veth21 enable", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"interface\": [\n {\n \"name\": \"host-veth21\",\n \"config\": {\n \"enabled\": \"true\"\n }\n }\n ]\n}" + }, + { + "id": "51b46690-bab5-dcfc-bb2e-8b61f666adda", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.5:8445/restconf/config/hc2vpp-ietf-routing:routing/routing-instance/vpp-routing-instance/routing-protocols/routing-protocol/learned-protocol-0/static-routes/ipv4/route/1", + "preRequestScript": null, + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511796631088, + "name": "Add reverse direction for 10.12.1.0/24", + "description": "Send reverse traffic using IP.\n\nCorresponding CLI command:\n\nip route add 10.12.1.0/24 via 10.24.1.2 host-veth42", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n\t\"route\": [\n\t\t{\n\t\t\t\"id\": 1,\n\t\t\t\"destination-prefix\": \"10.12.1.0/24\",\n\t\t\t\"next-hop\": \"10.24.1.2\",\n\t\t\t\"outgoing-interface\": \"host-veth42\"\n\t\t\t\n\t\t}]\n}" + }, + { + "id": "51d3fcb9-bbf8-0a54-8d1a-c50372554a45", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.5:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls", + "preRequestScript": "", + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511784778628, + "name": "Get mpls (cfg)", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "" + }, + { + "id": "563861ed-4363-071e-9bd5-eaff5eb8c98b", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.2:8445/restconf/operational/ietf-interfaces:interfaces-state/", + "preRequestScript": "", + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511781058381, + "name": "List ifcs - oper", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" + }, + { + "id": "5e1eb658-1b3d-7033-3f76-3077d62550b4", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.4:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/lsp4", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511801190473, + "name": "Swap 10341 and forward via veth341", + "description": "Corresponding CLI command:\n\nmpls local-label add eos 10341 via 10.34.1.4 host-veth341 out-labels 104\n\n\nCan be verified via CLI using:\n\nshow mpls fib 10341", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"static-lsp\": [\n {\n \"name\": \"lsp4\",\n \"config\": {\n \"in-segment\": {\n \"incoming-label\": 10341\n },\n \"operation\": \"swap-and-forward\",\n \"next-hop\": \"10.34.1.4\",\n \"outgoing-label\": 104,\n \"outgoing-interface\": \"host-veth341\"\n }\n }\n ]\n}" + }, + { + "id": "5f3d1085-288d-b0cd-d0fc-4c9d5e56bb97", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.2:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/trafficToA", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511857030755, + "name": "Send traffic to A via 103, 104", + "description": "Corresponding CLI command:\n\nip route add 10.100.1.1/24 via 10.13.1.3 host-veth13 out-labels 103 104\n\nCan be verified via CLI using:\n\nshow ip fib 10.100.1.1/24", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"static-lsp\": [\n {\n \"name\": \"trafficToA\",\n \"config\": {\n \"in-segment\": {\n \"ip-prefix\": \"10.100.1.1/24\"\n },\n \"operation\": \"impose-and-forward\",\n \"paths\": [\n {\n \"path-index\": 0,\n \"next-hop\": \"10.13.1.3\",\n \"outgoing-labels\": [\n 103,\n 104\n ],\n \"outgoing-interface\": \"host-veth13\"\n }\n ]\n }\n }\n ]\n}" + }, + { + "id": "608eb5d9-ec75-80f8-5f68-ad8393fbaa06", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.4:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/lsp5", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511802701919, + "name": "Swap 10342 and forward via veth342", + "description": "Corresponding CLI command:\n\nmpls local-label add eos 10342 via 10.34.2.4 host-veth342 out-labels 104\n\n\nCan be verified via CLI using:\n\nshow mpls fib 10342", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"static-lsp\": [\n {\n \"name\": \"lsp5\",\n \"config\": {\n \"in-segment\": {\n \"incoming-label\": 10342\n },\n \"operation\": \"swap-and-forward\",\n \"next-hop\": \"10.34.2.4\",\n \"outgoing-label\": 104,\n \"outgoing-interface\": \"host-veth342\"\n }\n }\n ]\n}" + }, + { + "id": "6180b672-0422-1c86-6982-213d297f644e", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.2:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/trafficToB", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511879726989, + "name": "Send traffic to B via 102", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"static-lsp\": [\n {\n \"name\": \"trafficToB\",\n \"config\": {\n \"in-segment\": {\n \"ip-prefix\": \"10.200.1.1/24\"\n },\n \"operation\": \"impose-and-forward\",\n \"next-hop\": \"10.12.1.2\",\n \"outgoing-label\" : 102,\n \"outgoing-interface\": \"host-veth12\"\n }\n }\n ]\n}" + }, + { + "id": "747b2251-395e-610b-7645-9a41b0b64488", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.3:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/lsp2", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511804026118, + "name": "Swap 104 and forward", + "description": "Corresponding CLI command:\n\nmpls local-label add eos 104 via 10.24.1.4 host-veth24 out-labels 104\n\n\nCan be verified via CLI using:\n\nshow mpls fib 104", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"static-lsp\": [\n {\n \"name\": \"lsp2\",\n \"config\": {\n \"in-segment\": {\n \"incoming-label\": 104\n },\n \"operation\": \"swap-and-forward\",\n \"next-hop\": \"10.24.1.4\",\n \"outgoing-label\": 104,\n \"outgoing-interface\": \"host-veth24\"\n }\n }\n ]\n}" + }, + { + "id": "786bf7e9-315d-4367-6bab-044f197182f4", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.2:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/trafficToA", + "preRequestScript": "", + "pathVariables": {}, + "method": "DELETE", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511878077664, + "name": "Delete rule for traffic to A", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "" + }, + { + "id": "7c820a89-b5b6-de2d-a24e-272e8652132e", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.2:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/trafficToB", + "preRequestScript": "", + "pathVariables": {}, + "method": "DELETE", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511856670841, + "name": "Delete rule for traffic to B", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "isFromCollection": true, + "collectionRequestId": "8822aefb-a139-52a4-b013-d27e34038e3b", + "folder": "43395a46-591f-06e1-c6f7-2d3be218f4b7", + "rawModeData": "" + }, + { + "id": "7db6d85d-ece1-aac3-d22f-d0d1a235cafc", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.3:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/lsp1", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511804019361, + "name": "Pop 102 and MPLS lookup", + "description": "Corresponding CLI command:\n\nmpls local-label add non-eos 102 mpls-lookup-in-table 0\n\n\nCan be verified via CLI using:\n\nshow mpls fib 102", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"static-lsp\": [\n {\n \"name\": \"lsp1\",\n \"config\": {\n \"in-segment\": {\n \"incoming-label\": 102\n },\n \"operation\": \"pop-and-lookup\",\n \"vpp-mpls:label-lookup\" : {\n \"type\": \"mpls\",\n \"mpls-lookup-in-table\": 0\n }\n }\n }\n ]\n}" + }, + { + "id": "8207832c-31f7-3a6c-635d-84acb0dc5aec", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.3:8445/restconf/config/ietf-interfaces:interfaces/", + "preRequestScript": "", + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511782986509, + "name": "List ifcs - cfg", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" + }, + { + "id": "8822aefb-a139-52a4-b013-d27e34038e3b", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.2:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/trafficToB", + "preRequestScript": "", + "pathVariables": {}, + "method": "DELETE", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511856670841, + "name": "Delete rule for traffic to B", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "" + }, + { + "id": "9d7d5222-0fdb-5779-1afd-34d2991d7de7", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.5:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/interface/host-veth431", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511790495962, + "name": "Enable mpls on veth431", + "description": "Correspondig CLI command:\n\nset interface mpls host-veth431 enable", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"interface\": [\n {\n \"name\": \"host-veth431\",\n \"config\": {\n \"enabled\": \"true\"\n }\n }\n ]\n}" + }, + { + "id": "aeb31fa2-4e55-2d4f-eb86-09ee2cf61d18", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.2:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/trafficToA", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511862434935, + "name": "Send traffic to A via 103, 10341", + "description": "Node + adjacency SID example.\n\nSteers traffic to A veth341 (the first interface between vpp3 and vpp4).", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"static-lsp\": [\n {\n \"name\": \"trafficToA\",\n \"config\": {\n \"in-segment\": {\n \"ip-prefix\": \"10.100.1.1/24\"\n },\n \"operation\": \"impose-and-forward\",\n \"paths\": [\n {\n \"path-index\": 0,\n \"next-hop\": \"10.13.1.3\",\n \"outgoing-labels\": [\n 103,\n 10341\n ],\n \"outgoing-interface\": \"host-veth13\"\n }\n ]\n }\n }\n ]\n}" + }, + { + "id": "b884638e-79a4-525b-45aa-82833fdd1dfb", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.2:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/trafficToA", + "preRequestScript": "", + "pathVariables": {}, + "method": "DELETE", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511878069136, + "name": "Delete rule for traffic to A", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "" + }, + { + "id": "b9f4ce2e-514f-5bbc-adf1-8a21e9930f0c", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.3:8445/restconf/operational/ietf-interfaces:interfaces-state/", + "preRequestScript": "", + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511782992979, + "name": "List ifcs - oper", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" + }, + { + "id": "c013c45c-91d1-1a3b-f79d-70b3b64b9e80", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.2:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/trafficToB", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511856993179, + "name": "Send traffic to B via 102,104", + "description": "Corresponding CLI command:\n\nip route add 10.200.1.1/24 via 10.12.1.2 host-veth12 out-labels 102 104\n\nCan be verified via CLI using:\n\nshow ip fib 10.200.1.1/24", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"static-lsp\": [\n {\n \"name\": \"trafficToB\",\n \"config\": {\n \"in-segment\": {\n \"ip-prefix\": \"10.200.1.1/24\"\n },\n \"operation\": \"impose-and-forward\",\n \"paths\": [\n {\n \"path-index\": 0,\n \"next-hop\": \"10.12.1.2\",\n \"outgoing-labels\": [\n 102,\n 104\n ],\n \"outgoing-interface\": \"host-veth12\"\n }\n ]\n }\n }\n ]\n}" + }, + { + "id": "c3f46171-f7c7-f959-ef2d-2c0c7a2b42c9", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.4:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/interface/host-veth341", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511787493647, + "name": "Enable mpls on host-veth341", + "description": "Correspondig CLI command:\n\nset interface mpls host-veth341 enable", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"interface\": [\n {\n \"name\": \"host-veth341\",\n \"config\": {\n \"enabled\": \"true\"\n }\n }\n ]\n}" + }, + { + "id": "c6f22ad3-fb95-f8d5-59ae-46bb1187161d", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.2:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/trafficToA", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511862579692, + "name": "Send traffic to A via 103, 10342", + "description": "Node + adjacency SID example.\n\nSteers traffic to A veth342 (the second interface between vpp3 and vpp4).", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"static-lsp\": [\n {\n \"name\": \"trafficToA\",\n \"config\": {\n \"in-segment\": {\n \"ip-prefix\": \"10.100.1.1/24\"\n },\n \"operation\": \"impose-and-forward\",\n \"paths\": [\n {\n \"path-index\": 0,\n \"next-hop\": \"10.13.1.3\",\n \"outgoing-labels\": [\n 103,\n 10342\n ],\n \"outgoing-interface\": \"host-veth13\"\n }\n ]\n }\n }\n ]\n}" + }, + { + "id": "c81edfa7-eed8-7034-2b2f-b51d1790769b", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.3:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/interface/host-veth24", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511783009910, + "name": "Enable mpls on host-veth24 interface", + "description": "Correspondig CLI command:\n\nset interface mpls host-veth24 enable", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"interface\": [\n {\n \"name\": \"host-veth24\",\n \"config\": {\n \"enabled\": \"true\"\n }\n }\n ]\n}" + }, + { + "id": "c8669e95-8c4f-4ab7-2c4a-676349929ecc", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.3:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls", + "preRequestScript": "", + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511783016510, + "name": "Get mpls (cfg)", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "" + }, + { + "id": "c8e47113-0a93-33c7-d2e3-872a831aa0aa", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.5:8445/restconf/config/hc2vpp-ietf-routing:routing/routing-instance/vpp-routing-instance/routing-protocols/routing-protocol/learned-protocol-0/static-routes/ipv4/route/2", + "preRequestScript": null, + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511797454889, + "name": "Add reverse direction for 10.13.1.0/24", + "description": "Send reverse traffic using IP.\n\nCorresponding CLI command:\n\nip route add 10.13.1.0/24 via 10.34.2.3 host-veth432", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n\t\"route\": [\n\t\t{\n\t\t\t\"id\": 2,\n\t\t\t\"destination-prefix\": \"10.13.1.0/24\",\n\t\t\t\"next-hop\": \"10.34.2.3\",\n\t\t\t\"outgoing-interface\": \"host-veth432\"\n\t\t\t\n\t\t}]\n}" + }, + { + "id": "cc6688cb-9b65-e4d0-4985-d4d9dec14ca6", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.4:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls", + "preRequestScript": "", + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511787309539, + "name": "Get mpls (cfg)", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "" + }, + { + "id": "cca562e5-6677-83b3-c694-e2852ae34582", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.4:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/interface/host-veth342", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511787556015, + "name": "Enable mpls on host-veth342", + "description": "Correspondig CLI command:\n\nset interface mpls host-veth342 enable", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"interface\": [\n {\n \"name\": \"host-veth342\",\n \"config\": {\n \"enabled\": \"true\"\n }\n }\n ]\n}" + }, + { + "id": "d1f8d9e4-9546-1aae-2b86-b88a5baa53e4", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.5:8445/restconf/config/ietf-interfaces:interfaces/", + "preRequestScript": "", + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511784757365, + "name": "List ifcs - cfg", + "description": "", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" + }, + { + "id": "d968a2a2-8c53-528e-31a7-4d34e85c3fd9", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.4:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/lsp3", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511801173478, + "name": "Swap 104 and forward via veth342", + "description": "Corresponding CLI command:\n\nmpls local-label add eos 104 via 10.34.2.4 host-veth342 out-labels 104\n\n\nCan be verified via CLI using:\n\nshow mpls fib 104", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"static-lsp\": [\n {\n \"name\": \"lsp3\",\n \"config\": {\n \"in-segment\": {\n \"incoming-label\": 104\n },\n \"operation\": \"swap-and-forward\",\n \"next-hop\": \"10.34.2.4\",\n \"outgoing-label\": 104,\n \"outgoing-interface\": \"host-veth342\"\n }\n }\n ]\n}" + }, + { + "id": "d98ec90f-b870-6ab7-ce74-46b78e4c4615", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.5:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/interface/host-veth432", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511790503226, + "name": "Enable mpls on veth432", + "description": "Correspondig CLI command:\n\nset interface mpls host-veth432 enable", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"interface\": [\n {\n \"name\": \"host-veth432\",\n \"config\": {\n \"enabled\": \"true\"\n }\n }\n ]\n}" + }, + { + "id": "dcbbd269-63b7-910c-a710-4ad8fd0573ee", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.4:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/interface/host-veth31", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511787499174, + "name": "Enable mpls on host-veth31", + "description": "Correspondig CLI command:\n\nset interface mpls host-veth31 enable", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"interface\": [\n {\n \"name\": \"host-veth31\",\n \"config\": {\n \"enabled\": \"true\"\n }\n }\n ]\n}" + }, + { + "id": "fc075349-ef0d-a0cc-dd7e-1de162c42c64", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "https://172.17.0.5:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-mpls:mpls/hc2vpp-ietf-mpls-static:static-lsps/static-lsp/lsp1", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1511804229802, + "name": "Pop 104 and IPv4 lookup", + "description": "Corresponding CLI command:\n\nmpls local-label add eos 104 ip4-lookup-in-table 0\n\n\nCan be verified via CLI using:\n\nshow mpls fib 104", + "collectionId": "775eb149-1920-2405-14f1-0a578e6dfa17", + "responses": [], + "rawModeData": "{\n \"static-lsp\": [\n {\n \"name\": \"lsp1\",\n \"config\": {\n \"in-segment\": {\n \"incoming-label\": 104\n },\n \"operation\": \"pop-and-lookup\",\n \"vpp-mpls:label-lookup\" : {\n \"type\": \"ipv4\",\n \"ip4-lookup-in-table\": 0\n }\n }\n }\n ]\n}" + } + ] +}
\ No newline at end of file diff --git a/examples/docker/mpls_demo/run_terminals.sh b/examples/docker/mpls_demo/run_terminals.sh new file mode 100755 index 000000000..aee7feb94 --- /dev/null +++ b/examples/docker/mpls_demo/run_terminals.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Opens connections to hc2vpp containers + +xfce4-terminal --title=vpp1 --command="docker exec -it vpp1 \ + bash -c '/hc2vpp/mpls_demo/init/vpp.sh vpp1; exec $SHELL'" + +xfce4-terminal --title=vpp2 --command="docker exec -it vpp2 \ + bash -c '/hc2vpp/mpls_demo/init/vpp.sh vpp2; exec $SHELL'" + +xfce4-terminal --title=vpp3 --command="docker exec -it vpp3 \ + bash -c '/hc2vpp/mpls_demo/init/vpp.sh vpp3; exec $SHELL'" + +xfce4-terminal --title=vpp4 --command="docker exec -it vpp4 \ + bash -c '/hc2vpp/mpls_demo/init/vpp.sh vpp4; exec $SHELL'" diff --git a/examples/docker/packages/.gitignore b/examples/docker/packages/.gitignore new file mode 100644 index 000000000..6708b4347 --- /dev/null +++ b/examples/docker/packages/.gitignore @@ -0,0 +1,2 @@ +# Do not store packages used by Dockerfile in the repo +*.deb
\ No newline at end of file diff --git a/examples/docker/remove_all_containers.sh b/examples/docker/remove_all_containers.sh new file mode 100755 index 000000000..7327f91e6 --- /dev/null +++ b/examples/docker/remove_all_containers.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +ids=$(docker ps -aq) + +# Stop all containers +docker stop $ids + +# Delete all containers +docker rm $ids diff --git a/examples/docker/remove_all_images.sh b/examples/docker/remove_all_images.sh new file mode 100755 index 000000000..c38cd7613 --- /dev/null +++ b/examples/docker/remove_all_images.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# Delete all images +docker rmi $(docker images -q) diff --git a/examples/docker/remove_hc2vpp_containers.sh b/examples/docker/remove_hc2vpp_containers.sh new file mode 100755 index 000000000..c1fbf705a --- /dev/null +++ b/examples/docker/remove_hc2vpp_containers.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +ids=$(docker ps -aq --filter ancestor=hc2vpp) + +# Stop all hc2vpp based containers +echo "Stopping containers: $ids" +docker stop $ids + +# Delete all hc2vpp based containers +echo "Removing containers: $ids" +docker rm $ids diff --git a/examples/docker/remove_hc2vpp_image.sh b/examples/docker/remove_hc2vpp_image.sh new file mode 100755 index 000000000..f08bc5fe0 --- /dev/null +++ b/examples/docker/remove_hc2vpp_image.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# Delete all images +docker rmi hc2vpp diff --git a/examples/docker/start_hc2vpp_container.sh b/examples/docker/start_hc2vpp_container.sh new file mode 100755 index 000000000..820fa021d --- /dev/null +++ b/examples/docker/start_hc2vpp_container.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Create & start container +# $1 - container name +docker run -dt --privileged --name=$1 hc2vpp +docker start $1 diff --git a/examples/docker/test/docker_ip.sh b/examples/docker/test/docker_ip.sh new file mode 100755 index 000000000..1e3bc997d --- /dev/null +++ b/examples/docker/test/docker_ip.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# Obtain IP address of the container +# See http://blog.oddbit.com/2014/08/11/four-ways-to-connect-a-docker/ +docker inspect --format '{{ .NetworkSettings.IPAddress }}' "$@" diff --git a/examples/docker/test/show_interfaces_state.sh b/examples/docker/test/show_interfaces_state.sh new file mode 100755 index 000000000..06d972e79 --- /dev/null +++ b/examples/docker/test/show_interfaces_state.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Obtain IP of the container +# $1 - container name +ip=$(/hc2vpp/test/docker_ip.sh $1) +url="https://$ip:8445/restconf/operational/ietf-interfaces:interfaces-state/" +echo "GET $url" + +# Show interfaces-state +curl --insecure -X GET $url \ + -H 'authorization: Basic YWRtaW46YWRtaW4=' \ + -H 'cache-control: no-cache' \ + -H 'content-type: application/json' + +echo diff --git a/examples/docker/utils.sh b/examples/docker/utils.sh new file mode 100755 index 000000000..7b4674752 --- /dev/null +++ b/examples/docker/utils.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# Creates named container from given image. +# +# $1 - container name +# $2 - image name +# +function create_container { + container_name=$1 + image_name=$2 + echo "Creating $container_name from $image_name" + docker run -dt --privileged --name=$container_name $image_name +} + +# Starts container +# and adds container's network namespace +# to the linux runtime data (/var/run). +# +# $1 - container name +# +# See: +# https://platform9.com/blog/container-namespaces-deep-dive-container-networking/ +# +function start_container { + container_name=$1 + echo "Starting container $container_name" + + # Remove namespace if it was present + ip netns del $container_name + + # Start container + docker start $container_name + + # Make container's network namespaces accessible using ip netns + pid=$(docker inspect -f '{{.State.Pid}}' $container_name) + ln -s /proc/$pid/ns/net /var/run/netns/$container_name + echo "Container $container_name started sucessfully (pid=$pid)" +} + +# Links two containers using a veth pair. +# +# $1 - name of the container A +# $2 - name of the veth endpoint that belongs to A +# $3 - name of the veth endpoint that belongs to B +# $4 - name of the container B +# +function create_link { + container1=$1 + if1=$2 + if2=$3 + container2=$4 + echo "Creating link from $container1($if1) to $container2($if2)" + ip link add $if1 type veth peer name $if2 + + # Move veth endpoints to corresponding namespaces + ip link set $if1 netns $container1 + ip link set $if2 netns $container2 + + # Bring interfaces up + ip netns exec $container1 ip link set $if1 up + ip netns exec $container2 ip link set $if2 up + echo "Link created successfully" +} diff --git a/examples/docker/vpp/kill.sh b/examples/docker/vpp/kill.sh new file mode 100755 index 000000000..329d201ec --- /dev/null +++ b/examples/docker/vpp/kill.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +ps -ef | grep vpp | awk '{print $2}'| xargs kill diff --git a/examples/docker/vpp/start.sh b/examples/docker/vpp/start.sh new file mode 100755 index 000000000..6b1899fdd --- /dev/null +++ b/examples/docker/vpp/start.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +vpp -c /etc/vpp/startup.conf & |