...
Code Block | ||
---|---|---|
| ||
onos> list 110 | Active | 80 | 1.0.0.SNAPSHOT | onos-restapps -a -s * 3 org.onosproject.drivers 1.2.2.SNAPSHOT Builtin device drivers * 116 | Active | 80 | 1.0.0.SNAPSHOT | onos-of-api 117 | Active | 80 | 1.0.0.SNAPSHOT | onos-of-ctl 118 | Active | 80 | 1.0.0.SNAPSHOT | onos-lldp-provider 119 | Active | 80 | 1.0.0.SNAPSHOT | onos-host-provider 120 | Active | 80 | 1.0.0.SNAPSHOT | onos-of-provider-device 121 | Active | 80 | 1.0.0.SNAPSHOT | onos-of-provider-packet 122 | Active | 80 | 1.0.0.SNAPSHOT | onos-of-provider-flow 136 | Active | 80 | 1.0.0.SNAPSHOT | onos-cli 137 | Active | 80 | 8.1.15.v20140411 | Jetty :: Websocket 138 | Active | 80 | 1.0.0.SNAPSHOT | onos-gui 151 | Active | 80 | 1.0.0.SNAPSHOT | onos-core-net 152 | Active | 80 | 1.0.0.SNAPSHOT | onos-core-trivial |
As you can see above, there is no reactive forwarding application loaded. Let's see how we load it.
Make it so, Number one
In your ONOS window, do
Code Block |
---|
onos> feature:install onos-app-fwd |
Then, in a mininet window run the ping again, just this time don't limit the number of pings.
Code Block |
---|
mininet> h11 ping h41 |
This time the ping is flowing:
Code Block | ||
---|---|---|
| ||
mininet> h11 ping h41
PING 10.0.0.19 (10.0.0.19) 56(84) bytes of data.
64 bytes from 10.0.0.19: icmp_req=1 ttl=64 time=9.12 ms
64 bytes from 10.0.0.19: icmp_req=2 ttl=64 time=0.892 ms
64 bytes from 10.0.0.19: icmp_req=3 ttl=64 time=0.075 ms
64 bytes from 10.0.0.19: icmp_req=4 ttl=64 time=0.068 ms |
Start stop start stop....
You have now seen that you can load applications into ONOS dynamically. Actually you can also interrupt applications while they are running so, for example, let's stop the reactive forwarding application.
Code Block |
---|
onos> stop onos-app-fwd |
Observe that the ping has now stopped. This is because when the reactive forwarding application is unloaded, it cleans up after itself by removing the rules that it has pushed. We'll talk more about this in the next section. For now, let's restart the reactive forwarding application.
Code Block |
---|
onos> start onos-app-fwd |
...and the ping restarts
ONOS CLI commands
ONOS has many CLI commands. In this section, we will go through some of the most useful commands. This section may also serve as a CLI reference for you during this tutorial. While we will explain some of the ONOS CLI commands here you can find an exhaustive list by running:
Code Block |
---|
onos> help onos |
or more information about an individual command adding --help to any command. Also most commands have autocompletion to help you find the parameters quickly and easily.
Devices command
An SDN Controller would be nothing without devices to control. Luckily, ONOS has a convenient command to list the device currently known in the system. Running
Code Block |
---|
onos> devices |
will return the following information,
Code Block | ||
---|---|---|
| ||
onos> devices
id=of:0000000000000001, available=true, role=MASTER, type=SWITCH, mfr=Nicira, Inc., hw=Open vSwitch, sw=2.1.3, serial=None, protocol=OF_10
id=of:0000000000000002, available=true, role=MASTER, type=SWITCH, mfr=Nicira, Inc., hw=Open vSwitch, sw=2.1.3, serial=None, protocol=OF_10
id=of:000000000000000b, available=true, role=MASTER, type=SWITCH, mfr=Nicira, Inc., hw=Open vSwitch, sw=2.1.3, serial=None, protocol=OF_10
id=of:000000000000000c, available=true, role=MASTER, type=SWITCH, mfr=Nicira, Inc., hw=Open vSwitch, sw=2.1.3, serial=None, protocol=OF_10
id=of:000000000000000d, available=true, role=MASTER, type=SWITCH, mfr=Nicira, Inc., hw=Open vSwitch, sw=2.1.3, serial=None, protocol=OF_10
id=of:000000000000000e, available=true, role=MASTER, type=SWITCH, mfr=Nicira, Inc., hw=Open vSwitch, sw=2.1.3, serial=None, protocol=OF_10 |
which consists of a device id, and a boolean value which indicates whether this devices is currently up. You also get the type of device and well as it's role relationship with this ONOS instance.
Links command
The links command is used to list the links detected by ONOS. At the ONOS prompt run
Code Block |
---|
onos> links |
and you should get the following output:
Code Block | ||
---|---|---|
| ||
onos> links
src=of:000000000000000e/1, dst=of:0000000000000001/5, type=DIRECT, state=ACTIVE
src=of:000000000000000d/1, dst=of:0000000000000001/4, type=DIRECT, state=ACTIVE
src=of:000000000000000e/2, dst=of:0000000000000002/5, type=DIRECT, state=ACTIVE
src=of:000000000000000c/1, dst=of:0000000000000001/3, type=DIRECT, state=ACTIVE
src=of:000000000000000d/2, dst=of:0000000000000002/4, type=DIRECT, state=ACTIVE
src=of:000000000000000b/1, dst=of:0000000000000001/2, type=DIRECT, state=ACTIVE
src=of:000000000000000c/2, dst=of:0000000000000002/3, type=DIRECT, state=ACTIVE
src=of:000000000000000b/2, dst=of:0000000000000002/2, type=DIRECT, state=ACTIVE
src=of:0000000000000002/2, dst=of:000000000000000b/2, type=DIRECT, state=ACTIVE
src=of:0000000000000001/2, dst=of:000000000000000b/1, type=DIRECT, state=ACTIVE
src=of:0000000000000002/3, dst=of:000000000000000c/2, type=DIRECT, state=ACTIVE
src=of:0000000000000001/3, dst=of:000000000000000c/1, type=DIRECT, state=ACTIVE
src=of:0000000000000002/4, dst=of:000000000000000d/2, type=DIRECT, state=ACTIVE
src=of:0000000000000001/4, dst=of:000000000000000d/1, type=DIRECT, state=ACTIVE
src=of:0000000000000002/5, dst=of:000000000000000e/2, type=DIRECT, state=ACTIVE
src=of:0000000000000001/5, dst=of:000000000000000e/1, type=DIRECT, state=ACTIVE
src=of:0000000000000002/1, dst=of:0000000000000001/1, type=DIRECT, state=ACTIVE
src=of:0000000000000001/1, dst=of:0000000000000002/1, type=DIRECT, state=ACTIVE |
The output shows you the list of discovered links. Reported links are formatted by source device-port pair to destination device-port pair. The 'type' field indicates whether the link is a direct connection between two devices or not.
Hosts command
A network without hosts is a little like a city without bars, it would be a ridiculously boring place. Fortunately, ONOS has the ability to list the hosts (as opposed to bars, although that would be a great feature) currently in the system.
Code Block |
---|
onos> hosts |
with this output:
Code Block | ||
---|---|---|
| ||
onos> hosts
id=00:00:00:00:00:01/-1, mac=00:00:00:00:00:01, location=of:000000000000000b/3, vlan=-1, ip(s)=[10.0.0.1]
id=00:00:00:00:00:13/-1, mac=00:00:00:00:00:13, location=of:000000000000000e/3, vlan=-1, ip(s)=[10.0.0.19] |
Which displays the hosts' id as well as its mac address and where in the network it is connected. The '-1' in the id field is used to display the vlan information, in this case there is no vlan .
Flows command
The flows command allows you to observe which flow entries are currently registered in the system. Flow entries may be in several states:
- PENDING_ADD - The flow has been submitted and forwarded to the switch.
- ADDED - The flow has been added to the switch.
- PENDING_REMOVE - The request to remove the flow has been submitted and forwarded to the switch.
- REMOVED - The rule has been removed.
So let's start some traffic but going to the mininet window and running
Code Block |
---|
mininet> h11 ping h41 |
then in the ONOS window let's run the flows command
Code Block |
---|
onos> flows |
you should see the following output
Code Block | ||
---|---|---|
| ||
deviceId=of:0000000000000001, flowRuleCount=1
id=30000b889cb32, state=ADDED, bytes=8722, packets=89, duration=89, priority=10, appId=org.onlab.onos.fwd
selector=[ETH_TYPE{ethType=800}, ETH_SRC{mac=00:00:00:00:00:01}, ETH_DST{mac=00:00:00:00:00:13}, IN_PORT{port=2}]
treatment=[OUTPUT{port=5}]
deviceId=of:0000000000000002, flowRuleCount=1
id=30000b889cf4d, state=ADDED, bytes=8624, packets=88, duration=88, priority=10, appId=org.onlab.onos.fwd
selector=[ETH_TYPE{ethType=800}, ETH_SRC{mac=00:00:00:00:00:13}, ETH_DST{mac=00:00:00:00:00:01}, IN_PORT{port=5}]
treatment=[OUTPUT{port=2}]
deviceId=of:000000000000000b, flowRuleCount=2
id=30000b88a8321, state=ADDED, bytes=8722, packets=89, duration=89, priority=10, appId=org.onlab.onos.fwd
selector=[ETH_TYPE{ethType=800}, ETH_SRC{mac=00:00:00:00:00:13}, ETH_DST{mac=00:00:00:00:00:01}, IN_PORT{port=2}]
treatment=[OUTPUT{port=3}]
id=30000b88a833e, state=ADDED, bytes=8722, packets=89, duration=89, priority=10, appId=org.onlab.onos.fwd
selector=[ETH_TYPE{ethType=800}, ETH_SRC{mac=00:00:00:00:00:01}, ETH_DST{mac=00:00:00:00:00:13}, IN_PORT{port=3}]
treatment=[OUTPUT{port=1}]
deviceId=of:000000000000000c, flowRuleCount=0
deviceId=of:000000000000000d, flowRuleCount=0
deviceId=of:000000000000000e, flowRuleCount=2
id=30000b88a8e45, state=ADDED, bytes=8722, packets=89, duration=89, priority=10, appId=org.onlab.onos.fwd
selector=[ETH_TYPE{ethType=800}, ETH_SRC{mac=00:00:00:00:00:01}, ETH_DST{mac=00:00:00:00:00:13}, IN_PORT{port=1}]
treatment=[OUTPUT{port=3}]
id=30000b88a8e82, state=ADDED, bytes=8722, packets=89, duration=89, priority=10, appId=org.onlab.onos.fwd
selector=[ETH_TYPE{ethType=800}, ETH_SRC{mac=00:00:00:00:00:13}, ETH_DST{mac=00:00:00:00:00:01}, IN_PORT{port=3}]
treatment=[OUTPUT{port=2}] |
As you can see from the above output, ONOS provides many details about he the flows at the switches. For example each flow entry defines a selector and treatment which is the set of traffic matched by the the flow entry and how this traffic should be handled. Notice as well that each flow entry it tagged by an appId (application id), this appId identifies which application installed this flow entry. This is a useful feature because it can help an admin identify which application may be misbehaving or consuming many resources.
Apps command
The apps command enables the user to list the applications currently running on ONOS.
Code Block | ||
---|---|---|
| ||
onos> apps
id=1, name=org.onlab.onos.net.intent
id=2, name=org.onlab.onos.fwd |
24 org.onosproject.openflow 1.2.2.SNAPSHOT OpenFlow protocol southbound providers |
As you can see above, there is no reactive forwarding application loaded. Let's see how we load it.
Make it so, Number one
In your ONOS window, do
Code Block |
---|
onos> app activate org.onosproject.fwd |
Then, in a mininet window run the ping again, just this time don't limit the number of pings.
Code Block |
---|
mininet> h11 ping h41 |
This time the ping is flowing:
Code Block | ||
---|---|---|
| ||
mininet> h11 ping h41
PING 10.0.0.19 (10.0.0.19) 56(84) bytes of data.
64 bytes from 10.0.0.19: icmp_req=1 ttl=64 time=9.12 ms
64 bytes from 10.0.0.19: icmp_req=2 ttl=64 time=0.892 ms
64 bytes from 10.0.0.19: icmp_req=3 ttl=64 time=0.075 ms
64 bytes from 10.0.0.19: icmp_req=4 ttl=64 time=0.068 ms |
Start stop start stop....
You have now seen that you can load applications into ONOS dynamically. Actually you can also interrupt applications while they are running so, for example, let's stop the reactive forwarding application.
Code Block |
---|
onos> app deactivate org.onosproject.fwd |
Observe that the ping has now stopped. This is because when the reactive forwarding application is unloaded, it cleans up after itself by removing the rules that it has pushed. We'll talk more about this in the next section. For now, let's restart the reactive forwarding application.
Code Block |
---|
onos> app activate org.onosproject.fwd |
...and the ping restarts
ONOS CLI commands
ONOS has many CLI commands. In this section, we will go through some of the most useful commands. This section may also serve as a CLI reference for you during this tutorial. While we will explain some of the ONOS CLI commands here you can find an exhaustive list by running:
Code Block |
---|
onos> help onos |
or more information about an individual command adding --help to any command. Also most commands have autocompletion to help you find the parameters quickly and easily.
Devices command
An SDN Controller would be nothing without devices to control. Luckily, ONOS has a convenient command to list the device currently known in the system. Running
Code Block |
---|
onos> devices |
will return the following information,
Code Block | ||
---|---|---|
| ||
onos> devices
id=of:0000000000000001, available=true, role=MASTER, type=SWITCH, mfr=Nicira, Inc., hw=Open vSwitch, sw=2.1.3, serial=None, protocol=OF_10
id=of:0000000000000002, available=true, role=MASTER, type=SWITCH, mfr=Nicira, Inc., hw=Open vSwitch, sw=2.1.3, serial=None, protocol=OF_10
id=of:000000000000000b, available=true, role=MASTER, type=SWITCH, mfr=Nicira, Inc., hw=Open vSwitch, sw=2.1.3, serial=None, protocol=OF_10
id=of:000000000000000c, available=true, role=MASTER, type=SWITCH, mfr=Nicira, Inc., hw=Open vSwitch, sw=2.1.3, serial=None, protocol=OF_10
id=of:000000000000000d, available=true, role=MASTER, type=SWITCH, mfr=Nicira, Inc., hw=Open vSwitch, sw=2.1.3, serial=None, protocol=OF_10
id=of:000000000000000e, available=true, role=MASTER, type=SWITCH, mfr=Nicira, Inc., hw=Open vSwitch, sw=2.1.3, serial=None, protocol=OF_10 |
which consists of a device id, and a boolean value which indicates whether this devices is currently up. You also get the type of device and well as it's role relationship with this ONOS instance.
Links command
The links command is used to list the links detected by ONOS. At the ONOS prompt run
Code Block |
---|
onos> links |
and you should get the following output:
Code Block | ||
---|---|---|
| ||
onos> links
src=of:000000000000000e/1, dst=of:0000000000000001/5, type=DIRECT, state=ACTIVE
src=of:000000000000000d/1, dst=of:0000000000000001/4, type=DIRECT, state=ACTIVE
src=of:000000000000000e/2, dst=of:0000000000000002/5, type=DIRECT, state=ACTIVE
src=of:000000000000000c/1, dst=of:0000000000000001/3, type=DIRECT, state=ACTIVE
src=of:000000000000000d/2, dst=of:0000000000000002/4, type=DIRECT, state=ACTIVE
src=of:000000000000000b/1, dst=of:0000000000000001/2, type=DIRECT, state=ACTIVE
src=of:000000000000000c/2, dst=of:0000000000000002/3, type=DIRECT, state=ACTIVE
src=of:000000000000000b/2, dst=of:0000000000000002/2, type=DIRECT, state=ACTIVE
src=of:0000000000000002/2, dst=of:000000000000000b/2, type=DIRECT, state=ACTIVE
src=of:0000000000000001/2, dst=of:000000000000000b/1, type=DIRECT, state=ACTIVE
src=of:0000000000000002/3, dst=of:000000000000000c/2, type=DIRECT, state=ACTIVE
src=of:0000000000000001/3, dst=of:000000000000000c/1, type=DIRECT, state=ACTIVE
src=of:0000000000000002/4, dst=of:000000000000000d/2, type=DIRECT, state=ACTIVE
src=of:0000000000000001/4, dst=of:000000000000000d/1, type=DIRECT, state=ACTIVE
src=of:0000000000000002/5, dst=of:000000000000000e/2, type=DIRECT, state=ACTIVE
src=of:0000000000000001/5, dst=of:000000000000000e/1, type=DIRECT, state=ACTIVE
src=of:0000000000000002/1, dst=of:0000000000000001/1, type=DIRECT, state=ACTIVE
src=of:0000000000000001/1, dst=of:0000000000000002/1, type=DIRECT, state=ACTIVE |
The output shows you the list of discovered links. Reported links are formatted by source device-port pair to destination device-port pair. The 'type' field indicates whether the link is a direct connection between two devices or not.
Hosts command
A network without hosts is a little like a city without bars, it would be a ridiculously boring place. Fortunately, ONOS has the ability to list the hosts (as opposed to bars, although that would be a great feature) currently in the system.
Code Block |
---|
onos> hosts |
with this output:
Code Block | ||
---|---|---|
| ||
onos> hosts
id=00:00:00:00:00:01/-1, mac=00:00:00:00:00:01, location=of:000000000000000b/3, vlan=-1, ip(s)=[10.0.0.1]
id=00:00:00:00:00:13/-1, mac=00:00:00:00:00:13, location=of:000000000000000e/3, vlan=-1, ip(s)=[10.0.0.19] |
Which displays the hosts' id as well as its mac address and where in the network it is connected. The '-1' in the id field is used to display the vlan information, in this case there is no vlan .
Flows command
The flows command allows you to observe which flow entries are currently registered in the system. Flow entries may be in several states:
- PENDING_ADD - The flow has been submitted and forwarded to the switch.
- ADDED - The flow has been added to the switch.
- PENDING_REMOVE - The request to remove the flow has been submitted and forwarded to the switch.
- REMOVED - The rule has been removed.
So let's start some traffic but going to the mininet window and running
Code Block |
---|
mininet> h11 ping h41 |
then in the ONOS window let's run the flows command
Code Block |
---|
onos> flows |
you should see the following output
Code Block | ||
---|---|---|
| ||
deviceId=of:0000000000000001, flowRuleCount=1
id=30000b889cb32, state=ADDED, bytes=8722, packets=89, duration=89, priority=10, appId=org.onlab.onos.fwd
selector=[ETH_TYPE{ethType=800}, ETH_SRC{mac=00:00:00:00:00:01}, ETH_DST{mac=00:00:00:00:00:13}, IN_PORT{port=2}]
treatment=[OUTPUT{port=5}]
deviceId=of:0000000000000002, flowRuleCount=1
id=30000b889cf4d, state=ADDED, bytes=8624, packets=88, duration=88, priority=10, appId=org.onlab.onos.fwd
selector=[ETH_TYPE{ethType=800}, ETH_SRC{mac=00:00:00:00:00:13}, ETH_DST{mac=00:00:00:00:00:01}, IN_PORT{port=5}]
treatment=[OUTPUT{port=2}]
deviceId=of:000000000000000b, flowRuleCount=2
id=30000b88a8321, state=ADDED, bytes=8722, packets=89, duration=89, priority=10, appId=org.onlab.onos.fwd
selector=[ETH_TYPE{ethType=800}, ETH_SRC{mac=00:00:00:00:00:13}, ETH_DST{mac=00:00:00:00:00:01}, IN_PORT{port=2}]
treatment=[OUTPUT{port=3}]
id=30000b88a833e, state=ADDED, bytes=8722, packets=89, duration=89, priority=10, appId=org.onlab.onos.fwd
selector=[ETH_TYPE{ethType=800}, ETH_SRC{mac=00:00:00:00:00:01}, ETH_DST{mac=00:00:00:00:00:13}, IN_PORT{port=3}]
treatment=[OUTPUT{port=1}]
deviceId=of:000000000000000c, flowRuleCount=0
deviceId=of:000000000000000d, flowRuleCount=0
deviceId=of:000000000000000e, flowRuleCount=2
id=30000b88a8e45, state=ADDED, bytes=8722, packets=89, duration=89, priority=10, appId=org.onlab.onos.fwd
selector=[ETH_TYPE{ethType=800}, ETH_SRC{mac=00:00:00:00:00:01}, ETH_DST{mac=00:00:00:00:00:13}, IN_PORT{port=1}]
treatment=[OUTPUT{port=3}]
id=30000b88a8e82, state=ADDED, bytes=8722, packets=89, duration=89, priority=10, appId=org.onlab.onos.fwd
selector=[ETH_TYPE{ethType=800}, ETH_SRC{mac=00:00:00:00:00:13}, ETH_DST{mac=00:00:00:00:00:01}, IN_PORT{port=3}]
treatment=[OUTPUT{port=2}] |
As you can see from the above output, ONOS provides many details about he the flows at the switches. For example each flow entry defines a selector and treatment which is the set of traffic matched by the the flow entry and how this traffic should be handled. Notice as well that each flow entry it tagged by an appId (application id), this appId identifies which application installed this flow entry. This is a useful feature because it can help an admin identify which application may be misbehaving or consuming many resourcesAs shown above the tutorial ONOS has three applications loaded. One of them is the reactive forwarding applications, we will see the other two later in this tutorial.
Paths command
Given a network topology, ONOS computes all the shortest paths between any two nodes. This is especially useful for your applications to obtain path information for either flow installation or some other use. The paths command takes two arguments, both of them are devices. To make things easy for you ONOS provides CLI autocompletion by simply hitting the <TAB> key.
...
First let's start by removing the old reactive forwarding application and load the intent reactive forwarding application.
Code Block |
---|
onos> feature:uninstall onos-app-app deactivate org.onosproject.fwd onos> app feature:install onos-app-activate org.onosproject.ifwd |
NB: Notice the different bundle names: onos-app-fwd vs. onos-app-ifwd (Hint: there is an extra 'i' )
Ok let's just make sure it is loaded correctly:make sure it is loaded correctly:
Code Block | ||
---|---|---|
| ||
onos> apps -s -a
* 5 org.onosproject.drivers 1.2.1 Builtin device drivers
* 10 org.onosproject.ifwd 1.2.1 Reactive forwarding application using intent service (experimental)
* 30 org.onosproject.openflow 1.2.1 OpenFlow protocol southbound providers
| ||
Code Block | ||
| ||
onos> apps
id=0, name=org.onlab.onos.net.intent
id=1, name=org.onlab.onos.fwd
id=2, name=org.onlab.onos.ifwd |
So we can see that the intent forwarding application is correctly loadedactive. The appId for the Reactive Forwarding application remains, so if you reload that application it will get the same appId it had previously.
...
Code Block |
---|
onos> remove-intent org.onosproject.ifwd <TAB> onos> purge-intents |
The <tab> key will autocomplete the id that was associated the intent we just pushed. You should now see that there are no intents in the system.
...
First , lets reload our reactive forwarding application.
Code Block |
---|
onos> app feature:uninstall onos-app-deactivate org.onosproject.ifwd onos> feature:install onos-app-app activate org.onosproject.fwd |
ONOS comes with a GUI. The GUI allows you to manipulate your network in a simple way.
You will need to load up the GUI bundle in ONOS, fortunately this is simple:
...
To open the UI simply click on the 'ONOS GUI' icon. Initially, when the UI loads up you will see your network's topology over a map of the US. You can remove the map by hitting 'b'. In fact, the UI has a cheat sheet which can be toggled by hitting '/' which is easy to remember because it's the question mark key except you don't need to hit shift.
...