@set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
    def host_discovery_packet_in_handler(self, ev):
        msg = ev.msg
        pkt = packet.Packet(msg.data)
        eth = pkt.get_protocols(ethernet.ethernet)[0]

        # ignore lldp packet
        if eth.ethertype == ETH_TYPE_LLDP:
            return

        datapath = msg.datapath
        dpid = datapath.id
        port_no = -1

        if msg.datapath.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
            port_no = msg.in_port
        else:
            port_no = msg.match['in_port']

        port = self._get_port(dpid, port_no)

        # can't find this port(ex: logic port)
        if not port:
            return
        # ignore switch-to-switch port
        if not self._is_edge_port(port):
            return

        host_mac = eth.src
        host = Host(host_mac, port)

        if self.hosts not in host_mac:
            self.hosts.add(host)
            ev = event.EventHostAdd(host)
            self.send_event_to_observers(ev)

        # arp packet, update ip address
        if eth.ethertype == ether_types.ETH_TYPE_ARP:
            arp_pkt = pkt.get_protocols(arp.arp)[0]
            self.hosts.update_ip(host, ip_v4=arp_pkt.src_ip)

        # ipv4 packet, update ipv4 address
        elif eth.ethertype == ether_types.ETH_TYPE_IP:
            ipv4_pkt = pkt.get_protocols(ipv4.ipv4)[0]
            self.hosts.update_ip(host, ip_v4=ipv4_pkt.src)

        # ipv6 packet, update ipv6 address
        elif eth.ethertype == ether_types.ETH_TYPE_IPV6:
            # TODO: need to handle NDP
            ipv6_pkt = pkt.get_protocols(ipv6.ipv6)[0]
            self.hosts.update_ip(host, ip_v6=ipv6_pkt.src)
dataset/ETHPy150Open osrg/ryu/ryu/topology/switches.py/Switches.host_discovery_packet_in_handler/swapped operands of `not in`