Пример #1
0
 def runOp(self,controllerPc,hostPc,opParams):
     port = controllerPc.configs.defaultConfContent['hostPcServerPort']
     socket = operationWithSocket.createCommunication(self, hostPc["IP"], port)
     messegeToServer = {"operation": "sleep", "param": SLEEP_COMMAND}
     socket.sendall(json.dumps(messegeToServer).encode('utf-8'))  # encode the dict to JSON
     socket.close()
     hostPcIsOn = operation.checkIfPcisOn(self, controllerPc, hostPc) # Verify the host is down
     return not hostPcIsOn
Пример #2
0
    def runOp(self, controllerPc, hostPc, opParams):
        os.system("echo " + powerOnWithClicker.CLICKER_CHANNEL_COMMANDS[
            hostPc['clicker']['chanel']][0] + " > " + hostPc['clicker']['COM'])
        time.sleep(0.5)
        os.system("echo " + powerOnWithClicker.CLICKER_CHANNEL_COMMANDS[
            hostPc['clicker']['chanel']][1] + " > " + hostPc['clicker']['COM'])

        # check if the host is on
        hostStatus = operation.checkIfPcisOn(self, controllerPc, hostPc)
        return hostStatus  # if the host is up the clicker done well, and should return True
Пример #3
0
    def runOp(self, controllerPc, hostPc, opParams):
        macAdress = turnOnWithLan.getMacAdress(hostPc)
        #macAdress = b'\x10\x65\x30\x2B\xE5\x87'
        # wake on lan
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.sendto(
            b'\xff' * 6 + macAdress * 16,  #Host Pc MAC adress
            (hostPc["IP"], 80))  # Host Pc IP

        hostPcIsOn = operation.checkIfPcisOn(self, controllerPc, hostPc)
        return hostPcIsOn