+ // Set up the mapping: switch -> src MAC address -> incoming port
+ if (this.mac_to_ports.get(incoming_node) == null) {
+ this.mac_to_ports.put(incoming_node, new HashMap<Long, NodeConnector>());
+ }
+
+ // Only replace if we don't know the mapping. This
+ // saves us from over-writing correct mappings with
+ // incorrect ones we get during flooding.
+ //
+ // TODO: this should never happen..
+ if (this.mac_to_ports.get(incoming_node).get(srcMAC_val) == null) {
+ this.mac_to_ports.get(incoming_node).put(srcMAC_val, incoming_connector);
+ }
+
+ NodeConnector dst_connector = this.mac_to_ports.get(incoming_node).get(dstMAC_val);