Abstracts the execution of commands on network devices. Allows for integrated parsing and manipulation of return data for rapid integration to existing or newly created tools.
Commando superclass is intended to be subclassed. More documentation soon!
I run commands on devices but am not much use unless you subclass me and configure vendor-specific parse/generate methods.
Parse output from a device. Overload this to customize this default behavior.
Parse output from a device. Overload this to customize this default behavior.
Parse output from a device. Overload this to customize this default behavior.
Parse output from a device. Overload this to customize this default behavior.
Generate commands to be run on a device. If you don’t overload this, it returns an empty list.
Generate commands to be run on a device. If you don’t overload this, it returns an empty list.
Generate commands to be run on a device. If you don’t overload this, it returns an empty list.
Generate commands to be run on a device. If you don’t overload this, it returns an empty list.
Generate commands to be run on a device. If you don’t overload this, it returns an empty list.
Generate commands to be run on a device. If you don’t overload this, it returns an empty list.
Generate commands to be run on a device. If you don’t overload this, it returns an empty list.
Parse output from a device. Overload this to customize this default behavior.
Parse output from a device. Overload this to customize this default behavior.
Parse output from a device. Overload this to customize this default behavior.
Nothing happens until you execute this to perform the actual work.
Another method for storing results. If you’d rather just change the default method for storing results, overload this. All default parse/generate methods call this.
Class to fetch and parse interface information. Exposes a config attribute which is a dictionary of devices passed to the constructor and their interface information.
Each device is a dictionary of interfaces. Each interface field will default to an empty list if not populated after parsing. Below is a skeleton of the basic config, with expected fields:
config {
'device1': {
'interface1': {
'acl_in': [],
'acl_out': [],
'addr': [],
'description': [],
'subnets': [],
}
}
}
Interface field descriptions:
:addr: List of IPy.IP objects of interface addresses
:acl_in: List of inbound ACL names
:acl_out: List of outbound ACL names
:description: List of interface description(s)
:subnets: List of IPy.IP objects of interface networks/CIDRs
Example:
>>> n = NetACLInfo(devices=['jm10-cc101-lab.lab.aol.net'])
>>> n.run()
Fetching jm10-cc101-lab.lab.aol.net
>>> n.config.keys()
[<NetDevice: jm10-cc101-lab.lab.aol.net>]
>>> dev = n.config.keys()[0]
>>> n.config[dev].keys()
['lo0.0', 'ge-0/0/0.0', 'ge-0/2/0.0', 'ge-0/1/0.0', 'fxp0.0']
>>> n.config[dev]['lo0.0'].keys()
['acl_in', 'subnets', 'addr', 'acl_out', 'description']
>>> lo0 = n.config[dev]['lo0.0']
>>> lo0['acl_in']; lo0['addr']
['abc123']
[IP('66.185.128.160')]
Given ‘172.20.1.4/24’, return IP(‘172.20.1.0/24’).
Parse IOS config based on EBNF grammar
Parse IOS config based on EBNF grammar
Parse IOS config based on EBNF grammar
Similar to IOS, but:
- Arista has now “show conf” so we have to do “show run”
- The regex used in the CLI for Arista is more “precise” so we have to change the pattern a little bit compared to the on in generate_ios_cmd
This is the “show me all interface information” command we pass to IOS devices
This is the “show me all interface information” command we pass to IOS devices
This is the “show me all interface information” command we pass to IOS devices
Generates an etree.Element object suitable for use with JunoScript
Parse IOS config based on EBNF grammar
Convert CIDR bits to netmask
Do all the magic to parse Junos interfaces