Updates to basic_tunnel and basic (#78)

* Adding initial implementation of basic_encap example

* Updated basic_encap example to count the number of valid packets

* Updated basic_encap example to put encapsulation layer after Ethernet
header.

* Added solution file for basic_encap example

* Changed the name of the basic_encap example to basic_tunnel and called
the new header myTunnel. Also changed the myTunnel field names slightly.

* Updated the README file for the basic_tunnel exercise. Also added topo.pdf
image to serve as a reference during implementation.

* Updated basic/README.md to point to basic_tunnel as the next exercise.

* Updated the README for basic to point to basic_tunnel.

Updated the starter code for basic_tunnel to look like basic
solution with todo comments.

Updated send.py and receive.py to be able to send both plain IP
packets and tunneled IP packets.

Updated basic_tunnel.p4 to have same control flow as p4runtime
exercise.
This commit is contained in:
sibanez12
2017-11-03 21:03:06 -07:00
committed by Robert Soule
parent 66c2cba1b5
commit 6c82b6fbe7
8 changed files with 128 additions and 125 deletions

View File

@@ -140,7 +140,7 @@ Other questions to consider:
There are several problems that might manifest as you develop your program:
1. `basic.p4` might fails to compile. In this case, `run.sh` will
1. `basic.p4` might fail to compile. In this case, `run.sh` will
report the error emitted from the compiler and halt.
2. `basic.p4` might compile but fail to support the control plane
@@ -167,6 +167,7 @@ make stop
## Next Steps
Congratulations, your implementation works! Move on to the next
exercise: implementing the [basic tunneling](./basic_tunnel)!
Congratulations, your implementation works! In the next exercise we
will build on top of this and add support for a basic tunneling
protocol: [basic_tunnel](../basic_tunnel)!

View File

@@ -6,7 +6,7 @@ import os
from scapy.all import sniff, sendp, hexdump, get_if_list, get_if_hwaddr
from scapy.all import Packet, IPOption
from scapy.all import ShortField, IntField, LongField, BitField, FieldListField, FieldLenField
from scapy.all import IP, UDP, Raw
from scapy.all import IP, TCP, UDP, Raw
from scapy.layers.inet import _IPOption_HDR
def get_if():
@@ -34,10 +34,11 @@ class IPOption_MRI(IPOption):
IntField("", 0),
length_from=lambda pkt:pkt.count*4) ]
def handle_pkt(pkt):
print "got a packet"
pkt.show2()
# hexdump(pkt)
sys.stdout.flush()
if TCP in pkt and pkt[TCP].dport == 1234:
print "got a packet"
pkt.show2()
# hexdump(pkt)
sys.stdout.flush()
def main():
@@ -45,7 +46,7 @@ def main():
iface = ifaces[0]
print "sniffing on %s" % iface
sys.stdout.flush()
sniff(filter="tcp", iface = iface,
sniff(iface = iface,
prn = lambda x: handle_pkt(x))
if __name__ == '__main__':