commit e4bbb8059a88963adb3d574df40ef3a65e3f771a
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Tue Sep 9 15:59:23 2014 +0200
add vti support
This patch adds support for vti devices. There is no configuration
supported beyond purely creating the device. The recipe format is:
<vti id="xyz" netns="aa">
<options>
<option name="local" value="1.1.1.1"/>
<option name="remote" value="1.1.1.2"/>
<option name="key" value="1"/>
</options>
</vti>
Where the key option is mandatory and local and remote options are
optional (though I don't know if such a device is usable). The netns
attribute is optional as usual.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/RecipeParser.py | 5 +++++
lnst/Slave/InterfaceManager.py | 2 ++
lnst/Slave/NetConfigDevice.py | 39 ++++++++++++++++++++++++++++++++++++++-
lnst/Slave/NmConfigDevice.py | 9 ++++++++-
schema-recipe.rng | 19 +++++++++++++++++++
5 files changed, 72 insertions(+), 2 deletions(-)
---
diff --git a/lnst/Controller/RecipeParser.py b/lnst/Controller/RecipeParser.py
index 3960c97..12b1214 100644
--- a/lnst/Controller/RecipeParser.py
+++ b/lnst/Controller/RecipeParser.py
@@ -141,6 +141,11 @@ class RecipeParser(XmlParser):
opts = self._proces_options(opts_tag)
if len(opts) > 0:
iface["options"] = opts
+ elif iface["type"] in ["vti"]:
+ # interface options
+ opts_tag = iface_tag.find("options")
+ opts = self._proces_options(opts_tag)
+ iface["options"] = opts
elif iface["type"] in ["vlan"]:
# real_dev of the VLAN interface
slaves_tag = iface_tag.find("slaves")
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index e30b52a..f83dd33 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -223,6 +223,8 @@ class InterfaceManager(object):
return self._assign_name_generic(prefix)
elif dev_type == "veth":
return self._assign_name_pair("veth")
+ elif dev_type == "vti":
+ return self._assign_name_generic("vti")
else:
return self._assign_name_generic("dev")
diff --git a/lnst/Slave/NetConfigDevice.py b/lnst/Slave/NetConfigDevice.py
index 2a15a82..0d88ce8 100644
--- a/lnst/Slave/NetConfigDevice.py
+++ b/lnst/Slave/NetConfigDevice.py
@@ -414,6 +414,42 @@ class NetConfigDeviceVEth(NetConfigDeviceGeneric):
def deconfigure(self):
return True
+class NetConfigDeviceVti(NetConfigDeviceGeneric):
+ _modulename = ""
+ _moduleload = False
+
+ def create(self):
+ conf = self._dev_config
+ local = ''
+ remote = ''
+ key = None
+ for opt, val in conf['options']:
+ if opt == 'local':
+ local = 'local ' + val
+ elif opt == 'remote':
+ remote = 'remote ' + val
+ elif opt == 'key':
+ key = val
+ else:
+ pass
+
+ if key == None:
+ raise Exception("Option 'key' not set for a vti device")
+
+ exec_cmd("ip link add %s type vti %s %s key %s" %
+ (conf["name"], local, remote, key))
+
+ def destroy(self):
+ conf = self._dev_config
+ exec_cmd("ip link del %s" % conf["name"])
+
+ def configure(self):
+ #no configuration options supported at the moment
+ return True
+
+ def deconfigure(self):
+ return True
+
type_class_mapping = {
"eth": NetConfigDeviceEth,
"bond": NetConfigDeviceBond,
@@ -422,7 +458,8 @@ type_class_mapping = {
"vlan": NetConfigDeviceVlan,
"team": NetConfigDeviceTeam,
"ovs_bridge": NetConfigDeviceOvsBridge,
- "veth": NetConfigDeviceVEth
+ "veth": NetConfigDeviceVEth,
+ "vti": NetConfigDeviceVti
}
def NetConfigDevice(dev_config, if_manager):
diff --git a/lnst/Slave/NmConfigDevice.py b/lnst/Slave/NmConfigDevice.py
index 37251e9..4e4f9bf 100644
--- a/lnst/Slave/NmConfigDevice.py
+++ b/lnst/Slave/NmConfigDevice.py
@@ -811,6 +811,12 @@ class NmConfigDeviceVEth(NmConfigDeviceGeneric):
def is_nm_managed(cls, dev_config, if_manager):
return False
+class NmConfigDeviceVti(NmConfigDeviceGeneric):
+ #Not supported by NetworkManager
+ @classmethod
+ def is_nm_managed(cls, dev_config, if_manager):
+ return False
+
type_class_mapping = {
"eth": NmConfigDeviceEth,
"bond": NmConfigDeviceBond,
@@ -819,7 +825,8 @@ type_class_mapping = {
"vlan": NmConfigDeviceVlan,
"team": NmConfigDeviceTeam,
"ovs_bridge": NmConfigDeviceOvsBridge,
- "veth": NmConfigDeviceVEth
+ "veth": NmConfigDeviceVEth,
+ "vti": NmConfigDeviceVti
}
def is_nm_managed(dev_config, if_manager):
diff --git a/schema-recipe.rng b/schema-recipe.rng
index f13f36a..594ec5b 100644
--- a/schema-recipe.rng
+++ b/schema-recipe.rng
@@ -136,6 +136,7 @@
<ref name="team"/>
<ref name="ovs_bridge"/>
<ref name="veth_pair"/>
+ <ref name="vti"/>
</choice>
</zeroOrMore>
</element>
@@ -364,6 +365,24 @@
</element>
</define>
+ <define name="vti">
+ <element name="vti">
+ <attribute name="id"/>
+ <optional>
+ <attribute name="netns"/>
+ </optional>
+ <interleave>
+ <optional>
+ <ref name="define"/>
+ </optional>
+
+ <zeroOrMore>
+ <ref name="options"/>
+ </zeroOrMore>
+ </interleave>
+ </element>
+ </define>
+
<define name="options">
<element name="options">
<interleave>
Show replies by date