MockServer¶
- class lsst.ts.m2com.MockServer(host, port_command=50000, port_telemetry=50001, timeout_in_second=0.05, log=None, socket_family=AddressFamily.AF_UNSPEC, is_csc=True)¶
Bases:
object
Mock server of M2.
- Parameters:
- host
str
IP address for this server; typically
LOCALHOST
for IP4 or “::” for IP6.- port_command
int
, optional IP port for the command server. (the default is 50000)
- port_telemetry
int
, optional IP port for the telemetry server. (the default is 50001)
- timeout_in_second
float
, optional Read timeout in second. (the default is 0.05)
- log
logging.Logger
or None, optional A logger. If None, a logger will be instantiated. (the default is None)
- socket_family
socket.AddressFamily
, optional Can be set to
socket.AF_INET
orsocket.AF_INET6
to limit the server to IPv4 or IPv6, respectively. Ifsocket.AF_UNSPEC
(the default) the family will be determined from host, and if host is None, the server may listen on both IPv4 and IPv6 sockets.- is_csc
bool
, optional Is called by the commandable SAL component (CSC) or not. (the default is True)
- host
- Attributes:
- log
logging.Logger
A logger.
- model
MockModel
Mock model to simulate the M2 hardware behavior.
- server_command
tcpip.OneClientServer
Command server.
- server_telemetry
tcpip.OneClientServer
Telemetry server.
- timeout_in_second
float
Read timeout in second.
- log
Attributes Summary
Methods Summary
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
- FAKE_ERROR_CODE = 99¶
- PERIOD_TELEMETRY_IN_SECOND = 0.05¶
Methods Documentation
- are_servers_connected()¶
The command and telemetry sockets are connected or not.
- Returns:
- bool
True if servers are connected. Else, False.
- async close()¶
Cancel the tasks and close the connections.
Note: this function is safe to call even though there is no connection.
- async start()¶
Start the command and telemetry TCP/IP servers.