This patch adds support for vti6 device in LNST. It is similar to vti device
that is already supported but works on top of IPv6 stack.
To use it you need a system with iproute2 v3.17 to make vti6 working.
The recipe xml looks like this:
<lnstrecipe>
<network>
<host id="1">
<interfaces>
<eth id="phy1" label="default" />
<vti6 id="vti6_one">
<options>
<option name="local"
value="2002::1/64"/>
<option name="remote"
value="2002::2/64"/>
<option name="key" value="10"/>
</options>
</vti6>
</interfaces>
</host>
</network>
<task>
<run command="ip link show" host="1"/>
</task>
</lnstrecipe>
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Controller/RecipeParser.py | 2 +-
lnst/Slave/InterfaceManager.py | 2 ++
lnst/Slave/NetConfigDevice.py | 40 ++++++++++++++++++++++++++++++++++++++++
lnst/Slave/NmConfigDevice.py | 7 +++++++
schema-recipe.rng | 19 +++++++++++++++++++
5 files changed, 69 insertions(+), 1 deletion(-)
diff --git a/lnst/Controller/RecipeParser.py b/lnst/Controller/RecipeParser.py
index 73422f1..12b4506 100644
--- a/lnst/Controller/RecipeParser.py
+++ b/lnst/Controller/RecipeParser.py
@@ -157,7 +157,7 @@ class RecipeParser(XmlParser):
opts = self._process_options(opts_tag)
if len(opts) > 0:
iface["options"] = opts
- elif iface["type"] in ["vti"]:
+ elif iface["type"] in ["vti", "vti6"]:
# interface options
opts_tag = iface_tag.find("options")
opts = self._process_options(opts_tag)
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index ab7efcd..fae80b8 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -250,6 +250,8 @@ class InterfaceManager(object):
return self._assign_name_pair("veth")
elif dev_type == "vti":
return self._assign_name_generic("vti")
+ elif dev_type == "vti6":
+ return self._assign_name_generic("t_ip6vti")
else:
return self._assign_name_generic("dev")
diff --git a/lnst/Slave/NetConfigDevice.py b/lnst/Slave/NetConfigDevice.py
index 6569410..a065f00 100644
--- a/lnst/Slave/NetConfigDevice.py
+++ b/lnst/Slave/NetConfigDevice.py
@@ -490,6 +490,45 @@ class NetConfigDeviceVti(NetConfigDeviceGeneric):
def deconfigure(self):
return True
+class NetConfigDeviceVti6(NetConfigDeviceGeneric):
+ _modulename = ""
+ _moduleload = False
+
+ def create(self):
+ conf = self._dev_config
+ local = ''
+ remote = ''
+ key = None
+ device = ''
+ for opt, val in conf['options']:
+ if opt == 'local':
+ local = 'local ' + val
+ elif opt == 'remote':
+ remote = 'remote ' + val
+ elif opt == 'key':
+ key = val
+ elif opt == 'dev':
+ device = 'dev ' + val
+ else:
+ pass
+
+ if key == None:
+ raise Exception("Option 'key' not set for a vti6 device")
+
+ exec_cmd("ip link add %s type vti6 %s %s key %s %s" %
+ (conf["name"], local, remote, key,
device))
+
+ 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,
@@ -500,6 +539,7 @@ type_class_mapping = {
"ovs_bridge": NetConfigDeviceOvsBridge,
"veth": NetConfigDeviceVEth,
"vti": NetConfigDeviceVti,
+ "vti6": NetConfigDeviceVti6,
"lo": NetConfigDeviceLoopback
}
diff --git a/lnst/Slave/NmConfigDevice.py b/lnst/Slave/NmConfigDevice.py
index 8e2f1dd..4875c07 100644
--- a/lnst/Slave/NmConfigDevice.py
+++ b/lnst/Slave/NmConfigDevice.py
@@ -833,6 +833,12 @@ class NmConfigDeviceVti(NmConfigDeviceGeneric):
def is_nm_managed(cls, dev_config, if_manager):
return False
+class NmConfigDeviceVti6(NmConfigDeviceGeneric):
+ #Not supported by NetworkManager
+ @classmethod
+ def is_nm_managed(cls, dev_config, if_manager):
+ return False
+
class NmConfigDeviceLoopback(NmConfigDeviceGeneric):
#Not supported by NetworkManager
@classmethod
@@ -849,6 +855,7 @@ type_class_mapping = {
"ovs_bridge": NmConfigDeviceOvsBridge,
"veth": NmConfigDeviceVEth,
"vti": NmConfigDeviceVti,
+ "vti6": NmConfigDeviceVti6,
"lo": NmConfigDeviceLoopback
}
diff --git a/schema-recipe.rng b/schema-recipe.rng
index 4cb0e9e..c1ffbed 100644
--- a/schema-recipe.rng
+++ b/schema-recipe.rng
@@ -137,6 +137,7 @@
<ref name="ovs_bridge"/>
<ref name="veth_pair"/>
<ref name="vti"/>
+ <ref name="vti6"/>
<ref name="lo"/>
</choice>
</zeroOrMore>
@@ -392,6 +393,24 @@
</element>
</define>
+ <define name="vti6">
+ <element name="vti6">
+ <attribute name="id"/>
+ <optional>
+ <attribute name="netns"/>
+ </optional>
+ <interleave>
+ <optional>
+ <ref name="define"/>
+ </optional>
+
+ <zeroOrMore>
+ <ref name="options"/>
+ </zeroOrMore>
+ </interleave>
+ </element>
+ </define>
+
<define name="lo">
<element name="lo">
<attribute name="id"/>
--
1.9.3