Coder Social home page Coder Social logo

napalm-aruba-cx's Introduction

Napalm-aruba-cx

NAPALM Driver implementation for AOS-CX Switches.

Supported Devices

All AOS-CX devices are supported, however the AOS-CX switch firmware should be version 10.05 or later, as some modules may have not been properly tested in older versions.

Current Support Functionality

* get_arp_table - Get the ARP table from a device.
* get_config - Get configuration from the device.
* get_facts - Get the version, serial number, vendor, model, and uptime from a device.
* get_interfaces - Get list of interfaces from a device.
* get_interfaces_ip - Get list of interface IP addresses from a device.
* get_lldp_neighbors - Get the list of LLDP Neighbors from a device.
* get_lldp_neighbors_detail - Get LLDP Neighbor details from a device.
* get_mac_address_table - Get the MAC Address table from a device.
* get_ntp_servers - Gets NTP information from a network device.
* get_route_to - Shows an IP route on a device.
* get_snmp_information - Get the SNMP information of a device.
* get_vlans - Get the Vlans information of a device.
* is_alive - Check to see if the connection to the device is up.
* ping - Execute a ping command from the device.

Early versions of this driver will focus on the Get functions.  Configuration handling is in current development.

Getting Started

For more information and guides to help get started, check out the Aruba Developer Hub section for NAPALM.

Prerequisites

The following software is required:

  • Python3
  • Pip
  • Python modules specified in requirements.txt
    • pyaoscx v1.0.0
    • requests
    • urllib3

Note that the current version of this driver utilizes pyaoscx v1 only. Future versions of this driver will be compatible with pyaoscx v2

Installing

To install simply run:

pip3 install napalm-aruba-cx

Switch configuration

The AOS-CX driver utilizes the REST API on the switches. Depending on the switch model, this may already be enabled. If not, please use the CLI commands below to enable REST on the specified VRF.

  1. There must be a user on the switch who belongs to the "administrators group" and has a password set. This user would then be allowed to access the REST API. In the below example, replace the username "admin" and password "mypassword" with your own username and password respectively.
8320(config)# user admin group administrators password plaintext mypassword
  1. Set the access mode for the HTTPS server to "read-write" and enable the HTTPS server on the VRF through which the client making the NAPALM calls can reach the switch. In the below example, this specifies both the management VRF and the default VRF.
8320(config)# https-server rest access-mode read-write
8320(config)# https-server vrf default
8320(config)# https-server vrf mgmt

Contributing

Please read CONTRIBUTING for details on our process for submitting issues and requests.

License

This project is licensed under the Apache License - see the LICENSE file for details

napalm-aruba-cx's People

Contributors

alagoutte avatar alvinc13 avatar mirceaulinic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

napalm-aruba-cx's Issues

get_facts in a VSF context

When you use get_facts in a VSF context, it only gathers and displays values for 1 device of the stack (model and serial)
While all the interfaces are gathered.

Method get_mac_address_table failed

We're using netbox 3.5 with the napalm Plugin. We can't fetch the mac address table (nor the lldp neighbours) for a Aruba 6100 Switch

Napalm reports the following:

{ "get_mac_address_table": { "error": "Method get_mac_address_table failed: list indices must be integers or slices, not str" }

Output from the switch itself:

SW# show mac-address-table
MAC age-time            : 300 seconds
Number of MAC addresses : 366

MAC Address          VLAN     Type                      Port
--------------------------------------------------------------
b0:xx:xx:xx:xx:21    1        dynamic                   1/1/51
90:xx:xx:xx:xx:cc    1        dynamic                   1/1/51
0c:xx:xx:xx:xx:24    1        dynamic                   1/1/51
00:xx:xx:xx:xx:96    1        dynamic                   1/1/51
00:xx:xx:xx:xx:c7    1        dynamic                   1/1/51
00:xx:xx:xx:xx:27    1        dynamic                   1/1/51
00:xx:xx:xx:xx:08    1        dynamic                   1/1/51
00:xx:xx:xx:xx:c2    1        dynamic                   1/1/51
00:xx:xx:xx:xx:2a    1        dynamic                   1/1/51
00:xx:xx:xx:xx:78    1        dynamic                   1/1/51
00:xx:xx:xx:xx:36    1        dynamic                   1/1/51
00:xx:xx:xx:xx:9b    1        dynamic                   1/1/51

Version is above 10.05:

SW# show version
-----------------------------------------------------------------------------
ArubaOS-CX
(c) Copyright 2017-2023 Hewlett Packard Enterprise Development LP
-----------------------------------------------------------------------------
Version      : PL.10.11.1030
Build Date   : 2023-06-20 14:20:37 UTC
Build ID     : ArubaOS-CX:PL.10.11.1030:c67b303ba898:202306201323
Build SHA    : c67b303ba8985a29658cb8694649d2dd3454c4dc
Hot Patches  :
Active Image : secondary

Service OS Version : PL.01.12.0003
BIOS Version       : PL.01.0002

Issue with a key in get_lldp_neighbors

There's an issue with "port" key in get_lldp_neighbors.
A colon is included in the key name :
{'hostname': '<device_name>', 'port:': '1/1/47'}
while it should be :
{'hostname': '<device_name>', 'port': '1/1/47'}

Issue with get_interfaces_ip()

When running get_interfaces_ip() function, we face the 2 following issues :

  1. When a physical port is part of a LAG, we have a 404 error.
  2. When a port supports splitting, we have a 404 error on the splitted interfaces, even if they are not created.

Examples :

  1. WARNING:root:FAIL: Getting Port table entry '1/1/55' failed with status code 404: Error when calling GET: Object not found.
    => This interface is part of a LAG
  2. WARNING:root:FAIL: Getting Port table entry '1/1/50:2' failed with status code 404: Error when calling GET: Object not found.
    => This interface represents the port #2 when interface 50 is splitted. This is not the case on my setup.

Issue seems to come from the pyaoscx's get_port function.

Issue with get_config

get_config fails as session information are not sent when it calls the _get_json_configuration function.
"**self.session_info" has to be used when get_config calls this sub-function

if retrieve in ["running", "all"]:
    config_dict['running'] = self._get_json_configuration("running-config", **self.session_info)
if retrieve in ["startup", "all"]:
    config_dict['startup'] = self._get_json_configuration("startup-config", **self.session_info)

Issues with basic gets

Hi, I get this error or something similar for every get I try to run. I'm using a basic test script to test on our CX gear. Any suggestions would help greatly! Thanks! On 10.0.5.0011. The rest session is connecting.

Thanks!

Traceback (most recent call last):
File "Test-Napalm.py", line 12, in
print(json.dumps(device.get_facts(), sort_keys=True))
File "/home/netauto/.local/lib/python3.8/site-packages/napalm_aoscx/aoscx.py", line 123, in get_facts
'serial_number': productinfo['product_info']['serial_number'],
KeyError: 'product_info'

Issue with get_environment() and Aruba 6300

When running get_environment() to a 6300M, it fails with the following error :

Traceback (most recent call last):
  File "test-napalm.py", line 15, in <module>
    print(device.get_environment())
  File "/opt/netbox/venv/lib/python3.8/site-packages/napalm_aoscx/aoscx.py", line 386, in get_environment
    '%usage': mm['resource_utilization']['cpu']
KeyError: 'cpu'

Seems that in the list of management modules retrieved in the backend, the loop starts with the module 2/1, which does not have "cpu" key.
Only Management module "1/1" has this key.

v1 API is deprecated

First, thanks for this implementation! It seems like Aruba has discontinued support for Rest API v1. We use Arubas 6100 series and wanted to implement NAPALM. Sadly, it doesn't work with this driver.

Is it possible to adjust this driver to work with the latest firmware? It kind of already does if you change the baseurl to /rest/latest/ but some components don't work properly.

get_arp problem

When I try to use the get_arp function the following error message occurs:

data = device.get_arp_table() File "/home/russ/src/aruba/cx/napalm/venv-napalm/lib/python3.9/site-packages/napalm_aoscx/aoscx.py", line 421, in get_arp_table vrf_list = pyaoscx.vrf.get_all_vrfs(**self.session_info) AttributeError: module 'pyaoscx' has no attribute 'vrf'

Here is my environment:

  • bcrypt 4.0.1
  • certifi 2022.12.7
  • cffi 1.15.1
  • charset-normalizer 3.0.1
  • cryptography 39.0.1
  • future 0.18.3
  • idna 3.4
  • Jinja2 3.1.2
  • junos-eznc 2.6.7
  • lxml 4.9.2
  • MarkupSafe 2.1.2
  • napalm 4.0.0
  • napalm-aruba-cx 0.1.4
  • ncclient 0.6.13
  • netaddr 0.8.0
  • netmiko 4.1.2
  • netutils 1.4.1
  • ntc-templates 3.2.0
  • paramiko 3.0.0
  • pexpect 4.8.0
  • pip 23.0.1
  • psycopg2 2.9.5
  • ptyprocess 0.7.0
  • pyaoscx 1.0.0
  • pycparser 2.21
  • pyeapi 0.8.4
  • PyNaCl 1.5.0
  • pyparsing 3.0.9
  • pyserial 3.5
  • python-dotenv 1.0.0
  • PyYAML 6.0
  • requests 2.28.2
  • scp 0.14.5
  • setuptools 58.1.0
  • six 1.16.0
  • tenacity 8.2.2
  • textfsm 1.1.2
  • transitions 0.9.0
  • ttp 0.9.2
  • ttp-templates 0.3.2
  • typing_extensions 4.5.0
  • urllib3 1.26.14
  • yamlordereddictloader 0.4.0

So far only commands I have been able to use successfully are:

  • is_alive
  • get_facts
  • get_lldp_neighbors
  • get_snmp_information

All the rest fail, in slightly different modes than for get_arp_table

get_environment

Hi,

I started configuring the napalm on all our switches in netbox. On our Aruba switches the napalm aos-cx doesn't work when it's a stacked switch. Can this be added?

Thanks in advance.

Import Error when using napalm Aruba driver

Hi,
I currently am experiencing a problem when trying to use the Aruba driver for napalm...

When i use the following command:
napalm --vendor aoscx --user --password <pw_redacted> call get_facts

Napalm errors out wit the following message:

2021-07-07 11:43:54,370 - napalm - ERROR - get_network_driver - Failed: cannot import name 'system'

================= Traceback =================

Traceback (most recent call last):
File "/opt/netbox/venv/bin/napalm", line 8, in
sys.exit(main())
File "/opt/netbox/venv/lib64/python3.6/site-packages/napalm/base/clitools/cl_napalm.py", line 308, in main
run_tests(args)
File "/opt/netbox/venv/lib64/python3.6/site-packages/napalm/base/clitools/cl_napalm.py", line 268, in run_tests
driver = call_get_network_driver(args.vendor)
File "/opt/netbox/venv/lib64/python3.6/site-packages/napalm/base/clitools/cl_napalm.py", line 27, in wrapper
r = func(*args, **kwargs)
File "/opt/netbox/venv/lib64/python3.6/site-packages/napalm/base/clitools/cl_napalm.py", line 170, in call_get_network_driver
return get_network_driver(vendor)
File "/opt/netbox/venv/lib64/python3.6/site-packages/napalm/base/init.py", line 95, in get_network_driver
raise e
File "/opt/netbox/venv/lib64/python3.6/site-packages/napalm/base/init.py", line 86, in get_network_driver
module = importlib.import_module(module_name)
File "/usr/lib64/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in _call_with_frames_removed
File "/opt/netbox/venv/lib64/python3.6/site-packages/napalm_aoscx/init.py", line 16, in
from napalm_aoscx.aoscx import AOSCXDriver
File "/opt/netbox/venv/lib64/python3.6/site-packages/napalm_aoscx/aoscx.py", line 52, in
from pyaoscx import session, interface, system, common_ops, port, lldp, mac
ImportError: cannot import name 'system'

Am I missing something here?

I do have the requierements installed, pyaoscx, requests and urllib3 and Python is version 3.6.8 runnign on CentOS Linux release 8.4.2105.

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.