diff options
author | Michal Cmarada <michal.cmarada@pantheon.tech> | 2018-06-15 10:37:14 +0200 |
---|---|---|
committer | Michal Cmarada <michal.cmarada@pantheon.tech> | 2018-06-20 08:29:14 +0200 |
commit | 1528ed5d01ddd8a0de14711de59861d16f727a3e (patch) | |
tree | defc318c886c8673161b2cae43d6fa097b8a0772 /examples/docker | |
parent | b77a5725338dc700873b36c98af85d70acd7bbe4 (diff) |
Add SRv6 5 node docker demo
This demo is intended to test SRv6 implementation. There are
two options how to run the demo. First one is to use VPP only
configuration and the second one uses honeycomb to configure
SRv6 on nodes.
For detailed information about the demo read documentation in
./asciidoc/Readme.adoc file. Follow the instructions to run
the demo and use provided commands to verify the operation
of VPP nodes.
Change-Id: I7d17db0096cc48b06e9148e7c78faaf9d7b8a97d
Signed-off-by: Michal Cmarada <michal.cmarada@pantheon.tech>
Diffstat (limited to 'examples/docker')
-rwxr-xr-x | examples/docker/Dockerfile | 2 | ||||
-rw-r--r-- | examples/docker/SRv6_5-node/asciidoc/Readme.adoc | 87 | ||||
-rwxr-xr-x | examples/docker/SRv6_5-node/asciidoc/resources/SRv6-5node.svg | 2 | ||||
-rwxr-xr-x | examples/docker/SRv6_5-node/clean_demo.sh | 25 | ||||
-rwxr-xr-x | examples/docker/SRv6_5-node/hc_configurations/hc_vpp_a_rest_config.sh | 208 | ||||
-rwxr-xr-x | examples/docker/SRv6_5-node/hc_configurations/hc_vpp_b_rest_config.sh | 59 | ||||
-rwxr-xr-x | examples/docker/SRv6_5-node/hc_configurations/hc_vpp_c_rest_config.sh | 59 | ||||
-rwxr-xr-x | examples/docker/SRv6_5-node/hc_configurations/hc_vpp_d_rest_config.sh | 59 | ||||
-rwxr-xr-x | examples/docker/SRv6_5-node/hc_configurations/hc_vpp_e_rest_config.sh | 207 | ||||
-rwxr-xr-x | examples/docker/SRv6_5-node/pcap_vpp.sh | 23 | ||||
-rwxr-xr-x | examples/docker/SRv6_5-node/restart_demo.sh | 27 | ||||
-rwxr-xr-x | examples/docker/SRv6_5-node/show_configuration.sh | 20 | ||||
-rwxr-xr-x | examples/docker/SRv6_5-node/start_demo.sh | 222 | ||||
-rwxr-xr-x | examples/docker/SRv6_5-node/watch_int_vpp.sh | 13 | ||||
-rwxr-xr-x | examples/docker/create_image.sh | 3 | ||||
-rwxr-xr-x | examples/docker/utils.sh | 88 |
16 files changed, 1089 insertions, 15 deletions
diff --git a/examples/docker/Dockerfile b/examples/docker/Dockerfile index 2decc50c2..d443fd37a 100755 --- a/examples/docker/Dockerfile +++ b/examples/docker/Dockerfile @@ -6,7 +6,7 @@ ADD . /hc2vpp RUN apt-get update && apt-get install -y \ # Utils - iproute2 iputils-ping net-tools vim-tiny jshon telnet \ + iproute2 iputils-ping net-tools vim-tiny jshon telnet curl \ # VPP package dependencies libnuma1 libssl1.0.0 libmbedcrypto0 libmbedtls10 libmbedx509-0 \ # Honeycomb package dependencies diff --git a/examples/docker/SRv6_5-node/asciidoc/Readme.adoc b/examples/docker/SRv6_5-node/asciidoc/Readme.adoc new file mode 100644 index 000000000..275159632 --- /dev/null +++ b/examples/docker/SRv6_5-node/asciidoc/Readme.adoc @@ -0,0 +1,87 @@ += SRv6-5 node Demo + +Requirements:: + +- docker +- deb packages for honeycomb (hc2vpp) and vpp + +Usage:: + +. download or build vpp and honeycomb deb packages and place them inside _"../packages"_ folder: +- honeycomb-*.deb (hc2vpp is required, use _"hc2vpp/packaging/deb/xenial/debuild.sh"_ to build deb package locally) +- vpp-*.deb +- vpp-lib*.deb +- vpp-plugins*.deb +- you can download vpp packages from +https://nexus.fd.io/content/repositories/fd.io.master.ubuntu.xenial.main/io/fd/[Nexus Fd.io] + +. Run the script _"./create_image.sh"_ in parent directory to create docker image with HC and VPP pre-installed. +It should be added to docker automatically (a tar file of the image can be created as backup, see content of +create_image.sh). +. Start the demo using _"start_demo.sh <demo_type>"_ script where _<demo_type>_ is _"vpp"_ for vpp only setup or _"hc"_ +for setup with honeycomb +. Clean everything with "clean_demo.sh" script +. if you need to restart the whole demo use _"restart_demo.sh <demo_type>"_. You don't have to use the same demo type as +in start_demo script. Current setup will be cleaned and started as a fresh demo. + +Topology:: + +- 5VPP nodes (*vppA* = A::, *vppB* = B::, *vppC* = C::, *vppD* = D::, *vppE* = E::) +- each node was preassigned with IPv6 addresses on host-veth interfaces (marked red) +- green dashed line represents how traffic should flow from source to the destination +- blue dashed line represents return traffic from destination back to source + +image::resources/SRv6-5node.svg[SRv6 5node topology] + +Testing/debuging:: + +. to list configuration for all nodes use `./show_configuration.sh` script +. to test ping for IPv6 use: +- *hostA:* + +_sudo ip netns exec VNET_A ping6 E::1_ + +_sudo ip netns exec VNET_A ping6 E::1 -c 1000 -s 1024 -i 0.0001_ (for bigger flow) +- *hostE:* + +_sudo ip netns exec VNET_E ping6 A::1_ + +_sudo ip netns exec VNET_E ping6 A::1 -c 1000 -s 1024 -i 0.0001_ (for bigger flow) + + + +. to run packet trace simply use _"pcap_vpp.sh"_ script + +e.g. ./pcap_vpp.sh <nodeName> <packetCount> + +_"./pcap_vpp.sh vppA 3"_ + + + +. to observe packet flow use _"watch_int_vpp.sh"_ script + +e.g. ./watch_int_vpp.sh <nodeName> + +_"./watch_int_vpp.sh vppA"_ + +. to check the packet flow on hostE use tcpdump: + +`sudo ip netns exec VNET_E tcpdump -i vethE -vv -c 4` + +Sample packet capture on hostE:: +.... +sudo ip netns exec VNET_E tcpdump -i vethE -vv -c 4 + +tcpdump: listening on vethE, link-type EN10MB (Ethernet), capture size 262144 bytes +12:21:00.210165 IP6 (flowlabel 0x3d90e, hlim 62, next-header ICMPv6 (58) payload length: 64) a::1 > e::1: [icmp6 sum ok] ICMP6, echo request, seq 285 +12:21:00.210250 IP6 (flowlabel 0x8fd85, hlim 64, next-header ICMPv6 (58) payload length: 64) e::1 > a::1: [icmp6 sum ok] ICMP6, echo reply, seq 285 +12:21:01.213350 IP6 (flowlabel 0x3d90e, hlim 62, next-header ICMPv6 (58) payload length: 64) a::1 > e::1: [icmp6 sum ok] ICMP6, echo request, seq 286 +12:21:01.213435 IP6 (flowlabel 0x8fd85, hlim 64, next-header ICMPv6 (58) payload length: 64) e::1 > a::1: [icmp6 sum ok] ICMP6, echo reply, seq 286 +4 packets captured +4 packets received by filter +0 packets dropped by kernel +.... + +Usefull VPP commands:: + +Note: to use vpp commands for this demo use syntax like this: + +`"sudo docker exec vppC vppctl sh hardware"` + +- vppctl show hardware (show interfaces with L2 addresses) +- vppctl show int (show interfaces with counters) +- vppctl show int address (show interfaces with L3 addresses) +- vppctl show sr localsids (shows local sid table) +- vppctl show sr policies (list of configured SR policies) +- vppctl show sr steering-policies (list of configured steering SR policies) +- vppctl show ip6 fib (shows routing table) +- vppctl show ip6 fib <dst_ip_mask> (shows routing table and filter matches by destination IP) diff --git a/examples/docker/SRv6_5-node/asciidoc/resources/SRv6-5node.svg b/examples/docker/SRv6_5-node/asciidoc/resources/SRv6-5node.svg new file mode 100755 index 000000000..c98687ca5 --- /dev/null +++ b/examples/docker/SRv6_5-node/asciidoc/resources/SRv6-5node.svg @@ -0,0 +1,2 @@ +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="741px" height="571px" version="1.1" content="<mxfile userAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36" version="8.7.8" editor="www.draw.io" type="google"><diagram id="6e814df7-4c32-5c57-ff26-ff71587e7534" name="Page-1">7Zxbc6s2EIB/jWfah3QQ4uZH39I+tDOd5qHJIwHFpsXIxdhx+usrjMRlkWzsYLA7nMnMgUWAtPqkXS0rj/Bsffg5djer36hPwpGu+YcRno90HWmGzv5LJV+ZxNTHmWAZBz4vVAhegn+JuJNLd4FPtpWCCaVhEmyqQo9GEfGSisyNY/pZLfZBw+pbN+6S1AQvnhvWpX8GfrLKpI6pFfJfSLBciTcjjV9Zu6IwF2xXrk8/SyK8GOFZTGmSHa0PMxKmyhN6ye57VlzNKxaTKGl0AzIc3cPI1rx3ZI3JEzKzR+zdcMdby2uafInms0cwTbOTKav+JhV6Id2xJ04/V0FCXjaulwo/Wecz2SpZh+wMsUP+aBIn5KCsMMrVwPghdE2S+IsV4TdgrrjPQu+2wGJV0rlpc6HL+3qZP6pQBzvgGmmqHYlyrJC9cvrODpbpwWSEj39czl6RXzqhyDOKc7ebjOOP4ED8djSJBK58EOpaXbWmTLO3UKx+XrHTR1EsHt+RYvF5xc4eRbGQWKNPxRrnFTt/FMVCYntVrMwAAcUuhGS7caNcpVDZlYt33weWVu0D3GcfWA2cgMifpK4UO4toRKoKYm2Ov17ZiSZO3tKTn8z09BAkr6IcOy6uZO8gfs35Ajpk9aC72COKyguP0I2XJFGU0eV90VDXMQndJNhXqynrAP6G32nAGpB3de7HCgMB+zBrHr+r7L3BB1kKSyMelOmg9qAjD3mzr0PE/i4iSgxOwdMSIrgBIkaviEBTZ1yJCIbTyrg7RJzziJSA+IskyRdf67m7hDIRjZMVXdLIDX+ldAPAKWaTtzIrr1WO3vIZCbLIJM9B2pjjvS2BZdz73ANNPb527smJhPaqA7DGrZknCShKvDqcexSuQjeIIKslRKCd6xIR8erHtE9NphGzT0ZMHdgn60pG8jiNeBDqkBFZOOdhGNHvnREDxkGg69GYEeAMYTTujhFZAEXNiBe6223gNVoNKY0NatHYNFkM9WttgJFA11obBHDr0NFFsmDQpZBI5pJTvkqLHonZgBHcq9dqAZfEwFdCYkO71aW5qUdVXv7YM6Hm07UbRDVkEnJIqpBsk5j+TWY0pHFhkD7YKgaI3DBYRilpjAPC5NM0NBV4bjjhF9aB74eqSFdMd5GfxrWOkH3QKHnhlULiPFumsRa1EvuCcQwxdEtwIVtCl66pQbr+G48sspFFD9OmV7rI+mdHxYWn7VEpE1YAaZtDcVHEG1d0mzztSbKazPKIZpx/NuJR+HIAM3udIlh5P3CIx490/PyssX8tRfstq+o+GGaNCkcCBTZvAYUsltEZFLMBihwKp+oK2naPUMjiEK1CMZvXoZjNBygAFPDzlY77g0KXBR46g2I+QCECndDT6xUKdeJIS1DMF3UomGyAogJFvm7I3f8efQqxSLwdFFMJFFMOxXSAQgGFLF+nOyjUCTsdQLEYoBAxR6PqaOr2uEco1MlGHZiPAQoVFPmXsV6gUCdKtbUkndahmEyHOAVYfTgggC2JXnUHhSxzqzMoBp+iWH3YdwSFOqLpB3spE2kHPXFdp1DExyrWqKjmYX7fNSmvVBTpm8caV6XfI/smquBu1bw+Lpo3axhEcIeCYdUGkeyzwG0GkTrYNwyiLgbRdc0aBhFMnrDrlqizQYTPxsG8XAsFG1jTLAtjNS7v5UHAHvID34TF3vZsGT+WWHj/X/Axm7W4pgHeq2SDncxRucmnV3w2ItYOHosBj8bbUuC3FQP1yMfN4yCaZHGTL3gZLA/NRaurXvB5BVk9RtLxzUMhEi6K6NjARWm+EGNUuBt6n1w02Mfm7eL9UTFgl4g0SQ/mPqkmXnVeZymdT6/l85W7nT3ON4njGzVGjhYvfVV+RfwIgZ564O52lbcna+35BMG+8vqAcUEGSOxtnNaHoJVqltbHOtv9KhXbpAW26voiDGN945P1QiC7HWPtdHlFWr1yh4VzWXm4accwT5evpfkbp8tbcMfHmfrAvE7sVMqzg6yHWsvBxA22LV40I1SGW300Np4wimnBvmBLEpwwXOJ8ePIJI50yLpgRzuWVc7WdzhnudW4xweRiXrtFxQKDxmyYM3zp5GLBlfq5welcNtgMOJhNdLq84ru4cqspnM2dM5MXdCHH3xr87LT43ZysePHrQ3jxHw==</diagram></mxfile>"><defs/><g transform="translate(0.5,0.5)"><path d="M 177.5 142.5 C 35.5 142.5 0 285 113.6 313.5 C 0 376.2 127.8 513 220.1 456 C 284 570 497 570 568 456 C 710 456 710 342 621.25 285 C 710 171 568 57 443.75 114 C 355 28.5 213 28.5 177.5 142.5 Z" fill="#ffffff" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><ellipse cx="145" cy="225" rx="25" ry="25" fill="#ffffff" stroke="#000000" pointer-events="none"/><g transform="translate(136.5,218.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="17" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 18px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><b>A::</b></div></div></foreignObject><text x="9" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><ellipse cx="385" cy="225" rx="25" ry="25" fill="#ffffff" stroke="#000000" pointer-events="none"/><g transform="translate(376.5,218.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="17" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 18px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><b>B::</b></div></div></foreignObject><text x="9" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><ellipse cx="145" cy="425" rx="25" ry="25" fill="#ffffff" stroke="#000000" pointer-events="none"/><g transform="translate(136.5,418.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="17" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 18px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><b>C::</b></div></div></foreignObject><text x="9" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><ellipse cx="385" cy="425" rx="25" ry="25" fill="#ffffff" stroke="#000000" pointer-events="none"/><g transform="translate(376.5,418.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="17" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 18px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><b>D::</b></div></div></foreignObject><text x="9" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><ellipse cx="595" cy="325" rx="25" ry="25" fill="#ffffff" stroke="#000000" pointer-events="none"/><g transform="translate(586.5,318.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="16" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 17px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><b>E<span>::</span></b></div></div></foreignObject><text x="8" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><path d="M 170 225 L 360 225" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 170 425 L 360 425" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 385 400 L 385 250" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 145 400 L 145 250" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 410 425 L 570 325" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 410 225 L 570 325" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 60 150 L 122.15 202.87" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 126.15 206.28 L 118.55 204.41 L 122.15 202.87 L 123.08 199.07 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 613 343 L 695.77 436.24" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><path d="M 699.26 440.16 L 691.99 437.25 L 695.77 436.24 L 697.23 432.61 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/><g transform="translate(263.5,91.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="102" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 16px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 103px; white-space: nowrap; word-wrap: normal; font-weight: bold; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">SRv6 domain</div></div></foreignObject><text x="51" y="17" fill="#000000" text-anchor="middle" font-size="16px" font-family="Helvetica" font-weight="bold">SRv6 domain</text></switch></g><g transform="translate(148.5,248.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="54" height="27" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(255, 0, 0); line-height: 1.2; vertical-align: top; width: 56px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><font style="font-size: 10px">host-vethAC<br />AC::A</font></div></div></foreignObject><text x="27" y="20" fill="#FF0000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><g transform="translate(150.5,380.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="54" height="27" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(255, 0, 0); line-height: 1.2; vertical-align: top; width: 56px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><font style="font-size: 10px">host-vethAC<br />AC::C</font></div></div></foreignObject><text x="27" y="20" fill="#FF0000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><g transform="translate(172.5,426.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="55" height="27" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(255, 0, 0); line-height: 1.2; vertical-align: top; width: 57px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><font style="font-size: 10px">host-vethCD<br />CD::C</font></div></div></foreignObject><text x="28" y="20" fill="#FF0000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><g transform="translate(302.5,426.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="55" height="27" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(255, 0, 0); line-height: 1.2; vertical-align: top; width: 57px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><font style="font-size: 10px">host-vethCD<br />CD::D</font></div></div></foreignObject><text x="28" y="20" fill="#FF0000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><g transform="translate(412.5,418.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="54" height="27" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(255, 0, 0); line-height: 1.2; vertical-align: top; width: 56px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><font style="font-size: 10px">host-vethDE<br />DE::D</font></div></div></foreignObject><text x="27" y="20" fill="#FF0000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><g transform="translate(412.5,203.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="54" height="27" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(255, 0, 0); line-height: 1.2; vertical-align: top; width: 55px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><font style="font-size: 10px">host-vethBE<br />BE::B</font></div></div></foreignObject><text x="27" y="20" fill="#FF0000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><g transform="translate(530.5,282.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="54" height="27" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(255, 0, 0); line-height: 1.2; vertical-align: top; width: 55px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><font style="font-size: 10px">host-vethBE<br />BE::E</font></div></div></foreignObject><text x="27" y="20" fill="#FF0000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><g transform="translate(530.5,353.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="54" height="27" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(255, 0, 0); line-height: 1.2; vertical-align: top; width: 56px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><font style="font-size: 10px">host-vethDE<br />DE::E</font></div></div></foreignObject><text x="27" y="20" fill="#FF0000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><g transform="translate(162.5,193.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="54" height="27" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(255, 0, 0); line-height: 1.2; vertical-align: top; width: 55px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><font style="font-size: 10px">host-vethAB<br />AB::A</font></div></div></foreignObject><text x="27" y="20" fill="#FF0000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><g transform="translate(309.5,193.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="54" height="27" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(255, 0, 0); line-height: 1.2; vertical-align: top; width: 55px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><font style="font-size: 10px">host-vethAB<br />AB::B</font></div></div></foreignObject><text x="27" y="20" fill="#FF0000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><g transform="translate(327.5,251.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="54" height="24" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(255, 0, 0); line-height: 1.2; vertical-align: top; width: 56px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><div style="text-align: right"><span style="font-size: 10px">host-vethBD</span></div><font style="font-size: 10px"><div style="text-align: right"><span>BD::B</span></div></font></div></div></foreignObject><text x="27" y="18" fill="#FF0000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><g transform="translate(327.5,375.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="54" height="24" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(255, 0, 0); line-height: 1.2; vertical-align: top; width: 56px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><div style="text-align: right"><span style="font-size: 10px">host-vethBD</span></div><font style="font-size: 10px"><div style="text-align: right"><span>BD::D</span></div></font></div></div></foreignObject><text x="27" y="18" fill="#FF0000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><g transform="translate(21.5,133.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="77" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(204, 0, 0); line-height: 1.2; vertical-align: top; width: 78px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><font color="#006633"><b>host (A::1/64)</b></font></div></div></foreignObject><text x="39" y="12" fill="#CC0000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><g transform="translate(661.5,444.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="76" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(204, 0, 0); line-height: 1.2; vertical-align: top; width: 77px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><font color="#006633"><b>host (E::1/64)</b></font></div></div></foreignObject><text x="38" y="12" fill="#CC0000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><g transform="translate(106.5,168.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="47" height="27" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(255, 0, 0); line-height: 1.2; vertical-align: top; width: 47px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><font style="font-size: 10px">host-veth0<br />A::A/64</font></div></div></foreignObject><text x="24" y="20" fill="#FF0000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><g transform="translate(620.5,328.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="47" height="27" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(255, 0, 0); line-height: 1.2; vertical-align: top; width: 47px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><font style="font-size: 10px">host-veth0<br />E::E/64</font></div></div></foreignObject><text x="24" y="20" fill="#FF0000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><path d="M 60 149 Q 100 199 120 264.5 Q 140 330 115 395 Q 90 460 170 460 Q 250 460 330 455 Q 410 450 450 445 Q 490 440 535 400 Q 580 360 605 370 Q 630 380 674.73 433.67" fill="none" stroke="#00cc00" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="6 6" pointer-events="none"/><path d="M 678.57 438.28 L 670.37 434.7 L 674.73 433.67 L 676.52 429.58 Z" fill="#00cc00" stroke="#00cc00" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/><path d="M 700 441 Q 620 350 585 355 Q 550 360 470 405.5 Q 390 451 395 325.5 Q 400 200 380 190 Q 360 180 275 185 Q 190 190 87.74 152.81" fill="none" stroke="#0000cc" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="6 6" pointer-events="none"/><path d="M 82.1 150.76 L 90.99 149.74 L 87.74 152.81 L 88.25 157.26 Z" fill="#0000cc" stroke="#0000cc" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/></g></svg>
\ No newline at end of file diff --git a/examples/docker/SRv6_5-node/clean_demo.sh b/examples/docker/SRv6_5-node/clean_demo.sh new file mode 100755 index 000000000..2e4a8675b --- /dev/null +++ b/examples/docker/SRv6_5-node/clean_demo.sh @@ -0,0 +1,25 @@ +#! /bin/bash + +if [[ $UID != 0 ]]; then + echo "Please run this script with sudo:" + echo "sudo $0 $*" + exit 1 +fi + +echo "Stopping docker containers:" +sudo docker stop vppA +sudo docker stop vppB +sudo docker stop vppC +sudo docker stop vppD +sudo docker stop vppE +echo "Deleting docker containers:" +sudo docker rm vppA +sudo docker rm vppB +sudo docker rm vppC +sudo docker rm vppD +sudo docker rm vppE + +echo "Cleaning namespaces." +sudo ip -all netns delete + +echo "Cleanup finished." diff --git a/examples/docker/SRv6_5-node/hc_configurations/hc_vpp_a_rest_config.sh b/examples/docker/SRv6_5-node/hc_configurations/hc_vpp_a_rest_config.sh new file mode 100755 index 000000000..35b274116 --- /dev/null +++ b/examples/docker/SRv6_5-node/hc_configurations/hc_vpp_a_rest_config.sh @@ -0,0 +1,208 @@ +#!/usr/bin/env bash +echo "VPPA - configuring routing table for SIDs and policy via HC" +curl --insecure --request PUT \ + --url https://172.17.0.2:8445/restconf/config/vpp-fib-table-management:fib-table-management/vpp-fib-table-management:fib-tables/table/0/vpp-fib-table-management:ipv6 \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "vpp-fib-table-management:table": [ + { + "table-id": 0, + "address-family": "vpp-fib-table-management:ipv6", + "name": "ipv6-VRF:0" + } + ] +}' +sleep 1 + +echo "VPPA - configuring local sid A::201 via HC" +curl --insecure --request PUT \ + --url https://172.17.0.2:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/ \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "hc2vpp-ietf-srv6-base:locator": [ + { + "name": "a::", + "is-default": false, + "prefix": { + "address": "a::", + "length": 64 + }, + "enable": true, + "vpp-ietf-srv6-base:fib-table" : { + "table-id": 0, + "address-family": "vpp-fib-table-management:ipv6" + } + } + ] +}' +sleep 1 + +curl --insecure --request PUT \ + --url https://172.17.0.2:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/513/ \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "hc2vpp-ietf-srv6-static:sid": [ + { + "opcode": 513, + "end-behavior-type": "ietf-srv6-types:End.DX6", + "end-dx6": { + "paths": { + "path": [ + { + "path-index": 1, + "interface": "host-veth0", + "next-hop": "a::1", + "weight": 1, + "role": "PRIMARY" + } + ] + } + } + } + ] +}' +sleep 1 + +echo "VPPA - configuring encapsulation source via HC" +curl --insecure --request PUT \ + --url https://172.17.0.2:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/hc2vpp-ietf-srv6-base:encapsulation/ \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "hc2vpp-ietf-srv6-base:encapsulation": { + "ip-ttl-propagation": false, + "source-address": "a::1" + } +}' +sleep 1 + +echo "VPPA - configuring SRv6 policy via HC" +curl --insecure --request PUT \ + --url https://172.17.0.2:8445/restconf/config/hc2vpp-oc-srte-policy:segment-routing \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "hc2vpp-oc-srte-policy:segment-routing": { + "traffic-engineering": { + "named-segment-lists": { + "named-segment-list": [{ + "name": "a::e-1", + "config": { + "name": "a::e-1" + }, + "segments": { + "segment": [{ + "index": 1, + "config": { + "index": 1, + "type": "type-2", + "sid-value": "c::100" + } + }, + { + "index": 2, + "config": { + "index": 2, + "type": "type-2", + "sid-value": "d::100" + } + }, + { + "index": 3, + "config": { + "index": 3, + "type": "type-2", + "sid-value": "e::201" + } + }] + } + }] + }, + "policies": { + "policy": [{ + "name": "a::e", + "config": { + "name": "a::e", + "color": 1, + "endpoint": "e::1", + "admin-state": "UP" + }, + "color": 1, + "endpoint": "e::1", + "candidate-paths": { + "candidate-path": [{ + "name": "candidatePath1", + "provisioning-method": "provisioning-method-config", + "preference": 100, + "distinguisher": 0, + "config": { + "name": "candidatePath1", + "provisioning-method": "provisioning-method-config", + "computation-method": "path-explicitly-defined", + "preference": 100, + "distinguisher": 0 + }, + "binding-sid": { + "config": { + "alloc-mode": "explicit", + "type": "srv6", + "value": "a::e" + } + }, + "segment-lists": { + "segment-list": [{ + "name": "a::e-1", + "config": { + "name": "a::e-1", + "weight": 1 + } + }] + } + }] + }, + "autoroute-include": { + "config": { + "metric-type": "constant", + "metric-constant": 0 + }, + "prefixes": { + "config": { + "prefixes-all": false + }, + "prefix": [{ + "ip-prefix": "e::/64", + "config": { + "ip-prefix": "e::/64" + } + }] + } + }, + "binding-sid": { + "config": { + "alloc-mode": "explicit", + "type": "srv6", + "value": "a::e" + } + }, + "vpp-oc-srte-policy:vpp-sr-policy": { + "config": { + "policy-type": "Default", + "policy-behavior": "Encapsulation", + "table-id": 0, + "address-family": "vpp-fib-table-management:ipv6" + } + } + }] + } + } + } +}' +sleep 1 diff --git a/examples/docker/SRv6_5-node/hc_configurations/hc_vpp_b_rest_config.sh b/examples/docker/SRv6_5-node/hc_configurations/hc_vpp_b_rest_config.sh new file mode 100755 index 000000000..4ce7dc42b --- /dev/null +++ b/examples/docker/SRv6_5-node/hc_configurations/hc_vpp_b_rest_config.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash +echo "VPPB - configuring routing table for SIDs and policy via HC" +curl --insecure --request PUT \ + --url https://172.17.0.3:8445/restconf/config/vpp-fib-table-management:fib-table-management/vpp-fib-table-management:fib-tables/table/0/vpp-fib-table-management:ipv6 \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "vpp-fib-table-management:table": [ + { + "table-id": 0, + "address-family": "vpp-fib-table-management:ipv6", + "name": "ipv6-VRF:0" + } + ] +}' +sleep 1 + +echo "VPPB - configuring local sid B::100 via HC" +curl --insecure --request PUT \ + --url https://172.17.0.3:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/b::/ \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "hc2vpp-ietf-srv6-base:locator": [ + { + "name": "b::", + "is-default": false, + "prefix": { + "address": "b::", + "length": 64 + }, + "enable": true, + "vpp-ietf-srv6-base:fib-table" : { + "table-id": 0, + "address-family": "vpp-fib-table-management:ipv6" + } + } + ] +}' +sleep 1 + +curl --insecure --request PUT \ + --url https://172.17.0.3:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/b::/static/local-sids/sid/256/ \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "hc2vpp-ietf-srv6-static:sid": [ + { + "opcode": 256, + "end-behavior-type": "ietf-srv6-types:End", + "end": { + } + } + ] +}' +sleep 1 diff --git a/examples/docker/SRv6_5-node/hc_configurations/hc_vpp_c_rest_config.sh b/examples/docker/SRv6_5-node/hc_configurations/hc_vpp_c_rest_config.sh new file mode 100755 index 000000000..10ee9d38d --- /dev/null +++ b/examples/docker/SRv6_5-node/hc_configurations/hc_vpp_c_rest_config.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash +echo "VPPC - configuring routing table for SIDs and policy via HC" +curl --insecure --request PUT \ + --url https://172.17.0.4:8445/restconf/config/vpp-fib-table-management:fib-table-management/vpp-fib-table-management:fib-tables/table/0/vpp-fib-table-management:ipv6 \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "vpp-fib-table-management:table": [ + { + "table-id": 0, + "address-family": "vpp-fib-table-management:ipv6", + "name": "ipv6-VRF:0" + } + ] +}' +sleep 1 + +echo "VPPC - configuring local sid C::100 via HC" +curl --insecure --request PUT \ + --url https://172.17.0.4:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/c::/ \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "hc2vpp-ietf-srv6-base:locator": [ + { + "name": "c::", + "is-default": false, + "prefix": { + "address": "c::", + "length": 64 + }, + "enable": true, + "vpp-ietf-srv6-base:fib-table" : { + "table-id": 0, + "address-family": "vpp-fib-table-management:ipv6" + } + } + ] +}' +sleep 1 + +curl --insecure --request PUT \ + --url https://172.17.0.4:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/c::/static/local-sids/sid/256/ \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "hc2vpp-ietf-srv6-static:sid": [ + { + "opcode": 256, + "end-behavior-type": "ietf-srv6-types:End", + "end": { + } + } + ] +}' +sleep 1 diff --git a/examples/docker/SRv6_5-node/hc_configurations/hc_vpp_d_rest_config.sh b/examples/docker/SRv6_5-node/hc_configurations/hc_vpp_d_rest_config.sh new file mode 100755 index 000000000..e15ddd393 --- /dev/null +++ b/examples/docker/SRv6_5-node/hc_configurations/hc_vpp_d_rest_config.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash +echo "VPPD - configuring routing table for SIDs and policy via HC" +curl --insecure --request PUT \ + --url https://172.17.0.5:8445/restconf/config/vpp-fib-table-management:fib-table-management/vpp-fib-table-management:fib-tables/table/0/vpp-fib-table-management:ipv6 \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "vpp-fib-table-management:table": [ + { + "table-id": 0, + "address-family": "vpp-fib-table-management:ipv6", + "name": "ipv6-VRF:0" + } + ] +}' +sleep 1 + +echo "VPPD - configuring local sid D::100 via HC" +curl --insecure --request PUT \ + --url https://172.17.0.5:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/d::/ \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "hc2vpp-ietf-srv6-base:locator": [ + { + "name": "d::", + "is-default": false, + "prefix": { + "address": "d::", + "length": 64 + }, + "enable": true, + "vpp-ietf-srv6-base:fib-table" : { + "table-id": 0, + "address-family": "vpp-fib-table-management:ipv6" + } + } + ] +}' +sleep 1 + +curl --insecure --request PUT \ + --url https://172.17.0.5:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/d::/static/local-sids/sid/256/ \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "hc2vpp-ietf-srv6-static:sid": [ + { + "opcode": 256, + "end-behavior-type": "ietf-srv6-types:End", + "end": { + } + } + ] +}' +sleep 1 diff --git a/examples/docker/SRv6_5-node/hc_configurations/hc_vpp_e_rest_config.sh b/examples/docker/SRv6_5-node/hc_configurations/hc_vpp_e_rest_config.sh new file mode 100755 index 000000000..01408a159 --- /dev/null +++ b/examples/docker/SRv6_5-node/hc_configurations/hc_vpp_e_rest_config.sh @@ -0,0 +1,207 @@ +#!/usr/bin/env bash +echo "VPPE - configuring routing table for SIDs and policy via HC" +curl --insecure --request PUT \ + --url https://172.17.0.6:8445/restconf/config/vpp-fib-table-management:fib-table-management/vpp-fib-table-management:fib-tables/table/0/vpp-fib-table-management:ipv6 \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "vpp-fib-table-management:table": [ + { + "table-id": 0, + "address-family": "vpp-fib-table-management:ipv6", + "name": "ipv6-VRF:0" + } + ] +}' +sleep 1 + +echo "VPPE - configuring local sid E::201 via HC" +curl --insecure --request PUT \ + --url https://172.17.0.6:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/e::/ \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "hc2vpp-ietf-srv6-base:locator": [ + { + "name": "e::", + "is-default": false, + "prefix": { + "address": "e::", + "length": 64 + }, + "enable": true, + "vpp-ietf-srv6-base:fib-table" : { + "table-id": 0, + "address-family": "vpp-fib-table-management:ipv6" + } + } + ] +}' +sleep 1 + +curl --insecure --request PUT \ + --url https://172.17.0.6:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/e::/static/local-sids/sid/513/ \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "hc2vpp-ietf-srv6-static:sid": [ + { + "opcode": 513, + "end-behavior-type": "ietf-srv6-types:End.DX6", + "end-dx6": { + "paths": { + "path": [ + { + "path-index": 1, + "interface": "host-veth0", + "next-hop": "e::1", + "weight": 1, + "role": "PRIMARY" + } + ] + } + } + } + ] +}' + +echo "VPPE - configuring encapsulation source via HC" +curl --insecure --request PUT \ + --url https://172.17.0.6:8445/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/hc2vpp-ietf-srv6-base:encapsulation/ \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "hc2vpp-ietf-srv6-base:encapsulation": { + "ip-ttl-propagation": false, + "source-address": "e::1" + } +}' +sleep 1 + +echo "VPPE - configuring SRv6 policy via HC" +curl --insecure --request PUT \ + --url https://172.17.0.6:8445/restconf/config/hc2vpp-oc-srte-policy:segment-routing \ + --header 'accept: application/json' \ + --header 'authorization: Basic YWRtaW46YWRtaW4=' \ + --header 'content-type: application/json' \ + --data '{ + "hc2vpp-oc-srte-policy:segment-routing": { + "traffic-engineering": { + "named-segment-lists": { + "named-segment-list": [{ + "name": "e::a-1", + "config": { + "name": "e::a-1" + }, + "segments": { + "segment": [{ + "index": 1, + "config": { + "index": 1, + "type": "type-2", + "sid-value": "d::100" + } + }, + { + "index": 2, + "config": { + "index": 2, + "type": "type-2", + "sid-value": "b::100" + } + }, + { + "index": 3, + "config": { + "index": 3, + "type": "type-2", + "sid-value": "a::201" + } + }] + } + }] + }, + "policies": { + "policy": [{ + "name": "e::a", + "config": { + "name": "e::a", + "color": 1, + "endpoint": "a::1", + "admin-state": "UP" + }, + "color": 1, + "endpoint": "a::1", + "candidate-paths": { + "candidate-path": [{ + "name": "candidatePath1", + "provisioning-method": "provisioning-method-config", + "preference": 100, + "distinguisher": 0, + "config": { + "name": "candidatePath1", + "provisioning-method": "provisioning-method-config", + "computation-method": "path-explicitly-defined", + "preference": 100, + "distinguisher": 0 + }, + "binding-sid": { + "config": { + "alloc-mode": "explicit", + "type": "srv6", + "value": "e::a" + } + }, + "segment-lists": { + "segment-list": [{ + "name": "e::a-1", + "config": { + "name": "e::a-1", + "weight": 1 + } + }] + } + }] + }, + "autoroute-include": { + "config": { + "metric-type": "constant", + "metric-constant": 0 + }, + "prefixes": { + "config": { + "prefixes-all": false + }, + "prefix": [{ + "ip-prefix": "a::/64", + "config": { + "ip-prefix": "a::/64" + } + }] + } + }, + "binding-sid": { + "config": { + "alloc-mode": "explicit", + "type": "srv6", + "value": "e::a" + } + }, + "vpp-oc-srte-policy:vpp-sr-policy": { + "config": { + "policy-type": "Default", + "policy-behavior": "Encapsulation", + "table-id": 0, + "address-family": "vpp-fib-table-management:ipv6" + } + } + }] + } + } + } +}' +sleep 1 diff --git a/examples/docker/SRv6_5-node/pcap_vpp.sh b/examples/docker/SRv6_5-node/pcap_vpp.sh new file mode 100755 index 000000000..167d11f9f --- /dev/null +++ b/examples/docker/SRv6_5-node/pcap_vpp.sh @@ -0,0 +1,23 @@ +#! /bin/bash + +vpp_node=$1 +packet_count=$2 + +if [ -z "$1" ]; then + echo "VPP node argument missing!" + echo "Usage:" + echo -e "\n'$0 <vpp_node> <packet_count>' to run this command!\n" + exit 1 +fi + +if [ -z "$2" ]; then + echo "Packet count argument missing!" + echo "Usage:" + echo -e "\n'$0 <vpp_node> <packet_count>' to run this command!\n" + exit 1 +fi + +sudo docker exec ${vpp_node} vppctl clear trace +sudo docker exec ${vpp_node} vppctl trace add af-packet-input ${packet_count} +sleep ${packet_count} +sudo docker exec ${vpp_node} vppctl show trace diff --git a/examples/docker/SRv6_5-node/restart_demo.sh b/examples/docker/SRv6_5-node/restart_demo.sh new file mode 100755 index 000000000..81fdd76e8 --- /dev/null +++ b/examples/docker/SRv6_5-node/restart_demo.sh @@ -0,0 +1,27 @@ +#! /bin/bash + +if [[ $UID != 0 ]]; then + echo "Please run this script with sudo:" + echo "sudo $0 $*" + exit 1 +fi + +if [ -z "$1" ]; then + echo "Demo type argument missing!" + echo "Usage:" + echo -e "\n'$0 <demo_type>' to run this command!\n" + echo "<demo_type> - vpp or hc" + exit 2 +fi + +demo_type=$1 + +if [[ "$demo_type" != "vpp" && "$demo_type" != "hc" ]]; then + echo "Demo type argument is wrong!" + echo "<demo_type> - vpp or hc" + exit 3 +fi + +./clean_demo.sh +sleep 5 +./start_demo.sh ${demo_type} diff --git a/examples/docker/SRv6_5-node/show_configuration.sh b/examples/docker/SRv6_5-node/show_configuration.sh new file mode 100755 index 000000000..9e440f11a --- /dev/null +++ b/examples/docker/SRv6_5-node/show_configuration.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +echo -e "\n\033[1mvppA Configuration:" +echo -e "----------------------------------------------------------------------------------------\033[m" +sudo docker exec vppA vppctl sh sr localsids +sudo docker exec vppA vppctl sh sr policies +sudo docker exec vppA vppctl sh sr steering +echo -e "\n\033[1mvppB Configuration:" +echo -e "----------------------------------------------------------------------------------------\033[m" +sudo docker exec vppB vppctl sh sr localsids +echo -e "\n\033[1mvppC Configuration:" +echo -e "----------------------------------------------------------------------------------------\033[m" +sudo docker exec vppC vppctl sh sr localsids +echo -e "\n\033[1mvppD Configuration:" +echo -e "----------------------------------------------------------------------------------------\033[m" +sudo docker exec vppD vppctl sh sr localsids +echo -e "\n\033[1mvppE Configuration:" +echo -e "----------------------------------------------------------------------------------------\033[m" +sudo docker exec vppE vppctl sh sr localsids +sudo docker exec vppE vppctl sh sr policies +sudo docker exec vppE vppctl sh sr steering diff --git a/examples/docker/SRv6_5-node/start_demo.sh b/examples/docker/SRv6_5-node/start_demo.sh new file mode 100755 index 000000000..83bb66bc7 --- /dev/null +++ b/examples/docker/SRv6_5-node/start_demo.sh @@ -0,0 +1,222 @@ +#! /bin/bash + +source ../utils.sh + +if [[ $UID != 0 ]]; then + echo "Please run this script with sudo:" + echo "sudo $0 $*" + exit 1 +fi + +if [ -z "$1" ]; then + echo "Demo type argument missing!" + echo "Usage:" + echo -e "\n'$0 <demo_type>' to run this command!\n" + echo "<demo_type> - vpp or hc" + exit 2 +fi + +demo_type=$1 + +if [[ "$demo_type" != "vpp" && "$demo_type" != "hc" ]]; then + echo "Demo type argument is wrong!" + echo "<demo_type> - vpp or hc" + exit 3 +fi + +echo "Creating docker containers..." +create_container vppA hc2vpp:latest 0.75 +create_container vppB hc2vpp:latest 0.75 +create_container vppC hc2vpp:latest 0.75 +create_container vppD hc2vpp:latest 0.75 +create_container vppE hc2vpp:latest 0.75 + +echo "Starting docker containers..." +start_container vppA & +start_container vppB & +start_container vppC & +start_container vppD & +start_container vppE & +wait + +# Connect containers using veth interfaces +echo "Creating SRv6 5 node demo topology." +create_link vppA vethAB vethBA vppB +create_link vppA vethAC vethCA vppC +create_link vppB vethBD vethDB vppD +create_link vppB vethBE vethEB vppE +create_link vppC vethCD vethDC vppD +create_link vppD vethDE vethED vppE + +echo "Creating hostA and hostE namespaces." +sudo ip netns add VNET_A +sudo ip netns add VNET_E +create_link VNET_A vethA veth0 vppA +create_link VNET_E vethE veth0 vppE + +sudo ip netns exec VNET_A ip addr add A::1/64 dev vethA +sudo ip netns exec VNET_A ip route add E::/64 via A::A +sudo ip netns exec VNET_E ip addr add E::1/64 dev vethE +sudo ip netns exec VNET_E ip route add A::/64 via E::E + +echo "Starting VPPs in containers:" +start_vpp_in_container vppA & +start_vpp_in_container vppB & +start_vpp_in_container vppC & +start_vpp_in_container vppD & +start_vpp_in_container vppE & +wait + +echo "Configuring VPP interfaces and SRv6 routing:" +echo "vppA:" +#interface setup for A:: +sudo docker exec vppA vppctl create host-interface name veth0 +sudo docker exec vppA vppctl set interface state host-veth0 up +sudo docker exec vppA vppctl set interface ip address host-veth0 A::A/64 +sudo docker exec vppA vppctl create host-interface name vethAB hw-addr 00:00:00:00:ab:0a +sudo docker exec vppA vppctl set interface state host-vethAB up +sudo docker exec vppA vppctl set interface ip address host-vethAB AB::A/64 +sudo docker exec vppA vppctl create host-interface name vethAC hw-addr 00:00:00:00:ac:0a +sudo docker exec vppA vppctl set interface state host-vethAC up +sudo docker exec vppA vppctl set interface ip address host-vethAC AC::A/64 +#setup neighbors +sudo docker exec vppA vppctl set ip6 neighbor host-vethAC C::100 00:00:00:00:ac:0c +sudo docker exec vppA vppctl set ip6 neighbor host-vethAB B::100 00:00:00:00:ab:0b +sudo docker exec vppA vppctl ip route add C::100/128 via host-vethAC +sudo docker exec vppA vppctl ip route add B::100/128 via host-vethAB +#SR setup for A:: +if [[ "$demo_type" = "vpp" ]]; then + echo "VPPA - Configuring SRv6 via VPP:" + sudo docker exec vppA vppctl sr localsid address A::201 behavior end.dx6 host-veth0 A::1 + sudo docker exec vppA vppctl set sr encaps source addr A::1 + sudo docker exec vppA vppctl sr policy add bsid A::E next C::100 next D::100 next E::201 encap + sudo docker exec vppA vppctl sr steer l3 E::/64 via bsid A::E +fi + +echo "vppB:" +#interface setup for B:: +sudo docker exec vppB vppctl create host-interface name vethBA hw-addr 00:00:00:00:ab:0b +sudo docker exec vppB vppctl set interface state host-vethBA up +sudo docker exec vppB vppctl set interface ip address host-vethBA AB::B/64 +sudo docker exec vppB vppctl create host-interface name vethBD hw-addr 00:00:00:00:bd:0b +sudo docker exec vppB vppctl set interface state host-vethBD up +sudo docker exec vppB vppctl set interface ip address host-vethBD BD::B/64 +sudo docker exec vppB vppctl create host-interface name vethBE hw-addr 00:00:00:00:be:0b +sudo docker exec vppB vppctl set interface state host-vethBE up +sudo docker exec vppB vppctl set interface ip address host-vethBE BE::E/64 +#setup neighbors +sudo docker exec vppB vppctl set ip6 neighbor host-vethBA A::201 00:00:00:00:ab:0a +sudo docker exec vppB vppctl set ip6 neighbor host-vethBD D::100 00:00:00:00:bd:0d +sudo docker exec vppB vppctl ip route add A::201/128 via host-vethBA +sudo docker exec vppB vppctl ip route add D::100/128 via host-vethBD +#SR setup for B:: +if [[ "$demo_type" = "vpp" ]]; then + echo "VPPB - Configuring SRv6 via VPP:" + sudo docker exec vppB vppctl sr localsid address B::100 behavior end +fi + +echo "vppC:" +#interface setup for C:: +sudo docker exec vppC vppctl create host-interface name vethCA hw-addr 00:00:00:00:ac:0c +sudo docker exec vppC vppctl set interface state host-vethCA up +sudo docker exec vppC vppctl set interface ip address host-vethCA AC::C/64 +sudo docker exec vppC vppctl create host-interface name vethCD hw-addr 00:00:00:00:cd:0c +sudo docker exec vppC vppctl set interface state host-vethCD up +sudo docker exec vppC vppctl set interface ip address host-vethCD CD::C/64 +#setup neighbors +sudo docker exec vppC vppctl set ip6 neighbor host-vethCD D::100 00:00:00:00:cd:0d +sudo docker exec vppC vppctl set ip6 neighbor host-vethCA A::201 00:00:00:00:ac:0a +sudo docker exec vppC vppctl ip route add D::100/128 via host-vethCD +sudo docker exec vppC vppctl ip route add A::201/128 via host-vethCA +#SR setup for C:: +if [[ "$demo_type" = "vpp" ]]; then + echo "VPPC - Configuring SRv6 via VPP:" + sudo docker exec vppC vppctl sr localsid address C::100 behavior end +fi + +echo "vppD:" +#interface setup for D:: +sudo docker exec vppD vppctl create host-interface name vethDB hw-addr 00:00:00:00:bd:0d +sudo docker exec vppD vppctl set interface state host-vethDB up +sudo docker exec vppD vppctl set interface ip address host-vethDB BD::D/64 +sudo docker exec vppD vppctl create host-interface name vethDC hw-addr 00:00:00:00:cd:0d +sudo docker exec vppD vppctl set interface state host-vethDC up +sudo docker exec vppD vppctl set interface ip address host-vethDC CD::D/64 +sudo docker exec vppD vppctl create host-interface name vethDE hw-addr 00:00:00:00:de:0d +sudo docker exec vppD vppctl set interface state host-vethDE up +sudo docker exec vppD vppctl set interface ip address host-vethDE DE::D/64 +#setup neighbors +sudo docker exec vppD vppctl set ip6 neighbor host-vethDE E::201 00:00:00:00:de:0e +sudo docker exec vppD vppctl set ip6 neighbor host-vethDB B::100 00:00:00:00:bd:0b +sudo docker exec vppD vppctl set ip6 neighbor host-vethDC C::100 00:00:00:00:cd:0c +sudo docker exec vppD vppctl ip route add E::201/128 via host-vethDE +sudo docker exec vppD vppctl ip route add B::100/128 via host-vethDB +sudo docker exec vppD vppctl ip route add C::100/128 via host-vethDC +#SR setup for D:: +if [[ "$demo_type" = "vpp" ]]; then + echo "VPPD - Configuring SRv6 via VPP:" + sudo docker exec vppD vppctl sr localsid address D::100 behavior end +fi + +echo "vppE:" +#interface setup for E:: +sudo docker exec vppE vppctl create host-interface name veth0 +sudo docker exec vppE vppctl set interface state host-veth0 up +sudo docker exec vppE vppctl set interface ip address host-veth0 E::E/64 +sudo docker exec vppE vppctl create host-interface name vethEB hw-addr 00:00:00:00:be:0e +sudo docker exec vppE vppctl set interface state host-vethEB up +sudo docker exec vppE vppctl set interface ip address host-vethEB BE::E/64 +sudo docker exec vppE vppctl create host-interface name vethED hw-addr 00:00:00:00:de:0e +sudo docker exec vppE vppctl set interface state host-vethED up +sudo docker exec vppE vppctl set interface ip address host-vethED DE::E/64 +#setup neighbors +sudo docker exec vppE vppctl set ip6 neighbor host-vethEB B::100 00:00:00:00:be:0b +sudo docker exec vppE vppctl set ip6 neighbor host-vethED D::100 00:00:00:00:de:0d +sudo docker exec vppE vppctl ip route add D::100/128 via host-vethED +sudo docker exec vppE vppctl ip route add B::100/128 via host-vethEB +#SR setup for E:: +if [[ "$demo_type" = "vpp" ]]; then + echo "VPPE - Configuring SRv6 via VPP:" + sudo docker exec vppE vppctl sr localsid address E::201 behavior end.dx6 host-veth0 E::1 + sudo docker exec vppE vppctl set sr encaps source addr E::1 + sudo docker exec vppE vppctl sr policy add bsid E::A next D::100 next B::100 next A::201 encap + sudo docker exec vppE vppctl sr steer l3 A::/64 via bsid E::A +fi + +if [[ "$demo_type" = "hc" ]]; then + hc_plugins=`sudo docker exec vppA dpkg -L honeycomb |grep "io/fd/hc2vpp/srv6"`; + + if [ -z "$hc_plugins" ]; then + echo "NO SRv6 plugins detected for Honeycomb in docker containers!!!" + echo "Ensure that you provided valid honeycomb version" + echo "Then recreate the docker image and restart demo." + exit 4 + fi + + echo "Configuring SRv6 via HC:" + echo "Starting Honeycomb in containers:" + start_hc_in_container vppA & + start_hc_in_container vppB & + start_hc_in_container vppC & + start_hc_in_container vppD & + start_hc_in_container vppE & + wait + + echo "Configuring Honeycomb in containers:" + hc_configurations/hc_vpp_a_rest_config.sh & + hc_configurations/hc_vpp_b_rest_config.sh & + hc_configurations/hc_vpp_c_rest_config.sh & + hc_configurations/hc_vpp_d_rest_config.sh & + hc_configurations/hc_vpp_e_rest_config.sh & + wait +fi + +echo "Demo started." + +echo "Ping hostA -> hostE, desired path: (A::201)->(C::100)->(D::100)->(E::201)" +echo "ip netns exec VNET_A ping6 e::1 -c 10 -i 0.25" +sudo ip netns exec VNET_A ping6 e::1 -c 10 -i 0.25 + +echo "Ping hostE -> hostA, desired path: (E::201)->(D::100)->(B::100)->(A::201)" +echo "ip netns exec VNET_E ping6 a::1 -c 10 -i 0.25" +sudo ip netns exec VNET_E ping6 a::1 -c 10 -i 0.25 diff --git a/examples/docker/SRv6_5-node/watch_int_vpp.sh b/examples/docker/SRv6_5-node/watch_int_vpp.sh new file mode 100755 index 000000000..ef11c5197 --- /dev/null +++ b/examples/docker/SRv6_5-node/watch_int_vpp.sh @@ -0,0 +1,13 @@ +#! /bin/bash + +vpp_node=$1 +packet_count=$2 + +if [ -z "$1" ]; then + echo "VPP node argument missing!" + echo "Usage:" + echo -e "\n'$0 <vpp_node>' to run this command!\n" + exit 1 +fi + +watch -d -n 1 sudo docker exec ${vpp_node} vppctl sh int diff --git a/examples/docker/create_image.sh b/examples/docker/create_image.sh index e00a48cd6..72bc0b1b7 100755 --- a/examples/docker/create_image.sh +++ b/examples/docker/create_image.sh @@ -2,3 +2,6 @@ # Build docker image with vpp and hc2vpp installed docker build -t hc2vpp -f Dockerfile . + +# make backup copy of image (uncomment next line if desired) +# docker save -o hc2vpp-latest.tar hc2vpp:latest diff --git a/examples/docker/utils.sh b/examples/docker/utils.sh index 91e18a6b6..6c90e88c4 100755 --- a/examples/docker/utils.sh +++ b/examples/docker/utils.sh @@ -4,12 +4,19 @@ # # $1 - container name # $2 - image name +# $3 - cpu allocation (default = 1.0) # 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 + if [ -z "$3" ] + then + cpu="1.0" + else + cpu=$3 + fi + echo "Creating $container_name from $image_name, cpu allocation: $cpu" + docker run -dt --cpus=${cpu} --privileged --name=${container_name} ${image_name} /bin/bash } # Starts container @@ -26,15 +33,67 @@ function start_container { echo "Starting container $container_name" # Remove namespace if it was present - ip netns del $container_name + ip netns del ${container_name} 2> /dev/null # Start container - docker start $container_name + 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)" + pid=$(docker inspect -f '{{.State.Pid}}' ${container_name}) + sudo mkdir -p /var/run/netns + sudo ln -sf /proc/${pid}/ns/net /var/run/netns/${container_name} + echo "Container $container_name started successfully (pid=$pid)" +} + +# Starts vpp in container +# +# $1 - container name +# +function start_vpp_in_container { + container=$1 + echo "Starting vpp in $container" + + # Start VPP in container + sudo docker exec -d ${container} ./vpp/start.sh + result="stopped" + echo -e "Waiting for vpp in ${container} to start\n" + while [ "$result" != "started" ] + do + found=`sudo docker exec ${container} vppctl sh int 2> /dev/null |grep "local0"` + if [[ ${found} = *"local0"* ]]; then + result="started" + fi + echo -ne "." + sleep 1 + done + + echo -e "\nVPP in $container started successfully" +} + +# Starts vpp in container +# +# $1 - container name +# +function start_hc_in_container { + container=$1 + echo "Starting hc in $container" + + # Start HC in container + sudo docker exec -d ${container} ./honeycomb/start.sh + match="Honeycomb started successfully!" + result="stopped" + echo "Waiting for hc in ${container} to start" + while [ "$result" != "started" ] + do + found=`sudo docker exec ${container} tail /var/log/honeycomb/honeycomb.log 2> /dev/null | grep "${match}"` + + if [[ ${found} = *"${match}"* ]]; then + result="started" + fi + echo -ne "." + sleep 1 + done + echo -e "\nHC in $container started successfully" } # Links two containers using a veth pair. @@ -49,19 +108,20 @@ function create_link { if1=$2 if2=$3 container2=$4 - echo "Creating link from $container1($if1) to $container2($if2)" - ip link add $if1 type veth peer name $if2 + echo -ne "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 + 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 + ip netns exec ${container1} ip link set ${if1} up + ip netns exec ${container2} ip link set ${if2} up # Set interfaces mtu to 9000 to match default VPP mtu values ip netns exec ${container1} ifconfig ${if1} mtu 9000 ip netns exec ${container2} ifconfig ${if2} mtu 9000 - echo "Link created successfully" + + echo " -> done." } |