About the switch control table import command in mininet

In the p4-tutorials tutorial, all control planes are configured using json files. I was browsing through the youtube course and noticed that the video publisher can use txt files to configure directly, how can I modify my utils tool to enable the configuration of the action match table directly through txt files?


The txt file is, as far as I can remember, the way that rules were installed in the beginning. Then they switched to the json files. However, I remember I still used .txt files for some rules.

I think I modified the topology.json (you can find them in the topo folders) file to include them as this:

    "hosts": [
    "switches": {
        "s1": {
          "cli_input" : "s1-commands.txt",
          "runtime_json" : "s1-runtime.json"
        "s2": {
          "cli_input" : "s2-commands.txt",
          "runtime_json" : "s2-runtime.json"
        "s3": {
          "cli_input" : "s3-commands.txt",
          "runtime_json" : "s3-runtime.json"
    . . .

I was not sure if I implemented it or it was already there. Searching Github shows that this was already there, see:

So you can add your own .txt file and try it out. The syntax could be similar to this one:

mirroring_add 500 2
table_add IngressImpl.int_ingress.tb_set_first_hop IngressImpl.int_ingress.int_set_first_hop 5 0

Hope it works for you,

It is very useful to me. Thank you.