[controller,p4] add debug print into controller

This commit is contained in:
Nico Schottelius 2019-02-24 15:53:10 +01:00
parent e8e33c78ea
commit 949560c995
3 changed files with 31 additions and 2 deletions

View file

@ -168,6 +168,26 @@ rtt min/avg/max/mdev = 0.053/0.074/0.095/0.021 ms
Different checksum in most packets. Different checksum in most packets.
root@ubuntu:~/master-thesis# ip -6 neigh show
root@ubuntu:~/master-thesis# ip -6 neigh add 2001:db8:61::42 dev h1-eth0 lladdr 00:00:0a:00:00:42
root@ubuntu:~/master-thesis# ip -6 neigh show
2001:db8:61::42 dev h1-eth0 lladdr 00:00:0a:00:00:42 PERMANENT
root@ubuntu:~/master-thesis#
root@ubuntu:~/master-thesis# tcpdump -ni h1-eth0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on h1-eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
^C20:22:43.944152 IP6 2001:db8:61::1 > 2001:db8:61::42: ICMP6, echo request, seq 1, length 64
20:22:43.945992 IP6 2001:db8:61::1 > 2001:db8:61::42: ICMP6, echo request, seq 1, length 64
20:22:44.952453 IP6 2001:db8:61::1 > 2001:db8:61::42: ICMP6, echo request, seq 2, length 64
20:22:44.953995 IP6 2001:db8:61::1 > 2001:db8:61::42: ICMP6, echo request, seq 2, length 64
4 packets captured
4 packets received by filter
0 packets dropped by kernel
root@ubuntu:~/master-thesis#
***** Hosts ***** Hosts
****** Left side: IPv6 ****** Left side: IPv6
****** Right side: IPv4 ****** Right side: IPv4

View file

@ -143,7 +143,7 @@ class L2Controller(object):
def debug_print_pkg(self, pkg, msg="INCOMING"): def debug_print_pkg(self, pkg, msg="INCOMING"):
log.info("{}: {}".format(msg, self.debug_format_pkg(pkg))) log.debug("{}: {}".format(msg, self.debug_format_pkg(pkg)))
def debug_format_pkg(self, pkg): def debug_format_pkg(self, pkg):
packet = Ether(str(pkg)) packet = Ether(str(pkg))
@ -169,6 +169,8 @@ class L2Controller(object):
def recv_msg_cpu(self, pkg): def recv_msg_cpu(self, pkg):
packet = Ether(str(pkg)) packet = Ether(str(pkg))
debug_print_pkg(pkg)
if packet.type == 0x800: if packet.type == 0x800:
pass pass
elif packet.type == 0x86dd: elif packet.type == 0x86dd:

View file

@ -16,6 +16,12 @@ control MyIngress(inout headers hdr,
inout metadata meta, inout metadata meta,
inout standard_metadata_t standard_metadata) { inout standard_metadata_t standard_metadata) {
/* use for debugging and controlling flows */
action send_to_controller() {
clone3(CloneType.I2E, 100, meta);
}
/********************** ADDRESS TABLES ***********************************/ /********************** ADDRESS TABLES ***********************************/
action icmp6_answer() { action icmp6_answer() {
@ -41,10 +47,11 @@ control MyIngress(inout headers hdr,
} }
actions = { actions = {
icmp6_answer; icmp6_answer;
send_to_controller;
NoAction; NoAction;
} }
size = ADDRESS_TABLE_SIZE; size = ADDRESS_TABLE_SIZE;
default_action = NoAction; default_action = send_to_controller;
} }