summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-02-11 20:36:08 +0100
committerChristian Poessinger <christian@poessinger.com>2021-02-11 20:37:19 +0100
commit8a39f15242ef0596a7d93001f7d413702f1ad7f5 (patch)
tree41174f0970e31ece8cf368bca523b0d0d9493ebd
parent8919e40a3c0b84053e422a8445a5fca829e5990f (diff)
downloadvyos-1x-8a39f15242ef0596a7d93001f7d413702f1ad7f5.tar.gz
vyos-1x-8a39f15242ef0596a7d93001f7d413702f1ad7f5.zip
ospfv3: T3267: move interface specific options to "protocols ospfv3"
-rw-r--r--Makefile9
-rw-r--r--interface-definitions/include/ospf-interface-common.xml.i39
-rw-r--r--interface-definitions/protocols-ospf.xml.in38
-rw-r--r--interface-definitions/protocols-ospfv3.xml.in60
-rw-r--r--smoketest/configs/ospf-small22
-rwxr-xr-xsrc/migration-scripts/interfaces/18-to-1918
6 files changed, 137 insertions, 49 deletions
diff --git a/Makefile b/Makefile
index abe4524d1..2adf385f9 100644
--- a/Makefile
+++ b/Makefile
@@ -46,15 +46,6 @@ interface_definitions: $(config_xml_obj)
rm -f $(TMPL_DIR)/vpn/ipsec/node.def
rm -rf $(TMPL_DIR)/vpn/nipsec
- # XXX: required until OSPF and RIP is migrated from vyatta-cfg-quagga to vyos-1x
- mkdir $(TMPL_DIR)/interfaces/loopback/node.tag/ipv6
- mkdir $(TMPL_DIR)/interfaces/dummy/node.tag/ipv6
- mkdir -p $(TMPL_DIR)/interfaces/vti/node.tag/ipv6
- cp $(TMPL_DIR)/interfaces/ethernet/node.tag/ipv6/node.def $(TMPL_DIR)/interfaces/loopback/node.tag/ipv6
- cp $(TMPL_DIR)/interfaces/ethernet/node.tag/ipv6/node.def $(TMPL_DIR)/interfaces/dummy/node.tag/ipv6
-
- cp $(TMPL_DIR)/interfaces/ethernet/node.tag/ipv6/node.def $(TMPL_DIR)/interfaces/vti/node.tag/ipv6
-
.PHONY: op_mode_definitions
.ONESHELL:
op_mode_definitions: $(op_xml_obj)
diff --git a/interface-definitions/include/ospf-interface-common.xml.i b/interface-definitions/include/ospf-interface-common.xml.i
new file mode 100644
index 000000000..c3493faa3
--- /dev/null
+++ b/interface-definitions/include/ospf-interface-common.xml.i
@@ -0,0 +1,39 @@
+<!-- included start from ospf-interface-common.xml.i -->
+<leafNode name="bfd">
+ <properties>
+ <help>Enable Bidirectional Forwarding Detection (BFD) support</help>
+ <valueless/>
+ </properties>
+</leafNode>
+<leafNode name="cost">
+ <properties>
+ <help>Interface cost</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>OSPF interface cost</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+</leafNode>
+<leafNode name="mtu-ignore">
+ <properties>
+ <help>Disable Maximum Transmission Unit (MTU) mismatch detection</help>
+ <valueless/>
+ </properties>
+</leafNode>
+<leafNode name="priority">
+ <properties>
+ <help>Router priority (default: 1)</help>
+ <valueHelp>
+ <format>u32:0-255</format>
+ <description>OSPF router priority cost</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-255"/>
+ </constraint>
+ </properties>
+ <defaultValue>1</defaultValue>
+</leafNode>
+<!-- included end -->
diff --git a/interface-definitions/protocols-ospf.xml.in b/interface-definitions/protocols-ospf.xml.in
index a616c0e60..d0cfa14b1 100644
--- a/interface-definitions/protocols-ospf.xml.in
+++ b/interface-definitions/protocols-ospf.xml.in
@@ -415,6 +415,7 @@
<children>
#include <include/ospf-authentication.xml.i>
#include <include/ospf-intervals.xml.i>
+ #include <include/ospf-interface-common.xml.i>
<leafNode name="bandwidth">
<properties>
<help>Bandwidth of interface (Megabit/sec)</help>
@@ -427,24 +428,6 @@
</constraint>
</properties>
</leafNode>
- <leafNode name="bfd">
- <properties>
- <help>Enable Bidirectional Forwarding Detection (BFD) support</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="cost">
- <properties>
- <help>Interface cost</help>
- <valueHelp>
- <format>u32:1-65535</format>
- <description>OSPF interface cost</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-65535"/>
- </constraint>
- </properties>
- </leafNode>
<leafNode name="hello-multiplier">
<properties>
<help>Hello multiplier factor</help>
@@ -457,12 +440,6 @@
</constraint>
</properties>
</leafNode>
- <leafNode name="mtu-ignore">
- <properties>
- <help>Disable Maximum Transmission Unit (MTU) mismatch detection</help>
- <valueless/>
- </properties>
- </leafNode>
<leafNode name="network">
<properties>
<help>Network type</help>
@@ -491,19 +468,6 @@
<constraintErrorMessage>Must be broadcast, non-broadcast, point-to-multipoint or point-to-point</constraintErrorMessage>
</properties>
</leafNode>
- <leafNode name="priority">
- <properties>
- <help>Router priority (default: 1)</help>
- <valueHelp>
- <format>u32:0-255</format>
- <description>OSPF router priority cost</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-255"/>
- </constraint>
- </properties>
- <defaultValue>1</defaultValue>
- </leafNode>
</children>
</tagNode>
<node name="log-adjacency-changes">
diff --git a/interface-definitions/protocols-ospfv3.xml.in b/interface-definitions/protocols-ospfv3.xml.in
index bd6a55b45..e28faa3cf 100644
--- a/interface-definitions/protocols-ospfv3.xml.in
+++ b/interface-definitions/protocols-ospfv3.xml.in
@@ -41,7 +41,7 @@
</completionHelp>
</properties>
</leafNode>
- <leafNode name="interface">
+ <tagNode name="interface">
<properties>
<help>Enable routing on an IPv6 interface</help>
<completionHelp>
@@ -54,9 +54,63 @@
<constraint>
<validator name="interface-name"/>
</constraint>
- <multi/>
</properties>
- </leafNode>
+ <children>
+ #include <include/ospf-intervals.xml.i>
+ #include <include/ospf-interface-common.xml.i>
+ <leafNode name="ifmtu">
+ <properties>
+ <help>Interface MTU</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>Interface MTU</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="instance-id">
+ <properties>
+ <help>Instance Id (default: 0)</help>
+ <valueHelp>
+ <format>u32:0-255</format>
+ <description>Instance Id</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-255"/>
+ </constraint>
+ </properties>
+ <defaultValue>0</defaultValue>
+ </leafNode>
+ <leafNode name="network">
+ <properties>
+ <help>Network type</help>
+ <completionHelp>
+ <list>broadcast point-to-point</list>
+ </completionHelp>
+ <valueHelp>
+ <format>broadcast</format>
+ <description>Broadcast network type</description>
+ </valueHelp>
+ <valueHelp>
+ <format>point-to-point</format>
+ <description>Point-to-point network type</description>
+ </valueHelp>
+ <constraint>
+ <regex>^(broadcast|point-to-point)$</regex>
+ </constraint>
+ <constraintErrorMessage>Must be broadcast or point-to-point</constraintErrorMessage>
+ </properties>
+ </leafNode>
+ <leafNode name="passive">
+ <properties>
+ <help>Disable forming of adjacency</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+ </tagNode>
<tagNode name="range">
<properties>
<help>Specify IPv6 prefix (border routers only)</help>
diff --git a/smoketest/configs/ospf-small b/smoketest/configs/ospf-small
index fe313e4b0..d95ba4ea4 100644
--- a/smoketest/configs/ospf-small
+++ b/smoketest/configs/ospf-small
@@ -24,12 +24,27 @@ interfaces {
transmit-delay 1
}
}
+ ipv6 {
+ ospfv3 {
+ bfd
+ cost 40
+ }
+ }
}
}
ethernet eth1 {
duplex auto
smp-affinity auto
speed auto
+ ipv6 {
+ ospfv3 {
+ bfd
+ cost 60
+ mtu-ignore
+ network broadcast
+ priority 20
+ }
+ }
}
}
protocols {
@@ -47,6 +62,13 @@ protocols {
passive-interface default
passive-interface-exclude eth0.201
}
+ ospfv3 {
+ area 0.0.0.0 {
+ interface eth0
+ interface eth1
+ interface eth2
+ }
+ }
static {
route 0.0.0.0/0 {
next-hop 172.18.201.254 {
diff --git a/src/migration-scripts/interfaces/18-to-19 b/src/migration-scripts/interfaces/18-to-19
index 460032602..06e07572f 100755
--- a/src/migration-scripts/interfaces/18-to-19
+++ b/src/migration-scripts/interfaces/18-to-19
@@ -32,6 +32,20 @@ def migrate_ospf(config, path, interface):
if len(config.list_nodes(path[:-1])) == 0:
config.delete(path[:-1])
+def migrate_ospfv3(config, path, interface):
+ path = path + ['ospfv3']
+ if config.exists(path):
+ new_base = ['protocols', 'ospfv3', 'interface']
+ config.set(new_base)
+ config.set_tag(new_base)
+ config.copy(path, new_base + [interface])
+ config.delete(path)
+
+ # if "ipv6 ospfv3" was the only setting, we can clean out the empty
+ # ip node afterwards
+ if len(config.list_nodes(path[:-1])) == 0:
+ config.delete(path[:-1])
+
def migrate_rip(config, path, interface):
path = path + ['rip']
if config.exists(path):
@@ -81,6 +95,7 @@ if __name__ == '__main__':
migrate_rip(config, ip_base, interface)
migrate_ripng(config, ipv6_base, interface)
migrate_ospf(config, ip_base, interface)
+ migrate_ospfv3(config, ipv6_base, interface)
vif_path = ['interfaces', type, interface, 'vif']
if config.exists(vif_path):
@@ -92,6 +107,7 @@ if __name__ == '__main__':
migrate_rip(config, vif_ip_base, ifname)
migrate_ripng(config, vif_ipv6_base, ifname)
migrate_ospf(config, vif_ip_base, ifname)
+ migrate_ospfv3(config, vif_ipv6_base, ifname)
vif_s_path = ['interfaces', type, interface, 'vif-s']
@@ -112,12 +128,14 @@ if __name__ == '__main__':
migrate_rip(config, vif_c_ip_base, ifname)
migrate_ripng(config, vif_c_ipv6_base, ifname)
migrate_ospf(config, vif_c_ip_base, ifname)
+ migrate_ospfv3(config, vif_c_ipv6_base, ifname)
ifname = f'{interface}.{vif_s}'
migrate_rip(config, vif_s_ip_base, ifname)
migrate_ripng(config, vif_s_ipv6_base, ifname)
migrate_ospf(config, vif_s_ip_base, ifname)
+ migrate_ospfv3(config, vif_s_ipv6_base, ifname)
try:
with open(file_name, 'w') as f: