This allows the ovn-controller to later find all ports that participate in dynamic routing.
Acked-by: Dumitru Ceara <dce...@redhat.com> Signed-off-by: Felix Huettner <felix.huettner@stackit.cloud> --- v7->v8: * minor changes to documentation as the format of "dynamic-routing-port-mapping" has changed. v5->v6: * addressed review comments v4->v5: update the dpdk version based on ovs changes v3->v4: added NEWS | 9 +++++ northd/northd.c | 18 ++++++++++ ovn-nb.xml | 87 +++++++++++++++++++++++++++++++++++++++++++++ tests/ovn-northd.at | 31 ++++++++++++++++ 4 files changed, 145 insertions(+) diff --git a/NEWS b/NEWS index 6d36a7222..889cab650 100644 --- a/NEWS +++ b/NEWS @@ -69,6 +69,15 @@ Post v24.09.0 * Add the option value "connected-as-host" to the "dynamic-routing-redistribute" LR and LRP option. If set then connected routes are announced as individual host routes. + * Add the option "dynamic-routing-maintain-vrf" to LRPs. If set the + ovn-controller will create a vrf named "ovnvrf" + datapath id that + includes all advertised and learned routes. + The vrf name can be overwritten with the "dynamic-routing-vrf-name" + setting. + * Add the option "dynamic-routing-port-name" to LRPs. If set only routes + learned from a linux interfaces that is locally bound to the referenced + LSP will be learned. Additionally support local overwrites for arbitrary + interface names using "dynamic-routing-port-mapping". OVN v24.09.0 - 13 Sep 2024 -------------------------- diff --git a/northd/northd.c b/northd/northd.c index 08a3a1d23..c324f22ae 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -4203,6 +4203,24 @@ sync_pb_for_lrp(struct ovn_port *op, } } + if ((is_cr_port(op) || chassis_name) && op->od->dynamic_routing) { + smap_add(&new, "dynamic-routing", "true"); + if (smap_get_bool(&op->nbrp->options, + "dynamic-routing-maintain-vrf", false)) { + smap_add(&new, "dynamic-routing-maintain-vrf", "true"); + } + const char *vrfname = smap_get(&op->od->nbr->options, + "dynamic-routing-vrf-name"); + if (vrfname) { + smap_add(&new, "dynamic-routing-vrf-name", vrfname); + } + const char *portname = smap_get(&op->nbrp->options, + "dynamic-routing-port-name"); + if (portname) { + smap_add(&new, "dynamic-routing-port-name", portname); + } + } + const char *ipv6_pd_list = smap_get(&op->sb->options, "ipv6_ra_pd_list"); if (ipv6_pd_list) { smap_add(&new, "ipv6_ra_pd_list", ipv6_pd_list); diff --git a/ovn-nb.xml b/ovn-nb.xml index 0addd09e6..5034b0a80 100644 --- a/ovn-nb.xml +++ b/ovn-nb.xml @@ -3107,6 +3107,31 @@ or table="Logical_Router_Port"/> on the Logical_Router_Port. </p> </column> + + <column name="options" key="dynamic-routing-vrf-name" + type='{"type": "string"}'> + <p> + Only relevant if <ref column="options" key="dynamic-routing"/> + is set to <code>true</code>. + </p> + + <p> + This defines the name of the vrf the ovn-controller will use to + advertise and learn routes. If not set the vrf will be named "ovnvrf" + with the datapath id of the Logical Router appended to it. + </p> + + <p> + The vrf name must be a valid linux interface name. If it is too long + the generated name will be used instead. + </p> + + <p> + The vrf table id is not affected by this setting. For details see + <ref column="options" key="dynamic-routing-maintain-vrf" + table="Logical_Router"/> on the Logical_Router. + </p> + </column> </group> <group title="Common Columns"> @@ -3932,6 +3957,68 @@ or </p> </column> + + <column name="options" key="dynamic-routing-maintain-vrf" + type='{"type": "boolean"}'> + <p> + Only relevant if <ref column="options" key="dynamic-routing" + table="Logical_Router"/> on the respective Logical_Router is set + to <code>true</code>. + </p> + + <p> + If this LRP is bound to a specific chassis then the ovn-controller of + this chassis will maintain a vrf. + This vrf will contain all the routes that should be announced from + this LRP. + Unless <ref column="options" key="dynamic-routing-vrf-name" + table="Logical_Router"/> is set the vrf will be named "ovnvrf" with + the datapath id of the Logical Router appended to it. + </p> + + <p> + If the setting is not set or false the ovn-controller will expect + this VRF to already exist. Some tooling outside of OVN needs to + ensure this. + </p> + + <p> + The VRF table ID is the same as the tunnel key of the Logical_Router + datapath. If this setting is false the tooling outside of OVN needs + to ensure that this is the case. + </p> + </column> + + <column name="options" key="dynamic-routing-port-name" + type='{"type": "string"}'> + Only relevant if <ref column="options" key="dynamic-routing" + table="Logical_Router"/> on the respective Logical_Router is set + to <code>true</code>. + + Only learn routes associated with the interface locally bound to the + LSP or LRP specified here. This allows a single chassis to learn + different routes on separate LRPs bound to this chassis. + + This is usefully e.g. in the case of a chassis with multiple links + towards the network fabric where all of them run BGP individually. + This option allows to have a 1:1 mapping between a single LRP and an + individual link. + + If the port referenced by this name is bound locally on the + ovn-controller we lookup the linux interface name of this port. This + interface name is then used for the route filtering, so only routes + that have this interface as nexthop will be learned. + + As there might not always be such a port bound on the ovn-controller + this value can also be an arbitrary string. The ovn-controller will + lookup the port name in the local <ref + key="dynamic-routing-port-mapping" table="Open_vSwitch" + column="external_ids" db="Open_vSwitch"/>. This is a list separated + by <code>,</code> that contains <code>port=interfacename</code> pairs. + If a match is found in there the configured interface name is used + instead of the autodiscovery. Also it is then irrelevant if the port + is bound locally. + </column> </group> <group title="Attachment"> diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index 44788bfdd..bd39865d5 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -15257,6 +15257,37 @@ check_row_count Advertised_Route 1 datapath=$datapath logical_port=$lr0lr2 ip_pr AT_CLEANUP ]) +OVN_FOR_EACH_NORTHD_NO_HV([ +AT_SETUP([dynamic-routing - lrp options]) +AT_KEYWORDS([dynamic-routing]) +ovn_start + +check ovn-nbctl lr-add lr0 +check ovn-nbctl set Logical_Router lr0 option:dynamic-routing=true \ + option:dynamic-routing-redistribute="connected;static" +check ovn-nbctl lrp-add lr0 lr0-sw0 00:00:00:00:ff:01 10.0.0.1/24 +check ovn-nbctl set Logical_Router lr0 options:chassis=hv1 +check ovn-nbctl ls-add sw0 +check ovn-nbctl lsp-add sw0 sw0-lr0 +check ovn-nbctl --wait=sb set Logical_Switch_Port sw0-lr0 type=router options:router-port=lr0-sw0 + +AT_CHECK([fetch_column sb:Port_Binding options logical_port=lr0-sw0 | grep -q 'dynamic-routing=true']) +AT_CHECK([fetch_column sb:Port_Binding options logical_port=lr0-sw0 | grep -qv 'dynamic-routing-maintain-vrf']) +AT_CHECK([fetch_column sb:Port_Binding options logical_port=lr0-sw0 | grep -qv 'dynamic-routing-vrf-name']) +AT_CHECK([fetch_column sb:Port_Binding options logical_port=lr0-sw0 | grep -qv 'dynamic-routing-port-name']) + +check ovn-nbctl set Logical_Router lr0 options:dynamic-routing-vrf-name=myvrf +check ovn-nbctl --wait=sb set Logical_Router_Port lr0-sw0 options:dynamic-routing-maintain-vrf=true \ + options:dynamic-routing-port-name=myif + +AT_CHECK([fetch_column sb:Port_Binding options logical_port=lr0-sw0 | grep -q 'dynamic-routing=true']) +AT_CHECK([fetch_column sb:Port_Binding options logical_port=lr0-sw0 | grep -q 'dynamic-routing-maintain-vrf=true']) +AT_CHECK([fetch_column sb:Port_Binding options logical_port=lr0-sw0 | grep -q 'dynamic-routing-vrf-name=myvrf']) +AT_CHECK([fetch_column sb:Port_Binding options logical_port=lr0-sw0 | grep -q 'dynamic-routing-port-name=myif']) + +AT_CLEANUP +]) + OVN_FOR_EACH_NORTHD_NO_HV([ AT_SETUP([dynamic-routing incremental processing]) AT_KEYWORDS([dynamic-routing]) -- 2.47.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev