Closed wei-coding closed 7 months ago
@wei-coding This looks like a useful addition to me. I have not tried testing with it, but I am hoping you have verified that with these changes the existing exercises continue working without needing any changes?
Yes, I have tested it on all exercises, and none of them were affected. Additionally, this function will only impact those exercises that require packetio, which is not present in this tutorial. I can upload an exercise I created that uses packetio to implement a learning switch in another pull request (PR).
An exercise that demonstrates packetio definitely sounds like a good one to have in the tutorials exercise collection, if you are interested in submitting one.
By default, when executing the
make
command in the tutorial exercise, the cpu port option in bmv2 is not provided, rendering the packet in function unusable. I have added a parser option to parse the JSON parameter in thetopology.json
file to enable the CPU port for the switch. An example of the CPU port option is as follows: