summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-05-19 17:21:42 +0200
committerChristian Poessinger <christian@poessinger.com>2020-05-19 17:21:43 +0200
commit77eaf77f4fde463192f7c29a9492ab958d75eaaf (patch)
treed70cb2e6180b42b7e1e4beb6540884152435788e
parent5cbdffd3c1bd3eedc1b17010964dc69be6962349 (diff)
downloadvyos-1x-77eaf77f4fde463192f7c29a9492ab958d75eaaf.tar.gz
vyos-1x-77eaf77f4fde463192f7c29a9492ab958d75eaaf.zip
configdict: T2372: add new interface_default_data dict
Dictionary is used to remove the amount of duplicated code by e.g. ethernet or bridge interface.
-rw-r--r--python/vyos/configdict.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index 8325355e8..a2a1d911f 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -103,8 +103,7 @@ def get_ethertype(ethertype_val):
else:
raise ConfigError('invalid ethertype "{}"'.format(ethertype_val))
-
-vlan_default = {
+interface_default_data = {
'address': [],
'address_remove': [],
'description': '',
@@ -115,8 +114,6 @@ vlan_default = {
'dhcpv6_temporary': False,
'disable': False,
'disable_link_detect': 1,
- 'egress_qos': '',
- 'egress_qos_changed': False,
'ip_disable_arp_filter': 1,
'ip_enable_arp_accept': 0,
'ip_enable_arp_announce': 0,
@@ -128,16 +125,22 @@ vlan_default = {
'ipv6_eui64_prefix_remove': [],
'ipv6_forwarding': 1,
'ipv6_dup_addr_detect': 1,
- 'ingress_qos': '',
- 'ingress_qos_changed': False,
'is_bridge_member': False,
'mac': '',
'mtu': 1500,
- 'vif_c': {},
- 'vif_c_remove': [],
'vrf': ''
}
+vlan_default = {
+ **interface_default_data,
+ 'egress_qos': '',
+ 'egress_qos_changed': False,
+ 'ingress_qos': '',
+ 'ingress_qos_changed': False,
+ 'vif_c': {},
+ 'vif_c_remove': []
+}
+
# see: https://docs.python.org/3/library/enum.html#functional-api
disable = Enum('disable','none was now both')