Repository: cobbler/cobbler

Issue:
allow to set IPv6 netmask
It is currently not possible to specify an IPv6 netmask for a system interface in cobbler:

cobbler system edit --name=test1.linux-ipv6.be --interface=eth0  --ipv6-address=2001:123:456:789::8:2/112
Returns this error: invalid format for IPv6 IP address (2001:123:456:789::8:2/112)

Please add a parameter to set the IPv6 netmask.



Discussion:

Resolving patch:
diff --git a/cobbler/field_info.py b/cobbler/field_info.py
--- a/cobbler/field_info.py
+++ b/cobbler/field_info.py
@@ -140,6 +140,7 @@
    "*netmask"        : "Networking",
    "*if_gateway"     : "Networking",
    "*ipv6_address"   : "Networking",
+   "*ipv6_prefix"    : "Networking",
    "*ipv6_secondaries"      : "Networking",
    "*ipv6_mtu"              : "Networking",
    "*ipv6_static_routes"    : "Networking",
diff --git a/cobbler/item_system.py b/cobbler/item_system.py
--- a/cobbler/item_system.py
+++ b/cobbler/item_system.py
@@ -86,6 +86,7 @@
   ["*static_routes",[],0,"Static Routes",True,"Should be used with --interface",0,"list"],
   ["*virt_bridge","",0,"Virt Bridge",True,"Should be used with --interface",0,"str"],
   ["*ipv6_address","",0,"IPv6 Address",True,"Should be used with --interface",0,"str"],
+  ["*ipv6_prefix","",0,"IPv6 Prefix",True,"Should be used with --interface",0,"str"],
   ["*ipv6_secondaries",[],0,"IPv6 Secondaries",True,"Space delimited. Should be used with --interface",0,"list"],
   ["*ipv6_mtu","",0,"IPv6 MTU",True,"Should be used with --interface",0,"str"],
   ["*ipv6_static_routes",[],0,"IPv6 Static Routes",True,"Should be used with --interface",0,"list"],
@@ -178,6 +179,7 @@ def __get_interface(self,name):
                 "dns_name"             : "",
                 "static_routes"        : [],
                 "ipv6_address"         : "",
+                "ipv6_prefix"          : "",
                 "ipv6_secondaries"     : [],
                 "ipv6_mtu"             : "",
                 "ipv6_static_routes"   : [],
@@ -480,6 +482,14 @@ def set_ipv6_address(self,address,interface):
            return True
         raise CX(_("invalid format for IPv6 IP address (%s)") % address)
 
+    def set_ipv6_prefix(self, prefix, interface):
+        """
+        Assign a IPv6 prefix
+        """
+        intf = self.__get_interface(interface)
+        intf["ipv6_prefix"] = prefix.strip()
+        return True
+
     def set_ipv6_secondaries(self,addresses,interface):
         intf = self.__get_interface(interface)
         data = utils.input_string_or_list(addresses)
@@ -708,6 +718,7 @@ def modify_interface(self, hash):
             if field == "management"          : self.set_management(value, interface)
             if field == "staticroutes"        : self.set_static_routes(value, interface)
             if field == "ipv6address"         : self.set_ipv6_address(value, interface)
+            if field == "ipv6prefix"          : self.set_ipv6_prefix(value, interface)
             if field == "ipv6secondaries"     : self.set_ipv6_secondaries(value, interface)
             if field == "ipv6mtu"             : self.set_ipv6_mtu(value, interface)
             if field == "ipv6staticroutes"    : self.set_ipv6_static_routes(value, interface)


Test patch: