mise a jour
This commit is contained in:
parent
a6aeba0a24
commit
21461ebaa6
8 changed files with 145 additions and 20 deletions
19
Dockerfiles/forContainerNet/bootconf/Dockerfile
Normal file
19
Dockerfiles/forContainerNet/bootconf/Dockerfile
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# Choosing the image to use
|
||||||
|
FROM node:buster
|
||||||
|
|
||||||
|
# Installing required libraries
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y net-tools iputils-ping python-pip && \
|
||||||
|
pip install flask && \
|
||||||
|
mkdir mydir && \
|
||||||
|
cd mydir
|
||||||
|
|
||||||
|
COPY bootstrap_server.py /mydir
|
||||||
|
|
||||||
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
|
||||||
|
RUN echo "nohup python /mydir/bootstrap_server.py &" > start.sh && echo "/bin/bash" >> start.sh && chmod 777 start.sh
|
||||||
|
|
||||||
|
# Mandatory entrypoint in containernet
|
||||||
|
ENTRYPOINT ./start.sh
|
||||||
|
|
15
Dockerfiles/forContainerNet/bootconf/bootstrap_server.py
Executable file
15
Dockerfiles/forContainerNet/bootconf/bootstrap_server.py
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@app.route("/getmyconfig/<string:my_ip>")
|
||||||
|
def configurations_giver(my_ip):
|
||||||
|
configs = ""
|
||||||
|
if my_ip=='10.0.0.3':
|
||||||
|
configs = '--local_name xxx --remote_ip xxx --remote_name xxx'
|
||||||
|
return configs
|
||||||
|
|
||||||
|
if __name__=='__main__':
|
||||||
|
app.run(debug=False, host='0.0.0.0', port=5555)
|
|
@ -1,6 +1,14 @@
|
||||||
# Choosing the image to use
|
# Choosing the image to use
|
||||||
FROM node:buster
|
FROM node:buster
|
||||||
|
|
||||||
|
# Defining variables to allow flexibility (each variable can be set directly within our topology deployment script)
|
||||||
|
ENV local_ip=127.0.0.1
|
||||||
|
ENV local_port=9001
|
||||||
|
ENV local_name=dev1
|
||||||
|
ENV remote_ip=127.0.0.1
|
||||||
|
ENV remote_port=8282
|
||||||
|
ENV remote_name=gwf1
|
||||||
|
|
||||||
# Installing required libraries
|
# Installing required libraries
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y net-tools iputils-ping && \
|
apt-get install -y net-tools iputils-ping && \
|
||||||
|
@ -12,7 +20,7 @@ RUN apt-get update && \
|
||||||
npm install request && \
|
npm install request && \
|
||||||
wget http://homepages.laas.fr/smedjiah/tmp/device.js
|
wget http://homepages.laas.fr/smedjiah/tmp/device.js
|
||||||
|
|
||||||
ENV LAUNCHER "node /mydir/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"
|
ENV LAUNCHER "node /mydir/device.js --local_ip '$local_ip' --local_port $local_port --local_name '$local_name' --remote_ip '$remote_ip' --remote_port $remote_port --remote_name '$remote_name' --send_period 3000"
|
||||||
|
|
||||||
ENV VIM_EMU_CMD "nohup $LAUNCHER &"
|
ENV VIM_EMU_CMD "nohup $LAUNCHER &"
|
||||||
#ENV VIM_EMU_CMD_STOP "TODO at shutdown"
|
#ENV VIM_EMU_CMD_STOP "TODO at shutdown"
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
# Choosing the image to use
|
# Choosing the image to use
|
||||||
FROM node:buster
|
FROM node:buster
|
||||||
|
|
||||||
# Defining variables to allow flexibility (each variable can be set while building through the parameter --build-arg <varname>=<value>)
|
# Defining variables to allow flexibility (each variable can be set directly within our topology deployment script)
|
||||||
ARG local_ip=127.0.0.1
|
ENV local_ip=127.0.0.1
|
||||||
ARG local_port=8282
|
ENV local_port=8282
|
||||||
ARG local_name=gwf1
|
ENV local_name=gwf1
|
||||||
ARG remote_ip=127.0.0.1
|
ENV remote_ip=127.0.0.1
|
||||||
ARG remote_port=8181
|
ENV remote_port=8181
|
||||||
ARG remote_name=gwi
|
ENV remote_name=gwi
|
||||||
|
|
||||||
# Installing required libraries
|
# Installing required libraries
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
# Choosing the image to use
|
# Choosing the image to use
|
||||||
FROM node:buster
|
FROM node:buster
|
||||||
|
|
||||||
# Defining variables to allow flexibility (each variable can be set while building through the parameter --build-arg <varname>=<value>)
|
# Defining variables to allow flexibility (each variable can be set directly within our topology deployment script)
|
||||||
ARG local_ip=127.0.0.1
|
ENV local_ip=127.0.0.1
|
||||||
ARG local_port=8181
|
ENV local_port=8181
|
||||||
ARG local_name=gwi
|
ENV local_name=gwi
|
||||||
ARG remote_ip=127.0.0.1
|
ENV remote_ip=127.0.0.1
|
||||||
ARG remote_port=8080
|
ENV remote_port=8080
|
||||||
ARG remote_name=srv
|
ENV remote_name=srv
|
||||||
|
|
||||||
# Installing required libraries
|
# Installing required libraries
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
# Choosing the image to use
|
# Choosing the image to use
|
||||||
FROM node:buster
|
FROM node:buster
|
||||||
|
|
||||||
# Defining variables to allow flexibility (each variable can be set while building through the parameter --build-arg <varname>=<value>)
|
# Defining variables to allow flexibility (each variable can be set directly within our topology deployment script)
|
||||||
ARG local_ip=127.0.0.1
|
ENV local_ip=127.0.0.1
|
||||||
ARG local_port=8080
|
ENV local_port=8080
|
||||||
ARG local_name=srv
|
ENV local_name=srv
|
||||||
|
|
||||||
# Installing required libraries
|
# Installing required libraries
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
|
|
83
topologie/dc_topology.py
Executable file
83
topologie/dc_topology.py
Executable file
|
@ -0,0 +1,83 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# Copyright (c) 2015 SONATA-NFV and Paderborn University
|
||||||
|
# ALL RIGHTS RESERVED.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
# Neither the name of the SONATA-NFV, Paderborn University
|
||||||
|
# nor the names of its contributors may be used to endorse or promote
|
||||||
|
# products derived from this software without specific prior written
|
||||||
|
# permission.
|
||||||
|
#
|
||||||
|
# This work has been performed in the framework of the SONATA project,
|
||||||
|
# funded by the European Commission under Grant number 671517 through
|
||||||
|
# the Horizon 2020 and 5G-PPP programmes. The authors would like to
|
||||||
|
# acknowledge the contributions of their colleagues of the SONATA
|
||||||
|
# partner consortium (www.sonata-nfv.eu).
|
||||||
|
import logging
|
||||||
|
from mininet.log import setLogLevel, info
|
||||||
|
from emuvim.dcemulator.net import DCNetwork
|
||||||
|
from emuvim.api.rest.rest_api_endpoint import RestApiEndpoint
|
||||||
|
from emuvim.api.openstack.openstack_api_endpoint import OpenstackApiEndpoint
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
setLogLevel('info') # set Mininet loglevel
|
||||||
|
logging.getLogger('werkzeug').setLevel(logging.DEBUG)
|
||||||
|
logging.getLogger('api.openstack.base').setLevel(logging.DEBUG)
|
||||||
|
logging.getLogger('api.openstack.compute').setLevel(logging.DEBUG)
|
||||||
|
logging.getLogger('api.openstack.keystone').setLevel(logging.DEBUG)
|
||||||
|
logging.getLogger('api.openstack.nova').setLevel(logging.DEBUG)
|
||||||
|
logging.getLogger('api.openstack.neutron').setLevel(logging.DEBUG)
|
||||||
|
logging.getLogger('api.openstack.heat').setLevel(logging.DEBUG)
|
||||||
|
logging.getLogger('api.openstack.heat.parser').setLevel(logging.DEBUG)
|
||||||
|
logging.getLogger('api.openstack.glance').setLevel(logging.DEBUG)
|
||||||
|
logging.getLogger('api.openstack.helper').setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
|
def create_topology():
|
||||||
|
net = DCNetwork(monitor=False, enable_learning=True)
|
||||||
|
|
||||||
|
dc1 = net.addDatacenter("dc1")
|
||||||
|
# add OpenStack-like APIs to the emulated DC
|
||||||
|
api1 = OpenstackApiEndpoint("0.0.0.0", 6001)
|
||||||
|
api1.connect_datacenter(dc1)
|
||||||
|
api1.start()
|
||||||
|
api1.connect_dc_network(net)
|
||||||
|
# add the command line interface endpoint to the emulated DC (REST API)
|
||||||
|
rapi1 = RestApiEndpoint("0.0.0.0", 5001)
|
||||||
|
rapi1.connectDCNetwork(net)
|
||||||
|
rapi1.connectDatacenter(dc1)
|
||||||
|
rapi1.start()
|
||||||
|
d1 = net.addDocker('srv', ip='10.0.0.3', dimage="server:topo")
|
||||||
|
d2 = net.addDocker('gwi', ip='10.0.0.6', dimage="server:topo")
|
||||||
|
info('*** Adding switches\n')
|
||||||
|
s1 = net.addSwitch('s1')
|
||||||
|
s2 = net.addSwitch('s2')
|
||||||
|
info('*** Creating links\n')
|
||||||
|
net.addLink(dc1, s1)
|
||||||
|
net.addLink(d1, s1)
|
||||||
|
net.addLink(s1, s2)
|
||||||
|
net.addLink(s2, d2)
|
||||||
|
info('*** Starting network\n')
|
||||||
|
net.start()
|
||||||
|
net.CLI()
|
||||||
|
# when the user types exit in the CLI, we stop the emulator
|
||||||
|
net.stop()
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
create_topology()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
|
@ -58,7 +58,7 @@ def create_topology():
|
||||||
rapi1.connectDCNetwork(net)
|
rapi1.connectDCNetwork(net)
|
||||||
rapi1.connectDatacenter(dc1)
|
rapi1.connectDatacenter(dc1)
|
||||||
rapi1.start()
|
rapi1.start()
|
||||||
d1 = net.addDocker('srv', ip='10.0.0.3', dimage="server:topo")
|
d1 = net.addDocker('srv', ip='10.0.0.3', dimage="server:topo", environment={'local_port':'9999'})
|
||||||
d2 = net.addDocker('gwi', ip='10.0.0.6', dimage="server:topo")
|
d2 = net.addDocker('gwi', ip='10.0.0.6', dimage="server:topo")
|
||||||
info('*** Adding switches\n')
|
info('*** Adding switches\n')
|
||||||
s1 = net.addSwitch('s1')
|
s1 = net.addSwitch('s1')
|
||||||
|
|
Loading…
Reference in a new issue