diff --git a/exercises/calc/Makefile b/exercises/calc/Makefile new file mode 100644 index 0000000..cfca924 --- /dev/null +++ b/exercises/calc/Makefile @@ -0,0 +1,5 @@ +BMV2_SWITCH_EXE = simple_switch_grpc +#NO_P4 = true +#P4C_ARGS = --p4runtime-file $(basename $@).p4info --p4runtime-format text + +include ../../utils/Makefile diff --git a/exercises/other/calc/README.md b/exercises/calc/README.md similarity index 100% rename from exercises/other/calc/README.md rename to exercises/calc/README.md diff --git a/exercises/other/calc/calc.p4 b/exercises/calc/calc.p4 similarity index 99% rename from exercises/other/calc/calc.p4 rename to exercises/calc/calc.p4 index 557cbc5..6e5cc90 100644 --- a/exercises/other/calc/calc.p4 +++ b/exercises/calc/calc.p4 @@ -175,7 +175,7 @@ control MyIngress(inout headers hdr, } action operation_drop() { - mark_to_drop(); + mark_to_drop(standard_metadata); } table calculate { diff --git a/exercises/other/calc/calc.py b/exercises/calc/calc.py old mode 100755 new mode 100644 similarity index 99% rename from exercises/other/calc/calc.py rename to exercises/calc/calc.py index d2fb035..6f457a2 --- a/exercises/other/calc/calc.py +++ b/exercises/calc/calc.py @@ -65,7 +65,7 @@ def main(): p = make_seq(num_parser, make_seq(op_parser,num_parser)) s = '' - iface = 'h1-eth0' + iface = 'eth0' while True: s = str(raw_input('> ')) diff --git a/exercises/other/calc/s1-runtime.json b/exercises/calc/s1-runtime.json similarity index 66% rename from exercises/other/calc/s1-runtime.json rename to exercises/calc/s1-runtime.json index 3bd42ce..4116f70 100644 --- a/exercises/other/calc/s1-runtime.json +++ b/exercises/calc/s1-runtime.json @@ -1,6 +1,6 @@ { "target": "bmv2", - "p4info": "build/calc.p4info", + "p4info": "build/calc.p4.p4info.txt", "bmv2_json": "build/calc.json", "table_entries": [ ] } diff --git a/exercises/other/calc/solution/calc.p4 b/exercises/calc/solution/calc.p4 similarity index 99% rename from exercises/other/calc/solution/calc.p4 rename to exercises/calc/solution/calc.p4 index 3c7e86c..2c68bd4 100644 --- a/exercises/other/calc/solution/calc.p4 +++ b/exercises/calc/solution/calc.p4 @@ -180,7 +180,7 @@ control MyIngress(inout headers hdr, } action operation_drop() { - mark_to_drop(); + mark_to_drop(standard_metadata); } table calculate { diff --git a/exercises/calc/topology.json b/exercises/calc/topology.json new file mode 100644 index 0000000..0184237 --- /dev/null +++ b/exercises/calc/topology.json @@ -0,0 +1,12 @@ +{ + "hosts": { + "h1": {"ip": "10.0.1.1/24", "mac": "08:00:00:00:01:01"}, + "h2": {"ip": "10.0.1.2/24", "mac": "08:00:00:00:01:02"} + }, + "switches": { + "s1": { "runtime_json" : "s1-runtime.json" } + }, + "links": [ + ["h1", "s1-p1"], ["h2", "s1-p2"] + ] +} diff --git a/exercises/ecn/receive.py b/exercises/ecn/receive.py index ca5f119..46dc7df 100755 --- a/exercises/ecn/receive.py +++ b/exercises/ecn/receive.py @@ -27,7 +27,7 @@ def handle_pkt(pkt): def main(): - iface = 'h2-eth0' + iface = 'eth0' print "sniffing on %s" % iface sys.stdout.flush() sniff(filter="udp and port 4321", iface = iface, diff --git a/exercises/mri/receive.py b/exercises/mri/receive.py index b3c3b35..bf786ab 100755 --- a/exercises/mri/receive.py +++ b/exercises/mri/receive.py @@ -47,7 +47,7 @@ def handle_pkt(pkt): def main(): - iface = 'h2-eth0' + iface = 'eth0' print "sniffing on %s" % iface sys.stdout.flush() sniff(filter="udp and port 4321", iface = iface, diff --git a/exercises/other/calc/Makefile b/exercises/other/calc/Makefile deleted file mode 100644 index 463ae07..0000000 --- a/exercises/other/calc/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -BMV2_SWITCH_EXE = simple_switch_grpc -NO_P4 = true -P4C_ARGS = --p4runtime-file $(basename $@).p4info --p4runtime-format text - -include ../../utils/Makefile diff --git a/exercises/other/calc/topology.json b/exercises/other/calc/topology.json deleted file mode 100644 index 4e0d4a3..0000000 --- a/exercises/other/calc/topology.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "hosts": [ - "h1", - "h2" - ], - "switches": { - "s1": { "runtime_json" : "s1-runtime.json" } - }, - "links": [ - ["h1", "s1"], ["h2", "s1"] - ] -}