Open pantmal opened 3 months ago
I also encountered the same problem, did you solve it?
No, unfortunately, I am still investigating this error. What I was able to find thus far is that SONiC is supposed to have an openconfig path of: '/components/component/integrated-circuit/config/node-id'. This ID can be set via gNMI. Also, in the redis database, there is also supposed to be a key of: CONFIG_DB:NODE_CFG|integrated_circuit0.
This means that a SONiC switch with a device ID that has been set, should have these above as non-empty values. But in my case, both of these are empty (Actually, this openconfig path and the redis key don't even exist). So apparently, SONiC needs a config sorts that enables these values, but I haven't been able to find any example yet.
Hope this information might help you in your search. If you happen to find anything useful, let me know.
No, unfortunately, I am still investigating this error. What I was able to find thus far is that SONiC is supposed to have an openconfig path of: '/components/component/integrated-circuit/config/node-id'. This ID can be set via gNMI. Also, in the redis database, there is also supposed to be a key of: CONFIG_DB:NODE_CFG|integrated_circuit0.
This means that a SONiC switch with a device ID that has been set, should have these above as non-empty values. But in my case, both of these are empty (Actually, this openconfig path and the redis key don't even exist). So apparently, SONiC needs a config sorts that enables these values, but I haven't been able to find any example yet.
Hope this information might help you in your search. If you happen to find anything useful, let me know.
Thank you for the tip, I will continue to investigate this error
@baxia-lan could you please check this issue with P4RT and VS.
@rhalstea Could you please take a look? Is node id in CONFIG required for p4rt boot up? Is it required to be set by gNMI via the path /components/component/integrated-circuit/config/node-id
? Or it can be optional when starting p4rt app?
"NODE_CFG": {
"integrated_circuit0": {
"node-id": "1"
}
cc. @mkeda
It's not required for bootup, but it is required if you want to use P4RT in any meaningful way. It looks like you have all the correct fields which p4rt_app monitors. You don't have to go through gNMI. The p4rt_app just needs to see the value in redis. config_db.json or manually updating should also work if you just want to test something.
Thanks @rhalstea
We probably need to add this default NODE_CFG
config to int_cfg.json.j2 then.
https://github.com/sonic-net/sonic-buildimage/blob/master/files/build_templates/init_cfg.json.j2
Discussed this issue offline with @rhalstea and @ndas7(gNMI team)
CONFIG DB NODE_CFG|integrated_circuit0
entry node_id
field is to configure the unique identifier(a device id) per switch. The unique id is used by controller to identify the device to talk to. See P4Runtime Specs for details.
The expected behavior is that switch boots up with initial config(node id can be missing) and p4rt app might complain the node id missing; then config with node id is pushed, p4rt app(ConfigDbNodeCfgTableEventHandler) will consume the node id and unblock the remaining.
The node id should be configured by users who enable P4RT app by setting OpenConfig path /components/component/integrated-circuit/config/node-id
value, i.e. setting CONFIG DB NODE_CFG|integrated_circuit0
entry node_id
field value.
The path /components/component/integrated-circuit/config/node-id
is in public OpenConfig(link), and the support on the gNMI/UMF side, the platforms xfmr is in progress to submit to the community.
So for general use case. the action item is on gNMI to submit the implementation, and users to configure the node-id before using p4rt. For tests only using standalone VirtualSwitch, e.g. docker-sonic-vs.gz for SWSS component test, a default node id can be hard coded in init_cfg.json.j2(e.g. PR 19534).
So, if I'm understanding correctly, you propose updating only the docker-sonic-vs.gz with a hardcoded node-id value, and for other sonic-vs setups you suggest that the user should set the Device ID on his own. I'm fine with this, though in my opinion this should be mentioned on a README, or somewhere in the repo.
Now while I'm able to connect to the Virtual Switch by setting the node-id value using redis-cli, I'm having trouble pushing the p4 config files to the Virtual Switch, resulting in an odd error. I would appreciate some help in the new issue I have posted: https://github.com/sonic-net/sonic-buildimage/issues/19589
Our way to set the node-id is through gNMI OpenConfig path. As mentioned the implementation is WIP(thanks @ndas7 for the input). And the OpenConfig will eventually be translated to CONFIG DB NODE_CFG table entry.
Also agreed that P4RT can add README for better instruction and documentation.
Description
Hello everyone, I am new to SONiC and I would like some assistance regarding some config related operations.
I have used the sonic-buildimage repo to create a custom SONiC Virtual Switch image. I have used the flag
INCLUDE_P4RT = y
so I may have a P4 runtime container.I have deployed this VS using GNS3 and I am able to connect to the switch and the P4RT gRPC port with the P4 runtime shell with:
python3 -m p4runtime_sh --grpc-addr <Switch-IP>:9559
.However when I connect I am receiving the following error:
CRITICAL:root:P4Runtime RPC error (FAILED_PRECONDITION): Switch does not have a Device ID. Has a config been pushed?
I understand that the P4 runtime shell needs the Device ID to complete the connection, but it has not been set. Can someone assist me with this issue? How am I supposed to set the Device ID and push the config in question? Can this operation be performed by GNS3? I can't see any related option in the sonic-buildimage repo.
Any assistance would be greatly appreciated.
(On another note, I have noticed that the P4rt container does not run by default and needs to be enabled manually with:
/usr/bin/p4rt.sh start
. Is this behavior expected?)Steps to reproduce the issue:
Build commands:
python3 -m p4runtime_sh --grpc-addr <Switch-Address>:9559
Describe the results you received:
Connecting to the switch with P4 runtime shell gives the error:
CRITICAL:root:P4Runtime RPC error (FAILED_PRECONDITION): Switch does not have a Device ID. Has a config been pushed?
Describe the results you expected:
The Device ID needs to be set. The ideal message, considering no forwarding pipeline is set, would be:
CRITICAL:root:P4Runtime RPC error (FAILED_PRECONDITION): No valid forwarding pipeline config has been pushed for any node so far.
Output of
show version
:Output of
show techsupport
:Attached relevant file.
sonic_dump_sonic_20240617_141035.tar.gz
Also attaching debug file produced by
sudo generate_dump
sonic_dump_sonic_20240617_141715.tar.gz