# Developing plugin for Aerohive wireless access points - need another set of eyes

**URL:** <https://forum.ansible.com/t/developing-plugin-for-aerohive-wireless-access-points-need-another-set-of-eyes/30815>\
**Category:** Ansible Developer\
**Created:** [July 19, 2019, 1:40am UTC](https://forum.ansible.com/t/developing-plugin-for-aerohive-wireless-access-points-need-another-set-of-eyes/30815 "2019-07-19T01:40:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DT1](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@DT1](https://forum.ansible.com/u/DT1)\
**Post date:** [July 19, 2019, 1:40am UTC](https://forum.ansible.com/t/developing-plugin-for-aerohive-wireless-access-points-need-another-set-of-eyes/30815/1 "2019-07-19T01:40:18Z")

</div>

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

1. 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
2. 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.
3. In the base.yml file I added hiveos to the NETWORK\_GROUP\_MODULES default list
4. Copied ios\_facts.py and **init**.py into /modules/network/hiveos and renamed to hiveos\_facts.py. Heavily modified to get hiveos specific info.
5. Created a playbook that executes the hiveos\_facts module against an AP.
6. 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:

1. 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.

2. 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](https://forum.ansible.com/uploads/short-url/6eTM1NtTtPVBPW7Dk3UToy3fUiZ.zip) (24.5 KB)

---

<div class="post-metadata">

**Author:** ![sdoran](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@sdoran](https://forum.ansible.com/u/sdoran)\
**Post date:** [July 22, 2019, 9:44pm UTC](https://forum.ansible.com/t/developing-plugin-for-aerohive-wireless-access-points-need-another-set-of-eyes/30815/2 "2019-07-22T21:44:14Z")

</div>

Dennis,

I think it’s great you’re working on this. I am a long time Aerohive user and these modules would be very handy.

Starting with the IOS modules as a base brings along a lot of extra cruft you won’t need. Those are the oldest modules and require the most work arounds due to variations between versions of IOS. HiveOS is much cleaner (mainly because it’s a newer OS) and should not need nearly as much code.

I would look at the EdgeOS and VyOS plugins and modules as much simpler and cleaner examples to follow.

I [pared down the attached plugins](https://gist.github.com/samdoran/8de48b29dfe8ce1a85dfc0decf73f08b) and managed to get them working. This may be a better starting point for you (though I’m sure there is still a lot more refinement that can take place).

Have a look at this article on [Developing network\_cli Platforms](https://github.com/ansible/community/blob/master/group-network/network_dev_network_cli.rst#action-plugin). It provides a good overview of the pieces needed for new platforms. Also look at [network connection plugins](https://docs.ansible.com/ansible/latest/network/dev_guide/developing_plugins_network.html#developing-modules-network) in the developer docs.

---

<div class="post-metadata">

**Author:** ![sdoran](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@sdoran](https://forum.ansible.com/u/sdoran)\
**Post date:** [July 23, 2019, 1:51pm UTC](https://forum.ansible.com/t/developing-plugin-for-aerohive-wireless-access-points-need-another-set-of-eyes/30815/3 "2019-07-23T13:51:17Z")

</div>

Dennis,

Developing network modules and plugins is much more challenging than standard modules and plugins due to all the moving parts. But once you get the terminal and cliconf plugins ironed out, it becomes much easier to focus on the logic involved in specific modules.

I would start with hiveos\_facts and hiveos\_command modules. From there you could create a generic hiveos\_config module that looks for lines in the config, or you could create modules like hiveos\_ssid, hiveos\_radio\_profile, hiveos\_user, hiveos\_group, hiveos\_user\_profile, etc. that take parameters and ensure the necessary config is set on the device without forcing the user to know the specific command syntax.

You can always reach out in #ansible-devel or #ansible-network on IRC for more help, or we can continue the discussion here. Whatever is easiest for you.
