Provides a system to determine available interfaces in a range#812
Provides a system to determine available interfaces in a range#812abates wants to merge 2 commits intonetworktocode:developfrom
Conversation
| up to (but not including) the next cut point. The final slice contains all | ||
| remaining interface names from the last cut point to the end of the sorted list. This |
There was a problem hiding this comment.
This makes sense to me, but in my mind should also be extended to start. Having to always define the first element (Ethernet1 in tests below) seems off to me.
I could understand either both start and end needing to be explicit or neither being explicit, but start being explicit and end being implicit is a bit confusing to me.
|
Suggestions for an API enhancement... using Full-disclosure, I'm the Don't fear the GPL in my case... if I was going to fuss about GPL viral licensing, Cisco would already be hot sauce for using it all over the place with non-GPL licensing. ❯ python
Python 3.13.0 (main, Dec 1 2024, 17:40:20) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from ciscoconfparse2 import CiscoRange
>>>
>>> intfs = CiscoRange("Ethernet2-4,6-8")
>>> for intf in intfs:
... print(intf)
...
Ethernet2
Ethernet3
Ethernet4
Ethernet6
Ethernet7
Ethernet8
>>>
>>> CiscoRange("Ethernet2-4") in intfs
True
>>>
>>> CiscoRange("Ethernet47-48") in intfs
False
>>> |
|
@mpenning wanted to start with a quick thanks for your open source contributions! Appreciate and notice all of your hard work over the years
Our lawyers say otherwise, so while I understand the spirit of what you are saying, in practice my hands our tied. |
|
The point was twofold...
|
This request adds a method to slice lists of interfaces in order to facilitate provisioning. Sometimes upstream connections are placed within a given range of interfaces. For instance, a primary connection may always go in the range of Ethernet[1-24] and a secondary connection may go into Ethernet[25-48]. If a switch has all the interfaces Ethernet[1-48] available, then the two needed slices are returned. If a subset of needed interfaces are available, then only those interfaces in the subset are returned. For instance:
will effectively produce: