partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
NXOSSSHDriver._get_bgp_route_attr
BGP protocol attributes for get_route_tp Only IPv4 supported
napalm/nxos_ssh/nxos_ssh.py
def _get_bgp_route_attr(self, destination, vrf, next_hop, ip_version=4): """ BGP protocol attributes for get_route_tp Only IPv4 supported """ CMD_SHIBNV = 'show ip bgp neighbors vrf {vrf} | include "is {neigh}"' search_re_dict = { "aspath": { ...
def _get_bgp_route_attr(self, destination, vrf, next_hop, ip_version=4): """ BGP protocol attributes for get_route_tp Only IPv4 supported """ CMD_SHIBNV = 'show ip bgp neighbors vrf {vrf} | include "is {neigh}"' search_re_dict = { "aspath": { ...
[ "BGP", "protocol", "attributes", "for", "get_route_tp", "Only", "IPv4", "supported" ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/nxos_ssh/nxos_ssh.py#L1164-L1286
[ "def", "_get_bgp_route_attr", "(", "self", ",", "destination", ",", "vrf", ",", "next_hop", ",", "ip_version", "=", "4", ")", ":", "CMD_SHIBNV", "=", "'show ip bgp neighbors vrf {vrf} | include \"is {neigh}\"'", "search_re_dict", "=", "{", "\"aspath\"", ":", "{", "\...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
NXOSSSHDriver.get_route_to
Only IPv4 supported, vrf aware, longer_prefixes parameter ready
napalm/nxos_ssh/nxos_ssh.py
def get_route_to(self, destination="", protocol=""): """ Only IPv4 supported, vrf aware, longer_prefixes parameter ready """ longer_pref = "" # longer_prefixes support, for future use vrf = "" ip_version = None try: ip_version = IPNetwork(destination...
def get_route_to(self, destination="", protocol=""): """ Only IPv4 supported, vrf aware, longer_prefixes parameter ready """ longer_pref = "" # longer_prefixes support, for future use vrf = "" ip_version = None try: ip_version = IPNetwork(destination...
[ "Only", "IPv4", "supported", "vrf", "aware", "longer_prefixes", "parameter", "ready" ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/nxos_ssh/nxos_ssh.py#L1288-L1394
[ "def", "get_route_to", "(", "self", ",", "destination", "=", "\"\"", ",", "protocol", "=", "\"\"", ")", ":", "longer_pref", "=", "\"\"", "# longer_prefixes support, for future use", "vrf", "=", "\"\"", "ip_version", "=", "None", "try", ":", "ip_version", "=", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
NetworkDriver._netmiko_open
Standardized method of creating a Netmiko connection using napalm attributes.
napalm/base/base.py
def _netmiko_open(self, device_type, netmiko_optional_args=None): """Standardized method of creating a Netmiko connection using napalm attributes.""" if netmiko_optional_args is None: netmiko_optional_args = {} try: self._netmiko_device = ConnectHandler( d...
def _netmiko_open(self, device_type, netmiko_optional_args=None): """Standardized method of creating a Netmiko connection using napalm attributes.""" if netmiko_optional_args is None: netmiko_optional_args = {} try: self._netmiko_device = ConnectHandler( d...
[ "Standardized", "method", "of", "creating", "a", "Netmiko", "connection", "using", "napalm", "attributes", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/base.py#L76-L94
[ "def", "_netmiko_open", "(", "self", ",", "device_type", ",", "netmiko_optional_args", "=", "None", ")", ":", "if", "netmiko_optional_args", "is", "None", ":", "netmiko_optional_args", "=", "{", "}", "try", ":", "self", ".", "_netmiko_device", "=", "ConnectHandl...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
NetworkDriver.load_template
Will load a templated configuration on the device. :param cls: Instance of the driver class. :param template_name: Identifies the template name. :param template_source (optional): Custom config template rendered and loaded on device :param template_path (optional): Absolute path to dire...
napalm/base/base.py
def load_template( self, template_name, template_source=None, template_path=None, **template_vars ): """ Will load a templated configuration on the device. :param cls: Instance of the driver class. :param template_name: Identifies the template name. :param template_s...
def load_template( self, template_name, template_source=None, template_path=None, **template_vars ): """ Will load a templated configuration on the device. :param cls: Instance of the driver class. :param template_name: Identifies the template name. :param template_s...
[ "Will", "load", "a", "templated", "configuration", "on", "the", "device", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/base.py#L148-L172
[ "def", "load_template", "(", "self", ",", "template_name", ",", "template_source", "=", "None", ",", "template_path", "=", "None", ",", "*", "*", "template_vars", ")", ":", "return", "napalm", ".", "base", ".", "helpers", ".", "load_template", "(", "self", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
NetworkDriver.traceroute
Executes traceroute on the device and returns a dictionary with the result. :param destination: Host or IP Address of the destination :param source (optional): Use a specific IP Address to execute the traceroute :param ttl (optional): Maimum number of hops :param timeout (optional): Num...
napalm/base/base.py
def traceroute( self, destination, source=c.TRACEROUTE_SOURCE, ttl=c.TRACEROUTE_TTL, timeout=c.TRACEROUTE_TIMEOUT, vrf=c.TRACEROUTE_VRF, ): """ Executes traceroute on the device and returns a dictionary with the result. :param destination: Hos...
def traceroute( self, destination, source=c.TRACEROUTE_SOURCE, ttl=c.TRACEROUTE_TTL, timeout=c.TRACEROUTE_TIMEOUT, vrf=c.TRACEROUTE_VRF, ): """ Executes traceroute on the device and returns a dictionary with the result. :param destination: Hos...
[ "Executes", "traceroute", "on", "the", "device", "and", "returns", "a", "dictionary", "with", "the", "result", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/base.py#L1295-L1407
[ "def", "traceroute", "(", "self", ",", "destination", ",", "source", "=", "c", ".", "TRACEROUTE_SOURCE", ",", "ttl", "=", "c", ".", "TRACEROUTE_TTL", ",", "timeout", "=", "c", ".", "TRACEROUTE_TIMEOUT", ",", "vrf", "=", "c", ".", "TRACEROUTE_VRF", ",", "...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
NetworkDriver.compliance_report
Return a compliance report. Verify that the device complies with the given validation file and writes a compliance report file. See https://napalm.readthedocs.io/en/latest/validate/index.html. :param validation_file: Path to the file containing compliance definition. Default is None. :...
napalm/base/base.py
def compliance_report(self, validation_file=None, validation_source=None): """ Return a compliance report. Verify that the device complies with the given validation file and writes a compliance report file. See https://napalm.readthedocs.io/en/latest/validate/index.html. :param...
def compliance_report(self, validation_file=None, validation_source=None): """ Return a compliance report. Verify that the device complies with the given validation file and writes a compliance report file. See https://napalm.readthedocs.io/en/latest/validate/index.html. :param...
[ "Return", "a", "compliance", "report", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/base.py#L1652-L1666
[ "def", "compliance_report", "(", "self", ",", "validation_file", "=", "None", ",", "validation_source", "=", "None", ")", ":", "return", "validate", ".", "compliance_report", "(", "self", ",", "validation_file", "=", "validation_file", ",", "validation_source", "=...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
NetworkDriver._canonical_int
Expose the helper function within this class.
napalm/base/base.py
def _canonical_int(self, interface): """Expose the helper function within this class.""" if self.use_canonical_interface is True: return napalm.base.helpers.canonical_interface_name( interface, addl_name_map=None ) else: return interface
def _canonical_int(self, interface): """Expose the helper function within this class.""" if self.use_canonical_interface is True: return napalm.base.helpers.canonical_interface_name( interface, addl_name_map=None ) else: return interface
[ "Expose", "the", "helper", "function", "within", "this", "class", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/base.py#L1668-L1675
[ "def", "_canonical_int", "(", "self", ",", "interface", ")", ":", "if", "self", ".", "use_canonical_interface", "is", "True", ":", "return", "napalm", ".", "base", ".", "helpers", ".", "canonical_interface_name", "(", "interface", ",", "addl_name_map", "=", "N...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.open
Open the connection with the device.
napalm/junos/junos.py
def open(self): """Open the connection with the device.""" try: self.device.open() except ConnectTimeoutError as cte: raise ConnectionException(cte.msg) self.device.timeout = self.timeout self.device._conn._session.transport.set_keepalive(self.keepalive) ...
def open(self): """Open the connection with the device.""" try: self.device.open() except ConnectTimeoutError as cte: raise ConnectionException(cte.msg) self.device.timeout = self.timeout self.device._conn._session.transport.set_keepalive(self.keepalive) ...
[ "Open", "the", "connection", "with", "the", "device", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L118-L132
[ "def", "open", "(", "self", ")", ":", "try", ":", "self", ".", "device", ".", "open", "(", ")", "except", "ConnectTimeoutError", "as", "cte", ":", "raise", "ConnectionException", "(", "cte", ".", "msg", ")", "self", ".", "device", ".", "timeout", "=", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.close
Close the connection.
napalm/junos/junos.py
def close(self): """Close the connection.""" if not self.lock_disable and self.session_config_lock: self._unlock() self.device.close()
def close(self): """Close the connection.""" if not self.lock_disable and self.session_config_lock: self._unlock() self.device.close()
[ "Close", "the", "connection", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L134-L138
[ "def", "close", "(", "self", ")", ":", "if", "not", "self", ".", "lock_disable", "and", "self", ".", "session_config_lock", ":", "self", ".", "_unlock", "(", ")", "self", ".", "device", ".", "close", "(", ")" ]
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver._lock
Lock the config DB.
napalm/junos/junos.py
def _lock(self): """Lock the config DB.""" if not self.locked: try: self.device.cu.lock() self.locked = True except JnprLockError as jle: raise LockError(py23_compat.text_type(jle))
def _lock(self): """Lock the config DB.""" if not self.locked: try: self.device.cu.lock() self.locked = True except JnprLockError as jle: raise LockError(py23_compat.text_type(jle))
[ "Lock", "the", "config", "DB", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L140-L147
[ "def", "_lock", "(", "self", ")", ":", "if", "not", "self", ".", "locked", ":", "try", ":", "self", ".", "device", ".", "cu", ".", "lock", "(", ")", "self", ".", "locked", "=", "True", "except", "JnprLockError", "as", "jle", ":", "raise", "LockErro...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver._unlock
Unlock the config DB.
napalm/junos/junos.py
def _unlock(self): """Unlock the config DB.""" if self.locked: try: self.device.cu.unlock() self.locked = False except JnrpUnlockError as jue: raise UnlockError(jue.messsage)
def _unlock(self): """Unlock the config DB.""" if self.locked: try: self.device.cu.unlock() self.locked = False except JnrpUnlockError as jue: raise UnlockError(jue.messsage)
[ "Unlock", "the", "config", "DB", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L149-L156
[ "def", "_unlock", "(", "self", ")", ":", "if", "self", ".", "locked", ":", "try", ":", "self", ".", "device", ".", "cu", ".", "unlock", "(", ")", "self", ".", "locked", "=", "False", "except", "JnrpUnlockError", "as", "jue", ":", "raise", "UnlockErro...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver._rpc
This allows you to construct an arbitrary RPC call to retreive common stuff. For example: Configuration: get: "<get-configuration/>" Interface information: get: "<get-interface-information/>" A particular interfacece information: get: "<get-interface-information/>" ...
napalm/junos/junos.py
def _rpc(self, get, child=None, **kwargs): """ This allows you to construct an arbitrary RPC call to retreive common stuff. For example: Configuration: get: "<get-configuration/>" Interface information: get: "<get-interface-information/>" A particular interfacece information: ...
def _rpc(self, get, child=None, **kwargs): """ This allows you to construct an arbitrary RPC call to retreive common stuff. For example: Configuration: get: "<get-configuration/>" Interface information: get: "<get-interface-information/>" A particular interfacece information: ...
[ "This", "allows", "you", "to", "construct", "an", "arbitrary", "RPC", "call", "to", "retreive", "common", "stuff", ".", "For", "example", ":", "Configuration", ":", "get", ":", "<get", "-", "configuration", "/", ">", "Interface", "information", ":", "get", ...
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L158-L173
[ "def", "_rpc", "(", "self", ",", "get", ",", "child", "=", "None", ",", "*", "*", "kwargs", ")", ":", "rpc", "=", "etree", ".", "fromstring", "(", "get", ")", "if", "child", ":", "rpc", ".", "append", "(", "etree", ".", "fromstring", "(", "child"...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.load_replace_candidate
Open the candidate config and merge.
napalm/junos/junos.py
def load_replace_candidate(self, filename=None, config=None): """Open the candidate config and merge.""" self.config_replace = True self._load_candidate(filename, config, True)
def load_replace_candidate(self, filename=None, config=None): """Open the candidate config and merge.""" self.config_replace = True self._load_candidate(filename, config, True)
[ "Open", "the", "candidate", "config", "and", "merge", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L244-L247
[ "def", "load_replace_candidate", "(", "self", ",", "filename", "=", "None", ",", "config", "=", "None", ")", ":", "self", ".", "config_replace", "=", "True", "self", ".", "_load_candidate", "(", "filename", ",", "config", ",", "True", ")" ]
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.load_merge_candidate
Open the candidate config and replace.
napalm/junos/junos.py
def load_merge_candidate(self, filename=None, config=None): """Open the candidate config and replace.""" self.config_replace = False self._load_candidate(filename, config, False)
def load_merge_candidate(self, filename=None, config=None): """Open the candidate config and replace.""" self.config_replace = False self._load_candidate(filename, config, False)
[ "Open", "the", "candidate", "config", "and", "replace", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L249-L252
[ "def", "load_merge_candidate", "(", "self", ",", "filename", "=", "None", ",", "config", "=", "None", ")", ":", "self", ".", "config_replace", "=", "False", "self", ".", "_load_candidate", "(", "filename", ",", "config", ",", "False", ")" ]
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.commit_config
Commit configuration.
napalm/junos/junos.py
def commit_config(self, message=""): """Commit configuration.""" commit_args = {"comment": message} if message else {} self.device.cu.commit(ignore_warning=self.ignore_warning, **commit_args) if not self.lock_disable and not self.session_config_lock: self._unlock()
def commit_config(self, message=""): """Commit configuration.""" commit_args = {"comment": message} if message else {} self.device.cu.commit(ignore_warning=self.ignore_warning, **commit_args) if not self.lock_disable and not self.session_config_lock: self._unlock()
[ "Commit", "configuration", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L263-L268
[ "def", "commit_config", "(", "self", ",", "message", "=", "\"\"", ")", ":", "commit_args", "=", "{", "\"comment\"", ":", "message", "}", "if", "message", "else", "{", "}", "self", ".", "device", ".", "cu", ".", "commit", "(", "ignore_warning", "=", "se...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.discard_config
Discard changes (rollback 0).
napalm/junos/junos.py
def discard_config(self): """Discard changes (rollback 0).""" self.device.cu.rollback(rb_id=0) if not self.lock_disable and not self.session_config_lock: self._unlock()
def discard_config(self): """Discard changes (rollback 0).""" self.device.cu.rollback(rb_id=0) if not self.lock_disable and not self.session_config_lock: self._unlock()
[ "Discard", "changes", "(", "rollback", "0", ")", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L270-L274
[ "def", "discard_config", "(", "self", ")", ":", "self", ".", "device", ".", "cu", ".", "rollback", "(", "rb_id", "=", "0", ")", "if", "not", "self", ".", "lock_disable", "and", "not", "self", ".", "session_config_lock", ":", "self", ".", "_unlock", "("...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.get_interfaces
Return interfaces details.
napalm/junos/junos.py
def get_interfaces(self): """Return interfaces details.""" result = {} interfaces = junos_views.junos_iface_table(self.device) interfaces.get() interfaces_logical = junos_views.junos_logical_iface_table(self.device) interfaces_logical.get() # convert all the tup...
def get_interfaces(self): """Return interfaces details.""" result = {} interfaces = junos_views.junos_iface_table(self.device) interfaces.get() interfaces_logical = junos_views.junos_logical_iface_table(self.device) interfaces_logical.get() # convert all the tup...
[ "Return", "interfaces", "details", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L302-L362
[ "def", "get_interfaces", "(", "self", ")", ":", "result", "=", "{", "}", "interfaces", "=", "junos_views", ".", "junos_iface_table", "(", "self", ".", "device", ")", "interfaces", ".", "get", "(", ")", "interfaces_logical", "=", "junos_views", ".", "junos_lo...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.get_interfaces_counters
Return interfaces counters.
napalm/junos/junos.py
def get_interfaces_counters(self): """Return interfaces counters.""" query = junos_views.junos_iface_counter_table(self.device) query.get() interface_counters = {} for interface, counters in query.items(): interface_counters[interface] = { k: v if v is...
def get_interfaces_counters(self): """Return interfaces counters.""" query = junos_views.junos_iface_counter_table(self.device) query.get() interface_counters = {} for interface, counters in query.items(): interface_counters[interface] = { k: v if v is...
[ "Return", "interfaces", "counters", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L364-L373
[ "def", "get_interfaces_counters", "(", "self", ")", ":", "query", "=", "junos_views", ".", "junos_iface_counter_table", "(", "self", ".", "device", ")", "query", ".", "get", "(", ")", "interface_counters", "=", "{", "}", "for", "interface", ",", "counters", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.get_environment
Return environment details.
napalm/junos/junos.py
def get_environment(self): """Return environment details.""" environment = junos_views.junos_environment_table(self.device) routing_engine = junos_views.junos_routing_engine_table(self.device) temperature_thresholds = junos_views.junos_temperature_thresholds(self.device) power_su...
def get_environment(self): """Return environment details.""" environment = junos_views.junos_environment_table(self.device) routing_engine = junos_views.junos_routing_engine_table(self.device) temperature_thresholds = junos_views.junos_temperature_thresholds(self.device) power_su...
[ "Return", "environment", "details", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L375-L542
[ "def", "get_environment", "(", "self", ")", ":", "environment", "=", "junos_views", ".", "junos_environment_table", "(", "self", ".", "device", ")", "routing_engine", "=", "junos_views", ".", "junos_routing_engine_table", "(", "self", ".", "device", ")", "temperat...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver._get_address_family
Function to derive address family from a junos table name. :params table: The name of the routing table :returns: address family
napalm/junos/junos.py
def _get_address_family(table, instance): """ Function to derive address family from a junos table name. :params table: The name of the routing table :returns: address family """ address_family_mapping = {"inet": "ipv4", "inet6": "ipv6", "inetflow": "flow"} if in...
def _get_address_family(table, instance): """ Function to derive address family from a junos table name. :params table: The name of the routing table :returns: address family """ address_family_mapping = {"inet": "ipv4", "inet6": "ipv6", "inetflow": "flow"} if in...
[ "Function", "to", "derive", "address", "family", "from", "a", "junos", "table", "name", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L545-L561
[ "def", "_get_address_family", "(", "table", ",", "instance", ")", ":", "address_family_mapping", "=", "{", "\"inet\"", ":", "\"ipv4\"", ",", "\"inet6\"", ":", "\"ipv6\"", ",", "\"inetflow\"", ":", "\"flow\"", "}", "if", "instance", "==", "\"master\"", ":", "fa...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.get_lldp_neighbors_detail
Detailed view of the LLDP neighbors.
napalm/junos/junos.py
def get_lldp_neighbors_detail(self, interface=""): """Detailed view of the LLDP neighbors.""" lldp_neighbors = defaultdict(list) lldp_table = junos_views.junos_lldp_neighbors_detail_table(self.device) if not interface: try: lldp_table.get() except ...
def get_lldp_neighbors_detail(self, interface=""): """Detailed view of the LLDP neighbors.""" lldp_neighbors = defaultdict(list) lldp_table = junos_views.junos_lldp_neighbors_detail_table(self.device) if not interface: try: lldp_table.get() except ...
[ "Detailed", "view", "of", "the", "LLDP", "neighbors", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L787-L854
[ "def", "get_lldp_neighbors_detail", "(", "self", ",", "interface", "=", "\"\"", ")", ":", "lldp_neighbors", "=", "defaultdict", "(", "list", ")", "lldp_table", "=", "junos_views", ".", "junos_lldp_neighbors_detail_table", "(", "self", ".", "device", ")", "if", "...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.cli
Execute raw CLI commands and returns their output.
napalm/junos/junos.py
def cli(self, commands): """Execute raw CLI commands and returns their output.""" cli_output = {} def _count(txt, none): # Second arg for consistency only. noqa """ Return the exact output, as Junos displays e.g.: > show system processes extensiv...
def cli(self, commands): """Execute raw CLI commands and returns their output.""" cli_output = {} def _count(txt, none): # Second arg for consistency only. noqa """ Return the exact output, as Junos displays e.g.: > show system processes extensiv...
[ "Execute", "raw", "CLI", "commands", "and", "returns", "their", "output", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L856-L980
[ "def", "cli", "(", "self", ",", "commands", ")", ":", "cli_output", "=", "{", "}", "def", "_count", "(", "txt", ",", "none", ")", ":", "# Second arg for consistency only. noqa", "\"\"\"\n Return the exact output, as Junos displays\n e.g.:\n ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.get_bgp_config
Return BGP configuration.
napalm/junos/junos.py
def get_bgp_config(self, group="", neighbor=""): """Return BGP configuration.""" def _check_nhs(policies, nhs_policies): if not isinstance(policies, list): # Make it a list if it is a single policy policies = [policies] # Return True if "next-hop ...
def get_bgp_config(self, group="", neighbor=""): """Return BGP configuration.""" def _check_nhs(policies, nhs_policies): if not isinstance(policies, list): # Make it a list if it is a single policy policies = [policies] # Return True if "next-hop ...
[ "Return", "BGP", "configuration", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L982-L1236
[ "def", "get_bgp_config", "(", "self", ",", "group", "=", "\"\"", ",", "neighbor", "=", "\"\"", ")", ":", "def", "_check_nhs", "(", "policies", ",", "nhs_policies", ")", ":", "if", "not", "isinstance", "(", "policies", ",", "list", ")", ":", "# Make it a ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.get_bgp_neighbors_detail
Detailed view of the BGP neighbors operational data.
napalm/junos/junos.py
def get_bgp_neighbors_detail(self, neighbor_address=""): """Detailed view of the BGP neighbors operational data.""" bgp_neighbors = {} default_neighbor_details = { "up": False, "local_as": 0, "remote_as": 0, "router_id": "", "local_addr...
def get_bgp_neighbors_detail(self, neighbor_address=""): """Detailed view of the BGP neighbors operational data.""" bgp_neighbors = {} default_neighbor_details = { "up": False, "local_as": 0, "remote_as": 0, "router_id": "", "local_addr...
[ "Detailed", "view", "of", "the", "BGP", "neighbors", "operational", "data", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L1238-L1397
[ "def", "get_bgp_neighbors_detail", "(", "self", ",", "neighbor_address", "=", "\"\"", ")", ":", "bgp_neighbors", "=", "{", "}", "default_neighbor_details", "=", "{", "\"up\"", ":", "False", ",", "\"local_as\"", ":", "0", ",", "\"remote_as\"", ":", "0", ",", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.get_arp_table
Return the ARP table.
napalm/junos/junos.py
def get_arp_table(self, vrf=""): """Return the ARP table.""" # could use ArpTable # from jnpr.junos.op.phyport import ArpTable # and simply use it # but # we need: # - filters # - group by VLAN ID # - hostname & TTE fields as well if ...
def get_arp_table(self, vrf=""): """Return the ARP table.""" # could use ArpTable # from jnpr.junos.op.phyport import ArpTable # and simply use it # but # we need: # - filters # - group by VLAN ID # - hostname & TTE fields as well if ...
[ "Return", "the", "ARP", "table", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L1399-L1425
[ "def", "get_arp_table", "(", "self", ",", "vrf", "=", "\"\"", ")", ":", "# could use ArpTable", "# from jnpr.junos.op.phyport import ArpTable", "# and simply use it", "# but", "# we need:", "# - filters", "# - group by VLAN ID", "# - hostname & TTE fields as well", "if", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.get_ipv6_neighbors_table
Return the IPv6 neighbors table.
napalm/junos/junos.py
def get_ipv6_neighbors_table(self): """Return the IPv6 neighbors table.""" ipv6_neighbors_table = [] ipv6_neighbors_table_raw = junos_views.junos_ipv6_neighbors_table(self.device) ipv6_neighbors_table_raw.get() ipv6_neighbors_table_items = ipv6_neighbors_table_raw.items() ...
def get_ipv6_neighbors_table(self): """Return the IPv6 neighbors table.""" ipv6_neighbors_table = [] ipv6_neighbors_table_raw = junos_views.junos_ipv6_neighbors_table(self.device) ipv6_neighbors_table_raw.get() ipv6_neighbors_table_items = ipv6_neighbors_table_raw.items() ...
[ "Return", "the", "IPv6", "neighbors", "table", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L1427-L1441
[ "def", "get_ipv6_neighbors_table", "(", "self", ")", ":", "ipv6_neighbors_table", "=", "[", "]", "ipv6_neighbors_table_raw", "=", "junos_views", ".", "junos_ipv6_neighbors_table", "(", "self", ".", "device", ")", "ipv6_neighbors_table_raw", ".", "get", "(", ")", "ip...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.get_ntp_stats
Return NTP stats (associations).
napalm/junos/junos.py
def get_ntp_stats(self): """Return NTP stats (associations).""" # NTP Peers does not have XML RPC defined # thus we need to retrieve raw text and parse... # :( ntp_stats = [] REGEX = ( r"^\s?(\+|\*|x|-)?([a-zA-Z0-9\.+-:]+)" r"\s+([a-zA-Z0-9\.]+)\...
def get_ntp_stats(self): """Return NTP stats (associations).""" # NTP Peers does not have XML RPC defined # thus we need to retrieve raw text and parse... # :( ntp_stats = [] REGEX = ( r"^\s?(\+|\*|x|-)?([a-zA-Z0-9\.+-:]+)" r"\s+([a-zA-Z0-9\.]+)\...
[ "Return", "NTP", "stats", "(", "associations", ")", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L1467-L1510
[ "def", "get_ntp_stats", "(", "self", ")", ":", "# NTP Peers does not have XML RPC defined", "# thus we need to retrieve raw text and parse...", "# :(", "ntp_stats", "=", "[", "]", "REGEX", "=", "(", "r\"^\\s?(\\+|\\*|x|-)?([a-zA-Z0-9\\.+-:]+)\"", "r\"\\s+([a-zA-Z0-9\\.]+)\\s+([0-9]...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.get_interfaces_ip
Return the configured IP addresses.
napalm/junos/junos.py
def get_interfaces_ip(self): """Return the configured IP addresses.""" interfaces_ip = {} interface_table = junos_views.junos_ip_interfaces_table(self.device) interface_table.get() interface_table_items = interface_table.items() _FAMILY_VMAP_ = { "inet": "ip...
def get_interfaces_ip(self): """Return the configured IP addresses.""" interfaces_ip = {} interface_table = junos_views.junos_ip_interfaces_table(self.device) interface_table.get() interface_table_items = interface_table.items() _FAMILY_VMAP_ = { "inet": "ip...
[ "Return", "the", "configured", "IP", "addresses", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L1512-L1555
[ "def", "get_interfaces_ip", "(", "self", ")", ":", "interfaces_ip", "=", "{", "}", "interface_table", "=", "junos_views", ".", "junos_ip_interfaces_table", "(", "self", ".", "device", ")", "interface_table", ".", "get", "(", ")", "interface_table_items", "=", "i...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.get_mac_address_table
Return the MAC address table.
napalm/junos/junos.py
def get_mac_address_table(self): """Return the MAC address table.""" mac_address_table = [] switch_style = self.device.facts.get("switch_style", "") if switch_style == "VLAN_L2NG": mac_table = junos_views.junos_mac_address_table_switch_l2ng(self.device) elif switch_s...
def get_mac_address_table(self): """Return the MAC address table.""" mac_address_table = [] switch_style = self.device.facts.get("switch_style", "") if switch_style == "VLAN_L2NG": mac_table = junos_views.junos_mac_address_table_switch_l2ng(self.device) elif switch_s...
[ "Return", "the", "MAC", "address", "table", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L1557-L1603
[ "def", "get_mac_address_table", "(", "self", ")", ":", "mac_address_table", "=", "[", "]", "switch_style", "=", "self", ".", "device", ".", "facts", ".", "get", "(", "\"switch_style\"", ",", "\"\"", ")", "if", "switch_style", "==", "\"VLAN_L2NG\"", ":", "mac...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.get_route_to
Return route details to a specific destination, learned from a certain protocol.
napalm/junos/junos.py
def get_route_to(self, destination="", protocol=""): """Return route details to a specific destination, learned from a certain protocol.""" routes = {} if not isinstance(destination, py23_compat.string_types): raise TypeError("Please specify a valid destination!") if protoc...
def get_route_to(self, destination="", protocol=""): """Return route details to a specific destination, learned from a certain protocol.""" routes = {} if not isinstance(destination, py23_compat.string_types): raise TypeError("Please specify a valid destination!") if protoc...
[ "Return", "route", "details", "to", "a", "specific", "destination", "learned", "from", "a", "certain", "protocol", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L1605-L1725
[ "def", "get_route_to", "(", "self", ",", "destination", "=", "\"\"", ",", "protocol", "=", "\"\"", ")", ":", "routes", "=", "{", "}", "if", "not", "isinstance", "(", "destination", ",", "py23_compat", ".", "string_types", ")", ":", "raise", "TypeError", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.get_snmp_information
Return the SNMP configuration.
napalm/junos/junos.py
def get_snmp_information(self): """Return the SNMP configuration.""" snmp_information = {} snmp_config = junos_views.junos_snmp_config_table(self.device) snmp_config.get() snmp_items = snmp_config.items() if not snmp_items: return snmp_information s...
def get_snmp_information(self): """Return the SNMP configuration.""" snmp_information = {} snmp_config = junos_views.junos_snmp_config_table(self.device) snmp_config.get() snmp_items = snmp_config.items() if not snmp_items: return snmp_information s...
[ "Return", "the", "SNMP", "configuration", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L1727-L1763
[ "def", "get_snmp_information", "(", "self", ")", ":", "snmp_information", "=", "{", "}", "snmp_config", "=", "junos_views", ".", "junos_snmp_config_table", "(", "self", ".", "device", ")", "snmp_config", ".", "get", "(", ")", "snmp_items", "=", "snmp_config", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver._get_root
get root user password.
napalm/junos/junos.py
def _get_root(self): """get root user password.""" _DEFAULT_USER_DETAILS = {"level": 20, "password": "", "sshkeys": []} root = {} root_table = junos_views.junos_root_table(self.device) root_table.get() root_items = root_table.items() for user_entry in root_items: ...
def _get_root(self): """get root user password.""" _DEFAULT_USER_DETAILS = {"level": 20, "password": "", "sshkeys": []} root = {} root_table = junos_views.junos_root_table(self.device) root_table.get() root_items = root_table.items() for user_entry in root_items: ...
[ "get", "root", "user", "password", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L2070-L2092
[ "def", "_get_root", "(", "self", ")", ":", "_DEFAULT_USER_DETAILS", "=", "{", "\"level\"", ":", "20", ",", "\"password\"", ":", "\"\"", ",", "\"sshkeys\"", ":", "[", "]", "}", "root", "=", "{", "}", "root_table", "=", "junos_views", ".", "junos_root_table"...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.get_users
Return the configuration of the users.
napalm/junos/junos.py
def get_users(self): """Return the configuration of the users.""" users = {} _JUNOS_CLASS_CISCO_PRIVILEGE_LEVEL_MAP = { "super-user": 15, "superuser": 15, "operator": 5, "read-only": 1, "unauthorized": 0, } _DEFAULT_US...
def get_users(self): """Return the configuration of the users.""" users = {} _JUNOS_CLASS_CISCO_PRIVILEGE_LEVEL_MAP = { "super-user": 15, "superuser": 15, "operator": 5, "read-only": 1, "unauthorized": 0, } _DEFAULT_US...
[ "Return", "the", "configuration", "of", "the", "users", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L2094-L2131
[ "def", "get_users", "(", "self", ")", ":", "users", "=", "{", "}", "_JUNOS_CLASS_CISCO_PRIVILEGE_LEVEL_MAP", "=", "{", "\"super-user\"", ":", "15", ",", "\"superuser\"", ":", "15", ",", "\"operator\"", ":", "5", ",", "\"read-only\"", ":", "1", ",", "\"unauth...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
JunOSDriver.get_optics
Return optics information.
napalm/junos/junos.py
def get_optics(self): """Return optics information.""" optics_table = junos_views.junos_intf_optics_table(self.device) optics_table.get() optics_items = optics_table.items() # optics_items has no lane information, so we need to re-format data # inserting lane 0 for all o...
def get_optics(self): """Return optics information.""" optics_table = junos_views.junos_intf_optics_table(self.device) optics_table.get() optics_items = optics_table.items() # optics_items has no lane information, so we need to re-format data # inserting lane 0 for all o...
[ "Return", "optics", "information", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/junos.py#L2133-L2232
[ "def", "get_optics", "(", "self", ")", ":", "optics_table", "=", "junos_views", ".", "junos_intf_optics_table", "(", "self", ".", "device", ")", "optics_table", ".", "get", "(", ")", "optics_items", "=", "optics_table", ".", "items", "(", ")", "# optics_items ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
_preprocess_yml
Dynamically create PY3 version of the file by re-writing 'unicode' to 'str'.
napalm/junos/utils/junos_views.py
def _preprocess_yml(path): """Dynamically create PY3 version of the file by re-writing 'unicode' to 'str'.""" with open(path) as f: tmp_yaml = f.read() return re.sub(r"unicode", "str", tmp_yaml)
def _preprocess_yml(path): """Dynamically create PY3 version of the file by re-writing 'unicode' to 'str'.""" with open(path) as f: tmp_yaml = f.read() return re.sub(r"unicode", "str", tmp_yaml)
[ "Dynamically", "create", "PY3", "version", "of", "the", "file", "by", "re", "-", "writing", "unicode", "to", "str", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/junos/utils/junos_views.py#L11-L15
[ "def", "_preprocess_yml", "(", "path", ")", ":", "with", "open", "(", "path", ")", "as", "f", ":", "tmp_yaml", "=", "f", ".", "read", "(", ")", "return", "re", ".", "sub", "(", "r\"unicode\"", ",", "\"str\"", ",", "tmp_yaml", ")" ]
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
cisco_conf_parse_parents
Use CiscoConfParse to find parent lines that contain a specific child line. :param parent: The parent line to search for :param child: The child line required under the given parent :param config: The device running/startup config
napalm/base/helpers.py
def cisco_conf_parse_parents(parent, child, config): """ Use CiscoConfParse to find parent lines that contain a specific child line. :param parent: The parent line to search for :param child: The child line required under the given parent :param config: The device running/startup config """ ...
def cisco_conf_parse_parents(parent, child, config): """ Use CiscoConfParse to find parent lines that contain a specific child line. :param parent: The parent line to search for :param child: The child line required under the given parent :param config: The device running/startup config """ ...
[ "Use", "CiscoConfParse", "to", "find", "parent", "lines", "that", "contain", "a", "specific", "child", "line", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/helpers.py#L113-L125
[ "def", "cisco_conf_parse_parents", "(", "parent", ",", "child", ",", "config", ")", ":", "if", "type", "(", "config", ")", "==", "str", ":", "config", "=", "config", ".", "splitlines", "(", ")", "parse", "=", "CiscoConfParse", "(", "config", ")", "cfg_ob...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
cisco_conf_parse_objects
Use CiscoConfParse to find and return a section of Cisco IOS config. Similar to "show run | section <cfg_section>" :param cfg_section: The section of the config to return eg. "router bgp" :param config: The running/startup config of the device to parse
napalm/base/helpers.py
def cisco_conf_parse_objects(cfg_section, config): """ Use CiscoConfParse to find and return a section of Cisco IOS config. Similar to "show run | section <cfg_section>" :param cfg_section: The section of the config to return eg. "router bgp" :param config: The running/startup config of the device ...
def cisco_conf_parse_objects(cfg_section, config): """ Use CiscoConfParse to find and return a section of Cisco IOS config. Similar to "show run | section <cfg_section>" :param cfg_section: The section of the config to return eg. "router bgp" :param config: The running/startup config of the device ...
[ "Use", "CiscoConfParse", "to", "find", "and", "return", "a", "section", "of", "Cisco", "IOS", "config", ".", "Similar", "to", "show", "run", "|", "section", "<cfg_section", ">" ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/helpers.py#L128-L145
[ "def", "cisco_conf_parse_objects", "(", "cfg_section", ",", "config", ")", ":", "return_config", "=", "[", "]", "if", "type", "(", "config", ")", "is", "str", ":", "config", "=", "config", ".", "splitlines", "(", ")", "parse", "=", "CiscoConfParse", "(", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
regex_find_txt
RegEx search for pattern in text. Will try to match the data type of the "default" value or return the default value if no match is found. This is to parse IOS config like below: regex_find_txt(r"remote-as (65000)", "neighbor 10.0.0.1 remote-as 65000", default=0) RETURNS: 65001 :param pattern: RegE...
napalm/base/helpers.py
def regex_find_txt(pattern, text, default=""): """"" RegEx search for pattern in text. Will try to match the data type of the "default" value or return the default value if no match is found. This is to parse IOS config like below: regex_find_txt(r"remote-as (65000)", "neighbor 10.0.0.1 remote-as 65...
def regex_find_txt(pattern, text, default=""): """"" RegEx search for pattern in text. Will try to match the data type of the "default" value or return the default value if no match is found. This is to parse IOS config like below: regex_find_txt(r"remote-as (65000)", "neighbor 10.0.0.1 remote-as 65...
[ "RegEx", "search", "for", "pattern", "in", "text", ".", "Will", "try", "to", "match", "the", "data", "type", "of", "the", "default", "value", "or", "return", "the", "default", "value", "if", "no", "match", "is", "found", ".", "This", "is", "to", "parse...
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/helpers.py#L148-L171
[ "def", "regex_find_txt", "(", "pattern", ",", "text", ",", "default", "=", "\"\"", ")", ":", "text", "=", "str", "(", "text", ")", "value", "=", "re", ".", "findall", "(", "pattern", ",", "text", ")", "try", ":", "if", "not", "value", ":", "raise",...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
textfsm_extractor
Applies a TextFSM template over a raw text and return the matching table. Main usage of this method will be to extract data form a non-structured output from a network device and return the values in a table format. :param cls: Instance of the driver class :param template_name: Specifies the name of t...
napalm/base/helpers.py
def textfsm_extractor(cls, template_name, raw_text): """ Applies a TextFSM template over a raw text and return the matching table. Main usage of this method will be to extract data form a non-structured output from a network device and return the values in a table format. :param cls: Instance of t...
def textfsm_extractor(cls, template_name, raw_text): """ Applies a TextFSM template over a raw text and return the matching table. Main usage of this method will be to extract data form a non-structured output from a network device and return the values in a table format. :param cls: Instance of t...
[ "Applies", "a", "TextFSM", "template", "over", "a", "raw", "text", "and", "return", "the", "matching", "table", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/helpers.py#L174-L225
[ "def", "textfsm_extractor", "(", "cls", ",", "template_name", ",", "raw_text", ")", ":", "textfsm_data", "=", "list", "(", ")", "fsm_handler", "=", "None", "for", "c", "in", "cls", ".", "__class__", ".", "mro", "(", ")", ":", "if", "c", "is", "object",...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
ip
Converts a raw string to a valid IP address. Optional version argument will detect that \ object matches specified version. Motivation: the groups of the IP addreses may contain leading zeros. IPv6 addresses can \ contain sometimes uppercase characters. E.g.: 2001:0dB8:85a3:0000:0000:8A2e:0370:7334 has \ ...
napalm/base/helpers.py
def ip(addr, version=None): """ Converts a raw string to a valid IP address. Optional version argument will detect that \ object matches specified version. Motivation: the groups of the IP addreses may contain leading zeros. IPv6 addresses can \ contain sometimes uppercase characters. E.g.: 2001:0d...
def ip(addr, version=None): """ Converts a raw string to a valid IP address. Optional version argument will detect that \ object matches specified version. Motivation: the groups of the IP addreses may contain leading zeros. IPv6 addresses can \ contain sometimes uppercase characters. E.g.: 2001:0d...
[ "Converts", "a", "raw", "string", "to", "a", "valid", "IP", "address", ".", "Optional", "version", "argument", "will", "detect", "that", "\\", "object", "matches", "specified", "version", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/helpers.py#L307-L333
[ "def", "ip", "(", "addr", ",", "version", "=", "None", ")", ":", "addr_obj", "=", "IPAddress", "(", "addr", ")", "if", "version", "and", "addr_obj", ".", "version", "!=", "version", ":", "raise", "ValueError", "(", "\"{} is not an ipv{} address\"", ".", "f...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
as_number
Convert AS Number to standardized asplain notation as an integer.
napalm/base/helpers.py
def as_number(as_number_val): """Convert AS Number to standardized asplain notation as an integer.""" as_number_str = py23_compat.text_type(as_number_val) if "." in as_number_str: big, little = as_number_str.split(".") return (int(big) << 16) + int(little) else: return int(as_num...
def as_number(as_number_val): """Convert AS Number to standardized asplain notation as an integer.""" as_number_str = py23_compat.text_type(as_number_val) if "." in as_number_str: big, little = as_number_str.split(".") return (int(big) << 16) + int(little) else: return int(as_num...
[ "Convert", "AS", "Number", "to", "standardized", "asplain", "notation", "as", "an", "integer", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/helpers.py#L336-L343
[ "def", "as_number", "(", "as_number_val", ")", ":", "as_number_str", "=", "py23_compat", ".", "text_type", "(", "as_number_val", ")", "if", "\".\"", "in", "as_number_str", ":", "big", ",", "little", "=", "as_number_str", ".", "split", "(", "\".\"", ")", "ret...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
split_interface
Split an interface name based on first digit, slash, or space match.
napalm/base/helpers.py
def split_interface(intf_name): """Split an interface name based on first digit, slash, or space match.""" head = intf_name.rstrip(r"/\0123456789. ") tail = intf_name[len(head) :].lstrip() return (head, tail)
def split_interface(intf_name): """Split an interface name based on first digit, slash, or space match.""" head = intf_name.rstrip(r"/\0123456789. ") tail = intf_name[len(head) :].lstrip() return (head, tail)
[ "Split", "an", "interface", "name", "based", "on", "first", "digit", "slash", "or", "space", "match", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/helpers.py#L346-L350
[ "def", "split_interface", "(", "intf_name", ")", ":", "head", "=", "intf_name", ".", "rstrip", "(", "r\"/\\0123456789. \"", ")", "tail", "=", "intf_name", "[", "len", "(", "head", ")", ":", "]", ".", "lstrip", "(", ")", "return", "(", "head", ",", "tai...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
canonical_interface_name
Function to return an interface's canonical name (fully expanded name). Use of explicit matches used to indicate a clear understanding on any potential match. Regex and other looser matching methods were not implmented to avoid false positive matches. As an example, it would make sense to do "[P|p][O|o]" w...
napalm/base/helpers.py
def canonical_interface_name(interface, addl_name_map=None): """Function to return an interface's canonical name (fully expanded name). Use of explicit matches used to indicate a clear understanding on any potential match. Regex and other looser matching methods were not implmented to avoid false posit...
def canonical_interface_name(interface, addl_name_map=None): """Function to return an interface's canonical name (fully expanded name). Use of explicit matches used to indicate a clear understanding on any potential match. Regex and other looser matching methods were not implmented to avoid false posit...
[ "Function", "to", "return", "an", "interface", "s", "canonical", "name", "(", "fully", "expanded", "name", ")", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/helpers.py#L353-L380
[ "def", "canonical_interface_name", "(", "interface", ",", "addl_name_map", "=", "None", ")", ":", "name_map", "=", "{", "}", "name_map", ".", "update", "(", "base_interfaces", ")", "interface_type", ",", "interface_number", "=", "split_interface", "(", "interface"...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
abbreviated_interface_name
Function to return an abbreviated representation of the interface name. :param interface: The interface you are attempting to abbreviate. :param addl_name_map (optional): A dict containing key/value pairs that updates the base mapping. Used if an OS has specific differences. e.g. {"Po": "PortChannel"} vs ...
napalm/base/helpers.py
def abbreviated_interface_name(interface, addl_name_map=None, addl_reverse_map=None): """Function to return an abbreviated representation of the interface name. :param interface: The interface you are attempting to abbreviate. :param addl_name_map (optional): A dict containing key/value pairs that updates ...
def abbreviated_interface_name(interface, addl_name_map=None, addl_reverse_map=None): """Function to return an abbreviated representation of the interface name. :param interface: The interface you are attempting to abbreviate. :param addl_name_map (optional): A dict containing key/value pairs that updates ...
[ "Function", "to", "return", "an", "abbreviated", "representation", "of", "the", "interface", "name", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/helpers.py#L383-L423
[ "def", "abbreviated_interface_name", "(", "interface", ",", "addl_name_map", "=", "None", ",", "addl_reverse_map", "=", "None", ")", ":", "name_map", "=", "{", "}", "name_map", ".", "update", "(", "base_interfaces", ")", "interface_type", ",", "interface_number", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.close
Close the connection to the device and do the necessary cleanup.
napalm/ios/ios.py
def close(self): """Close the connection to the device and do the necessary cleanup.""" # Return file prompt quiet to the original state if self.auto_file_prompt and self.prompt_quiet_changed is True: self.device.send_config_set(["no file prompt quiet"]) self.prompt_quie...
def close(self): """Close the connection to the device and do the necessary cleanup.""" # Return file prompt quiet to the original state if self.auto_file_prompt and self.prompt_quiet_changed is True: self.device.send_config_set(["no file prompt quiet"]) self.prompt_quie...
[ "Close", "the", "connection", "to", "the", "device", "and", "do", "the", "necessary", "cleanup", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L164-L172
[ "def", "close", "(", "self", ")", ":", "# Return file prompt quiet to the original state", "if", "self", ".", "auto_file_prompt", "and", "self", ".", "prompt_quiet_changed", "is", "True", ":", "self", ".", "device", ".", "send_config_set", "(", "[", "\"no file promp...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver._send_command
Wrapper for self.device.send.command(). If command is a list will iterate through commands until valid command.
napalm/ios/ios.py
def _send_command(self, command): """Wrapper for self.device.send.command(). If command is a list will iterate through commands until valid command. """ try: if isinstance(command, list): for cmd in command: output = self.device.send_comma...
def _send_command(self, command): """Wrapper for self.device.send.command(). If command is a list will iterate through commands until valid command. """ try: if isinstance(command, list): for cmd in command: output = self.device.send_comma...
[ "Wrapper", "for", "self", ".", "device", ".", "send", ".", "command", "()", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L174-L189
[ "def", "_send_command", "(", "self", ",", "command", ")", ":", "try", ":", "if", "isinstance", "(", "command", ",", "list", ")", ":", "for", "cmd", "in", "command", ":", "output", "=", "self", ".", "device", ".", "send_command", "(", "cmd", ")", "if"...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.is_alive
Returns a flag with the state of the connection.
napalm/ios/ios.py
def is_alive(self): """Returns a flag with the state of the connection.""" null = chr(0) if self.device is None: return {"is_alive": False} if self.transport == "telnet": try: # Try sending IAC + NOP (IAC is telnet way of sending command ...
def is_alive(self): """Returns a flag with the state of the connection.""" null = chr(0) if self.device is None: return {"is_alive": False} if self.transport == "telnet": try: # Try sending IAC + NOP (IAC is telnet way of sending command ...
[ "Returns", "a", "flag", "with", "the", "state", "of", "the", "connection", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L191-L216
[ "def", "is_alive", "(", "self", ")", ":", "null", "=", "chr", "(", "0", ")", "if", "self", ".", "device", "is", "None", ":", "return", "{", "\"is_alive\"", ":", "False", "}", "if", "self", ".", "transport", "==", "\"telnet\"", ":", "try", ":", "# T...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver._normalize_compare_config
Filter out strings that should not show up in the diff.
napalm/ios/ios.py
def _normalize_compare_config(self, diff): """Filter out strings that should not show up in the diff.""" ignore_strings = [ "Contextual Config Diffs", "No changes were found", "ntp clock-period", ] if self.auto_file_prompt: ignore_strings.a...
def _normalize_compare_config(self, diff): """Filter out strings that should not show up in the diff.""" ignore_strings = [ "Contextual Config Diffs", "No changes were found", "ntp clock-period", ] if self.auto_file_prompt: ignore_strings.a...
[ "Filter", "out", "strings", "that", "should", "not", "show", "up", "in", "the", "diff", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L306-L323
[ "def", "_normalize_compare_config", "(", "self", ",", "diff", ")", ":", "ignore_strings", "=", "[", "\"Contextual Config Diffs\"", ",", "\"No changes were found\"", ",", "\"ntp clock-period\"", ",", "]", "if", "self", ".", "auto_file_prompt", ":", "ignore_strings", "....
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver._normalize_merge_diff_incr
Make the compare config output look better. Cisco IOS incremental-diff output No changes: !List of Commands: end !No changes were found
napalm/ios/ios.py
def _normalize_merge_diff_incr(diff): """Make the compare config output look better. Cisco IOS incremental-diff output No changes: !List of Commands: end !No changes were found """ new_diff = [] changes_found = False for line in diff.spl...
def _normalize_merge_diff_incr(diff): """Make the compare config output look better. Cisco IOS incremental-diff output No changes: !List of Commands: end !No changes were found """ new_diff = [] changes_found = False for line in diff.spl...
[ "Make", "the", "compare", "config", "output", "look", "better", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L326-L359
[ "def", "_normalize_merge_diff_incr", "(", "diff", ")", ":", "new_diff", "=", "[", "]", "changes_found", "=", "False", "for", "line", "in", "diff", ".", "splitlines", "(", ")", ":", "if", "re", ".", "search", "(", "r\"order-dependent line.*re-ordered\"", ",", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver._normalize_merge_diff
Make compare_config() for merge look similar to replace config diff.
napalm/ios/ios.py
def _normalize_merge_diff(diff): """Make compare_config() for merge look similar to replace config diff.""" new_diff = [] for line in diff.splitlines(): # Filter blank lines and prepend +sign if line.strip(): new_diff.append("+" + line) if new_diff...
def _normalize_merge_diff(diff): """Make compare_config() for merge look similar to replace config diff.""" new_diff = [] for line in diff.splitlines(): # Filter blank lines and prepend +sign if line.strip(): new_diff.append("+" + line) if new_diff...
[ "Make", "compare_config", "()", "for", "merge", "look", "similar", "to", "replace", "config", "diff", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L362-L375
[ "def", "_normalize_merge_diff", "(", "diff", ")", ":", "new_diff", "=", "[", "]", "for", "line", "in", "diff", ".", "splitlines", "(", ")", ":", "# Filter blank lines and prepend +sign", "if", "line", ".", "strip", "(", ")", ":", "new_diff", ".", "append", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.compare_config
show archive config differences <base_file> <new_file>. Default operation is to compare system:running-config to self.candidate_cfg
napalm/ios/ios.py
def compare_config(self): """ show archive config differences <base_file> <new_file>. Default operation is to compare system:running-config to self.candidate_cfg """ # Set defaults base_file = "running-config" base_file_system = "system:" if self.config_r...
def compare_config(self): """ show archive config differences <base_file> <new_file>. Default operation is to compare system:running-config to self.candidate_cfg """ # Set defaults base_file = "running-config" base_file_system = "system:" if self.config_r...
[ "show", "archive", "config", "differences", "<base_file", ">", "<new_file", ">", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L377-L423
[ "def", "compare_config", "(", "self", ")", ":", "# Set defaults", "base_file", "=", "\"running-config\"", "base_file_system", "=", "\"system:\"", "if", "self", ".", "config_replace", ":", "new_file", "=", "self", ".", "candidate_cfg", "else", ":", "new_file", "=",...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver._file_prompt_quiet
Decorator to toggle 'file prompt quiet' for methods that perform file operations.
napalm/ios/ios.py
def _file_prompt_quiet(f): """Decorator to toggle 'file prompt quiet' for methods that perform file operations.""" @functools.wraps(f) def wrapper(self, *args, **kwargs): if not self.prompt_quiet_configured: if self.auto_file_prompt: # disable fil...
def _file_prompt_quiet(f): """Decorator to toggle 'file prompt quiet' for methods that perform file operations.""" @functools.wraps(f) def wrapper(self, *args, **kwargs): if not self.prompt_quiet_configured: if self.auto_file_prompt: # disable fil...
[ "Decorator", "to", "toggle", "file", "prompt", "quiet", "for", "methods", "that", "perform", "file", "operations", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L425-L453
[ "def", "_file_prompt_quiet", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "prompt_quiet_configured", ":", "if", "self"...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver._commit_handler
Special handler for hostname change on commit operation. Also handles username removal which prompts for confirmation (username removal prompts for each user...)
napalm/ios/ios.py
def _commit_handler(self, cmd): """ Special handler for hostname change on commit operation. Also handles username removal which prompts for confirmation (username removal prompts for each user...) """ current_prompt = self.device.find_prompt().strip() terminating_char = ...
def _commit_handler(self, cmd): """ Special handler for hostname change on commit operation. Also handles username removal which prompts for confirmation (username removal prompts for each user...) """ current_prompt = self.device.find_prompt().strip() terminating_char = ...
[ "Special", "handler", "for", "hostname", "change", "on", "commit", "operation", ".", "Also", "handles", "username", "removal", "which", "prompts", "for", "confirmation", "(", "username", "removal", "prompts", "for", "each", "user", "...", ")" ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L456-L482
[ "def", "_commit_handler", "(", "self", ",", "cmd", ")", ":", "current_prompt", "=", "self", ".", "device", ".", "find_prompt", "(", ")", ".", "strip", "(", ")", "terminating_char", "=", "current_prompt", "[", "-", "1", "]", "# Look for trailing pattern that in...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.commit_config
If replacement operation, perform 'configure replace' for the entire config. If merge operation, perform copy <file> running-config.
napalm/ios/ios.py
def commit_config(self, message=""): """ If replacement operation, perform 'configure replace' for the entire config. If merge operation, perform copy <file> running-config. """ if message: raise NotImplementedError( "Commit message not implemented fo...
def commit_config(self, message=""): """ If replacement operation, perform 'configure replace' for the entire config. If merge operation, perform copy <file> running-config. """ if message: raise NotImplementedError( "Commit message not implemented fo...
[ "If", "replacement", "operation", "perform", "configure", "replace", "for", "the", "entire", "config", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L484-L537
[ "def", "commit_config", "(", "self", ",", "message", "=", "\"\"", ")", ":", "if", "message", ":", "raise", "NotImplementedError", "(", "\"Commit message not implemented for this platform\"", ")", "# Always generate a rollback config on commit", "self", ".", "_gen_rollback_c...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver._discard_config
Set candidate_cfg to current running-config. Erase the merge_cfg file.
napalm/ios/ios.py
def _discard_config(self): """Set candidate_cfg to current running-config. Erase the merge_cfg file.""" discard_candidate = "copy running-config {}".format( self._gen_full_path(self.candidate_cfg) ) discard_merge = "copy null: {}".format(self._gen_full_path(self.merge_cfg)) ...
def _discard_config(self): """Set candidate_cfg to current running-config. Erase the merge_cfg file.""" discard_candidate = "copy running-config {}".format( self._gen_full_path(self.candidate_cfg) ) discard_merge = "copy null: {}".format(self._gen_full_path(self.merge_cfg)) ...
[ "Set", "candidate_cfg", "to", "current", "running", "-", "config", ".", "Erase", "the", "merge_cfg", "file", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L544-L551
[ "def", "_discard_config", "(", "self", ")", ":", "discard_candidate", "=", "\"copy running-config {}\"", ".", "format", "(", "self", ".", "_gen_full_path", "(", "self", ".", "candidate_cfg", ")", ")", "discard_merge", "=", "\"copy null: {}\"", ".", "format", "(", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.rollback
Rollback configuration to filename or to self.rollback_cfg file.
napalm/ios/ios.py
def rollback(self): """Rollback configuration to filename or to self.rollback_cfg file.""" filename = self.rollback_cfg cfg_file = self._gen_full_path(filename) if not self._check_file_exists(cfg_file): raise ReplaceConfigException("Rollback config file does not exist") ...
def rollback(self): """Rollback configuration to filename or to self.rollback_cfg file.""" filename = self.rollback_cfg cfg_file = self._gen_full_path(filename) if not self._check_file_exists(cfg_file): raise ReplaceConfigException("Rollback config file does not exist") ...
[ "Rollback", "configuration", "to", "filename", "or", "to", "self", ".", "rollback_cfg", "file", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L553-L566
[ "def", "rollback", "(", "self", ")", ":", "filename", "=", "self", ".", "rollback_cfg", "cfg_file", "=", "self", ".", "_gen_full_path", "(", "filename", ")", "if", "not", "self", ".", "_check_file_exists", "(", "cfg_file", ")", ":", "raise", "ReplaceConfigEx...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver._inline_tcl_xfer
Use Netmiko InlineFileTransfer (TCL) to transfer file or config to remote device. Return (status, msg) status = boolean msg = details on what happened
napalm/ios/ios.py
def _inline_tcl_xfer( self, source_file=None, source_config=None, dest_file=None, file_system=None ): """ Use Netmiko InlineFileTransfer (TCL) to transfer file or config to remote device. Return (status, msg) status = boolean msg = details on what happened ""...
def _inline_tcl_xfer( self, source_file=None, source_config=None, dest_file=None, file_system=None ): """ Use Netmiko InlineFileTransfer (TCL) to transfer file or config to remote device. Return (status, msg) status = boolean msg = details on what happened ""...
[ "Use", "Netmiko", "InlineFileTransfer", "(", "TCL", ")", "to", "transfer", "file", "or", "config", "to", "remote", "device", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L568-L592
[ "def", "_inline_tcl_xfer", "(", "self", ",", "source_file", "=", "None", ",", "source_config", "=", "None", ",", "dest_file", "=", "None", ",", "file_system", "=", "None", ")", ":", "if", "source_file", ":", "return", "self", ".", "_xfer_file", "(", "sourc...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver._scp_file
SCP file to remote device. Return (status, msg) status = boolean msg = details on what happened
napalm/ios/ios.py
def _scp_file(self, source_file, dest_file, file_system): """ SCP file to remote device. Return (status, msg) status = boolean msg = details on what happened """ return self._xfer_file( source_file=source_file, dest_file=dest_file, ...
def _scp_file(self, source_file, dest_file, file_system): """ SCP file to remote device. Return (status, msg) status = boolean msg = details on what happened """ return self._xfer_file( source_file=source_file, dest_file=dest_file, ...
[ "SCP", "file", "to", "remote", "device", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L594-L607
[ "def", "_scp_file", "(", "self", ",", "source_file", ",", "dest_file", ",", "file_system", ")", ":", "return", "self", ".", "_xfer_file", "(", "source_file", "=", "source_file", ",", "dest_file", "=", "dest_file", ",", "file_system", "=", "file_system", ",", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver._xfer_file
Transfer file to remote device. By default, this will use Secure Copy if self.inline_transfer is set, then will use Netmiko InlineTransfer method to transfer inline using either SSH or telnet (plus TCL onbox). Return (status, msg) status = boolean msg = details on what ...
napalm/ios/ios.py
def _xfer_file( self, source_file=None, source_config=None, dest_file=None, file_system=None, TransferClass=FileTransfer, ): """Transfer file to remote device. By default, this will use Secure Copy if self.inline_transfer is set, then will use ...
def _xfer_file( self, source_file=None, source_config=None, dest_file=None, file_system=None, TransferClass=FileTransfer, ): """Transfer file to remote device. By default, this will use Secure Copy if self.inline_transfer is set, then will use ...
[ "Transfer", "file", "to", "remote", "device", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L609-L683
[ "def", "_xfer_file", "(", "self", ",", "source_file", "=", "None", ",", "source_config", "=", "None", ",", "dest_file", "=", "None", ",", "file_system", "=", "None", ",", "TransferClass", "=", "FileTransfer", ",", ")", ":", "if", "not", "source_file", "and...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver._send_command_postprocess
Cleanup actions on send_command() for NAPALM getters. Remove "Load for five sec; one minute if in output" Remove "Time source is"
napalm/ios/ios.py
def _send_command_postprocess(output): """ Cleanup actions on send_command() for NAPALM getters. Remove "Load for five sec; one minute if in output" Remove "Time source is" """ output = re.sub(r"^Load for five secs.*$", "", output, flags=re.M) output = re.sub(r"^...
def _send_command_postprocess(output): """ Cleanup actions on send_command() for NAPALM getters. Remove "Load for five sec; one minute if in output" Remove "Time source is" """ output = re.sub(r"^Load for five secs.*$", "", output, flags=re.M) output = re.sub(r"^...
[ "Cleanup", "actions", "on", "send_command", "()", "for", "NAPALM", "getters", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L727-L736
[ "def", "_send_command_postprocess", "(", "output", ")", ":", "output", "=", "re", ".", "sub", "(", "r\"^Load for five secs.*$\"", ",", "\"\"", ",", "output", ",", "flags", "=", "re", ".", "M", ")", "output", "=", "re", ".", "sub", "(", "r\"^Time source is ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.get_interfaces_ip
Get interface ip details. Returns a dict of dicts Example Output: { u'FastEthernet8': { 'ipv4': { u'10.66.43.169': { 'prefix_length': 22}}}, u'Loopback555': { 'ipv4': { u'192.168.1.1': { 'prefix_length': 24}}, 'ipv6': { u'1::1': { ...
napalm/ios/ios.py
def get_interfaces_ip(self): """ Get interface ip details. Returns a dict of dicts Example Output: { u'FastEthernet8': { 'ipv4': { u'10.66.43.169': { 'prefix_length': 22}}}, u'Loopback555': { 'ipv4': { u'192.168.1.1': { 'prefix_length': 24}}, ...
def get_interfaces_ip(self): """ Get interface ip details. Returns a dict of dicts Example Output: { u'FastEthernet8': { 'ipv4': { u'10.66.43.169': { 'prefix_length': 22}}}, u'Loopback555': { 'ipv4': { u'192.168.1.1': { 'prefix_length': 24}}, ...
[ "Get", "interface", "ip", "details", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L1092-L1163
[ "def", "get_interfaces_ip", "(", "self", ")", ":", "interfaces", "=", "{", "}", "command", "=", "\"show ip interface\"", "show_ip_interface", "=", "self", ".", "_send_command", "(", "command", ")", "command", "=", "\"show ipv6 interface\"", "show_ipv6_interface", "=...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.get_bgp_config
Parse BGP config params into a dict :param group='': :param neighbor='':
napalm/ios/ios.py
def get_bgp_config(self, group="", neighbor=""): """ Parse BGP config params into a dict :param group='': :param neighbor='': """ bgp_config = {} def build_prefix_limit(af_table, limit, prefix_percent, prefix_timeout): prefix_limit = {} ...
def get_bgp_config(self, group="", neighbor=""): """ Parse BGP config params into a dict :param group='': :param neighbor='': """ bgp_config = {} def build_prefix_limit(af_table, limit, prefix_percent, prefix_timeout): prefix_limit = {} ...
[ "Parse", "BGP", "config", "params", "into", "a", "dict", ":", "param", "group", "=", ":", ":", "param", "neighbor", "=", ":" ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L1217-L1461
[ "def", "get_bgp_config", "(", "self", ",", "group", "=", "\"\"", ",", "neighbor", "=", "\"\"", ")", ":", "bgp_config", "=", "{", "}", "def", "build_prefix_limit", "(", "af_table", ",", "limit", ",", "prefix_percent", ",", "prefix_timeout", ")", ":", "prefi...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.get_bgp_neighbors
BGP neighbor information. Currently no VRF support. Supports both IPv4 and IPv6.
napalm/ios/ios.py
def get_bgp_neighbors(self): """BGP neighbor information. Currently no VRF support. Supports both IPv4 and IPv6. """ supported_afi = ["ipv4", "ipv6"] bgp_neighbor_data = dict() bgp_neighbor_data["global"] = {} # get summary output from device cmd_bgp_al...
def get_bgp_neighbors(self): """BGP neighbor information. Currently no VRF support. Supports both IPv4 and IPv6. """ supported_afi = ["ipv4", "ipv6"] bgp_neighbor_data = dict() bgp_neighbor_data["global"] = {} # get summary output from device cmd_bgp_al...
[ "BGP", "neighbor", "information", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L1463-L1817
[ "def", "get_bgp_neighbors", "(", "self", ")", ":", "supported_afi", "=", "[", "\"ipv4\"", ",", "\"ipv6\"", "]", "bgp_neighbor_data", "=", "dict", "(", ")", "bgp_neighbor_data", "[", "\"global\"", "]", "=", "{", "}", "# get summary output from device", "cmd_bgp_all...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.get_interfaces_counters
Return interface counters and errors. 'tx_errors': int, 'rx_errors': int, 'tx_discards': int, 'rx_discards': int, 'tx_octets': int, 'rx_octets': int, 'tx_unicast_packets': int, 'rx_unicast_packets': int, 'tx_multicast_packets': int, 'rx_mu...
napalm/ios/ios.py
def get_interfaces_counters(self): """ Return interface counters and errors. 'tx_errors': int, 'rx_errors': int, 'tx_discards': int, 'rx_discards': int, 'tx_octets': int, 'rx_octets': int, 'tx_unicast_packets': int, 'rx_unicast_packets': i...
def get_interfaces_counters(self): """ Return interface counters and errors. 'tx_errors': int, 'rx_errors': int, 'tx_discards': int, 'rx_discards': int, 'tx_octets': int, 'rx_octets': int, 'tx_unicast_packets': int, 'rx_unicast_packets': i...
[ "Return", "interface", "counters", "and", "errors", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L1962-L2070
[ "def", "get_interfaces_counters", "(", "self", ")", ":", "counters", "=", "{", "}", "command", "=", "\"show interfaces\"", "output", "=", "self", ".", "_send_command", "(", "command", ")", "sh_int_sum_cmd", "=", "\"show interface summary\"", "sh_int_sum_cmd_out", "=...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.get_environment
Get environment facts. power and fan are currently not implemented cpu is using 1-minute average cpu hard-coded to cpu0 (i.e. only a single CPU)
napalm/ios/ios.py
def get_environment(self): """ Get environment facts. power and fan are currently not implemented cpu is using 1-minute average cpu hard-coded to cpu0 (i.e. only a single CPU) """ environment = {} cpu_cmd = "show proc cpu" mem_cmd = "show memory s...
def get_environment(self): """ Get environment facts. power and fan are currently not implemented cpu is using 1-minute average cpu hard-coded to cpu0 (i.e. only a single CPU) """ environment = {} cpu_cmd = "show proc cpu" mem_cmd = "show memory s...
[ "Get", "environment", "facts", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L2072-L2147
[ "def", "get_environment", "(", "self", ")", ":", "environment", "=", "{", "}", "cpu_cmd", "=", "\"show proc cpu\"", "mem_cmd", "=", "\"show memory statistics\"", "temp_cmd", "=", "\"show env temperature status\"", "output", "=", "self", ".", "_send_command", "(", "c...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.get_ntp_peers
Implementation of get_ntp_peers for IOS.
napalm/ios/ios.py
def get_ntp_peers(self): """Implementation of get_ntp_peers for IOS.""" ntp_stats = self.get_ntp_stats() return { ntp_peer.get("remote"): {} for ntp_peer in ntp_stats if ntp_peer.get("remote") }
def get_ntp_peers(self): """Implementation of get_ntp_peers for IOS.""" ntp_stats = self.get_ntp_stats() return { ntp_peer.get("remote"): {} for ntp_peer in ntp_stats if ntp_peer.get("remote") }
[ "Implementation", "of", "get_ntp_peers", "for", "IOS", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L2246-L2254
[ "def", "get_ntp_peers", "(", "self", ")", ":", "ntp_stats", "=", "self", ".", "get_ntp_stats", "(", ")", "return", "{", "ntp_peer", ".", "get", "(", "\"remote\"", ")", ":", "{", "}", "for", "ntp_peer", "in", "ntp_stats", "if", "ntp_peer", ".", "get", "...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.get_ntp_servers
Implementation of get_ntp_servers for IOS. Returns the NTP servers configuration as dictionary. The keys of the dictionary represent the IP Addresses of the servers. Inner dictionaries do not have yet any available keys. Example:: { '192.168.0.1': {}, ...
napalm/ios/ios.py
def get_ntp_servers(self): """Implementation of get_ntp_servers for IOS. Returns the NTP servers configuration as dictionary. The keys of the dictionary represent the IP Addresses of the servers. Inner dictionaries do not have yet any available keys. Example:: { ...
def get_ntp_servers(self): """Implementation of get_ntp_servers for IOS. Returns the NTP servers configuration as dictionary. The keys of the dictionary represent the IP Addresses of the servers. Inner dictionaries do not have yet any available keys. Example:: { ...
[ "Implementation", "of", "get_ntp_servers", "for", "IOS", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L2256-L2281
[ "def", "get_ntp_servers", "(", "self", ")", ":", "ntp_servers", "=", "{", "}", "command", "=", "\"show run | include ntp server\"", "output", "=", "self", ".", "_send_command", "(", "command", ")", "for", "line", "in", "output", ".", "splitlines", "(", ")", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.get_ntp_stats
Implementation of get_ntp_stats for IOS.
napalm/ios/ios.py
def get_ntp_stats(self): """Implementation of get_ntp_stats for IOS.""" ntp_stats = [] command = "show ntp associations" output = self._send_command(command) for line in output.splitlines(): # Skip first two lines and last line of command output if line ...
def get_ntp_stats(self): """Implementation of get_ntp_stats for IOS.""" ntp_stats = [] command = "show ntp associations" output = self._send_command(command) for line in output.splitlines(): # Skip first two lines and last line of command output if line ...
[ "Implementation", "of", "get_ntp_stats", "for", "IOS", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L2283-L2322
[ "def", "get_ntp_stats", "(", "self", ")", ":", "ntp_stats", "=", "[", "]", "command", "=", "\"show ntp associations\"", "output", "=", "self", ".", "_send_command", "(", "command", ")", "for", "line", "in", "output", ".", "splitlines", "(", ")", ":", "# Sk...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.get_mac_address_table
Returns a lists of dictionaries. Each dictionary represents an entry in the MAC Address Table, having the following keys * mac (string) * interface (string) * vlan (int) * active (boolean) * static (boolean) * moves (int) * last...
napalm/ios/ios.py
def get_mac_address_table(self): """ Returns a lists of dictionaries. Each dictionary represents an entry in the MAC Address Table, having the following keys * mac (string) * interface (string) * vlan (int) * active (boolean) * static (...
def get_mac_address_table(self): """ Returns a lists of dictionaries. Each dictionary represents an entry in the MAC Address Table, having the following keys * mac (string) * interface (string) * vlan (int) * active (boolean) * static (...
[ "Returns", "a", "lists", "of", "dictionaries", ".", "Each", "dictionary", "represents", "an", "entry", "in", "the", "MAC", "Address", "Table", "having", "the", "following", "keys", "*", "mac", "(", "string", ")", "*", "interface", "(", "string", ")", "*", ...
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L2324-L2559
[ "def", "get_mac_address_table", "(", "self", ")", ":", "RE_MACTABLE_DEFAULT", "=", "r\"^\"", "+", "MAC_REGEX", "RE_MACTABLE_6500_1", "=", "r\"^\\*\\s+{}\\s+{}\\s+\"", ".", "format", "(", "VLAN_REGEX", ",", "MAC_REGEX", ")", "# 7 fields", "RE_MACTABLE_6500_2", "=", "r\...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.get_snmp_information
Returns a dict of dicts Example Output: { 'chassis_id': u'Asset Tag 54670', 'community': { u'private': { 'acl': u'12', 'mode': u'rw'}, u'public': { 'acl': u'11', 'mode': u'ro'}, u'public_named_acl': { 'acl': u'ALLOW-SNMP-ACL', ...
napalm/ios/ios.py
def get_snmp_information(self): """ Returns a dict of dicts Example Output: { 'chassis_id': u'Asset Tag 54670', 'community': { u'private': { 'acl': u'12', 'mode': u'rw'}, u'public': { 'acl': u'11', 'mode': u'ro'}, u'publ...
def get_snmp_information(self): """ Returns a dict of dicts Example Output: { 'chassis_id': u'Asset Tag 54670', 'community': { u'private': { 'acl': u'12', 'mode': u'rw'}, u'public': { 'acl': u'11', 'mode': u'ro'}, u'publ...
[ "Returns", "a", "dict", "of", "dicts" ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L2597-L2648
[ "def", "get_snmp_information", "(", "self", ")", ":", "# default values", "snmp_dict", "=", "{", "\"chassis_id\"", ":", "\"unknown\"", ",", "\"community\"", ":", "{", "}", ",", "\"contact\"", ":", "\"unknown\"", ",", "\"location\"", ":", "\"unknown\"", ",", "}",...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.get_users
Returns a dictionary with the configured users. The keys of the main dictionary represents the username. The values represent the details of the user, represented by the following keys: * level (int) * password (str) * sshkeys (list) *Note: sshkeys o...
napalm/ios/ios.py
def get_users(self): """ Returns a dictionary with the configured users. The keys of the main dictionary represents the username. The values represent the details of the user, represented by the following keys: * level (int) * password (str) *...
def get_users(self): """ Returns a dictionary with the configured users. The keys of the main dictionary represents the username. The values represent the details of the user, represented by the following keys: * level (int) * password (str) *...
[ "Returns", "a", "dictionary", "with", "the", "configured", "users", ".", "The", "keys", "of", "the", "main", "dictionary", "represents", "the", "username", ".", "The", "values", "represent", "the", "details", "of", "the", "user", "represented", "by", "the", ...
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L2650-L2696
[ "def", "get_users", "(", "self", ")", ":", "username_regex", "=", "(", "r\"^username\\s+(?P<username>\\S+)\\s+(?:privilege\\s+(?P<priv_level>\\S+)\"", "r\"\\s+)?(?:secret \\d+\\s+(?P<pwd_hash>\\S+))?$\"", ")", "pub_keychain_regex", "=", "(", "r\"^\\s+username\\s+(?P<username>\\S+)(?P<k...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.ping
Execute ping on the device and returns a dictionary with the result. Output dictionary has one of following keys: * success * error In case of success, inner dictionary will have the followin keys: * probes_sent (int) * packet_loss (int) * rtt...
napalm/ios/ios.py
def ping( self, destination, source=C.PING_SOURCE, ttl=C.PING_TTL, timeout=C.PING_TIMEOUT, size=C.PING_SIZE, count=C.PING_COUNT, vrf=C.PING_VRF, ): """ Execute ping on the device and returns a dictionary with the result. Output...
def ping( self, destination, source=C.PING_SOURCE, ttl=C.PING_TTL, timeout=C.PING_TIMEOUT, size=C.PING_SIZE, count=C.PING_COUNT, vrf=C.PING_VRF, ): """ Execute ping on the device and returns a dictionary with the result. Output...
[ "Execute", "ping", "on", "the", "device", "and", "returns", "a", "dictionary", "with", "the", "result", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L2698-L2781
[ "def", "ping", "(", "self", ",", "destination", ",", "source", "=", "C", ".", "PING_SOURCE", ",", "ttl", "=", "C", ".", "PING_TTL", ",", "timeout", "=", "C", ".", "PING_TIMEOUT", ",", "size", "=", "C", ".", "PING_SIZE", ",", "count", "=", "C", ".",...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSDriver.get_ipv6_neighbors_table
Get IPv6 neighbors table information. Return a list of dictionaries having the following set of keys: * interface (string) * mac (string) * ip (string) * age (float) in seconds * state (string) For example:: [ { ...
napalm/ios/ios.py
def get_ipv6_neighbors_table(self): """ Get IPv6 neighbors table information. Return a list of dictionaries having the following set of keys: * interface (string) * mac (string) * ip (string) * age (float) in seconds * state (string) ...
def get_ipv6_neighbors_table(self): """ Get IPv6 neighbors table information. Return a list of dictionaries having the following set of keys: * interface (string) * mac (string) * ip (string) * age (float) in seconds * state (string) ...
[ "Get", "IPv6", "neighbors", "table", "information", ".", "Return", "a", "list", "of", "dictionaries", "having", "the", "following", "set", "of", "keys", ":", "*", "interface", "(", "string", ")", "*", "mac", "(", "string", ")", "*", "ip", "(", "string", ...
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/ios/ios.py#L2984-L3035
[ "def", "get_ipv6_neighbors_table", "(", "self", ")", ":", "ipv6_neighbors_table", "=", "[", "]", "command", "=", "\"show ipv6 neighbors\"", "output", "=", "self", ".", "_send_command", "(", "command", ")", "ipv6_neighbors", "=", "\"\"", "fields", "=", "re", ".",...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
EOSDriver.open
Implementation of NAPALM method open.
napalm/eos/eos.py
def open(self): """Implementation of NAPALM method open.""" try: connection = self.transport_class( host=self.hostname, username=self.username, password=self.password, timeout=self.timeout, **self.eapi_kwargs ...
def open(self): """Implementation of NAPALM method open.""" try: connection = self.transport_class( host=self.hostname, username=self.username, password=self.password, timeout=self.timeout, **self.eapi_kwargs ...
[ "Implementation", "of", "NAPALM", "method", "open", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/eos/eos.py#L126-L147
[ "def", "open", "(", "self", ")", ":", "try", ":", "connection", "=", "self", ".", "transport_class", "(", "host", "=", "self", ".", "hostname", ",", "username", "=", "self", ".", "username", ",", "password", "=", "self", ".", "password", ",", "timeout"...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
EOSDriver._multiline_convert
Converts running-config HEREDOC into EAPI JSON dict
napalm/eos/eos.py
def _multiline_convert(config, start="banner login", end="EOF", depth=1): """Converts running-config HEREDOC into EAPI JSON dict""" ret = list(config) # Don't modify list in-place try: s = ret.index(start) e = s while depth: e = ret.index(end,...
def _multiline_convert(config, start="banner login", end="EOF", depth=1): """Converts running-config HEREDOC into EAPI JSON dict""" ret = list(config) # Don't modify list in-place try: s = ret.index(start) e = s while depth: e = ret.index(end,...
[ "Converts", "running", "-", "config", "HEREDOC", "into", "EAPI", "JSON", "dict" ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/eos/eos.py#L168-L182
[ "def", "_multiline_convert", "(", "config", ",", "start", "=", "\"banner login\"", ",", "end", "=", "\"EOF\"", ",", "depth", "=", "1", ")", ":", "ret", "=", "list", "(", "config", ")", "# Don't modify list in-place", "try", ":", "s", "=", "ret", ".", "in...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
EOSDriver._mode_comment_convert
EOS has the concept of multi-line mode comments, shown in the running-config as being inside a config stanza (router bgp, ACL definition, etc) and beginning with the normal level of spaces and '!!', followed by comments. Unfortunately, pyeapi does not accept mode comments in this format, and ha...
napalm/eos/eos.py
def _mode_comment_convert(commands): """ EOS has the concept of multi-line mode comments, shown in the running-config as being inside a config stanza (router bgp, ACL definition, etc) and beginning with the normal level of spaces and '!!', followed by comments. Unfortunately, py...
def _mode_comment_convert(commands): """ EOS has the concept of multi-line mode comments, shown in the running-config as being inside a config stanza (router bgp, ACL definition, etc) and beginning with the normal level of spaces and '!!', followed by comments. Unfortunately, py...
[ "EOS", "has", "the", "concept", "of", "multi", "-", "line", "mode", "comments", "shown", "in", "the", "running", "-", "config", "as", "being", "inside", "a", "config", "stanza", "(", "router", "bgp", "ACL", "definition", "etc", ")", "and", "beginning", "...
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/eos/eos.py#L185-L227
[ "def", "_mode_comment_convert", "(", "commands", ")", ":", "ret", "=", "[", "]", "comment_count", "=", "0", "for", "idx", ",", "element", "in", "enumerate", "(", "commands", ")", ":", "# Check first for stringiness, as we may have dicts in the command list already", "...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
EOSDriver.commit_config
Implementation of NAPALM method commit_config.
napalm/eos/eos.py
def commit_config(self, message=""): """Implementation of NAPALM method commit_config.""" if message: raise NotImplementedError( "Commit message not implemented for this platform" ) commands = [ "copy startup-config flash:rollback-0", ...
def commit_config(self, message=""): """Implementation of NAPALM method commit_config.""" if message: raise NotImplementedError( "Commit message not implemented for this platform" ) commands = [ "copy startup-config flash:rollback-0", ...
[ "Implementation", "of", "NAPALM", "method", "commit_config", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/eos/eos.py#L294-L308
[ "def", "commit_config", "(", "self", ",", "message", "=", "\"\"", ")", ":", "if", "message", ":", "raise", "NotImplementedError", "(", "\"Commit message not implemented for this platform\"", ")", "commands", "=", "[", "\"copy startup-config flash:rollback-0\"", ",", "\"...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
EOSDriver.get_bgp_config
Implementation of NAPALM method get_bgp_config.
napalm/eos/eos.py
def get_bgp_config(self, group="", neighbor=""): """Implementation of NAPALM method get_bgp_config.""" _GROUP_FIELD_MAP_ = { "type": "type", "multipath": "multipath", "apply-groups": "apply_groups", "remove-private-as": "remove_private_as", "eb...
def get_bgp_config(self, group="", neighbor=""): """Implementation of NAPALM method get_bgp_config.""" _GROUP_FIELD_MAP_ = { "type": "type", "multipath": "multipath", "apply-groups": "apply_groups", "remove-private-as": "remove_private_as", "eb...
[ "Implementation", "of", "NAPALM", "method", "get_bgp_config", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/eos/eos.py#L705-L912
[ "def", "get_bgp_config", "(", "self", ",", "group", "=", "\"\"", ",", "neighbor", "=", "\"\"", ")", ":", "_GROUP_FIELD_MAP_", "=", "{", "\"type\"", ":", "\"type\"", ",", "\"multipath\"", ":", "\"multipath\"", ",", "\"apply-groups\"", ":", "\"apply_groups\"", "...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
EOSDriver.get_network_instances
get_network_instances implementation for EOS.
napalm/eos/eos.py
def get_network_instances(self, name=""): """get_network_instances implementation for EOS.""" output = self._show_vrf() vrfs = {} all_vrf_interfaces = {} for vrf in output: if ( vrf.get("route_distinguisher", "") == "<not set>" or vrf....
def get_network_instances(self, name=""): """get_network_instances implementation for EOS.""" output = self._show_vrf() vrfs = {} all_vrf_interfaces = {} for vrf in output: if ( vrf.get("route_distinguisher", "") == "<not set>" or vrf....
[ "get_network_instances", "implementation", "for", "EOS", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/eos/eos.py#L1770-L1817
[ "def", "get_network_instances", "(", "self", ",", "name", "=", "\"\"", ")", ":", "output", "=", "self", ".", "_show_vrf", "(", ")", "vrfs", "=", "{", "}", "all_vrf_interfaces", "=", "{", "}", "for", "vrf", "in", "output", ":", "if", "(", "vrf", ".", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
EOSDriver.ping
Execute ping on the device and returns a dictionary with the result. Output dictionary has one of following keys: * success * error In case of success, inner dictionary will have the followin keys: * probes_sent (int) * packet_loss (int) * rtt_...
napalm/eos/eos.py
def ping( self, destination, source=c.PING_SOURCE, ttl=c.PING_TTL, timeout=c.PING_TIMEOUT, size=c.PING_SIZE, count=c.PING_COUNT, vrf=c.PING_VRF, ): """ Execute ping on the device and returns a dictionary with the result. Output ...
def ping( self, destination, source=c.PING_SOURCE, ttl=c.PING_TTL, timeout=c.PING_TIMEOUT, size=c.PING_SIZE, count=c.PING_COUNT, vrf=c.PING_VRF, ): """ Execute ping on the device and returns a dictionary with the result. Output ...
[ "Execute", "ping", "on", "the", "device", "and", "returns", "a", "dictionary", "with", "the", "result", ".", "Output", "dictionary", "has", "one", "of", "following", "keys", ":", "*", "success", "*", "error", "In", "case", "of", "success", "inner", "dictio...
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/eos/eos.py#L1819-L1936
[ "def", "ping", "(", "self", ",", "destination", ",", "source", "=", "c", ".", "PING_SOURCE", ",", "ttl", "=", "c", ".", "PING_TTL", ",", "timeout", "=", "c", ".", "PING_TIMEOUT", ",", "size", "=", "c", ".", "PING_SIZE", ",", "count", "=", "c", ".",...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
empty_tree
Recursively iterate through values in nested lists.
napalm/base/validate.py
def empty_tree(input_list): """Recursively iterate through values in nested lists.""" for item in input_list: if not isinstance(item, list) or not empty_tree(item): return False return True
def empty_tree(input_list): """Recursively iterate through values in nested lists.""" for item in input_list: if not isinstance(item, list) or not empty_tree(item): return False return True
[ "Recursively", "iterate", "through", "values", "in", "nested", "lists", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/validate.py#L178-L183
[ "def", "empty_tree", "(", "input_list", ")", ":", "for", "item", "in", "input_list", ":", "if", "not", "isinstance", "(", "item", ",", "list", ")", "or", "not", "empty_tree", "(", "item", ")", ":", "return", "False", "return", "True" ]
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
build_napalm_ansible_module_docs
Create documentation for Ansible modules.
docs/conf.py
def build_napalm_ansible_module_docs(app): """Create documentation for Ansible modules.""" # Add script to clone napalm-ansible repo status = subprocess.call( "./build-ansible-module-docs.sh", stdout=sys.stdout, stderr=sys.stderr ) if status != 0: print("Something bad happened when...
def build_napalm_ansible_module_docs(app): """Create documentation for Ansible modules.""" # Add script to clone napalm-ansible repo status = subprocess.call( "./build-ansible-module-docs.sh", stdout=sys.stdout, stderr=sys.stderr ) if status != 0: print("Something bad happened when...
[ "Create", "documentation", "for", "Ansible", "modules", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/docs/conf.py#L319-L352
[ "def", "build_napalm_ansible_module_docs", "(", "app", ")", ":", "# Add script to clone napalm-ansible repo", "status", "=", "subprocess", ".", "call", "(", "\"./build-ansible-module-docs.sh\"", ",", "stdout", "=", "sys", ".", "stdout", ",", "stderr", "=", "sys", ".",...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
build_getters_support_matrix
Build the getters support matrix.
docs/conf.py
def build_getters_support_matrix(app): """Build the getters support matrix.""" status = subprocess.call("./test.sh", stdout=sys.stdout, stderr=sys.stderr) if status != 0: print("Something bad happened when processing the test reports.") sys.exit(-1) drivers = set() matrix = { ...
def build_getters_support_matrix(app): """Build the getters support matrix.""" status = subprocess.call("./test.sh", stdout=sys.stdout, stderr=sys.stderr) if status != 0: print("Something bad happened when processing the test reports.") sys.exit(-1) drivers = set() matrix = { ...
[ "Build", "the", "getters", "support", "matrix", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/docs/conf.py#L355-L402
[ "def", "build_getters_support_matrix", "(", "app", ")", ":", "status", "=", "subprocess", ".", "call", "(", "\"./test.sh\"", ",", "stdout", "=", "sys", ".", "stdout", ",", "stderr", "=", "sys", ".", "stderr", ")", "if", "status", "!=", "0", ":", "print",...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
IOSXRDriver.get_bgp_neighbors
Initial run to figure out what VRF's are available Decided to get this one from Configured-section because bulk-getting all instance-data to do the same could get ridiculously heavy Assuming we're always interested in the DefaultVRF
napalm/iosxr/iosxr.py
def get_bgp_neighbors(self): def generate_vrf_query(vrf_name): """ Helper to provide XML-query for the VRF-type we're interested in. """ if vrf_name == "global": rpc_command = "<Get><Operational><BGP><InstanceTable><Instance><Naming>\ ...
def get_bgp_neighbors(self): def generate_vrf_query(vrf_name): """ Helper to provide XML-query for the VRF-type we're interested in. """ if vrf_name == "global": rpc_command = "<Get><Operational><BGP><InstanceTable><Instance><Naming>\ ...
[ "Initial", "run", "to", "figure", "out", "what", "VRF", "s", "are", "available", "Decided", "to", "get", "this", "one", "from", "Configured", "-", "section", "because", "bulk", "-", "getting", "all", "instance", "-", "data", "to", "do", "the", "same", "c...
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/iosxr/iosxr.py#L362-L562
[ "def", "get_bgp_neighbors", "(", "self", ")", ":", "def", "generate_vrf_query", "(", "vrf_name", ")", ":", "\"\"\"\n Helper to provide XML-query for the VRF-type we're interested in.\n \"\"\"", "if", "vrf_name", "==", "\"global\"", ":", "rpc_command", "=",...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
netmiko_args
Check for Netmiko arguments that were passed in as NAPALM optional arguments. Return a dictionary of these optional args that will be passed into the Netmiko ConnectHandler call.
napalm/base/netmiko_helpers.py
def netmiko_args(optional_args): """Check for Netmiko arguments that were passed in as NAPALM optional arguments. Return a dictionary of these optional args that will be passed into the Netmiko ConnectHandler call. """ fields = py23_compat.argspec(BaseConnection.__init__) args = fields[0] ...
def netmiko_args(optional_args): """Check for Netmiko arguments that were passed in as NAPALM optional arguments. Return a dictionary of these optional args that will be passed into the Netmiko ConnectHandler call. """ fields = py23_compat.argspec(BaseConnection.__init__) args = fields[0] ...
[ "Check", "for", "Netmiko", "arguments", "that", "were", "passed", "in", "as", "NAPALM", "optional", "arguments", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/netmiko_helpers.py#L17-L49
[ "def", "netmiko_args", "(", "optional_args", ")", ":", "fields", "=", "py23_compat", ".", "argspec", "(", "BaseConnection", ".", "__init__", ")", "args", "=", "fields", "[", "0", "]", "defaults", "=", "fields", "[", "3", "]", "check_self", "=", "args", "...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
ensure_netmiko_conn
Decorator that ensures Netmiko connection exists.
napalm/nxos/nxos.py
def ensure_netmiko_conn(func): """Decorator that ensures Netmiko connection exists.""" def wrap_function(self, filename=None, config=None): try: netmiko_object = self._netmiko_device if netmiko_object is None: raise AttributeError() except AttributeError:...
def ensure_netmiko_conn(func): """Decorator that ensures Netmiko connection exists.""" def wrap_function(self, filename=None, config=None): try: netmiko_object = self._netmiko_device if netmiko_object is None: raise AttributeError() except AttributeError:...
[ "Decorator", "that", "ensures", "Netmiko", "connection", "exists", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/nxos/nxos.py#L47-L65
[ "def", "ensure_netmiko_conn", "(", "func", ")", ":", "def", "wrap_function", "(", "self", ",", "filename", "=", "None", ",", "config", "=", "None", ")", ":", "try", ":", "netmiko_object", "=", "self", ".", "_netmiko_device", "if", "netmiko_object", "is", "...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
NXOSDriverBase._get_merge_diff
The merge diff is not necessarily what needs to be loaded for example under NTP, even though the 'ntp commit' command might be alread configured, it is mandatory to be sent otherwise it won't take the new configuration - see: https://github.com/napalm-automation/napalm-nxos/issues/59 ...
napalm/nxos/nxos.py
def _get_merge_diff(self): """ The merge diff is not necessarily what needs to be loaded for example under NTP, even though the 'ntp commit' command might be alread configured, it is mandatory to be sent otherwise it won't take the new configuration - see: https://github....
def _get_merge_diff(self): """ The merge diff is not necessarily what needs to be loaded for example under NTP, even though the 'ntp commit' command might be alread configured, it is mandatory to be sent otherwise it won't take the new configuration - see: https://github....
[ "The", "merge", "diff", "is", "not", "necessarily", "what", "needs", "to", "be", "loaded", "for", "example", "under", "NTP", "even", "though", "the", "ntp", "commit", "command", "might", "be", "alread", "configured", "it", "is", "mandatory", "to", "be", "s...
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/nxos/nxos.py#L157-L174
[ "def", "_get_merge_diff", "(", "self", ")", ":", "diff", "=", "[", "]", "running_config", "=", "self", ".", "get_config", "(", "retrieve", "=", "\"running\"", ")", "[", "\"running\"", "]", "running_lines", "=", "running_config", ".", "splitlines", "(", ")", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
NXOSDriverBase._get_diff
Get a diff between running config and a proposed file.
napalm/nxos/nxos.py
def _get_diff(self): """Get a diff between running config and a proposed file.""" diff = [] self._create_sot_file() diff_out = self._send_command( "show diff rollback-patch file {} file {}".format( "sot_file", self.candidate_cfg ), raw_...
def _get_diff(self): """Get a diff between running config and a proposed file.""" diff = [] self._create_sot_file() diff_out = self._send_command( "show diff rollback-patch file {} file {}".format( "sot_file", self.candidate_cfg ), raw_...
[ "Get", "a", "diff", "between", "running", "config", "and", "a", "proposed", "file", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/nxos/nxos.py#L176-L200
[ "def", "_get_diff", "(", "self", ")", ":", "diff", "=", "[", "]", "self", ".", "_create_sot_file", "(", ")", "diff_out", "=", "self", ".", "_send_command", "(", "\"show diff rollback-patch file {} file {}\"", ".", "format", "(", "\"sot_file\"", ",", "self", "....
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
NXOSDriverBase._create_sot_file
Create Source of Truth file to compare.
napalm/nxos/nxos.py
def _create_sot_file(self): """Create Source of Truth file to compare.""" # Bug on on NX-OS 6.2.16 where overwriting sot_file would take exceptionally long time # (over 12 minutes); so just delete the sot_file try: self._delete_file(filename="sot_file") except Except...
def _create_sot_file(self): """Create Source of Truth file to compare.""" # Bug on on NX-OS 6.2.16 where overwriting sot_file would take exceptionally long time # (over 12 minutes); so just delete the sot_file try: self._delete_file(filename="sot_file") except Except...
[ "Create", "Source", "of", "Truth", "file", "to", "compare", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/nxos/nxos.py#L237-L251
[ "def", "_create_sot_file", "(", "self", ")", ":", "# Bug on on NX-OS 6.2.16 where overwriting sot_file would take exceptionally long time", "# (over 12 minutes); so just delete the sot_file", "try", ":", "self", ".", "_delete_file", "(", "filename", "=", "\"sot_file\"", ")", "exc...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
NXOSDriverBase.ping
Execute ping on the device and returns a dictionary with the result. Output dictionary has one of following keys: * success * error In case of success, inner dictionary will have the followin keys: * probes_sent (int) * packet_loss (int) * rtt_...
napalm/nxos/nxos.py
def ping( self, destination, source=c.PING_SOURCE, ttl=c.PING_TTL, timeout=c.PING_TIMEOUT, size=c.PING_SIZE, count=c.PING_COUNT, vrf=c.PING_VRF, ): """ Execute ping on the device and returns a dictionary with the result. Output ...
def ping( self, destination, source=c.PING_SOURCE, ttl=c.PING_TTL, timeout=c.PING_TIMEOUT, size=c.PING_SIZE, count=c.PING_COUNT, vrf=c.PING_VRF, ): """ Execute ping on the device and returns a dictionary with the result. Output ...
[ "Execute", "ping", "on", "the", "device", "and", "returns", "a", "dictionary", "with", "the", "result", ".", "Output", "dictionary", "has", "one", "of", "following", "keys", ":", "*", "success", "*", "error", "In", "case", "of", "success", "inner", "dictio...
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/nxos/nxos.py#L253-L378
[ "def", "ping", "(", "self", ",", "destination", ",", "source", "=", "c", ".", "PING_SOURCE", ",", "ttl", "=", "c", ".", "PING_TTL", ",", "timeout", "=", "c", ".", "PING_TIMEOUT", ",", "size", "=", "c", ".", "PING_SIZE", ",", "count", "=", "c", ".",...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
NXOSDriverBase.get_lldp_neighbors
IOS implementation of get_lldp_neighbors.
napalm/nxos/nxos.py
def get_lldp_neighbors(self): """IOS implementation of get_lldp_neighbors.""" lldp = {} neighbors_detail = self.get_lldp_neighbors_detail() for intf_name, entries in neighbors_detail.items(): lldp[intf_name] = [] for lldp_entry in entries: hostname...
def get_lldp_neighbors(self): """IOS implementation of get_lldp_neighbors.""" lldp = {} neighbors_detail = self.get_lldp_neighbors_detail() for intf_name, entries in neighbors_detail.items(): lldp[intf_name] = [] for lldp_entry in entries: hostname...
[ "IOS", "implementation", "of", "get_lldp_neighbors", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/nxos/nxos.py#L536-L551
[ "def", "get_lldp_neighbors", "(", "self", ")", ":", "lldp", "=", "{", "}", "neighbors_detail", "=", "self", ".", "get_lldp_neighbors_detail", "(", ")", "for", "intf_name", ",", "entries", "in", "neighbors_detail", ".", "items", "(", ")", ":", "lldp", "[", ...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
NXOSDriver._send_command
Wrapper for NX-API show method. Allows more code sharing between NX-API and SSH.
napalm/nxos/nxos.py
def _send_command(self, command, raw_text=False): """ Wrapper for NX-API show method. Allows more code sharing between NX-API and SSH. """ return self.device.show(command, raw_text=raw_text)
def _send_command(self, command, raw_text=False): """ Wrapper for NX-API show method. Allows more code sharing between NX-API and SSH. """ return self.device.show(command, raw_text=raw_text)
[ "Wrapper", "for", "NX", "-", "API", "show", "method", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/nxos/nxos.py#L637-L643
[ "def", "_send_command", "(", "self", ",", "command", ",", "raw_text", "=", "False", ")", ":", "return", "self", ".", "device", ".", "show", "(", "command", ",", "raw_text", "=", "raw_text", ")" ]
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
NXOSDriver._compute_timestamp
Some fields such `uptime` are returned as: 23week(s) 3day(s) This method will determine the epoch of the event. e.g.: 23week(s) 3day(s) -> 1462248287
napalm/nxos/nxos.py
def _compute_timestamp(stupid_cisco_output): """ Some fields such `uptime` are returned as: 23week(s) 3day(s) This method will determine the epoch of the event. e.g.: 23week(s) 3day(s) -> 1462248287 """ if not stupid_cisco_output or stupid_cisco_output == "never": ...
def _compute_timestamp(stupid_cisco_output): """ Some fields such `uptime` are returned as: 23week(s) 3day(s) This method will determine the epoch of the event. e.g.: 23week(s) 3day(s) -> 1462248287 """ if not stupid_cisco_output or stupid_cisco_output == "never": ...
[ "Some", "fields", "such", "uptime", "are", "returned", "as", ":", "23week", "(", "s", ")", "3day", "(", "s", ")", "This", "method", "will", "determine", "the", "epoch", "of", "the", "event", ".", "e", ".", "g", ".", ":", "23week", "(", "s", ")", ...
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/nxos/nxos.py#L655-L694
[ "def", "_compute_timestamp", "(", "stupid_cisco_output", ")", ":", "if", "not", "stupid_cisco_output", "or", "stupid_cisco_output", "==", "\"never\"", ":", "return", "-", "1.0", "if", "\"(s)\"", "in", "stupid_cisco_output", ":", "pass", "elif", "\":\"", "in", "stu...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
NXOSDriver._get_table_rows
Inconsistent behavior: {'TABLE_intf': [{'ROW_intf': { vs {'TABLE_mac_address': {'ROW_mac_address': [{ vs {'TABLE_vrf': {'ROW_vrf': {'TABLE_adj': {'ROW_adj': {
napalm/nxos/nxos.py
def _get_table_rows(parent_table, table_name, row_name): """ Inconsistent behavior: {'TABLE_intf': [{'ROW_intf': { vs {'TABLE_mac_address': {'ROW_mac_address': [{ vs {'TABLE_vrf': {'ROW_vrf': {'TABLE_adj': {'ROW_adj': { """ if parent_table is None:...
def _get_table_rows(parent_table, table_name, row_name): """ Inconsistent behavior: {'TABLE_intf': [{'ROW_intf': { vs {'TABLE_mac_address': {'ROW_mac_address': [{ vs {'TABLE_vrf': {'ROW_vrf': {'TABLE_adj': {'ROW_adj': { """ if parent_table is None:...
[ "Inconsistent", "behavior", ":", "{", "TABLE_intf", ":", "[", "{", "ROW_intf", ":", "{", "vs", "{", "TABLE_mac_address", ":", "{", "ROW_mac_address", ":", "[", "{", "vs", "{", "TABLE_vrf", ":", "{", "ROW_vrf", ":", "{", "TABLE_adj", ":", "{", "ROW_adj", ...
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/nxos/nxos.py#L697-L716
[ "def", "_get_table_rows", "(", "parent_table", ",", "table_name", ",", "row_name", ")", ":", "if", "parent_table", "is", "None", ":", "return", "[", "]", "_table", "=", "parent_table", ".", "get", "(", "table_name", ")", "_table_rows", "=", "[", "]", "if",...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
NXOSDriver.get_bgp_neighbors
af_name_dict = { 'af-id': {'safi': "af-name"}, 'af-id': {'safi': "af-name"}, 'af-id': {'safi': "af-name"} }
napalm/nxos/nxos.py
def get_bgp_neighbors(self): results = {} bgp_state_dict = { "Idle": {"is_up": False, "is_enabled": True}, "Active": {"is_up": False, "is_enabled": True}, "Open": {"is_up": False, "is_enabled": True}, "Established": {"is_up": True, "is_enabled": True}, ...
def get_bgp_neighbors(self): results = {} bgp_state_dict = { "Idle": {"is_up": False, "is_enabled": True}, "Active": {"is_up": False, "is_enabled": True}, "Open": {"is_up": False, "is_enabled": True}, "Established": {"is_up": True, "is_enabled": True}, ...
[ "af_name_dict", "=", "{", "af", "-", "id", ":", "{", "safi", ":", "af", "-", "name", "}", "af", "-", "id", ":", "{", "safi", ":", "af", "-", "name", "}", "af", "-", "id", ":", "{", "safi", ":", "af", "-", "name", "}", "}" ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/nxos/nxos.py#L844-L927
[ "def", "get_bgp_neighbors", "(", "self", ")", ":", "results", "=", "{", "}", "bgp_state_dict", "=", "{", "\"Idle\"", ":", "{", "\"is_up\"", ":", "False", ",", "\"is_enabled\"", ":", "True", "}", ",", "\"Active\"", ":", "{", "\"is_up\"", ":", "False", ","...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
NXOSDriver.get_network_instances
get_network_instances implementation for NX-OS
napalm/nxos/nxos.py
def get_network_instances(self, name=""): """ get_network_instances implementation for NX-OS """ # command 'show vrf detail' returns all VRFs with detailed information # format: list of dictionaries with keys such as 'vrf_name' and 'rd' command = "show vrf detail" vrf_table_raw ...
def get_network_instances(self, name=""): """ get_network_instances implementation for NX-OS """ # command 'show vrf detail' returns all VRFs with detailed information # format: list of dictionaries with keys such as 'vrf_name' and 'rd' command = "show vrf detail" vrf_table_raw ...
[ "get_network_instances", "implementation", "for", "NX", "-", "OS" ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/nxos/nxos.py#L1254-L1304
[ "def", "get_network_instances", "(", "self", ",", "name", "=", "\"\"", ")", ":", "# command 'show vrf detail' returns all VRFs with detailed information", "# format: list of dictionaries with keys such as 'vrf_name' and 'rd'", "command", "=", "\"show vrf detail\"", "vrf_table_raw", "...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
get_network_driver
Searches for a class derived form the base NAPALM class NetworkDriver in a specific library. The library name must repect the following pattern: napalm_[DEVICE_OS]. NAPALM community supports a list of devices and provides the corresponding libraries; for full reference please refer to the `Supported Network...
napalm/base/__init__.py
def get_network_driver(name, prepend=True): """ Searches for a class derived form the base NAPALM class NetworkDriver in a specific library. The library name must repect the following pattern: napalm_[DEVICE_OS]. NAPALM community supports a list of devices and provides the corresponding libraries; for ...
def get_network_driver(name, prepend=True): """ Searches for a class derived form the base NAPALM class NetworkDriver in a specific library. The library name must repect the following pattern: napalm_[DEVICE_OS]. NAPALM community supports a list of devices and provides the corresponding libraries; for ...
[ "Searches", "for", "a", "class", "derived", "form", "the", "base", "NAPALM", "class", "NetworkDriver", "in", "a", "specific", "library", ".", "The", "library", "name", "must", "repect", "the", "following", "pattern", ":", "napalm_", "[", "DEVICE_OS", "]", "....
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/__init__.py#L38-L118
[ "def", "get_network_driver", "(", "name", ",", "prepend", "=", "True", ")", ":", "if", "name", "==", "\"mock\"", ":", "return", "MockDriver", "if", "not", "(", "isinstance", "(", "name", ",", "py23_compat", ".", "string_types", ")", "and", "len", "(", "n...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
main
Load a config for the device.
docs/tutorials/sample_scripts/load_replace.py
def main(config_file): """Load a config for the device.""" if not (os.path.exists(config_file) and os.path.isfile(config_file)): msg = "Missing or invalid config file {0}".format(config_file) raise ValueError(msg) print("Loading config file {0}.".format(config_file)) # Use the appropr...
def main(config_file): """Load a config for the device.""" if not (os.path.exists(config_file) and os.path.isfile(config_file)): msg = "Missing or invalid config file {0}".format(config_file) raise ValueError(msg) print("Loading config file {0}.".format(config_file)) # Use the appropr...
[ "Load", "a", "config", "for", "the", "device", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/docs/tutorials/sample_scripts/load_replace.py#L14-L59
[ "def", "main", "(", "config_file", ")", ":", "if", "not", "(", "os", ".", "path", ".", "exists", "(", "config_file", ")", "and", "os", ".", "path", ".", "isfile", "(", "config_file", ")", ")", ":", "msg", "=", "\"Missing or invalid config file {0}\"", "....
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
oc_attr_isdefault
Return wether an OC attribute has been defined or not.
napalm/base/utils/jinja_filters.py
def oc_attr_isdefault(o): """Return wether an OC attribute has been defined or not.""" if not o._changed() and not o.default(): return True if o == o.default(): return True return False
def oc_attr_isdefault(o): """Return wether an OC attribute has been defined or not.""" if not o._changed() and not o.default(): return True if o == o.default(): return True return False
[ "Return", "wether", "an", "OC", "attribute", "has", "been", "defined", "or", "not", "." ]
napalm-automation/napalm
python
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/utils/jinja_filters.py#L19-L25
[ "def", "oc_attr_isdefault", "(", "o", ")", ":", "if", "not", "o", ".", "_changed", "(", ")", "and", "not", "o", ".", "default", "(", ")", ":", "return", "True", "if", "o", "==", "o", ".", "default", "(", ")", ":", "return", "True", "return", "Fal...
c11ae8bb5ce395698704a0051cdf8d144fbb150d
train
OsqueryTable.Column
Iterates over values of a given column. Args: column_name: A nome of the column to retrieve the values for. Yields: Values of the specified column. Raises: KeyError: If given column is not present in the table.
grr/core/grr_response_core/lib/rdfvalues/osquery.py
def Column(self, column_name): """Iterates over values of a given column. Args: column_name: A nome of the column to retrieve the values for. Yields: Values of the specified column. Raises: KeyError: If given column is not present in the table. """ column_idx = None for ...
def Column(self, column_name): """Iterates over values of a given column. Args: column_name: A nome of the column to retrieve the values for. Yields: Values of the specified column. Raises: KeyError: If given column is not present in the table. """ column_idx = None for ...
[ "Iterates", "over", "values", "of", "a", "given", "column", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/rdfvalues/osquery.py#L55-L77
[ "def", "Column", "(", "self", ",", "column_name", ")", ":", "column_idx", "=", "None", "for", "idx", ",", "column", "in", "enumerate", "(", "self", ".", "header", ".", "columns", ")", ":", "if", "column", ".", "name", "==", "column_name", ":", "column_...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74