MockServer

class lsst.ts.m2com.MockServer(host: str, port_command: int = 50000, port_telemetry: int = 50001, timeout_in_second: float = 0.05, log: Logger | None = None, is_csc: bool = True)

Bases: object

Mock server of M2.

Parameters

hoststr

IP address for this server; typically “LOCALHOST_IPV4” for IP4 or “LOCALHOST_IPV6” for IP6.

port_commandint, optional

IP port for the command server. (the default is 50000)

port_telemetryint, optional

IP port for the telemetry server. (the default is 50001)

timeout_in_secondfloat, optional

Read timeout in second. (the default is 0.05)

loglogging.Logger or None, optional

A logger. If None, a logger will be instantiated. (the default is None)

is_cscbool, optional

Is called by the commandable SAL component (CSC) or not. (the default is True)

Attributes

loglogging.Logger

A logger.

modelMockModel

Mock model to simulate the M2 hardware behavior.

server_commandtcpip.OneClientServer

Command server.

server_telemetrytcpip.OneClientServer

Telemetry server.

timeout_in_secondfloat

Read timeout in second.

Attributes Summary

PERIOD_TELEMETRY_IN_SECOND

Methods Summary

are_servers_connected()

The command and telemetry sockets are connected or not.

close()

Cancel the tasks and close the connections.

start()

Start the command and telemetry TCP/IP servers.

Attributes Documentation

PERIOD_TELEMETRY_IN_SECOND = 0.05

Methods Documentation

are_servers_connected() bool

The command and telemetry sockets are connected or not.

Returns

bool

True if servers are connected. Else, False.

async close() None

Cancel the tasks and close the connections.

Note: this function is safe to call even though there is no connection.

async start() None

Start the command and telemetry TCP/IP servers.