From: stevenvanrossem Date: Sat, 22 Apr 2017 17:37:29 +0000 (+0200) Subject: add demo topologies and cadvisor startup args X-Git-Tag: v3.1~30^2~26 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=3df73e8cdfb04c55df6bf49c42425d8e9dceb2f8;p=osm%2Fvim-emu.git add demo topologies and cadvisor startup args --- diff --git a/src/emuvim/dcemulator/monitoring.py b/src/emuvim/dcemulator/monitoring.py index 985a1c1..01c0918 100755 --- a/src/emuvim/dcemulator/monitoring.py +++ b/src/emuvim/dcemulator/monitoring.py @@ -504,7 +504,9 @@ class DCNetworkMonitor(): "--publish={0}:8080".format(port), "--name=cadvisor", "--label",'com.containernet=""', - "google/cadvisor:latest" + "google/cadvisor:latest", + "--storage_duration=1m0s", + "--allow_dynamic_housekeeping=true", ] logging.info('Start cAdvisor container {0}'.format(cmd)) return Popen(cmd) diff --git a/src/emuvim/examples/demo_topo_1pop.py b/src/emuvim/examples/demo_topo_1pop.py new file mode 100755 index 0000000..9c851ca --- /dev/null +++ b/src/emuvim/examples/demo_topo_1pop.py @@ -0,0 +1,87 @@ +""" +Copyright (c) 2015 SONATA-NFV +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 [, ANY ADDITIONAL AFFILIATION] +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). +""" +""" +A simple topology with two PoPs for the y1 demo story board. + + (dc1) <<-->> s1 <<-->> (dc2) + +- SAP deployment enabled +- learning switch enabled +""" + +import logging +from mininet.log import setLogLevel +from emuvim.dcemulator.net import DCNetwork +from emuvim.api.rest.rest_api_endpoint import RestApiEndpoint +from emuvim.api.sonata import SonataDummyGatekeeperEndpoint +from mininet.node import RemoteController +import os + +logging.basicConfig(level=logging.INFO) + + +def create_topology1(): + # create topology + net = DCNetwork(controller=RemoteController, monitor=True, enable_learning=True) + dc1 = net.addDatacenter("dc1") + + + # add the command line interface endpoint to each DC (REST API) + rapi1 = RestApiEndpoint("0.0.0.0", 5001) + rapi1.connectDCNetwork(net) + rapi1.connectDatacenter(dc1) + # run API endpoint server (in another thread, don't block) + rapi1.start() + + + # specify a vnfd file to be deployed as internal SAP: + sap_vnfd = 'vepc_sap_vnfd.yml' + dir_path = os.path.dirname(__file__) + sap_vnfd_path = os.path.join(dir_path, sap_vnfd) + # sap_vnfd_path = None + # add the SONATA dummy gatekeeper to each DC + sdkg1 = SonataDummyGatekeeperEndpoint("0.0.0.0", 5000, deploy_sap=True, auto_deploy=True, + docker_management=True, auto_delete=True, + sap_vnfd_path=sap_vnfd_path) + sdkg1.connectDatacenter(dc1) + # run the dummy gatekeeper (in another thread, don't block) + sdkg1.start() + + # start the emulation platform + net.start() + net.CLI() + net.stop() + + +def main(): + setLogLevel('info') # set Mininet loglevel + create_topology1() + + +if __name__ == '__main__': + main() diff --git a/src/emuvim/examples/demo_topo_3pop.py b/src/emuvim/examples/demo_topo_3pop.py new file mode 100755 index 0000000..bf3cc20 --- /dev/null +++ b/src/emuvim/examples/demo_topo_3pop.py @@ -0,0 +1,87 @@ +""" +Copyright (c) 2015 SONATA-NFV +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 [, ANY ADDITIONAL AFFILIATION] +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). +""" +""" +A simple topology with two PoPs for the y1 demo story board. + + (dc1) <<-->> s1 <<-->> (dc2) + +- SAP deployment enabled +- learning switch enabled +""" + +import logging +from mininet.log import setLogLevel +from emuvim.dcemulator.net import DCNetwork +from emuvim.api.rest.rest_api_endpoint import RestApiEndpoint +from emuvim.api.sonata import SonataDummyGatekeeperEndpoint +from mininet.node import RemoteController +import os + +logging.basicConfig(level=logging.INFO) + + +def create_topology1(): + # create topology + net = DCNetwork(controller=RemoteController, monitor=False, enable_learning=True) + dc1 = net.addDatacenter("dc1") + + + # add the command line interface endpoint to each DC (REST API) + rapi1 = RestApiEndpoint("0.0.0.0", 5001) + rapi1.connectDCNetwork(net) + rapi1.connectDatacenter(dc1) + # run API endpoint server (in another thread, don't block) + rapi1.start() + + + # specify a vnfd file to be deployed as internal SAP: + sap_vnfd = 'vepc_sap_vnfd.yml' + dir_path = os.path.dirname(__file__) + sap_vnfd_path = os.path.join(dir_path, sap_vnfd) + # sap_vnfd_path = None + # add the SONATA dummy gatekeeper to each DC + sdkg1 = SonataDummyGatekeeperEndpoint("0.0.0.0", 5000, deploy_sap=True, auto_deploy=True, + docker_management=True, auto_delete=True, + sap_vnfd_path=sap_vnfd_path) + sdkg1.connectDatacenter(dc1) + # run the dummy gatekeeper (in another thread, don't block) + sdkg1.start() + + # start the emulation platform + net.start() + net.CLI() + net.stop() + + +def main(): + setLogLevel('info') # set Mininet loglevel + create_topology1() + + +if __name__ == '__main__': + main()