diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-10-27 05:01:38 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-10-27 05:01:38 +0100 |
commit | 9805067e9d80ec1676cf2c2039be3136401c9fa3 (patch) | |
tree | 141f2063203ac5823eb3980b83646756f053ddbc /python/vyos/interface.py | |
parent | 69a14678de1c4f9b35414cbb00f33330478e4c58 (diff) | |
parent | 556b528ef9cc1eca9d142ebe1f8f88cd02d536da (diff) | |
download | vyos-1x-9805067e9d80ec1676cf2c2039be3136401c9fa3.tar.gz vyos-1x-9805067e9d80ec1676cf2c2039be3136401c9fa3.zip |
Merge branch 'current' of github.com:vyos/vyos-1x into equuleus
* 'current' of github.com:vyos/vyos-1x:
snmp: T1769: remove TSM (Transport Security Mode) support
snmp: T818: T1738: remove per user/trap engine id
T1759: ioctl.pm/interface.pm rewrite
Diffstat (limited to 'python/vyos/interface.py')
-rw-r--r-- | python/vyos/interface.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/python/vyos/interface.py b/python/vyos/interface.py index 1aae6db60..cc726e5cc 100644 --- a/python/vyos/interface.py +++ b/python/vyos/interface.py @@ -16,6 +16,8 @@ import vyos from vyos.config import Config import vyos.interfaces +import vyos.ioctl +from vyos.iflag import IFlag import re import json @@ -33,11 +35,18 @@ class Interface(): intf = None intf_type = None valid = False + flags = None def __init__(self,intf): self.intf = intf self.intf_type = vyos.interfaces.get_type_of_interface(self.intf) self.valid = (self.intf in vyos.interfaces.list_interfaces()) + if (self.valid): + self.flags = vyos.ioctl.get_interface_flags(intf) + + def up(self): + """ return whether interface is up or not """ + return self.flags & IFlag.IFF_UP def print_interface(self): |