[Python-modules-commits] [napalm-base] 01/05: Imported Upstream version 0.14.1

Vincent Bernat bernat at moszumanska.debian.org
Fri May 27 08:50:55 UTC 2016


This is an automated email from the git hooks/post-receive script.

bernat pushed a commit to branch master
in repository napalm-base.

commit ed29fd3135ab5e805fd222b634a34fc7041c236d
Author: Vincent Bernat <bernat at debian.org>
Date:   Fri May 27 10:45:07 2016 +0200

    Imported Upstream version 0.14.1
---
 MANIFEST.in                                 |    1 +
 PKG-INFO                                    |   16 +
 napalm_base.egg-info/PKG-INFO               |   16 +
 napalm_base.egg-info/SOURCES.txt            |   20 +
 napalm_base.egg-info/dependency_links.txt   |    1 +
 napalm_base.egg-info/entry_points.txt       |    3 +
 napalm_base.egg-info/requires.txt           |    2 +
 napalm_base.egg-info/top_level.txt          |    1 +
 napalm_base/__init__.py                     |   86 ++
 napalm_base/base.py                         | 1251 +++++++++++++++++++++++++++
 napalm_base/clitools/__init__.py            |    0
 napalm_base/clitools/cl_napalm_configure.py |  144 +++
 napalm_base/exceptions.py                   |   43 +
 napalm_base/helpers.py                      |  159 ++++
 napalm_base/test/__init__.py                |    0
 napalm_base/test/base.py                    |  405 +++++++++
 napalm_base/test/models.py                  |  277 ++++++
 napalm_base/utils/__init__.py               |    0
 napalm_base/utils/string_parsers.py         |   99 +++
 requirements.txt                            |    2 +
 setup.cfg                                   |    5 +
 setup.py                                    |   36 +
 22 files changed, 2567 insertions(+)

diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..f9bd145
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1 @@
+include requirements.txt
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..05c9677
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,16 @@
+Metadata-Version: 1.1
+Name: napalm-base
+Version: 0.14.1
+Summary: Network Automation and Programmability Abstraction Layer with Multivendor support
+Home-page: https://github.com/napalm-automation/napalm-base
+Author: David Barroso
+Author-email: dbarrosop at dravetech.com
+License: UNKNOWN
+Description: UNKNOWN
+Platform: UNKNOWN
+Classifier: Topic :: Utilities
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Operating System :: POSIX :: Linux
+Classifier: Operating System :: MacOS
diff --git a/napalm_base.egg-info/PKG-INFO b/napalm_base.egg-info/PKG-INFO
new file mode 100644
index 0000000..05c9677
--- /dev/null
+++ b/napalm_base.egg-info/PKG-INFO
@@ -0,0 +1,16 @@
+Metadata-Version: 1.1
+Name: napalm-base
+Version: 0.14.1
+Summary: Network Automation and Programmability Abstraction Layer with Multivendor support
+Home-page: https://github.com/napalm-automation/napalm-base
+Author: David Barroso
+Author-email: dbarrosop at dravetech.com
+License: UNKNOWN
+Description: UNKNOWN
+Platform: UNKNOWN
+Classifier: Topic :: Utilities
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Operating System :: POSIX :: Linux
+Classifier: Operating System :: MacOS
diff --git a/napalm_base.egg-info/SOURCES.txt b/napalm_base.egg-info/SOURCES.txt
new file mode 100644
index 0000000..8260714
--- /dev/null
+++ b/napalm_base.egg-info/SOURCES.txt
@@ -0,0 +1,20 @@
+MANIFEST.in
+requirements.txt
+setup.py
+napalm_base/__init__.py
+napalm_base/base.py
+napalm_base/exceptions.py
+napalm_base/helpers.py
+napalm_base.egg-info/PKG-INFO
+napalm_base.egg-info/SOURCES.txt
+napalm_base.egg-info/dependency_links.txt
+napalm_base.egg-info/entry_points.txt
+napalm_base.egg-info/requires.txt
+napalm_base.egg-info/top_level.txt
+napalm_base/clitools/__init__.py
+napalm_base/clitools/cl_napalm_configure.py
+napalm_base/test/__init__.py
+napalm_base/test/base.py
+napalm_base/test/models.py
+napalm_base/utils/__init__.py
+napalm_base/utils/string_parsers.py
\ No newline at end of file
diff --git a/napalm_base.egg-info/dependency_links.txt b/napalm_base.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/napalm_base.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/napalm_base.egg-info/entry_points.txt b/napalm_base.egg-info/entry_points.txt
new file mode 100644
index 0000000..4a94e3e
--- /dev/null
+++ b/napalm_base.egg-info/entry_points.txt
@@ -0,0 +1,3 @@
+[console_scripts]
+cl_napalm_configure = napalm_base.clitools.cl_napalm_configure:main
+
diff --git a/napalm_base.egg-info/requires.txt b/napalm_base.egg-info/requires.txt
new file mode 100644
index 0000000..62b0e5a
--- /dev/null
+++ b/napalm_base.egg-info/requires.txt
@@ -0,0 +1,2 @@
+jinja2
+gtextfsm
diff --git a/napalm_base.egg-info/top_level.txt b/napalm_base.egg-info/top_level.txt
new file mode 100644
index 0000000..d140051
--- /dev/null
+++ b/napalm_base.egg-info/top_level.txt
@@ -0,0 +1 @@
+napalm_base
diff --git a/napalm_base/__init__.py b/napalm_base/__init__.py
new file mode 100644
index 0000000..b14c82a
--- /dev/null
+++ b/napalm_base/__init__.py
@@ -0,0 +1,86 @@
+# Copyright 2015 Spotify AB. All rights reserved.
+#
+# The contents of this file are licensed under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+"""napalm_base package."""
+
+# Python std lib
+import inspect
+import importlib
+
+# NAPALM base
+from napalm_base.base import NetworkDriver
+from napalm_base.exceptions import ModuleImportError
+
+
+__all__ = [
+    'get_network_driver',  # export the function
+    'NetworkDriver'  # also export the base class
+]
+
+
+def get_network_driver(module_name):
+
+    """
+    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 Operation Systems`_ paragraph on `Read the Docs`_.
+
+    .. _`Supported Network Operation Systems`: http://napalm.readthedocs.io/en/latest/#supported-network-operating-systems
+    .. _`Read the Docs`: http://napalm.readthedocs.io/
+
+    :param module_name:         the name of the device operating system, or the name of the library.
+    :return:                    the first class derived from NetworkDriver, found in the library.
+    :raise ModuleImportError:   when the library is not installed, or a derived class from NetworkDriver was not found.
+
+    Example::
+
+    .. code-block:: python
+
+        >>> get_network_driver('junos')
+        <class 'napalm_junos.junos.JunOSDriver'>
+        >>> get_network_driver('IOS-XR')
+        <class 'napalm_iosxr.iosxr.IOSXRDriver'>
+        >>> get_network_driver('napalm_eos')
+        <class 'napalm_eos.eos.EOSDriver'>
+        >>> get_network_driver('wrong')
+        napalm_base.exceptions.ModuleImportError: Cannot import "napalm_wrong". Is the library installed?
+    """
+
+    if not (isinstance(module_name, basestring) and len(module_name) > 0):
+        raise ModuleImportError('Please provide a valid driver name.')
+
+    try:
+        module_name = module_name.lower()  # only lowercase allowed
+        module_install_name = module_name.replace('-', '')  # to not raise error when users requests IOS-XR for e.g.
+        if 'napalm_' not in module_install_name:  # can also request using napalm_[SOMETHING]
+            module_install_name = 'napalm_{name}'.format(name=module_install_name)
+        module = importlib.import_module(module_install_name)
+    except ImportError:
+        raise ModuleImportError(
+                'Cannot import "{install_name}". Is the library installed?'.format(
+                    install_name=module_install_name
+                )
+            )
+
+    for name, obj in inspect.getmembers(module):
+        if inspect.isclass(obj) and issubclass(obj, NetworkDriver):
+            return obj
+
+    # looks like you don't have any Driver class in your module...
+    raise ModuleImportError(
+            'No class inheriting "napalm_base.base.NetworkDriver" found in "{install_name}".'.format(
+                install_name=module_install_name
+            )
+        )
diff --git a/napalm_base/base.py b/napalm_base/base.py
new file mode 100644
index 0000000..19d6c9f
--- /dev/null
+++ b/napalm_base/base.py
@@ -0,0 +1,1251 @@
+# Copyright 2015 Spotify AB. All rights reserved.
+#
+# The contents of this file are licensed under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+# std libs
+import sys
+
+# local modules
+import napalm_base.exceptions
+import napalm_base.helpers
+
+
+class NetworkDriver(object):
+
+    def __init__(self, hostname, username, password, timeout, optional_args):
+        """
+        This is the base class you have to inherit from when writing your own Network Driver to manage any device. You
+        will, in addition, have to override all the methods specified on this class. Make sure you follow the guidelines
+        for every method and that you return the correct data.
+
+        :param hostname: (str) IP or FQDN of the device you want to connect to.
+        :param username: (str) Username you want to use
+        :param password: (str) Password
+        :param timeout: (int) Time in seconds to wait for the device to respond.
+        :param optional_args: (dict) Pass additional arguments to underlying driver
+        :return:
+        """
+        raise NotImplementedError
+
+    def __enter__(self):
+        try:
+            self.open()
+        except:
+            exc_info = sys.exc_info()
+            self.__raise_clean_exception(exc_info[0], exc_info[1], exc_info[2])
+        return self
+
+    def __exit__(self, exc_type, exc_value, exc_traceback):
+        self.close()
+        if exc_type is not None:
+            self.__raise_clean_exception(exc_type, exc_value, exc_traceback)
+
+    @staticmethod
+    def __raise_clean_exception(exc_type, exc_value, exc_traceback):
+        """
+        This method is going to check if the exception exc_type is part of the builtins exceptions or part of the
+        napalm exceptions. If it is not, it will print a message on the screen giving instructions to fill a bug.
+        Finally it will raise the original exception.
+
+        :param exc_type: Exception class.
+        :param exc_value: Exception object.
+        :param exc_traceback: Traceback.
+        """
+        if exc_type.__name__ not in dir(napalm_base.exceptions) and \
+                        exc_type.__name__ not in __builtins__.keys():
+            epilog = ("NAPALM didn't catch this exception. Please, fill a bugfix on "
+                      "https://github.com/napalm-automation/napalm/issues\n"
+                      "Don't forget to include this traceback.")
+            print(epilog)
+        raise exc_type, exc_value, exc_traceback
+
+    def open(self):
+        """
+        Opens a connection to the device.
+        """
+        raise NotImplementedError
+
+    def close(self):
+        """
+        Closes the connection to the device.
+        """
+        raise NotImplementedError
+
+    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_source (optional): A custom config template to be rendered and loaded on the device
+        :param template_path (optional): Specifies the absolute path to a different directory for the configuration \
+        templates
+        :param template_vars: Dictionary with the arguments  to be used when the template is rendered.
+        :raise DriverTemplateNotImplemented: No template defined for the device type
+        :raise TemplateNotImplemented: The template specified in template_name does not exist in the default path or \
+        in the custom path if any specified using parameter `template_path`
+        :raise TemplateRenderException: The template could not be rendered. Either the template source does not have \
+        the right format, either the arguments in `template_vars` are not properly specified.
+        """
+        return napalm_base.helpers.load_template(self,
+                                                 template_name,
+                                                 template_source=template_source,
+                                                 template_path=template_path,
+                                                 **template_vars)
+
+    def load_replace_candidate(self, filename=None, config=None):
+        """
+        Populates the candidate configuration. You can populate it from a file or from a string. If you send both a
+        filename and a string containing the configuration, the file takes precedence.
+
+        If you use this method the existing configuration will be replaced entirely by the candidate configuration once
+        you commit the changes. This method will not change the configuration by itself.
+
+        :param filename: Path to the file containing the desired configuration. By default is None.
+        :param config: String containing the desired configuration.
+        :raise ReplaceConfigException: If there is an error on the configuration sent.
+        """
+        raise NotImplementedError
+
+    def load_merge_candidate(self, filename=None, config=None):
+        """
+        Populates the candidate configuration. You can populate it from a file or from a string. If you send both a
+        filename and a string containing the configuration, the file takes precedence.
+
+        If you use this method the existing configuration will be merged with the candidate configuration once
+        you commit the changes. This method will not change the configuration by itself.
+
+        :param filename: Path to the file containing the desired configuration. By default is None.
+        :param config: String containing the desired configuration.
+        :raise MergeConfigException: If there is an error on the configuration sent.
+        """
+        raise NotImplementedError
+
+    def compare_config(self):
+        """
+        :return: A string showing the difference between the running configuration and the candidate configuration. The\
+        running_config is loaded automatically just before doing the comparison so there is no need for you to do it.
+        """
+        raise NotImplementedError
+
+    def commit_config(self):
+        """
+        Commits the changes requested by the method load_replace_candidate or load_merge_candidate.
+        """
+        raise NotImplementedError
+
+    def discard_config(self):
+        """
+        Discards the configuration loaded into the candidate.
+        """
+        raise NotImplementedError
+
+    def rollback(self):
+        """
+        If changes were made, revert changes to the original state.
+        """
+        raise NotImplementedError
+
+    def get_facts(self):
+        """
+        Returns a dictionary containing the following information:
+         * uptime - Uptime of the device in seconds.
+         * vendor - Manufacturer of the device.
+         * model - Device model.
+         * hostname - Hostname of the device
+         * fqdn - Fqdn of the device
+         * os_version - String with the OS version running on the device.
+         * serial_number - Serial number of the device
+         * interface_list - List of the interfaces of the device
+
+        Example::
+
+            {
+            'uptime': 151005.57332897186,
+            'vendor': u'Arista',
+            'os_version': u'4.14.3-2329074.gaatlantarel',
+            'serial_number': u'SN0123A34AS',
+            'model': u'vEOS',
+            'hostname': u'eos-router',
+            'fqdn': u'eos-router',
+            'interface_list': [u'Ethernet2', u'Management1', u'Ethernet1', u'Ethernet3']
+            }
+
+        """
+        raise NotImplementedError
+
+    def get_interfaces(self):
+        """
+        Returns a dictionary of dictionaries. The keys for the first dictionary will be the interfaces in the devices.\
+        The inner dictionary will containing the following data for each interface:
+         * is_up (True/False)
+         * is_enabled (True/False)
+         * description (string)
+         * last_flapped (int in seconds)
+         * speed (int in Mbit)
+         * mac_address (string)
+
+        Example::
+
+            {
+            u'Management1':
+                {
+                'is_up': False,
+                'is_enabled': False,
+                'description': u'',
+                'last_flapped': -1,
+                'speed': 1000,
+                'mac_address': u'dead:beef:dead',
+                },
+            u'Ethernet1':
+                {
+                'is_up': True,
+                'is_enabled': True,
+                'description': u'foo',
+                'last_flapped': 1429978575.1554043,
+                'speed': 1000,
+                'mac_address': u'beef:dead:beef',
+                },
+            u'Ethernet2':
+                {
+                'is_up': True,
+                'is_enabled': True,
+                'description': u'bla',
+                'last_flapped': 1429978575.1555667,
+                'speed': 1000,
+                'mac_address': u'beef:beef:beef',
+                },
+            u'Ethernet3':
+                {
+                'is_up': False,
+                'is_enabled': True,
+                'description': u'bar',
+                'last_flapped': -1,
+                'speed': 1000,
+                'mac_address': u'dead:dead:dead',
+                }
+            }
+        """
+        raise NotImplementedError
+
+    def get_lldp_neighbors(self):
+        """
+        Returns a dictionary where the keys are local ports and the value is a list of dictionaries with the following \
+        information:
+            * hostname
+            * port
+
+        Example::
+
+            {
+            u'Ethernet2':
+                [
+                    {
+                    'hostname': u'junos-unittest',
+                    'port': u'520',
+                    }
+                ],
+            u'Ethernet3':
+                [
+                    {
+                    'hostname': u'junos-unittest',
+                    'port': u'522',
+                    }
+                ],
+            u'Ethernet1':
+                [
+                    {
+                    'hostname': u'junos-unittest',
+                    'port': u'519',
+                    },
+                    {
+                    'hostname': u'ios-xrv-unittest',
+                    'port': u'Gi0/0/0/0',
+                    }
+                ],
+            u'Management1':
+                [
+                    {
+                    'hostname': u'junos-unittest',
+                    'port': u'508',
+                    }
+                ]
+            }
+        """
+        raise NotImplementedError
+
+    def get_bgp_neighbors(self):
+        """
+        Returns a dictionary of dictionaries. The keys for the first dictionary will be the vrf (global if no vrf).
+        The inner dictionary will contain the following data for each vrf:
+
+          * router_id
+          * peers - another dictionary of dictionaries. Outer keys are the IPs of the neighbors. The inner keys are:
+             * local_as (int)
+             * remote_as (int)
+             * remote_id - peer router id
+             * is_up (True/False)
+             * is_enabled (True/False)
+             * description (string)
+             * uptime (int in seconds)
+             * address_family (dictionary) - A dictionary of address families available for the neighbor. So far it can\
+               be 'ipv4' or 'ipv6'
+                * received_prefixes (int)
+                * accepted_prefixes (int)
+                * sent_prefixes (int)
+        """
+        raise NotImplementedError
+
+    def get_environment(self):
+        """
+        Returns a dictionary where:
+
+            * fans is a dictionary of dictionaries where the key is the location and the values:
+                 * status (True/False) - True if it's ok, false if it's broken
+            * temperature is a dictionary of dictionaries where the key is the location and the values:
+                 * temperature (float) - Temperature in celsius the sensor is reporting.
+                 * is_alert (True/False) - True if the temperature is above the alert threshold
+                 * is_critical (True/False) - True if the temperature is above the critical threshold
+            * power is a dictionary of dictionaries where the key is the PSU id and the values:
+                 * status (True/False) - True if it's ok, false if it's broken
+                 * capacity (float) - Capacity in W that the power supply can support
+                 * output (float) - Watts drawn by the system
+            * cpu is a dictionary of dictionaries where the key is the ID and the values
+                 * %usage
+            * memory is a dictionary with:
+                 * available_ram (int) - Total amount of RAM installed in the device
+                 * used_ram (int) - RAM in use in the device
+        """
+        raise NotImplementedError
+
+    def get_interfaces_counters(self):
+        """
+        Returns a dictionary of dictionaries where the first key is an interface name and the inner dictionary contains
+        the following keys:
+
+            * 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_multicast_packets (int)
+            * tx_broadcast_packets (int)
+            * rx_broadcast_packets (int)
+
+        Example::
+
+            {
+                u'Ethernet2': {
+                    'tx_multicast_packets': 699,
+                    'tx_discards': 0,
+                    'tx_octets': 88577,
+                    'tx_errors': 0,
+                    'rx_octets': 0,
+                    'tx_unicast_packets': 0,
+                    'rx_errors': 0,
+                    'tx_broadcast_packets': 0,
+                    'rx_multicast_packets': 0,
+                    'rx_broadcast_packets': 0,
+                    'rx_discards': 0,
+                    'rx_unicast_packets': 0
+                },
+                u'Management1': {
+                     'tx_multicast_packets': 0,
+                     'tx_discards': 0,
+                     'tx_octets': 159159,
+                     'tx_errors': 0,
+                     'rx_octets': 167644,
+                     'tx_unicast_packets': 1241,
+                     'rx_errors': 0,
+                     'tx_broadcast_packets': 0,
+                     'rx_multicast_packets': 0,
+                     'rx_broadcast_packets': 80,
+                     'rx_discards': 0,
+                     'rx_unicast_packets': 0
+                },
+                u'Ethernet1': {
+                     'tx_multicast_packets': 293,
+                     'tx_discards': 0,
+                     'tx_octets': 38639,
+                     'tx_errors': 0,
+                     'rx_octets': 0,
+                     'tx_unicast_packets': 0,
+                     'rx_errors': 0,
+                     'tx_broadcast_packets': 0,
+                     'rx_multicast_packets': 0,
+                     'rx_broadcast_packets': 0,
+                     'rx_discards': 0,
+                     'rx_unicast_packets': 0
+                }
+            }
+        """
+        raise NotImplementedError
+
+    def get_lldp_neighbors_detail(self, interface = ''):
+        """
+        Returns a detailed view of the LLDP neighbors as a dictionary
+        containing lists of dictionaries for each interface.
+
+        Inner dictionaries contain fields:
+            * parent_interface (string)
+            * remote_port (string)
+            * remote_port_description (string)
+            * remote_chassis_id (string)
+            * remote_system_name (string)
+            * remote_system_description (string)
+            * remote_system_capab (string)
+            * remote_system_enabled_capab (string)
+
+        Example::
+
+            {
+                'TenGigE0/0/0/8': [
+                    {
+                        'parent_interface': u'Bundle-Ether8',
+                        'remote_chassis_id': u'8c60.4f69.e96c',
+                        'remote_system_name': u'switch',
+                        'remote_port': u'Eth2/2/1',
+                        'remote_port_description': u'Ethernet2/2/1',
+                        'remote_system_description': u'''Cisco Nexus Operating System (NX-OS) Software 7.1(0)N1(1a)
+                              TAC support: http://www.cisco.com/tac
+                              Copyright (c) 2002-2015, Cisco Systems, Inc. All rights reserved.''',
+                        'remote_system_capab': u'B, R',
+                        'remote_system_enable_capab': u'B'
+                    }
+                ]
+            }
+        """
+        raise NotImplementedError
+
+    def get_bgp_config(self, group='', neighbor=''):
+        """
+        Returns a dictionary containing the BGP configuration.
+        Can return either the whole config, either the config only for a group or neighbor.
+
+        :param group: Returns the configuration of a specific BGP group.
+        :param neighbor: Returns the configuration of a specific BGP neighbor.
+
+        Main dictionary keys represent the group name and the values represent a dictionary having the following keys:
+            * type (string)
+            * description (string)
+            * apply_groups (string list)
+            * multihop_ttl (int)
+            * multipath (True/False)
+            * local_address (string)
+            * local_as (int)
+            * remote_as (int)
+            * import_policy (string)
+            * export_policy (string)
+            * remove_private_as (True/False)
+            * prefix_limit (dictionary)
+            * neighbors (dictionary)
+        Neighbors is a dictionary of dictionaries with the following keys:
+            * description (string)
+            * import_policy (string)
+            * export_policy (string)
+            * local_address (string)
+            * local_as (int)
+            * remote_as (int)
+            * authentication_key (string)
+            * prefix_limit (dictionary)
+            * route_reflector_client (True/False)
+            * nhs (True/False)
+        The inner dictionary prefix_limit has the same structure for both layers::
+
+            {
+                [FAMILY_NAME]: {
+                    [FAMILY_TYPE]: {
+                        'limit': [LIMIT],
+                        ... other options
+                    }
+                }
+            }
+
+        Example::
+
+            {
+                'PEERS-GROUP-NAME':{
+                    'type'              : u'external',
+                    'description'       : u'Here we should have a nice description',
+                    'apply_groups'      : [u'BGP-PREFIX-LIMIT'],
+                    'import_policy'     : u'PUBLIC-PEER-IN',
+                    'export_policy'     : u'PUBLIC-PEER-OUT',
+                    'remove_private_as' : True,
+                    'multipath'         : True,
+                    'multihop_ttl'      : 30,
+                    'neighbors'         : {
+                        '192.168.0.1': {
+                            'description'   : 'Facebook [CDN]',
+                            'prefix_limit'  : {
+                                'inet': {
+                                    'unicast': {
+                                        'limit': 100,
+                                        'teardown': {
+                                            'threshold' : 95,
+                                            'timeout'   : 5
+                                        }
+                                    }
+                                }
+                            }
+                            'remote_as'             : 32934,
+                            'route_reflector_client': False,
+                            'nhs'                   : True
+                        },
+                        '172.17.17.1': {
+                            'description'   : 'Twitter [CDN]',
+                            'prefix_limit'  : {
+                                'inet': {
+                                    'unicast': {
+                                        'limit': 500,
+                                        'no-validate': 'IMPORT-FLOW-ROUTES'
+                                    }
+                                }
+                            }
+                            'remote_as'               : 13414
+                            'route_reflector_client': False,
+                            'nhs'                   : False
+                        }
+                    }
+                }
+            }
+        """
+        raise NotImplementedError
+
+    def cli(self, *commands):
+
+        """
+        Will execute a list of commands and return the output in a dictionary format.
+
+        Example::
+
+            {
+                u'show version and haiku':  u'''Hostname: re0.edge01.arn01
+                                                Model: mx480
+                                                Junos: 13.3R6.5
+
+                                                        Help me, Obi-Wan
+                                                        I just saw Episode Two
+                                                        You're my only hope
+                                            ''',
+                u'show chassis fan'     :   u'''Item                      Status   RPM     Measurement
+                                                Top Rear Fan              OK       3840    Spinning at intermediate-speed
+                                                Bottom Rear Fan           OK       3840    Spinning at intermediate-speed
+                                                Top Middle Fan            OK       3900    Spinning at intermediate-speed
+                                                Bottom Middle Fan         OK       3840    Spinning at intermediate-speed
+                                                Top Front Fan             OK       3810    Spinning at intermediate-speed
+                                                Bottom Front Fan          OK       3840    Spinning at intermediate-speed
+                                            '''
+            }
+        """
+        raise NotImplementedError
+
+    def get_bgp_neighbors_detail(self, neighbor_address=''):
+
+        """
+        Returns a detailed view of the BGP neighbors as a dictionary of lists.
+
+        :param neighbor_address: Retuns the statistics for a spcific BGP neighbor.
+
+        The keys of the dictionary represent the AS number of the neighbors.
+        Inner dictionaries contain the following fields:
+            * up (True/False)
+            * local_as (int)
+            * remote_as (int)
+            * local_address (string)
+            * routing_table (string)
+            * local_address_configured (True/False)
+            * local_port (int)
+            * remote_address (string)
+            * remote_port (int)
+            * multihop (True/False)
+            * multipath (True/False)
+            * remove_private_as (True/False)
+            * import_policy (string)
+            * export_policy (string)
+            * input_messages (int)
+            * output_messages (int)
+            * input_updates (int)
+            * output_updates (int)
+            * messages_queued_out (int)
+            * connection_state (string)
+            * previous_connection_state (string)
+            * last_event (string)
+            * suppress_4byte_as (True/False)
+            * local_as_prepend (True/False)
+            * holdtime (int)
+            * configured_holdtime (int)
+            * keepalive (int)
+            * configured_keepalive (int)
+            * active_prefix_count (int)
+            * received_prefix_count (int)
+            * accepted_prefix_count (int)
+            * suppressed_prefix_count (int)
+            * advertised_prefix_count (int)
+            * flap_count (int)
+
+        Example::
+
+            {
+                8121: [
+                    {
+                        'up'                        : True,
+                        'local_as'                  : 13335,
+                        'remote_as'                 : 8121,
+                        'local_address'             : u'172.101.76.1',
+                        'local_address_configured'  : True,
+                        'local_port'                : 179,
+                        'routing_table'             : u'inet.0',
+                        'remote_address'            : u'192.247.78.0',
+                        'remote_port'               : 58380,
+                        'multihop'                  : False,
+                        'multipath'                 : True,
+                        'remove_private_as'         : True,
+                        'import_policy'             : u'4-NTT-TRANSIT-IN',
+                        'export_policy'             : u'4-NTT-TRANSIT-OUT',
+                        'input_messages'            : 123,
+                        'output_messages'           : 13,
+                        'input_updates'             : 123,
+                        'output_updates'            : 5,
+                        'messages_queued_out'       : 23,
+                        'connection_state'          : u'Established',
+                        'previous_connection_state' : u'EstabSync',
+                        'last_event'                : u'RecvKeepAlive',
+                        'suppress_4byte_as'         : False,
+                        'local_as_prepend'          : False,
+                        'holdtime'                  : 90,
+                        'configured_holdtime'       : 90,
+                        'keepalive'                 : 30,
+                        'configured_keepalive'      : 30,
+                        'active_prefix_count'       : 132808,
+                        'received_prefix_count'     : 566739,
+                        'accepted_prefix_count'     : 566479,
+                        'suppressed_prefix_count'   : 0,
+                        'advertise_prefix_count'    : 0,
+                        'flap_count'                : 27
+                    }
+                ]
+            }
+        """
+        raise NotImplementedError
+
+    def get_arp_table(self):
+
+        """
+        Returns a list of dictionaries having the following set of keys:
+            * interface (string)
+            * mac (string)
+            * ip (string)
+            * age (float)
+
+        Example::
+
+            [
+                {
+                    'interface' : 'MgmtEth0/RSP0/CPU0/0',
+                    'mac'       : '5c:5e:ab:da:3c:f0',
+                    'ip'        : '172.17.17.1',
+                    'age'       : 1454496274.84
+                },
+                {
+                    'interface' : 'MgmtEth0/RSP0/CPU0/0',
+                    'mac'       : '66:0e:94:96:e0:ff',
+                    'ip'        : '172.17.17.2',
+                    'age'       : 1435641582.49
+                }
+            ]
+
+        """
+        raise NotImplementedError
+
+
+    def get_ntp_peers(self):
+
+        """
+        Returns the NTP peers configuration as dictionary.
+        The keys of the dictionary represent the IP Addresses of the peers.
+        Inner dictionaries do not have yet any available keys.
+
+        Example::
+
+            {
+                '192.168.0.1': {},
+                '17.72.148.53': {},
+                '37.187.56.220': {},
+                '162.158.20.18': {}
+            }
+
+        """
+
+        raise NotImplementedError
+
+
+    def get_ntp_stats(self):
+
+        """
+        Returns a list of NTP synchronization statistics.
+
+            * remote (string)
+            * referenceid (string)
+            * synchronized (True/False)
+            * stratum (int)
+            * type (string)
+            * when (string)
+            * hostpoll (int)
+            * reachability (int)
+            * delay (float)
+            * offset (float)
+            * jitter (float)
+
+        Example::
+
+            [
+                {
+                    'remote'        : u'188.114.101.4',
+                    'referenceid'   : u'188.114.100.1',
+                    'synchronized'  : True,
+                    'stratum'       : 4,
+                    'type'          : u'-',
+                    'when'          : u'107',
+                    'hostpoll'      : 256,
+                    'reachability'  : 377,
+                    'delay'         : 164.228,
+                    'offset'        : -13.866,
+                    'jitter'        : 2.695
+                }
+            ]
+        """
+        raise NotImplementedError
+
+    def get_interfaces_ip(self):
+
+        """
+        Returns all configured IP addresses on all interfaces as a dictionary of dictionaries.
+        Keys of the main dictionary represent the name of the interface.
+        Values of the main dictionary represent are dictionaries that may consist of two keys
+        'ipv4' and 'ipv6' (one, both or none) which are themselvs dictionaries witht the IP addresses as keys.
+        Each IP Address dictionary has the following keys:
+            * prefix_length (int)
+
+        Example::
+
+            {
+                u'FastEthernet8': {
+                    u'ipv4': {
+                        u'10.66.43.169': {
+                            'prefix_length': 22
+                        }
+                    }
+                },
+                u'Loopback555': {
+                    u'ipv4': {
+                        u'192.168.1.1': {
+                            'prefix_length': 24
+                        }
+                    },
+                    u'ipv6': {
+                        u'1::1': {
+                            'prefix_length': 64
+                        },
+                        u'2001:DB8:1::1': {
... 1721 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/napalm-base.git



More information about the Python-modules-commits mailing list