OVS CLI Enhancements

PicOS OVS cli has some enhancements from version 2.7.1.

List ovs running configuration

From PicOS2.7.1 OVS add a new command to display the current configuration by traversing the ovsdb tables. The command is:

ovs-vsctl show-running-config 

admin@PicOS-OVS$ovs-vsctl show-running-config
Open_vSwitch c645ee8a-34d5-4c64-a3dc-0c1a20f3c26e
  Bridge "br0"
    datapath_id: "1c48cc37ab254bc1"
    datapath_type: "pica8"
    Port "ge-1/1/19"
      Interface "ge-1/1/19"
        type: "pica8"
      tag: 1
      vlan_mode: trunk
    Port "br0"
      Interface "br0"
        mtu: 1500
        type: internal
  Pica8 ecafe6f4-97ac-407b-b4df-c871b5cd9561
    hardware_type: "as4610_54t"
admin@PicOS-OVS$

Show ovs-vsctl commands

From PicOS3.2.0, OVS add one command to show the configurations in ovsdb through ovs-vsctl command.

ovs-vsctl display-settings

admin@PICOS-OVS:~$ ovs-vsctl display-settings 
ovs-vsctl add-br br0 
ovs-vsctl add-port br0 ge-1/1/1
ovs-vsctl set port ge-1/1/1  vlan_mode=trunk  tag=1 
ovs-vsctl set interface ge-1/1/1  options=link_speed=100M 
ovs-vsctl add-port br0 ge-1/1/2
ovs-vsctl set port ge-1/1/2  vlan_mode=trunk  tag=1 
ovs-vsctl set interface ge-1/1/2  options=mtu=1500 
ovs-vsctl set-group-ranges ecmp-select-groups=1-100
ovs-vsctl set-match-mode ip=1-1000,ipv6_full=1001-2000

List System Resources Usage

From PicOS2.7.1 OVS add two commands to display current system resources usage and interfaces.

When we show system resources usage, the current mode is cared, such as match-mode, udf-mode, L2-mode, L3-mode, combinate-mode and egress-mode.

The commands are:

         ovs-appctl pica/show tables

         ovs-appctl pica/show interfaces

admin@PicOS-OVS$ovs-appctl pica/show tables
Pica Tables Statistics:
    Pica Tables              Max Limitation          Current Used
    -----------------------------------------------------------------------
    ICAP Table                 2046                    9         
    ECAP Table                 (null)                  (null)    
    VCAP Table                 1024                    0         
    L2 System Table            (null)                  (null)    
    L2 FDB Table               (null)                  (null)    
    L3 Host Table              (null)                  (null)    
    L3 Route Table             (null)                  (null)    
    UDF Table                  (null)                  (null)    
admin@PicOS-OVS$
admin@PicOS-OVS$
admin@PicOS-OVS$ovs-appctl pica/show interfaces
Valid Interfaces On Switch P3290:
Physical interfaces:
ge-1/1/1(1) ge-1/1/2(2) ge-1/1/3(3) ge-1/1/4(4)
ge-1/1/5(5) ge-1/1/6(6) ge-1/1/7(7) ge-1/1/8(8)
ge-1/1/9(9) ge-1/1/10(10) ge-1/1/11(11) ge-1/1/12(12)
ge-1/1/13(13) ge-1/1/14(14) ge-1/1/15(15) ge-1/1/16(16)
ge-1/1/17(17) ge-1/1/18(18) ge-1/1/19(19) ge-1/1/20(20)
ge-1/1/21(21) ge-1/1/22(22) ge-1/1/23(23) ge-1/1/24(24)
ge-1/1/25(25) ge-1/1/26(26) ge-1/1/27(27) ge-1/1/28(28)
ge-1/1/29(29) ge-1/1/30(30) ge-1/1/31(31) ge-1/1/32(32)
ge-1/1/33(33) ge-1/1/34(34) ge-1/1/35(35) ge-1/1/36(36)
ge-1/1/37(37) ge-1/1/38(38) ge-1/1/39(39) ge-1/1/40(40)
ge-1/1/41(41) ge-1/1/42(42) ge-1/1/43(43) ge-1/1/44(44)
ge-1/1/45(45) ge-1/1/46(46) ge-1/1/47(47) ge-1/1/48(48)
te-1/1/49(49) te-1/1/50(50) te-1/1/51(51) te-1/1/52(52)
LAG interfaces: ae1(1025) - ae1023(2047)
Bond interfaces: bond1(2049) - bond1023(3071)
GRE interfaces: gre1(3073) - gre1023(4095)
VXLAN interfaces: vxlan1(4097) - vxlan1023(5119)
L2GRE interfaces: l2gre1(5121) - l2gre1023(6143)
admin@PicOS-OVS$

Associate sw-flow with hw-flow

From PicOS2.7.1, when a new flow entry is added, a unique 64bit flow-id is assigned to it. The flow-id can be used by ovs-ofctl and ovs-appctl to filter the flow entries and associate sw-flow with hw-flow.

The commands are:

ovs-ofctl dump-flows br0 [flow_id=n]

ovs-appctl pica/dump-flows [flow_id=n]


Example 1:

root@PicOS-OVS$ovs-ofctl add-flow br0 priority=200,in_port=1,actions=2
root@PicOS-OVS$ovs-ofctl add-flow br0 priority=124,in_port=1,ip,nw_src=10.10.10.10,actions=4
root@PicOS-OVS$ovs-ofctl dump-flows br0
OFPST_FLOW reply (OF1.4) (xid=0x2):
 cookie=0x0, duration=36.591s, flow_id=1, table=0, n_packets=n/a, n_bytes=0, priority=200,in_port=1 actions=output:2
 cookie=0x0, duration=6.393s, flow_id=2, table=0, n_packets=n/a, n_bytes=0, priority=124,ip,in_port=1,nw_src=10.10.10.10 actions=output:4
root@PicOS-OVS$ovs-appctl pica/dump-flows
#4 normal permanent flow_id=1, priority=124,recirc_id=0,ip,in_port=1,nw_src=10.10.10.10, actions:2
#3 normal permanent flow_id=1, priority=200,recirc_id=0,in_port=1, actions:2
#0 normal_d permanent priority=0,recirc_id=0, actions:drop
Total 3 flows in HW.

From the above example, if two flow entries in table 0 don’t have the exact same match and priority, but the match of sw-flow which has higher priority can cover another sw-flow’s match, then two hw-flows with the same flow-id of sw-flow which has the higher priority will be installed.


Example 2:

root@PicOS-OVS$ovs-ofctl add-flow br0 priority=200,in_port=1,actions=goto_table:1
root@PicOS-OVS$ovs-ofctl add-flow br0 table=1,priority=101,in_port=1,ip,nw_src=10.10.10.11,actions=2
root@PicOS-OVS$ovs-ofctl add-flow br0 table=1,priority=102,ip,nw_src=10.10.10.12,actions=goto_table:2
root@PicOS-OVS$ovs-ofctl add-flow br0 table=2,priority=123,dl_dst=00:11:22:33:44:55,actions=3 
root@PicOS-OVS$
root@PicOS-OVS$ovs-ofctl dump-flows br0
OFPST_FLOW reply (OF1.4) (xid=0x2):
 cookie=0x0, duration=184.078s, flow_id=1, table=0, n_packets=n/a, n_bytes=0, priority=200,in_port=1 actions=goto_table:1
 cookie=0x0, duration=49.800s, flow_id=2, table=1, n_packets=n/a, n_bytes=0, priority=102,ip,nw_src=10.10.10.12 actions=goto_table:2
 cookie=0x0, duration=107.575s, flow_id=3, table=1, n_packets=n/a, n_bytes=0, priority=101,ip,in_port=1,nw_src=10.10.10.11 actions=output:2
 cookie=0x0, duration=7.991s, flow_id=4, table=2, n_packets=n/a, n_bytes=0, priority=123,dl_dst=00:11:22:33:44:55 actions=output:3
root@PicOS-OVS$ovs-appctl pica/dump-flows
#6 normal permanent flow_id=1, priority=201,recirc_id=0,ip,in_port=1,dl_dst=00:11:22:33:44:55,nw_src=10.10.10.12, actions:3
#5 normal permanent flow_id=1, priority=200,recirc_id=0,ip,in_port=1,nw_src=10.10.10.11, actions:2
#0 normal_d permanent priority=0,recirc_id=0, actions:drop
Total 3 flows in HW.

If a flow entry in table 0 has goto action, then the flow-id will be applied to all hw-flows generated by it. Only the flow-id's of sw-flows in first table are cared now.

Display dpid in both hex and decimal

From PicOS2.7.1, when the status of bridge is shown, we add decimal numbers for dpid to display.

admin@PicOS-OVS$ovs-ofctl show br0
OFPT_FEATURES_REPLY (OF1.4) (xid=0x2):
dpid:0x1c48cc37ab254bc1(2038103370851765185)
n_tables:254, n_buffers:256
capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS
OFPST_PORT_DESC reply (OF1.4) (xid=0x3):
 13(ge-1/1/13): addr:cc:37:ab:25:4b:c1
     config:     0
     state:      LINK_UP
     current:    100MB-FD COPPER AUTO_NEG
     advertised: 10MB-FD 100MB-FD 1GB-FD COPPER AUTO_NEG
     supported:  10MB-FD 100MB-FD 1GB-FD COPPER AUTO_NEG
     peer:       10MB-HD 10MB-FD 100MB-HD 100MB-FD COPPER
     speed: 100 Mbps now, 1000 Mbps max
LOCAL(br0): addr:cc:37:ab:25:4b:c1
     config:     0
     state:      LINK_UP
     current:    10MB-FD COPPER
     supported:  10MB-FD COPPER
     speed: 10 Mbps now, 10 Mbps max
OFPT_GET_CONFIG_REPLY (OF1.4) (xid=0x5): frags=normal miss_send_len=0

List Interface Details

From PicOS2.7.1, a command is added to display the details of a specific interface or all interfaces in the bridge. A corresponding openflow multipart message should be added by using multipart experimenter type, the controller can then get these statistics as well.

The command is:

ovs-ofctl dump-interfaces <bridge> [interface]


Example:

Add the following flow:

admin@PicOS-OVS$ovs-ofctl add-flow br0 in_port=13,actions=15

No packets:

admin@PicOS-OVS$ovs-ofctl  dump-interfaces br0 ge-1/1/15   
PXST_INTERFACE_STATS reply (OF1.4) (xid=0x4): 1 interfaces
  ge-1/1/15(port 15):
     Traffic statistics:
        Input Packets............................0
        Output Packets...........................0
        Input Octets.............................0
        Output Octets............................0


Port 13 send unicast packets to match the flow and check:

admin@PicOS-OVS$ovs-ofctl  dump-interfaces br0 ge-1/1/13
PXST_INTERFACE_STATS reply (OF1.4) (xid=0x4): 1 interfaces
  ge-1/1/13(port 13):
     Traffic statistics:
        Input Packets............................3013397
        Output Packets...........................0
        Input Octets.............................771429632
        Output Octets............................0
     Transmit:
        Unicast packets........................0
        Multicast packets......................0
        Broadcast packets......................0
        Packets 64 Octets......................0
        Packets 65-127 Octets..................0
        Packets 128-255 Octets.................0
        Packets 256-511 Octets.................0
        Packets 512-1023 Octets................0
        Packets 1024-1518 Octets...............0
        Oversize Packets.......................0
        Total Packets Without Errors...........0
        Discarded Packets......................0
        Total Packets With Errors..............0
        Single Collision Frames................0
        Multiple Collision Frames..............0
        Deferred Frames........................0
        Late Collisions........................0
        Excessive Collisions...................0
        Pause Frames...........................0
     Receive:
        Unicast packets........................3013393
        Multicast packets......................0
        Broadcast packets......................0
        Packets 64 Octets......................0
        Packets 65-127 Octets..................0
        Packets 128-255 Octets.................0
        Packets 256-511 Octets.................3013396
        Packets 512-1023 Octets................0
        Packets 1024-1518 Octets...............0
        Oversize Packets.......................0
        Total Packets Without Errors...........3013397
        Discarded Packets......................0
        Total Packets With Errors..............0
        Alignment Errors.......................0
        FCS Errors.............................0
        Collisions.............................0
        Pause Frames...........................0

Copyright © 2024 Pica8 Inc. All Rights Reserved.