summaryrefslogtreecommitdiff
path: root/python
AgeCommit message (Collapse)Author
2020-04-09vxlan: pseudo-ethernet: T2260: convert link nodes to source-interfaceChristian Poessinger
2020-04-09Merge pull request #316 from thomas-mangin/T2242Christian Poessinger
import: T2242: remove all import *
2020-04-09Merge pull request #317 from thomas-mangin/T2028-remoteChristian Poessinger
tunnel: T2028: fix remote and registration
2020-04-09Merge pull request #314 from thomas-mangin/T2186Christian Poessinger
airbag: T2186: report friendly user message and log to syslog
2020-04-08tunnel: T2028: register the _Tunnel classThomas Mangin
All interface classes register themselves so that we can figure out from an interface name what class is responsible for its creation. In the case of Tunnel, it is not the case as multiple different interfaces are sharing the same "tun" prefix. Still many operations are the same and it should be done.
2020-04-08Revert "util: T2226: rewrite remote function helpers to use cmd"John Estabrook
This reverts commit 7219d4013814a55c4eeaf36b7a36d5e8076d09f0.
2020-04-08vyos.util: introduce chmod_750() for files/directoriesChristian Poessinger
2020-04-08vyos-util: rename chown_file() > chown()Christian Poessinger
... to make it clear also directories can be chown(-ed)
2020-04-08logging: T2186: cosmetic changesThomas Mangin
2020-04-08import: T2242: remove all import *Thomas Mangin
2020-04-08logging: T2186: Initial implementation of loggingThomas Mangin
All messages sent to stderr are now logged to syslog. Also should a raise statement not be handled by the program, a friendlier message is sent to the user (with the trace to syslog) It provide a new debug option: /tmp/vyos.developer.debug when the file exists and the code raise without being caught up the program will automatically fall into pdb port-morterm mode allowing to investigate the reason for the failure
2020-04-08version: T2186: do not raise if not version infoThomas Mangin
The code attempted to access the information on the file system During the package build this is not available, therefore the code was modified to return empty object when no data is there
2020-04-07bridge: T2232: prevent deletion of enslaved interfacesChristian Poessinger
Interfaces enslaved to a bridge are not allowed to be deleted. If an interface is deleted from the config but it is still enslaved to a bridge will cause a configuration error on the subsequent boot.
2020-04-07vyos.util: T2226: add proper commentsChristian Poessinger
2020-04-06util: T2226: remove all references to subprocess_cmdThomas Mangin
2020-04-06util: T2226: rewrite util to use cmdThomas Mangin
2020-04-06util: T2226: rewrite remote function helpers to use cmdThomas Mangin
2020-04-06util: T2226: rewrite WireGuardIf to use cmdThomas Mangin
2020-04-06util: T2226: rewrite EthernetIf.feature to use cmdThomas Mangin
2020-04-06util: T2226: rewrite make_password_hash to use cmdThomas Mangin
2020-04-06util: T2226: improve popen, cmd and add runThomas Mangin
improves open and cmd adds a new help function run. the extra optional arguments provide all the features of subprocess used by every module of VyOS. popen matches closely subprocess.Popen cmd matches closely subprocess.check_output run matches closely subprocess.call and os.system popen returns the string and errord code cmd returns the string and raise on error (the class can be defined the default is OSError) run returns the return code of the command the options are: shell=None, the code auto-detect is a shell is required decode=None, use .decode() otherwise the encoding will be used env=None, universal_newlines=None: as per subprocess.Popen input=None, timeout=None, stdout=PIPE, stderr=STDOUT, as per Popen.communicate
2020-04-05ifconfig: l2tpv3: T1823: fix remaining errors in config syntaxChristian Poessinger
Commit b5310b0 ("ifconfig: l2tpv3: T1823: fix configuration build syntax") did not cover all parts of the l2tpv3 config. Some parts when e.g. adjusting l2tpv3 addresses after the tunnel was created did fail with the same error. This has been fixed.
2020-04-04vyos.util: rename chmod_x_file() to chmod_x()Christian Poessinger
Now both files and directories are supported.
2020-04-04Merge pull request #302 from thomas-mangin/T2190Christian Poessinger
ifconfig: T2190: option to prevent Interface creation
2020-04-04Merge pull request #299 from thomas-mangin/T2205Christian Poessinger
ifconfig: T2205: silence ethtool harmless failures
2020-04-04ifconfig: T2190: option to prevent Interface creationThomas Mangin
a new option was added to the Interface class "create". By default the value is set to True, and when an instance of the class is created and the underlying interface does not exists, the class will create it. If the option "create" is set to False, the interface will not be created and instead the class will raise an error when it is instantiated.
2020-04-04ifconfig: T2205: silence ethtool harmless failuresThomas Mangin
Not all interface are capable of all features. Since commands are now checked for valid completion, ethtool command failure must be ignored.
2020-04-04vyos.util: use common subprocess_cmd wrapperChristian Poessinger
2020-04-02vyos.util: move import statements next to the helpers using itChristian Poessinger
2020-04-02vyos.util: add chown_file and chmod_x_file helpersChristian Poessinger
2020-04-02fconfig: l2tpv3: T1823: fix configuration build syntaxChristian Poessinger
Fixes reference to unspecified variable Traceback (most recent call last): File "/usr/libexec/vyos/conf_mode/interfaces-l2tpv3.py", line 245, in <module> apply(c) File "/usr/libexec/vyos/conf_mode/interfaces-l2tpv3.py", line 211, inapply l = L2TPv3If(l2tpv3['intf'], **conf) File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 185, in __init__ self._create() File "/usr/lib/python3/dist-packages/vyos/ifconfig/l2tpv3.py", line 48, in _create cmd = 'ip l2tp add tunnel tunnel_id {} '.format(config['tunnel_id']) NameError: name 'config' is not defined
2020-04-02ifconfig: l2tpv3: T1823: add missing items from config dict to optionsChristian Poessinger
Commit 8a4dd6c2816 ("ifconfig: T2057: add class Register") added the interface options but not all have been migrated. The forgotten ones have been added by this commit (session_id & peer_session_id).
2020-04-02ifconfig: l2tpv3: T1823: add missing import statementChristian Poessinger
Import statement has been forgotton on the ifconfig file split.
2020-04-01validate: T2182: IPv6 normalisation and % in interface nameThomas Mangin
The IPv6 address can be expressed in different ways: (for example all these are valid loopback ::1, 0::1, 0:0::0:001) The IPv6 need to be normalised when tested, and the best way to do this is to test it on-wire representation, the same can be done for IPv4. Also The interface name which returned by netifaces.ifaddresses can have a % in the 'addr' field, for example '::1%eth0', which would also break the test in is_intf_addr_assigned.
2020-03-31Revert "validate: T2182: IPv6 are not normalised when compared"Christian Poessinger
This reverts commit e2f80e57d9895d207edf0ad92c299dc7862087d6. Due to failing smoketests this commit is reverted.
2020-03-31Merge pull request #287 from thomas-mangin/T2182Christian Poessinger
validate: T2182: IPv6 are not normalised when compared
2020-03-31Merge pull request #283 from thomas-mangin/T2057-wg-dumpChristian Poessinger
ifconfig: T2057: Move code from interface.py to wireguard.py
2020-03-31ifconfig: T2057: centralise wireguard codeThomas Mangin
Some left over wireguard code was left in the interface.py file. The code was moved into the wireguard.py file and the now empty interface.py file removed as no longer holdin any code.
2020-03-31ifconfig: T2057: allow to disable interface debuggingThomas Mangin
In order to be able to use the interface class with operational mode, these commands must not log as it would otherwise mess with the output on the screen.
2020-03-31Merge pull request #284 from jestabro/T2180Daniil Baturin
vyos.config: T2180: ignore CLI edit level in show_config
2020-03-30validate: T2182: IPv6 are not normalised when comparedThomas Mangin
Adding an already existing IP address on an interface would cause the 'ip addr add' command to fail. To prevent this, the code checks if the IP already exists on the interface. The code was not normalising the different ways of representing the IPv6 address (trailing 0, ::, etc.).
2020-03-30migration: T2029: extract the version string instead of strippingJohn Estabrook
2020-03-30migration: T2029: process new version syntax in configtreeJohn Estabrook
2020-03-30migration: T2029: remove reference to default vintage in MigratorJohn Estabrook
2020-03-30migration: T2029: run virtual migration before migrationJohn Estabrook
Update syntax of component version string, before passing config file to configtree in migration scripts.
2020-03-30migration: T2029: set default vintage; remove target from virtualJohn Estabrook
The VirtualMigrator updates the syntax of the component version string. Remove the default target, allowing downgrade to old syntax.
2020-03-30ifconfig: T2166: Recovery Proxy ARP for vlansDmitriyEshenko
2020-03-30wireless: T2057: fix missing rename of set_state() -> set_admin_state()Christian Poessinger
Commit 627d1c704c83 ("ifconfig: T2057: explicity name state functions") introduced a new API naming, unfortunately this was nod added for wireless interfaces.
2020-03-29vyos.config: T2180: ignore CLI edit level in show_configJohn Estabrook
2020-03-29vyos.util: increase usage of process_running() and remove duplicated codeChristian Poessinger
OpenVPN, WIFI, SSTP all had the same boiler plate copied about checking if a process associated with a pidfile is running or not. This has been migrated to the common library function vyos.util.process_running().