summaryrefslogtreecommitdiff
path: root/python/vyos/validate.py
diff options
context:
space:
mode:
authorMarcus Hoff <marcus.hoff@ring2.dk>2020-09-26 13:19:37 +0200
committerMarcus Hoff <marcus.hoff@ring2.dk>2020-09-26 13:19:37 +0200
commit1141bee72677b25d18436975625d2d298be503ff (patch)
tree4b6dc8fe1a8ced931e1ba08c58a348abfcd85a6b /python/vyos/validate.py
parent45b30adfaaec7065f768d04085138a75a76ed376 (diff)
parent374724be64728101c262fcac1579beece63ee651 (diff)
downloadvyos-1x-1141bee72677b25d18436975625d2d298be503ff.tar.gz
vyos-1x-1141bee72677b25d18436975625d2d298be503ff.zip
Merge remote-tracking branch 'upstream/current' into current
Diffstat (limited to 'python/vyos/validate.py')
-rw-r--r--python/vyos/validate.py41
1 files changed, 0 insertions, 41 deletions
diff --git a/python/vyos/validate.py b/python/vyos/validate.py
index ceeb6888a..691cf3c8e 100644
--- a/python/vyos/validate.py
+++ b/python/vyos/validate.py
@@ -19,7 +19,6 @@ import netifaces
import ipaddress
from vyos.util import cmd
-from vyos import xml
# Important note when you are adding new validation functions:
#
@@ -267,46 +266,6 @@ def assert_mac(m):
raise ValueError(f'{m} is a VRRP MAC address')
-def is_member(conf, interface, intftype=None):
- """
- Checks if passed interface is member of other interface of specified type.
- intftype is optional, if not passed it will search all known types
- (currently bridge and bonding)
-
- Returns:
- None -> Interface is not a member
- interface name -> Interface is a member of this interface
- False -> interface type cannot have members
- """
- ret_val = None
- if intftype not in ['bonding', 'bridge', None]:
- raise ValueError((
- f'unknown interface type "{intftype}" or it cannot '
- f'have member interfaces'))
-
- intftype = ['bonding', 'bridge'] if intftype == None else [intftype]
-
- # set config level to root
- old_level = conf.get_level()
- conf.set_level([])
-
- for it in intftype:
- base = ['interfaces', it]
- for intf in conf.list_nodes(base):
- memberintf = base + [intf, 'member', 'interface']
- if xml.is_tag(memberintf):
- if interface in conf.list_nodes(memberintf):
- ret_val = intf
- break
- elif xml.is_leaf(memberintf):
- if ( conf.exists(memberintf) and
- interface in conf.return_values(memberintf) ):
- ret_val = intf
- break
-
- old_level = conf.set_level(old_level)
- return ret_val
-
def has_address_configured(conf, intf):
"""
Checks if interface has an address configured.