Skip to content

Commit ea6e860

Browse files
committed
feat: added client link quality validation
1 parent d9f2b7b commit ea6e860

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

butter/mas/clients/client.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,25 @@ def timeout(self, timeout):
4343

4444
self._timeout = timeout
4545

46+
def assertLinkQuality(self, clientIp) -> Response:
47+
"""Validate robot connection and assert link quality
48+
This validation assets minimal lower bound link quality, and do not take worst case scenarios into account
49+
ICMP protocol is assumed to be supported and enabled on the machine network
50+
51+
Args:
52+
clientIp (str): this machine ip address
53+
54+
Returns:
55+
Response: whether this machine is reachable within the defined link parameter
56+
"""
57+
packet = PacketBuilder(self.ip, self.port, self.protocol) \
58+
.addCommand('network') \
59+
.addParameter('ping') \
60+
.addKeyValuePair('ip', clientIp) \
61+
.addKeyValuePair('timeout', self._timeout) \
62+
.build()
63+
return packet.send(self._timeout)
64+
4665
def getAvailableHandlers(self) -> Response:
4766
"""Get available robot handlers
4867

0 commit comments

Comments
 (0)