diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-04-17 08:11:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-17 08:11:31 +0200 |
commit | 75c7e2a5cea6713623208a4023455de64d13d7e1 (patch) | |
tree | 8be3e77575d316d428dfd1d570a7502257dea4b5 /python/vyos/ifconfig/section.py | |
parent | 3964ee10a3a85e3655135d7e0235b4d1b2f08214 (diff) | |
parent | 7d04bfbcc74e062b80b337753e7018a6af81e70c (diff) | |
download | vyos-1x-75c7e2a5cea6713623208a4023455de64d13d7e1.tar.gz vyos-1x-75c7e2a5cea6713623208a4023455de64d13d7e1.zip |
Merge pull request #341 from thomas-mangin/T2223
op_mode: T2223: convert vyatta-show-interfaces.pl to show_interfaces.py
Diffstat (limited to 'python/vyos/ifconfig/section.py')
-rw-r--r-- | python/vyos/ifconfig/section.py | 18 |
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, ... """ |