summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-11-24 11:06:55 +0100
committerChristian Poessinger <christian@poessinger.com>2019-11-24 11:06:55 +0100
commit4198ea04f6ab1735e24f878b0939cee43e4f0946 (patch)
tree4f7e2538618e3c96b949b9503d5f445e1ccbf696 /python
parent9ab56f29f07a3c94a92bb7e1ffa54fcb4762a8fb (diff)
parent762e0922eec583c011c5fb834ad8a22971bc96b5 (diff)
downloadvyos-1x-4198ea04f6ab1735e24f878b0939cee43e4f0946.tar.gz
vyos-1x-4198ea04f6ab1735e24f878b0939cee43e4f0946.zip
Merge branch 't1799-geneve' of github.com:c-po/vyos-1x into current
* 't1799-geneve' of github.com:c-po/vyos-1x: geneve: T1799: add IPv4 routing parameters geneve: T1799: support bridging geneve: T1799: add Generic Network Virtualization Encapsulation
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig.py39
1 files changed, 38 insertions, 1 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py
index 279d948b7..f487e6a5b 100644
--- a/python/vyos/ifconfig.py
+++ b/python/vyos/ifconfig.py
@@ -1609,7 +1609,7 @@ class WireGuardIf(Interface):
class VXLANIf(Interface, ):
"""
The VXLAN protocol is a tunnelling protocol designed to solve the
- problem of limited VLAN IDs (4096) in IEEE 802.1q. With VXLAN the
+ problem of limited VLAN IDs (4096) in IEEE 802.1q. With VXLAN the
size of the identifier is expanded to 24 bits (16777216).
VXLAN is described by IETF RFC 7348, and has been implemented by a
@@ -1668,3 +1668,40 @@ class VXLANIf(Interface, ):
'remote': ''
}
return config
+
+class GeneveIf(Interface, ):
+ """
+ Geneve: Generic Network Virtualization Encapsulation
+
+ For more information please refer to:
+ https://tools.ietf.org/html/draft-gross-geneve-00
+ https://www.redhat.com/en/blog/what-geneve
+ https://developers.redhat.com/blog/2019/05/17/an-introduction-to-linux-virtual-interfaces-tunnels/#geneve
+ https://lwn.net/Articles/644938/
+ """
+ def __init__(self, ifname, config=''):
+ if config:
+ self._ifname = ifname
+
+ if not os.path.exists('/sys/class/net/{}'.format(self._ifname)):
+ cmd = 'ip link add name {} type geneve id {} remote {}' \
+ .format(self._ifname, config['vni'], config['remote'])
+ self._cmd(cmd)
+
+ super().__init__(ifname, type='geneve')
+
+ @staticmethod
+ def get_config():
+ """
+ GENEVE interfaces require a configuration when they are added using
+ iproute2. This static method will provide the configuration dictionary
+ used by this class.
+
+ Example:
+ >> dict = GeneveIf().get_config()
+ """
+ config = {
+ 'vni': 0,
+ 'remote': ''
+ }
+ return config