summaryrefslogtreecommitdiff
path: root/python/vyos/configdict.py
AgeCommit message (Collapse)Author
2020-09-22ifconfig: T2653: bond: bridge: ensure member interface is not a source-interfaceChristian Poessinger
As we already check that a bond/bridge member interface is not a member of any other bridge or bond, the check must be extended. We also need to ensure that the bond member interface is not used as a source-interface to pppoe, macsec, tunnel, pseudo-ethernet, vxlan interfaces.
2020-09-22ifconfig: T2653: move is_member() from vyos.vylidate to vyos.configdictChristian Poessinger
2020-09-20vyos.configdict: T2665: cleanup get_interface_dict() default dict handlingChristian Poessinger
2020-09-15vyos.configdict: T2515: leaf_node_changed() should return list or NoneChristian Poessinger
2020-08-31T2636: remove workarounds for get_config_dict()Christian Poessinger
Now that b40c52682a256 ("config: T2636: get_config_dict() returns a list on multi node by default") is implemented the workarounds can be removed.
2020-08-23T2755: convert jmespath.search() to vyos_dict_search() for performanceChristian Poessinger
2020-08-22dhcpv6-pd: T2677: optimize CLI interface for PD configurationChristian Poessinger
The current CLI did not support multiple prefix-delegations per interface. Some ISPs only send one /64 to a client per prefix-delegation request, but they allow the customer to request multiple prefixes. The 'dhcpv6-options prefix-delegation' node has been renamed and converted to a tag node named 'dhcpv6-options pd'. The tag node specifies a PD request (>=0). In the past the user needed to know what prefix will be assigned and required to calculate the sla-len by himself. The 'sla-len' node was dropped and is now calculated in the background from the 'dhcpv6-options pd 0 length' node. It is no longer mandatory to supply the 'sla-id' node, if sla-id is not specified it is 'guessed' by counting upwards. Example configuration: ---------------------- ethernet eth1 { address dhcpv6 dhcpv6-options { pd 0 { length 56 interface eth2 { address 1 } } } } This will request a /56 assignment from the ISP and will delegate a /64 network to interface eth2. VyOS will use the interface address ::1 on the delegate interface (eth2) as its local address.
2020-08-15vyos.configdict: keep is_member import as local as possibleChristian Poessinger
2020-07-25ifconfig: T2653: make ifname an optional argument to get_interface_dict()Christian Poessinger
Further reduce the boiler-plate code to determine interface tag node or not. It can be passed into get_interface_dict() if explicitly required - else it is taken from the environment.
2020-07-25vyos.configdict: T2653: remove obsolete code from configdict and ifconfig_vlanChristian Poessinger
After all interfaces have been moved to the targetted implementation of T2653 the old implementations of migrating a CLI session to a configuration dict can be dropped.
2020-07-25ifconfig: T2653: move get_ethertype() from configdict to interfaceChristian Poessinger
... as it is only used inside the interface class.
2020-07-25vlan: ifconfig: T2653: move get_removed_vlans() to vyos.configdiffChristian Poessinger
As we wrap up additional functions from this library it should be part of it.
2020-07-25vyos.configdict: T2653: use dict_merge() over update()Christian Poessinger
With dict.update() existing keys will get overwritten when blending in interface default values.
2020-07-25vyos.configdict: T2653: add new reusable helper node_changed()Christian Poessinger
This can be used to see if a tagNode has been changed. It will return a list of changed nodes.
2020-07-25bridge: ifconfig: T2653: move to get_config_dict()Christian Poessinger
The current VyOS CLI parser code written in Python contains a ton of duplicates which I can also hold myself accountable for - or maybe mainly me - depends on the angle of judge. While providing a new update() method in vyos.ifconfig.interfaces() this is extended for bridge interfaces in the derived bridge class. Signed-off-by: Christian Poessinger <christian@poessinger.com>
2020-07-25ethernet: ifconfig: T2653: move to get_config_dict()Christian Poessinger
The current VyOS CLI parser code written in Python contains a ton of duplicates which I can also hold myself accountable for - or maybe mainly me - depends on the angle of judge. While providing a new update() method in vyos.ifconfig.interfaces() this is extended for ethernet based interfaces which also supports 802.1q, 802.1ad VLANs. This commit migrates the existing codebase for an ethernet based interfaces and implements the missing parts for VLANs. Adding or migrating other interfaces (e.g. bridge or bond) will become much easier as they must reuse the entire functionality - we now walk towards a single codepath. Thanks for all who made this combined effort possible! Signed-off-by: Christian Poessinger <christian@poessinger.com>
2020-06-27ifconfig: T2653: move macsec interface to get_config_dict()Christian Poessinger
2020-06-26configdict: T2653: prevent recursive importsChristian Poessinger
2020-06-24dictconfig: T2637: identify sub-interfaces (vif) to deleteThomas Mangin
2020-06-18vyos: configdict: add dict_merge functionChristian Poessinger
Merge two dictionaries. Only keys which are not present in destination will be copied from source, anything else will be kept untouched. Function will return a new dict which has the merged key/value pairs. Before: {'device': {'usb0b2.4p1.0': {'speed': '9600'}, 'usb0b2.4p1.1': {'data-bits': '8', 'parity': 'none', 'speed': '115200', 'stop-bits': '2'}}} After: {'device': {'usb0b2.4p1.0': {'data-bits': '8', 'parity': 'none', 'speed': '9600', 'stop-bits': '1'}, 'usb0b2.4p1.1': {'data-bits': '8', 'parity': 'none', 'speed': '115200', 'stop-bits': '2'}}}
2020-06-06dhcpv6-pd: T2551: fixup configuration pathChristian Poessinger
Commit 728b1feaf744 ("dhcpv6-pd: T2551: fix prefix length not set in config") reworked the way the configuration path is accesses on the individual interfaces, but it was missed out to apply it correctly when reading in sla-len and sla-id values.
2020-06-06dhcpv6-pd: T2551: fix prefix length not set in configChristian Poessinger
Retrieving the CLI nodes from current config was missed out and only implemented for PPPoE.
2020-05-28dhcpc6-pd: T2506: bugfix config rendering on non PPPoE interfacesChristian Poessinger
After commit d5b58517f883 ("dhcpv6-pd: pppoe: T2506: restructure CLI") the CLI syntax has been adjusted for a better definition of DHCPv6-PD prefix length option. Verifying a properly rendered template indeed did not happen which cause the function to vanish for non PPPoE interfaces.
2020-05-26dhcpv6-pd: T2506: use common dictionary definition for config parametersChristian Poessinger
2020-05-26dhcpv6-pd: T2506: add option to request specific prefix lengthChristian Poessinger
Some ISPs (e.g. Comcast) only delegate a /64 by default. You have to explicitly "ask" for a bigger (e.g. /60) prefix. This commit adds a CLI node to request a specific prefix length in the range 32 - 64. dhcpv6-options { prefix-delegation { length 60 } }
2020-05-26dhcpv6-pd: pppoe: T2506: restructure CLIChristian Poessinger
Rename the CLI nodes for prefix delegation from "dhcpv6-options delegate <interface>" to "dhcpv6-options prefix-delegation interface <interface>". The change is required to add the possibility to request for specific prefix sized via the CLI. That option was not possible with the old configuration tree.
2020-05-19dhcpv6-pd: T421: support ethernet based interfacesChristian Poessinger
Add support for prefix delegation when receiving the prefix via ethernet, bridge, bond, wireless.
2020-05-19configdict: T2372: use list over stringChristian Poessinger
2020-05-19configdict: T2372: add new interface_default_data dictChristian Poessinger
Dictionary is used to remove the amount of duplicated code by e.g. ethernet or bridge interface.
2020-05-11vlan: T2449: set accept_ra on vlan interfacesJernej Jakob
2020-05-11configdict: T2449: set accept_ra=2 if ipv6 address autoconf or dhcpv6 is setJernej Jakob
To make SLAAC and DHCPv6 work when forwarding=1, accept_ra must be 2 (default for accept_ra is 1).
2020-05-05configdict: T2427: clarify code commentsJernej Jakob
2020-05-05vlan: T2427: convert vlan config variables from lists to dictsJernej Jakob
Previously all vlan configs, which are dicts, were appended to a simple list, with the distinguishing 'id' stored inside the dicts themselves. This worked, but wasn't ideal. This commit converts them to dicts, where the key is the VLAN ID and value the config dict of that VLAN. This makes it posible to access single VLANs by their ID (key) and we can for-loop and get both the ID and config with: 'for vif_id, vif in conf["vif"].items():'
2020-05-05configdict: T2427: do not remove all addresses when disabling interfaceJernej Jakob
Commit 3fdf0093a introduced code that removed all addresses from an interface when that interface is disabled. This is wrong, as other configured services may be listening on these addresses and may fail to start if their configured address isn't present. It also caused a commit error when applying dhcp-server configuration: DHCP server configuration error! None of configured DHCP subnets does not have appropriate primary IP address on any broadcast interface. This commit reverts it to prior behavior, which was to just put the interface admin down and leave all addresses configured, other than the IPv6 'fe80::EUI-64/64' link-local, which it deletes, as the interface may not have a MAC if it's put down.
2020-05-04configdict: T2241: don't add default IPv6 EUI64 if member of a bridgeJernej Jakob
Bridge members should not have addresses assigned.
2020-05-04vlan: T2241: add checks for bridge membershipJernej Jakob
2020-05-04intf_from_dict: T2241: move getting mac code so it's sorted alphabeticallyJernej Jakob
2020-05-04validate: T2241: rewrite is_bridge_member to generic is_memberJernej Jakob
- rewrite the function to support both bridge and bonding interface types, if the type is passed it searches only that type, otherwise it searches both - move is_member check out of the deleted condition - move is_member check to intf_from_dict for interfaces that use it
2020-05-04configdict: T2241: get interface name in intf/vlan_from_dictJernej Jakob
This is needed as later functions depend on it
2020-05-04vlan: T2241: cleanup vlan_to_dict functionJernej Jakob
Remove one unnecessary call to conf.get_level()
2020-05-02dictconfig: T2372: fix interfaces disable bugThomas Mangin
off-by one line where the IP were added to the add list and not the remove list
2020-05-02configdict: T2372: correct disable support in vlan_to_dictThomas Mangin
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
2020-04-23interfaces: T2362: add node to delete the default IPv6 link-local addressJernej Jakob
2020-04-23interfaces: T2362: allow setting multiple 'ipv6 address eui64'Jernej Jakob
2020-04-23interfaces: T2362: delete and re-add all EUI64 addresses if MAC has changedJernej Jakob
2020-04-23interfaces: T2362: add default IPv6 link-local address to make IPv6 workJernej Jakob
2020-04-23interfaces: vlan: T2362: add IPv6 EUI64 address to VLAN scriptsJernej Jakob
2020-03-30ifconfig: T2166: Recovery Proxy ARP for vlansDmitriyEshenko
2020-03-28ipv6: T1831: migrate autoconf nodeChristian Poessinger
Autoconfigure addresses using Prefix Information in Router Advertisements.
2020-03-28ipv6: T1831: use integers over bool in interface configurationChristian Poessinger