コード例 #1
0
  def PatchPort(self, device_alias, port, is_output, action, universe,
                callback=None):
    """Patch a port to a universe.

    Args:
      device_alias: the alias of the device of which to patch a port
      port: the id of the port
      is_output: select the input or output port
      action: OlaClient.PATCH or OlaClient.UNPATCH
      universe: the universe to set the name of
      callback: The function to call once complete, takes one argument, a
        RequestStatus object.

    Returns:
      True if the request was sent, False otherwise.
    """
    if self._socket is None:
      return False

    controller = SimpleRpcController()
    request = Ola_pb2.PatchPortRequest()
    request.device_alias = device_alias
    request.port_id = port
    request.action = action
    request.is_output = is_output
    request.universe = universe
    try:
      self._stub.PatchPort(
          controller, request,
          lambda x, y: self._AckMessageComplete(callback, x, y))
    except socket.error:
      raise OLADNotRunningException()
    return True
コード例 #2
0
ファイル: OlaClient.py プロジェクト: syn2cat/syndilights
    def PatchPort(self, device_alias, port, action, universe, callback=None):
        """Patch a port to a universe.

    Args:
      device_alias: the alias of the device to configure
      port: the id of the port
      action: OlaClient.PATCH or OlcClient.UNPATCH
      universe: the universe to set the name of
      callback: The function to call once complete, takes one argument, a
        RequestStatus object.
    """
        controller = SimpleRpcController()
        request = Ola_pb2.PatchPortRequest()
        request.device_alias = device_alias
        request.port_id = port
        request.action = action
        request.universe = universe
        done = lambda x, y: self._AckMessageComplete(callback, x, y)
        self._stub.PatchPort(controller, request, done)