Example #1
0
    def processevent(self, event):
        """Event handler

        @param event event to handle
        """
        key = self.get_key(event.sock, event.match.dl_src)

        #Broadcast mac
        if (pu.is_multicast_mac(event.match.dl_src)):
            return True

        mc.set(key, event.pktin.in_port, mac2sw_binding.TIMEOUT)
        output.vdbg("Learn that %x " % pu.array2val(event.match.dl_src) +\
                       "is connected to port " + \
                       str(event.pktin.in_port)+" of switch with "+\
                       str(event.sock),
                   self.__class__.__name__)

        return True
Example #2
0
    def processevent(self, event):
        """Event handler

        @param event event to handle
        @return false if flow can be installed, else true
        """
        if (isinstance(event, ofevents.pktin)):
            #Forward packet/flow
            if (pu.is_multicast_mac(event.match.dl_dst)):
                return True
            
            key = swhost.mac2sw_binding.get_key(event.sock,
                                                event.match.dl_dst)
            port = mc.get(key)
            if (port != None):
                self.installflow(event, port)
                return False
            else:
                output.dbg("No binding found for mac %x"  % pu.array2val(event.match.dl_dst),
                           self.__class__.__name__)
            
        return True