Merge branch 'master' of gitlab.ethz.ch:nicosc/master-thesis

This commit is contained in:
Nico Schottelius 2019-08-04 19:25:12 +02:00
commit a31dc107a1
13 changed files with 34682 additions and 40 deletions

View File

@ -3342,6 +3342,7 @@ https://en.wikipedia.org/wiki/IPv4_header_checksum
| 6.3 | Fixed lpm bug: ABORT |
| 6.4 | table size = 64, [nsg]: |
| 6.5 | udp in ipv6 integrated with ugly define [esprimo]: |
| | |
** TODO Benchmark/comparison
*** TODO Setup / Benchmark Jool
*** TODO Setup / Benchmark tayga
@ -7270,7 +7271,8 @@ success
*** DONE 2019-07-28: ping6 test for getting packet: failure
CLOSED: [2019-07-28 Sun 12:43]
*** TODO 2019-07-28: *NETPFGA PORT MAPPINGS*
*** DONE 2019-07-28: *NETPFGA PORT MAPPINGS*
CLOSED: [2019-08-04 Sun 15:33]
nf_port_map = {
"nf0":0b00000001,
"nf1":0b00000100,
@ -8865,6 +8867,16 @@ nico@ESPRIMO-P956:~/master-thesis/bin$
**** DONE MAXIMUM payload size: 215 0s + 42 + \n = 219 bytes payload
CLOSED: [2019-08-04 Sun 13:43]
****
*** TODO 2019-08-04: retesting with simulation while compiling
#+BEGIN_CENTER
expected (tlast, tkeep, tdata) = (0, ffffffff, 000a4200000a7164114000000100100200450008082222222208081111111108)
actual (tlast, tkeep, tdata) = (0, ffffffff, 000a4200000a7264114000000000100200450008082222222208081111111108)
#+END_CENTER
- ID = 1 in ipv4, unset / not existing in ipv6 -> translated = 0, scapy
generated = 1
- checksum off by one (probably because of ID)
** The NetPFGA saga
Problems encountered:
- The logfile for a compile run is 10k+ lines

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,40 @@
+ date
Son Aug 4 15:51:19 CEST 2019
+ cd /home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4
+ make
make -C src/ clean
make[1]: Entering directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src'
rm -f *.sdnet *.tbl .sdnet_switch_info.dat
make[1]: Leaving directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src'
make -C testdata/ clean
make[1]: Entering directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/testdata'
rm -f *.pcap *.txt *.pyc *.axi config_writes.* *_reg_defines.py
make[1]: Leaving directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/testdata'
rm -rf nf_sume_sdnet_ip/
rm -f
rm -f sw/config_tables.c
make -C src/
make[1]: Entering directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src'
p4c-sdnet -o minip4.sdnet --sdnet_info .sdnet_switch_info.dat minip4_solution.p4
minip4_solution.p4(23): [--Wwarn=uninitialized_out_param] warning: out parameter meta may be uninitialized when RealParser terminates
out metadata meta,
^^^^
minip4_solution.p4(20)
parser RealParser(
^^^^^^^^^^
/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/bin/p4_px_tables.py commands.txt .sdnet_switch_info.dat
make[1]: Leaving directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src'
make -C testdata/
make[1]: Entering directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/testdata'
./gen_testdata.py
Traceback (most recent call last):
File "./gen_testdata.py", line 146, in <module>
test_nat64()
File "./gen_testdata.py", line 117, in test_nat64
applyPkg(pkg4, "nf2", pkgCnt)
NameError: global name 'applyPkg' is not defined
Makefile:4: recipe for target 'all' failed
make[1]: *** [all] Error 1
make[1]: Leaving directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/testdata'
Makefile:31: recipe for target 'frontend' failed
make: *** [frontend] Error 2

View File

@ -0,0 +1,40 @@
+ date
Son Aug 4 15:52:57 CEST 2019
+ cd /home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4
+ make
make -C src/ clean
make[1]: Entering directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src'
rm -f *.sdnet *.tbl .sdnet_switch_info.dat
make[1]: Leaving directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src'
make -C testdata/ clean
make[1]: Entering directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/testdata'
rm -f *.pcap *.txt *.pyc *.axi config_writes.* *_reg_defines.py
make[1]: Leaving directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/testdata'
rm -rf nf_sume_sdnet_ip/
rm -f
rm -f sw/config_tables.c
make -C src/
make[1]: Entering directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src'
p4c-sdnet -o minip4.sdnet --sdnet_info .sdnet_switch_info.dat minip4_solution.p4
minip4_solution.p4(23): [--Wwarn=uninitialized_out_param] warning: out parameter meta may be uninitialized when RealParser terminates
out metadata meta,
^^^^
minip4_solution.p4(20)
parser RealParser(
^^^^^^^^^^
/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/bin/p4_px_tables.py commands.txt .sdnet_switch_info.dat
make[1]: Leaving directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src'
make -C testdata/
make[1]: Entering directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/testdata'
./gen_testdata.py
Traceback (most recent call last):
File "./gen_testdata.py", line 146, in <module>
test_nat64()
File "./gen_testdata.py", line 117, in test_nat64
applyPkg(pkg4, "nf2", pkgCnt)
NameError: global name 'applyPkg' is not defined
Makefile:4: recipe for target 'all' failed
make[1]: *** [all] Error 1
make[1]: Leaving directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/testdata'
Makefile:31: recipe for target 'frontend' failed
make: *** [frontend] Error 2

View File

@ -0,0 +1,40 @@
+ date
Son Aug 4 15:53:05 CEST 2019
+ cd /home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4
+ make
make -C src/ clean
make[1]: Entering directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src'
rm -f *.sdnet *.tbl .sdnet_switch_info.dat
make[1]: Leaving directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src'
make -C testdata/ clean
make[1]: Entering directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/testdata'
rm -f *.pcap *.txt *.pyc *.axi config_writes.* *_reg_defines.py
make[1]: Leaving directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/testdata'
rm -rf nf_sume_sdnet_ip/
rm -f
rm -f sw/config_tables.c
make -C src/
make[1]: Entering directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src'
p4c-sdnet -o minip4.sdnet --sdnet_info .sdnet_switch_info.dat minip4_solution.p4
minip4_solution.p4(23): [--Wwarn=uninitialized_out_param] warning: out parameter meta may be uninitialized when RealParser terminates
out metadata meta,
^^^^
minip4_solution.p4(20)
parser RealParser(
^^^^^^^^^^
/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/bin/p4_px_tables.py commands.txt .sdnet_switch_info.dat
make[1]: Leaving directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src'
make -C testdata/
make[1]: Entering directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/testdata'
./gen_testdata.py
Traceback (most recent call last):
File "./gen_testdata.py", line 146, in <module>
test_nat64()
File "./gen_testdata.py", line 117, in test_nat64
applyPkt(pkg4, "nf2", pkgCnt)
UnboundLocalError: local variable 'pkgCnt' referenced before assignment
Makefile:4: recipe for target 'all' failed
make[1]: *** [all] Error 1
make[1]: Leaving directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/testdata'
Makefile:31: recipe for target 'frontend' failed
make: *** [frontend] Error 2

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
gen_testdata-port1.py
gen_testdata_nat64_500byte.py

View File

@ -0,0 +1,147 @@
#!/usr/bin/env python
# from switch_calc_headers import *
from scapy.all import *
from nf_sim_tools import *
from collections import OrderedDict
import sss_sdnet_tuples
########################
# pkt generation tools #
########################
pktsApplied = []
pktsExpected = []
# Pkt lists for SUME simulations
nf_applied = OrderedDict()
nf_applied[0] = []
nf_applied[1] = []
nf_applied[2] = []
nf_applied[3] = []
nf_expected = OrderedDict()
nf_expected[0] = []
nf_expected[1] = []
nf_expected[2] = []
nf_expected[3] = []
nf_port_map = {
"nf0":0b00000001,
"nf1":0b00000100,
"nf2":0b00010000,
"nf3":0b01000000,
"dma0":0b00000010
}
nf_id_map = {
"nf0":0,
"nf1":1,
"nf2":2,
"nf3":3
}
sss_sdnet_tuples.clear_tuple_files()
def applyPkt(pkt, ingress, time):
print("Applying pkt on {} at {}: ".format(ingress, time))
pktsApplied.append(pkt)
sss_sdnet_tuples.sume_tuple_in['src_port'] = nf_port_map[ingress]
sss_sdnet_tuples.sume_tuple_expect['src_port'] = nf_port_map[ingress]
pkt.time = time
nf_applied[nf_id_map[ingress]].append(pkt)
def expPkt(pkt, egress):
pktsExpected.append(pkt)
sss_sdnet_tuples.sume_tuple_expect['dst_port'] = nf_port_map[egress]
sss_sdnet_tuples.write_tuples()
if egress in ["nf0","nf1","nf2","nf3"]:
nf_expected[nf_id_map[egress]].append(pkt)
elif egress == 'bcast':
nf_expected[0].append(pkt)
nf_expected[1].append(pkt)
nf_expected[2].append(pkt)
nf_expected[3].append(pkt)
def print_summary(pkts):
for pkt in pkts:
print "summary = ", pkt.summary()
def write_pcap_files():
wrpcap("src.pcap", pktsApplied)
wrpcap("dst.pcap", pktsExpected)
for i in nf_applied.keys():
if (len(nf_applied[i]) > 0):
wrpcap('nf{0}_applied.pcap'.format(i), nf_applied[i])
for i in nf_expected.keys():
if (len(nf_expected[i]) > 0):
wrpcap('nf{0}_expected.pcap'.format(i), nf_expected[i])
# i = 0..3
for i in nf_applied.keys():
print "nf{0}_applied times: ".format(i), [p.time for p in nf_applied[i]]
#####################
# generate testdata #
#####################
MAC1 = "08:11:11:11:11:08"
MAC2 = "08:22:22:22:22:08"
pktCnt = 0
INDEX_WIDTH = 4
REG_DEPTH = 2**INDEX_WIDTH
# Not sure what this is used for
NUM_KEYS = 4
lookup_table = {
0: 0x00000001,
1: 0x00000010,
2: 0x00000100,
3: 0x00001000
}
def test_nat64():
""" packets for a certain mac always go to nf0 """
pkgCnt = 1
# From v4 to v6
e4 = Ether(dst=MAC2, src=MAC1)
i4 = IP(src = "10.0.0.42", dst = "10.0.0.66")
u4 = UDP(sport=5000, dport=2345)
p4 = 500 * "A"
pkg4 = e4 / i4 / u4 / p4
applyPkt(pkg4, "nf2", pkgCnt)
e6 = e4
i6 = IPv6(src = "2001:db8:42::a00:2a", dst = "2001:db8:42::42")
u6 = u4
p6 = p4
pkg6 = e6 / i6 / u6 / p6
expPkt(pkg6, 'nf3')
pkgCnt += 1
# From v6 to v4
e6 = Ether(dst=MAC1, src=MAC2)
i6 = IPv6(dst = "2001:db8:42::a00:2a", src = "2001:db8:42::42")
u6 = UDP(dport=5000, sport=2345)
p6 = 500 * "A"
pkg6 = e6 / i6 / u6 / p6
e4 = e6
i4 = IP(dst = "10.0.0.42", src = "10.0.0.66", id=0)
u4 = u6
p4 = p6
pkg4 = e4 / i4 / u4 / p4
applyPkt(pkg6, "nf3", pkgCnt)
expPkt(pkg4, 'nf2')
test_nat64()
write_pcap_files()

13
p4src/commands.txt Normal file
View File

@ -0,0 +1,13 @@
// Setup with full NAT64
// egress for dst=10.0.0.42
table_cam_add_entry realmain_v4_networks_0 realmain.set_egress_port 167772202 => 16 0 0 0 0
// egress for dst=2001:db8:42::42
table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477184434242 => 64 0 0 0 0
// nat64: dst=2001:db8:42::a00:2a translated to 10.0.0.42:
table_cam_add_entry realmain_nat64_0 realmain.nat64_static 42540766411362381960998550477352206378 => 42540766411362381960998550477184434176 167772160 42540766411362381960998550477184434176 0
// nat46: translate dst=10.0.0.66 to
table_cam_add_entry realmain_nat46_0 realmain.nat46_static 167772226 => 42540766411362381960998550477184434176 167772160 42540766411362381960998550477184434176 0

View File

@ -1,38 +0,0 @@
// only used on netpfga for dummy packet reply
//table_cam_add_entry dummy_table_for_netpfga send_to_port1 0x082222222208 => 0x1
// likely wrong!
table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477184434177 => 1 0 0 0 0
table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477184434178 => 2 0 0 0 0
table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477184434179 => 3 0 0 0 0
table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477184434180 => 4 0 0 0 0
table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477184434181 => 5 0 0 0 0
table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477184434182 => 6 0 0 0 0
table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477184434183 => 7 0 0 0 0
table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477184434184 => 8 0 0 0 0
// 1
// 4
// 16
// 64
table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477184434177 => 1 1 1 0 0
table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477184434180 => 1 4 4 0 0
table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477184434198 => 1 16 16 0 0
table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477184434276 => 1 64 64 0 0
// 32
table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477184434226 => 1 32 32 0 0
// deleting: table_cam_delete_entry realmain_v6_networks_0 42540766411362381960998550477184434179
// 42 del: table_cam_delete_entry realmain_v6_networks_0 42540766411362381960998550477184434242
// IPv4:
table_cam_add_entry realmain_v4_networks_0 realmain.set_egress_port 167772161 => 1 1 1 0 0
table_cam_delete_entry realmain_v4_networks_0 167772161