Updated receive.py & Calc tutorial (#284)
* Updated receive.py * Updated calc tutorial * Relocated calc tutorial
This commit is contained in:
parent
76a9067dea
commit
3fdb8d6cb6
5
exercises/calc/Makefile
Normal file
5
exercises/calc/Makefile
Normal 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 |
@ -175,7 +175,7 @@ control MyIngress(inout headers hdr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
action operation_drop() {
|
action operation_drop() {
|
||||||
mark_to_drop();
|
mark_to_drop(standard_metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
table calculate {
|
table calculate {
|
2
exercises/other/calc/calc.py → exercises/calc/calc.py
Executable file → Normal file
2
exercises/other/calc/calc.py → exercises/calc/calc.py
Executable file → Normal file
@ -65,7 +65,7 @@ def main():
|
|||||||
|
|
||||||
p = make_seq(num_parser, make_seq(op_parser,num_parser))
|
p = make_seq(num_parser, make_seq(op_parser,num_parser))
|
||||||
s = ''
|
s = ''
|
||||||
iface = 'h1-eth0'
|
iface = 'eth0'
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
s = str(raw_input('> '))
|
s = str(raw_input('> '))
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"target": "bmv2",
|
"target": "bmv2",
|
||||||
"p4info": "build/calc.p4info",
|
"p4info": "build/calc.p4.p4info.txt",
|
||||||
"bmv2_json": "build/calc.json",
|
"bmv2_json": "build/calc.json",
|
||||||
"table_entries": [ ]
|
"table_entries": [ ]
|
||||||
}
|
}
|
@ -180,7 +180,7 @@ control MyIngress(inout headers hdr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
action operation_drop() {
|
action operation_drop() {
|
||||||
mark_to_drop();
|
mark_to_drop(standard_metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
table calculate {
|
table calculate {
|
12
exercises/calc/topology.json
Normal file
12
exercises/calc/topology.json
Normal 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"]
|
||||||
|
]
|
||||||
|
}
|
@ -27,7 +27,7 @@ def handle_pkt(pkt):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
iface = 'h2-eth0'
|
iface = 'eth0'
|
||||||
print "sniffing on %s" % iface
|
print "sniffing on %s" % iface
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
sniff(filter="udp and port 4321", iface = iface,
|
sniff(filter="udp and port 4321", iface = iface,
|
||||||
|
@ -47,7 +47,7 @@ def handle_pkt(pkt):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
iface = 'h2-eth0'
|
iface = 'eth0'
|
||||||
print "sniffing on %s" % iface
|
print "sniffing on %s" % iface
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
sniff(filter="udp and port 4321", iface = iface,
|
sniff(filter="udp and port 4321", iface = iface,
|
||||||
|
@ -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 |
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"hosts": [
|
|
||||||
"h1",
|
|
||||||
"h2"
|
|
||||||
],
|
|
||||||
"switches": {
|
|
||||||
"s1": { "runtime_json" : "s1-runtime.json" }
|
|
||||||
},
|
|
||||||
"links": [
|
|
||||||
["h1", "s1"], ["h2", "s1"]
|
|
||||||
]
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user