From: peusterm Date: Wed, 17 Jan 2018 14:15:22 +0000 (+0100) Subject: Pingpong example for OSM-to-vim-emu deployments. X-Git-Tag: v4.0.0~5 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Fvim-emu.git;a=commitdiff_plain;h=d8fd9372be1e135f2e11efe2d69c0c16bbcb7be4;hp=ec3a23ed1a1dc21d511c49adbe1fe3d3ab8ff8c3 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 --- 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 0000000..e5d9202 Binary files /dev/null and b/src/emuvim/examples/services/pingpong_nsd.tar.gz differ 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 0000000..c19270b Binary files /dev/null and b/src/emuvim/examples/vnfs/ping.tar.gz differ diff --git a/src/emuvim/examples/vnfs/ping_vnf/ping_vnfd.yaml b/src/emuvim/examples/vnfs/ping_vnf/ping_vnfd.yaml new file mode 100644 index 0000000..e114f3e --- /dev/null +++ b/src/emuvim/examples/vnfs/ping_vnf/ping_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: ping + name: ping + short-name: ping + description: "Empty example 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: ping/cp0 + type: VPORT + - name: ping/cp1 + type: VPORT + # Management interface + mgmt-interface: + cp: ping/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: ping0 + position: 0 + type: EXTERNAL + virtual-interface: + type: VIRTIO + external-connection-point-ref: ping/cp0 + - name: ping1 + position: 1 + type: EXTERNAL + virtual-interface: + type: VIRTIO + external-connection-point-ref: ping/cp1 + + + + diff --git a/src/emuvim/examples/vnfs/pong.tar.gz b/src/emuvim/examples/vnfs/pong.tar.gz new file mode 100644 index 0000000..085c00a Binary files /dev/null and b/src/emuvim/examples/vnfs/pong.tar.gz differ 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 + + + +