Hi,
Unfortunately there are a few problems that make it hard to realize the scenario you describe.
The P4Runtime API defines a mechanism for
role config, where multiple masters can connect to the same switch as long as they use different roles.
ONOS currently supports establishing sessions with the “default role” only. If your P4Runtime switch implementation supports role config, then you should be able to establish a new session as master via a different P4Runtime client as long as you don’t use the default role. If you are using Stratum, unfortunately that doesn’t support role config, yet. I’m not sure if p4runtime-sh supports setting a role config.
If you use a separate P4Runtime client to become master for the default role, that will interfere with ONOS operations, as the switch is expected to notify to ONOS that it is no longer the master, which immediately triggers a mechanism in ONOS to regain mastership, thus removing it from the other client.
If all you want to do with the other client is reading state, then there should be no need to gain mastership or deal with role config, simply issue a Read RPC for the tables you’re interested in.
However, it sounds like you are interested in using the other client to write state… so, if you manage to to bring up a separate client with role config and make it master, unfortunately state that you write might get removed by the ONOS data plane state reconciliation mechanism. For example, the FlowRuleManager periodically asks the P4Runtime driver to report all table entries for a given device, during this process all table entries that are known (i.e., not stored in the ONOS core) are removed.
Ideally, ONOS should not remove entries written by other controllers with different roles, but this functionality is currently not implemented
Carmelo