Difference between revisions of "HICN/How To Configure the Hicn Plugin of VPP with Open DayLight"
From fd.io
< HICN
Muscariello (Talk | contribs) |
|||
(7 intermediate revisions by one other user not shown) | |||
Line 31: | Line 31: | ||
$ sudo apt-get update | $ sudo apt-get update | ||
$ sudo apt-get install \ | $ sudo apt-get install \ | ||
− | apt-transport-https | + | apt-transport-https \ |
ca-certificates \ | ca-certificates \ | ||
curl \ | curl \ | ||
Line 37: | Line 37: | ||
software-properties-common | software-properties-common | ||
− | $ | + | $ sudo https://get.docker.com | bash |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
$ sudo apt-get update | $ sudo apt-get update | ||
$ sudo apt-get install docker-ce docker-ce-cli containerd.io | $ sudo apt-get install docker-ce docker-ce-cli containerd.io | ||
Line 52: | Line 48: | ||
CONTAINER=vswitch | CONTAINER=vswitch | ||
PORT=55555 | PORT=55555 | ||
− | $ docker run --cap-add=NET_ADMIN --device=/dev/vhost-net --device=/dev/net/tun -p ${PORT}:${PORT} --name ${CONTAINER} icnteam/vswitch | + | $ docker run -d --cap-add=NET_ADMIN --device=/dev/vhost-net --device=/dev/net/tun -p ${PORT}:${PORT}/udp --name ${CONTAINER} icnteam/vswitch |
</syntaxhighlight> | </syntaxhighlight> | ||
Line 63: | Line 59: | ||
$ TAP_ID=0 | $ TAP_ID=0 | ||
$ TAP_NAME=tap${TAP_ID} | $ TAP_NAME=tap${TAP_ID} | ||
− | $ docker exec -it ${CONTAINER} - | + | $ docker exec -it ${CONTAINER} bash -c "apt update && apt -y install iptables" |
$ docker exec -it ${CONTAINER} vppctl create tap id ${TAP_ID} | $ docker exec -it ${CONTAINER} vppctl create tap id ${TAP_ID} | ||
$ docker exec -it ${CONTAINER} vppctl set int state ${TAP_NAME} up | $ docker exec -it ${CONTAINER} vppctl set int state ${TAP_NAME} up | ||
Line 73: | Line 69: | ||
$ docker exec -it ${CONTAINER} iptables -t nat -A POSTROUTING -j MASQUERADE --src ${TAP_ADDRESS_NET} ! --dst ${TAP_ADDRESS_NET} -o eth0 | $ docker exec -it ${CONTAINER} iptables -t nat -A POSTROUTING -j MASQUERADE --src ${TAP_ADDRESS_NET} ! --dst ${TAP_ADDRESS_NET} -o eth0 | ||
# Add default route to vpp | # Add default route to vpp | ||
− | $ docker exec -it ${CONTAINER} ip route add 0.0.0.0/0 via ${TAP_ADDRESS_KER} ${TAP_NAME} | + | $ docker exec -it ${CONTAINER} vppctl ip route add 0.0.0.0/0 via ${TAP_ADDRESS_KER} ${TAP_NAME} |
</syntaxhighlight> | </syntaxhighlight> | ||
+ | Configure udp punting: | ||
+ | |||
+ | <syntaxhighlight lang="bash"> | ||
+ | vppctl hicn punting add prefix c001::/16 intfc ${TAP_NAME} type udp4 src_port${PORT} dst_port ${PORT} | ||
+ | </syntaxhighlight> | ||
== Deploy a Open Daylight Docker container == | == Deploy a Open Daylight Docker container == |
Latest revision as of 19:55, 3 February 2020
Contents
Configure the Hicn Plugin of VPP with Open DayLight
This tutorial shows how to perform the following operations:
- Deploy a Docker container with vpp, the hicn-plugin, sysrepo and the netopeer2 server
- Deploy a Open Daylight Docker container
- Configure opendaylight for connecting to netopeer2, which will in turn connect to the hicn-plugin for pushing the configuration
- Push the hicn network configuration from to opendaylight using REST
- Check the configuration is effectively applied on hicn-plugin
Background
For the tutorial we will use a single ubuntu 18.04 machine where the 2 docker containers (the one with the hicn-plugin and the one with ODL) will be running. The two dockers should be able to communicate using the network.
A second machine will be then used for pushing the network configuration to Open Dayligh, using network API (REST).
Deploy a Docker container with vpp, the hicn-plugin, sysrepo and the netopeer2 server
Install docker on the ubuntu machine:
$ sudo apt-get update $ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common $ sudo https://get.docker.com | bash $ sudo apt-get update $ sudo apt-get install docker-ce docker-ce-cli containerd.io
Deploy the icnteam/vswitch docker image. We will use udp faces with port 55555, so we need to expose that port when running the container:
CONTAINER=vswitch PORT=55555 $ docker run -d --cap-add=NET_ADMIN --device=/dev/vhost-net --device=/dev/net/tun -p ${PORT}:${PORT}/udp --name ${CONTAINER} icnteam/vswitch
Connect the vpp forwarder to the external network.
$ TAP_ADDRESS_VPP=192.168.0.2 $ TAP_ADDRESS_KER=192.168.0.1 $ TAP_ADDRESS_NET=192.168.0.0/24 $ TAP_ID=0 $ TAP_NAME=tap${TAP_ID} $ docker exec -it ${CONTAINER} bash -c "apt update && apt -y install iptables" $ docker exec -it ${CONTAINER} vppctl create tap id ${TAP_ID} $ docker exec -it ${CONTAINER} vppctl set int state ${TAP_NAME} up $ docker exec -it ${CONTAINER} vppctl set interface ip address tap0 ${TAP_ADDRESS_VPP}/24 $ docker exec -it ${CONTAINER} ip addr add ${TAP_ADDRESS_KER}/24 brd + dev ${TAP_NAME} # Redirect the udp traffic on port 55555 (The one used for hicn) to VPP $ docker exec -it ${CONTAINER} iptables -t nat -A PREROUTING -p udp --dport ${PORT} -j DNAT --to-destination ${TAP_ADDRESS_VPP}:${PORT} # Masquerade all the traffic coming from VPP $ docker exec -it ${CONTAINER} iptables -t nat -A POSTROUTING -j MASQUERADE --src ${TAP_ADDRESS_NET} ! --dst ${TAP_ADDRESS_NET} -o eth0 # Add default route to vpp $ docker exec -it ${CONTAINER} vppctl ip route add 0.0.0.0/0 via ${TAP_ADDRESS_KER} ${TAP_NAME}
Configure udp punting:
vppctl hicn punting add prefix c001::/16 intfc ${TAP_NAME} type udp4 src_port${PORT} dst_port ${PORT}
Deploy a Open Daylight Docker container
Deploy the icnteam/odl docker image