Transport table debug information to controller
This commit is contained in:
parent
e1146070c4
commit
9ca4d4c8de
4 changed files with 88 additions and 26 deletions
|
|
@ -23,11 +23,20 @@ log = logging.getLogger("main")
|
|||
|
||||
|
||||
cpu_fields = {
|
||||
0: 'UNSET',
|
||||
1: 'ICMP6_NS',
|
||||
2: 'ICMP6_GENERAL',
|
||||
3: 'DEBUG'
|
||||
}
|
||||
|
||||
table_id_fields = {
|
||||
0: 'UNSET_TABLE',
|
||||
1: 'TABLE_NAT64',
|
||||
2: 'TABLE_ICMP6,
|
||||
3: 'TABLE_V6_NETWORKS,
|
||||
4: 'TABLE_NAT46',
|
||||
5: 'TABLE_V4_NETWORKS'
|
||||
}
|
||||
|
||||
class CpuHeader(Packet):
|
||||
name = 'CpuPacket'
|
||||
|
|
@ -35,6 +44,7 @@ class CpuHeader(Packet):
|
|||
ShortEnumField('task', 1, cpu_fields ),
|
||||
ShortField('ingress_port', 0),
|
||||
XShortEnumField("type", 0x9000, ETHER_TYPES)
|
||||
ShortEnumField('table_id', 1, table_id_fields ),
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -421,8 +431,6 @@ class L2Controller(object):
|
|||
def recv_msg_cpu(self, pkg):
|
||||
packet = Ether(str(pkg))
|
||||
|
||||
|
||||
|
||||
if packet.type == 0x0800:
|
||||
log.debug("Received raw (untagged) packet - BUG")
|
||||
self.debug_print_pkg(pkg)
|
||||
|
|
@ -432,13 +440,14 @@ class L2Controller(object):
|
|||
cpu_header = CpuHeader(packet.payload)
|
||||
ether_orig = Ether(src=packet.src, dst=packet.dst, type=cpu_header.type)
|
||||
orig_packet = ether_orig / IP(cpu_header.load)
|
||||
log.debug("cpu = {}".format(cpu_header.__repr__()))
|
||||
log.debug("v4 reassambled={}".format(orig_packet.__repr__()))
|
||||
|
||||
elif packet.type == 0x4242:
|
||||
cpu_header = CpuHeader(packet.payload)
|
||||
|
||||
# Not necessary anymore - cpu decoding works
|
||||
# log.debug("cpu = {}".format(cpu_header.__repr__()))
|
||||
log.debug("cpu = {}".format(cpu_header.__repr__()))
|
||||
|
||||
ether_orig = Ether(src=packet.src, dst=packet.dst, type=cpu_header.type)
|
||||
|
||||
|
|
@ -454,7 +463,7 @@ class L2Controller(object):
|
|||
src = orig_packet['IPv6'].src
|
||||
log.debug("Router solicitation from {} -- should probably handle this?".format(src))
|
||||
elif cpu_header.task == self.task['DEBUG']:
|
||||
log.debug("v6 reassambled={}".format(orig_packet.__repr__()))
|
||||
log.debug("[debug] v6 reassambled={}".format(orig_packet.__repr__()))
|
||||
elif cpu_header.task == self.task['ICMP6_NS']:
|
||||
log.info("Doing neighbor solicitation for the switch in the controller")
|
||||
self.handle_icmp6_ns(orig_packet)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue