Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page explain how to use the SR cli. The example used in the example uses sr-3node.conf configuration file, which is explained in the Configuration ONOS section <LINK>

Show switch information

The folllowing shows all commands that SR cli supports. Among them, we explain show, watch, and configure, which are mainly used for segment routing application.show switch : show the switches connected to the controller (NOTE: any switch not configured in the config file is not shown)

Code Block
languagetext
onos-vm# <tab>
clearsh link 
# Src Switch DPID configure  date       enable     exit      Src historyPort Dst Switch DPID no         show       trace    Dst  watch      
clearterm  connect    echo       end        help       logout     ping       test       version

show switch : show the switches connected to the controller (NOTE: any switch not configured in the config file is not shown)

Code Block
languagetext
onos-vm# sh link 
# Src Switch DPID                     Src Port Dst Switch DPID                     Dst Port Type
-|---Port Type
-|----------------------------------------------|--------|-----------------------------------|--------|------
1 00:00:00:00:00:00:00:01 (Dallas-R1) 7        00:00:00:00:00:00:00:02 (Dallas-R2) 3        packet
2 00:00:00:00:00:00:00:02 (Dallas-R2) 1        00:00:00:00:00:00:00:01 (Dallas-R1) 6        packet
3 00:00:00:00:00:00:00:03 (Dallas-R3) 2        00:00:00:00:00:00:00:02 (Dallas-R2) 2        packet

...

Code Block
languagetext
onos-vm# watch sh switch 00:00:00:00:00:00:00:01 port 
# OF Port #     Status Rcv Bytes Rcv Pkts Rcv Errs Rcv Dropped Rcv CRC Rcv Overruns Rcv Frame Errs Xmit Bytes Xmit Pkts Xmit Errs Xmit Dropped Collisions
-|-------------|------|---------|--------|--------|-----------|-------|------------|--------------|----------|---------|---------|------------|----------
1 1 (s1-eth1)   up     1880      22       0        0           0       0            0              5651       80        0         0            0
2 2 (s1-eth2)   up     600       8        0        0           0       0            0              4531       68        0         0            0
3 3 (s1-eth3)   up     558       7        0        0           0       0            0              4531       68        0         0            0
4 4 (s1-eth4)   up     558       7        0        0           0       0            0              4489       67        0         0            0
5 5 (s1-eth5)   up     558       7        0        0           0       0            0              4489       67        0         0            0
6 6 (s1-eth6)   up     5144      74       0        0           0       0            0              5101       73        0         0            0
7 7 (s1-eth7)   up     5046      73       0        0           0       0            0              4999       72        0         0            0
8 8 (s1-eth8)   up     4556      68       0        0           0       0            0              4489       67        0         0            0
9 65534 (local) up     0         0        0        0           0       0            0              0          0         0         0            0
Executing sh switch 00:00:00:00:00:00:00:01 port  
# OF Port #     Status Rcv Bytes Rcv Pkts Rcv Errs Rcv Dropped Rcv CRC Rcv Overruns Rcv Frame Errs Xmit Bytes Xmit Pkts Xmit Errs Xmit Dropped Collisions
-|-------------|------|---------|--------|--------|-----------|-------|------------|--------------|----------|---------|---------|------------|----------
1 1 (s1-eth1)   up     2076      24       0        0           0       0            0              5847       82        0         0            0
2 2 (s1-eth2)   up     600       8        0        0           0       0            0              4531       68        0         0            0
3 3 (s1-eth3)   up     558       7        0        0           0       0            0              4531       68        0         0            0
4 4 (s1-eth4)   up     558       7        0        0           0       0            0              4489       67        0         0            0
5 5 (s1-eth5)   up     558       7        0        0           0       0            0              4489       67        0         0            0
6 6 (s1-eth6)   up     5242      75       0        0           0       0            0              5203       74        0         0            0
7 7 (s1-eth7)   up     5144      74       0        0           0       0            0              5101       73        0         0            0
8 8 (s1-eth8)   up     4556      68       0        0           0       0            0              4489       67        0         0            0
9 65534 (local) up     0         0        0        0           0       0            0              0          0         0         0            0

show policy : show the policy information created by operators (NOTE: Configuring switches section describe how to create a policy)

Code Block
languagetext
onos-vm(config)# sh policy 
# Policy Id Policy Type Priority Dst Mac Src Mac Ether Type Dst IP     IP Protocol Src IP      Dst TcpPort Src TcpPort Tunnel Used
-|---------|-----------|--------|-------|-------|----------|----------|-----------|-----------|-----------|-----------|-----------
1 p1  0      TUNNEL_FLOW 0 10000    *       *0       0x2048     7.7.7.7/32 * 0          10.0.1.1/32 * 0         0         0 *           t10


show tunnelpolicy : show the tunnel policy information created by operators (NOTE: Configuring switches section describe how to create a tunnel)policy)

Code Block
languagetext
onos-vm(config)# sh policy 
# Policy Id Policy Type Priority Dst Mac Src Mac Ether Type Dst IP     IP Protocol Src IP      Dst TcpPort Src TcpPort Tunnel Used
-|---------|-----------|--------|-------|-------|---
Code Block
languagetext
onos-vm(config)# sh tunnel 
# Id Policies Tunnel Path [Head-->Tail] Label Stack [Outer-->Inner]
-|--|-------|--|--------|-----------|------|-----|-----------|-----------
1 t1          [101, 102, 103]           [[103]]

 

Configuring switches

configure: enter configuration mode

Code Block
languagetext
onos-vm# configure 
onos-vm(config)# <tab>
clear        connect      enable |-----------
1 p1      feature  TUNNEL_FLOW 10000   logout *      policy *      tag-mapping 0x2048 tunnel    7.7.7.7/32 *  
clearterm    date     10.0.1.1/32 *   end        *  help         no           show         test         version      
configure    echot1


show tunnel : show the tunnel information created by operators (NOTE: Configuring switches section describe how to create a tunnel)

Code Block
languagetext
onos-vm(config)# sh tunnel 
# Id Policies Tunnel Path [Head-->Tail] Label Stack [Outer-->Inner]
-|--|--------|-------------------------|---------------------------
1 t1          [101, 102, exit103]         history  [[103]]

 

Configuring switches

configure: enter configuration mode

Code Block
languagetext
mininet-vm> enable
mininet-vm#   ping         tag          trace        watch  configure 
mininet-vm(config)# 


tunnel <tunnel ID> : Create a tunnel for a tunnel-flow policy. Specify the node SID of all routers of the tunnel, following node keyword.  end suspends the tunnel creation  If you want to suspend creating the tunnel, you can type end. It will suspend creating the tunnel and exit the configuration mode.

...

policy <policy ID> policy-type <policy type>: Create a specific type of policy. Only tunnel-flow type is supported now. flow-entry, tunnel, and priority must be specified. IP, TCP, and UDP are supported as the flow-entry type. The first subnet (10.0.1.1/32 in the example) is the source, and the second subnet (7.7.7.7/32 in the example) is the destination.

Code Block
languagetext
onos-vm(config)# policy p1 policy-type tunnel-flow 
onos-vm(config-policy)# flow-entry ip 10.0.1.1/32 7.7.7.7/32
onos-vm(config-policy)# tunnel t1
onos-vm(config-policy)# priority 10000
onos-vm(config-policy)# exit 

...

Code Block
languagetext
onos-vm(config)# sh tunnel 
# Id Policies Tunnel Path [Head-->Tail] Label Stack [Outer-->Inner]
-|--|--------|-------------------------|---------------------------
1 t1          [101, 102, 103]           [[103]]
onos-vm(config)# no tunnel t`
Error: Invalid argument: Invalid Alphabetic character, followed by alphanumerics: t`; Invalid characters in identifier
onos-vm(config)# no tunnel t1
onos-vm(config)# sh tunnel 
None.