open-switch/opx-tools

opx-config-global-switch --lag-hash-fields broken on 4112F-ON

Closed this issue · 3 comments

Heads Up Skip to the bottom to see where I currently am troubleshooting this.

System Info:

Not sure why it is unstable. I installed with the 3.2.0 installer and the HCL says the 4112F-ON is support on 3.0 and up.

    OS_NAME="OPX"
    OS_VERSION="unstable"
    PLATFORM="S4112F-ON"
    ARCHITECTURE="x86_64"
    INTERNAL_BUILD_ID="OpenSwitch blueprint for Dell 1.0.0"
    BUILD_VERSION="unstable.0-stretch"
    BUILD_DATE="2019-06-21T19:04:22+0000"
    INSTALL_DATE="2019-10-23T23:16:10+00:00"
    SYSTEM_UPTIME= 1 day, 5 minutes
    SYSTEM_STATE= running
    UPGRADED_PACKAGES=no
    ALTERED_PACKAGES=yes

Output of command:

root@OPX:~# opx-config-global-switch --lag-hash-fields src-ip,dest-ip,l4-dest-port,l4-src-port,ip-protocol

usage: opx-config-global-switch [-h]
                                [--switch-mode {store-and-forward,cut-through}]
                                [--lag-hash-alg {crc,random,xor}]
                                [--lag-hash-seed SEED]
                                [--ecmp-hash-alg {crc,random,xor}]
                                [--ecmp-hash-seed SEED] [--mac-age-time TIME]
                                [--default-mac-addr MACADDR]
                                [--counter-refresh TIME]
                                [--uft-mode {default,scaled-L2,scaled-L3-hosts,scaled-L3-routes}]
opx-config-global-switch: error: unrecognized arguments: --lag-hash-fields src-ip,dest-ip,l4-dest-port,l4-src-port,ip-protocol

I dug around in the in the source code and the problem occurs in line 214. See code here.

lag-hash-fields is not part of target-attrs. My target attrs are

['base-switch/switching-entities/switching-entity/num-unicast-queues-per-port', 'base-switch/switching-entities/switching-entity/max-vxlan-overlay-rifs', 'base-switch/switching-entities/switching-entity/uft-mode', 'base-switch/switching-entities/switching-entity/max-ecmp-entry-per-group', 'base-switch/switching-entities/switching-entity/max-ipv6-extended-prefix-routes', 'base-switch/switching-entities/switching-entity/num-queues-per-port', 'base-switch/switching-entities/switching-entity/lag-hash-algorithm', 'base-switch/switching-entities/switching-entity/ipv6-extended-prefix-routes', 'base-switch/switching-entities/switching-entity/acl-entry-max-priority', 'base-switch/switching-entities/switching-entity/ipv6-extended-prefix-routes-lpm-block-size', 'base-switch/switching-entities/switching-entity/qos-rate-adjust', 'base-switch/switching-entities/switching-entity/ecmp-hash-algorithm', 'base-switch/switching-entities/switching-entity/lag-hash-seed-value', 'base-switch/switching-entities/switching-entity/switch-id', 'base-switch/switching-entities/switching-entity/acl-table-max-priority', 'base-switch/switching-entities/switching-entity/acl-table-min-priority', 'base-switch/switching-entities/switching-entity/ecmp-group-size', 'base-switch/switching-entities/switching-entity/l3-nexthop-table-size', 'base-switch/switching-entities/switching-entity/max-mtu', 'base-switch/switching-entities/switching-entity/acl-entry-min-priority', 'base-switch/switching-entities/switching-entity/counter-refresh-interval', 'base-switch/switching-entities/switching-entity/num-queues-cpu-port', 'base-switch/switching-entities/switching-entity/bst-enable', 'base-switch/switching-entities/switching-entity/total-buffer-size', 'base-switch/switching-entities/switching-entity/mac-age-timer', 'base-switch/switching-entities/switching-entity/egress-buffer-pool-num', 'base-switch/switching-entities/switching-entity/num-multicast-queues-per-port', 'base-switch/switching-entities/switching-entity/default-mac-address', 'base-switch/switching-entities/switching-entity/bridge-table-size', 'base-switch/switching-entities/switching-entity/uft-mode-info', 'base-switch/switching-entities/switching-entity/vxlan-riot-enable', 'base-switch/switching-entities/switching-entity/max-vxlan-overlay-nexthops', 'base-switch/switching-entities/switching-entity/ingress-buffer-pool-num', 'base-switch/switching-entities/switching-entity/temperature', 'base-switch/switching-entities/switching-entity/switch-mode', 'base-switch/switching-entities/switching-entity/rif-table-size', 'base-switch/switching-entities/switching-entity/ecmp-hash-seed-value', 'base-switch/switching-entities/switching-entity/bst-tracking-mode']

Edit:

Some additional info. Below is the response from resp = cps_get('target', 'base-switch/switching-entities/switching-entity', {})

[   {   'data': {   'base-switch/switching-entities/switching-entity/acl-entry-max-priority': bytearray(b'\xff\xff\xff\x7f'),
                    'base-switch/switching-entities/switching-entity/acl-entry-min-priority': bytearray(b'\x00\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/acl-table-max-priority': bytearray(b'\x0b\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/acl-table-min-priority': bytearray(b'\x00\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/bridge-table-size': bytearray(b'\x00@\x02\x00'),
                    'base-switch/switching-entities/switching-entity/bst-enable': bytearray(b'\x00\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/bst-tracking-mode': bytearray(b'\x02\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/counter-refresh-interval': bytearray(b'\x05\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/default-mac-address': bytearray(b'\x88o\xd4\x98\xb7\x80'),
                    'base-switch/switching-entities/switching-entity/ecmp-group-size': bytearray(b'\x00\x01\x00\x00'),
                    'base-switch/switching-entities/switching-entity/ecmp-hash-algorithm': bytearray(b'\x02\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/ecmp-hash-seed-value': bytearray(b'\x00\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/egress-buffer-pool-num': bytearray(b'\x04\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/ingress-buffer-pool-num': bytearray(b'\x04\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/ipv6-extended-prefix-routes': bytearray(b'\x00\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/ipv6-extended-prefix-routes-lpm-block-size': bytearray(b'\x00\x04\x00\x00'),
                    'base-switch/switching-entities/switching-entity/l3-nexthop-table-size': bytearray(b'\x00\x80\x00\x00'),
                    'base-switch/switching-entities/switching-entity/lag-hash-algorithm': bytearray(b'\x02\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/lag-hash-seed-value': bytearray(b'\x00\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/mac-age-timer': bytearray(b'\x08\x07\x00\x00'),
                    'base-switch/switching-entities/switching-entity/max-ecmp-entry-per-group': bytearray(b'\x00\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/max-ipv6-extended-prefix-routes': bytearray(b'\x00\x0c\x00\x00'),
                    'base-switch/switching-entities/switching-entity/max-mtu': bytearray(b'\x00$\x00\x00'),
                    'base-switch/switching-entities/switching-entity/max-vxlan-overlay-nexthops': bytearray(b'\x00\x10\x00\x00'),
                    'base-switch/switching-entities/switching-entity/max-vxlan-overlay-rifs': bytearray(b'\x00\x08\x00\x00'),
                    'base-switch/switching-entities/switching-entity/num-multicast-queues-per-port': bytearray(b'\n\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/num-queues-cpu-port': bytearray(b'+\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/num-queues-per-port': bytearray(b'\x14\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/num-unicast-queues-per-port': bytearray(b'\n\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/qos-rate-adjust': bytearray(b'\x00\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/rif-table-size': bytearray(b'\x000\x00\x00'),
                    'base-switch/switching-entities/switching-entity/switch-id': bytearray(b'\x00\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/switch-mode': bytearray(b'\x02\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/temperature': bytearray(b'0\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/total-buffer-size': bytearray(b'\x9c/\x00\x00'),
                    'base-switch/switching-entities/switching-entity/uft-mode': bytearray(b'\x01\x00\x00\x00'),
                    'base-switch/switching-entities/switching-entity/uft-mode-info': {   '0': {   'base-switch/switching-entities/switching-entity/uft-mode-info/host-table-size': bytearray(b'\x00\x10\x02\x00'),
                                                                                                  'base-switch/switching-entities/switching-entity/uft-mode-info/l2-mac-table-size': bytearray(b'\x00@\x02\x00'),
                                                                                                  'base-switch/switching-entities/switching-entity/uft-mode-info/l3-route-table-size': bytearray(b'\x00@\x00\x00'),
                                                                                                  'base-switch/switching-entities/switching-entity/uft-mode-info/mode': bytearray(b'\x01\x00\x00\x00')}},
                    'base-switch/switching-entities/switching-entity/vxlan-riot-enable': bytearray(b'\x01\x00\x00\x00')},
        'key': '1.36.2359341.2359299.2359302.'}]

Edit 2:

It looks like lag-hash-field is in the CPS database:

root@OPX:/usr/lib/x86_64-linux-gnu# cps_model_info base-switch/switching-entities/switching-entity | grep -B 10 -A 10 --text lag-hash-field
Registered to CPS with qualifier:  target

Process Owner:  opx_nas_daemon


Registered to CPS with qualifier:  observed

Process Owner:  opx_nas_daemon


base-switch/switching-entities/switching-entity/lag-hash-fields
        Attribute Type =  leaf-list
        Description =  The switches hash fields used for lags

Registered to CPS with qualifier:  target

Process Owner:  opx_nas_daemon


Registered to CPS with qualifier:  observed

Edit 3:

It looks like the function cps_get:

def cps_get(q, obj, attrs={}):
    resp = []
    return resp if cps.get([cps_object.CPSObject(obj,
                                                 qual=q,
                                                 data=attrs
                                             ).get()
                        ], resp
    ) else None

does not return leaf-lists from the YANG model, which is why lag-hash-fields doesn't show up. Is that the intended behavior? cps_object.CPSObject just returns the numerical identifier so it looks like the problem must exist in cps.get and it looks like that's a module imported from C++?

You can run cps_get_oid.py -qua target base-switch/switching-entities/switching-entity | grep <ANY LEAF LIST> and there won't be any results.

@grantcurell , although the entry lag-hash-fields is defined in the yang it is not used. So the error you are facing is expected.

I believe what you are looking for is defined in dell-base-hash.yang. However as of now there is no direct command line tool available to get/set this field. You can try using the cps command line tools to do the same.

Examples:

# Get hash fields value for LAG NON_IP traffic
# cps_get_oid.py -qua target base-traffic-hash/entry base-traffic-hash/entry/obj-type=2

============1.257.16842755.16842753.16842754.==========
base-traffic-hash/entry/std-hash-field = 5,11,10,7
------------------------------------------------
# Get hash fields value for LAG IP traffic
# cps_get_oid.py -qua target base-traffic-hash/entry base-traffic-hash/entry/obj-type=6
============1.257.16842755.16842753.16842754.==========
base-traffic-hash/entry/std-hash-field = 1,2,8,9,6
------------------------------------------------
# Set hash fields value for LAG IP traffic
# cps_set_oid.py -qua target \
> -oper set \
> -attr base-traffic-hash/entry/std-hash-field=1,2,8,9,6,5 \
> base-traffic-hash/entry \
> base-traffic-hash/entry/obj-type=6
Success
Key: 1.257.16842755.16842753.
base-traffic-hash/entry/obj-type = 6
base-traffic-hash/entry/std-hash-field = 1,2,8,9,6,5
cps/object-group/return-code = 0
#

Refer the yang model for the field values

@gunasekaran-t just saw this! I'm not sure why I missed it. Thanks for the help!

Fix proposed in #29