From d8fd9372be1e135f2e11efe2d69c0c16bbcb7be4 Mon Sep 17 00:00:00 2001 From: peusterm Date: Wed, 17 Jan 2018 15:15:22 +0100 Subject: [PATCH 1/1] Pingpong example for OSM-to-vim-emu deployments. This commit cleans up the outdated emulator examples from the SONATA project and adds example VNFs (ping and pong) as well as a corresponding NSD as an up-to-date example that is tested with OSM rel. THREE. The added example service and VNFs is used by the end-to-end example documented in the OSM wiki. Goal is to give users an pre-defined example on how to on-board and instantiate a network service on the emulator using OSM. Also improved README.md. Change-Id: I45a00f1b6acf1664a96b22e21be4c23612f581cf Signed-off-by: peusterm --- README.md | 66 +++++--- Vagrantfile | 151 ------------------ src/emuvim/examples/custom_sap_vnfd.yml | 75 --------- src/emuvim/examples/demo_topo_1pop.py | 87 ---------- src/emuvim/examples/demo_topo_3pop.py | 96 ----------- .../monitoring_demo_topology_restapi.py | 145 ----------------- src/emuvim/examples/profiling.py | 116 -------------- .../examples/resource_model_demo_topology.py | 106 ------------ .../services/pingpong_ns/pingpong_nsd.yaml | 98 ++++++++++++ .../examples/services/pingpong_nsd.tar.gz | Bin 0 -> 1498 bytes src/emuvim/examples/simple_topology.py | 125 --------------- src/emuvim/examples/son-monitor_test_topo.py | 110 ------------- src/emuvim/examples/sonata_simple.py | 78 --------- src/emuvim/examples/sonata_simple_topology.py | 80 ---------- .../examples/sonata_y1_demo_topology_1.py | 81 ---------- ...y1_demo_topology_1_w_ls_and_mon_and_sap.py | 83 ---------- .../sonata_y1_demo_topology_1_w_ls_and_sap.py | 83 ---------- src/emuvim/examples/vnfs/ping.tar.gz | Bin 0 -> 1328 bytes .../examples/vnfs/ping_vnf/ping_vnfd.yaml | 77 +++++++++ src/emuvim/examples/vnfs/pong.tar.gz | Bin 0 -> 1361 bytes .../examples/vnfs/pong_vnf/pong_vnfd.yaml | 77 +++++++++ 21 files changed, 293 insertions(+), 1441 deletions(-) delete mode 100755 Vagrantfile delete mode 100755 src/emuvim/examples/custom_sap_vnfd.yml delete mode 100755 src/emuvim/examples/demo_topo_1pop.py delete mode 100755 src/emuvim/examples/demo_topo_3pop.py delete mode 100755 src/emuvim/examples/monitoring_demo_topology_restapi.py delete mode 100755 src/emuvim/examples/profiling.py delete mode 100755 src/emuvim/examples/resource_model_demo_topology.py create mode 100644 src/emuvim/examples/services/pingpong_ns/pingpong_nsd.yaml create mode 100644 src/emuvim/examples/services/pingpong_nsd.tar.gz delete mode 100755 src/emuvim/examples/simple_topology.py delete mode 100755 src/emuvim/examples/son-monitor_test_topo.py delete mode 100755 src/emuvim/examples/sonata_simple.py delete mode 100755 src/emuvim/examples/sonata_simple_topology.py delete mode 100755 src/emuvim/examples/sonata_y1_demo_topology_1.py delete mode 100755 src/emuvim/examples/sonata_y1_demo_topology_1_w_ls_and_mon_and_sap.py delete mode 100755 src/emuvim/examples/sonata_y1_demo_topology_1_w_ls_and_sap.py create mode 100644 src/emuvim/examples/vnfs/ping.tar.gz create mode 100644 src/emuvim/examples/vnfs/ping_vnf/ping_vnfd.yaml create mode 100644 src/emuvim/examples/vnfs/pong.tar.gz create mode 100644 src/emuvim/examples/vnfs/pong_vnf/pong_vnfd.yaml diff --git a/README.md b/README.md index ba22ec3..0c59264 100755 --- a/README.md +++ b/README.md @@ -44,41 +44,54 @@ If you use the emulation platform for your research and/or other publications, p ## Installation -There are three ways to install and use the emulation platform. The bare-metal installation requires a freshly installed Ubuntu 16.04 LTS and is done by an ansible playbook. The second option is to use a nested Docker environment to run the emulator inside a Docker container. The third option is to use Vagrant to create a VirtualBox-based VM on your machine that contains the pre-installed and configured emulator. +There are multiple ways to install and use the emulation platform. The easiest way is the automated installation using the OSM installer. The bare-metal installation requires a freshly installed Ubuntu 16.04 LTS and is done by an ansible playbook. Another option is to use a nested Docker environment to run the emulator inside a Docker container. -### Option 1: Bare-metal installation +### Automated installation (recommended) -* Requires: Ubuntu 16.04 LTS -* `sudo apt-get install ansible git aptitude` +```sh +./install_osm.sh --lxdimages --vimemu +``` -#### 1. Containernet +This command will install OSM (as LXC containers) as well as the emulator (as a Docker container) on a local machine. It is recommended to use a machine with Ubuntu 16.04. -* `cd` -* `git clone https://github.com/containernet/containernet.git` -* `cd ~/containernet/ansible` -* `sudo ansible-playbook -i "localhost," -c local install.yml` +### Manual installation -#### 2. vim-emu +#### Option 1: Bare-metal installation -* `cd` -* `git clone https://osm.etsi.org/gerrit/osm/vim-emu.git` -* `cd ~/vim-emu/ansible` -* `sudo ansible-playbook -i "localhost," -c local install.yml` +```sh +sudo apt-get install ansible git aptitude +``` -### Option 2: Nested Docker Deployment +##### Step 1. Containernet installation + +```sh +cd +git clone https://github.com/containernet/containernet.git +cd ~/containernet/ansible +sudo ansible-playbook -i "localhost," -c local install.yml +``` + +##### Step 2. vim-emu installation + +```sh +cd +git clone https://osm.etsi.org/gerrit/osm/vim-emu.git +cd ~/vim-emu/ansible +sudo ansible-playbook -i "localhost," -c local install.yml +``` + +#### Option 2: Nested Docker Deployment This option requires a Docker installation on the host machine on which the emulator should be deployed. -* `git clone https://osm.etsi.org/gerrit/osm/vim-emu.git` -* `cd ~/vim-emu` -* Build the container: `docker build -t vim-emu-img .` -* Run the (interactive) container: `docker run --name vim-emu -it --rm --privileged --pid='host' -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img /bin/bash` +```sh +git clone https://osm.etsi.org/gerrit/osm/vim-emu.git +cd ~/vim-emu +# build the container: +docker build -t vim-emu-img . +# run the (interactive) container: +docker run --name vim-emu -it --rm --privileged --pid='host' -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img /bin/bash +``` -### Option 3: Vagrant Installation -* Request VirtualBox and Vagrant to be installed on the system. -* `git clone https://osm.etsi.org/gerrit/osm/vim-emu.git` -* `cd ~/vim-emu` -* `vagrant up` -* `vagrant ssh` to enter the new VM in which the emulator is installed. ## Usage @@ -96,8 +109,11 @@ This simple example shows how to start the emulator with a simple topology (term * `containernet> vnf1 ifconfig` * `containernet> vnf1 ping -c 2 vnf2` +A more advanced example that includes OSM can be found in the [official vim-emu documentation in the OSM wiki](https://osm.etsi.org/wikipub/index.php/VIM_emulator). + ### Further documentation and useful links +* [Official vim-emu documentation in the OSM wiki](https://osm.etsi.org/wikipub/index.php/VIM_emulator) * [Full CLI command documentation](https://github.com/sonata-nfv/son-emu/wiki/CLI-Command-Overview) * [Requirements for Docker containers executed by the emulator](https://github.com/sonata-nfv/son-emu/wiki/Container-Requirements) * [REST API](https://github.com/sonata-nfv/son-emu/wiki/APIs) diff --git a/Vagrantfile b/Vagrantfile deleted file mode 100755 index a54050e..0000000 --- a/Vagrantfile +++ /dev/null @@ -1,151 +0,0 @@ -# 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). - -# -*- mode: ruby -*- -# vi: set ft=ruby : - -# -# This Vagrant file create a son-emu VM. -# -# -# All Vagrant configuration is done below. The "2" in Vagrant.configure -# configures the configuration version (we support older styles for -# backwards compatibility). Please don't change it unless you know what -# you're doing. -Vagrant.configure(2) do |config| - # The most common configuration options are documented and commented below. - # For a complete reference, please see the online documentation at - # https://docs.vagrantup.com. - - # Every Vagrant development environment requires a box. You can search for - # boxes at https://atlas.hashicorp.com/search. - - # there is a bug in the /etc/hosts of 16.04: https://bugs.launchpad.net/ubuntu/+source/livecd-rootfs/+bug/1561250 - #config.vm.box = "ubuntu/xenial64" - - # so we use 14.04 for now - config.vm.box = "ubuntu/xenial64" - - - # Disable automatic box update checking. If you disable this, then - # boxes will only be checked for updates when the user runs - # `vagrant box outdated`. This is not recommended. - # config.vm.box_check_update = false - - # Create a forwarded port mapping which allows access to a specific port - # within the machine from a port on the host machine. In the example below, - # accessing "localhost:8080" will access port 80 on the guest machine. - config.vm.network "forwarded_port", guest: 5000, host: 5000 # dummy gatekeeper - config.vm.network "forwarded_port", guest: 5001, host: 5001 # REST API - config.vm.network "forwarded_port", guest: 8081, host: 8081 # cAdvisor - config.vm.network "forwarded_port", guest: 9091, host: 9091 # push gateway - - # Create a private network, which allows host-only access to the machine - # using a specific IP. - # config.vm.network "private_network", ip: "192.168.33.10" - - # Create a public network, which generally matched to bridged network. - # Bridged networks make the machine appear as another physical device on - # your network. - # config.vm.network "public_network" - - # Share an additional folder to the guest VM. The first argument is - # the path on the host to the actual folder. The second argument is - # the path on the guest to mount the folder. And the optional third - # argument is a set of non-required options. - config.vm.synced_folder ".", "/vagrant", disabled: true - config.vm.synced_folder ".", "/home/ubuntu/son-emu" - - - # Provider-specific configuration so you can fine-tune various - # backing providers for Vagrant. These expose provider-specific options. - # Example for VirtualBox: - # - config.vm.provider "virtualbox" do |vb| - vb.name = "son-emu" - # # Display the VirtualBox GUI when booting the machine - # vb.gui = true - # - # # Customize the amount of memory on the VM: - vb.memory = "1024" - end - # - # View the documentation for the provider you are using for more - # information on available options. - - # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies - # such as FTP and Heroku are also available. See the documentation at - # https://docs.vagrantup.com/v2/push/atlas.html for more information. - # config.push.define "atlas" do |push| - # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME" - # end - - # Enable provisioning with a shell script. Additional provisioners such as - # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the - # documentation for more information about their specific syntax and use. - config.vm.provision "shell", inline: <<-SHELL - sudo apt-get update - sudo apt-get install -y git ansible - sudo echo "localhost ansible_connection=local" >> /etc/ansible/hosts - # install containernet - git clone https://github.com/containernet/containernet.git - echo "Installing containernet (will take some time ~30 minutes) ..." - cd /home/ubuntu/containernet/ansible - sudo ansible-playbook install.yml - - # install son-emu - echo "Installing son-emu (will take some time) ..." - cd /home/ubuntu/son-emu/ansible - sudo ansible-playbook install.yml - - # execute son-emu tests at the end to validate installation - echo "Running son-emu unit tests to validate installation" - cd /home/ubuntu/son-emu - sudo python setup.py develop - sudo py.test -v src/emuvim/test/unittests - - # install son-cli - sudo apt-get install -y python3.4 python3-dev python3-pip libyaml-dev build-essential - sudo pip install virtualenv - sudo pip install numpy - sudo pip install scipy - - # place motd - cd /home/ubuntu/son-emu - sudo cp utils/vagrant/motd /etc/motd - - # pre-fetch sonata example vnfs from DockerHub - echo "Fetching SONATA example VNF container from DockerHub/sonatanfv" - sudo docker pull sonatanfv/sonata-empty-vnf - sudo docker pull sonatanfv/sonata-iperf3-vnf - sudo docker pull sonatanfv/sonata-snort-ids-vnf - sudo docker pull sonatanfv/sonata-ovs1-vnf - sudo docker pull sonatanfv/sonata-ryu-vnf - sudo docker pull sonatanfv/sonata-vtc-vnf - sudo docker pull sonatanfv/son-emu-sap - SHELL - -end diff --git a/src/emuvim/examples/custom_sap_vnfd.yml b/src/emuvim/examples/custom_sap_vnfd.yml deleted file mode 100755 index 8d1b260..0000000 --- a/src/emuvim/examples/custom_sap_vnfd.yml +++ /dev/null @@ -1,75 +0,0 @@ ---- -# Copyright (c) 2017 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). - -## -## Some general information regarding this -## VNF descriptor. -## -descriptor_version: "vnfd-schema-01" -vendor: "eu.sonata-nfv" -name: "sap_vnf" -version: "0.1" -author: "Steven Van Rossem, Ghent University, steven.vanrossem@intec.ugent.be" -description: "An empty ubuntu VNF; used as SAP" -## -## The virtual deployment unit. -## -virtual_deployment_units: - - id: "1" - vm_image: "sonatanfv/son-emu-sap" - vm_image_format: "docker" - resource_requirements: - cpu: - vcpus: 1 - memory: - size: 1 - size_unit: "GB" - storage: - size: 1 - size_unit: "GB" - connection_points: - - id: "vdu01:cp01" - type: "interface" - -## -## The virtual links that interconnect -## the different connections points. -## -virtual_links: - - id: "port" - connectivity_type: "E-Line" - connection_points_reference: - - "vdu01:cp02" - - "port" - -## -## The VNF connection points to the -## outside world. -## -connection_points: - - id: "port" - type: "interface" diff --git a/src/emuvim/examples/demo_topo_1pop.py b/src/emuvim/examples/demo_topo_1pop.py deleted file mode 100755 index aaee446..0000000 --- a/src/emuvim/examples/demo_topo_1pop.py +++ /dev/null @@ -1,87 +0,0 @@ -""" -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 = 'custom_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 deleted file mode 100755 index aee5f91..0000000 --- a/src/emuvim/examples/demo_topo_3pop.py +++ /dev/null @@ -1,96 +0,0 @@ -""" -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") - dc2 = net.addDatacenter("dc2") - dc3 = net.addDatacenter("dc3") - s1 = net.addSwitch("s1") - net.addLink(dc1, s1) - net.addLink(dc2, s1) - net.addLink(dc3, s1) - - # add the command line interface endpoint to each DC (REST API) - rapi1 = RestApiEndpoint("0.0.0.0", 5001) - rapi1.connectDCNetwork(net) - rapi1.connectDatacenter(dc1) - rapi1.connectDatacenter(dc2) - rapi1.connectDatacenter(dc3) - # run API endpoint server (in another thread, don't block) - rapi1.start() - - - # specify a vnfd file to be deployed as internal SAP: - sap_vnfd = 'custom_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) - sdkg1.connectDatacenter(dc2) - sdkg1.connectDatacenter(dc3) - # 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/monitoring_demo_topology_restapi.py b/src/emuvim/examples/monitoring_demo_topology_restapi.py deleted file mode 100755 index 0813d23..0000000 --- a/src/emuvim/examples/monitoring_demo_topology_restapi.py +++ /dev/null @@ -1,145 +0,0 @@ -""" -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). -""" -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.zerorpc.compute import ZeroRpcApiEndpoint -from emuvim.api.zerorpc.network import ZeroRpcApiEndpointDCNetwork - - -logging.basicConfig(level=logging.INFO) - - -def create_topology1(): - """ - 1. Create a data center network object (DCNetwork) with monitoring enabled - """ - net = DCNetwork(monitor=True, enable_learning=False) - - """ - 1b. Add endpoint APIs for the whole DCNetwork, - to access and control the networking from outside. - e.g., to setup forwarding paths between compute - instances aka. VNFs (represented by Docker containers), passing through - different switches and datacenters of the emulated topology - """ - # create monitoring api endpoint for backwards compatibility with zerorpc api - mon_api = ZeroRpcApiEndpointDCNetwork("0.0.0.0", 5151) - mon_api.connectDCNetwork(net) - mon_api.start() - - """ - 2. Add (logical) data centers to the topology - (each data center is one "bigswitch" in our simplified - first prototype) - """ - dc1 = net.addDatacenter("datacenter1") - dc2 = net.addDatacenter("datacenter2") - - """ - 3. You can add additional SDN switches for data center - interconnections to the network. - """ - s1 = net.addSwitch("s1") - - """ - 4. Add links between your data centers and additional switches - to define you topology. - These links can use Mininet's features to limit bw, add delay or jitter. - """ - - net.addLink(dc1, s1) - net.addLink(s1, dc2) - - - """ - 5. We want to access and control our data centers from the outside, - e.g., we want to connect an orchestrator to start/stop compute - resources aka. VNFs (represented by Docker containers in the emulated) - - So we need to instantiate API endpoints (e.g. a zerorpc or REST - interface). Depending on the endpoint implementations, we can connect - one or more data centers to it, which can then be controlled through - this API, e.g., start/stop/list compute instances. - """ - # keep the old zeroRPC interface for the prometheus metric query test - zapi1 = ZeroRpcApiEndpoint("0.0.0.0", 4242) - # connect data centers to this endpoint - zapi1.connectDatacenter(dc1) - zapi1.connectDatacenter(dc2) - # run API endpoint server (in another thread, don't block) - zapi1.start() - - # create a new instance of a endpoint implementation - # the restapi handles all compute, networking and monitoring commands in one api endpoint - api1 = RestApiEndpoint("0.0.0.0", 5001) - # connect data centers to this endpoint - api1.connectDatacenter(dc1) - api1.connectDatacenter(dc2) - # connect total network also, needed to do the chaining and monitoring - api1.connectDCNetwork(net) - # run API endpoint server (in another thread, don't block) - api1.start() - - """ - 5.1. For our example, we create a second endpoint to illustrate that - this is supported by our design. This feature allows us to have - one API endpoint for each data center. This makes the emulation - environment more realistic because you can easily create one - OpenStack-like REST API endpoint for *each* data center. - This will look like a real-world multi PoP/data center deployment - from the perspective of an orchestrator. - """ - #zapi2 = ZeroRpcApiEndpoint("0.0.0.0", 4343) - #zapi2.connectDatacenter(dc3) - #zapi2.connectDatacenter(dc4) - #zapi2.start() - - """ - 6. Finally we are done and can start our network (the emulator). - We can also enter the Mininet CLI to interactively interact - with our compute resources (just like in default Mininet). - But we can also implement fully automated experiments that - can be executed again and again. - """ - net.start() - net.CLI() - # when the user types exit in the CLI, we stop the emulator - net.stop() - - -def main(): - setLogLevel('info') # set Mininet loglevel - create_topology1() - - -if __name__ == '__main__': - main() diff --git a/src/emuvim/examples/profiling.py b/src/emuvim/examples/profiling.py deleted file mode 100755 index fd53317..0000000 --- a/src/emuvim/examples/profiling.py +++ /dev/null @@ -1,116 +0,0 @@ -""" -Copyright (c) 2017 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). -""" -""" -A simple topology with a single data center for usage in son-profile. - -""" - -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 -from time import sleep -import argparse -import sys -import signal - -logging.basicConfig() -LOG = logging.getLogger("sonata-profiling") -LOG.setLevel(logging.DEBUG) -logging.getLogger("werkzeug").setLevel(logging.WARNING) - -""" - Catches SIGINT and SIGTERM to shut the topology down gracefully. -""" -class GracefulKiller: - def __init__(self, to_be_killed): - signal.signal(signal.SIGINT, self.exit_gracefully) - signal.signal(signal.SIGTERM, self.exit_gracefully) - self.to_be_killed = to_be_killed - - def exit_gracefully(self, signum, frame): - self.to_be_killed.stop_it() - - -""" - A simple topology with only one data center which will stop when another thread tells it to or when a time limit is reached. -""" -class Profiling: - - stop_now = False - - """ - Set up a simple topology and start it - :port: the port the REST interface will be using, port+1 will be in use as well - """ - def __init__(self, port=5000): - GracefulKiller(self) - # create topology - self.net = DCNetwork(controller=RemoteController, monitor=False, enable_learning=False) - self.dc = self.net.addDatacenter("dc1") - - # add the command line interface endpoint to each DC (REST API) - self.rapi1 = RestApiEndpoint("0.0.0.0", port+1) - self.rapi1.connectDCNetwork(self.net) - self.rapi1.connectDatacenter(self.dc) - # run API endpoint server (in another thread, don't block) - self.rapi1.start() - - # add the SONATA dummy gatekeeper to each DC - self.sdkg1 = SonataDummyGatekeeperEndpoint("0.0.0.0", port, deploy_sap=False) - self.sdkg1.connectDatacenter(self.dc) - # run the dummy gatekeeper (in another thread, don't block) - self.sdkg1.start() - - - self.net.start() - LOG.info("Started topology") - while(not self.stop_now): - sleep(1) - self.net.stop() - LOG.info("Stopped topology") - - """ - Set stop value to stop the topology - """ - def stop_it(self): - self.stop_now = True - - -def main(args): - setLogLevel('info') # set Mininet loglevel - p = Profiling(args.get('port')) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser(description="Run a simple topology") - parser.add_argument('--port', '-p', type=int, help='the port for the REST interface', default=5000, required=False, dest='port') - arg_list = vars(parser.parse_args(sys.argv[1:])) - main(arg_list) diff --git a/src/emuvim/examples/resource_model_demo_topology.py b/src/emuvim/examples/resource_model_demo_topology.py deleted file mode 100755 index 0472554..0000000 --- a/src/emuvim/examples/resource_model_demo_topology.py +++ /dev/null @@ -1,106 +0,0 @@ -""" -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 to test resource model support. -""" - -import logging -import time -import os -from mininet.log import setLogLevel -from mininet.node import Controller -from emuvim.dcemulator.net import DCNetwork -from emuvim.api.zerorpc.compute import ZeroRpcApiEndpoint -from emuvim.api.sonata import SonataDummyGatekeeperEndpoint -from emuvim.dcemulator.resourcemodel.upb.simple import UpbSimpleCloudDcRM, UpbOverprovisioningCloudDcRM - -logging.basicConfig(level=logging.INFO) - - -RESOURCE_LOG_PATH = "resource.log" - - -def create_topology1(): - cleanup() - # create topology - # use a maximum of 50% cpu time for containers added to data centers - net = DCNetwork(dc_emulation_max_cpu=0.5, controller=Controller) - # add some data centers and create a topology - dc1 = net.addDatacenter("dc1", resource_log_path=RESOURCE_LOG_PATH) - dc2 = net.addDatacenter("dc2", resource_log_path=RESOURCE_LOG_PATH) - s1 = net.addSwitch("s1") - net.addLink(dc1, s1, delay="10ms") - net.addLink(dc2, s1, delay="20ms") - - # create and assign resource models for each DC - rm1 = UpbSimpleCloudDcRM(max_cu=4, max_mu=1024) - rm2 = UpbOverprovisioningCloudDcRM(max_cu=4) - dc1.assignResourceModel(rm1) - dc2.assignResourceModel(rm2) - - # add the command line interface endpoint to each DC - zapi1 = ZeroRpcApiEndpoint("0.0.0.0", 4242) - zapi1.connectDatacenter(dc1) - zapi1.connectDatacenter(dc2) - # run API endpoint server (in another thread, don't block) - zapi1.start() - - # start the emulation platform - net.start() - print "Wait a moment and allocate some compute start some compute resources..." - time.sleep(2) - dc1.startCompute("vnf1") - dc1.startCompute("vnf2", flavor_name="tiny") - dc1.startCompute("vnf3", flavor_name="small") - dc2.startCompute("vnf4", flavor_name="medium") - dc2.startCompute("vnf5", flavor_name="medium") - dc2.startCompute("vnf6", flavor_name="medium") - print "... done." - time.sleep(5) - print "Removing instances ..." - dc1.stopCompute("vnf1") - dc2.stopCompute("vnf4") - print "... done" - net.CLI() - net.stop() - - -def cleanup(): - try: - os.remove(RESOURCE_LOG_PATH) - except OSError: - pass - - -def main(): - setLogLevel('info') # set Mininet loglevel - create_topology1() - - -if __name__ == '__main__': - main() diff --git a/src/emuvim/examples/services/pingpong_ns/pingpong_nsd.yaml b/src/emuvim/examples/services/pingpong_ns/pingpong_nsd.yaml new file mode 100644 index 0000000..79ed457 --- /dev/null +++ b/src/emuvim/examples/services/pingpong_ns/pingpong_nsd.yaml @@ -0,0 +1,98 @@ +--- +# Copyright (c) 2018 by Paderborn University and Manuel Peuster +# (manuel@peuster.de) +# 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 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. + +nsd-catalog: + nsd: + - id: pingpong + name: pingpong + short-name: pingpong + description: Ping-pong example nentwork scenario with two VNFs. + vendor: "Paderborn University" + version: '1.1' + + # Place the logo as png in icons directory and provide the name here + # logo: + + # Specify the VNFDs that are part of this NSD + constituent-vnfd: + # The member-vnf-index needs to be unique, starting from 1 + # vnfd-id-ref is the id of the VNFD + # Multiple constituent VNFDs can be specified + - member-vnf-index: '1' + vnfd-id-ref: ping + - member-vnf-index: '2' + vnfd-id-ref: pong + + vld: + - id: mgmt_vl + description: Management VL + name: mgmt_vl + short-name: mgmt_vl + vim-network-name: default # important for emulator! + type: ELAN + vendor: "Paderborn University" + version: '1.0' + mgmt-network: 'true' + vnfd-connection-point-ref: + - member-vnf-index-ref: '1' + vnfd-connection-point-ref: ping/cp0 + vnfd-id-ref: ping + - member-vnf-index-ref: '2' + vnfd-connection-point-ref: pong/cp0 + vnfd-id-ref: pong + #vld: + # Networks for the VNFs + # - id: demo_nsd_vld0 + # name: management + # short-name: management + # type: ELAN + # mgmt-network: 'true' + # # vim-network-name: + # # provider-network: + # # overlay-type: VLAN + # # segmentation_id: + # vnfd-connection-point-ref: + # # Specify the constituent VNFs + # # member-vnf-index-ref - entry from constituent vnf + # # vnfd-id-ref - VNFD id + # # vnfd-connection-point-ref - connection point name in the VNFD + # - nsd:member-vnf-index-ref: 1 + # nsd:vnfd-id-ref: http_vnfd + # # NOTE: Validate the entry below + # nsd:vnfd-connection-point-ref: eth0 + # - id: http_nsd_vld1 + # name: http_nsd_vld1 + # short-name: http_nsd_vld1 + # type: ELAN + # # vim-network-name: + # # provider-network: + # # overlay-type: VLAN + # # segmentation_id: + # vnfd-connection-point-ref: + # # Specify the constituent VNFs + # # member-vnf-index-ref - entry from constituent vnf + # # vnfd-id-ref - VNFD id + # # vnfd-connection-point-ref - connection point name in the VNFD + # - nsd:member-vnf-index-ref: 1 + # nsd:vnfd-id-ref: http_vnfd + # # NOTE: Validate the entry below + # nsd:vnfd-connection-point-ref: eth1 diff --git a/src/emuvim/examples/services/pingpong_nsd.tar.gz b/src/emuvim/examples/services/pingpong_nsd.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..e5d9202eae4bf626bfcad947b117a38ddc65bfda GIT binary patch literal 1498 zcmV<01tt0)iwFQZnM+y#1MOK~Q`<%m=h>fP3lAYP$XLe4)a_*IVyAHnhQSV*JTYhK zY;GdmDR(D~zkPQl*_J@ybV`y*tDRvi-|p?--|oprB;-6&a(*L?f4K8?sDadJx9QXE zv>W-)745i3&1SRXwpyL$PQyKFbdGkQ{gwPFP;4yI06QU*F%O=W+s6MvDazMB|E0cU z;R}UJ1wL-Io~l1Sx|{m9kFoy8t+u-Zjh8Y1JpIq>?>J6v4^CCI)M9>XVc&ZV&4zmd z(K_2dRG}Gu zA8GO*ofMQt?o-ajoEIFJsnj78aZk*IhjGby%;p^C3IQWA9Ei9Mg`r{^0uO2lL?|q? z$;zXkQiO~$H;5rw$X9hKgCvSewGlNWE3CnK$}}}fo21fHPFP9O&83g4oWhH=3YDc~ zu~F}8qQJ2W0nPK-mMXca3Otg z@K5+%SdH9dF_FL!N|w#7($;x`>2u?05m83FaEV-p*jPh`rNgXnX%|X=0)rW5=x^2! z3kBDsx2C?_g z_kkKx?Fiq|d`68*9twYjWAgQZ{CON$LFLN%m&N2^TTjH$>WuK$hSJ? zB{{~*OKcF-fekDWo|N%|SXsf+x;!lU^GXvK9C}fsd`~G@w%Bj}GyCd`?B}Q4UIA=$ zMkMJp>r;q^S&k1IMEX2b^iqqU@f$@Eq6}4QR6dp{pzj&E5)iF<&thP2^Y9qS*$jMB zCY?=Dz1CbNL_`O2z?M$x;&rKu>4V{OiY_^!Zzz3F+y4UC=9K5B^@AyA%H+$ChBd`4 zc!VTFH?IZ7O4FH}!%i|#5fV=dmc@eGHp`GKrw0}uY>$TdS|MSNj{EX~ z=&kdHR?6kE3oa%DEGG*Dl_>Ei&CiqvYO%#id2e!i+bHj&#G9;-N+L+nx!zwtHV;*we6K!nYv20^{J*5a{m<2)*FPV;xQ#9MKMl8)yZ>vubpO|B9aZ-~--7zt zdpW*Bd73ku-c($S&)0A4^b?tRpOPQ-Tyjk^wbM)%`}|x$^P~=c#uD6ix83O;9l_~f zJfUl(&X3+6|9L9(zjw>MPbLmc-QL@mv$3uJk@?{MzkS@S?ti}tO&h#9J8Jo?(`s^l zGV8S3P4{HVra$u*Yt5zrkNzo8^>jrQRa8+$6;)JGMHN+4(GN&}1IaJd`T!^Z0NOF! AWB>pF literal 0 HcmV?d00001 diff --git a/src/emuvim/examples/simple_topology.py b/src/emuvim/examples/simple_topology.py deleted file mode 100755 index b43ad78..0000000 --- a/src/emuvim/examples/simple_topology.py +++ /dev/null @@ -1,125 +0,0 @@ -""" -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). -""" -""" -This is an example that shows how a user of the emulation tool can -define network topologies with multiple emulated cloud data centers. - -The definition is done with a Python API which looks very similar to the -Mininet API (in fact it is a wrapper for it). - -We only specify the topology *between* data centers not within a single -data center (data center internal setups or placements are not of interest, -we want to experiment with VNF chains deployed across multiple PoPs). - -The original Mininet API has to be completely hidden and not be used by this -script. -""" -import logging -from mininet.log import setLogLevel -from emuvim.dcemulator.net import DCNetwork -from emuvim.api.rest.rest_api_endpoint import RestApiEndpoint -from mininet.node import RemoteController - -logging.basicConfig(level=logging.INFO) - - -def create_topology1(): - """ - 1. Create a data center network object (DCNetwork) - """ - net = DCNetwork(controller=RemoteController, monitor=False, enable_learning=True) - - """ - 2. Add (logical) data centers to the topology - (each data center is one "bigswitch" in our simplified - first prototype) - """ - dc1 = net.addDatacenter("datacenter1") - dc2 = net.addDatacenter("datacenter2") - dc3 = net.addDatacenter("long_data_center_name3") - dc4 = net.addDatacenter( - "datacenter4", - metadata={"mydata": "we can also add arbitrary metadata to each DC"}) - - """ - 3. You can add additional SDN switches for data center - interconnections to the network. - """ - s1 = net.addSwitch("s1") - - """ - 4. Add links between your data centers and additional switches - to define you topology. - These links can use Mininet's features to limit bw, add delay or jitter. - """ - net.addLink(dc1, dc2) - net.addLink("datacenter1", s1) - net.addLink(s1, dc3) - net.addLink(s1, "datacenter4") - - """ - 5. We want to access and control our data centers from the outside, - e.g., we want to connect an orchestrator to start/stop compute - resources aka. VNFs (represented by Docker containers in the emulated) - - So we need to instantiate API endpoints (e.g. a zerorpc or REST - interface). Depending on the endpoint implementations, we can connect - one or more data centers to it, which can then be controlled through - this API, e.g., start/stop/list compute instances. - """ - # create a new instance of a endpoint implementation - rapi1 = RestApiEndpoint("127.0.0.1", 5001, net) - # connect data centers to this endpoint - rapi1.connectDatacenter(dc1) - rapi1.connectDatacenter(dc2) - rapi1.connectDatacenter(dc3) - rapi1.connectDatacenter(dc4) - # run API endpoint server (in another thread, don't block) - - rapi1.start() - - """ - 6. Finally we are done and can start our network (the emulator). - We can also enter the Mininet CLI to interactively interact - with our compute resources (just like in default Mininet). - But we can also implement fully automated experiments that - can be executed again and again. - """ - net.start() - net.CLI() - # when the user types exit in the CLI, we stop the emulator - net.stop() - - -def main(): - setLogLevel('info') # set Mininet loglevel - create_topology1() - - -if __name__ == '__main__': - main() diff --git a/src/emuvim/examples/son-monitor_test_topo.py b/src/emuvim/examples/son-monitor_test_topo.py deleted file mode 100755 index 9438460..0000000 --- a/src/emuvim/examples/son-monitor_test_topo.py +++ /dev/null @@ -1,110 +0,0 @@ -""" -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) -""" - -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 signal -import sys -import time - -logging.basicConfig(level=logging.INFO) - -exit = False - -def create_topology1(): - - global exit - - # create topology - net = DCNetwork(controller=RemoteController, monitor=True, enable_learning = False) - dc1 = net.addDatacenter("dc1") - dc2 = net.addDatacenter("dc2") - s1 = net.addSwitch("s1") - net.addLink(dc1, s1, delay="10ms") - net.addLink(dc2, s1, delay="20ms") - - # add the command line interface endpoint to each DC (REST API) - rapi1 = RestApiEndpoint("0.0.0.0", 5001) - rapi1.connectDatacenter(dc1) - rapi1.connectDatacenter(dc2) - # connect total network also, needed to do the chaining and monitoring - rapi1.connectDCNetwork(net) - # run API endpoint server (in another thread, don't block) - rapi1.start() - - # add the SONATA dummy gatekeeper to each DC - sdkg1 = SonataDummyGatekeeperEndpoint("0.0.0.0", 5000, deploy_sap=True) - sdkg1.connectDatacenter(dc1) - sdkg1.connectDatacenter(dc2) - # run the dummy gatekeeper (in another thread, don't block) - sdkg1.start() - - # start the emulation platform - net.start() - - #does not work from docker compose (cannot start container in interactive mode) - #cli = net.CLI() - # instead wait here: - logging.info("waiting for SIGTERM or SIGINT signal") - while not exit: - time.sleep(1) - logging.info("got SIG signal") - net.stop() - -def exit_gracefully(signum, frame): - """ - 7. At shutdown, we should receive the unix signal here and shutdown gracefully - """ - - global exit - - logging.info('Signal handler called with signal {0}'.format(signum)) - exit = True - - -def main(): - setLogLevel('info') # set Mininet loglevel - # add the SIGTERM handler (eg. received when son-emu docker container stops) - signal.signal(signal.SIGTERM, exit_gracefully) - # also handle Ctrl-C - signal.signal(signal.SIGINT, exit_gracefully) - # start the topology - create_topology1() - - -if __name__ == '__main__': - main() diff --git a/src/emuvim/examples/sonata_simple.py b/src/emuvim/examples/sonata_simple.py deleted file mode 100755 index 0627247..0000000 --- a/src/emuvim/examples/sonata_simple.py +++ /dev/null @@ -1,78 +0,0 @@ -""" -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 - -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() - - # add the SONATA dummy gatekeeper to each DC - sdkg1 = SonataDummyGatekeeperEndpoint("0.0.0.0", 5000, deploy_sap=True) - 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/sonata_simple_topology.py b/src/emuvim/examples/sonata_simple_topology.py deleted file mode 100755 index 31dd76f..0000000 --- a/src/emuvim/examples/sonata_simple_topology.py +++ /dev/null @@ -1,80 +0,0 @@ -""" -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() - - - # add the SONATA dummy gatekeeper to each DC - sdkg1 = SonataDummyGatekeeperEndpoint("0.0.0.0", 5000, deploy_sap=True) - 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/sonata_y1_demo_topology_1.py b/src/emuvim/examples/sonata_y1_demo_topology_1.py deleted file mode 100755 index 5c2402c..0000000 --- a/src/emuvim/examples/sonata_y1_demo_topology_1.py +++ /dev/null @@ -1,81 +0,0 @@ -""" -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). -""" -""" -A simple topology with two PoPs for the y1 demo story board. - - (dc1) <<-->> s1 <<-->> (dc2) -""" - -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 - -logging.basicConfig(level=logging.INFO) - - -def create_topology1(): - # create topology - net = DCNetwork(controller=RemoteController, monitor=False, enable_learning=True) - dc1 = net.addDatacenter("dc1") - dc2 = net.addDatacenter("dc2") - s1 = net.addSwitch("s1") - net.addLink(dc1, s1, delay="10ms") - net.addLink(dc2, s1, delay="20ms") - - # add the command line interface endpoint to each DC (REST API) - rapi1 = RestApiEndpoint("0.0.0.0", 5001) - rapi1.connectDCNetwork(net) - rapi1.connectDatacenter(dc1) - rapi1.connectDatacenter(dc2) - # run API endpoint server (in another thread, don't block) - rapi1.start() - - # add the SONATA dummy gatekeeper to each DC - sdkg1 = SonataDummyGatekeeperEndpoint("0.0.0.0", 5000, deploy_sap=False) - sdkg1.connectDatacenter(dc1) - sdkg1.connectDatacenter(dc2) - # run the dummy gatekeeper (in another thread, don't block) - sdkg1.start() - - # start the emulation platform - net.start() - net.CLI() - rapi1.stop() - net.stop() - - -def main(): - setLogLevel('info') # set Mininet loglevel - create_topology1() - - -if __name__ == '__main__': - main() diff --git a/src/emuvim/examples/sonata_y1_demo_topology_1_w_ls_and_mon_and_sap.py b/src/emuvim/examples/sonata_y1_demo_topology_1_w_ls_and_mon_and_sap.py deleted file mode 100755 index b38720e..0000000 --- a/src/emuvim/examples/sonata_y1_demo_topology_1_w_ls_and_mon_and_sap.py +++ /dev/null @@ -1,83 +0,0 @@ -""" -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 - -logging.basicConfig(level=logging.INFO) - - -def create_topology1(): - # create topology - net = DCNetwork(controller=RemoteController, monitor=True, enable_learning=True) - dc1 = net.addDatacenter("dc1") - dc2 = net.addDatacenter("dc2") - s1 = net.addSwitch("s1") - net.addLink(dc1, s1, delay="3ms") - net.addLink(dc2, s1, delay="5ms") - - # add the command line interface endpoint to each DC (REST API) - rapi1 = RestApiEndpoint("0.0.0.0", 5001) - rapi1.connectDCNetwork(net) - rapi1.connectDatacenter(dc1) - rapi1.connectDatacenter(dc2) - # run API endpoint server (in another thread, don't block) - rapi1.start() - - # add the SONATA dummy gatekeeper to each DC - sdkg1 = SonataDummyGatekeeperEndpoint("0.0.0.0", 5000, deploy_sap=True) - sdkg1.connectDatacenter(dc1) - sdkg1.connectDatacenter(dc2) - # 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/sonata_y1_demo_topology_1_w_ls_and_sap.py b/src/emuvim/examples/sonata_y1_demo_topology_1_w_ls_and_sap.py deleted file mode 100755 index ffb1159..0000000 --- a/src/emuvim/examples/sonata_y1_demo_topology_1_w_ls_and_sap.py +++ /dev/null @@ -1,83 +0,0 @@ -""" -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 - -logging.basicConfig(level=logging.INFO) - - -def create_topology1(): - # create topology - net = DCNetwork(controller=RemoteController, monitor=False, enable_learning=False) - dc1 = net.addDatacenter("dc1") - dc2 = net.addDatacenter("dc2") - s1 = net.addSwitch("s1") - net.addLink(dc1, s1, delay="3ms") - net.addLink(dc2, s1, delay="5ms") - - # add the command line interface endpoint to each DC (REST API) - rapi1 = RestApiEndpoint("0.0.0.0", 5001) - rapi1.connectDCNetwork(net) - rapi1.connectDatacenter(dc1) - rapi1.connectDatacenter(dc2) - # run API endpoint server (in another thread, don't block) - rapi1.start() - - # add the SONATA dummy gatekeeper to each DC - sdkg1 = SonataDummyGatekeeperEndpoint("0.0.0.0", 5000, deploy_sap=True) - sdkg1.connectDatacenter(dc1) - sdkg1.connectDatacenter(dc2) - # 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/vnfs/ping.tar.gz b/src/emuvim/examples/vnfs/ping.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..c19270b81c1f6524a419ce2f20bd4bae1d4952b0 GIT binary patch literal 1328 zcmV-01<(2)iwFQZnM+y#1MOJdbK*7-&oh6;4tcm_CMFm#B<@RTAU)cIWPotJr;e~? z(8QKhS%&c6cV+WohotF4a=n}SH68WwuiD=_#&uZ*E{T`1SK-45R+IKbrP? zwaPIHZkR`TOnpc=?f`m0p(}}pFB{1jOwD$JL!(xQ6QfYwh^nVQp@+3dAR=qvLPHW$ zbirZ>SV)0Bc~oj(96S-pkP+@tSTVgwx7j$sFyQOPg_voA+646_ehTt>Ky(_g!9r{4 zo}aH)s~SmztqC

QI1{AO^~ACCJL2ArBa@Q}taDEe2z6sC%N5{dD6WQI|OWCcP2 znJbDiElj*C#WW7$8N?#cE21cR@mZ`Dnt43Zfd zsc$$NQ(6ch5LrO6q#g^Hhk5aNLgp0a0vm>7Iv}ZvSZs`jNhKno4cYk4Pdv25 zJVp9ofqrnzHRBZJf7b#-U5O!G$Vmw3#p zrNigKC%a~Us_fQ};XWi@)&iK301|`55@Yi+&s5XLR`-za?3h44m&~X8B4R~p&Y5xH zBDEX|s>xht=!>Ht48f9uaqaFTTjKU~oO`lf5F6;VMDg_gZZ!F4Q~O_;9-9*nyE>xW zoGf_41xUkA9L*zb?UswddNLPg&S6)Fl*Afmmcq360DN-}%yz>>{e3y6`48S=y*&i5!aioqJx*at=Qj(b0I~{vTD6HGyOj% z{n4;{bI2Q0Iw9d}eO~l39gOhNa-cw;&=%X)dOqNmqQNWUTukY(V*8X{o8|8yC41j0 zl}hEmzVqdg1~}?>d$;`$+vAPlA zeM~QP6c2EtQ@Psc;+6B3LF1wZza<=O$8|bxvk6!I@x*+M=zLebUg8kh0kxpsW1K{B zO+V@P-{Ym*0lqgZ6M2Qk5N|Y#3qC|-jB}$a|aqu_WLbOBxC;$M!%x8 zmO&F+^2suUe}5~R7ds^F%}vvL^E1N$+SO|J*%!-+6!X)g*M*Jfb~@(U>2~b$_ZCOa znd`b;r`_(lN4Ddfb(|yUys}?8vQ!fVa1;}fvFK&JugU+VNKF36gI@n;@M>q61fRFt zFXrEAm-3H^w;lYA`L|!qqZ0n-`R}uoDxPSmfGS2b3&3B)?c@f6y(A&@fy^1qnPAH3 zG_E$fQos!d_o4+qX9Ap#*Xep^XK*!`Ou@x0H~#MUYJ3@a|I-Dd4`~*sE&Zs!{TW~D zfBW2dGXL9lw_W%D_kiE_FWmFC-=S^)(jjM#+wmQnG5eCz?!_emFctFKQiMTkP2#9- z=>Hb-{;#I^o1gKO{%@am+|u*^-1NWep4a{VJz!Z@;~1`FvQ~V)(D0VNGY{?ya|^g5 z0aLzI0`3K0GL>?@1|kBu$+>_#hU77Y``;Gq{FoFgt$@A5)!y|rjE5gSPA4!POa|lG zpxs=DQ!z!dhk!lQjsb zAxjyW;3 z&^qx>Pgko|i{#F>q?(^bg<^VoJ-ix>CIbr{&bQo)h@~kg_It)vajPN;`a_A2UPfdE zc(EdL#ZacD@pq-T=3;&VsSNdsD27%7o@&MYOjpR-dWSKW6_73>pxK+iaMFaIdXwSg z1Z{j8PCwq>PvKKJO*G+Y$bI553W6_+>cip8!Lu@EG=(DC0jm z$qkJxFq};ot2hwK!l5)_l!u&RTwBJ+q^tilBh1^UNtqkT&I{%QBWgQnrGT)rdD#gnFw%|neY-NW2p_<_$$aL z?!+_DcmN@aiqhJqB(Efy>3zhB;%LO=PBUSQ?80p|8fK+qQ(WfJdeD51y=F-*Z#fU% zI4$Q*W4C?`cM+jQ;xP^hB!vVMizUmc$zgy6PLbteI3SBl93k7&Y#+PY~~!+a?FI8Cpgza zq+utH=dreS%T;G-QgX9ou%{zNQjML;VAj6}vFUz)*FyMiwaZ74dF8!9zzsPhGF!2{ zvDa~5>8;HSFw=3!d}*IKr}Qr8vq-LX;%yOTekOEQiJ@TZ89}A)n)kT^OchT4HOfMg zMH>2&K42BnZ9O)t^hn%;d!1&ZvVIKjBeIm4+P3@bX2T8__?Q-&=b>(=4n|hlzKpHV z>{s4FewQ@Ktj)29*^gO_)oaDR2OY;f5U0o+)`2xgxnnc%wtPQZlvA+EoM3S6j8dZQ~R%)5v7#1ZN}Yl{5n(HM1m( z0$7kG7M$r#9&TnPHZzN}h+wD(@h39nMYdn+xxuf~!FbfWKIEM%ossCJKB-!n4afLE zI#6JbxEIUbdO9F1#ljcHL6wrjjPFBwX%_qgLUQ({)@al(UNvges8ORvjT$v-)TmLT TMvWRZ{sR60%(6V&04M+e_2;fX literal 0 HcmV?d00001 diff --git a/src/emuvim/examples/vnfs/pong_vnf/pong_vnfd.yaml b/src/emuvim/examples/vnfs/pong_vnf/pong_vnfd.yaml new file mode 100644 index 0000000..3e80700 --- /dev/null +++ b/src/emuvim/examples/vnfs/pong_vnf/pong_vnfd.yaml @@ -0,0 +1,77 @@ +--- +# Copyright (c) 2018 by Paderborn University and Manuel Peuster +# (manuel@peuster.de) +# 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 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. + +vnfd-catalog: + vnfd: + - id: pong + name: pong + short-name: pong + description: Empty Container VNF + vendor: "Paderborn University" + version: '1.1' + + # Place the logo as png in icons directory and provide the name here + # logo: sonata.png + connection-point: + - name: pong/cp0 + type: VPORT + - name: pong/cp1 + type: VPORT + # Management interface + mgmt-interface: + cp: pong/cp0 + + # Atleast one VDU need to be specified + vdu: + # Additional VDUs can be created by copying the + # VDU descriptor below + - id: ubuntu + name: ubuntu + description: "Ubuntu Trusty default Docker container" + count: "1" + + # Flavour of the VM to be instantiated for the VDU + vm-flavor: + vcpu-count: 1 + memory-mb: 512 + storage-gb: 10 + + # Image including the full path + image: "ubuntu:trusty" + #image: cirros034 + interface: + - name: pong0 # attention, no two VNFs should have same if names in emulator + position: 0 + type: EXTERNAL + virtual-interface: + type: VIRTIO + external-connection-point-ref: pong/cp0 + - name: pong1 + position: 1 + type: EXTERNAL + virtual-interface: + type: VIRTIO + external-connection-point-ref: pong/cp1 + + + + -- 2.17.1