Difference between revisions of "HICN/How To Configure the Hicn Plugin of VPP with Open DayLight"
From fd.io
< HICN
Line 63: | Line 63: | ||
$ 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 |
Revision as of 11:33, 22 July 2019
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 $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" $ 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 --cap-add=NET_ADMIN --device=/dev/vhost-net --device=/dev/net/tun -p ${PORT}:${PORT} --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} ip route add 0.0.0.0/0 via ${TAP_ADDRESS_KER} ${TAP_NAME}
Deploy a Open Daylight Docker container
Deploy the icnteam/odl docker image