[controller,p4] add debug print into controller
This commit is contained in:
		
					parent
					
						
							
								e8e33c78ea
							
						
					
				
			
			
				commit
				
					
						949560c995
					
				
			
		
					 3 changed files with 31 additions and 2 deletions
				
			
		
							
								
								
									
										20
									
								
								doc/plan.org
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								doc/plan.org
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -168,6 +168,26 @@ rtt min/avg/max/mdev = 0.053/0.074/0.095/0.021 ms
 | 
			
		|||
 | 
			
		||||
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
 | 
			
		||||
****** Left side: IPv6
 | 
			
		||||
****** Right side: IPv4
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -143,7 +143,7 @@ class L2Controller(object):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
    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):
 | 
			
		||||
        packet = Ether(str(pkg))
 | 
			
		||||
| 
						 | 
				
			
			@ -169,6 +169,8 @@ class L2Controller(object):
 | 
			
		|||
    def recv_msg_cpu(self, pkg):
 | 
			
		||||
        packet = Ether(str(pkg))
 | 
			
		||||
 | 
			
		||||
        debug_print_pkg(pkg)
 | 
			
		||||
 | 
			
		||||
        if packet.type == 0x800:
 | 
			
		||||
            pass
 | 
			
		||||
        elif packet.type == 0x86dd:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,6 +16,12 @@ control MyIngress(inout headers hdr,
 | 
			
		|||
    inout metadata meta,
 | 
			
		||||
    inout standard_metadata_t standard_metadata) {
 | 
			
		||||
 | 
			
		||||
    /* use for debugging and controlling flows */
 | 
			
		||||
    action send_to_controller() {
 | 
			
		||||
        clone3(CloneType.I2E, 100, meta);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /********************** ADDRESS TABLES ***********************************/
 | 
			
		||||
    action icmp6_answer() {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -41,10 +47,11 @@ control MyIngress(inout headers hdr,
 | 
			
		|||
        }
 | 
			
		||||
        actions = {
 | 
			
		||||
			icmp6_answer;
 | 
			
		||||
            send_to_controller;
 | 
			
		||||
            NoAction;
 | 
			
		||||
        }
 | 
			
		||||
        size = ADDRESS_TABLE_SIZE;
 | 
			
		||||
        default_action = NoAction;
 | 
			
		||||
        default_action = send_to_controller;
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue