p4lang / p4app

Apache License 2.0
112 stars 58 forks source link

How to run simple_switch_grpc if using custom target #66

Closed damomeen closed 5 years ago

damomeen commented 5 years ago

Hi,

I'm using p4app with custom target.

{
  "program": "p4src/countmin.p4",
  "language": "p4-14",
  "targets": {
      "custom": {
           "program": "topo.py"
      }
  }
}

It is currently simple_switch: PYTHONPATH=$PYTHONPATH:/scripts/mininet/ python2 topo.py --behavioral-exe "simple_switch" --json "countmin.json" --cli "simple_switch_CLI"

However, I would like to switch to gRPC which should allow me to develop more complex control of the p4app. What I need to change to run my custom topo.py with --behavioral-exe "simple_switch_grpc"?

I have tempoary work around the problem by modifying scripts/p4apprunner.py (replacing 'simple_switch' with 'simple_switch_grpc' everywhere )but without success. I still see: PYTHONPATH=$PYTHONPATH:/scripts/mininet/ python2 topo.py --behavioral-exe "simple_switch" --json "countmin.json" --cli "simple_switch_CLI" From where this line is called?

damomeen commented 5 years ago

I found I have full control of switches instantiation inside topo.py and can there overwrite which switch backend is used.