From 0ca6d38c846a2a04c43e79e6cf1ba65831979e2f Mon Sep 17 00:00:00 2001
From: Christian Poessinger <christian@poessinger.com>
Date: Tue, 6 Oct 2020 07:57:34 +0200
Subject: xml: include: add common helper file for listen-address

---
 interface-definitions/dns-forwarding.xml.in        | 19 +------------------
 interface-definitions/include/listen-address.xml.i | 20 ++++++++++++++++++++
 interface-definitions/ntp.xml.in                   | 19 +------------------
 interface-definitions/ssh.xml.in                   | 19 +------------------
 interface-definitions/tftp-server.xml.in           | 19 +------------------
 5 files changed, 24 insertions(+), 72 deletions(-)
 create mode 100644 interface-definitions/include/listen-address.xml.i

diff --git a/interface-definitions/dns-forwarding.xml.in b/interface-definitions/dns-forwarding.xml.in
index 07e63d54a..c519676f3 100644
--- a/interface-definitions/dns-forwarding.xml.in
+++ b/interface-definitions/dns-forwarding.xml.in
@@ -128,24 +128,7 @@
                   </constraint>
                 </properties>
               </leafNode>
-              <leafNode name="listen-address">
-                <properties>
-                  <help>Addresses to listen for DNS queries [REQUIRED]</help>
-                  <valueHelp>
-                    <format>ipv4</format>
-                    <description>Domain Name Server (DNS) IPv4 address</description>
-                  </valueHelp>
-                  <valueHelp>
-                    <format>ipv6</format>
-                    <description>Domain Name Server (DNS) IPv6 address</description>
-                  </valueHelp>
-                  <multi/>
-                  <constraint>
-                    <validator name="ipv4-address"/>
-                    <validator name="ipv6-address"/>
-                  </constraint>
-                </properties>
-              </leafNode>
+              #include <include/listen-address.xml.i>
               <leafNode name="negative-ttl">
                 <properties>
                   <help>Maximum amount of time negative entries are cached (default: 3600)</help>
diff --git a/interface-definitions/include/listen-address.xml.i b/interface-definitions/include/listen-address.xml.i
new file mode 100644
index 000000000..e474344e4
--- /dev/null
+++ b/interface-definitions/include/listen-address.xml.i
@@ -0,0 +1,20 @@
+<!-- included start from listen-address.xml.i -->
+<leafNode name="listen-address">
+  <properties>
+    <help>Local IP addresses for service to listen on</help>
+    <valueHelp>
+      <format>ipv4</format>
+      <description>IP address to listen for incoming connections</description>
+    </valueHelp>
+    <valueHelp>
+      <format>ipv6</format>
+      <description>IPv6 address to listen for incoming connections</description>
+    </valueHelp>
+    <multi/>
+    <constraint>
+      <validator name="ipv4-address"/>
+      <validator name="ipv6-address"/>
+    </constraint>
+  </properties>
+</leafNode>
+<!-- included end -->
diff --git a/interface-definitions/ntp.xml.in b/interface-definitions/ntp.xml.in
index 485487a42..6070cafe0 100644
--- a/interface-definitions/ntp.xml.in
+++ b/interface-definitions/ntp.xml.in
@@ -58,24 +58,7 @@
               </leafNode>
             </children>
           </node>
-          <leafNode name="listen-address">
-            <properties>
-              <help>Addresses to listen for NTP queries</help>
-              <valueHelp>
-                <format>ipv4</format>
-                <description>Network Time Protocol (NTP) IPv4 address</description>
-              </valueHelp>
-              <valueHelp>
-                <format>ipv6</format>
-                <description>Network Time Protocol (NTP) IPv6 address</description>
-              </valueHelp>
-              <multi/>
-              <constraint>
-                <validator name="ipv4-address"/>
-                <validator name="ipv6-address"/>
-              </constraint>
-            </properties>
-          </leafNode>
+          #include <include/listen-address.xml.i>
           #include <include/interface-vrf.xml.i>
         </children>
       </node>
diff --git a/interface-definitions/ssh.xml.in b/interface-definitions/ssh.xml.in
index d253c2f34..3db740131 100644
--- a/interface-definitions/ssh.xml.in
+++ b/interface-definitions/ssh.xml.in
@@ -110,24 +110,7 @@
               </constraint>
             </properties>
           </leafNode>
-          <leafNode name="listen-address">
-            <properties>
-              <help>Local addresses SSH service should listen on</help>
-              <valueHelp>
-                <format>ipv4</format>
-                <description>IP address to listen for incoming connections</description>
-              </valueHelp>
-              <valueHelp>
-                <format>ipv6</format>
-                <description>IPv6 address to listen for incoming connections</description>
-              </valueHelp>
-              <multi/>
-              <constraint>
-                <validator name="ipv4-address"/>
-                <validator name="ipv6-address"/>
-              </constraint>
-            </properties>
-          </leafNode>
+          #include <include/listen-address.xml.i>
           <leafNode name="loglevel">
             <properties>
               <help>Log level</help>
diff --git a/interface-definitions/tftp-server.xml.in b/interface-definitions/tftp-server.xml.in
index 2874b034c..eea6fe531 100644
--- a/interface-definitions/tftp-server.xml.in
+++ b/interface-definitions/tftp-server.xml.in
@@ -32,24 +32,7 @@
               </constraint>
             </properties>
           </leafNode>
-          <leafNode name="listen-address">
-            <properties>
-              <help>Addresses for TFTP server to listen [REQUIRED]</help>
-              <valueHelp>
-                <format>ipv4</format>
-                <description>TFTP IPv4 listen address</description>
-              </valueHelp>
-              <valueHelp>
-                <format>ipv6</format>
-                <description>TFTP IPv6 listen address</description>
-              </valueHelp>
-              <multi/>
-              <constraint>
-                <validator name="ipv4-address"/>
-                <validator name="ipv6-address"/>
-              </constraint>
-            </properties>
-          </leafNode>
+          #include <include/listen-address.xml.i>
         </children>
       </node>
     </children>
-- 
cgit v1.2.3