Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interface range exponsion with ending "/1" #204

Closed
indy-independence opened this issue Feb 8, 2023 · 2 comments
Closed

interface range exponsion with ending "/1" #204

indy-independence opened this issue Feb 8, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@indy-independence
Copy link

Environment

  • Python version: 3.7.3
  • netutils version: 1.4.0

Expected Behavior

range expansion works for [49-50]/1 in same way as 1/[49-50]

Observed Behavior

interface_range_expansion("Ethernet1/[49-50]")
['Ethernet1/49', 'Ethernet1/50']
interface_range_expansion("Ethernet[49-50]/1")
['Ethernet49', 'Ethernet50']

"/1" part is stripped away if it's on the end

Steps to Reproduce

  1. use interface_range_expansion()
@itdependsnetworks
Copy link
Contributor

thanks for the report!

@itdependsnetworks itdependsnetworks added the bug Something isn't working label Feb 9, 2023
@abates abates self-assigned this Feb 9, 2023
@abates
Copy link
Contributor

abates commented Feb 9, 2023

I have seen this behavior. I will work on a fix. However, in the mean time there is a workaround that may work for you:

>>> from netutils.interface import interface_range_expansion
>>> interface_range_expansion("Ethernet[49-50]/[1]")
['Ethernet49/1', 'Ethernet50/1']

Note the brackets around the [1]

@abates abates closed this as completed in b9a41a2 Feb 9, 2023
bminnix pushed a commit to bminnix/netutils that referenced this issue Feb 17, 2023
This change fixed a bug where interface_range_expansion would drop any trailing constant from a range expansion. For instance, `Ethernet[1-3]/1` would expand to `["Ethernet1", "Ethernet2", "Ethernet3"]` without the trailing `/1`

fixes networktocode#204
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants