After using the “p4c-bm2-ss --p4v 16 --p4runtime-files …” command, the file “xxx.p4.p4info.txt” is empty. I don’t know where the problem is, and I am very distressed, so I want to seek everyone’s help.
The error details are as follows:
root@ubuntu:/home/p4/ddosmitigation# p4c-bm2-ss --p4v 16 --p4runtime-files build/ddosmit.p4.p4info.txt -o build/ddosmit.json ddosmit.p4
ddosmit.p4(236): [–Wwarn=unused] warning: k_noattack: unused instance
register<bit<8>>(1) k_noattack; /* k value when switch is under attack */
^^^^^^^^^^
terminate called after throwing an instance of ‘std::system_error’
what(): Unknown error -1
Aborted (core dumped)
Are you able to successfully run a similar command the tutorials/exercises/basic/solution/basic.p4 source file?
Are you able to share your full P4 source code of the program that is causing this error, and provide a link to it? (better to provide a link here rather than try to copy & paste the entire program in a forum message)
I tried to run the ddosmit.p4 and v1model.p4 in directory tutorials/exercises/basic/solution/basic.p4 and ultimately obtained a valid xxx.p4.p4info.txt file, but a new error occurred when using the “make” command:
Configuring switch s11 using P4Runtime with file ./sw_rules/s11-runtime.json
Using P4Info file build/ddosmit.p4.p4info.txt…
Connecting to P4Runtime server on 127.0.0.1:50051 (bmv2)…
Setting pipeline config (build/ddosmit.json)…
Inserting 25 table entries…
MyIngress.ipv4_lpm: (default action) => MyIngress.drop()
Traceback (most recent call last):
File “./utils/run_exercise.py”, line 396, in
exercise.run_exercise()
File “./utils/run_exercise.py”, line 207, in run_exercise
self.program_switches()
File “./utils/run_exercise.py”, line 309, in program_switches
self.program_switch_p4runtime(sw_name, sw_dict)
File “./utils/run_exercise.py”, line 284, in program_switch_p4runtime
proto_dump_fpath=outfile)
File “/home/p4/ddosmitigation/utils/p4runtime_lib/simple_controller.py”, line 129, in program_switch
insertTableEntry(sw, entry, p4info_helper)
File “/home/p4/ddosmitigation/utils/p4runtime_lib/simple_controller.py”, line 150, in insertTableEntry
sw.WriteTableEntry(table_entry)
File “/home/p4/ddosmitigation/utils/p4runtime_lib/switch.py”, line 101, in WriteTableEntry
self.client_stub.Write(request)
File “/usr/local/lib/python2.7/dist-packages/grpc/_interceptor.py”, line 221, in call
compression=compression)
File “/usr/local/lib/python2.7/dist-packages/grpc/_interceptor.py”, line 257, in _with_call
return call.result(), call
File “/usr/local/lib/python2.7/dist-packages/grpc/_channel.py”, line 343, in result
raise self
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNKNOWN
details = “”
debug_error_string = “{“created”:”@1681108983.781918108",“description”:“Error received from peer ipv4:127.0.0.1:50051”,“file”:“src/core/lib/surface/call.cc”,“file_line”:1070,“grpc_message”:“”,“grpc_status”:2}"
utils/Makefile~:27: recipe for target ‘run’ failed
When you do make run in one of the exercises directories, it does (at least) these three things:
compiles the P4 source code, generating a compiled “binary” of the program for loading into simple_switch_grpc (aka a BMv2 JSON file), and the P4Info file.
starts mininet with one simple_switch_grpc process per simulated switch, and one or more emulated hosts
Starts a Python program that makes a P4Runtime API connection to each of the simple_switch_grpc processes, and adds table entries to particular tables in the running P4 programs there.
My guess is the last step is failing in your run. Very likely this is because the table names, key fields, action names, and/or action parameters are different in your P4 program, vs. then basic.p4 program in the tutorials/exercises/basic directory. If the controller tries to add table entries into a program that cannot accept them, errors are the likely result.
Thank you for your answer. I understand what you mean. But if I don’t run it in the tutorials/exercises/basic directory to get the P4Info file, I won’t get the correct P4Info file in the original directory.