Updated receive.py & Calc tutorial (#284)

* Updated receive.py

* Updated calc tutorial

* Relocated calc tutorial
This commit is contained in:
Xin Zhe Khooi 2019-09-20 21:44:24 +08:00 committed by Nate Foster
parent 76a9067dea
commit 3fdb8d6cb6
11 changed files with 23 additions and 23 deletions

5
exercises/calc/Makefile Normal file
View File

@ -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

After

Width:  |  Height:  |  Size: 156 B

View File

@ -175,7 +175,7 @@ control MyIngress(inout headers hdr,
}
action operation_drop() {
mark_to_drop();
mark_to_drop(standard_metadata);
}
table calculate {

View File

@ -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('> '))

View File

@ -1,6 +1,6 @@
{
"target": "bmv2",
"p4info": "build/calc.p4info",
"p4info": "build/calc.p4.p4info.txt",
"bmv2_json": "build/calc.json",
"table_entries": [ ]
}

View File

@ -180,7 +180,7 @@ control MyIngress(inout headers hdr,
}
action operation_drop() {
mark_to_drop();
mark_to_drop(standard_metadata);
}
table calculate {

View File

@ -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"]
]
}

View File

@ -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,

View File

@ -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,

View File

@ -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

Before

Width:  |  Height:  |  Size: 154 B

View File

@ -1,12 +0,0 @@
{
"hosts": [
"h1",
"h2"
],
"switches": {
"s1": { "runtime_json" : "s1-runtime.json" }
},
"links": [
["h1", "s1"], ["h2", "s1"]
]
}