Add support for Airos in OpenWISP2
This PR is now closed as the work has been included in an external package, netjsonconfig-airos and will be available from the next release (v0.6.3)
this is the airos v8.3 backend as of today
- tests are ok for both python2 and python3
I will go on with squashing commits where possible to keep size down
Another important things to do is to implement the backward_conversion for the radio converter as of now the radio configuration values are mostly hardware dependents. This may be superseded by an approach where the user writes a very verbose netjson with lots of additional values for the radio object.
Coverage decreased (-3.2%) to 96.737% when pulling 7c8e27bb34476e1b4cc70b398345cb8df33d3728 on airos into a37cdeab7454ee44e6f055b38042127654e22d84 on master.
I'm attaching a diff between the "default configuration" (reset the antenna and enable advanced network configuration) and the default netjson
there are minimal differencies except for the radio section , the one not implemented in netjsonconfig.
I'll go over other configurations (station+wpa2 personal, ap,...) and post the diff later
PS: the travis build is failing
#98 fixed, rebase on master again please
this is definitely very strange, not the bug but the behaviour.
I'll try and see if more pops up
2017-08-29 16:10 GMT+02:00 Federico Capoano [email protected]:
@nemesisdesign requested changes on this pull request.
see my inline comments related (related to issue #97 https://github.com/openwisp/netjsonconfig/issues/97)
In netjsonconfig/backends/airos/interface.py https://github.com/openwisp/netjsonconfig/pull/91#discussion_r135800491:
- """
- return interface['wireless']['encryption']['key']
+def radio(interface):
- """
- Return wireless interface's radio name
- """
- return interface['wireless']['radio']
+def split_cidr(address):
- """
- Return the address in dict format
- """
- network = ip_interface('{addr}/{mask}'.format(addr=address['address'], mask=address['mask']))
this line is causing the build to fail on python2, see #97 https://github.com/openwisp/netjsonconfig/issues/97 and related fix 61801a1 https://github.com/openwisp/netjsonconfig/commit/61801a12f20358925e04185ef7be9307addf6d39, I suggest you to apply a similar fix
In netjsonconfig/backends/airos/converters.py https://github.com/openwisp/netjsonconfig/pull/91#discussion_r135800648:
'gateway': address['gateway'],
'ip': '0.0.0.0','netmask': 0,'status': 'enabled',})except KeyError:passreturn result- def to_intermediate(self):
result = []routes = []routes = self.default_routes()original = get_copy(self.netjson, self.netjson_key, [])for r in original:network = ip_interface(r['destination'])this line is causing the build to fail on python2, see #97 https://github.com/openwisp/netjsonconfig/issues/97 and related fix 61801a1 https://github.com/openwisp/netjsonconfig/commit/61801a12f20358925e04185ef7be9307addf6d39, I suggest you to apply a similar fix
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openwisp/netjsonconfig/pull/91#pullrequestreview-59252996, or mute the thread https://github.com/notifications/unsubscribe-auth/AD4zuRCdPVt455hBPEZNmqT0Kp935rFuks5sdBvrgaJpZM4OY-yp .
this should be it, there are no more failing tests in python2 and let's hope it doesn't change python3 outcome
@EdoPut isort check failed
Coverage decreased (-1.04%) to 98.887% when pulling 309e712bc2a544ac12c4c6ea2b5e6a0a49994e44 on airos into a2611ef79fea147c363851661cb8fa421d430ba7 on master.
@edoput this code can be used as a good starting point for future work, or we may resume it together as well when I have cleared out some urgent matters and in case you want to dedicate some more time on it.
Can we leave it open or do you have anything against this?
Hey, I extracted this work to a different package that can be imported at runtime with my last contribution
This PR is now closed as the work has been included in an external package, netjsonconfig-airos and will be available from the next release (v0.6.3)
Right now is still sitting there as testing on hardware is still too hard but we can manage to include it better in the openwisp controller.
Because the code has been migrated I think that the discussion should too.
I edited the top comment to explain what happened but didn't leave an explanation at the bottom.
@edoput that's great! What about the docs you wrote? Maybe those could go in your README?
We should also find a way to give visibility to your package somehow, so the chances to find somebody who will help us out will increase. We could do 2 things: add a new page in the netjsonconfig docs which links your package; show this PR in the contributors board, I just did that.