diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | data/templates/frr/ospf.frr.tmpl | 3 | ||||
-rw-r--r-- | interface-definitions/include/static-route-disable.xml.i | 8 | ||||
-rw-r--r-- | interface-definitions/include/static-route-distance.xml.i | 14 | ||||
-rw-r--r-- | interface-definitions/include/static-route-map.xml.i | 10 | ||||
-rw-r--r-- | interface-definitions/include/static-route-next-hop-vrf.xml.i | 17 | ||||
-rw-r--r-- | interface-definitions/protocols-ospf.xml.in | 12 | ||||
-rw-r--r-- | interface-definitions/protocols-ripng.xml.in | 350 | ||||
-rw-r--r-- | interface-definitions/protocols-static.xml.in | 362 | ||||
-rw-r--r-- | op-mode-definitions/ipv6-route.xml.in | 2 | ||||
-rw-r--r-- | op-mode-definitions/show-ip.xml.in | 20 | ||||
-rw-r--r-- | python/vyos/configverify.py | 7 | ||||
-rwxr-xr-x | src/conf_mode/protocols_ospf.py | 14 | ||||
-rwxr-xr-x | src/conf_mode/protocols_ospfv3.py | 1 | ||||
-rwxr-xr-x | src/conf_mode/protocols_rpki.py | 1 | ||||
-rwxr-xr-x | src/op_mode/powerctrl.py | 2 | ||||
-rwxr-xr-x | src/op_mode/show_nat_translations.py | 2 | ||||
-rwxr-xr-x | src/op_mode/show_neigh.py | 96 |
18 files changed, 918 insertions, 5 deletions
@@ -48,6 +48,8 @@ interface_definitions: $(config_xml_obj) rm -f $(TMPL_DIR)/vpn/ipsec/node.def rm -rf $(TMPL_DIR)/vpn/nipsec rm -rf $(TMPL_DIR)/protocols/nvrf + rm -rf $(TMPL_DIR)/protocols/nripng + rm -rf $(TMPL_DIR)/protocols/nstatic # XXX: required until OSPF and RIP is migrated from vyatta-cfg-quagga to vyos-1x mkdir $(TMPL_DIR)/interfaces/loopback/node.tag/ipv6 diff --git a/data/templates/frr/ospf.frr.tmpl b/data/templates/frr/ospf.frr.tmpl index 37c21e146..7ca69eee6 100644 --- a/data/templates/frr/ospf.frr.tmpl +++ b/data/templates/frr/ospf.frr.tmpl @@ -31,6 +31,8 @@ interface {{ iface }} {% endif %} {% if iface_config.dead_interval is defined and iface_config.dead_interval is not none %} ip ospf dead-interval {{ iface_config.dead_interval }} +{% elif iface_config.hello_multiplier is defined and iface_config.hello_multiplier is not none %} + ip ospf dead-interval minimal hello-multiplier {{ iface_config.hello_multiplier }} {% endif %} {% if iface_config.bfd is defined %} ip ospf bfd @@ -44,6 +46,7 @@ interface {{ iface }} {% if iface_config.bandwidth is defined and iface_config.bandwidth is not none %} bandwidth {{ iface_config.bandwidth }} {% endif %} +! {% endfor %} {% endif %} ! diff --git a/interface-definitions/include/static-route-disable.xml.i b/interface-definitions/include/static-route-disable.xml.i new file mode 100644 index 000000000..100ca3cbf --- /dev/null +++ b/interface-definitions/include/static-route-disable.xml.i @@ -0,0 +1,8 @@ +<!-- included start from static-route-disable.xml.i.xml.i --> +<leafNode name="disable"> + <properties> + <help>Disable interface static route</help> + <valueless/> + </properties> +</leafNode> +<!-- included end --> diff --git a/interface-definitions/include/static-route-distance.xml.i b/interface-definitions/include/static-route-distance.xml.i new file mode 100644 index 000000000..d6c0d3d82 --- /dev/null +++ b/interface-definitions/include/static-route-distance.xml.i @@ -0,0 +1,14 @@ +<!-- included start from static-route-distance.xml.i --> +<leafNode name="distance"> + <properties> + <help>Distance for this route</help> + <valueHelp> + <format>u32:1-255</format> + <description>Distance for this route</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 1-255"/> + </constraint> + </properties> +</leafNode> +<!-- included end --> diff --git a/interface-definitions/include/static-route-map.xml.i b/interface-definitions/include/static-route-map.xml.i new file mode 100644 index 000000000..25542b8b1 --- /dev/null +++ b/interface-definitions/include/static-route-map.xml.i @@ -0,0 +1,10 @@ +<!-- included start from static-route-map.xml.i --> +<leafNode name="route-map"> + <properties> + <help>Filter routes installed in local route map</help> + <completionHelp> + <path>policy route-map</path> + </completionHelp> + </properties> +</leafNode> +<!-- included end --> diff --git a/interface-definitions/include/static-route-next-hop-vrf.xml.i b/interface-definitions/include/static-route-next-hop-vrf.xml.i new file mode 100644 index 000000000..c90140856 --- /dev/null +++ b/interface-definitions/include/static-route-next-hop-vrf.xml.i @@ -0,0 +1,17 @@ +<!-- included start from static-route-next-hop-vrf.xml.i --> +<leafNode name="next-hop-vrf"> + <properties> + <help>VRF to leak route</help> + <valueHelp> + <format>txt</format> + <description>Name of VRF to leak to</description> + </valueHelp> + <completionHelp> + <path>protocols vrf</path> + </completionHelp> + <constraint> + <regex>^[a-zA-Z0-9\-_]{1,100}$</regex> + </constraint> + </properties> +</leafNode> +<!-- included end --> diff --git a/interface-definitions/protocols-ospf.xml.in b/interface-definitions/protocols-ospf.xml.in index 1051e3741..7a5cef6ef 100644 --- a/interface-definitions/protocols-ospf.xml.in +++ b/interface-definitions/protocols-ospf.xml.in @@ -438,6 +438,18 @@ </constraint> </properties> </leafNode> + <leafNode name="hello-multiplier"> + <properties> + <help>Hello multiplier factor</help> + <valueHelp> + <format>u32:1-10</format> + <description>Number of Hellos to send each second</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 1-10"/> + </constraint> + </properties> + </leafNode> <leafNode name="mtu-ignore"> <properties> <help>Disable Maximum Transmission Unit (MTU) mismatch detection</help> diff --git a/interface-definitions/protocols-ripng.xml.in b/interface-definitions/protocols-ripng.xml.in new file mode 100644 index 000000000..2fca0f5dd --- /dev/null +++ b/interface-definitions/protocols-ripng.xml.in @@ -0,0 +1,350 @@ +<!-- Routing Information Protocol (RIPng) configuration --> +<interfaceDefinition> + <node name="protocols"> + <children> + <node name="nripng" owner="${vyos_conf_scripts_dir}/protocols_ripng.py"> + <properties> + <help>Routing Information Protocol (RIPng) parameters</help> + </properties> + <children> + <leafNode name="aggregate-address"> + <properties> + <help>Aggregate RIPng route announcement</help> + <valueHelp> + <format>ipv6net</format> + <description>Aggregate RIPng route announcement</description> + </valueHelp> + <constraint> + <validator name="ipv6-prefix"/> + </constraint> + <multi/> + </properties> + </leafNode> + <node name="default-information"> + <properties> + <help>Control distribution of default route</help> + </properties> + <children> + <leafNode name="originate"> + <properties> + <help>Distribute a default route</help> + <valueless/> + </properties> + </leafNode> + </children> + </node> + <leafNode name="default-metric"> + <properties> + <help>Metric of redistributed routes</help> + <valueHelp> + <format>u32:1-16</format> + <description>Default metric</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 1-16"/> + </constraint> + </properties> + </leafNode> + <node name="distribute-list"> + <properties> + <help>Filter networks in routing updates</help> + </properties> + <children> + <node name="access-list"> + <properties> + <help>Access-list</help> + </properties> + <children> + <leafNode name="in"> + <properties> + <help>Access list to apply to input packets</help> + <valueHelp> + <format>u32:1-4294967295</format> + <description>Access list to apply to input packets</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 1-4294967295"/> + </constraint> + </properties> + </leafNode> + <leafNode name="out"> + <properties> + <help>Access list to apply to output packets</help> + <valueHelp> + <format>u32:1-4294967295</format> + <description>Access list to apply to output packets</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 1-4294967295"/> + </constraint> + </properties> + </leafNode> + </children> + </node> + <tagNode name="interface"> + <properties> + <help>Apply filtering to an interface</help> + <valueHelp> + <format>txt</format> + <description>Apply filtering to an interface</description> + </valueHelp> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces.py</script> + </completionHelp> + </properties> + <children> + <node name="access-list"> + <properties> + <help>Access list</help> + </properties> + <children> + <leafNode name="in"> + <properties> + <help>Access list to apply to input packets</help> + <valueHelp> + <format>u32:1-4294967295</format> + <description>Access list to apply to input packets</description> + </valueHelp> + <completionHelp> + <path>policy access-list6</path> + </completionHelp> + </properties> + </leafNode> + <leafNode name="out"> + <properties> + <help>Access list to apply to output packets</help> + <valueHelp> + <format>u32:1-4294967295</format> + <description>Access list to apply to output packets</description> + </valueHelp> + <completionHelp> + <path>policy access-list</path> + </completionHelp> + </properties> + </leafNode> + </children> + </node> + <node name="prefix-list"> + <properties> + <help>Prefix-list</help> + </properties> + <children> + <leafNode name="in"> + <properties> + <help>Prefix-list to apply to input packets</help> + <valueHelp> + <format>txt</format> + <description>Prefix-list to apply to input packets</description> + </valueHelp> + <completionHelp> + <path>policy prefix-list6</path> + </completionHelp> + </properties> + </leafNode> + <leafNode name="out"> + <properties> + <help>Prefix-list to apply to output packets</help> + <valueHelp> + <format>txt</format> + <description>Prefix-list to apply to output packets</description> + </valueHelp> + <completionHelp> + <path>policy prefix-list6</path> + </completionHelp> + </properties> + </leafNode> + </children> + </node> + </children> + </tagNode> + <node name="prefix-list"> + <properties> + <help>Prefix-list</help> + </properties> + <children> + <leafNode name="in"> + <properties> + <help>Prefix-list to apply to input packets</help> + <valueHelp> + <format>txt</format> + <description>Prefix-list to apply to input packets</description> + </valueHelp> + <completionHelp> + <path>policy prefix-list</path> + </completionHelp> + </properties> + </leafNode> + <leafNode name="out"> + <properties> + <help>Prefix-list to apply to output packets</help> + <valueHelp> + <format>txt</format> + <description>Prefix-list to apply to output packets</description> + </valueHelp> + <completionHelp> + <path>policy prefix-list</path> + </completionHelp> + </properties> + </leafNode> + </children> + </node> + </children> + </node> + <leafNode name="interface"> + <properties> + <help>Interface name</help> + <valueHelp> + <format>txt</format> + <description>Apply filtering to an interface</description> + </valueHelp> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces.py</script> + </completionHelp> + <multi/> + </properties> + </leafNode> + <leafNode name="network"> + <properties> + <help>RIPng network</help> + <valueHelp> + <format>ipv6net</format> + <description>RIPng network</description> + </valueHelp> + <constraint> + <validator name="ipv6-prefix"/> + </constraint> + <multi/> + </properties> + </leafNode> + <leafNode name="passive-interface"> + <properties> + <help>Passive interface</help> + <valueHelp> + <format>txt</format> + <description>Suppress routing updates on interface</description> + </valueHelp> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces.py</script> + </completionHelp> + <multi/> + </properties> + </leafNode> + <node name="redistribute"> + <properties> + <help>Redistribute information from another routing protocol</help> + </properties> + <children> + <node name="bgp"> + <properties> + <help>Redistribute BGP routes</help> + </properties> + <children> + #include <include/rip-redistribute.xml.i> + </children> + </node> + <node name="connected"> + <properties> + <help>Redistribute connected routes</help> + </properties> + <children> + #include <include/rip-redistribute.xml.i> + </children> + </node> + <node name="kernel"> + <properties> + <help>Redistribute kernel routes</help> + </properties> + <children> + #include <include/rip-redistribute.xml.i> + </children> + </node> + <node name="ospfv3"> + <properties> + <help>Redistribute OSPFv3 routes</help> + </properties> + <children> + #include <include/rip-redistribute.xml.i> + </children> + </node> + <node name="static"> + <properties> + <help>Redistribute static routes</help> + </properties> + <children> + #include <include/rip-redistribute.xml.i> + </children> + </node> + </children> + </node> + <leafNode name="route"> + <properties> + <help>RIPng static route</help> + <valueHelp> + <format>ipv6net</format> + <description>RIPng static route</description> + </valueHelp> + <constraint> + <validator name="ipv6-prefix"/> + </constraint> + <multi/> + </properties> + </leafNode> + <leafNode name="route-map"> + <properties> + <help>Filter routes installed in local route map</help> + <completionHelp> + <path>policy route-map</path> + </completionHelp> + </properties> + </leafNode> + <node name="timers"> + <properties> + <help>RIPng timer values</help> + </properties> + <children> + <leafNode name="garbage-collection"> + <properties> + <help>Garbage collection timer</help> + <valueHelp> + <format>u32:5-2147483647</format> + <description>Garbage colletion time (default 120)</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 5-2147483647"/> + </constraint> + </properties> + <defaultValue>120</defaultValue> + </leafNode> + <leafNode name="timeout"> + <properties> + <help>Routing information timeout timer</help> + <valueHelp> + <format>u32:5-2147483647</format> + <description>Routing information timeout timer (default 180)</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 5-2147483647"/> + </constraint> + </properties> + <defaultValue>180</defaultValue> + </leafNode> + <leafNode name="update"> + <properties> + <help>Routing table update timer</help> + <valueHelp> + <format>u32:5-2147483647</format> + <description>Routing table update timer in seconds (default 30)</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 5-2147483647"/> + </constraint> + </properties> + <defaultValue>30</defaultValue> + </leafNode> + </children> + </node> + </children> + </node> + </children> + </node> +</interfaceDefinition> diff --git a/interface-definitions/protocols-static.xml.in b/interface-definitions/protocols-static.xml.in new file mode 100644 index 000000000..2a9f7014f --- /dev/null +++ b/interface-definitions/protocols-static.xml.in @@ -0,0 +1,362 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Protocol STATIC configuration --> +<interfaceDefinition> + <node name="protocols"> + <children> + <node name="nstatic" owner="${vyos_conf_scripts_dir}/protocols_static.py"> + <properties> + <help>Static route parameters</help> + </properties> + <children> + <tagNode name="interface-route"> + <properties> + <help>Interface based static route</help> + <valueHelp> + <format>ipv4net</format> + <description>Interface based static route</description> + </valueHelp> + <constraint> + <validator name="ipv4-prefix"/> + </constraint> + </properties> + <children> + <tagNode name="next-hop-interface"> + <properties> + <help>Next-hop interface [REQUIRED]</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces.py</script> + </completionHelp> + </properties> + <children> + #include <include/static-route-disable.xml.i> + #include <include/static-route-distance.xml.i> + #include <include/static-route-next-hop-vrf.xml.i> + </children> + </tagNode> + </children> + </tagNode> + <tagNode name="interface-route6"> + <properties> + <help>Interface based IPv6 static route</help> + <valueHelp> + <format>ipv6net</format> + <description>Interface based IPv6 static route</description> + </valueHelp> + <constraint> + <validator name="ipv6-prefix"/> + </constraint> + </properties> + <children> + <tagNode name="next-hop-interface"> + <properties> + <help>Next-hop interface [REQUIRED]</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces.py</script> + </completionHelp> + </properties> + <children> + #include <include/static-route-disable.xml.i> + #include <include/static-route-distance.xml.i> + </children> + </tagNode> + </children> + </tagNode> + #include <include/static-route-map.xml.i> + <tagNode name="route"> + <properties> + <help>Static route</help> + <valueHelp> + <format>ipv4net</format> + <description>Static route</description> + </valueHelp> + <constraint> + <validator name="ipv4-prefix"/> + </constraint> + </properties> + <children> + <node name="blackhole"> + <properties> + <help>Silently discard pkts when matched</help> + </properties> + <children> + #include <include/static-route-distance.xml.i> + <leafNode name="tag"> + <properties> + <help>Tag value for this route</help> + <valueHelp> + <format>u32:1-4294967295</format> + <description>Tag value for this route</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 1-4294967295"/> + </constraint> + </properties> + </leafNode> + </children> + </node> + <leafNode name="dhcp-interface"> + <properties> + <help>DHCP interface that supplies the next-hop IP address for this static route</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces.py</script> + </completionHelp> + <valueHelp> + <format>txt</format> + <description>DHCP interface</description> + </valueHelp> + </properties> + </leafNode> + <tagNode name="next-hop"> + <properties> + <help>Next-hop router</help> + <valueHelp> + <format>ipv4</format> + <description>Next-hop router</description> + </valueHelp> + <constraint> + <validator name="ipv4-address"/> + </constraint> + </properties> + <children> + #include <include/static-route-disable.xml.i> + #include <include/static-route-distance.xml.i> + <leafNode name="next-hop-interface"> + <properties> + <help>IPv4 gateway interface name</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces.py</script> + </completionHelp> + <valueHelp> + <format>txt</format> + <description>IPv4 gateway interface name</description> + </valueHelp> + </properties> + </leafNode> + #include <include/static-route-next-hop-vrf.xml.i> + </children> + </tagNode> + </children> + </tagNode> + <tagNode name="route6"> + <properties> + <help>Static IPv6 route</help> + <valueHelp> + <format>ipv6net</format> + <description>Static IPv6 route</description> + </valueHelp> + <constraint> + <validator name="ipv6-prefix"/> + </constraint> + </properties> + <children> + <node name="blackhole"> + <properties> + <help>Silently discard pkts when matched</help> + </properties> + <children> + #include <include/static-route-distance.xml.i> + </children> + </node> + <tagNode name="next-hop"> + <properties> + <help>Next-hop IPv6 router [REQUIRED]</help> + <valueHelp> + <format>ipv6</format> + <description>Next-hop IPv6 router [REQUIRED]</description> + </valueHelp> + <constraint> + <validator name="ipv6-address"/> + </constraint> + </properties> + <children> + #include <include/static-route-disable.xml.i> + #include <include/static-route-distance.xml.i> + <leafNode name="interface"> + <properties> + <help>IPv6 gateway interface name</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces.py</script> + </completionHelp> + <valueHelp> + <format>txt</format> + <description>IPv6 gateway interface name</description> + </valueHelp> + </properties> + </leafNode> + #include <include/static-route-next-hop-vrf.xml.i> + </children> + </tagNode> + </children> + </tagNode> + <tagNode name="table"> + <properties> + <help>Policy route table number</help> + <valueHelp> + <format>u32:1-200</format> + <description>Policy route table number</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 1-200"/> + </constraint> + </properties> + <children> + <tagNode name="interface-route"> + <properties> + <help>Interface based static route</help> + <valueHelp> + <format>ipv4net</format> + <description>Interface based static route</description> + </valueHelp> + <constraint> + <validator name="ipv4-prefix"/> + </constraint> + </properties> + <children> + <tagNode name="next-hop-interface"> + <properties> + <help>Next-hop interface [REQUIRED]</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces.py</script> + </completionHelp> + </properties> + <children> + #include <include/static-route-disable.xml.i> + #include <include/static-route-distance.xml.i> + </children> + </tagNode> + </children> + </tagNode> + <tagNode name="interface-route6"> + <properties> + <help>Interface based IPv6 static route</help> + <valueHelp> + <format>ipv6net</format> + <description>Interface based IPv6 static route</description> + </valueHelp> + <constraint> + <validator name="ipv6-prefix"/> + </constraint> + </properties> + <children> + <tagNode name="next-hop-interface"> + <properties> + <help>Next-hop interface [REQUIRED]</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces.py</script> + </completionHelp> + </properties> + <children> + #include <include/static-route-disable.xml.i> + #include <include/static-route-distance.xml.i> + </children> + </tagNode> + </children> + </tagNode> + <tagNode name="route"> + <properties> + <help>Static route</help> + <valueHelp> + <format>ipv4net</format> + <description>Static route</description> + </valueHelp> + <constraint> + <validator name="ipv4-prefix"/> + </constraint> + </properties> + <children> + <node name="blackhole"> + <properties> + <help>Silently discard pkts when matched</help> + </properties> + <children> + #include <include/static-route-distance.xml.i> + </children> + </node> + <leafNode name="dhcp-interface"> + <properties> + <help>DHCP interface that supplies the next-hop IP address for this static route</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces.py</script> + </completionHelp> + <valueHelp> + <format>txt</format> + <description>DHCP interface</description> + </valueHelp> + </properties> + </leafNode> + <tagNode name="next-hop"> + <properties> + <help>Next-hop router</help> + <valueHelp> + <format>ipv4</format> + <description>Next-hop router</description> + </valueHelp> + <constraint> + <validator name="ipv4-address"/> + </constraint> + </properties> + <children> + #include <include/static-route-disable.xml.i> + #include <include/static-route-distance.xml.i> + <leafNode name="next-hop-interface"> + <properties> + <help>IPv4 gateway interface name</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces.py</script> + </completionHelp> + <valueHelp> + <format>txt</format> + <description>IPv4 gateway interface name</description> + </valueHelp> + </properties> + </leafNode> + #include <include/static-route-next-hop-vrf.xml.i> + </children> + </tagNode> + </children> + </tagNode> + <tagNode name="route6"> + <properties> + <help>Static IPv6 route</help> + <valueHelp> + <format>ipv6net</format> + <description>Static IPv6 route</description> + </valueHelp> + <constraint> + <validator name="ipv6-prefix"/> + </constraint> + </properties> + <children> + <node name="blackhole"> + <properties> + <help>Silently discard pkts when matched</help> + </properties> + <children> + #include <include/static-route-distance.xml.i> + </children> + </node> + <tagNode name="next-hop"> + <properties> + <help>Next-hop IPv6 router [REQUIRED]</help> + <valueHelp> + <format>ipv6</format> + <description>Next-hop IPv6 router [REQUIRED]</description> + </valueHelp> + <constraint> + <validator name="ipv6-address"/> + </constraint> + </properties> + <children> + #include <include/static-route-disable.xml.i> + #include <include/static-route-distance.xml.i> + </children> + </tagNode> + </children> + </tagNode> + </children> + </tagNode> + </children> + </node> + </children> + </node> +</interfaceDefinition> diff --git a/op-mode-definitions/ipv6-route.xml.in b/op-mode-definitions/ipv6-route.xml.in index 28f5b1aad..7f188fdb2 100644 --- a/op-mode-definitions/ipv6-route.xml.in +++ b/op-mode-definitions/ipv6-route.xml.in @@ -21,7 +21,7 @@ <properties> <help>Show IPv6 Neighbor Discovery (ND) information</help> </properties> - <command>ip -f inet6 neigh list</command> + <command>${vyos_op_scripts_dir}/show_neigh.py --family inet6</command> </leafNode> </children> diff --git a/op-mode-definitions/show-ip.xml.in b/op-mode-definitions/show-ip.xml.in new file mode 100644 index 000000000..91564440d --- /dev/null +++ b/op-mode-definitions/show-ip.xml.in @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<interfaceDefinition> + <node name="show"> + <children> + <node name="ip"> + <properties> + <help>Show IPv4 routing information</help> + </properties> + <children> + <node name="neighbors"> + <properties> + <help>Show IPv4 Neighbor Discovery (ND) information</help> + </properties> + <command>${vyos_op_scripts_dir}/show_neigh.py --family inet</command> + </node> + </children> + </node> + </children> + </node> +</interfaceDefinition> diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py index e71e4e1c5..5a4d14c68 100644 --- a/python/vyos/configverify.py +++ b/python/vyos/configverify.py @@ -252,6 +252,13 @@ def verify_vlan_config(config): Common helper function used by interface implementations to perform recurring validation of interface VLANs """ + + # VLAN and Q-in-Q IDs are not allowed to overlap + if 'vif' in config and 'vif_s' in config: + duplicate = list(set(config['vif']) & set(config['vif_s'])) + if duplicate: + raise ConfigError(f'Duplicate VLAN id "{duplicate[0]}" used for vif and vif-s interfaces!') + # 802.1q VLANs for vlan in config.get('vif', {}): vlan = config['vif'][vlan] diff --git a/src/conf_mode/protocols_ospf.py b/src/conf_mode/protocols_ospf.py index 866b2db62..3310fac5a 100755 --- a/src/conf_mode/protocols_ospf.py +++ b/src/conf_mode/protocols_ospf.py @@ -97,8 +97,15 @@ def get_config(config=None): default_values, ospf['area'][area]['virtual_link'][virtual_link]) if 'interface' in ospf: - default_values = defaults(base + ['interface']) for interface in ospf['interface']: + # We need to reload the defaults on every pass b/c of + # hello-multiplier dependency on dead-interval + default_values = defaults(base + ['interface']) + # If hello-multiplier is set, we need to remove the default from + # dead-interval. + if 'hello_multiplier' in ospf['interface'][interface]: + del default_values['dead_interval'] + ospf['interface'][interface] = dict_merge(default_values, ospf['interface'][interface]) @@ -120,6 +127,11 @@ def verify(ospf): if 'interface' in ospf: for interface in ospf['interface']: verify_interface_exists(interface) + # One can not use dead-interval and hello-multiplier at the same + # time. FRR will only activate the last option set via CLI. + if {'hello_multiplier', 'dead_interval'} <= set(ospf['interface'][interface]): + raise ConfigError(f'Can not use hello-multiplier and dead-interval ' \ + f'concurrently for "{interface}"!') return None diff --git a/src/conf_mode/protocols_ospfv3.py b/src/conf_mode/protocols_ospfv3.py index 2fb600056..e008a350b 100755 --- a/src/conf_mode/protocols_ospfv3.py +++ b/src/conf_mode/protocols_ospfv3.py @@ -24,7 +24,6 @@ from vyos.configverify import verify_route_maps from vyos.template import render from vyos.template import render_to_string from vyos.util import call -from vyos.util import dict_search from vyos.xml import defaults from vyos import ConfigError from vyos import frr diff --git a/src/conf_mode/protocols_rpki.py b/src/conf_mode/protocols_rpki.py index aa6f974ab..0b9525caf 100755 --- a/src/conf_mode/protocols_rpki.py +++ b/src/conf_mode/protocols_rpki.py @@ -20,7 +20,6 @@ from sys import exit from vyos.config import Config from vyos.configdict import dict_merge -from vyos.configverify import verify_route_maps from vyos.template import render from vyos.template import render_to_string from vyos.util import call diff --git a/src/op_mode/powerctrl.py b/src/op_mode/powerctrl.py index c000d7d06..f8b5a3dda 100755 --- a/src/op_mode/powerctrl.py +++ b/src/op_mode/powerctrl.py @@ -177,7 +177,7 @@ def main(): action="store_true") action.add_argument("--check", - help="Check pending chutdown", + help="Check pending shutdown", action="store_true") args = parser.parse_args() diff --git a/src/op_mode/show_nat_translations.py b/src/op_mode/show_nat_translations.py index 04c20e584..25091e9fc 100755 --- a/src/op_mode/show_nat_translations.py +++ b/src/op_mode/show_nat_translations.py @@ -51,6 +51,8 @@ def command(srcdest, proto, ipaddr): command += f' --orig-src {ipaddr}' if srcdest == 'destination': command += ' -g' + if ipaddr: + command += f' --orig-dst {ipaddr}' return command diff --git a/src/op_mode/show_neigh.py b/src/op_mode/show_neigh.py new file mode 100755 index 000000000..94e745493 --- /dev/null +++ b/src/op_mode/show_neigh.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2020 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/>. + +#ip -j -f inet neigh list | jq +#[ + #{ + #"dst": "192.168.101.8", + #"dev": "enp0s25", + #"lladdr": "78:d2:94:72:77:7e", + #"state": [ + #"STALE" + #] + #}, + #{ + #"dst": "192.168.101.185", + #"dev": "enp0s25", + #"lladdr": "34:46:ec:76:f8:9b", + #"state": [ + #"STALE" + #] + #}, + #{ + #"dst": "192.168.101.225", + #"dev": "enp0s25", + #"lladdr": "c2:cb:fa:bf:a0:35", + #"state": [ + #"STALE" + #] + #}, + #{ + #"dst": "192.168.101.1", + #"dev": "enp0s25", + #"lladdr": "00:98:2b:f8:3f:11", + #"state": [ + #"REACHABLE" + #] + #}, + #{ + #"dst": "192.168.101.181", + #"dev": "enp0s25", + #"lladdr": "d8:9b:3b:d5:88:22", + #"state": [ + #"STALE" + #] + #} +#] + +import sys +import argparse +import json +from vyos.util import cmd + +def main(): + #parese args + parser = argparse.ArgumentParser() + parser.add_argument('--family', help='Protocol family', required=True) + args = parser.parse_args() + + neigh_raw_json = cmd(f'ip -j -f {args.family} neigh list') + neigh_raw_json = neigh_raw_json.lower() + neigh_json = json.loads(neigh_raw_json) + + format_neigh = '%-50s %-10s %-20s %s' + print(format_neigh % ("IP Address", "Device", "State", "LLADDR")) + print(format_neigh % ("----------", "------", "-----", "------")) + + if neigh_json is not None: + for neigh_item in neigh_json: + dev = neigh_item['dev'] + dst = neigh_item['dst'] + lladdr = neigh_item['lladdr'] if 'lladdr' in neigh_item else '' + state = neigh_item['state'] + + i = 0 + for state_item in state: + if i == 0: + print(format_neigh % (dst, dev, state_item, lladdr)) + else: + print(format_neigh % ('', '', state_item, '')) + i+=1 + +if __name__ == '__main__': + main() |