Example #1
0
 def startDiscovery( self, network ):
     ba = getBroadcastAddress( network )
     self.__log.debug( "startDiscovery %s, %s" % (network,ba) )
     # send attention request
     #TODO: confirm password not needed for probe message
     #sendUdpCommand( ba, "LGpassword" )
     sendUdpCommand( ba, "DA" )
 def testBadCommand(self):
     # without login
     sendUdpCommand( self._wbAddress, "LG" )
     sendUdpCommand( self._wbAddress, "NNTest1234" )
     time.sleep(1.0) # takes a while.
     sts = Wb6Status( self._wbAddress )
     cmdSts = sts.getCmdStatus()
     if cmdSts == 6: # webbrick started.
         cmdSts = 0
     self.assertNotEqual( cmdSts, 0 )
     return
 def testAlternatePort(self):
     # without login
     self.doLogin(self._wbAddressAndPort)
     sendUdpCommand( self._wbAddressAndPort, "NNTest1234" )
     time.sleep(1.0) # takes a while.
     sts = Wb6Status( self._wbAddress )
     cmdSts = sts.getCmdStatus()
     if cmdSts == 6: # webbrick started.
         cmdSts = 0
     self.assertEqual( cmdSts, 0 )
     return
 def testNameNode(self):
     self.doLogin(self._wbAddress)
     sendUdpCommand( self._wbAddress, "NNTest1234" )
     self.verifyCmdStatus()
     
     sendUdpCommand( self._wbAddress, "SN1" )
     self.verifyCmdStatus()
     
     time.sleep(1)
     cfg = Wb6Config( self._wbAddress )
     self.assertEqual( cfg.getNodeNumber(), 1 )
     self.assertEqual( cfg.getNodeName(), "Test1234" )
def setIp(tgtadrs, macbytes, ipbytes):
    cmd  = (':SA;'+
        formatIntList(macbytes,sep=";")+";"+
        formatIntList(ipbytes,sep=";")+":")
    if not sendUdpCommand(tgtadrs, cmd):
        return "Failed to send new address to WebBrick"
    return None
def login(tgtadrs, password):
    if not sendUdpCommand(tgtadrs, ':LG;'+password+':'):
        return "Failed to send login to WebBrick"
    return None
 def testDigOut(self):
     sendUdpCommand( self._wbAddress, "DO4T" )
     time.sleep(1.0) # takes a while.
     self.verifyCmdStatus()
     return
 def testLogin(self):
     sendUdpCommand( self._wbAddress, "LG%s" % (self._wbPassword) )
     time.sleep(1.0) # takes a while.
     self.verifyCmdStatus()
     return
 def testSiteplayerReset(self):
     self.doLogin(self._udpAddress)
     sendUdpCommand( self._udpAddress, "RS" )
     time.sleep(8.0) # takes a while.
     return
 def factoryReset(self):
     self.doLogin(self._wbAddress)
     sendUdpCommand( self._wbAddress, "FR1" )
     time.sleep(8.0) # takes a while.
     return
 def doReboot(self):
     # takes a while.
     self.doLogin(self._wbAddress)
     sendUdpCommand( self._wbAddress, "RB" )
     time.sleep(5.0)
     return
 def doLogin(self, wbAddress):
     sendUdpCommand( wbAddress, "LG%s" % (self._wbPassword) )
     # self.wb.Login( "installer" )
     return
 def doDiscover( self, action ):
     # send DA command
     ba = getBroadcastAddress( action[1] )
     self._log.debug( "discover %s, %s" % (action[1],ba) )
     #sendUdpCommand( ba, "LGpassword" )
     sendUdpCommand( ba, "DA" )