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>
CLI commands:
onos-vm(config)# <tab> clear connect enable feature logout policy tag-mapping tunnel clearterm date end help no show test version configure echo exit history ping tag trace watch
show switch : show the switches connected to the controller (NOTE: any switch not configured in the config file is not shown)
onos-vm(config)# sh link # Src Switch DPID Src Port Dst Switch DPID Dst 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
show switch <switch DPID> : shows the detail of the switch
onos-vm(config)# sh switch 00:00:00:00:00:00:00:01 # Switch DPID Alias Connected Since Connected At Type Controller -|-----------------------|---------|----------------------------|-----------------|------|---------- 1 00:00:00:00:00:00:00:01 Dallas-R1 Wed Dec 03 16:06:40 PST 2014 192.168.0.3:52922 packet onos-vm
show switch <switch DPID> table <acl/ip/mpls> : shows the specific table of the switch
onos-vm(config)# sh switch 00:00:00:00:00:00:00:01 table acl # Bytes Packets Dur(s) Cookie Priority In Port Src MAC Dst MAC EthType Src IP Dst IP Protocol Src Port Dst Port Instructions -|-----|-------|------|------|--------|-------|-------|-------|-------|------|------|--------|--------|--------|------------ 1 0 0 525 0 0 * * * * * * * * * onos-vm(config)# sh switch 00:00:00:00:00:00:00:01 table ip # Bytes Packets Dur(s) Cookie Priority Dst IP Instructions -|-----|-------|------|------|--------|--------------|----------------------------------------------------- 1 0 0 423 0 65535 192.168.0.2/32 {goto: {tableid: acl}, write: {dec_nw_ttl, group: 1}} 2 0 0 423 0 65535 192.168.0.3/32 {goto: {tableid: acl}, write: {group: 2}} 3 0 0 423 0 49104 7.7.7.0/24 {goto: {tableid: acl}, write: {group: 2}} 4 0 0 444 0 0 * {goto: {tableid: acl}, write: {output: controller}} onos-vm(config)# sh switch 00:00:00:00:00:00:00:01 table mpls # Bytes Packets Dur(s) Priority MPLS Label MPLS BOS MPLS TC Instructions -|-----|-------|------|--------|----------|--------|-------|----------------------------------------------------------------------------------------------------------------------------------------------- 1 0 0 426 65535 102 false * {goto: {tableid: acl}, write: {pop_mpls: 0x8847, copy_ttl_in, group: 1, dec_mpls_ttl}} 2 0 0 426 65535 102 true * {goto: {tableid: acl}, write: {pop_mpls: 0x800, dec_nw_ttl, copy_ttl_in, group: 1}} 3 0 0 426 65535 103 true * {goto: {tableid: acl}, write: {group: 1, dec_mpls_ttl}} 4 0 0 426 65535 103 false * {goto: {tableid: acl}, write: {group: 1, dec_mpls_ttl}} 5 0 0 426 65535 101006 true * {goto: {tableid: acl}, write: {pop_mpls: 0x800, dst_mac: 00:00:02:02:02:80, dec_nw_ttl, src_mac: 00:00:01:01:01:80, output: 6, copy_ttl_in}} 6 0 0 426 65535 101006 false * {goto: {tableid: acl}, write: {dec_mpls_ttl, pop_mpls: 0x8847, dst_mac: 00:00:02:02:02:80, src_mac: 00:00:01:01:01:80, output: 6, copy_ttl_in}} 7 0 0 426 65535 101007 true * {goto: {tableid: acl}, write: {pop_mpls: 0x800, dst_mac: 00:00:02:02:02:80, dec_nw_ttl, src_mac: 00:00:01:01:01:80, output: 7, copy_ttl_in}} 8 0 0 426 65535 101007 false * {goto: {tableid: acl}, write: {dec_mpls_ttl, pop_mpls: 0x8847, dst_mac: 00:00:02:02:02:80, src_mac: 00:00:01:01:01:80, output: 7, copy_ttl_in}} 9 0 0 447 0 * * * {goto: {tableid: acl}, write: {output: controller}}
show link: show the links discovered by the controller (NOTE: any link not configured in the config file is not shown)
onos-vm(config)# sh link # Src Switch DPID Src Port Dst Switch DPID Dst 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