summaryrefslogtreecommitdiff
path: root/python/vyos/validate.py
diff options
context:
space:
mode:
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.