summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-08-27 19:50:02 +0200
committerChristian Poessinger <christian@poessinger.com>2019-08-27 19:50:02 +0200
commit6cbf8db38ddca0c9e3b9cf1a52fc646cc2d5febb (patch)
tree5ea45b49715128cf21f84d549513c8902b6c50af /python
parent1ace4a35237889bceff7309df0c687bf32ab89a9 (diff)
parent34adc76f589cb01406155007ce49c5855764c79c (diff)
downloadvyos-1x-6cbf8db38ddca0c9e3b9cf1a52fc646cc2d5febb.tar.gz
vyos-1x-6cbf8db38ddca0c9e3b9cf1a52fc646cc2d5febb.zip
Merge branch 't1614-bonding' into current
* t1614-bonding: Python/VyOS validate: add is_ip() to check for IPv4 or IPv4 address bridge: T1556: remove unused function freeze() list-interfaces: T1614: support listing interfaces which can be bonded
Diffstat (limited to 'python')
-rw-r--r--python/vyos/validate.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/python/vyos/validate.py b/python/vyos/validate.py
index 97a401423..258f7f76a 100644
--- a/python/vyos/validate.py
+++ b/python/vyos/validate.py
@@ -16,6 +16,12 @@
import netifaces
import ipaddress
+def is_ip(addr):
+ """
+ Check addr if it is an IPv4 or IPv6 address
+ """
+ return is_ipv4(addr) or is_ipv6(addr)
+
def is_ipv4(addr):
"""
Check addr if it is an IPv4 address/network. Returns True/False