Skip to content

Get SAI_OBJECT_TYPE_FDB_ENTRY failed by npu.process_commands #239

@xuyinhao

Description

@xuyinhao

my simple code :

    idx=0
    mac = macs[0]
    cmds3 = [
       {
            "name": f"fdb_{idx}",
            "op": "get",
            "type": "SAI_OBJECT_TYPE_FDB_ENTRY",
            "key": {
                "bv_id": "$vlan_10",
                "mac_address": mac,
                "switch_id" : "$SWITCH_ID"
            },
            "attributes": [
                "SAI_FDB_ENTRY_ATTR_TYPE"
            ]
        }
    ]
    status = [*npu.process_commands(cmds3)]

error:

/usr/local/lib/python3.9/dist-packages/saichallenger/common/sai.py:210: in process_commands
    yield from map(self.command_processor.process_command, commands)
/usr/local/lib/python3.9/dist-packages/saichallenger/common/sai.py:155: in process_command
    obj_type = self.sai.vid_to_type(obj_id)
/usr/local/lib/python3.9/dist-packages/saichallenger/common/sai.py:290: in vid_to_type
    return self.sai_client.vid_to_type(vid)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

vid = 'SAI_OBJECT_TYPE_FDB_ENTRY:{"bv_id": "oid:0x260000000009b5", "mac_address": "00:11:11:11:11:11", "switch_id": "oid:0x21000000000000"}'

    @staticmethod
    def vid_to_type(vid):
>       obj_type = int(vid[4:], 16) >> 48
E       ValueError: invalid literal for int() with base 16: 'OBJECT_TYPE_FDB_ENTRY:{"bv_id": "oid:0x260000000009b5", "mac_address": "00:11:11:11:11:11", "switch_id": "oid:0x21000000000000"}'

/usr/local/lib/python3.9/dist-packages/saichallenger/common/sai_client/sai_redis_client/sai_redis_client.py:604: ValueError

sai.py not support fdb info (key) get , there obj_id is 'SAI_OBJECT_TYPE_FDB_ENTRY:{"bv_id": "oid:0x260000000009b5", "mac_address": "00:11:11:11:11:11", "switch_id": "oid:0x21000000000000"} '

 elif operation == "get":
            obj_type = self.sai.vid_to_type(obj_id)
            results = []
            for attr in attrs:
                attr_type = self.sai.get_obj_attr_type(obj_type, attr)
                status, data = self.sai.get_by_type(obj_id, attr, attr_type)
                assert status == "SAI_STATUS_SUCCESS", f"Failed to retrieve {attr}: {status}"
                results.append(data)
            return results

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions