summaryrefslogtreecommitdiff
path: root/interface-definitions
diff options
context:
space:
mode:
authorIndrajit Raychaudhuri <irc@indrajit.com>2023-11-09 15:06:33 -0600
committerIndrajit Raychaudhuri <irc@indrajit.com>2023-11-09 16:02:18 -0600
commit64322b19d6968195a6dc7c82e7e22126072377f5 (patch)
tree39c2e45a8edee504d7e470d94f7395041e183add /interface-definitions
parent1f4e9bc3860e4829fe35ecfcbf32d9d4eb00f777 (diff)
downloadvyos-1x-64322b19d6968195a6dc7c82e7e22126072377f5.tar.gz
vyos-1x-64322b19d6968195a6dc7c82e7e22126072377f5.zip
T5727: Use native URL validator instead of regex-based validator
Replace regex-based URL validator with native validator from vyos-utils. Also, move `include/url.xml.i` to `include/url-http-https.xml.i` to reflect the fact that it is used only for HTTP(S) URLs.
Diffstat (limited to 'interface-definitions')
-rw-r--r--interface-definitions/dns-dynamic.xml.in2
-rw-r--r--interface-definitions/include/url-http-https.xml.i15
-rw-r--r--interface-definitions/include/url.xml.i15
-rw-r--r--interface-definitions/service-monitoring-telegraf.xml.in6
-rw-r--r--interface-definitions/system-update-check.xml.in2
5 files changed, 20 insertions, 20 deletions
diff --git a/interface-definitions/dns-dynamic.xml.in b/interface-definitions/dns-dynamic.xml.in
index 07b1bf1b8..32c5af9b6 100644
--- a/interface-definitions/dns-dynamic.xml.in
+++ b/interface-definitions/dns-dynamic.xml.in
@@ -38,7 +38,7 @@
<help>Options when using HTTP(S) web request to obtain the IP address</help>
</properties>
<children>
- #include <include/url.xml.i>
+ #include <include/url-http-https.xml.i>
<leafNode name="skip">
<properties>
<help>Pattern to skip from the HTTP(S) respose</help>
diff --git a/interface-definitions/include/url-http-https.xml.i b/interface-definitions/include/url-http-https.xml.i
new file mode 100644
index 000000000..f763c2bb2
--- /dev/null
+++ b/interface-definitions/include/url-http-https.xml.i
@@ -0,0 +1,15 @@
+<!-- include start from url-http-https.xml.i -->
+<leafNode name="url">
+ <properties>
+ <help>Remote URL</help>
+ <valueHelp>
+ <format>url</format>
+ <description>Remote HTTP(S) URL</description>
+ </valueHelp>
+ <constraint>
+ <validator name="url" argument="--scheme http --scheme https"/>
+ </constraint>
+ <constraintErrorMessage>Invalid HTTP(S) URL format</constraintErrorMessage>
+ </properties>
+</leafNode>
+<!-- include end -->
diff --git a/interface-definitions/include/url.xml.i b/interface-definitions/include/url.xml.i
deleted file mode 100644
index caa6f67bd..000000000
--- a/interface-definitions/include/url.xml.i
+++ /dev/null
@@ -1,15 +0,0 @@
-<!-- include start from url.xml.i -->
-<leafNode name="url">
- <properties>
- <help>Remote URL</help>
- <valueHelp>
- <format>url</format>
- <description>Remote URL</description>
- </valueHelp>
- <constraint>
- <regex>^https?:\/\/?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\:[0-9]+)*(\/.*)?</regex>
- </constraint>
- <constraintErrorMessage>Incorrect URL format</constraintErrorMessage>
- </properties>
-</leafNode>
-<!-- include end -->
diff --git a/interface-definitions/service-monitoring-telegraf.xml.in b/interface-definitions/service-monitoring-telegraf.xml.in
index ae0bae900..4d694114a 100644
--- a/interface-definitions/service-monitoring-telegraf.xml.in
+++ b/interface-definitions/service-monitoring-telegraf.xml.in
@@ -53,7 +53,7 @@
</properties>
<defaultValue>main</defaultValue>
</leafNode>
- #include <include/url.xml.i>
+ #include <include/url-http-https.xml.i>
#include <include/port-number.xml.i>
<leafNode name="port">
<defaultValue>8086</defaultValue>
@@ -145,7 +145,7 @@
<constraintErrorMessage>Table is limited to alphanumerical characters and can contain hyphen and underscores</constraintErrorMessage>
</properties>
</leafNode>
- #include <include/url.xml.i>
+ #include <include/url-http-https.xml.i>
</children>
</node>
<leafNode name="source">
@@ -271,7 +271,7 @@
</leafNode>
</children>
</node>
- #include <include/url.xml.i>
+ #include <include/url-http-https.xml.i>
</children>
</node>
#include <include/interface/vrf.xml.i>
diff --git a/interface-definitions/system-update-check.xml.in b/interface-definitions/system-update-check.xml.in
index e4d7041ec..a7d754003 100644
--- a/interface-definitions/system-update-check.xml.in
+++ b/interface-definitions/system-update-check.xml.in
@@ -14,7 +14,7 @@
<valueless/>
</properties>
</leafNode>
- #include <include/url.xml.i>
+ #include <include/url-http-https.xml.i>
</children>
</node>
</children>