summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface-definitions/include/bfd.xml.i8
-rw-r--r--interface-definitions/include/isis/isis-redistribute-ipv4.xml.i (renamed from interface-definitions/include/isis-redistribute-ipv4.xml.i)2
-rw-r--r--interface-definitions/include/isis/passive.xml.i8
-rw-r--r--interface-definitions/include/ospf/ospf-interface-common.xml.i7
-rw-r--r--interface-definitions/policy-lists.xml.in20
-rw-r--r--interface-definitions/protocols-isis.xml.in26
-rw-r--r--interface-definitions/protocols-ospfv3.xml.in7
-rw-r--r--op-mode-definitions/show-ntp.xml.in9
-rwxr-xr-xsrc/conf_mode/protocols_ospf.py13
-rwxr-xr-xsrc/op_mode/show_ntp.sh39
-rwxr-xr-xsrc/validators/interface-name19
11 files changed, 101 insertions, 57 deletions
diff --git a/interface-definitions/include/bfd.xml.i b/interface-definitions/include/bfd.xml.i
new file mode 100644
index 000000000..2bc3664e1
--- /dev/null
+++ b/interface-definitions/include/bfd.xml.i
@@ -0,0 +1,8 @@
+<!-- include start from bfd.xml.i -->
+<leafNode name="bfd">
+ <properties>
+ <help>Enable Bidirectional Forwarding Detection (BFD)</help>
+ <valueless/>
+ </properties>
+</leafNode>
+<!-- include end -->
diff --git a/interface-definitions/include/isis-redistribute-ipv4.xml.i b/interface-definitions/include/isis/isis-redistribute-ipv4.xml.i
index 774086a81..df48b4d28 100644
--- a/interface-definitions/include/isis-redistribute-ipv4.xml.i
+++ b/interface-definitions/include/isis/isis-redistribute-ipv4.xml.i
@@ -1,4 +1,4 @@
-<!-- include start from isis-redistribute-ipv4.xml.i -->
+<!-- include start from isis/isis-redistribute-ipv4.xml.i -->
<node name="level-1">
<properties>
<help>Redistribute into level-1</help>
diff --git a/interface-definitions/include/isis/passive.xml.i b/interface-definitions/include/isis/passive.xml.i
new file mode 100644
index 000000000..6d05f8cc7
--- /dev/null
+++ b/interface-definitions/include/isis/passive.xml.i
@@ -0,0 +1,8 @@
+<!-- include start from isis/passive.xml.i -->
+<leafNode name="passive">
+ <properties>
+ <help>Configure passive mode for interface</help>
+ <valueless/>
+ </properties>
+</leafNode>
+<!-- include end -->
diff --git a/interface-definitions/include/ospf/ospf-interface-common.xml.i b/interface-definitions/include/ospf/ospf-interface-common.xml.i
index c0069ccb5..39e90482c 100644
--- a/interface-definitions/include/ospf/ospf-interface-common.xml.i
+++ b/interface-definitions/include/ospf/ospf-interface-common.xml.i
@@ -1,10 +1,5 @@
<!-- include start from ospf/ospf-interface-common.xml.i -->
-<leafNode name="bfd">
- <properties>
- <help>Enable Bidirectional Forwarding Detection (BFD) support</help>
- <valueless/>
- </properties>
-</leafNode>
+#include <include/bfd.xml.i>
<leafNode name="cost">
<properties>
<help>Interface cost</help>
diff --git a/interface-definitions/policy-lists.xml.in b/interface-definitions/policy-lists.xml.in
index 0fece6594..a0bea2ce2 100644
--- a/interface-definitions/policy-lists.xml.in
+++ b/interface-definitions/policy-lists.xml.in
@@ -9,6 +9,7 @@
<tagNode name="access-list">
<properties>
<help>IP access-list filter</help>
+ <priority>470</priority>
<valueHelp>
<format>u32:1-99</format>
<description>IP standard access list</description>
@@ -144,10 +145,10 @@
</tagNode>
</children>
</tagNode>
- <!-- END access-list -->
<tagNode name="access-list6">
<properties>
<help>IPv6 access-list filter</help>
+ <priority>470</priority>
<valueHelp>
<format>txt</format>
<description>Name of IPv6 access-list</description>
@@ -204,10 +205,10 @@
</tagNode>
</children>
</tagNode>
- <!-- END access-list6 -->
<tagNode name="as-path-list">
<properties>
<help>Border Gateway Protocol (BGP) autonomous system path filter</help>
+ <priority>470</priority>
<valueHelp>
<format>txt</format>
<description>AS path list name</description>
@@ -242,10 +243,10 @@
</tagNode>
</children>
</tagNode>
- <!-- END as-path-list -->
<tagNode name="community-list">
<properties>
<help>Border Gateway Protocol (BGP) autonomous system path filter</help>
+ <priority>470</priority>
<valueHelp>
<format>txt</format>
<description>Border Gateway Protocol (BGP) community-list filter</description>
@@ -280,10 +281,10 @@
</tagNode>
</children>
</tagNode>
- <!-- END community-list -->
<tagNode name="extcommunity-list">
<properties>
<help>Border Gateway Protocol (BGP) extended community-list filter</help>
+ <priority>490</priority>
<valueHelp>
<format>txt</format>
<description>Border Gateway Protocol (BGP) extended community-list filter</description>
@@ -326,10 +327,10 @@
</tagNode>
</children>
</tagNode>
- <!-- END extcommunity-list -->
<tagNode name="large-community-list">
<properties>
<help>Border Gateway Protocol (BGP) large-community-list filter</help>
+ <priority>470</priority>
<valueHelp>
<format>txt</format>
<description>Border Gateway Protocol (BGP) large-community-list filter</description>
@@ -364,10 +365,10 @@
</tagNode>
</children>
</tagNode>
- <!-- END large-community-list -->
<tagNode name="prefix-list">
<properties>
<help>IP prefix-list filter</help>
+ <priority>470</priority>
<valueHelp>
<format>txt</format>
<description>Prefix list name</description>
@@ -429,10 +430,10 @@
</tagNode>
</children>
</tagNode>
- <!-- END prefix-list -->
<tagNode name="prefix-list6">
<properties>
<help>IPv6 prefix-list filter</help>
+ <priority>470</priority>
<valueHelp>
<format>txt</format>
<description>Prefix list name</description>
@@ -494,10 +495,10 @@
</tagNode>
</children>
</tagNode>
- <!-- END prefix-list6 -->
<tagNode name="route-map">
<properties>
<help>IP route-map</help>
+ <priority>470</priority>
<valueHelp>
<format>txt</format>
<description>Route map name</description>
@@ -1028,7 +1029,7 @@
<format>none</format>
<description>none</description>
</valueHelp>
- <!-- Need to add properly validator
+ <!-- Need to add properly validator
<constraint>
<regex>^(local-AS|no-advertise|no-export|internet|additive|none)$</regex>
</constraint> -->
@@ -1260,7 +1261,6 @@
</tagNode>
</children>
</tagNode>
- <!-- END route-map -->
</children>
</node>
</interfaceDefinition>
diff --git a/interface-definitions/protocols-isis.xml.in b/interface-definitions/protocols-isis.xml.in
index 5b26d6923..0afa8dcb1 100644
--- a/interface-definitions/protocols-isis.xml.in
+++ b/interface-definitions/protocols-isis.xml.in
@@ -489,7 +489,7 @@
<help>Border Gateway Protocol (BGP)</help>
</properties>
<children>
- #include <include/isis-redistribute-ipv4.xml.i>
+ #include <include/isis/isis-redistribute-ipv4.xml.i>
</children>
</node>
<node name="connected">
@@ -497,7 +497,7 @@
<help>Redistribute connected routes into IS-IS</help>
</properties>
<children>
- #include <include/isis-redistribute-ipv4.xml.i>
+ #include <include/isis/isis-redistribute-ipv4.xml.i>
</children>
</node>
<node name="kernel">
@@ -505,7 +505,7 @@
<help>Redistribute kernel routes into IS-IS</help>
</properties>
<children>
- #include <include/isis-redistribute-ipv4.xml.i>
+ #include <include/isis/isis-redistribute-ipv4.xml.i>
</children>
</node>
<node name="ospf">
@@ -513,7 +513,7 @@
<help>Redistribute OSPF routes into IS-IS</help>
</properties>
<children>
- #include <include/isis-redistribute-ipv4.xml.i>
+ #include <include/isis/isis-redistribute-ipv4.xml.i>
</children>
</node>
<node name="rip">
@@ -521,7 +521,7 @@
<help>Redistribute RIP routes into IS-IS</help>
</properties>
<children>
- #include <include/isis-redistribute-ipv4.xml.i>
+ #include <include/isis/isis-redistribute-ipv4.xml.i>
</children>
</node>
<node name="static">
@@ -529,7 +529,7 @@
<help>Redistribute static routes into IS-IS</help>
</properties>
<children>
- #include <include/isis-redistribute-ipv4.xml.i>
+ #include <include/isis/isis-redistribute-ipv4.xml.i>
</children>
</node>
</children>
@@ -637,12 +637,7 @@
</completionHelp>
</properties>
<children>
- <leafNode name="bfd">
- <properties>
- <help>Enable BFD support</help>
- <valueless/>
- </properties>
- </leafNode>
+ #include <include/bfd.xml.i>
<leafNode name="circuit-type">
<properties>
<help>Configure circuit type for interface</help>
@@ -721,12 +716,7 @@
</leafNode>
</children>
</node>
- <leafNode name="passive">
- <properties>
- <help>Configure the passive mode for interface</help>
- <valueless/>
- </properties>
- </leafNode>
+ #include <include/isis/passive.xml.i>
<node name="password">
<properties>
<help>Configure the authentication password for a circuit</help>
diff --git a/interface-definitions/protocols-ospfv3.xml.in b/interface-definitions/protocols-ospfv3.xml.in
index 06787b604..f4f403e93 100644
--- a/interface-definitions/protocols-ospfv3.xml.in
+++ b/interface-definitions/protocols-ospfv3.xml.in
@@ -163,12 +163,7 @@
<constraintErrorMessage>Must be broadcast or point-to-point</constraintErrorMessage>
</properties>
</leafNode>
- <leafNode name="passive">
- <properties>
- <help>Disable forming of adjacency</help>
- <valueless/>
- </properties>
- </leafNode>
+ #include <include/isis/passive.xml.i>
</children>
</tagNode>
<node name="parameters">
diff --git a/op-mode-definitions/show-ntp.xml.in b/op-mode-definitions/show-ntp.xml.in
index b7f0acdf8..01f4477d8 100644
--- a/op-mode-definitions/show-ntp.xml.in
+++ b/op-mode-definitions/show-ntp.xml.in
@@ -6,7 +6,7 @@
<properties>
<help>Show peer status of NTP daemon</help>
</properties>
- <command>if ps -C ntpd &amp;&gt;/dev/null; then ntpq -n -c peers; else echo NTP daemon disabled; fi</command>
+ <command>${vyos_op_scripts_dir}/show_ntp.sh --basic</command>
<children>
<tagNode name="server">
<properties>
@@ -15,15 +15,14 @@
<script>${vyos_completion_dir}/list_ntp_servers.sh</script>
</completionHelp>
</properties>
- <command>/usr/sbin/ntpdate -q "$4"</command>
+ <command>${vyos_op_scripts_dir}/show_ntp.sh --server "$4"</command>
</tagNode>
<node name="info">
<properties>
<help>Show NTP operational summary</help>
</properties>
- <command>if ps -C ntpd &amp;&gt;/dev/null; then ntpq -n -c sysinfo; ntpq -n -c kerninfo; else echo NTP daemon disabled; fi</command>
- </node>
-
+ <command>${vyos_op_scripts_dir}/show_ntp.sh --info</command>
+ </node>
</children>
</node>
</children>
diff --git a/src/conf_mode/protocols_ospf.py b/src/conf_mode/protocols_ospf.py
index 30246594a..08347aa52 100755
--- a/src/conf_mode/protocols_ospf.py
+++ b/src/conf_mode/protocols_ospf.py
@@ -50,7 +50,8 @@ def get_config(config=None):
# eqivalent of the C foo ? 'a' : 'b' statement
base = vrf and ['vrf', 'name', vrf, 'protocols', 'ospf'] or base_path
- ospf = conf.get_config_dict(base, key_mangling=('-', '_'), get_first_key=True)
+ ospf = conf.get_config_dict(base, key_mangling=('-', '_'),
+ get_first_key=True)
# Assign the name of our VRF context. This MUST be done before the return
# statement below, else on deletion we will delete the default instance
@@ -91,6 +92,7 @@ def get_config(config=None):
for protocol in ['bgp', 'connected', 'isis', 'kernel', 'rip', 'static']:
if dict_search(f'redistribute.{protocol}', ospf) is None:
del default_values['redistribute'][protocol]
+
# XXX: T2665: we currently have no nice way for defaults under tag nodes,
# clean them out and add them manually :(
del default_values['neighbor']
@@ -152,10 +154,11 @@ def verify(ospf):
f'concurrently for {interface}!')
if 'vrf' in ospf:
- # If interface specific options are set, we must ensure that the
- # interface is bound to our requesting VRF. Due to the VyOS/Vyatta
- # priorities the interface is bound to the VRF after creation of
- # the VRF itself, and before any routing protocol is configured.
+ # If interface specific options are set, we must ensure that
+ # the interface is bound to our requesting VRF. Due to the VyOS
+ # priorities the interface is bound to the VRF after creation
+ # of the VRF itself, and before any routing protocol is
+ # configured.
vrf = ospf['vrf']
tmp = get_interface_config(interface)
if 'master' not in tmp or tmp['master'] != vrf:
diff --git a/src/op_mode/show_ntp.sh b/src/op_mode/show_ntp.sh
new file mode 100755
index 000000000..e9dd6c5c9
--- /dev/null
+++ b/src/op_mode/show_ntp.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+basic=0
+info=0
+
+while [[ "$#" -gt 0 ]]; do
+ case $1 in
+ --info) info=1 ;;
+ --basic) basic=1 ;;
+ --server) server=$2; shift ;;
+ *) echo "Unknown parameter passed: $1" ;;
+ esac
+ shift
+done
+
+if ! ps -C ntpd &>/dev/null; then
+ echo NTP daemon disabled
+ exit 1
+fi
+
+PID=$(pgrep ntpd)
+VRF_NAME=$(ip vrf identify ${PID})
+
+if [ ! -z ${VRF_NAME} ]; then
+ VRF_CMD="sudo ip vrf exec ${VRF_NAME}"
+fi
+
+if [ $basic -eq 1 ]; then
+ $VRF_CMD ntpq -n -c peers
+elif [ $info -eq 1 ]; then
+ echo "=== sysingo ==="
+ $VRF_CMD ntpq -n -c sysinfo
+ echo
+ echo "=== kerninfo ==="
+ $VRF_CMD ntpq -n -c kerninfo
+elif [ ! -z $server ]; then
+ $VRF_CMD /usr/sbin/ntpdate -q $server
+fi
+
diff --git a/src/validators/interface-name b/src/validators/interface-name
index 72e9fd54a..5bac671b1 100755
--- a/src/validators/interface-name
+++ b/src/validators/interface-name
@@ -14,14 +14,21 @@
# 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 os
import re
-import sys
+
+from sys import argv
+from sys import exit
pattern = '^(bond|br|dum|en|ersp|eth|gnv|lan|l2tp|l2tpeth|macsec|peth|ppp|pppoe|pptp|sstp|tun|vti|vtun|vxlan|wg|wlan|wlm)[0-9]+(.\d+)?|lo$'
if __name__ == '__main__':
- if len(sys.argv) != 2:
- sys.exit(1)
- if not re.match(pattern, sys.argv[1]):
- sys.exit(1)
- sys.exit(0)
+ if len(argv) != 2:
+ exit(1)
+ interface = argv[1]
+
+ if re.match(pattern, interface):
+ exit(0)
+ if os.path.exists(f'/sys/class/net/{interface}'):
+ exit(0)
+ exit(1)