Set up multiple switches and controllers in a single machine

Hey everyone,

I’m wondering if it’s possible to set up multiple connection pairs between switch and controller (One switch is connected with one controller)? I would like to test my P4 program using different datasets. Running switches in parallel could accelerate the evaluation process.

Thanks in advance!

Yes, this is possible when using open source simple_switch / simple_switch_grpc processes to run P4 programs. The details of how depend upon how you are starting these processes.

I can give quick advice if you are starting simple_switch_grpc yourself on the command line or via simple shell scripts you have written. If you look in the output of the command simple_switch_grpc --help, you can see documentation for these command line options:

  --grpc-server-addr arg          Bind gRPC server to given address [default is

If you are using the P4Runtime API to configure the switches, then you should either:

  • start simple_switch_grpc processes so that they are listening for P4Runtime API gRPC connections on different TCP port numbers, not the default value of 9559 as shown above.
  • start simple_switch_grpc processes in different Linux network namespaces, which likely would enable you to use the same TCP ports to listen on, but then each of your controller processes must also be started in the same namespace as the simple_switch_grpc process you want it to control.

I would recommend trying to start these things up manually or with a small shell script you write yourself, so you can edit the options as you experiment and find out what works.

If you are using mininet or some other “wrapper” code to start switches and controllers, I have less experience there to give you advice, but others might be able to.