文档章节

ONOS安装和运行

wangxuwei
 wangxuwei
发布于 2017/05/13 21:00
字数 3565
阅读 633
收藏 0

1.安装Karaf,MVN(新版MVN不是必须了)

http://archive.apache.org/dist/karaf/3.0.8/apache-karaf-3.0.8.tar.gz
http://archive.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
mkdir ~/Applications
tar -zxvf apache-karaf-3.0.8.tar.gz -C ~/Applications/
tar -zxvf apache-maven-3.3.9-bin.tar.gz -C ~/Applications/

2.安装install Oracle Java 8 及MVN


1. Download and Extract JDK package, such as jdk-8u131-linux-x64.tar.gz,
   and you can see new directory /home/yourname/jdk1.8.0_131
 
2. Add two environment variables into ~/.bashrc or /etc/profile:
   export JAVA_HOME=/home/yourname/jdk1.8.0_131
   export PATH=${JAVA_HOME}/bin:$PATH
 

 

3.获取ONOS

git clone https://gerrit.onosproject.org/onos

另外可从github下载源码,下载地址

https://github.com/opennetworkinglab/onos

 

4.设置环境

export M2_HOME=$HOME/Applications/apache-maven-3.3.9
export PATH=$M2_HOME/bin:$PATH

export ONOS_ROOT=$HOME/onos
export KARAF_ROOT=$HOME/Applications/apache-karaf-3.0.8
export PATH=$KARAF_ROOT/bin:$PATH
if [ -d $ONOS_ROOT/tools/dev ]; then
 . $ONOS_ROOT/tools/dev/bash_profile
fi

5.构建


cd $ONOS_ROOT
tools/build/onos-buck build onos --show-output

新的2.0版需要bazel来构建,可以check out为老版本

git checkout 1.14.1

 

在本地开发机启动onos:

cd $ONOS_ROOT


ok clean
或tools/build/onos-buck run onos-local -- clean debug
onos-karaf clean 

查看openflow端口是否打开:

netstat -anput|grep 6633

6.mininet连接ONOS做为控制器

$ sudo mn --topo tree,depth=2,fanout=3 --mac --controller=remote,ip=127.0.0.1,port=6633 

 

7.To attach to the ONOS CLI console, run:

$  $ONOS_ROOT/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> devices
id=of:0000000000000001, available=true, local-status=connected 39m56s ago, role=MASTER, type=SWITCH, mfr=Nicira, Inc., hw=Open vSwitch, sw=2.5.2, serial=None, driver=ovs, channelId=127.0.0.1:33252, managementAddress=127.0.0.1, protocol=OF_13
id=of:0000000000000002, available=true, local-status=connected 39m56s ago, role=MASTER, type=SWITCH, mfr=Nicira, Inc., hw=Open vSwitch, sw=2.5.2, serial=None, driver=ovs, channelId=127.0.0.1:33258, managementAddress=127.0.0.1, protocol=OF_13
id=of:0000000000000003, available=true, local-status=connected 39m56s ago, role=MASTER, type=SWITCH, mfr=Nicira, Inc., hw=Open vSwitch, sw=2.5.2, serial=None, driver=ovs, channelId=127.0.0.1:33256, managementAddress=127.0.0.1, protocol=OF_13
id=of:0000000000000004, available=true, local-status=connected 39m56s ago, role=MASTER, type=SWITCH, mfr=Nicira, Inc., hw=Open vSwitch, sw=2.5.2, serial=None, driver=ovs, channelId=127.0.0.1:33254, managementAddress=127.0.0.1, protocol=OF_13
onos> links
src=of:0000000000000002/4, dst=of:0000000000000001/1, type=DIRECT, state=ACTIVE, expected=false
src=of:0000000000000001/3, dst=of:0000000000000004/4, type=DIRECT, state=ACTIVE, expected=false
src=of:0000000000000004/4, dst=of:0000000000000001/3, type=DIRECT, state=ACTIVE, expected=false
src=of:0000000000000001/1, dst=of:0000000000000002/4, type=DIRECT, state=ACTIVE, expected=false
src=of:0000000000000001/2, dst=of:0000000000000003/4, type=DIRECT, state=ACTIVE, expected=false
src=of:0000000000000003/4, dst=of:0000000000000001/2, type=DIRECT, state=ACTIVE, expected=false

mininet> links
s1-eth1<->s2-eth4 (OK OK) 
s1-eth2<->s3-eth4 (OK OK) 
s1-eth3<->s4-eth4 (OK OK) 
s2-eth1<->h1-eth0 (OK OK) 
s2-eth2<->h2-eth0 (OK OK) 
s2-eth3<->h3-eth0 (OK OK) 
s3-eth1<->h4-eth0 (OK OK) 
s3-eth2<->h5-eth0 (OK OK) 
s3-eth3<->h6-eth0 (OK OK) 
s4-eth1<->h7-eth0 (OK OK) 
s4-eth2<->h8-eth0 (OK OK) 
s4-eth3<->h9-eth0 (OK OK)

mininet> dpctl dump-flows
*** s1 ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
 cookie=0x10000c42e0660, duration=1.399s, table=0, n_packets=0, n_bytes=0, idle_age=1, priority=40000,arp actions=CONTROLLER:65535
 cookie=0x10000190260d7, duration=1.398s, table=0, n_packets=4, n_bytes=324, idle_age=1, priority=40000,dl_type=0x88cc actions=CONTROLLER:65535
 cookie=0x10000adc87f7a, duration=1.396s, table=0, n_packets=0, n_bytes=0, idle_age=1, priority=5,ip actions=CONTROLLER:65535
 cookie=0x100006a526acd, duration=1.396s, table=0, n_packets=4, n_bytes=324, idle_age=1, priority=40000,dl_type=0x8942 actions=CONTROLLER:65535
 cookie=0x10000f1040206, duration=1.396s, table=0, n_packets=0, n_bytes=0, idle_age=1, priority=5,arp actions=CONTROLLER:65535
*** s2 ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
 cookie=0x10000984d6c82, duration=1.394s, table=0, n_packets=0, n_bytes=0, idle_age=1, priority=5,arp actions=CONTROLLER:65535
 cookie=0x100002f8d46be, duration=1.394s, table=0, n_packets=1, n_bytes=81, idle_age=1, priority=40000,dl_type=0x88cc actions=CONTROLLER:65535
 cookie=0x10000a8ca7e32, duration=1.394s, table=0, n_packets=0, n_bytes=0, idle_age=1, priority=40000,arp actions=CONTROLLER:65535
 cookie=0x100005f500291, duration=1.394s, table=0, n_packets=1, n_bytes=81, idle_age=1, priority=40000,dl_type=0x8942 actions=CONTROLLER:65535
 cookie=0x100009e4a103f, duration=1.394s, table=0, n_packets=0, n_bytes=0, idle_age=1, priority=5,ip actions=CONTROLLER:65535
*** s3 ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
 cookie=0x100008118b503, duration=1.447s, table=0, n_packets=0, n_bytes=0, idle_age=1, priority=5,arp actions=CONTROLLER:65535
 cookie=0x10000a0b249d1, duration=1.447s, table=0, n_packets=0, n_bytes=0, idle_age=1, priority=5,ip actions=CONTROLLER:65535
 cookie=0x10000068c0d36, duration=1.447s, table=0, n_packets=2, n_bytes=162, idle_age=1, priority=40000,dl_type=0x88cc actions=CONTROLLER:65535
 cookie=0x10000fe3dbf3b, duration=1.447s, table=0, n_packets=2, n_bytes=162, idle_age=1, priority=40000,dl_type=0x8942 actions=CONTROLLER:65535
 cookie=0x1000090985895, duration=1.436s, table=0, n_packets=0, n_bytes=0, idle_age=1, priority=40000,arp actions=CONTROLLER:65535
*** s4 ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
 cookie=0x10000ae14ea27, duration=1.416s, table=0, n_packets=0, n_bytes=0, idle_age=1, priority=5,arp actions=CONTROLLER:65535
 cookie=0x10000f2317b70, duration=1.416s, table=0, n_packets=0, n_bytes=0, idle_age=1, priority=40000,arp actions=CONTROLLER:65535
 cookie=0x10000f83ba517, duration=1.415s, table=0, n_packets=1, n_bytes=81, idle_age=1, priority=40000,dl_type=0x8942 actions=CONTROLLER:65535
 cookie=0x100001bd2055c, duration=1.414s, table=0, n_packets=0, n_bytes=0, idle_age=1, priority=5,ip actions=CONTROLLER:65535
 cookie=0x100006ab365e9, duration=1.414s, table=0, n_packets=1, n_bytes=81, idle_age=1, priority=40000,dl_type=0x88cc actions=CONTROLLER:65535

onos> flows
deviceId=of:0000000000000001, flowRuleCount=5
    id=10000190260d7, state=ADDED, bytes=133650, packets=1650, duration=1705, liveType=UNKNOWN, priority=40000, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:lldp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
    id=100006a526acd, state=ADDED, bytes=133650, packets=1650, duration=1705, liveType=UNKNOWN, priority=40000, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:bddp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
    id=10000c42e0660, state=ADDED, bytes=0, packets=0, duration=1705, liveType=UNKNOWN, priority=40000, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:arp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
    id=10000adc87f7a, state=ADDED, bytes=0, packets=0, duration=1705, liveType=UNKNOWN, priority=5, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:ipv4], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
    id=10000f1040206, state=ADDED, bytes=0, packets=0, duration=1705, liveType=UNKNOWN, priority=5, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:arp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
deviceId=of:0000000000000002, flowRuleCount=5
    id=100002f8d46be, state=ADDED, bytes=44550, packets=550, duration=1705, liveType=UNKNOWN, priority=40000, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:lldp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
    id=100005f500291, state=ADDED, bytes=44550, packets=550, duration=1705, liveType=UNKNOWN, priority=40000, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:bddp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
    id=10000a8ca7e32, state=ADDED, bytes=0, packets=0, duration=1705, liveType=UNKNOWN, priority=40000, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:arp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
    id=10000984d6c82, state=ADDED, bytes=0, packets=0, duration=1705, liveType=UNKNOWN, priority=5, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:arp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
    id=100009e4a103f, state=ADDED, bytes=0, packets=0, duration=1705, liveType=UNKNOWN, priority=5, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:ipv4], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
deviceId=of:0000000000000003, flowRuleCount=5
    id=10000068c0d36, state=ADDED, bytes=44550, packets=550, duration=1705, liveType=UNKNOWN, priority=40000, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:lldp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
    id=1000090985895, state=ADDED, bytes=0, packets=0, duration=1705, liveType=UNKNOWN, priority=40000, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:arp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
    id=10000fe3dbf3b, state=ADDED, bytes=44550, packets=550, duration=1705, liveType=UNKNOWN, priority=40000, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:bddp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
    id=100008118b503, state=ADDED, bytes=0, packets=0, duration=1705, liveType=UNKNOWN, priority=5, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:arp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
    id=10000a0b249d1, state=ADDED, bytes=0, packets=0, duration=1705, liveType=UNKNOWN, priority=5, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:ipv4], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
deviceId=of:0000000000000004, flowRuleCount=5
    id=100006ab365e9, state=ADDED, bytes=44550, packets=550, duration=1705, liveType=UNKNOWN, priority=40000, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:lldp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
    id=10000f2317b70, state=ADDED, bytes=0, packets=0, duration=1705, liveType=UNKNOWN, priority=40000, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:arp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
    id=10000f83ba517, state=ADDED, bytes=44550, packets=550, duration=1705, liveType=UNKNOWN, priority=40000, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:bddp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
    id=100001bd2055c, state=ADDED, bytes=0, packets=0, duration=1705, liveType=UNKNOWN, priority=5, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:ipv4], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}
    id=10000ae14ea27, state=ADDED, bytes=0, packets=0, duration=1705, liveType=UNKNOWN, priority=5, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:arp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, meter=None, cleared=true, metadata=null}

我们可以看出mininet里links命令除去主机和交换机之间的链路,和onos的links命令是能够对应的。onos> flows和mininet> dpctl dump-flows也是。

也可以直接用$ dpctl dump-flows tcp:127.0.0.1:6654(这里是s1)命令来查看流表

先用ovs-vsctl查看虚拟交换机的监听端口
$ sudo ovs-vsctl show
、2b05a0c0-015b-44cd-8ce8-d540d9f551c4
    Bridge "s3"
        Controller "ptcp:6656"
        Controller "tcp:127.0.0.1:6633"
            is_connected: true
        fail_mode: secure
        Port "s3-eth2"
            Interface "s3-eth2"
        Port "s3-eth1"
            Interface "s3-eth1"
        Port "s3"
            Interface "s3"
                type: internal
        Port "s3-eth4"
            Interface "s3-eth4"
        Port "s3-eth3"
            Interface "s3-eth3"
    Bridge "s1"
        Controller "ptcp:6654"
        Controller "tcp:127.0.0.1:6633"
            is_connected: true
        fail_mode: secure
        Port "s1-eth1"
            Interface "s1-eth1"
        Port "s1-eth2"
            Interface "s1-eth2"
        Port "s1"
            Interface "s1"
                type: internal
        Port "s1-eth3"
            Interface "s1-eth3"
    Bridge "s4"
        Controller "tcp:127.0.0.1:6633"
            is_connected: true
        Controller "ptcp:6657"
        fail_mode: secure
        Port "s4-eth2"
            Interface "s4-eth2"
        Port "s4-eth4"
            Interface "s4-eth4"
        Port "s4-eth1"
            Interface "s4-eth1"
        Port "s4"
            Interface "s4"
                type: internal
        Port "s4-eth3"
            Interface "s4-eth3"
    Bridge "s2"
        Controller "tcp:127.0.0.1:6633"
            is_connected: true
        Controller "ptcp:6655"
        fail_mode: secure
        Port "s2-eth4"
            Interface "s2-eth4"
        Port "s2-eth2"
            Interface "s2-eth2"
        Port "s2-eth3"
            Interface "s2-eth3"
        Port "s2-eth1"
            Interface "s2-eth1"
        Port "s2"
            Interface "s2"
                type: internal
    ovs_version: "2.5.2"


$ dpctl dump-flows tcp:127.0.0.1:6654
stats_reply (xid=0x533c0333): flags=none type=1(flow)
  cookie=281479020282374, duration_sec=730s, duration_nsec=459000000s, table_id=0, priority=5, n_packets=0, n_bytes=0, idle_timeout=0,hard_timeout=0,arp,actions=CONTROLLER:65535
  cookie=281477892308858, duration_sec=730s, duration_nsec=459000000s, table_id=0, priority=5, n_packets=0, n_bytes=0, idle_timeout=0,hard_timeout=0,ip,actions=CONTROLLER:65535
  cookie=281475396296919, duration_sec=730s, duration_nsec=459000000s, table_id=0, priority=40000, n_packets=711, n_bytes=57591, idle_timeout=0,hard_timeout=0,dl_type=0x88cc,actions=CONTROLLER:65535
  cookie=281476760496845, duration_sec=730s, duration_nsec=459000000s, table_id=0, priority=40000, n_packets=711, n_bytes=57591, idle_timeout=0,hard_timeout=0,dl_type=0x8942,actions=CONTROLLER:65535
  cookie=281478268061280, duration_sec=730s, duration_nsec=459000000s, table_id=0, priority=40000, n_packets=0, n_bytes=0, idle_timeout=0,hard_timeout=0,arp,actions=CONTROLLER:65535

这里cookie和mininet>  dpctl dump-flows是一样的(如281479020282374=0x10000f1040206),只不过是用十进制来表示。

开始时候onos>hosts输出为空,在mininet里主机都ping一遍就会被onos发现。

onos> hosts 
id=00:00:00:00:00:01/None, mac=00:00:00:00:00:01, location=of:0000000000000002/1, vlan=None, ip(s)=[10.0.0.1], configured=false
id=00:00:00:00:00:02/None, mac=00:00:00:00:00:02, location=of:0000000000000002/2, vlan=None, ip(s)=[10.0.0.2], configured=false
id=00:00:00:00:00:03/None, mac=00:00:00:00:00:03, location=of:0000000000000002/3, vlan=None, ip(s)=[10.0.0.3], configured=false
id=00:00:00:00:00:04/None, mac=00:00:00:00:00:04, location=of:0000000000000003/1, vlan=None, ip(s)=[10.0.0.4], configured=false
id=00:00:00:00:00:05/None, mac=00:00:00:00:00:05, location=of:0000000000000003/2, vlan=None, ip(s)=[10.0.0.5], configured=false
id=00:00:00:00:00:06/None, mac=00:00:00:00:00:06, location=of:0000000000000003/3, vlan=None, ip(s)=[10.0.0.6], configured=false
id=00:00:00:00:00:07/None, mac=00:00:00:00:00:07, location=of:0000000000000004/1, vlan=None, ip(s)=[10.0.0.7], configured=false
id=00:00:00:00:00:08/None, mac=00:00:00:00:00:08, location=of:0000000000000004/2, vlan=None, ip(s)=[10.0.0.8], configured=false
id=00:00:00:00:00:09/None, mac=00:00:00:00:00:09, location=of:0000000000000004/3, vlan=None, ip(s)=[10.0.0.9], configured=false

路径 

onos> paths of:0000000000000001 of:0000000000000004
of:0000000000000001/2-of:0000000000000002/2==>of:0000000000000002/3-of:0000000000000003/2==>of:0000000000000003/3-of:0000000000000004/2; cost=3.0

如果$ sudo mn --topo linear,4  --mac --controller=remote,ip=127.0.0.1,port=6633

s1到s4路径要经过s2和s3

onos> paths of:0000000000000002 of:0000000000000004
of:0000000000000002/4-of:0000000000000001/1==>of:0000000000000001/3-of:0000000000000004/4; cost=2.0

 

拆除(建立)虚拟交换机的连接

mininet> link s1 s2 down
mininet> h1 ping -c 2 h4
PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.

--- 10.0.0.4 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1030ms
onos> links
src=of:0000000000000001/3, dst=of:0000000000000004/4, type=DIRECT, state=ACTIVE, expected=false
src=of:0000000000000004/4, dst=of:0000000000000001/3, type=DIRECT, state=ACTIVE, expected=false
src=of:0000000000000001/2, dst=of:0000000000000003/4, type=DIRECT, state=ACTIVE, expected=false
src=of:0000000000000003/4, dst=of:0000000000000001/2, type=DIRECT, state=ACTIVE, expected=false

重新建立连接
mininet> link s1 s2 up
mininet> h1 ping -c 2 h4
PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
64 bytes from 10.0.0.4: icmp_seq=1 ttl=64 time=14.9 ms
64 bytes from 10.0.0.4: icmp_seq=2 ttl=64 time=0.762 ms

--- 10.0.0.4 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.762/7.853/14.945/7.092 ms
onos> links
src=of:0000000000000001/3, dst=of:0000000000000004/4, type=DIRECT, state=ACTIVE, expected=false
src=of:0000000000000002/4, dst=of:0000000000000001/1, type=DIRECT, state=ACTIVE, expected=false
src=of:0000000000000004/4, dst=of:0000000000000001/3, type=DIRECT, state=ACTIVE, expected=false
src=of:0000000000000001/1, dst=of:0000000000000002/4, type=DIRECT, state=ACTIVE, expected=false
src=of:0000000000000001/2, dst=of:0000000000000003/4, type=DIRECT, state=ACTIVE, expected=false
src=of:0000000000000003/4, dst=of:0000000000000001/2, type=DIRECT, state=ACTIVE, expected=false

 

使用intents比简单的使用流表项去编程网络的好处是:intents可以跟踪网络的状态,并且为了满足你的intention对网络进行重新配置。例如:如果某处的link断开了,intent框架可以变更(reroute)你的intent(也就是你的流表)到另外可用的路径上。但是,如果没有另外可用的路径该怎么办呢?在这种情况下,intent将进入失败状态,并且保持这种状态直到出现一个可用的路径。

onos> add-host-intent 00:00:00:00:00:01/-1 00:00:00:00:00:09/-1
Host to Host intent submitted:
HostToHostIntent{id=0x0, key=0x0, appId=DefaultApplicationId{id=3, name=org.onosproject.cli}, priority=100, resources=[00:00:00:00:00:01/None, 00:00:00:00:00:09/None], selector=DefaultTrafficSelector{criteria=[]}, treatment=DefaultTrafficTreatment{immediate=[NOACTION], deferred=[], transition=None, meter=None, cleared=false, metadata=null}, constraints=[LinkTypeConstraint{inclusive=false, types=[OPTICAL]}], resourceGroup=null, one=00:00:00:00:00:01/None, two=00:00:00:00:00:09/None}
onos> intents 
Id: 0x0
State: INSTALLED
Key: 0x0
Intent type: HostToHostIntent
Application Id: org.onosproject.cli
Resources: [00:00:00:00:00:01/None, 00:00:00:00:00:09/None]
Treatment: [NOACTION]
Constraints: [LinkTypeConstraint{inclusive=false, types=[OPTICAL]}]
Source host: 00:00:00:00:00:01/None
Destination host: 00:00:00:00:00:09/None

onos> intents -i
Id: 0x0
State: INSTALLED
Key: 0x0
Intent type: HostToHostIntent
Application Id: org.onosproject.cli
Resources: [00:00:00:00:00:01/None, 00:00:00:00:00:09/None]
Treatment: [NOACTION]
Constraints: [LinkTypeConstraint{inclusive=false, types=[OPTICAL]}]
Source host: 00:00:00:00:00:01/None
Destination host: 00:00:00:00:00:09/None
Installable: [FlowRuleIntent{id=0x3, key=0x0, appId=DefaultApplicationId{id=96, name=org.onosproject.net.intent}, resources=[DefaultLink{src=of:0000000000000002/4, dst=of:0000000000000001/1, type=DIRECT, state=ACTIVE, expected=false}, DefaultLink{src=of:0000000000000001/3, dst=of:0000000000000004/4, type=DIRECT, state=ACTIVE, expected=false}], flowRule=[DefaultFlowRule{id=600000e3184ab0, deviceId=of:0000000000000004, priority=100, selector=[IN_PORT:4, ETH_DST:00:00:00:00:00:09, ETH_SRC:00:00:00:00:00:01], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:3], deferred=[], transition=None, meter=None, cleared=false, metadata=null}, tableId=0, created=1495979689127, payLoad=null}, DefaultFlowRule{id=6000009caef945, deviceId=of:0000000000000001, priority=100, selector=[IN_PORT:1, ETH_DST:00:00:00:00:00:09, ETH_SRC:00:00:00:00:00:01], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:3], deferred=[], transition=None, meter=None, cleared=false, metadata=null}, tableId=0, created=1495979689127, payLoad=null}, DefaultFlowRule{id=60000023ebd357, deviceId=of:0000000000000002, priority=100, selector=[IN_PORT:1, ETH_DST:00:00:00:00:00:09, ETH_SRC:00:00:00:00:00:01], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:4], deferred=[], transition=None, meter=None, cleared=false, metadata=null}, tableId=0, created=1495979689127, payLoad=null}], resourceGroup=null}, FlowRuleIntent{id=0x4, key=0x0, appId=DefaultApplicationId{id=96, name=org.onosproject.net.intent}, resources=[DefaultLink{src=of:0000000000000004/4, dst=of:0000000000000001/3, type=DIRECT, state=ACTIVE, expected=false}, DefaultLink{src=of:0000000000000001/1, dst=of:0000000000000002/4, type=DIRECT, state=ACTIVE, expected=false}], flowRule=[DefaultFlowRule{id=6000005e7112cc, deviceId=of:0000000000000004, priority=100, selector=[IN_PORT:3, ETH_DST:00:00:00:00:00:01, ETH_SRC:00:00:00:00:00:09], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:4], deferred=[], transition=None, meter=None, cleared=false, metadata=null}, tableId=0, created=1495979689127, payLoad=null}, DefaultFlowRule{id=6000008bf33a8c, deviceId=of:0000000000000001, priority=100, selector=[IN_PORT:3, ETH_DST:00:00:00:00:00:01, ETH_SRC:00:00:00:00:00:09], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:1], deferred=[], transition=None, meter=None, cleared=false, metadata=null}, tableId=0, created=1495979689127, payLoad=null}, DefaultFlowRule{id=600000f42b1dbe, deviceId=of:0000000000000002, priority=100, selector=[IN_PORT:4, ETH_DST:00:00:00:00:00:01, ETH_SRC:00:00:00:00:00:09], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:1], deferred=[], transition=None, meter=None, cleared=false, metadata=null}, tableId=0, created=1495979689127, payLoad=null}], resourceGroup=null}]

8.GUI

地址:http://localhost:8181/onos/ui

tools/test/bin/onos-gui localhost


ONOS Core REST API
http://127.0.0.1:8181/onos/v1/docs/index.html

默认用户名密码:karaf

来源

OpenDaylight与Mininet应用实战之流表操作

https://wiki.onosproject.org/display/test/Building+ONOS

© 著作权归作者所有

wangxuwei
粉丝 27
博文 343
码字总数 137316
作品 0
杭州
其他
私信 提问
ONOS 项目与 Linux 基金会合作开发 SDN/NFV

近日,ONOS 社区和 Linux 基金会联合宣布结成战略合作关系,双方将联手开发开源的 SDN/NFV 解决方案。 ONOS 项目与 Linux 基金会的合作旨在创建颠覆性的 SDN 解决方法,重点是开源平台、白盒...

oschina
2015/10/18
1K
2
ONF 开源白皮书:SDN 解决方案案例——Carrier/WAN SDN

译者简介:罗旭:湖南师范大学研究生 3.1 运行中的商用部署传输SDN平台 韩国电信公司展示了其传输SDN项目,该项目于2015年11月开始建设,计划2016年1月开始部署。该项目指出了运营商在管理复...

oschina
2016/04/28
2.4K
0
SDN in Action: Build a mini-lab environment and practice SDN-IP/ONOS with GNS3, Mininet and VMware

SDN in Action: Build a mini-lab environment and practice SDN-IP/ONOS with GNS3, Mininet and VMware 薛国锋 xueguofeng2011@gmail.com 本文主要通过简单的实验,对SDN相关概念以及ONOS开......

xueguofeng
2017/09/18
0
0
SDN网络IPv6组播机制支持实时视频业务海量用户扩展

【技术沙龙002期】数据中台:宜信敏捷数据中台建设实践 宜信技术沙龙 将于5月23日晚8点线上直播,点击报名 一、背景: 随着互联网的迅猛发展,诸如视频直播、网络教学等实时业务的广泛应用,...

宜信技术学院
05/16
16
0
2016 年 SDN/NFV 开源三大趋势

在软件定义网络(SDN)和网络功能虚拟化(NFV)开源工作的头几年,开源工作的目标相对模糊,但今年开源工作的进展有了3个明显的趋势。 首先,CORD项目变得越来越受业界的欢迎。CORD项目在2016年受...

两味真火
2016/12/31
1K
0

没有更多内容

加载失败,请刷新页面

加载更多

灵光一闪来个科普贴:Linux文件系统

在计算机系统中,各种需要保存的信息都是以文件的形式存在的。文件管理是对系统信息资源的管理,是操作系统的一项重要功能。 1.文件与文件系统: 1.1文件: 文件是具有名字的一组相关信息的有...

Linux就该这么学
10分钟前
2
0
ExtJS 4.2 评分组件

本文转载于:专业的前端网站➸ExtJS 4.2 评分组件 上一文章是扩展ExtJS自带的Date组件。在这里将创建一个评分组件。 目录 1. 介绍 2. 示例 3. 资源下载 1. 介绍 代码参考的是 Sencha Touch 2...

前端老手
13分钟前
2
0
如何为视频添加封面?

一个好的视频封面可以吸引观众的眼球,从而起到事半功倍的宣传效果,但是很多小伙伴并不知道怎么给视频添加封面。下面分享一个制作封面否方法,操作起来也比较简单的,有兴趣的小伙伴请接着往...

白米稀饭2019
23分钟前
2
0
如何使用soapUI模拟webservice客户端发送请求

参考资料 https://jingyan.baidu.com/article/cbcede0712849a02f40b4d88.html 左边是请求参数,可以自己填写!按着那个绿色三角箭头可以模拟发送请求,右边是返回的报文 soapui如何发送xml格...

故久呵呵
53分钟前
5
0
Java Security 介绍

1.介绍 Java平台设计的重点是安全性。在其核心,java语言本身是类型安全的并且提供了垃圾自动回收,这使其增加了应用程序代码的健壮性。安全的类加载以及验证机制确保了只有合法的代码才能够...

lixiaobao
58分钟前
5
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部