summaryrefslogtreecommitdiff
path: root/python/vyos/interface.py
diff options
context:
space:
mode:
authorkroy <kroy@kroy.io>2019-10-24 12:16:54 -0500
committerkroy <kroy@kroy.io>2019-10-24 12:16:54 -0500
commit1d8b917fb934060c3d0f79e7039ae3a468f51f2c (patch)
tree03e77df407ee84e23995d0be80ec422d2de96d0e /python/vyos/interface.py
parent3400b1dd79702553ebbd40516bf454f3fe47885b (diff)
downloadvyos-1x-1d8b917fb934060c3d0f79e7039ae3a468f51f2c.tar.gz
vyos-1x-1d8b917fb934060c3d0f79e7039ae3a468f51f2c.zip
T1759: ioctl.pm/interface.pm rewrite
Diffstat (limited to 'python/vyos/interface.py')
-rw-r--r--python/vyos/interface.py9
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):