summaryrefslogtreecommitdiff
path: root/python/vyos
AgeCommit message (Collapse)Author
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-05config: T2427: always return copies of listsJernej Jakob
Since lists in python are assigned by reference, taking the return value from these functions and modifying it will modify all other return values of functions that called the function before and did not explicitly copy it. To be safe, always make a copy of lists before returning them.
2020-05-04ifconfig: section: T2241: add get_config_path functionJernej Jakob
Add a function that converts an interface name to its config path. For example: 'eth0.1.2' -> 'ethernet eth0 vif-s 1 vif-c 2'
2020-05-04ifconfig: T2241: fix section _basename vlan strippingJernej Jakob
Previously the function returned the correct basename only for vif interfaces as it stopped at the 2nd dot. If we had a vif-s vif-c interface 'eth0.1.2' it would return 'eth0.'. It is now fixed to strip both vif-s and vif-c if 'vlan=True' (default).
2020-05-04validate: T2241: add func that checks if an interface has a configured addressJernej Jakob
2020-05-04vlan: T2241: make address and bridge membership mutually exclusiveJernej Jakob
Bridge members should not have addresses assigned.
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: fix falling out of bridge when changing settingsJernej Jakob
Previously, set_vrf was always called, which uses the same master and nomaster commands as bridge, so it removed the interface from the bridge. - add checks to make VRF and bridge membership mutually exclusive - always re-add the interface back to any bridge it is part of in case it is deleted and recreated (e.g. changing egress/ingress-qos)
2020-05-04interface: T2241: add function to add self to bridgeJernej Jakob
Will be called by all interface scripts to re-add themselves to a bridge after deleting and recreating themselves.
2020-05-04util: T2241: add get_bridge_member_config functionJernej Jakob
Function that parses the config of a bridge member into a dict that is needed to apply all port config when adding a port to a bridge. Needed because other interfaces will be adding themselves to the bridge outside of the bridge conf_mode script and they need a common place to get their config. Can't be put as method of BridgeIf as we can't invoke it without it creating the bridge (create=False raises an exception), we need to get the configuration before we create the interface.
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-04util: T2241: add func that gets interface name from current config levelJernej Jakob
2020-05-04vlan: T2241: cleanup vlan_to_dict functionJernej Jakob
Remove one unnecessary call to conf.get_level()
2020-05-03interface: T2367: optimize flow and detriplicate add/del_addr functionsJernej Jakob
- detriplicate list appending - detriplicate returns - use if-elif-else - move check if address is already added to beginning - move caching in variable to after address assignment so a failed assignment won't cache the address
2020-05-02interface: T2367: use self.ifname instead of self.configThomas Mangin
2020-05-02interface: T2367: de-imbricate the ifsThomas Mangin
2020-05-02Merge pull request #388 from jjakob/flush-addrs-T2367Christian Poessinger
T2367: flush addresses when adding bond/bridge members
2020-05-02interface: T2367: add flush_addrs functionJernej Jakob
Add function that flushes all addresses from an interface.
2020-05-02interface: T2367: fix add_addr and del_addr address tracking in cacheJernej Jakob
Correctly track addresses in cache _addr variable
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-02Merge pull request #383 from thomas-mangin/T2372Christian Poessinger
disable :T2372: disable sub-interface if parent is
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-29dhclient: T2393: switch to old configuration path to keep existing op-mode ↵Christian Poessinger
tolls intact
2020-04-28dhclient: T2393: remove intermediate _DHCP helper classChristian Poessinger
The intermedite class only held the path to the configuration files - thus its existence was doubtworthy. For better readability and a clean inheritance graph that class has been dropped.
2020-04-28dhclient6: T2393: T2394: migrate from SysVinit to systemdChristian Poessinger
2020-04-28dhclient: T2393: migrate from SysVinit to systemdChristian Poessinger
2020-04-28vlan: T2372: de-indent add_vlanThomas Mangin
2020-04-27template: T2388: fix typoJohn Estabrook
2020-04-27Merge pull request #381 from thomas-mangin/T2388Christian Poessinger
template: T2388: move mkdir/chmod/chown within render()
2020-04-27Merge pull request #379 from thomas-mangin/T2226-improveChristian Poessinger
util: T2226: multiple improvements
2020-04-27template: T2388: move mkdir/chmod/chown within render()Thomas Mangin
2020-04-26dhcp: T2379: fix dhcp stopThomas Mangin
2020-04-26util: T2226: a way to report noteworthy eventThomas Mangin
debug.noteworthy can be used to record noteworhy event during the lifetime of the program. Should anything then cause the program to fail and cause an airbag report to the user, then this information will also be included.
2020-04-26util: T2226: expected return code for cmdThomas Mangin
add an option to cmd() allowing to define a list of error codes which are expected when runnin the command. the default is only to expect zero (no error).
2020-04-26util: T2226: better handle stderrThomas Mangin
Do not agreggate stderr with stdout. So if a command reports a message on stderr but does not report an error, it will not be send to the user to confuse him. Explicitely set encoding to utf-8, which does not change the code behaviour but simplify the code.
2020-04-24log: T2377: do not modify log file if not 666Thomas Mangin
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-04-23interfaces: T2362: split set_ipv6_eui64_address into add and del functionsJernej Jakob
2020-04-22http api: T2096: form of show/generate should be consistent with other cmdsJohn Estabrook
2020-04-22Merge pull request #360 from thomas-mangin/T2186-syslogChristian Poessinger
airbag: T2186: generic syslog and better text
2020-04-22Merge pull request #372 from thomas-mangin/T2354Christian Poessinger
tunnel: T2354: do not allow display as bridge option
2020-04-22Merge pull request #370 from thomas-mangin/T2331Christian Poessinger
vrrp: T2331: fix show vrrp