summaryrefslogtreecommitdiff
path: root/python/vyos/interface.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-10-24 13:28:49 -0500
committerGitHub <noreply@github.com>2019-10-24 13:28:49 -0500
commitf0b979aa6d5eec76f6e74fb225847769b9484246 (patch)
tree03e77df407ee84e23995d0be80ec422d2de96d0e /python/vyos/interface.py
parent3400b1dd79702553ebbd40516bf454f3fe47885b (diff)
parent1d8b917fb934060c3d0f79e7039ae3a468f51f2c (diff)
downloadvyos-1x-f0b979aa6d5eec76f6e74fb225847769b9484246.tar.gz
vyos-1x-f0b979aa6d5eec76f6e74fb225847769b9484246.zip
Merge pull request #153 from kroy-the-rabbit/py-interface
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):