From 4b494aae5a39aeff4c13a2e91be722770760ef6e Mon Sep 17 00:00:00 2001 From: chabisik Date: Fri, 11 Dec 2020 18:43:27 +0100 Subject: [PATCH] mise a jour --- Dockerfiles/forContainerNet/device/Dockerfile | 23 ++++++++++++ .../{ => forContainerNet}/gatewayF/Dockerfile | 1 + .../{ => forContainerNet}/gatewayI/Dockerfile | 3 +- Dockerfiles/forContainerNet/server/Dockerfile | 21 +++++++++++ .../{ => forManualTest}/device/Dockerfile | 1 + Dockerfiles/forManualTest/gatewayF/Dockerfile | 24 +++++++++++++ Dockerfiles/forManualTest/gatewayI/Dockerfile | 22 ++++++++++++ .../{ => forManualTest}/server/Dockerfile | 0 topologie/topology_containernet.py | 35 +++++++++++++++++++ 9 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 Dockerfiles/forContainerNet/device/Dockerfile rename Dockerfiles/{ => forContainerNet}/gatewayF/Dockerfile (97%) rename Dockerfiles/{ => forContainerNet}/gatewayI/Dockerfile (78%) create mode 100644 Dockerfiles/forContainerNet/server/Dockerfile rename Dockerfiles/{ => forManualTest}/device/Dockerfile (97%) create mode 100644 Dockerfiles/forManualTest/gatewayF/Dockerfile create mode 100644 Dockerfiles/forManualTest/gatewayI/Dockerfile rename Dockerfiles/{ => forManualTest}/server/Dockerfile (100%) create mode 100755 topologie/topology_containernet.py diff --git a/Dockerfiles/forContainerNet/device/Dockerfile b/Dockerfiles/forContainerNet/device/Dockerfile new file mode 100644 index 0000000..a31ded2 --- /dev/null +++ b/Dockerfiles/forContainerNet/device/Dockerfile @@ -0,0 +1,23 @@ +# Choosing the image to use +FROM node:alpine + +# Installing required libraries +RUN apk add npm && \ + apk add bash && \ + mkdir device && \ + cd device && \ + npm install express && \ + npm install yargs && \ + npm install systeminformation && \ + npm install request && \ + wget http://homepages.laas.fr/smedjiah/tmp/device.js + +# set entry point for emulator gatekeeper (needed for compatibility with vim-emu datacenters) +#ENV VIM_EMU_CMD "node /device/device.js --local_ip "127.0.0.1" --local_port 9001 --local_name "dev1" --remote_ip "127.0.0.1" --remote_port 8282 --remote_name "gwf1" --send_period 3000" #uncomment when on ContainerNet datacenter +#ENV VIM_EMU_CMD "TODO at startup" +#ENV VIM_EMU_CMD_STOP "TODO at shutdown" + +# CMD should always point to /bin/bash to not block the emulator (sh for node:alpine) +CMD node /device/device.js --local_ip "127.0.0.1" --local_port 9001 --local_name "dev1" --remote_ip "127.0.0.1" --remote_port 8282 --remote_name "gwf1" --send_period 3000 #comment when on ContainerNet datacenter +#CMD /bin/bash #uncomment when on ContainerNet datacenter + diff --git a/Dockerfiles/gatewayF/Dockerfile b/Dockerfiles/forContainerNet/gatewayF/Dockerfile similarity index 97% rename from Dockerfiles/gatewayF/Dockerfile rename to Dockerfiles/forContainerNet/gatewayF/Dockerfile index c70ddcc..86037f3 100644 --- a/Dockerfiles/gatewayF/Dockerfile +++ b/Dockerfiles/forContainerNet/gatewayF/Dockerfile @@ -8,6 +8,7 @@ RUN apk add npm && \ npm install express && \ npm install yargs && \ npm install systeminformation && \ + npm install request && \ wget http://homepages.laas.fr/smedjiah/tmp/gateway.js # set entry point for emulator gatekeeper (needed for compatibility with vim-emu datacenters) diff --git a/Dockerfiles/gatewayI/Dockerfile b/Dockerfiles/forContainerNet/gatewayI/Dockerfile similarity index 78% rename from Dockerfiles/gatewayI/Dockerfile rename to Dockerfiles/forContainerNet/gatewayI/Dockerfile index 518d4e0..cd657ff 100644 --- a/Dockerfiles/gatewayI/Dockerfile +++ b/Dockerfiles/forContainerNet/gatewayI/Dockerfile @@ -8,6 +8,7 @@ RUN apk add npm && \ npm install express && \ npm install yargs && \ npm install systeminformation && \ + npm install request && \ wget http://homepages.laas.fr/smedjiah/tmp/gateway.js # set entry point for emulator gatekeeper (needed for compatibility with vim-emu datacenters) @@ -16,6 +17,6 @@ RUN apk add npm && \ #ENV VIM_EMU_CMD_STOP "TODO at shutdown" # CMD should always point to /bin/bash to not block the emulator (sh for node:alpine) -CMD node /gateway/gateway.js --local_ip "127.0.0.1" --local_port 8181 --local_name "gwi" --remote_ip "127.0.0.1" --remote_port 8080 --remote_name "srv" #comment when on ContainerNet datacenter +CMD node /gateway/gateway.js --local_ip "172.17.0.4" --local_port 8181 --local_name "gwi" --remote_ip "172.17.0.2" --remote_port 8080 --remote_name "srv" #comment when on ContainerNet datacenter #CMD /bin/sh #uncomment when on ContainerNet datacenter diff --git a/Dockerfiles/forContainerNet/server/Dockerfile b/Dockerfiles/forContainerNet/server/Dockerfile new file mode 100644 index 0000000..6d66145 --- /dev/null +++ b/Dockerfiles/forContainerNet/server/Dockerfile @@ -0,0 +1,21 @@ +# Choosing the image to use +FROM node:alpine + +# Installing required libraries +RUN apk add npm && \ + apk add bash && \ + mkdir server && \ + cd server && \ + npm install express && \ + npm install yargs && \ + npm install systeminformation && \ + wget http://homepages.laas.fr/smedjiah/tmp/server.js + +# set entry point for emulator gatekeeper (needed for compatibility with vim-emu datacenters) +ENV VIM_EMU_CMD "node /server/server.js --local_ip '127.0.0.1' --local_port '8080' --local_name 'srv'" #uncomment when on ContainerNet datacenter +#ENV VIM_EMU_CMD "TODO at startup" +#ENV VIM_EMU_CMD_STOP "TODO at shutdown" + +# CMD should always point to /bin/bash to not block the emulator (sh for node:alpine) +#CMD node /server/server.js --local_ip '127.0.0.1' --local_port '8080' --local_name 'srv' #comment when on ContainerNet datacenter +CMD /bin/bash #uncomment when on ContainerNet datacenter diff --git a/Dockerfiles/device/Dockerfile b/Dockerfiles/forManualTest/device/Dockerfile similarity index 97% rename from Dockerfiles/device/Dockerfile rename to Dockerfiles/forManualTest/device/Dockerfile index 0536fae..c1c89b6 100644 --- a/Dockerfiles/device/Dockerfile +++ b/Dockerfiles/forManualTest/device/Dockerfile @@ -8,6 +8,7 @@ RUN apk add npm && \ npm install express && \ npm install yargs && \ npm install systeminformation && \ + npm install request && \ wget http://homepages.laas.fr/smedjiah/tmp/device.js # set entry point for emulator gatekeeper (needed for compatibility with vim-emu datacenters) diff --git a/Dockerfiles/forManualTest/gatewayF/Dockerfile b/Dockerfiles/forManualTest/gatewayF/Dockerfile new file mode 100644 index 0000000..86037f3 --- /dev/null +++ b/Dockerfiles/forManualTest/gatewayF/Dockerfile @@ -0,0 +1,24 @@ +# Choosing the image to use +FROM node:alpine + +# Installing required libraries +RUN apk add npm && \ + mkdir gateway && \ + cd gateway && \ + npm install express && \ + npm install yargs && \ + npm install systeminformation && \ + npm install request && \ + wget http://homepages.laas.fr/smedjiah/tmp/gateway.js + +# set entry point for emulator gatekeeper (needed for compatibility with vim-emu datacenters) +#ENV VIM_EMU_CMD "node /gateway/gateway.js --local_ip "127.0.0.1" --local_port 8282 --local_name "gwf1" --remote_ip "127.0.0.1" --remote_port 8181 --remote_name "gwi" + #uncomment when on ContainerNet datacenter +#ENV VIM_EMU_CMD "TODO at startup" +#ENV VIM_EMU_CMD_STOP "TODO at shutdown" + +# CMD should always point to /bin/bash to not block the emulator (sh for node:alpine) +CMD node /gateway/gateway.js --local_ip "127.0.0.1" --local_port 8282 --local_name "gwf1" --remote_ip "127.0.0.1" --remote_port 8181 --remote_name "gwi" + #comment when on ContainerNet datacenter +#CMD /bin/sh #uncomment when on ContainerNet datacenter + diff --git a/Dockerfiles/forManualTest/gatewayI/Dockerfile b/Dockerfiles/forManualTest/gatewayI/Dockerfile new file mode 100644 index 0000000..cd657ff --- /dev/null +++ b/Dockerfiles/forManualTest/gatewayI/Dockerfile @@ -0,0 +1,22 @@ +# Choosing the image to use +FROM node:alpine + +# Installing required libraries +RUN apk add npm && \ + mkdir gateway && \ + cd gateway && \ + npm install express && \ + npm install yargs && \ + npm install systeminformation && \ + npm install request && \ + wget http://homepages.laas.fr/smedjiah/tmp/gateway.js + +# set entry point for emulator gatekeeper (needed for compatibility with vim-emu datacenters) +#ENV VIM_EMU_CMD "node /gateway/gateway.js --local_ip "127.0.0.1" --local_port 8181 --local_name "gwi" --remote_ip "127.0.0.1" --remote_port 8080 --remote_name "srv" #uncomment when on ContainerNet datacenter +#ENV VIM_EMU_CMD "TODO at startup" +#ENV VIM_EMU_CMD_STOP "TODO at shutdown" + +# CMD should always point to /bin/bash to not block the emulator (sh for node:alpine) +CMD node /gateway/gateway.js --local_ip "172.17.0.4" --local_port 8181 --local_name "gwi" --remote_ip "172.17.0.2" --remote_port 8080 --remote_name "srv" #comment when on ContainerNet datacenter +#CMD /bin/sh #uncomment when on ContainerNet datacenter + diff --git a/Dockerfiles/server/Dockerfile b/Dockerfiles/forManualTest/server/Dockerfile similarity index 100% rename from Dockerfiles/server/Dockerfile rename to Dockerfiles/forManualTest/server/Dockerfile diff --git a/topologie/topology_containernet.py b/topologie/topology_containernet.py new file mode 100755 index 0000000..3429ea9 --- /dev/null +++ b/topologie/topology_containernet.py @@ -0,0 +1,35 @@ +#!/usr/bin/python +""" +This is the most simple example to showcase Containernet. +""" +from mininet.net import Containernet +from mininet.node import Controller +from mininet.cli import CLI +from mininet.link import TCLink +from mininet.log import info, setLogLevel +setLogLevel('info') + +net = Containernet(controller=Controller) +info('*** Adding controller\n') +net.addController('c0') +info('*** Adding docker containers\n') +d1 = net.addDocker('srv', ip='10.0.0.3', dimage="server:version1", network="net") +d2 = net.addDocker('gwi', ip='10.0.0.6', dimage="server:version1", network="net") +#gwf1 = net.addDocker('gwf1', ip='10.0.0.9', dimage="gwf:version1") +#dev1 = net.addDocker('dev1', ip='10.0.0.12', dimage="dev:version1") +info('*** Adding switches\n') +s1 = net.addSwitch('s1') +s2 = net.addSwitch('s2') +info('*** Creating links\n') +net.addLink(d1, s1) +net.addLink(s1, s2, cls=TCLink, delay='100ms', bw=1) +net.addLink(s2, d2) +info('*** Starting network\n') +net.start() +info('*** Testing connectivity\n') +net.ping([d1, d2]) +info('*** Running CLI\n') +CLI(net) +info('*** Stopping network') +net.stop() +