-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add EXERCISE 8 on GTP termination with fabric.p4 (#47)
* Use custom stratum_bmv2 image for both mininet and ptf This is required to use scapy in Mininet. Before the ptf image was essentially mn-stratum plus scapy, ptf, etc. I renamed that to a generic stratum_bmv2 and use it for both mininet (in docker-compose) and to run ptf tests, instead of using two different images. * Progress on exercise 8 * Bump stratum_bmv2 * Fix loop by disabling ip4 forwarding Perhaps it is enabled by default in Docker for Mac? * Fix flowrule-gtp.json solution * Add make targets to push flow rules * Check gtp solution in Travis * Add instructions for Exercise 8 * Not exercise 4 * Update topo img * Edits * Add link to main readme
- Loading branch information
Showing
17 changed files
with
1,023 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"flows": [ | ||
{ | ||
"deviceId": "device:leaf1", | ||
"tableId": "FabricIngress.spgw_ingress.dl_sess_lookup", | ||
"priority": 10, | ||
"timeout": 0, | ||
"isPermanent": true, | ||
"selector": { | ||
"criteria": [ | ||
{ | ||
"type": "IPV4_DST", | ||
"ip": "<INSERT UE IP ADDRESS HERE>/32" | ||
} | ||
] | ||
}, | ||
"treatment": { | ||
"instructions": [ | ||
{ | ||
"type": "PROTOCOL_INDEPENDENT", | ||
"subtype": "ACTION", | ||
"actionId": "FabricIngress.spgw_ingress.set_dl_sess_info", | ||
"actionParams": { | ||
"teid": "BEEF", | ||
"s1u_enb_addr": "0a006401", | ||
"s1u_sgw_addr": "0a0064fe" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
{ | ||
"devices": { | ||
"device:leaf1": { | ||
"basic": { | ||
"managementAddress": "grpc://mininet:50001?device_id=1", | ||
"driver": "stratum-bmv2", | ||
"pipeconf": "org.onosproject.pipelines.fabric", | ||
"locType": "grid", | ||
"gridX": 200, | ||
"gridY": 600 | ||
}, | ||
"segmentrouting": { | ||
"name": "leaf1", | ||
"ipv4NodeSid": 101, | ||
"ipv4Loopback": "192.168.1.1", | ||
"routerMac": "00:AA:00:00:00:01", | ||
"isEdgeRouter": true, | ||
"adjacencySids": [] | ||
} | ||
}, | ||
"device:leaf2": { | ||
"basic": { | ||
"managementAddress": "grpc://mininet:50002?device_id=1", | ||
"driver": "stratum-bmv2", | ||
"pipeconf": "org.onosproject.pipelines.fabric", | ||
"locType": "grid", | ||
"gridX": 800, | ||
"gridY": 600 | ||
}, | ||
"segmentrouting": { | ||
"name": "leaf2", | ||
"ipv4NodeSid": 102, | ||
"ipv4Loopback": "192.168.1.2", | ||
"routerMac": "00:AA:00:00:00:02", | ||
"isEdgeRouter": true, | ||
"adjacencySids": [] | ||
} | ||
}, | ||
"device:spine1": { | ||
"basic": { | ||
"managementAddress": "grpc://mininet:50003?device_id=1", | ||
"driver": "stratum-bmv2", | ||
"pipeconf": "org.onosproject.pipelines.fabric", | ||
"locType": "grid", | ||
"gridX": 400, | ||
"gridY": 400 | ||
}, | ||
"segmentrouting": { | ||
"name": "spine1", | ||
"ipv4NodeSid": 201, | ||
"ipv4Loopback": "192.168.2.1", | ||
"routerMac": "00:BB:00:00:00:01", | ||
"isEdgeRouter": false, | ||
"adjacencySids": [] | ||
} | ||
}, | ||
"device:spine2": { | ||
"basic": { | ||
"managementAddress": "grpc://mininet:50004?device_id=1", | ||
"driver": "stratum-bmv2", | ||
"pipeconf": "org.onosproject.pipelines.fabric", | ||
"locType": "grid", | ||
"gridX": 600, | ||
"gridY": 400 | ||
}, | ||
"segmentrouting": { | ||
"name": "spine2", | ||
"ipv4NodeSid": 202, | ||
"ipv4Loopback": "192.168.2.2", | ||
"routerMac": "00:BB:00:00:00:02", | ||
"isEdgeRouter": false, | ||
"adjacencySids": [] | ||
} | ||
} | ||
}, | ||
"ports": { | ||
"device:leaf1/3": { | ||
"interfaces": [ | ||
{ | ||
"name": "leaf1-3", | ||
"ips": [ | ||
"10.0.100.254/24" | ||
], | ||
"vlan-untagged": 100 | ||
} | ||
] | ||
}, | ||
"device:leaf2/3": { | ||
"interfaces": [ | ||
{ | ||
"name": "leaf2-3", | ||
"ips": [ | ||
"10.0.200.254/24" | ||
], | ||
"vlan-untagged": 200 | ||
} | ||
] | ||
} | ||
}, | ||
"hosts": { | ||
"00:00:00:00:00:10/None": { | ||
"basic": { | ||
"name": "enodeb", | ||
"gridX": 100, | ||
"gridY": 700, | ||
"locType": "grid", | ||
"ips": [ | ||
"10.0.100.1" | ||
], | ||
"locations": [ | ||
"device:leaf1/3" | ||
] | ||
} | ||
}, | ||
"00:00:00:00:00:20/None": { | ||
"basic": { | ||
"name": "pdn", | ||
"gridX": 850, | ||
"gridY": 700, | ||
"locType": "grid", | ||
"ips": [ | ||
"10.0.200.1" | ||
], | ||
"locations": [ | ||
"device:leaf2/3" | ||
] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/python | ||
|
||
# Script used in Exercise 8 that sniffs packets and prints on screen whether | ||
# they are GTP encapsulated or not. | ||
|
||
import signal | ||
import sys | ||
|
||
from ptf.packet import IP | ||
from scapy.contrib import gtp | ||
from scapy.sendrecv import sniff | ||
|
||
pkt_count = 0 | ||
|
||
|
||
def handle_pkt(pkt, ex): | ||
global pkt_count | ||
pkt_count = pkt_count + 1 | ||
if gtp.GTP_U_Header in pkt: | ||
is_gtp_encap = True | ||
else: | ||
is_gtp_encap = False | ||
|
||
print "[%d] %d bytes: %s -> %s, is_gtp_encap=%s\n\t%s" \ | ||
% (pkt_count, len(pkt), pkt[IP].src, pkt[IP].dst, | ||
is_gtp_encap, pkt.summary()) | ||
|
||
if is_gtp_encap and ex: | ||
exit() | ||
|
||
|
||
print "Will print a line for each UDP packet received..." | ||
|
||
|
||
def handle_timeout(signum, frame): | ||
print "Timeout! Did not receive any GTP packet" | ||
exit(1) | ||
|
||
|
||
exitOnSuccess = False | ||
if len(sys.argv) > 1 and sys.argv[1] == "-e": | ||
# wait max 10 seconds or exit | ||
signal.signal(signal.SIGALRM, handle_timeout) | ||
signal.alarm(10) | ||
exitOnSuccess = True | ||
|
||
sniff(count=0, store=False, filter="udp", | ||
prn=lambda x: handle_pkt(x, exitOnSuccess)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/python | ||
|
||
# Script used in Exercise 8. | ||
# Send downlink packets to UE address. | ||
|
||
from scapy.layers.inet import IP, UDP | ||
from scapy.sendrecv import send | ||
|
||
UE_ADDR = '17.0.0.1' | ||
RATE = 5 # packets per second | ||
PAYLOAD = ' '.join(['P4 is great!'] * 50) | ||
|
||
print "Sending %d UDP packets per second to %s..." % (RATE, UE_ADDR) | ||
|
||
pkt = IP(dst=UE_ADDR) / UDP(sport=80, dport=400) / PAYLOAD | ||
send(pkt, inter=1.0 / RATE, loop=True, verbose=True) |
Oops, something went wrong.