-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add the vlan_mask fixture #14
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,4 +94,10 @@ def inner(count): | |
@pytest.fixture(scope='class') | ||
def vlan_addr(vlan, addr_family): | ||
'''Return the correct ip address for the macvlan interface''' | ||
return vlan.get_address(addr_family).compressed | ||
return vlan.get_address(addr_family)[0].compressed | ||
|
||
|
||
@pytest.fixture(scope='class') | ||
def vlan_mask(vlan, addr_family): | ||
'''Return the correct network mask for the macvlan interface''' | ||
return vlan.get_address(addr_family)[1] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First, this isn't the mask - its the prefix. And I don't think you should add this fixture.
But we have a lot of tests that ask for 5 more, for example, and this change will break them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't do this. This is a list for a reason - its possible to have multiple addresses per network interface. You can't just shove whatever extra data you want in here just because.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addr
is already anipaddress.IPv4Address
/ipaddress.IPv6Address
- we useipaddress.ip_address
to parse it.It would make much more sense to just mixin the prefix information and use
ipaddress.ip_interface
instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, we probably should just mark this method as deprecated and introduce a new method that returns interfaces instead of addresses.