Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ONOS Introduction

ONOS Introduction

ONOS (Open Networkr Operating System) SDN Controller Introduction and Tutorial

1ec13070abf6996a0bc06b9be103ea85?s=128

Eueung Mulyana

February 12, 2018
Tweet

Transcript

  1. 1 / 63 ONOS Open Network Operating System Eueung Mulyana

    https://telematika.org/remark/onos Intro+Labs | Attribution-ShareAlike CC BY-SA
  2. Outline Introduction ONOS + Mininet REST Interface Dev Quick Start

    + onos.py ONOS App Samples Template Application 2 / 63
  3. ONOS Magpie 1.12.0 | Mininet 2.2.2 on RPI3 with Ubuntu

    16.04.3 LTS | OVS (Open vSwitch) 2.5.2 VirtualBox 5.2.6 on Ubuntu Xenial 16.04.3. 3 / 63
  4. Introduction 4 / 63

  5. 5 / 63 ONOS Open Network OS ONOS provides the

    control plane for a software-de ned network (SDN), managing network components, such as switches and links, and running software programs or modules to provide communication services to end hosts and neighboring networks. ONOS applications and use cases often consist of customized communication routing, management, or monitoring services for software-de ned networks. ONOS can run as a distributed system across multiple servers, allowing it to use the CPU and memory resources of multiple servers while providing fault tolerance in the face of server failure and potentially supporting live/rolling upgrades of hardware and software without interrupting network tra c. Ref: ONOS - Wiki
  6. 6 / 63 ONOS Architecture Tenets High-availability, scalability and performance

    (required to sustain demands of service provider & enterprise networks) Strong abstractions and simplicity (required for development of apps and solutions) Protocol and device behaviour independence (avoid contouring and deformation due to protocol speci cs) Separation of concerns and modularity (allow tailoring and customization without speciating the code-base) Ref: ONOS Distributed Tutorial
  7. ONOS Distributed Architecture 7 / 63

  8. ONOS Distributed Architecture 8 / 63

  9. ONOS Core Subsystems 9 / 63

  10. Getting Started ONOS + Mininet 10 / 63

  11. 11 / 63 Getting Started Install Java JDK + Env

    Adjustment Download ONOS + Extract Run ONOS Install Apps Run Mininet (Remote Controller Pointed to the ONOS instance)
  12. 12 / 63 Installation Java Dependency $ sudo apt-get install

    unzip zip tree $ sudo apt-get install software-properties-common -y && \ sudo add-apt-repository ppa:webupd8team/java -y && \ sudo apt-get update && \ echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | sudo debconf-s sudo apt-get install oracle-java8-installer oracle-java8-set-default -y $ java -version java version "1.8.0_161" Java(TM) SE Runtime Environment (build 1.8.0_161-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode) $ which java /usr/bin/java $ echo $JAVA_HOME $ nano .profile export JAVA_HOME=/usr/lib/jvm/java-8-oracle/ $ source .profile
  13. 13 / 63 Installation Download Extract # direct download $

    wget -c http://downloads.onosproject.org/release/onos-1.12.0.tar.gz # indirect: download first + sftp $ sftp -oPort=22 em@192.168.56.70 sftp> put onos-1.12.0.tar.gz $ ssh em@192.168.56.70 $ tar xzf onos-1.12.0.tar.gz $ cd onos-1.12.0/bin ~/onos-1.12.0/bin$ ./onos-service start
  14. ~/onos-1.12.0/bin$ ./onos-service clean Welcome to Open Network Operating System (ONOS)!

    ____ _ ______ ____ / __ \/ |/ / __ \/ __/ / /_/ / / /_/ /\ \ \____/_/|_/\____/___/ Documentation: wiki.onosproject.org Tutorials: tutorials.onosproject.org Mailing lists: lists.onosproject.org Come help out! Find out how at: contribute.onosproject.org Hit '<tab>' for a list of available commands and '[cmd] --help' for help on a specific command. Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown ONOS. onos> apps -s -a +22 org.onosproject.drivers 1.12.0 Default Drivers onos> feature:list -i Name | Version | Installed | Repository | Descriptio ---------------------------------------------------------------------------------------------- onos-thirdparty-base | 1.12.0 | x | onos-1.12.0 | ONOS 3rd p onos-thirdparty-web | 1.12.0 | x | onos-1.12.0 | ONOS 3rd p onos-api | 1.12.0 | x | onos-1.12.0 | ONOS servi onos-core | 1.12.0 | x | onos-1.12.0 | ONOS core onos-incubator | 1.12.0 | x | onos-1.12.0 | ONOS core onos-rest | 1.12.0 | x | onos-1.12.0 | ONOS REST onos-gui | 1.12.0 | x | onos-1.12.0 | ONOS GUI c onos-cli | 1.12.0 | x | onos-1.12.0 | ONOS admin standard | 3.0.8 | x | standard-3.0.8 | Karaf stan http | 3.0.8 | x | standard-3.0.8 | Implementa war | 3.0.8 | x | standard-3.0.8 | Turn Karaf webconsole | 3.0.8 | x | standard-3.0.8 | Base suppo ssh | 3.0.8 | x | standard-3.0.8 | Provide a scr | 3.0.8 | x | standard-3.0.8 | Declarativ onos-drivers-default | 1.12.0 | x | onos-drivers-default-1.12.0 | Default Dr pax-jetty | 8.1.19.v20160209 | x | org.ops4j.pax.web-3.2.9 | Provide Je pax-http | 3.2.9 | x | org.ops4j.pax.web-3.2.9 | Implementa pax-http-whiteboard | 3.2.9 | x | org.ops4j.pax.web-3.2.9 | Provide HT pax-war | 3.2.9 | x | org.ops4j.pax.web-3.2.9 | Provide su 14 / 63 Run ONOS
  15. ONOS Web GUI - Login 15 / 63

  16. ONOS Web GUI - <IP>:8181/onos/ui 16 / 63

  17. ONOS Web GUI - Hotkeys 17 / 63

  18. onos> app activate org.onosproject.openflow-base Activated org.onosproject.openflow-base onos> app activate org.onosproject.openflow

    Activated org.onosproject.openflow onos> apps -s -a + 10 org.onosproject.hostprovider 1.12.0 Host Location Provider + 11 org.onosproject.lldpprovider 1.12.0 LLDP Link Provider + 12 org.onosproject.optical-model 1.12.0 Optical Network Model + 13 org.onosproject.openflow-base 1.12.0 OpenFlow Base Provider + 14 org.onosproject.openflow 1.12.0 OpenFlow Provider Suite + 22 org.onosproject.drivers 1.12.0 Default Drivers em@x64server:~$ netstat -ltn Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp6 0 0 :::11990 :::* LISTEN tcp6 0 0 :::22 :::* LISTEN tcp6 0 0 :::46074 :::* LISTEN tcp6 0 0 :::6653 :::* LISTEN tcp6 0 0 :::8101 :::* LISTEN tcp6 0 0 :::6633 :::* LISTEN tcp6 0 0 127.0.0.1:43625 :::* LISTEN tcp6 0 0 :::9876 :::* LISTEN tcp6 0 0 :::8181 :::* LISTEN 18 / 63 Install Apps
  19. 19 / 63 Mininet Connect to ONOS $ ssh -X

    ubuntu@192.168.0.159 $ ubuntu@pi:~$ sudo mn --topo linear,3 --mac --controller=remote,ip=192.168.0.159,port=6633 --sw +++ Creating network +++ Adding controller +++ Adding hosts: h1 h2 h3 +++ Adding switches: s1 s2 s3 +++ Adding links: (h1, s1) (h2, s2) (h3, s3) (s2, s1) (s3, s2) +++ Configuring hosts h1 h2 h3 +++ Starting controller c0 +++ Starting 3 switches s1 s2 s3 ... +++ Starting CLI: mininet> # access (cred: onos/rocks) # http://192.168.0.159:8181/onos/ui
  20. Topology 20 / 63

  21. 21 / 63 Mininet pings mininet> h1 ping h3 PING

    10.0.0.3 (10.0.0.3) 56(84) bytes of data. From 10.0.0.1 icmp_seq=1 Destination Host Unreachable From 10.0.0.1 icmp_seq=2 Destination Host Unreachable From 10.0.0.1 icmp_seq=3 Destination Host Unreachable ... From 10.0.0.1 icmp_seq=6 Destination Host Unreachable ^C --- 10.0.0.3 ping statistics --- 9 packets transmitted, 0 received, +6 errors, 100% packet loss, time 8047ms pipe 3
  22. onos> app activate org.onosproject.fwd Activated org.onosproject.fwd onos> apps -s -a

    + 10 org.onosproject.hostprovider 1.12.0 Host Location Provider + 11 org.onosproject.lldpprovider 1.12.0 LLDP Link Provider + 12 org.onosproject.optical-model 1.12.0 Optical Network Model + 13 org.onosproject.openflow-base 1.12.0 OpenFlow Base Provider + 14 org.onosproject.openflow 1.12.0 OpenFlow Provider Suite + 22 org.onosproject.drivers 1.12.0 Default Drivers + 138 org.onosproject.fwd 1.12.0 Reactive Forwarding onos> feature:list -i Name | Version | Installed | Repository ---------------------------------------------------------------------------------------------- onos-thirdparty-base | 1.12.0 | x | onos-1.12.0 onos-thirdparty-web | 1.12.0 | x | onos-1.12.0 onos-api | 1.12.0 | x | onos-1.12.0 onos-core | 1.12.0 | x | onos-1.12.0 onos-incubator | 1.12.0 | x | onos-1.12.0 onos-rest | 1.12.0 | x | onos-1.12.0 onos-gui | 1.12.0 | x | onos-1.12.0 onos-cli | 1.12.0 | x | onos-1.12.0 onos-providers-openflow-base | 1.12.0 | x | onos-providers-openflow-base-1.1 standard | 3.0.8 | x | standard-3.0.8 http | 3.0.8 | x | standard-3.0.8 war | 3.0.8 | x | standard-3.0.8 webconsole | 3.0.8 | x | standard-3.0.8 ssh | 3.0.8 | x | standard-3.0.8 scr | 3.0.8 | x | standard-3.0.8 onlab-osgi | 1.12.0 | x | onlab-osgi-1.12.0 onos-providers-lldp | 1.12.0 | x | onos-providers-lldp-1.12.0 onos-drivers-default | 1.12.0 | x | onos-drivers-default-1.12.0 onos-apps-fwd | 1.12.0 | x | onos-apps-fwd-1.12.0 onos-optical-model | 1.12.0 | x | onos-optical-model-1.12.0 onos-providers-host | 1.12.0 | x | onos-providers-host-1.12.0 pax-jetty | 8.1.19.v20160209 | x | org.ops4j.pax.web-3.2.9 pax-http | 3.2.9 | x | org.ops4j.pax.web-3.2.9 pax-http-whiteboard | 3.2.9 | x | org.ops4j.pax.web-3.2.9 pax-war | 3.2.9 | x | org.ops4j.pax.web-3.2.9 22 / 63 Reactive FWD
  23. 23 / 63 Mininet pings mininet> h1 ping h3 PING

    10.0.0.3 (10.0.0.3) 56(84) bytes of data. 64 bytes from 10.0.0.3: icmp_seq=1 ttl=64 time=76.8 ms ... 64 bytes from 10.0.0.3: icmp_seq=5 ttl=64 time=0.199 ms ^C --- 10.0.0.3 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4001ms rtt min/avg/max/mdev = 0.188/15.840/76.874/30.522 ms mininet> h1 ping -c 1 h2 PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. 64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=39.9 ms --- 10.0.0.2 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 39.970/39.970/39.970/0.000 ms
  24. Topology - h1 ping h3 24 / 63

  25. Topology - h1 ping h2 25 / 63

  26. REST Interface 26 / 63

  27. 27 / 63 REST Interface ONOS uses Swagger to auto-generate

    REST API documentation. This can be viewed from any running ONOS instance at the URL: <IP>:8181/onos/v1/docs/ O ers a nice way to directly run queries or copy & paste curl commands for testing. Endpoints contributed by non-core applications can be reached through the top menu. The REST API exists primarily to provide an easy (but slow) way for web applications and scripting languages to interact with the ONOS system. It is not recommended for routing or high-performance network applications, but can be useful for human-timescale tasks such as system management. It can also be useful for testing and debugging. Ref: Introduction to the ONOS APIs
  28. ONOS REST API Docs (Swagger) 28 / 63

  29. ONOS REST API Docs (Swagger) 29 / 63

  30. Testing hosts Endpoint 30 / 63

  31. Testing hosts Endpoint - After pingall 31 / 63

  32. ONOS REST API via Postman 32 / 63

  33. ONOS REST API via Postman 33 / 63

  34. ONOS App Development Quick Start + onos.py 34 / 63

  35. 35 / 63 Compile & Run # Java JDK +

    Env as before $ git clone https://gerrit.onosproject.org/onos $ cd onos && export ONOS_ROOT=$(pwd) ~/onos$ git checkout 1.12.0 ~/onos$ tools/build/onos-buck build onos --show-output ... The outputs are: //tools/package:onos-package buck-out/gen/tools/package/onos-package/onos.tar.gz # cd onos && export ONOS_ROOT=$(pwd) ~/onos$ tools/build/onos-buck run onos-local -- clean debug Ref: Developer Quick Start - ONOS
  36. # run server $ cd onos && export ONOS_ROOT=$(pwd) ~/onos$

    tools/build/onos-buck run onos-local -- clean debug # http://192.168.56.70:8181/onos/ui # run client; attach to the ONOS CLI console ~/onos$ export ONOS_ROOT=$(pwd) && tools/test/bin/onos localhost Welcome to Open Network Operating System (ONOS)! ____ _ ______ ____ / __ \/ |/ / __ \/ __/ / /_/ / / /_/ /\ \ \____/_/|_/\____/___/ Documentation: wiki.onosproject.org Tutorials: tutorials.onosproject.org Mailing lists: lists.onosproject.org Come help out! Find out how at: contribute.onosproject.org Hit '<tab>' for a list of available commands and '[cmd] --help' for help on a specific command. Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown ONOS. onos> apps -s -a 24 org.onosproject.drivers 1.12.0 Default Drivers onos> app activate org.onosproject.openflow Activated org.onosproject.openflow onos> app activate org.onosproject.fwd Activated org.onosproject.fwd onos> apps -s -a + 12 org.onosproject.hostprovider 1.12.0 Host Location Provider + 13 org.onosproject.lldpprovider 1.12.0 LLDP Link Provider + 14 org.onosproject.optical-model 1.12.0 Optical Network Model + 15 org.onosproject.openflow-base 1.12.0 OpenFlow Base Provider + 16 org.onosproject.openflow 1.12.0 OpenFlow Provider Suite + 24 org.onosproject.drivers 1.12.0 Default Drivers + 138 org.onosproject.fwd 1.12.0 Reactive Forwarding 36 / 63 Quick Start
  37. ubuntu@pi:~$ sudo mn --controller remote,ip=192.168.0.159 --topo torus,3,3 +++ Creating network

    +++ Adding controller Connecting to remote controller at 192.168.0.159:6653 +++ Adding hosts: h1x1 h1x2 h1x3 h2x1 h2x2 h2x3 h3x1 h3x2 h3x3 +++ Adding switches: s1x1 s1x2 s1x3 s2x1 s2x2 s2x3 s3x1 s3x2 s3x3 +++ Adding links: (h1x1, s1x1) (h1x2, s1x2) (h1x3, s1x3) (h2x1, s2x1) (h2x2, s2x2) (h2x3, s2x3) (h3x1, s3x1) (h3 +++ Configuring hosts h1x1 h1x2 h1x3 h2x1 h2x2 h2x3 h3x1 h3x2 h3x3 +++ Starting controller c0 +++ Starting 9 switches s1x1 s1x2 s1x3 s2x1 s2x2 s2x3 s3x1 s3x2 s3x3 ... +++ Starting CLI: mininet> pingall +++ Ping: testing ping reachability h1x1 -> h1x2 h1x3 h2x1 h2x2 h2x3 h3x1 h3x2 h3x3 h1x2 -> h1x1 h1x3 h2x1 h2x2 h2x3 h3x1 h3x2 h3x3 h1x3 -> h1x1 h1x2 h2x1 h2x2 h2x3 h3x1 h3x2 h3x3 h2x1 -> h1x1 h1x2 h1x3 h2x2 h2x3 h3x1 h3x2 h3x3 h2x2 -> h1x1 h1x2 h1x3 h2x1 h2x3 h3x1 h3x2 h3x3 h2x3 -> h1x1 h1x2 h1x3 h2x1 h2x2 h3x1 h3x2 h3x3 h3x1 -> h1x1 h1x2 h1x3 h2x1 h2x2 h2x3 h3x2 h3x3 h3x2 -> h1x1 h1x2 h1x3 h2x1 h2x2 h2x3 h3x1 h3x3 h3x3 -> h1x1 h1x2 h1x3 h2x1 h2x2 h2x3 h3x1 h3x2 +++ Results: 0% dropped (72/72 received) 37 / 63 Mininet
  38. ONOS Web UI 38 / 63

  39. ONOS Web UI - After pingall 39 / 63

  40. 40 / 63 onos.py # install ONOS & compile as

    before $ sudo apt install bridge-utils # install mininet $ git clone http://github.com/mininet/mininet $ cd mininet && git checkout 2.2.2 $ util/install.sh -nvfw $ mn --version 2.2.2
  41. em@x64server:~/onos/tools/dev/mininet$ sudo mn --custom onos.py --controller onos,1 --topo tre [sudo]

    password for em: +++ Creating network +++ Adding controller +++ Creating network +++ Adding hosts: (unpacking /tmp/onos1)onos1 +++ Adding switches: cs1 +++ Adding links: (onos1, cs1) +++ Configuring hosts onos1 +++ Adding "iface nat0-eth0 inet manual" to /etc/network/interfaces +++ Adding hosts: h1 h2 h3 h4 +++ Adding switches: s1 s2 s3 +++ Adding links: (s1, s2) (s1, s3) (s2, h1) (s2, h2) (s3, h3) (s3, h4) +++ Configuring hosts h1 h2 h3 h4 +++ Starting controller c0 +++ ONOS_APPS = drivers,openflow,fwd,proxyarp,mobility +++ Starting controller +++ Starting 1 switches cs1 (starting onos1) onos1(checking: karaf. ssh-port.(1 warnings)...... protocol.(6 warnings)... node-status.) +++ Waited 38.20 seconds for ONOS startup +++ Starting 3 switches s1 s2 s3 ... +++ Starting CLI: mininet-onos> mininet-onos> pingall +++ Ping: testing ping reachability h1 -> h2 h3 h4 h2 -> h1 h3 h4 h3 -> h1 h2 h4 h4 -> h1 h2 h3 +++ Results: 0% dropped (12/12 received) mininet-onos> 41 / 63 Mininet
  42. ONOS Web UI - via onos.py 42 / 63

  43. mininet-onos> onos:apps -s -a client: JAVA_HOME not set; results may

    vary Logging in as onos 697 [sshd-SshClient[7dc7cbad]-nio2-thread-2] WARN org.apache.sshd.client.keyverifier.AcceptAll + 12 org.onosproject.hostprovider 1.12.0 Host Location Provider + 13 org.onosproject.lldpprovider 1.12.0 LLDP Link Provider + 14 org.onosproject.optical-model 1.12.0 Optical Network Model + 15 org.onosproject.openflow-base 1.12.0 OpenFlow Base Provider + 16 org.onosproject.openflow 1.12.0 OpenFlow Provider Suite + 24 org.onosproject.drivers 1.12.0 Default Drivers + 51 org.onosproject.mobility 1.12.0 Host Mobility + 89 org.onosproject.proxyarp 1.12.0 Proxy ARP/NDP + 138 org.onosproject.fwd 1.12.0 Reactive Forwarding mininet-onos> mininet-onos> onos client: JAVA_HOME not set; results may vary Logging in as onos 658 [sshd-SshClient[7dc7cbad]-nio2-thread-2] WARN org.apache.sshd.client.keyverifier.AcceptAll Welcome to Open Network Operating System (ONOS)! ____ _ ______ ____ / __ \/ |/ / __ \/ __/ / /_/ / / /_/ /\ \ \____/_/|_/\____/___/ Documentation: wiki.onosproject.org Tutorials: tutorials.onosproject.org Mailing lists: lists.onosproject.org Come help out! Find out how at: contribute.onosproject.org Hit '<tab>' for a list of available commands and '[cmd] --help' for help on a specific command. Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown ONOS. onos> ^D mininet-onos> 43 / 63 onos.py
  44. ONOS App Development ONOS App Samples 44 / 63

  45. 45 / 63 Maven $ apt-cache policy maven maven: Installed:

    (none) Candidate: 3.3.9-3 Version table: 3.3.9-3 500 500 http://kambing.ui.ac.id/ubuntu xenial/universe amd64 Packages 500 http://kambing.ui.ac.id/ubuntu xenial/universe i386 Packages $ sudo apt install maven $ mvn -v Apache Maven 3.3.9 Maven home: /usr/share/maven Java version: 1.8.0_161, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-8-oracle/jre Default locale: en_US, platform encoding: ANSI_X3.4-1968 OS name: "linux", version: "4.4.0-112-generic", arch: "amd64", family: "unix"
  46. # in case $ cd onos && export ONOS_ROOT=$(pwd) $

    git clone https://gerrit.onosproject.org/onos-app-samples $ cd onos-app-samples ~/onos-app-samples$ nano pom.xml <parent> <groupId>org.onosproject</groupId> <artifactId>onos</artifactId> <version>1.12.0</version> </parent> ~/onos-app-samples$ mvn clean install ... [INFO] Reactor Summary: [INFO] [INFO] onos-app-calendar .................................. SUCCESS [01:43 min] [INFO] onos-app-database-perf ............................. SUCCESS [ 7.116 s] [INFO] onos-app-flowtest .................................. SUCCESS [ 1.146 s] [INFO] onos-app-ifwd ...................................... SUCCESS [ 1.219 s] [INFO] onos-app-ipfix ..................................... SUCCESS [ 13.742 s] [INFO] onos-app-oneping ................................... SUCCESS [ 1.067 s] [INFO] onos-app-sdx-l3 .................................... SUCCESS [ 10.990 s] [INFO] onos-app-sdx-l2 .................................... SUCCESS [ 8.202 s] [INFO] onos-app-tvue ...................................... SUCCESS [ 0.881 s] [INFO] onos-app-uiref ..................................... SUCCESS [ 1.338 s] [INFO] onos-app-ecord-co .................................. SUCCESS [ 1.554 s] [INFO] onos-app-carrierethernet ........................... SUCCESS [ 23.076 s] [INFO] mef-nrp-api ........................................ SUCCESS [ 6.172 s] [INFO] mef-sca-api ........................................ SUCCESS [ 3.900 s] [INFO] onos-icona ......................................... SUCCESS [ 1.929 s] [INFO] onos-app-icona-domain-manager ...................... SUCCESS [ 1.285 s] [INFO] onos-app-icona-domain-provider ..................... SUCCESS [ 1.583 s] [INFO] onos-app-icona ..................................... SUCCESS [ 0.429 s] [INFO] onos-app-patchpanel ................................ SUCCESS [ 1.340 s] [INFO] ovsdb-rest ......................................... SUCCESS [ 1.061 s] [INFO] onos-app-group-fwd ................................. SUCCESS [ 1.000 s] [INFO] onos-pppoe ......................................... SUCCESS [ 1.146 s] [INFO] onos-apps-pppoe-api ................................ SUCCESS [ 3.047 s] [INFO] onos-apps-pppoe-driver ............................. SUCCESS [ 0.932 s] [INFO] onos-apps-pppoe-app ................................ SUCCESS [ 4.493 s] [INFO] l SUCCESS [ 5 357 ] 46 / 63 onos-app- samples
  47. # server $ export ONOS_ROOT=$(pwd) && tools/build/onos-buck run onos-local --

    clean debug # cli client $ export ONOS_ROOT=$(pwd) && tools/test/bin/onos localhost onos> apps -s -a + 11 org.onosproject.hostprovider 1.12.0 Host Location Provider + 12 org.onosproject.lldpprovider 1.12.0 LLDP Link Provider + 13 org.onosproject.optical-model 1.12.0 Optical Network Model + 14 org.onosproject.openflow-base 1.12.0 OpenFlow Base Provider + 15 org.onosproject.openflow 1.12.0 OpenFlow Provider Suite + 23 org.onosproject.drivers 1.12.0 Default Drivers ~/onos-app-samples/oneping$ onos-app 127.0.0.1 install! target/onos-app-oneping-1.9.0-SNAPSHOT {"name":"org.onosproject.oneping","id":156,"version":"1.9.0.SNAPSHOT","category":"Monitoring", onos> apps -s -a + 11 org.onosproject.hostprovider 1.12.0 Host Location Provider + 12 org.onosproject.lldpprovider 1.12.0 LLDP Link Provider + 13 org.onosproject.optical-model 1.12.0 Optical Network Model + 14 org.onosproject.openflow-base 1.12.0 OpenFlow Base Provider + 15 org.onosproject.openflow 1.12.0 OpenFlow Provider Suite + 23 org.onosproject.drivers 1.12.0 Default Drivers + 138 org.onosproject.fwd 1.12.0 Reactive Forwarding + 156 org.onosproject.oneping 1.9.0.SNAPSHOT One-Ping-Only App 47 / 63 Test - oneping
  48. 48 / 63 oneping Notes 2018-02-11 16:13:36,018 | WARN |

    p-app-activation | ApplicationManager | 129 - or java.lang.IllegalStateException: Can't install feature onos-app-oneping/0.0.0: Could not start bundle mvn:org.onosproject/onos-app-oneping/1.9.0-SNAPSHOT in feature(s) onos-ap at org.apache.karaf.features.internal.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.jav
  49. ONOS App Development Template Application 49 / 63

  50. 50 / 63 Preparation $ cd onos && export ONOS_ROOT=$(pwd)

    && source $ONOS_ROOT/tools/dev/bash_profile # once? $ cd onos && onos-buck-publish-local # in case $ cd $ONOS_ROOT/tools/package/archetypes $ mvn clean install ... [INFO] Reactor Summary: [INFO] [INFO] onos-archetypes .................................... SUCCESS [ 1.536 s] [INFO] onos-api-archetype ................................. SUCCESS [ 43.710 s] [INFO] onos-bundle-archetype .............................. SUCCESS [ 0.119 s] [INFO] onos-cli-archetype ................................. SUCCESS [ 0.100 s] [INFO] onos-rest-archetype ................................ SUCCESS [ 0.104 s] [INFO] onos-ui-archetype .................................. SUCCESS [ 0.229 s] [INFO] onos-uitab-archetype ............................... SUCCESS [ 0.214 s] [INFO] onos-uitopo-archetype .............................. SUCCESS [ 0.255 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 56.356 s [INFO] Finished at: 2018-02-11T15:35:03+07:00 [INFO] Final Memory: 20M/231M [INFO] ------------------------------------------------------------------------
  51. $ onos-create-app Define value for property 'groupId': org.foo Define value

    for property 'artifactId': foo-app Define value for property 'version' 1.0-SNAPSHOT: : Define value for property 'package' org.foo: : org.foo.app Confirm properties configuration: groupId: org.foo artifactId: foo-app version: 1.0-SNAPSHOT package: org.foo.app Y: : [INFO] ---------------------------------------------------------------------------- [INFO] Using following parameters for creating project from Archetype: onos-bundle-archetype:1 [INFO] ---------------------------------------------------------------------------- [INFO] Parameter: groupId, Value: org.foo [INFO] Parameter: artifactId, Value: foo-app [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] Parameter: package, Value: org.foo.app [INFO] Parameter: packageInPathFormat, Value: org/foo/app [INFO] Parameter: package, Value: org.foo.app [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] Parameter: groupId, Value: org.foo [INFO] Parameter: artifactId, Value: foo-app [INFO] Project created from Archetype in dir: /home/em/foo-app [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:42 min [INFO] Finished at: 2018-02-11T15:37:25+07:00 [INFO] Final Memory: 16M/141M [INFO] ------------------------------------------------------------------------ # edit pom.xml $ mvn clean install ... [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ foo-app --- [INFO] Installing /home/em/foo-app/target/foo-app-1.0-SNAPSHOT.jar to /home/em/.m2/repository/ [INFO] Installing /home/em/foo-app/pom.xml to /home/em/.m2/repository/org/foo/foo-app/1.0-SNAP [INFO] Installing /home/em/foo-app/target/foo-app-1.0-SNAPSHOT.oar to /home/em/.m2/repository/ [INFO] 51 / 63 onos-create-app
  52. # server ~/onos$ tools/build/onos-buck run onos-local -- clean debug #

    cli ~/onos$ export ONOS_ROOT=$(pwd) && tools/test/bin/onos localhost onos> apps -s -a + 12 org.onosproject.hostprovider 1.12.0 Host Location Provider + 13 org.onosproject.lldpprovider 1.12.0 LLDP Link Provider + 14 org.onosproject.optical-model 1.12.0 Optical Network Model + 15 org.onosproject.openflow-base 1.12.0 OpenFlow Base Provider + 16 org.onosproject.openflow 1.12.0 OpenFlow Provider Suite + 24 org.onosproject.drivers 1.12.0 Default Drivers + 51 org.onosproject.mobility 1.12.0 Host Mobility + 89 org.onosproject.proxyarp 1.12.0 Proxy ARP/NDP + 138 org.onosproject.fwd 1.12.0 Reactive Forwarding # onos-app ~/foo-app$ onos-app 127.0.0.1 install! target/foo-app-1.0-SNAPSHOT.oar {"name":"org.foo.app","id":156,"version":"1.0.SNAPSHOT","category":"default","description":"ON onos> apps -s -a + 12 org.onosproject.hostprovider 1.12.0 Host Location Provider + 13 org.onosproject.lldpprovider 1.12.0 LLDP Link Provider + 14 org.onosproject.optical-model 1.12.0 Optical Network Model + 15 org.onosproject.openflow-base 1.12.0 OpenFlow Base Provider + 16 org.onosproject.openflow 1.12.0 OpenFlow Provider Suite + 24 org.onosproject.drivers 1.12.0 Default Drivers + 51 org.onosproject.mobility 1.12.0 Host Mobility + 89 org.onosproject.proxyarp 1.12.0 Proxy ARP/NDP + 138 org.onosproject.fwd 1.12.0 Reactive Forwarding + 156 org.foo.app 1.0.SNAPSHOT Foo App onos> log:display | grep org.foo.app 2018-02-11 15:46:14,810 | INFO | p-app-activation | ApplicationManager | 129 - 2018-02-11 15:46:14,830 | INFO | p-app-activation | AppComponent | 176 - 2018-02-11 15:46:14,831 | INFO | p-app-activation | ApplicationManager | 129 - 52 / 63 Install & Activate
  53. <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema <modelVersion>4.0.0</modelVersion> <groupId>org.foo</groupId> <artifactId>foo-app</artifactId> <version>1.0-SNAPSHOT</version>

    <packaging>bundle</packaging> <description>ONOS OSGi bundle archetype</description> <url>http://onosproject.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <onos.version>1.12.0</onos.version> <onos.app.name>org.foo.app</onos.app.name> <onos.app.title>Foo App</onos.app.title> <onos.app.origin>Foo, Inc.</onos.app.origin> <onos.app.category>default</onos.app.category> <onos.app.url>http://onosproject.org</onos.app.url> <onos.app.readme>ONOS OSGi bundle archetype.</onos.app.readme> </properties> <dependencies> <dependency> <groupId>org.onosproject</groupId> <artifactId>onos-api</artifactId> <version>${onos.version}</version> </dependency> <dependency> <groupId>org.onosproject</groupId> <artifactId>onlab-osgi</artifactId> <version>${onos.version}</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>org.onosproject</groupId> <artifactId>onos-api</artifactId> <version>${onos.version}</version> <scope>test</scope> 53 / 63 pom.xml
  54. ~$ onos-create-app cli org.foo.app foo-app 1.0.0 [INFO] Using property: groupId

    = org.foo.app [INFO] Using property: artifactId = foo-app [INFO] Using property: version = 1.0.0 [INFO] Using property: package = org.foo.app Confirm properties configuration: groupId: org.foo.app artifactId: foo-app version: 1.0.0 package: org.foo.app Y: : ~/foo-app$ ll src/main/java/org/foo/app/ total 16 drwxrwxr-x 2 em em 4096 Feb 11 15:52 ./ drwxrwxr-x 3 em em 4096 Feb 11 15:37 ../ -rw-rw-r-- 1 em em 1027 Feb 11 15:52 AppCommand.java -rw-rw-r-- 1 em em 1245 Feb 11 15:37 AppComponent.java ~/foo-app$ mvn clean install ~/foo-app$ onos-app 127.0.0.1 reinstall! target/foo-app-1.0-SNAPSHOT.oar {"name":"org.foo.app","id":156,"version":"1.0.SNAPSHOT","category":"default","description":"ON onos> sample Hello World 54 / 63 CLI Overlay
  55. <scope>test</scope> <classifier>tests</classifier> </dependency> <dependency> <groupId>org.apache.felix</groupId> <artifactId>org.apache.felix.scr.annotations</artifactId> <version>1.9.12</version> <scope>provided</scope> </dependency> <dependency>

    <groupId>org.onosproject</groupId> <artifactId>onos-cli</artifactId> <version>${onos.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.osgi</groupId> <artifactId>org.osgi.core</artifactId> <version>5.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.karaf.shell</groupId> <artifactId>org.apache.karaf.shell.console</artifactId> <version>3.0.8</version> <scope>provided</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>3.0.1</version> <extensions>true</extensions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.5.1</version> <configuration> 1 8 / 55 / 63 pom.xml
  56. $ onos-create-app -h usage: onos-create-app {app|bundle|ui|uitab|uitopo|cli|api} groupId artifactId version package

    All arguments are optional # UI Overlay - Custom View $ onos-create-app ui org.foo.app foo-app 1.0.0 # UI Overlay - Tabular View $ onos-create-app uitab org.foo.app foo-app 1.0.0 # REST Interface $ onos-create-app rest org.foo.app foo-app 1.0.0 # --------------- $ cd onos && export ONOS_ROOT=$(pwd) && source $ONOS_ROOT/tools/dev/bash_profile $ onos-create-app $ onos-create-app cli org.foo.app foo-app 1.0-SNAPSHOT $ onos-create-app ui org.foo.app foo-app 1.0-SNAPSHOT $ onos-create-app uitab org.foo.app foo-app 1.0-SNAPSHOT $ onos-create-app rest org.foo.app foo-app 1.0-SNAPSHOT ~$ ll foo-app/src/main/java/org/foo/app total 44 drwxrwxr-x 2 em em 4096 Feb 12 14:38 ./ drwxrwxr-x 3 em em 4096 Feb 12 14:36 ../ -rw-rw-r-- 1 em em 1027 Feb 11 15:52 AppCommand.java -rw-rw-r-- 1 em em 1245 Feb 11 15:37 AppComponent.java -rw-rw-r-- 1 em em 2556 Feb 12 14:31 AppUiComponent.java -rw-rw-r-- 1 em em 2600 Feb 12 14:31 AppUiMessageHandler.java -rw-rw-r-- 1 em em 2563 Feb 12 14:33 AppUiTableComponent.java -rw-rw-r-- 1 em em 6600 Feb 12 14:33 AppUiTableMessageHandler.java -rw-rw-r-- 1 em em 930 Feb 12 14:38 AppWebApplication.java -rw-rw-r-- 1 em em 1244 Feb 12 14:38 AppWebResource.java ~/foo-app$ mvn clean install ~/foo-app$ onos-app 127.0.0.1 install! target/foo-app-1.0-SNAPSHOT.oar {"name":"org.foo.app","id":154,"version":"1.0.SNAPSHOT","category":"default","description":"ON onos> apps -s -a + 23 org.onosproject.drivers 1.12.0 Default Drivers + 154 org.foo.app 1.0.SNAPSHOT Foo App 56 / 63 UI Overlay & REST Interface
  57. Web UI Overlay 57 / 63

  58. Web UI Overlay - Sample Table 58 / 63

  59. Web UI Overlay - Sample Custom 59 / 63

  60. REST Interface - Sample API 60 / 63

  61. Refs/Resources 61 / 63

  62. Refs/Resources 1. ONOS - Wiki 2. opennetworkinglab/onos: Open Network Operating

    System 3. ONOS Distributed Tutorial 4. Appendix B: REST API - ONOS - Wiki 5. Mininet and onos.py work ow 6. Developer Quick Start 7. Downloads - ONOS 8. Introduction to the ONOS APIs 9. Running ONOS with onos.py 10. Building the ONOS Sample Apps - ONOS 11. Managing ONOS applications 62 / 63
  63. 63 / 63 END Eueung Mulyana https://telematika.org/remark/onos Intro+Labs | Attribution-ShareAlike

    CC BY-SA