From b04a9791226f7953cfa740804ec0d43745605f49 Mon Sep 17 00:00:00 2001
From: Jernej Jakob <jernej.jakob@gmail.com>
Date: Sun, 16 Jun 2019 15:27:03 +0200
Subject: T1439: remove quotes around dhcp6.client-id

---
 src/conf_mode/dhcpv6_server.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf_mode/dhcpv6_server.py b/src/conf_mode/dhcpv6_server.py
index 5430097de..aa9c35fa1 100755
--- a/src/conf_mode/dhcpv6_server.py
+++ b/src/conf_mode/dhcpv6_server.py
@@ -94,7 +94,7 @@ shared-network {{ network.name }} {
         {%- for host in subnet.static_mapping %}
         {% if not host.disabled -%}
         host {{ network.name }}_{{ host.name }} {
-            host-identifier option dhcp6.client-id "{{ host.client_identifier }}";
+            host-identifier option dhcp6.client-id {{ host.client_identifier }};
             fixed-address6 {{ host.ipv6_address }};
         }
         {%- endif %}
-- 
cgit v1.2.3


From f875731a710eb7fadefd5a73d65e53915477dce8 Mon Sep 17 00:00:00 2001
From: Jernej Jakob <jernej.jakob@gmail.com>
Date: Sun, 16 Jun 2019 17:07:16 +0200
Subject: dhcpv6-server: Add name constraint, clarify help, fix typos

---
 interface-definitions/dhcpv6-server.xml | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/interface-definitions/dhcpv6-server.xml b/interface-definitions/dhcpv6-server.xml
index e63eb2242..bf049cf7a 100644
--- a/interface-definitions/dhcpv6-server.xml
+++ b/interface-definitions/dhcpv6-server.xml
@@ -268,7 +268,7 @@
                   </leafNode>
                   <leafNode name="sntp-server">
                     <properties>
-                      <help>IPv6 address of an SNTP Server for client to use</help>
+                      <help>IPv6 address of an SNTP server for client to use</help>
                       <constraint>
                         <validator name="ipv6-address"/>
                       </constraint>
@@ -278,25 +278,29 @@
                   <tagNode name="static-mapping">
                     <properties>
                       <help>Name of static mapping</help>
+                      <constraint>
+                        <regex>^[-_a-zA-Z0-9.]+$</regex>
+                      </constraint>
+                      <constraintErrorMessage>Invalid static-mapping name</constraintErrorMessage>
                     </properties>
                     <children>
                       <leafNode name="disable">
                         <properties>
-                          <help>Option to disable static-mapping</help>
+                          <help>Option to disable static mapping</help>
                           <valueless/>
                         </properties>
                       </leafNode>
                       <leafNode name="identifier">
                         <properties>
-                          <help>Client identifier for this static mapping</help>
+                          <help>Client identifier (DUID) for this static mapping [REQUIRED]</help>
                         </properties>
                       </leafNode>
                       <leafNode name="ipv6-address">
                         <properties>
-                          <help>Client IPv5 address for this static mapping</help>
+                          <help>Client IPv6 address for this static mapping [REQUIRED]</help>
                           <valueHelp>
                             <format>ipv6</format>
-                            <description>IPv6 address for this tatic mapping</description>
+                            <description>IPv6 address for this static mapping [REQUIRED]</description>
                           </valueHelp>
                           <constraint>
                             <validator name="ipv6-address"/>
-- 
cgit v1.2.3


From 87df87e3983e120ad171ae9dc2966309fc14fcd8 Mon Sep 17 00:00:00 2001
From: Jernej Jakob <jernej.jakob@gmail.com>
Date: Sun, 16 Jun 2019 19:22:49 +0200
Subject: T1439: add dhcpv6-client-id validator

---
 interface-definitions/dhcpv6-server.xml |  9 ++++++++-
 src/validators/dhcpv6-client-id         | 28 ++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100755 src/validators/dhcpv6-client-id

diff --git a/interface-definitions/dhcpv6-server.xml b/interface-definitions/dhcpv6-server.xml
index bf049cf7a..b1e5c8d6c 100644
--- a/interface-definitions/dhcpv6-server.xml
+++ b/interface-definitions/dhcpv6-server.xml
@@ -281,7 +281,7 @@
                       <constraint>
                         <regex>^[-_a-zA-Z0-9.]+$</regex>
                       </constraint>
-                      <constraintErrorMessage>Invalid static-mapping name</constraintErrorMessage>
+                      <constraintErrorMessage>Invalid static-mapping name. May only contain letters, numbers and .-_</constraintErrorMessage>
                     </properties>
                     <children>
                       <leafNode name="disable">
@@ -293,6 +293,13 @@
                       <leafNode name="identifier">
                         <properties>
                           <help>Client identifier (DUID) for this static mapping [REQUIRED]</help>
+                          <valueHelp>
+                            <format>h[[:h]...]</format>
+                            <description>DUID: colon-separated hex list (as used by isc-dhcp option dhcpv6.client-id)</description>
+                          </valueHelp>
+                          <constraint>
+                            <validator name="dhcpv6-client-id"/>
+                          </constraint>
                         </properties>
                       </leafNode>
                       <leafNode name="ipv6-address">
diff --git a/src/validators/dhcpv6-client-id b/src/validators/dhcpv6-client-id
new file mode 100755
index 000000000..a8c3e60b6
--- /dev/null
+++ b/src/validators/dhcpv6-client-id
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2019 VyOS maintainers and contributors
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or later as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+#
+
+import sys
+import re
+
+if len(sys.argv) == 2:
+  pattern = "^([0-9A-Fa-f]{1,2}[:])*([0-9A-Fa-f]{1,2})$"
+  if re.match(pattern, sys.argv[1]):
+    sys.exit(0)
+  else:
+    sys.exit(1)
+
-- 
cgit v1.2.3


From 6a6634b02d73cc93cd7368cf2290940b57fae9c7 Mon Sep 17 00:00:00 2001
From: Jernej Jakob <jernej.jakob@gmail.com>
Date: Sun, 16 Jun 2019 21:59:01 +0200
Subject: T1439: move DUID validator to regex

---
 interface-definitions/dhcpv6-server.xml |  2 +-
 src/validators/dhcpv6-client-id         | 28 ----------------------------
 2 files changed, 1 insertion(+), 29 deletions(-)
 delete mode 100755 src/validators/dhcpv6-client-id

diff --git a/interface-definitions/dhcpv6-server.xml b/interface-definitions/dhcpv6-server.xml
index b1e5c8d6c..09ffe67ed 100644
--- a/interface-definitions/dhcpv6-server.xml
+++ b/interface-definitions/dhcpv6-server.xml
@@ -298,7 +298,7 @@
                             <description>DUID: colon-separated hex list (as used by isc-dhcp option dhcpv6.client-id)</description>
                           </valueHelp>
                           <constraint>
-                            <validator name="dhcpv6-client-id"/>
+                            <regex>^([0-9A-Fa-f]{1,2}[:])*([0-9A-Fa-f]{1,2})$</regex>
                           </constraint>
                         </properties>
                       </leafNode>
diff --git a/src/validators/dhcpv6-client-id b/src/validators/dhcpv6-client-id
deleted file mode 100755
index a8c3e60b6..000000000
--- a/src/validators/dhcpv6-client-id
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env python3
-#
-# Copyright (C) 2019 VyOS maintainers and contributors
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 or later as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-#
-
-import sys
-import re
-
-if len(sys.argv) == 2:
-  pattern = "^([0-9A-Fa-f]{1,2}[:])*([0-9A-Fa-f]{1,2})$"
-  if re.match(pattern, sys.argv[1]):
-    sys.exit(0)
-  else:
-    sys.exit(1)
-
-- 
cgit v1.2.3


From 03c09b1b0d7dfdab9fc87bc7b017455c45141ced Mon Sep 17 00:00:00 2001
From: Jernej Jakob <jernej.jakob@gmail.com>
Date: Sun, 16 Jun 2019 22:52:05 +0200
Subject: T1439: remove beginning and end anchors, they are implied with
 re.fullmatch

---
 interface-definitions/dhcpv6-server.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/interface-definitions/dhcpv6-server.xml b/interface-definitions/dhcpv6-server.xml
index 09ffe67ed..e18a58608 100644
--- a/interface-definitions/dhcpv6-server.xml
+++ b/interface-definitions/dhcpv6-server.xml
@@ -279,7 +279,7 @@
                     <properties>
                       <help>Name of static mapping</help>
                       <constraint>
-                        <regex>^[-_a-zA-Z0-9.]+$</regex>
+                        <regex>[-_a-zA-Z0-9.]+</regex>
                       </constraint>
                       <constraintErrorMessage>Invalid static-mapping name. May only contain letters, numbers and .-_</constraintErrorMessage>
                     </properties>
@@ -298,7 +298,7 @@
                             <description>DUID: colon-separated hex list (as used by isc-dhcp option dhcpv6.client-id)</description>
                           </valueHelp>
                           <constraint>
-                            <regex>^([0-9A-Fa-f]{1,2}[:])*([0-9A-Fa-f]{1,2})$</regex>
+                            <regex>([0-9A-Fa-f]{1,2}[:])*([0-9A-Fa-f]{1,2})</regex>
                           </constraint>
                         </properties>
                       </leafNode>
-- 
cgit v1.2.3