From 548d9057e3ed66852bb2be62fe770c265712b4f3 Mon Sep 17 00:00:00 2001
From: Christian Poessinger <christian@poessinger.com>
Date: Sat, 13 Mar 2021 21:08:38 +0100
Subject: vrf: T3344: move dynamic routing protocols under "vrf name <name>
 protocols"

Instead of having the dynamic routing protocols OSPF and BGP residing under
the "protocols vrf <name> [ospf|bgp]" nodes, rather move them directly under
the "vrf name <name> protocols [ospf|bgp]" node. Now all VRF related parts
are placed under the same root node.

This eases the verify steps tremendously, as we do not need to check wheter a
VRF eists or not, it will always exist as we operate under a child node.
---
 interface-definitions/vrf.xml.in | 47 ++++++++++++++++++++++++++++++++++++----
 1 file changed, 43 insertions(+), 4 deletions(-)

(limited to 'interface-definitions/vrf.xml.in')

diff --git a/interface-definitions/vrf.xml.in b/interface-definitions/vrf.xml.in
index eca9e75a7..50a693248 100644
--- a/interface-definitions/vrf.xml.in
+++ b/interface-definitions/vrf.xml.in
@@ -15,17 +15,58 @@
       </leafNode>
       <tagNode name="name">
         <properties>
-          <help>VRF instance name</help>
+          <help>Virtual Routing and Forwarding instance</help>
           <constraint>
             <validator name="vrf-name"/>
           </constraint>
           <constraintErrorMessage>VRF instance name must be 15 characters or less and can not\nbe named as regular network interfaces.\n</constraintErrorMessage>
           <valueHelp>
             <format>txt</format>
-            <description>Instance name</description>
+            <description>VRF instance name</description>
           </valueHelp>
         </properties>
         <children>
+          #include <include/interface-description.xml.i>
+          #include <include/interface-disable.xml.i>
+          <node name="protocols">
+            <properties>
+              <help>Routing protocol parameters</help>
+            </properties>
+            <children>
+              <node name="static" owner="${vyos_conf_scripts_dir}/protocols_static.py $VAR(../../@)">
+                <properties>
+                  <help>Static route parameters</help>
+                </properties>
+                <children>
+                  #include <include/static-route.xml.i>
+                  #include <include/static-route6.xml.i>
+                </children>
+              </node>
+              <tagNode name="bgp" owner="${vyos_conf_scripts_dir}/protocols_bgp.py $VAR(../../@)">
+                <properties>
+                  <help>Border Gateway Protocol (BGP)</help>
+                  <valueHelp>
+                    <format>u32:1-4294967294</format>
+                    <description>Autonomous System Number</description>
+                  </valueHelp>
+                  <constraint>
+                    <validator name="numeric" argument="--range 1-4294967294"/>
+                  </constraint>
+                </properties>
+                <children>
+                  #include <include/bgp/bgp-common-config.xml.i>
+                </children>
+              </tagNode>
+              <node name="ospf" owner="${vyos_conf_scripts_dir}/protocols_ospf.py $VAR(../../@)">
+                <properties>
+                  <help>Open Shortest Path First (OSPF)</help>
+                </properties>
+                <children>
+                  #include <include/ospf/ospf-common-config.xml.i>
+                </children>
+              </node>
+            </children>
+          </node>
           <leafNode name="table">
             <properties>
               <help>Routing table associated with this instance</help>
@@ -39,8 +80,6 @@
               <constraintErrorMessage>VRF routing table must be in range from 100 to 2147483647</constraintErrorMessage>
             </properties>
           </leafNode>
-          #include <include/interface-description.xml.i>
-          #include <include/interface-disable.xml.i>
         </children>
       </tagNode>
     </children>
-- 
cgit v1.2.3


From 007284ed9333ae65f7355ac49631965fef76a1db Mon Sep 17 00:00:00 2001
From: Christian Poessinger <christian@poessinger.com>
Date: Sun, 14 Mar 2021 11:07:25 +0100
Subject: vrf: T3344: set explicit priority values for routing protocols

We must ensure that an interface is already added to a VRF before it is
referenced inside a VRF context, e.g. OSPF.
---
 interface-definitions/vrf.xml.in | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'interface-definitions/vrf.xml.in')

diff --git a/interface-definitions/vrf.xml.in b/interface-definitions/vrf.xml.in
index 50a693248..b1d25926e 100644
--- a/interface-definitions/vrf.xml.in
+++ b/interface-definitions/vrf.xml.in
@@ -36,6 +36,7 @@
               <node name="static" owner="${vyos_conf_scripts_dir}/protocols_static.py $VAR(../../@)">
                 <properties>
                   <help>Static route parameters</help>
+                  <priority>600</priority>
                 </properties>
                 <children>
                   #include <include/static-route.xml.i>
@@ -45,6 +46,7 @@
               <tagNode name="bgp" owner="${vyos_conf_scripts_dir}/protocols_bgp.py $VAR(../../@)">
                 <properties>
                   <help>Border Gateway Protocol (BGP)</help>
+                  <priority>820</priority>
                   <valueHelp>
                     <format>u32:1-4294967294</format>
                     <description>Autonomous System Number</description>
@@ -60,6 +62,7 @@
               <node name="ospf" owner="${vyos_conf_scripts_dir}/protocols_ospf.py $VAR(../../@)">
                 <properties>
                   <help>Open Shortest Path First (OSPF)</help>
+                  <priority>620</priority>
                 </properties>
                 <children>
                   #include <include/ospf/ospf-common-config.xml.i>
-- 
cgit v1.2.3