diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-11-24 20:33:25 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-11-24 20:33:25 +0100 |
commit | 525af4f27dc2aa7e226f2bba46b4b1736bbc014f (patch) | |
tree | 8068edf769df8f680246ebd0e5e1e6e625ff3ed2 /python | |
parent | 24b23d41146eddd8fb0609ad4ae85d27e7c6ec6a (diff) | |
parent | 5238f0970219639e988bc31beb7db27b43f94e6e (diff) | |
download | vyos-1x-525af4f27dc2aa7e226f2bba46b4b1736bbc014f.tar.gz vyos-1x-525af4f27dc2aa7e226f2bba46b4b1736bbc014f.zip |
Merge branch 'current' of github.com:vyos/vyos-1x into equuleus
* 'current' of github.com:vyos/vyos-1x:
bridge: T1673: re-use "base" variable
bridge: T1673: add missing VLAN bridge member migration
geneve: T1799: add misssing "vni" to default_config_data
vxlan: T1636: add misssing "vni" to default_config_data
geneve: T1799: set minimum MTU size 1500 bytes
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.py | 39 |
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 |