def WebBrickUpdateIp(self, IpAddress, MacAddress, NetAddress, Password, NewIpAdrs):
     if IpAddress == "(None)": return "No WebBrick selected"
     if NewIpAdrs == "(None)": return "No IP address specified"
     bcadrs   = formatIpAdrs(mkBroadcastAddress(*parseNetAdrs(NetAddress)))
     macbytes = parseMacAdrs(MacAddress)
     ipbytes  = parseIpAdrs(NewIpAdrs)
     err      = login(bcadrs, Password)
     err      = err or setIp(bcadrs, macbytes, ipbytes)
     return err
Example #2
0
    def getWebBricks( self, network ):
        result = list()
        # turn result dict into list.
        self.__log.debug( "result %s" % self._webbricks )

        netbytes = parseNetAdrs(network)
        # now filter out all unwanted webbricks.
        for ntry in self._webbricks:
            wb = self._webbricks[ntry]
            ipbytes = parseIpAdrs( wb["ipAdr"] )
            if ipInNetwork(ipbytes, netbytes):
                result.append( wb )
        return result
Example #3
0
 def handleEvent1( self, inEvent ):
     self.__log.debug( 'Event %s : %s' % (inEvent.source(), inEvent.type()) )
     #self.__log.debug( 'Event.other_data %s' % (inEvent.other_data()) )
     if ( inEvent.type() == "http://id.webbrick.co.uk/events/webbrick/NN" ) or \
        ( inEvent.type() == "http://id.webbrick.co.uk/events/webbrick/AA" ):
         macStr = inEvent.other_data()["macAdr"]
         wb = None
         if self._webbricks.has_key( macStr ):
             # already seen
             wb = self._webbricks[macStr]
             #TODO: update values?
         else:
             # new entry: filter out responses from other networks
             ipStr   = inEvent.other_data()["ipAdr"]
             ipbytes = parseIpAdrs(ipStr)
             if ipInNetwork(ipbytes, self._netbytes):
                 wb = dict()
                 wb["macAdr"] = macStr
                 wb["ipAdr"]  = ipStr
                 self._webbricks[macStr] = wb
                 self.__log.debug( "new %s" % wb )
         if wb and inEvent.type() == "http://id.webbrick.co.uk/events/webbrick/NN":
             wb["unconfigured"] = True