Class APIs are used to build a function of the class, in terms of:
▪IP
▪IPv6
▪MAC
API |
Description |
---|---|
Device(device_name) |
Construct a function and return a new device object initialized from a device name. |
Device.Name() |
Return the hostname of the device. The returned data type is string. |
Device.Interfaces() |
Return all interface of a device. The returned data type is list. |
Device.Neighbors([topology_type] |
Return the neighbors of a device that belongs to a specified topology type. The returned object type is list. ▪topology_type — the topology type. The default value is null, which means all topology types. See Topology Type for the built-in topology types in the system. |
Device.NeighborInterfaces(topology_name) |
Return the neighbor interfaces of a device that belongs to a specified topology type. The returned object type is list. ▪topology_type — the topology type. The default value is null, which means all topology types. See Topology Type for the built-in topology types in the system. |
Device.SetProperty(device_property_name, value) |
Set a value for a specified property of a device. ▪device_property_name — the name of the specified device property, such as software version. ▪value — the value of the property. |
Device.GetProperty(device_property_name) |
Return the value of a specified device property. ▪device_property_name — the name of the specified device property, such as software version. |
Device.UpdateProperties() |
Update all property values of a device. |
API |
Description |
---|---|
Interface(device_name, interface_name, interface_type) |
Construct a function and return a new interface object initialized from a specified interface. ▪device_name — the device name. ▪interface_name — the name of the specified device interface. ▪interface_type — the interface types. See Interface Type for the types in the system. |
Interface.Name() |
Return the full name of an interface. |
Interface.ShortName() |
Return the short name of an interface. |
Interface.DeviceName() |
Return the hostname of the device that the current interface belongs to. |
Interface.Device() |
Return the device (object) that the current interface belongs to. |
Interface.Type() |
Return the type of the current interface. |
Interface.Neighbors([topology_type]) |
Return an interface's neighbor devices that belong to a specified topology type. The returned data type is a list. ▪topology_type — the topology type. The default value is null, which means all topology types. See Topology Type for the built-in topology types in the system. |
Interface.NeighborInterfaces([topology_type]) |
Return an interface's neighbor interfaces that belong to a specified topology type. The returned data type is a list. ▪topology_type — the topology type. The default value is null, which means all topology types. See Topology Type for the built-in topology types in the system. |
Interface.SetProperty(interface_property_name, value) |
Set a value for a specified property of an interface. ▪interface_property_name — the name of the specified module property, such as SW Rev. ▪value — the value of the module property. |
Interface.GetProperty(interface_property_name) |
Return the value of a specified property of an interface. ▪interface_property_name — the name of the specified property, such as SW Rev. |
Interface.UpdateProperties() |
Update all property values of an interface. |
API |
Description |
---|---|
Table([dict]) |
Construct a function and return a new interface object initialized from a specified dict. The dict is null by default. |
Table.AddOneRow(row_dict) |
Append one row to a table. |
Table.InsertOneRow(row_index, row_dict) |
Insert one row to the specific position of a table. ▪row_index — the position of a row. ▪row_dict — a dictionary variable which contains the mappings of the column names to the values of the items in the specified row, such as {"column_name1": value1, "column_name2": value2}. |
Table.DeleteOneRow(row_index) |
Delete a specified row. ▪row_index — the position of a row. |
Table.GetOneRow(row_index) |
Return a specified row. The returned variable is a dictionary which contains the mappings of the column names to the values of the items in the specified row, such as {"column_name1": value1, "column_name2": value2}. ▪row_index — the position of a row. |
Table.GetRows() |
Return all rows and their values of a table. The returned data type is a list and for a row in the list, it style is {"column_name1": value1, "column_name2": value2}. |
Table.GetRowCount() |
Count the number of rows of a table. The returned data type is int. |
Table.GetOneColumn(column_name) |
Retrieve all the items in a specified column. The returned data type is list. |
Table.GetColumns() |
Return all column names and the corresponding column values of a table. |
Table.GetColumnCount() |
Return the number of columns in the table. |
Table.HasColumn(column_name) |
Judge whether a specified column name exists in the current table. The returned data type is bool. |
Table.GetColumnNames() |
Return all column names. The returned data type is list. |
Table.SetValue(row_index, column_name, value) |
Set a value for table cell. |
Table.GetValue(row_index, column_name, value) |
Return the value of a specified table cell. |
Table.SetAttribute(attribute_name, value) |
Set a value for a specified attribute of a table. |
Table.GetAttribute(attribute_name) |
Return the value of a specified attribute of a table. |
Table.Attributes() |
Return all attribute names and their values. The returned data type is dict. |
Table.GetAttributeCount() |
Return the number of table attribute items. |
Table.ClearRows() |
Clear all rows of a table. |
Table.IsAllContain() |
Judge whether all the items in the specified column contain a value. |
Table.IsAllDifferent() |
Judge whether the items in the specified column are all different from each other in values. |
Table.IsAllSame() |
Judge whether the items in the specified column are the same as each other in value. |
Table.SortTable(column_name[, sort_type, is_ascending]) |
Sort the table according to the sort type applied to the specified column. ▪column_name — the column name. ▪sort_type — the value type of the specified column, such as IP, Int and etc. ▪is_ascending — the default value is True. False means sorting in the descent order. |
Table.UniqTable() |
Remove the duplicated rows in a table. |
API |
Description |
---|---|
IP(ip[, mask]) |
Construct a function and return a new IP object initialized from a specified IP. The input value supports the following formats: ▪1.1.1.1 ▪1.1.1.1/24 ▪1.1.1.1 255.255.255.0 |
IP.Address() |
Return an IP address, such as 192.168.1.1. |
IP.Mask() |
Return the mask of an IP address, such as 255.255.0.0. |
IP.ClassMask() |
Return the default mask of an IP address class, such as 255.0.0.0 for class A networks. |
IP.NetworkAddress |
Return the network address of an IP address, such as 192.168.1.0. |
IP.BoardcastAddress |
Return the network address of an IP address, such as 192.168.1.255. |
IP.Prefix() |
Return an IP address with address prefix length, such as 192.168.1.0/24. |
IP.Subnet() |
Return the subnet of an IP address, such as 192.168.1.0/24. |
IP.IsInSameSubnet(IP_address) |
Judge whether the IP address is in the same subnet as the input IP address. |
IP.IsSubnetOf(IP_address) |
Judge whether the IP address is one subnet of the input IP address. |
IP.IsInWildcardSubnet(network, wildcard) |
Judge whether the IP address is in the range of the input network address. The returned data type is bool (True or False). •Network — the IP network address. •Wildcard — the wildcard for the network address. |
IP.IsInRange(start_ip, end_ip) |
Judge whether the IP address is in a specified IP range. |
IP.IsPrivate() |
Judge whether the IP address is private. The returned data type is bool. |
IP.IsSubnet() |
Judge whether the IP address is a subnet IP address. |
IP.Int() |
Return the decimal value of an IP address. |
IP.Hex() |
Return the hex value of an IP address. |
IP.GetMask(wildcard_mask) |
Return the mask of an IP address according to the wildcard mask. |
IP.PrefixLengthToMask(prefix_length) |
Return the corresponding mask of a specified prefix length. The returned data type is string. |
IP.MaskToPrefixLength(mask) |
Return the corresponding prefix length of a specified mask. The returned data type is int. |
IP.IntToIP(int_value) |
Return the corresponding IP address of an integer. The returned data type is string. |
IP.IPToInt(ip_address) |
Return the corresponding integer of an IP address. The returned data type is int. |
API |
Description |
---|---|
IPv6(ipv6_address[, ipv6_mask]) |
Construct a function and return a new IP object initialized from a specified IP. The input value supports the following formats: ▪IPv6("2001:0001:0000:0000:0000:0000:0000:0001/64") ▪IPv6("2001:0001:0000:0000:0000:0000:0000:0001") |
IPv6.Address() |
Return the compressed format of an IPv6 address. such as 2001:1::1. |
IPv6.FullFormatAddress |
Return the full format of an IPv6 address, such as 2001:0001:0000:0000:0000:0000:0000:0001. |
IPv6.OriginalAddress() |
Return the original address of an IPv6 address, such as returning 2001:0001::1 for 2001:0001::0001. |
IPv6.PrefixLength() |
Return the prefix length of an IPv6 address. |
IPv6.Mask() |
Return the mask of an IPv6 address. |
IPv6.NetworkAddress() |
Return the network address of an IPv6 address. |
IPv6.Prefix([long_format]) |
Return an IP address with address prefix length, such as 2001:1::1/64. ▪long_format — the value type is bool. By default, the value is False, which refers to return an IPv6 address in a compressed representation. If True, return the IPv6 address in a full representation. |
IPv6.Subnet() |
Return the subnet of an IPv6 address, such as 2001:0001:0000:0000:0000:0000:0000:0000/64. |
IPv6.IsInSameSubnet(IP_address) |
Judge whether the IP address is in the same subnet as the input IP address. |
IPv6.IsSubnetOf(IP_address) |
Judge whether the IP address is one subnet of the input IP address. |
IPv6.IsInRange(start_ipv6, end_ipv6) |
Judge whether the IP address is in a specified IP range. |
IPv6.IsLinkLocal() |
Judge whether the IP address is link-local address. The returned data type is bool. |
IPv6.IsLoopback() |
Judge whether the IP address is a loopback address. The returned data type is bool. |
IPv6.IsMulticast() |
Judge whether the IP address is a multicast address. The returned data type is bool. |
IPv6.Int() |
Return the decimal value of an IP address. |
IPv6.Hex() |
Return the hex value of an IP address. |
API |
Description |
---|---|
MAC(mac_address) |
Construct a function and return a new MAC object initialized from a specified MAC address. The input value supports the following formats: ▪MAC("aaaaaaaaaaaa") ▪MAC("aaaaaa.bbbbbb") ▪MAC("aaaaaa-bbbbbb") ▪MAC("aaaaaa bbbbbb") ▪MAC("aaaaaa:bbbbbb") ▪MAC("aaaaaa/bbbbbb") ▪MAC("aaaa.bbbb.cccc") ▪MAC("aaaa-bbbb-cccc") ▪MAC("aaaa bbbb cccc") ▪MAC("aaaa:bbbb:cccc“) ▪MAC("aaaa/bbbb/cccc”) ▪MAC("aa.bb.cc.dd.ee.ff") ▪MAC("aa-bb-cc-dd-ee-ff") ▪MAC("aa bb cc dd ee ff") ▪MAC("aa:bb:cc:dd:ee:ff") ▪MAC("aa/bb/cc/dd/ee/ff") |
MAC.Address() |
Return a MAC address in a standard format (XXX.XXXX.XXXX). |
MAC.Int() |
Return the decimal value of an IP address. |
MAC.Hex() |
Return the hex value of an IP address. |
API |
Description |
---|---|
Percent([value]) |
Construct a function and return a new percent object initialized from a specified value. The input value supports the following formats: ▪Percent(0.1) ▪Percent("10.1%") |
Percent.Value |
Return the numeric value of a percent. For example, return 10 for 10%. |
Percent.TrueValue |
Return the value of a percent in decimal. For example, return 0.1 for 10%. |
API |
Description |
---|---|
IsIP(ip_address) |
Judge whether the IP address is valid. If the IP address is valid, return 4 for IPv4 address and 6 for IPv6 address. ▪IP_ address — the input IP address. |
IsMAC(mac_address) |
Judge whether the MAC address is valid. The returned data type is bool. |
IsPercent(percent) |
Judge whether the percent is valid. The returned data type is bool. |
See also: