summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig/section.py
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-04-14 09:46:46 +0100
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-04-14 12:04:43 +0100
commite0aa8aa20b835f17a74e0cf2a0dc2ca6e7823a3c (patch)
tree8357fd78883ab114b4cdc019e7eeeb6920368d00 /python/vyos/ifconfig/section.py
parentfdfd050431f786f9c9b7bfdcb51b5e8aca3f79f5 (diff)
downloadvyos-1x-e0aa8aa20b835f17a74e0cf2a0dc2ca6e7823a3c.tar.gz
vyos-1x-e0aa8aa20b835f17a74e0cf2a0dc2ca6e7823a3c.zip
ifconfig: T2223: group all operational commands
All operational command are moved within an Operational class and an inherited on for wireguard.
Diffstat (limited to 'python/vyos/ifconfig/section.py')
-rw-r--r--python/vyos/ifconfig/section.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/python/vyos/ifconfig/section.py b/python/vyos/ifconfig/section.py
index ab340d247..092236fef 100644
--- a/python/vyos/ifconfig/section.py
+++ b/python/vyos/ifconfig/section.py
@@ -69,7 +69,14 @@ class Section:
if name in cls._prefixes:
return cls._prefixes[name].definition['section']
return ''
-
+
+ @classmethod
+ def sections(cls):
+ """
+ return all the sections we found under 'set interfaces'
+ """
+ return list(set([cls._prefixes[_].definition['section'] for _ in cls._prefixes]))
+
@classmethod
def klass(cls, name, vlan=True):
name = cls._basename(name, vlan)
@@ -80,7 +87,8 @@ class Section:
@classmethod
def _intf_under_section (cls,section=''):
"""
- return a generator with the name of the interface which are under a section
+ return a generator with the name of the configured interface
+ which are under a section
"""
interfaces = netifaces.interfaces()
@@ -97,7 +105,7 @@ class Section:
@classmethod
def interfaces(cls, section=''):
"""
- return a list of the name of the interface which are under a section
+ return a list of the name of the configured interface which are under a section
if no section is provided, then it returns all configured interfaces
"""
return list(cls._intf_under_section(section))
@@ -105,7 +113,7 @@ class Section:
@classmethod
def _intf_with_feature(cls, feature=''):
"""
- return a generator with the name of the interface which have
+ return a generator with the name of the configured interface which have
a particular feature set in their definition such as:
bondable, broadcast, bridgeable, ...
"""
@@ -116,7 +124,7 @@ class Section:
@classmethod
def feature(cls, feature=''):
"""
- return list with the name of the interface which have
+ return list with the name of the configured interface which have
a particular feature set in their definition such as:
bondable, broadcast, bridgeable, ...
"""