Supported Functions in Network Intent

Network Intent provides built-in functions for you to define compound variables, compound tables or Formula Columns to convert predefined variables in terms of variable types, units, values, etc.

The following table introduces the built-in functions that will assist you in defining compound variables.

Function Name

Description

Data Type of Input Parameter

Sample of Input Parameter

Data Type of Return

Sample of Return

IPStringToNumber

Convert an IP address from string format to an integer. Masked IP address is allowed, e.g., “192.168.91.1/28”.

Note: Returning “-1” represents error.

String

IPStringToNumber(“192.168.91.1”)

Int (long)

3232258817

IPNumberToString

Convert an IP address from integer format to string format.

Note: Returning NULL (“”) represents error.

Int (long)

IPNumberToString(3232258817)

String

“192.168.91.1”

PercentageToNumber

Remove the percentage sign (%).

Note: Returning “-1” represents error.

String

PercentageToNumber(“50%”)

Int
Double

50

ByteConverter

Convert storage units (such as KB, MB, GB, etc.) to byte.

Note: The input parameter is case-insensitive, and abbreviations are allowed, e.g., GB, G, g.

Note: Returning “-1” represents error.

String

ByteConverter(“35MB”)

Int
Double

36,700,160 Bytes
(35x1024x1024)

NumberToString

Convert a number to string format.

Note: Returning NULL (“”) represents error.

Int
Double

NumberToString(5)

String

"5"

StringToNumber

Convert a string-type number to int or double format.

String

NumberToString(“19”)

Int
Double

19

IPtoHostname

Obtain a device hostname by using a given IP address. Masked IP address is allowed, e.g., “192.168.91.1/24”.

Note: If an IP address is being used by multiple devices, the hostname of a random device among those matches will be returned.

String

IPtoHostname(“192.168.91.1”)

String

“R1”

TrimRight

Trim one or more characters on the right side of a given string. If the designated character is left blank, it will be identified as a space character.

Format: TrimRight($var, ”char”)

String (original string),

String (char)

TrimRight(“4.03,” ”,”)

String

“4.03”

TrimLeft

Trim one or more characters on the left side of a given string. If the designated character is left blank, it will be identified as a space character.

Format: TrimLeft($var, “char”)

String (original string),

String (char)

TrimLeft(”-4.03”, ”-“)

String

“4.03”

Replace

Replace one character with another in a given string.

Format: Replace($var, “char_old”, “char_new”)

String (original string),

String (old char),

String (new char)

Replace(”2020-8-23”, “-”, “/“)

String

“2020/8/23”

FormatMAC

Format MAC addresses using NetBrain-specific standard (period-separated hexadecimal notation).

String

FormatMAC(“D8-67-D9-86-59-40”)

String

“d867.d986.5940”

IPtoInterfaceName

Obtain a device interface full name by using a given IP address. Masked IP address is allowed, e.g., “192.168.91.1/24”.

Note: If an IP address is being used by multiple devices, the interface name of a random device among those matches will be returned.

String

IPtoInterfaceName(“192.168.91.1”)

String

“FastEthernet1/1”

InterfaceShortToFull

Obtain a interface full name by using a given interface short name.

Format: InterfaceShortToFull($this_device, $intf )

String(deviname), String(intf_short_name)

InterfaceShortToFull(“R1”,”Ether2/1”)

String

“Ehternet2/1”

Find

Find one or more characters with another in a given string.

Format: Find($var, “chars”)

String (original string),

String (target char)

Find(”router ospf 100”,  “ospf”)

Int

1(True) or 0(False)

GetTableRowCount

Obain a table rows count by using a given table name

Note: Only applies to Compound Variables

String

GetTableRowCount(“ospf_nbrs”)

Int

32