9.6. networking
- class nettoolkit.nettoolkit_common.networking.IP[source]
Bases:
objectCollection of static methods for Networking on (IP). see more…
- static bin2dec(binmask)[source]
convert binary mask to decimal mask
- Parameters:
binmask (str) – binary mask value
- Returns:
Decimal mask
- Return type:
int
- nettoolkit.nettoolkit_common.networking.expand_if(ifname)[source]
get the full length interface string for variable length interface
- Parameters:
ifname (str) – variable length interface name
- Returns:
updated interface string
- Return type:
str
- nettoolkit.nettoolkit_common.networking.expand_if_dict(d)[source]
returns updated the dictionary with standard expanded interface format in keys.
- Parameters:
d (dict) – dictionary where keys are interface names
- Returns:
updated dictionary keys with standard expanded interface format
- Return type:
dict
- nettoolkit.nettoolkit_common.networking.get_int_ip(ip)[source]
get ip address from ip/mask info
- Parameters:
ip (str) – ip with mask
- Returns:
ip address
- Return type:
str
- nettoolkit.nettoolkit_common.networking.get_int_mask(ip)[source]
get mask from ip/mask info
- Parameters:
ip (str) – ip with mask
- Returns:
mask
- Return type:
str
- nettoolkit.nettoolkit_common.networking.get_interface_cisco(line)[source]
get the standard interface string from interface config line
- Parameters:
ifname (str) – line starting with interface [interface name]
- Returns:
standard interface string
- Return type:
str
- nettoolkit.nettoolkit_common.networking.get_juniper_pw_string(spl, key_index)[source]
get plain-text-password from encrypted password.
- Parameters:
spl (list) – splitted set command list for password entry.
key_index (int) – index of password
- Returns:
decrypted password
- Return type:
str
- nettoolkit.nettoolkit_common.networking.get_vlans_cisco(line)[source]
set of vlan numbers allowed for the interface.
- Parameters:
line (str) – interface config line containing vlan info
- Returns:
vlan information dictionary
- Return type:
dict
- nettoolkit.nettoolkit_common.networking.get_vlans_juniper(spl, how='s')[source]
get the list of vlans on the interface
- Parameters:
spl (list) – splitted line
- Returns:
list of vlans
- Return type:
list
- nettoolkit.nettoolkit_common.networking.get_vrf_cisco(line)[source]
get the standard vrf string from vrf config line
- Parameters:
ifname (str) – line starting with vrf definition [vrf name]
- Returns:
standard interface string
- Return type:
str