gilesknap / maaspower

Provide MAAS power control via webhooks for various remote control power switches.
Apache License 2.0
18 stars 13 forks source link

Add support for Cisco IOS PoE Switches #24

Closed Banshee1221 closed 3 months ago

Banshee1221 commented 3 months ago

This PR contains code to add support for Cisco IOS PoE Switches. I've tested this on a Cisco Catalyst 2960X (WS-C2960X-24PS-L). I don't have access to any other Cisco switches at this stage, so unsure if they will work but I think many, if not most should.

I've also run the complete project through the linting process and updated some of the files based on styling recommendations.

Please let me know if I've missed anything!

Banshee1221 commented 3 months ago

I see that the tests for Python 3.11 and 3.12 failed due to a library that is used by netmiko that is deprecated.

This is unfortunate. There is an open issue about it at the netmiko repository: https://github.com/ktbyers/netmiko/issues/3177

I suppose that if we want it to pass here I might have to rewrite with a different library :/

We could possible ignore this deprecation for 3.11 and 3.12 as it's only slated for removal in 3.13.

gilesknap commented 3 months ago

This looks great - thanks!

I'm going to merge with CI errors which are just about telnet builtin library deprecation.

Reason being is that I'm going to update the python project framework to our latest and then turn off the deprecation warning. (rather than remembering how to do it the old way!)

gilesknap commented 3 months ago

OK @Banshee1221 I've modernized the project (when I made this we were still using pipenv - ugh!). See https://github.com/gilesknap/maaspower/pull/25

Please can you verify that your PoE device support is still working and that your docs you added look good.

Then I'll merge.

@lbunge I'll also take a look at your https://github.com/gilesknap/maaspower/pull/22 because this will likely have fixed the CI issues.

Thanks both.

gilesknap commented 3 months ago

Oh and @Banshee1221 I had to turn off error on DepricationWarning for telnetlib.

This is a dependency of netmiko that you added. Hopefully they will get rid of that before python 3.13 releases because they are dropping telnet standard lib at that point.

I have personally converted a project from to telnetlib3 and it was non-trivial AFAIR

Banshee1221 commented 3 months ago

Perfect, thanks. I'll try to get some time together to verify the PoE device support ASAP. 👍

Banshee1221 commented 3 months ago

@gilesknap I've pulled your adopt-copier branch for #25 and all of the functionality (on, on w/ static wattage, off and query) for my switch appears functional ✅

gilesknap commented 3 months ago

@Banshee1221 that's great, thanks for taking a look.