I am in need of some guidance on developing a plugin for Aerohive wireless access points. I feel like I am very close to making this all work, but I am stuck and would appreciate any assistance that you can provide. I have included all of the .py files as well as error output from the execution of my playbook.
Here’s what I’ve done so far:
*disclaimer, I chose the ios.py files simply due to the fact that interacting with the cli on the APs is very similar to interacting with the Cisco cli
- Copied the ios.py files in the action, cliconf, and terminal plugin directories and renamed them to hiveos.py. I have heavily modified the contents of the files essentially doing find/replace on ios for hiveos
- In the module_utils/network directory I created a hiveos directory and added a copy of ios.py (renamed to hiveos.py) and init.py files - again, lots of find/replace on ios for hiveos.
- In the base.yml file I added hiveos to the NETWORK_GROUP_MODULES default list
- Copied ios_facts.py and init.py into /modules/network/hiveos and renamed to hiveos_facts.py. Heavily modified to get hiveos specific info.
- Created a playbook that executes the hiveos_facts module against an AP.
- Now I’m stuck
Essentially what happens is Ansible connects to the AP and logs in successfully. It changes the console page length to 0 and then bombs.
There are two spots so far that I don’t understand how they work in the original ios_facts.py files:
-
In the file located at /module_utils/network/ios there is the following:
.
.
from ansible.module_utils.basic import env_fallback, return_values
.
.
When I ran my playbook it bombed saying that return_values can’t be imported. I went in and looked at the basic.py file to see what return_values was doing and I can’t find it anywhere. I’m using VS Code as my Python IDE and flake8 is saying that return_values is imported but unused (even in the original, unmodified ios.py file). When I run ios_facts (instead of hiveos_facts) everything works - Ansible doesn’t bomb in this module. -
In the file located at /module_utils/network/hiveos there is the following:
.
.
capabilities = Connection(module._socket_path).get_capabilities()
.
.
When I run my playbook it bombs at this spot. I went and looked at the connection.py file and, again, I don’t see any function called get_capabilities(). Again, the ios_facts module has no issues with this. I can’t find any information on what exactly this is supposed to be pulling back from the device.
Thanks for any assistance you can provide.
Dennis
I’m running my ansible host on CentOS 7
[root@localhost ansible]# ansible --version
ansible 2.8.2
config file = /root/ansible/ansible.cfg
configured module search path = [u’/root/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Jun 20 2019, 20:27:34) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
(attachments)
hiveos-plugin.zip (24.5 KB)