summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/interface-bonding.py6
-rwxr-xr-xsrc/conf_mode/interface-bridge.py2
-rwxr-xr-xsrc/conf_mode/interface-dummy.py7
-rwxr-xr-xsrc/conf_mode/interface-ethernet.py4
-rwxr-xr-xsrc/conf_mode/interface-loopback.py6
-rwxr-xr-xsrc/conf_mode/interface-openvpn.py6
-rwxr-xr-xsrc/conf_mode/interface-vxlan.py10
-rwxr-xr-xsrc/conf_mode/interface-wireguard.py8
8 files changed, 20 insertions, 29 deletions
diff --git a/src/conf_mode/interface-bonding.py b/src/conf_mode/interface-bonding.py
index 9049913e6..4a91619f1 100755
--- a/src/conf_mode/interface-bonding.py
+++ b/src/conf_mode/interface-bonding.py
@@ -13,8 +13,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-#
import os
@@ -90,7 +88,7 @@ def apply_vlan_config(vlan, config):
# ignore link state changes
vlan.link_detect = config['disable_link_detect']
# Maximum Transmission Unit (MTU)
- vlan.mtu = config['mtu']
+ vlan.set_mtu(config['mtu'])
# Change VLAN interface MAC address
if config['mac']:
vlan.mac = config['mac']
@@ -395,7 +393,7 @@ def apply(bond):
# Bonding policy
b.mode = bond['mode']
# Maximum Transmission Unit (MTU)
- b.mtu = bond['mtu']
+ b.set_mtu(bond['mtu'])
# Primary device interface
if bond['primary']:
diff --git a/src/conf_mode/interface-bridge.py b/src/conf_mode/interface-bridge.py
index 62589c798..cb768e082 100755
--- a/src/conf_mode/interface-bridge.py
+++ b/src/conf_mode/interface-bridge.py
@@ -13,8 +13,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-#
import os
diff --git a/src/conf_mode/interface-dummy.py b/src/conf_mode/interface-dummy.py
index 614fe08db..1b3fbcc93 100755
--- a/src/conf_mode/interface-dummy.py
+++ b/src/conf_mode/interface-dummy.py
@@ -13,10 +13,9 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-#
-from os import environ
+import os
+
from copy import deepcopy
from sys import exit
@@ -40,7 +39,7 @@ def get_config():
# determine tagNode instance
try:
- dummy['intf'] = environ['VYOS_TAGNODE_VALUE']
+ dummy['intf'] = os.environ['VYOS_TAGNODE_VALUE']
except KeyError as E:
print("Interface not specified")
diff --git a/src/conf_mode/interface-ethernet.py b/src/conf_mode/interface-ethernet.py
index 5d597fd0a..43e598618 100755
--- a/src/conf_mode/interface-ethernet.py
+++ b/src/conf_mode/interface-ethernet.py
@@ -71,7 +71,7 @@ def apply_vlan_config(vlan, config):
# ignore link state changes
vlan.link_detect = config['disable_link_detect']
# Maximum Transmission Unit (MTU)
- vlan.mtu = config['mtu']
+ vlan.set_mtu(config['mtu'])
# Change VLAN interface MAC address
if config['mac']:
vlan.mac = config['mac']
@@ -296,7 +296,7 @@ def apply(eth):
e.mac = eth['hw_id']
# Maximum Transmission Unit (MTU)
- e.mtu = eth['mtu']
+ e.set_mtu(eth['mtu'])
# GRO (generic receive offload)
e.set_gro(eth['offload_gro'])
diff --git a/src/conf_mode/interface-loopback.py b/src/conf_mode/interface-loopback.py
index a1a807868..aba682f31 100755
--- a/src/conf_mode/interface-loopback.py
+++ b/src/conf_mode/interface-loopback.py
@@ -13,9 +13,9 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-from os import environ
+import os
+
from sys import exit
from copy import deepcopy
@@ -38,7 +38,7 @@ def get_config():
# determine tagNode instance
try:
- loopback['intf'] = environ['VYOS_TAGNODE_VALUE']
+ loopback['intf'] = os.environ['VYOS_TAGNODE_VALUE']
except KeyError as E:
print("Interface not specified")
diff --git a/src/conf_mode/interface-openvpn.py b/src/conf_mode/interface-openvpn.py
index 35e7928c2..fa01f7fc5 100755
--- a/src/conf_mode/interface-openvpn.py
+++ b/src/conf_mode/interface-openvpn.py
@@ -13,8 +13,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-#
import os
import re
@@ -580,7 +578,7 @@ def get_config():
# Minimum required TLS version
if conf.exists('tls tls-version-min'):
openvpn['tls_version_min'] = conf.return_value('tls tls-version-min')
-
+
if conf.exists('shared-secret-key-file'):
openvpn['shared_secret_file'] = conf.return_value('shared-secret-key-file')
@@ -736,7 +734,7 @@ def verify(openvpn):
if openvpn['tls_auth']:
if not checkCertHeader('-----BEGIN OpenVPN Static key V1-----', openvpn['tls_auth']):
raise ConfigError('Specified auth-file "{}" is invalid'.format(openvpn['tls_auth']))
-
+
if openvpn['tls_cert']:
if not checkCertHeader('-----BEGIN CERTIFICATE-----', openvpn['tls_cert']):
raise ConfigError('Specified cert-file "{}" is invalid'.format(openvpn['tls_cert']))
diff --git a/src/conf_mode/interface-vxlan.py b/src/conf_mode/interface-vxlan.py
index e97b4bf99..f0fa7596a 100755
--- a/src/conf_mode/interface-vxlan.py
+++ b/src/conf_mode/interface-vxlan.py
@@ -13,9 +13,9 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-from os import environ
+import os
+
from sys import exit
from copy import deepcopy
@@ -48,7 +48,7 @@ def get_config():
# determine tagNode instance
try:
- vxlan['intf'] = environ['VYOS_TAGNODE_VALUE']
+ vxlan['intf'] = os.environ['VYOS_TAGNODE_VALUE']
except KeyError as E:
print("Interface not specified")
@@ -127,7 +127,7 @@ def verify(vxlan):
if vxlan['link']:
# VXLAN adds a 50 byte overhead - we need to check the underlaying MTU
# if our configured MTU is at least 50 bytes less
- underlay_mtu = int(Interface(vxlan['link']).mtu)
+ underlay_mtu = int(Interface(vxlan['link']).get_mtu())
if underlay_mtu < (vxlan['mtu'] + 50):
raise ConfigError('VXLAN has a 50 byte overhead, underlaying device ' \
'MTU is to small ({})'.format(underlay_mtu))
@@ -165,7 +165,7 @@ def apply(vxlan):
# update interface description used e.g. by SNMP
v.ifalias = vxlan['description']
# Maximum Transfer Unit (MTU)
- v.mtu = vxlan['mtu']
+ v.set_mtu(vxlan['mtu'])
# configure ARP cache timeout in milliseconds
v.arp_cache_tmp = vxlan['ip_arp_cache_tmo']
diff --git a/src/conf_mode/interface-wireguard.py b/src/conf_mode/interface-wireguard.py
index 4ae3251fe..069298265 100755
--- a/src/conf_mode/interface-wireguard.py
+++ b/src/conf_mode/interface-wireguard.py
@@ -13,8 +13,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-#
import sys
import os
@@ -97,7 +95,7 @@ def get_config():
if c.exists(ifname + ' mtu'):
config_data[ifname]['mtu'] = c.return_value(ifname + ' mtu')
if c.exists(ifname + ' private-key'):
- config_data[ifname]['pk'] = "{0}/{1}/private.key".format(kdir,c.return_value(ifname + ' private-key'))
+ config_data[ifname]['pk'] = "{0}/{1}/private.key".format(kdir,c.return_value(ifname + ' private-key'))
if c.exists(ifname + ' peer'):
for p in c.list_nodes(ifname + ' peer'):
if not c.exists(ifname + ' peer ' + p + ' disable'):
@@ -204,10 +202,10 @@ def apply(c):
# interface MTU
if c[ifname]['mtu'] != 1420:
- intfc.mtu = int(c[ifname]['mtu'])
+ intfc.set_mtu(int(c[ifname]['mtu']))
else:
# default is set to 1420 in config_data
- intfc.mtu = int(c[ifname]['mtu'])
+ intfc.set_mtu(int(c[ifname]['mtu']))
# ifalias for snmp from description
descr_eff = c_eff.return_effective_value(ifname + ' description')