net_utils

st.net_utils.validate_ipv4_string(ipv4_addr)

Validate dotted-decimal IPv4 address string

Parameters:

ipv4_addr (str) – address to validate

Returns:

if valid IPv4 address, false otherwise

Return type:

true

st.net_utils.validate_port(port)

Validate port number

Parameters:

port (number) – port number to validate

Returns:

if valid port number, false otherwise

Return type:

true

st.net_utils.convert_ipv4_decimal_to_string(ipv4_integer)

Convert IPv4 decimal value to dotted-decimal string

Parameters:

ipv4_integer (number) – decimal representation of IPv4 address

Returns:

IPv4 value if successful, nil otherwise

Return type:

converted

st.net_utils.convert_ipv4_hex_to_dotted_decimal(hex_ip)

Converts a hex string to a valid dotted-decimal IPv4 address

Note: This will be primarily used to update older LAN devices that have hex representations for their IPv4 address. This utility function could be removed in the future when no longer in use.

Parameters:

hex_ip (str) – IP address string represented in hex

Returns:

IP address in dotted-decimal form if valid, nil otherwise

Return type:

str