summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-09-24 18:40:07 +0200
committerChristian Poessinger <christian@poessinger.com>2019-09-24 21:53:25 +0200
commit12d0cdf69ba15dccb705e212ea605b692f825dbd (patch)
treee871010d64336f6494ef7f1deb372862b11b342c /src/conf_mode
parent8138766884bb7fe301dc21d2cb0bd3556d169d2e (diff)
downloadvyos-1x-12d0cdf69ba15dccb705e212ea605b692f825dbd.tar.gz
vyos-1x-12d0cdf69ba15dccb705e212ea605b692f825dbd.zip
Python/ifconfig: T1557: refactor Interface 'ifalias' property to set_alias()
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/interface-bonding.py4
-rwxr-xr-xsrc/conf_mode/interface-bridge.py2
-rwxr-xr-xsrc/conf_mode/interface-dummy.py14
-rwxr-xr-xsrc/conf_mode/interface-ethernet.py4
-rwxr-xr-xsrc/conf_mode/interface-loopback.py3
-rwxr-xr-xsrc/conf_mode/interface-vxlan.py2
-rwxr-xr-xsrc/conf_mode/interface-wireguard.py2
7 files changed, 15 insertions, 16 deletions
diff --git a/src/conf_mode/interface-bonding.py b/src/conf_mode/interface-bonding.py
index dce4a8106..8b4c8b625 100755
--- a/src/conf_mode/interface-bonding.py
+++ b/src/conf_mode/interface-bonding.py
@@ -84,7 +84,7 @@ def apply_vlan_config(vlan, config):
raise TypeError()
# update interface description used e.g. within SNMP
- vlan.ifalias = config['description']
+ vlan.set_alias(config['description'])
# ignore link state changes
vlan.set_link_detect(config['disable_link_detect'])
# Maximum Transmission Unit (MTU)
@@ -369,7 +369,7 @@ def apply(bond):
b.arp_ip_target = '+' + addr
# update interface description used e.g. within SNMP
- b.ifalias = bond['description']
+ b.set_alias(bond['description'])
#
# missing DHCP/DHCPv6 options go here
diff --git a/src/conf_mode/interface-bridge.py b/src/conf_mode/interface-bridge.py
index 558ec3cc6..cadd44feb 100755
--- a/src/conf_mode/interface-bridge.py
+++ b/src/conf_mode/interface-bridge.py
@@ -201,7 +201,7 @@ def apply(bridge):
# enable or disable IGMP querier
br.set_multicast_querier(bridge['igmp_querier'])
# update interface description used e.g. within SNMP
- br.ifalias = bridge['description']
+ br.set_alias(bridge['description'])
# Change interface MAC address
if bridge['mac']:
diff --git a/src/conf_mode/interface-dummy.py b/src/conf_mode/interface-dummy.py
index 1b3fbcc93..2556722fa 100755
--- a/src/conf_mode/interface-dummy.py
+++ b/src/conf_mode/interface-dummy.py
@@ -78,28 +78,28 @@ def generate(dummy):
return None
def apply(dummy):
- du = DummyIf(dummy['intf'])
+ d = DummyIf(dummy['intf'])
# Remove dummy interface
if dummy['deleted']:
- du.remove()
+ d.remove()
else:
# enable interface
- du.state = 'up'
+ d.state = 'up'
# update interface description used e.g. within SNMP
- du.ifalias = dummy['description']
+ d.set_alias(dummy['description'])
# Configure interface address(es)
# - not longer required addresses get removed first
# - newly addresses will be added second
for addr in dummy['address_remove']:
- du.del_addr(addr)
+ d.del_addr(addr)
for addr in dummy['address']:
- du.add_addr(addr)
+ d.add_addr(addr)
# disable interface on demand
if dummy['disable']:
- du.state = 'down'
+ d.state = 'down'
return None
diff --git a/src/conf_mode/interface-ethernet.py b/src/conf_mode/interface-ethernet.py
index f4bc53a32..5c8c76827 100755
--- a/src/conf_mode/interface-ethernet.py
+++ b/src/conf_mode/interface-ethernet.py
@@ -67,7 +67,7 @@ def apply_vlan_config(vlan, config):
raise TypeError()
# update interface description used e.g. within SNMP
- vlan.ifalias = config['description']
+ vlan.set_alias(config['description'])
# ignore link state changes
vlan.set_link_detect(config['disable_link_detect'])
# Maximum Transmission Unit (MTU)
@@ -271,7 +271,7 @@ def apply(eth):
e.remove()
else:
# update interface description used e.g. within SNMP
- e.ifalias = eth['description']
+ e.set_alias(eth['description'])
#
# missing DHCP/DHCPv6 options go here
diff --git a/src/conf_mode/interface-loopback.py b/src/conf_mode/interface-loopback.py
index aba682f31..46fc6809b 100755
--- a/src/conf_mode/interface-loopback.py
+++ b/src/conf_mode/interface-loopback.py
@@ -75,8 +75,7 @@ def apply(loopback):
lo = LoopbackIf(loopback['intf'])
if not loopback['deleted']:
# update interface description used e.g. within SNMP
- # update interface description used e.g. within SNMP
- lo.ifalias = loopback['description']
+ lo.set_alias(loopback['description'])
# Configure interface address(es)
# - not longer required addresses get removed first
diff --git a/src/conf_mode/interface-vxlan.py b/src/conf_mode/interface-vxlan.py
index f0fa7596a..638efda31 100755
--- a/src/conf_mode/interface-vxlan.py
+++ b/src/conf_mode/interface-vxlan.py
@@ -163,7 +163,7 @@ def apply(vxlan):
# Finally create the new interface
v = VXLANIf(vxlan['intf'], config=conf)
# update interface description used e.g. by SNMP
- v.ifalias = vxlan['description']
+ v.set_alias(vxlan['description'])
# Maximum Transfer Unit (MTU)
v.set_mtu(vxlan['mtu'])
diff --git a/src/conf_mode/interface-wireguard.py b/src/conf_mode/interface-wireguard.py
index 069298265..7254e153f 100755
--- a/src/conf_mode/interface-wireguard.py
+++ b/src/conf_mode/interface-wireguard.py
@@ -210,7 +210,7 @@ def apply(c):
# ifalias for snmp from description
descr_eff = c_eff.return_effective_value(ifname + ' description')
if descr_eff != c[ifname]['descr']:
- intfc.ifalias = str(c[ifname]['descr'])
+ intfc.set_alias(str(c[ifname]['descr']))
# peer deletion
peer_eff = c_eff.list_effective_nodes(ifname + ' peer')