Interaction between two programs implementing control plane

Hello guys,

While i was inspecting the code from the p4lang/tutorials/exercises/p4runtime for controller, i saw that in, a function program_switch_p4runtime was called when i executed make command. In this function, the was used from p4runtime_lib.

My question is how the is used while the has first been executed and thus is the primary controller?

I am not certain, but I believe what is happening is that when you type make in the tutorials/exercises/p4runtime directory, it executes the program, which does connect to one or more of the switches via a gRPC/TCP connection to send some P4Runtime commands to the switch, but when it is finished sending those commands, it disconnects, leaving the switches with no connected controller at all. That disconnection happens before its starts simple_switch_CLI and before you see the mininet> prompt show up.

At that time, any other controller can connect to the switch and become the primary controller.