diff options
| author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2022-08-31 12:46:51 +0300 |
|---|---|---|
| committer | Viacheslav Hletenko <v.gletenko@vyos.io> | 2022-08-31 17:30:57 +0000 |
| commit | 3489089000a43a533fcd89282b0ced2434851c03 (patch) | |
| tree | 24b42a02eedbfaa2323ec65a148848f996ecf3b5 /python/vyos/ifconfig/section.py | |
| parent | 69bcdb9a680b33422d041fd03e70c25094bfa6a2 (diff) | |
| parent | 69f79beee2070906b68f2b910296c362e7216278 (diff) | |
| download | veeos-1x-3489089000a43a533fcd89282b0ced2434851c03.tar.gz veeos-1x-3489089000a43a533fcd89282b0ced2434851c03.zip | |
nat: T538: Move nat configs to /run directory
Diffstat (limited to 'python/vyos/ifconfig/section.py')
| -rw-r--r-- | python/vyos/ifconfig/section.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/python/vyos/ifconfig/section.py b/python/vyos/ifconfig/section.py index 91f667b65..5e98cd510 100644 --- a/python/vyos/ifconfig/section.py +++ b/python/vyos/ifconfig/section.py @@ -88,7 +88,7 @@ class Section: raise ValueError(f'No type found for interface name: {name}') @classmethod - def _intf_under_section (cls,section=''): + def _intf_under_section (cls,section='',vlan=True): """ return a generator with the name of the configured interface which are under a section @@ -103,6 +103,9 @@ class Section: if section and ifsection != section: continue + if vlan == False and '.' in ifname: + continue + yield ifname @classmethod @@ -135,13 +138,14 @@ class Section: return l @classmethod - def interfaces(cls, section=''): + def interfaces(cls, section='', vlan=True): """ 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 + if no section is provided, then it returns all configured interfaces. + If vlan is True, also Vlan subinterfaces will be returned """ - return cls._sort_interfaces(cls._intf_under_section(section)) + return cls._sort_interfaces(cls._intf_under_section(section, vlan)) @classmethod def _intf_with_feature(cls, feature=''): |
