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
disable :T2372: disable sub-interface if parent is #383
Conversation
python/vyos/configdict.py
Outdated
@@ -98,192 +103,339 @@ def get_ethertype(ethertype_val): | |||
raise ConfigError('invalid ethertype "{}"'.format(ethertype_val)) | |||
|
|||
|
|||
def vlan_to_dict(conf): | |||
vlan_default = { | |||
# get the '100' in 'interfaces bonding bond0 vif-s 100' |
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.
What do you mean with this comment?
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.
leftover from line 109 ..
python/vyos/configdict.py
Outdated
act_eui = conf.return_values('ipv6 address eui64') | ||
|
||
# Determine interface addresses (currently effective) - to determine which | ||
# address is no longer valid and needs to be removed from the bond |
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.
I guess bond here is just a leftover.
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.
Yes, this comment is also a left-over !
I really like the idea and besides those two small comments all looks good to me. Less duplicated code! |
""" | ||
Common used function which will extract VLAN related information from config | ||
and represent the result as Python dictionary. | ||
|
||
Function call's itself recursively if a vif-s/vif-c pair is detected. | ||
""" | ||
vlan = { | ||
'id': conf.get_level()[-1], # get the '100' in 'interfaces bonding bond0 vif-s 100' |
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.
@c-po this left over.
@thomas-mangin one of us will need to rebase our changes as we were working on the same code. Look at my PR. Does this work fine regarding the link-local address code? |
@thomas-mangin can you please fox the leftovers? |
implement disable_state which looks if the current node, or some designated parent node are set are 'disable' and thefore should be ignored. break down the function vlan_to_dict in it multiple components add_to_dict which can parse vif, vif-s, or vif-c and add them to the configuration dictionary intf_to_dict which setup a base configuration dictionary from the interface Config() with addresses, arp, disable, ... it is used by vlan_to_dict but can and will be used by other interfaces
use intf_to_dict and add_to_dict to correctly implement disable.
use intf_to_dict and add_to_dict to correctly implement disable. keeping all interface code with VLAN the same.
use intf_to_dict and add_to_dict to correctly implement disable. keeping all interface code with VLAN the same.
I fixed the two comments |
The patchset rewrites the vlan_to_dict code so that if an interface is disabled, all the VLAN of that interface are also disabled (admin down).
The code creates a new helper function to look for the disable option in parent interfaces.
It also refactor much of the dictionary generation for interfaces and VLANs (as they are indicatical, and create a helper function to parse vif, vif-s, vif-c.