helper module

helper.get_ip_of(lab_id, machine_id)

Returns the ip address of the specified machine id of the specified lab.

Parameters:
  • lab_id (str) – id of the lab, anyone of {sl1,sl2,cs101}
  • machine_id (int) – machine id is the last octet of the ip address
Returns:

ip_address (str)

helper.get_lab_prefix(lab_id)

Returns the prefix part of the ip address of the specified lab, along with last ip octet of the last node.

Parameters:lab_id
Returns:tuple (prefix,LAST_NODE)
helper.ping(ip)

Pings the specified ip and returns the status.

Parameters:ip (str) – ip address to be pinged
Returns:bool that represents online status
helper.ping_lab(lab_id)

Pings the specified ip and returns the status.

Parameters:lab_id (str) – id of the lab, anyone of {sl1,sl2,cs101}
Returns:bool that represents online status
helper.validate_machine(lab_id, machine_id)

Validates whether the ip address belongs to the specified lab.

Parameters:
  • lab_id (str) – id of the lab, anyone of {sl1,sl2,cs101}
  • machine_id (int) – machine id is the last octet of the ip address
Returns: