Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

Special Built-In Functions

 

Wildmask Conversion for Cisco



Use function called wildcardtocidr

Sample

The result could be:



Convert ISIS system ID to IPv4





Match string value



Use function called getmatch

Sample:

The result of the print out is “1”



Get physical interface from sub interface



Use function called getphysical

Sample:

The result of the print out is “ge-0/0/1”.



Arithmetic Function



Arithmetic functions supported are add, subtract, multiply, and divide

Sample:

The result of the print out is “7”

The result of the print out is “3”

The result of the print out is “10”

The result of the print out is “2.5”



String Extraction Function



String extraction functions returns the character of properties of a string. The first character in a string starts at index 1. String functions includes len, right, left, mid, and find.

  • len(string) # returns the length of the string

  • right(string, num_char) # returns the number of characters from the right

  • left(string, num_char), # returns the number of characters from the left

  • mid(string, start_index, num_char) # returns the number of characters from the specified start index

  • find(txt_to_find, string, [start_index]) # find the index of the character in the string, the start_index is optional

Sample:

The result of the print out is "port-1/8/5:10G => 10G"

The result of the print out is "GigabitEthernet0/7/0/36.1778 => GigabitEthernet0/7/0/36"

The result of the print out is “test case 3 (a): length = 10"



Array Extraction Function



To extract an array from a string, the string syntax must have the array elements enclosed by bracket [,] and delimited by comma or white space. Then use the toarray function on the string to extract the array elements.

Sample:



Data Structure Objects



Data structure objects allows the user to create an object that can have multiple attributes assigned to it.

Sample: