napalm-automation-community / napalm-arubaos-switch Goto Github PK
View Code? Open in Web Editor NEWNAPALM driver for ArubaOS-Switch
License: MIT License
NAPALM driver for ArubaOS-Switch
License: MIT License
The documentation says this code works on:
AOS > WC.16.09.0004
Does it also work on:
AOS = YC.16.11
Getting the facts from Aruba Switch shows Firmware, Hostname etc.
Napalm is failing with error:
`2021-10-20 17:28:43,604 - napalm - ERROR - method - Failed: list index out of range
================= Traceback =================
Traceback (most recent call last):
File "/home/username/napalm/bin/napalm", line 8, in
sys.exit(main())
File "/home/username/napalm/lib64/python3.6/site-packages/napalm/base/clitools/cl_napalm.py", line 308, in main
run_tests(args)
File "/home/username/napalm/lib64/python3.6/site-packages/napalm/base/clitools/cl_napalm.py", line 291, in run_tests
call_getter(device, args.method, **method_kwargs)
File "/home/username/napalm/lib64/python3.6/site-packages/napalm/base/clitools/cl_napalm.py", line 27, in wrapper
r = func(*args, **kwargs)
File "/home/username/napalm/lib64/python3.6/site-packages/napalm/base/clitools/cl_napalm.py", line 255, in call_getter
r = func(**kwargs)
File "/home/username/napalm/lib64/python3.6/site-packages/napalm_arubaoss/ArubaOS.py", line 260, in get_facts
rest_out['dns_domain_names'][0]
IndexError: list index out of range
`
napalm --user <username --password <password --vendor arubaoss <hostname> call get_facts
ip dns domain-name <yourdomainnamehere>
Aruba Switch: JL320A 2930M-24G-PoE+
Software Version: WC.16.10.0016
Output from debug Ansible URI Module:
When "ip dns domain-name is configured:
"output.json": {
"dns_config_mode": "DCM_MANUAL",
"dns_domain_names": [
"mylocaldomain.de"
],
"server_1": null,
"server_2": null,
"server_3": null,
"server_4": null,
"uri": "/dns"
}
When ip dns domain-name is not configured:
"output.json": {
"dns_config_mode": "DCM_DHCP",
"dns_domain_names": [],
"server_1": null,
"server_2": null,
"server_3": null,
"server_4": null,
"uri": "/dns"
}
The current maintainers of this project have shifted priorities and cannot commit to keep this repo maintained. As such, we're looking for new maintainers for the driver.
Maybe @derpedda or @alagoutte are interested?
This is more of a question than an expectation. I'm attempting to use napalm-arubaos-switch with nornir (with multithreading). I'm seeing non-deterministic output and suspect that some part of the arubaoss napalm library is not thread-safe. I think the issue may arise from the way api connections are implemented. If this is the case, I expect it would be no simple task to rewrite; I'd just like to confirm whether I'm on the right track or if there's a gap in my understanding somewhere.
When called through Nornir, napalm-arubaos-switch exhibits seemingly non-deterministic behavior. Hosts will return the expected output some of the time, but then return empty dictionaries when the same script is run again immediately after. No errors are logged, no exceptions are raised, and the maximum number of https/rest sessions is not exceeded. The non-deterministic behavior affects all different devices in nornir's hosts.yml file; it is not isolated to one specific host. No host returns expected output 100% of the time.
nr = InitNornir(
runner={
"plugin": "threaded",
"options": {
"num_workers": 20,
},
},
inventory={
...
<SNIP>
...
)
results = nr.run(
task=napalm_get,
getters=["lldp_neighbors"]
)
print_result(results)
nr.close_connections()
get_lldp_neighbors needs to return PortDescr attribute instead of PortId, currenlty the PortID is returned which does not match in cases the switch is stacked.
Returns interface 3 instead of 1/3 for example.
When clicking to retrieve information from the switch, I am presented with the following error.
Error connecting to the device at 10.100.100.33: Could not find a suitable TLS CA certificate bundle, invalid path: False
This does not happen if I use the provided test python script which returns the full config as expected.
Any help would be appreciated
Executing compare_config
after load_replace_candidate
returns a list of added/removed configuration values.
Executing compare_config
after load_replace_candidate
always returns a empty list.
I think the issue is here: https://github.com/napalm-automation-community/napalm-arubaos-switch/blob/development/napalm_arubaoss/helper/compare_config.py
The switch requires some time to compute the difference. If I add a sleep time between the two API calls in the function, everything works as expected. Currently, 2 sec seems to be enough.
Unfortunately, I have not found a way to check whether the diff is ready. On our switch, the rest API system/config/cfg_restore/latest_diff
always returns a status CRS_IN_PROGRESS
but never CRS_SUCCESS
.
Is it possible to add an optional argument to specify a sleep time for the compare_config function?
Both IPv4 and IPv6 addresses configured on the switch are returned after the API call
Only IPv4 addresses are returned
1.Configure IPv4 and IPv6 addresses on VLAN x
2. HTTP GET https:///rest/v7/ipaddresses
3. Only ipv4 addresses are returned
Test suite passes.
[ 26s] + export PATH=/home/abuild/rpmbuild/BUILD/napalm-arubaos-switch-0.2.0/build/flavorbin:/usr/local/bin:/usr/bin:/bin
[ 26s] + PATH=/home/abuild/rpmbuild/BUILD/napalm-arubaos-switch-0.2.0/build/flavorbin:/usr/local/bin:/usr/bin:/bin
[ 26s] ++ '[' -f _current_flavor ']'
[ 26s] ++ cat _current_flavor
[ 26s] + last_flavor=python310
[ 26s] + '[' -z python310 ']'
[ 26s] + '[' python310 '!=' python38 ']'
[ 26s] + '[' -d build ']'
[ 26s] + mv build _build.python310
[ 26s] + '[' -d _build.python38 ']'
[ 26s] + mv _build.python38 build
[ 26s] + echo python38
[ 26s] + python_flavor=python38
[ 26s] + PYTHONPATH=/home/abuild/rpmbuild/BUILDROOT/python-napalm-arubaos-switch-0.2.0-0.x86_64/usr/lib/python3.8/site-packages
[ 26s] + PYTHONDONTWRITEBYTECODE=1
[ 26s] + pytest-3.8 --ignore=_build.python38 --ignore=_build.python39 --ignore=_build.python310 -v -v -k 'not (test_traceroute)'
[ 27s] ============================= test session starts ==============================
[ 27s] platform linux -- Python 3.8.16, pytest-7.1.2, pluggy-1.0.0 -- /usr/bin/python3.8
[ 27s] cachedir: .pytest_cache
[ 27s] metadata: {'Python': '3.8.16', 'Platform': 'Linux-6.1.1-1-default-x86_64-with-glibc2.34', 'Packages': {'pytest': '7.1.2', 'pluggy': '1.0.0'}, 'Plugins': {'anyio': '3.6.2', 'metadata': '2.0.4', 'json-report': '1.5.0', 'cov': '4.0.0'}}
[ 27s] rootdir: /home/abuild/rpmbuild/BUILD/napalm-arubaos-switch-0.2.0, configfile: setup.cfg, testpaths: test
[ 27s] plugins: anyio-3.6.2, metadata-2.0.4, json-report-1.5.0, cov-4.0.0
[ 28s] collecting ... collected 40 items / 1 deselected / 39 selected
...
[ 29s] =================================== FAILURES ===================================
[ 29s] ______________________ TestGetter.test_method_signatures _______________________
[ 29s]
[ 29s] self = <test.unit.test_getters.TestGetter object at 0x7face23c8490>
[ 29s]
[ 29s] def test_method_signatures(self):
[ 29s] """
[ 29s] Test that all methods have the same signature.
[ 29s]
[ 29s] The type hint annotations are ignored here because the import paths might differ."""
[ 29s] errors = {}
[ 29s] cls = self.driver
[ 29s] # Create fictional driver instance (py3 needs bound methods)
[ 29s] tmp_obj = cls(hostname="test", username="admin", password="pwd")
[ 29s] attrs = [m for m, v in inspect.getmembers(tmp_obj)]
[ 29s] for attr in attrs:
[ 29s] func = getattr(tmp_obj, attr)
[ 29s] if attr.startswith("_") or not inspect.ismethod(func):
[ 29s] continue
[ 29s] try:
[ 29s] orig = getattr(NetworkDriver, attr)
[ 29s] orig_spec = inspect.getfullargspec(orig)[:4]
[ 29s] except AttributeError:
[ 29s] orig_spec = "Method does not exist in napalm.base"
[ 29s] func_spec = inspect.getfullargspec(func)[:4]
[ 29s] if orig_spec != func_spec:
[ 29s] errors[attr] = (orig_spec, func_spec)
[ 29s]
[ 29s] EXTRA_METHODS = ["__init__"]
[ 29s] for method in EXTRA_METHODS:
[ 29s] orig_spec = inspect.getfullargspec(getattr(NetworkDriver, method))[:4]
[ 29s] func_spec = inspect.getfullargspec(getattr(cls, method))[:4]
[ 29s] if orig_spec != func_spec:
[ 29s] errors[attr] = (orig_spec, func_spec)
[ 29s]
[ 29s] > assert not errors, "Some methods vary. \n{}".format(errors.keys())
[ 29s] E AssertionError: Some methods vary.
[ 29s] E dict_keys(['cli'])
[ 29s]
[ 29s] /usr/lib/python3.8/site-packages/napalm/base/test/getters.py:141: AssertionError
[ 29s] ______________________ TestGetter.test_get_facts[normal] _______________________
[ 29s]
[ 29s] self = <test.unit.test_getters.TestGetter object at 0x7face23bd5e0>
[ 29s] test_case = 'normal'
[ 29s]
[ 29s] @wrap_test_cases
[ 29s] def test_get_facts(self, test_case):
[ 29s] """Test get_facts method."""
[ 29s] facts = self.device.get_facts()
[ 29s] > assert helpers.test_model(models.FactsDict, facts)
[ 29s] E AssertionError
[ 29s]
[ 29s] /usr/lib/python3.8/site-packages/napalm/base/test/getters.py:154: AssertionError
[ 29s] _______________________ TestGetter.test_get_facts[stack] _______________________
[ 29s]
[ 29s] self = <test.unit.test_getters.TestGetter object at 0x7face23bdd30>
[ 29s] test_case = 'stack'
[ 29s]
[ 29s] @wrap_test_cases
[ 29s] def test_get_facts(self, test_case):
[ 29s] """Test get_facts method."""
[ 29s] facts = self.device.get_facts()
[ 29s] > assert helpers.test_model(models.FactsDict, facts)
[ 29s] E AssertionError
[ 29s]
[ 29s] /usr/lib/python3.8/site-packages/napalm/base/test/getters.py:154: AssertionError
[ 29s] =============================== warnings summary ===============================
[ 29s] ../../../../../usr/lib/python3.8/site-packages/_pytest/config/__init__.py:1252
[ 29s] /usr/lib/python3.8/site-packages/_pytest/config/__init__.py:1252: PytestConfigWarning: Unknown config option: json_report
[ 29s]
[ 29s] self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
[ 29s]
[ 29s] ../../../../../usr/lib/python3.8/site-packages/_pytest/config/__init__.py:1252
[ 29s] /usr/lib/python3.8/site-packages/_pytest/config/__init__.py:1252: PytestConfigWarning: Unknown config option: jsonapi
[ 29s]
[ 29s] self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
[ 29s]
[ 29s] -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
[ 29s]
[ 29s] ---------- coverage: platform linux, python 3.8.16-final-0 -----------
[ 29s] Name Stmts Miss Cover Missing
[ 29s] -----------------------------------------------------------------------------------
[ 29s] napalm_arubaoss/ArubaOS.py 141 31 78% 71-72, 75, 94-96, 116-118, 126-128, 138, 147, 155, 163-166, 504, 512-514, 529-533, 551-555, 569, 577-585, 620, 628, 636-638, 651-653
[ 29s] napalm_arubaoss/__init__.py 2 0 100%
[ 29s] napalm_arubaoss/helper/__init__.py 24 0 100%
[ 29s] napalm_arubaoss/helper/base.py 97 68 30% 50-101, 105-114, 124-126, 136-138, 148-150, 160-162, 171-192, 205-227, 236-237
[ 29s] napalm_arubaoss/helper/commit_config.py 27 19 30% 26-60
[ 29s] napalm_arubaoss/helper/compare_config.py 22 17 23% 19-52
[ 29s] napalm_arubaoss/helper/confirm_commit.py 10 4 60% 19-23
[ 29s] napalm_arubaoss/helper/get_arp_table.py 16 0 100%
[ 29s] napalm_arubaoss/helper/get_config.py 13 2 85% 19-21
[ 29s] napalm_arubaoss/helper/get_facts.py 37 0 100%
[ 29s] napalm_arubaoss/helper/get_interfaces.py 43 5 88% 28-29, 32-33, 56
[ 29s] napalm_arubaoss/helper/get_interfaces_ip.py 22 0 100%
[ 29s] napalm_arubaoss/helper/get_lldp_neighbors.py 15 0 100%
[ 29s] napalm_arubaoss/helper/get_lldp_neighbors_detail.py 15 0 100%
[ 29s] napalm_arubaoss/helper/get_mac_address_table.py 12 0 100%
[ 29s] napalm_arubaoss/helper/get_ntp_servers.py 16 0 100%
[ 29s] napalm_arubaoss/helper/get_ntp_stats.py 33 9 73% 29-38, 58, 74
[ 29s] napalm_arubaoss/helper/get_route_to.py 33 6 82% 68-83, 103
[ 29s] napalm_arubaoss/helper/has_pending_commit.py 9 5 44% 18-24
[ 29s] napalm_arubaoss/helper/is_alive.py 9 5 44% 16-22
[ 29s] napalm_arubaoss/helper/load_merge_candidate.py 13 8 38% 25-36
[ 29s] napalm_arubaoss/helper/load_replace_candidate.py 14 9 36% 28-37
[ 29s] napalm_arubaoss/helper/ping.py 15 1 93% 25
[ 29s] napalm_arubaoss/helper/rollback.py 11 6 45% 18-25
[ 29s] napalm_arubaoss/helper/traceroute.py 23 19 17% 17-55
[ 29s] napalm_arubaoss/helper/utils.py 61 46 25% 19-20, 30-32, 43-62, 79-101, 112-122, 133-140
[ 29s] -----------------------------------------------------------------------------------
[ 29s] TOTAL 733 260 65%
[ 29s]
[ 29s] =========================== short test summary info ============================
[ 29s] FAILED test/unit/test_getters.py::TestGetter::test_method_signatures - Assert...
[ 29s] FAILED test/unit/test_getters.py::TestGetter::test_get_facts[normal] - Assert...
[ 29s] FAILED test/unit/test_getters.py::TestGetter::test_get_facts[stack] - Asserti...
[ 29s] ====== 3 failed, 21 passed, 15 skipped, 1 deselected, 2 warnings in 1.88s ======
Complete build log with all details of packages used and steps taken.
When executing:
pip install napalm-arubaoss-switch
in a python3 virtual environment, there are errors when trying to build cryptography-4.0
=============================DEBUG ASSISTANCE=============================
If you are seeing a compilation error please try the following steps to
successfully install cryptography:
1) Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
2) Read https://cryptography.io/en/latest/installation/ for specific
instructions for your platform.
3) Check our frequently asked questions for more information:
https://cryptography.io/en/latest/faq/
4) Ensure you have a recent Rust toolchain installed:
https://cryptography.io/en/latest/installation/#rust
Python: 3.10.11
platform: OpenBSD-7.3-amd64-64bit-ELF
pip: n/a
setuptools: 67.7.2
setuptools_rust: 1.6.0
rustc: 1.68.0 (2c8cc3432 2023-03-06) (built from a source tarball)
=============================DEBUG ASSISTANCE=============================
error: `cargo rustc --lib --message-format=json-render-diagnostics --manifest-path src/rust/Cargo.toml --release -v --features 'pyo3/extension-module pyo3/abi3-py36' --crate-type cdylib --` failed with code 101
[end of output]
...
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cryptography
Building wheel for MarkupSafe (pyproject.toml) ... done
Created wheel for MarkupSafe: filename=MarkupSafe-2.1.2-cp310-cp310-openbsd_7_3_amd64.whl size=21289 sha256=efac044a7718171b686aa522803b17f034532b052440638154c7b60752367c9b
Stored in directory: /home/russ/.cache/pip/wheels/54/8e/98/3c8a462676f35ac84e7e2a886d2e90c50c796b73f4cd1f351f
Building wheel for pynacl (pyproject.toml) ... done
Created wheel for pynacl: filename=PyNaCl-1.5.0-cp310-cp310-openbsd_7_3_amd64.whl size=197885 sha256=1204e8174fe6ee5095efad10976852af9841a024c55c6b6542334113f15ada90
Stored in directory: /home/russ/.cache/pip/wheels/d6/b6/aa/ee9c8cff9b446cde8825a5c7d5be57a8312c7ef3eed7c47843
Building wheel for yamlordereddictloader (pyproject.toml) ... done
Created wheel for yamlordereddictloader: filename=yamlordereddictloader-0.4.0-py3-none-any.whl size=4053 sha256=4247f2b6fcef198da03a3ae28414473fc9cccfa0945f57edb95ee75d50378b2a
Stored in directory: /home/russ/.cache/pip/wheels/36/ab/cc/b583bb9d8c269b27a6b7bdc6e766588db00f79d8754774fe0d
Successfully built napalm-arubaos-switch cffi ncclient lxml pyeapi pyYAML bcrypt MarkupSafe pynacl yamlordereddictloader
Failed to build cryptography
ERROR: Could not build wheels for cryptography, which is required to install pyproject.toml-based projects
Load configuration files larger than 16kbytes should be allowed if the configuration is valid for the given platform.
If the configuration file is larger than 16kbytes, load fails with HTTP error 413
Method: load_candidate()
API: /rest/v7/system/config/payload
When: payload is larger than 16008 bytes
Aruba confirmed that it's currently only supporting payload of max 16k bytes. They are working in removing this limitation under CR id #241093, and it's expected to ship by the end of June 2020.
Expected changes in 16.10:
somewhat related to HPE bug CR_0000247435.
After loading a config payload with include-credentials
, encrypt-credentials
or hide-sensitive-data
, every sub-subsequent request fails with 400 Bad Req.
After cfg-restored is run, the same behavior is seen.
So far, reconnecting after the load_replace_candidate()
and compare_config()
seems to work, but there's no reliable status code for those events.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.