Ensure compliance with RFC8212 35/102535/5
authorSamuel Schneider <samuel.schneider@pantheon.tech>
Mon, 3 Oct 2022 08:46:22 +0000 (10:46 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 12 Dec 2022 09:49:33 +0000 (09:49 +0000)
Change default routing policy config to be compliant
with default behavior from RFC8212.

Add the fact of compliance with RFC8212 to documentation.

Changes to tests caused by change to default policy.

JIRA: BGPCEP-1013
Change-Id: Ia1a78780a7b34d436cb878cf53a66c971540aec1
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
bgp/config-example/src/main/resources/initial/routing-policy-config.xml
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/AddPathBasePathsTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/GracefulRestartTest.java
bmp/bmp-impl/src/test/java/org/opendaylight/protocol/bmp/impl/session/BmpDispatcherImplTest.java
docs/bgp/bgp-user-guide-rib-config-policies.rst
docs/bgp/bgp-user-guide-supported-capabilities.rst

index 3e4fb385f7a4d015f8a8ef18f96d7af20fb6af92..2b417de35c023c7789c2ee9f330c7e2ebfc5718b 100644 (file)
                         </bgp-conditions>
                     </conditions>
                     <actions>
-                        <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
-                            <non-transitive-attributes-filter xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
-                            <local-as-path-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
-                        </bgp-actions>
+                        <reject-route/>
                     </actions>
                 </statement>
                 <statement>
                         <reject-route/>
                     </actions>
                 </statement>
-                <statement>
-                    <name>from-external-to-external-RTC</name>
-                    <conditions>
-                        <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
-                            <afi-safi-in xmlns:x="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">x:ROUTE-TARGET-CONSTRAIN</afi-safi-in>
-                            <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <from-role>
-                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
-                                </from-role>
-                                <to-role>
-                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
-                                </to-role>
-                            </match-role-set>
-                        </bgp-conditions>
-                    </conditions>
-                    <actions>
-                        <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
-                            <client-attribute-prepend xmlns="urn:opendaylight:params:xml:ns:yang:bgp:route:target:constrain"/>
-                        </bgp-actions>
-                    </actions>
-                </statement>
                 <statement>
                     <name>to-external</name>
                     <conditions>
                         </bgp-conditions>
                     </conditions>
                     <actions>
-                        <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
-                            <non-transitive-attributes-filter xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
-                            <local-as-path-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
-                            <set-as-path-prepend/>
-                        </bgp-actions>
+                        <reject-route/>
                     </actions>
                 </statement>
                 <statement>
index b4f891596f30878fc567c7a3540c1343a37dd54a..7ecc58bf610d0c2d0651eba706d2fae1edc82492 100644 (file)
@@ -93,21 +93,19 @@ public class AddPathBasePathsTest extends AbstractAddPathTest {
         //new best route so far
         sendRouteAndCheckIsOnLocRib(session1, PREFIX1, 100, 1);
         checkReceivedMessages(listener4, 2);
-        checkReceivedMessages(listener5, 2);
+        checkReceivedMessages(listener5, 1);
         assertEquals(UPD_NA_100, listener4.getListMsg().get(1));
-        assertEquals(UPD_NA_100_EBGP, listener5.getListMsg().get(1));
 
         //the second best route
         sendRouteAndCheckIsOnLocRib(session2, PREFIX1, 100, 1);
         checkReceivedMessages(listener4, 2);
-        checkReceivedMessages(listener5, 2);
+        checkReceivedMessages(listener5, 1);
 
         //new best route
         sendRouteAndCheckIsOnLocRib(session3, PREFIX1, 200, 1);
         checkReceivedMessages(listener4, 3);
-        checkReceivedMessages(listener5, 3);
+        checkReceivedMessages(listener5, 1);
         assertEquals(UPD_NA_200, listener4.getListMsg().get(2));
-        assertEquals(UPD_NA_200_EBGP, listener5.getListMsg().get(2));
 
         final SimpleSessionListener listener6 = new SimpleSessionListener();
         configurePeer(tableRegistry, PEER6, ribImpl, nonAddPathParams, PeerRole.RrClient,
@@ -123,24 +121,23 @@ public class AddPathBasePathsTest extends AbstractAddPathTest {
         //best route updated to be the worse one
         sendRouteAndCheckIsOnLocRib(session3, PREFIX1, 20, 1);
         checkReceivedMessages(listener4, 4);
-        checkReceivedMessages(listener5, 4);
+        checkReceivedMessages(listener5, 1);
         assertEquals(UPD_NA_100, listener4.getListMsg().get(3));
-        assertEquals(UPD_NA_100_EBGP, listener5.getListMsg().get(3));
 
         //Remove second best, no advertisement should be done
         sendWithdrawalRouteAndCheckIsOnLocRib(session2, PREFIX1, 50, 1);
         checkReceivedMessages(listener4, 4);
-        checkReceivedMessages(listener5, 4);
+        checkReceivedMessages(listener5, 1);
 
         //Remove best, 1 advertisement
         sendWithdrawalRouteAndCheckIsOnLocRib(session1, PREFIX1, 100, 1);
         checkReceivedMessages(listener4, 5);
-        checkReceivedMessages(listener5, 5);
+        checkReceivedMessages(listener5, 1);
 
         //Remove best, 1 withdrawal
         sendWithdrawalRouteAndCheckIsOnLocRib(session3, PREFIX1, 20, 0);
         checkReceivedMessages(listener4, 6);
-        checkReceivedMessages(listener5, 6);
+        checkReceivedMessages(listener5, 1);
 
         session1.close();
         session2.close();
index 6a8c6910be25a11e797fe76b5d8edf0d38874f0b..53da62dc716efc0722f420241106c9b13da816c7 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.protocol.bgp.rib.impl;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.opendaylight.protocol.bgp.rib.impl.CheckUtil.checkIdleState;
@@ -334,41 +333,36 @@ public class GracefulRestartTest extends AbstractAddPathTest {
      */
     @Test
     public void verifySendEORafterRestartTest() throws Exception {
-        final SimpleSessionListener listener2 = new SimpleSessionListener();
-        configurePeer(tableRegistry, PEER2, ribImpl, parameters, PeerRole.Ebgp,
+        configurePeer(tableRegistry, PEER2, ribImpl, parameters, PeerRole.Ibgp,
                 serverRegistry, afiSafiAdvertised, gracefulAfiSafiAdvertised);
-        final BGPSessionImpl session2 = createPeerSession(PEER2, parameters, listener2);
         final List<Ipv4Prefix> ipv4Prefixes = Arrays.asList(new Ipv4Prefix(PREFIX1));
         final List<Ipv4Prefix> ipv4Prefixes2 = Arrays.asList(new Ipv4Prefix(PREFIX2));
         final List<Ipv6Prefix> ipv6Prefixes = Collections.singletonList(new Ipv6Prefix(PREFIX3));
         insertRoutes(ipv4Prefixes, ipv6Prefixes);
-        insertRoutes(ipv4Prefixes2, PEER2, null, null, session2, BgpOrigin.Egp);
+        insertRoutes(ipv4Prefixes2, null);
         checkLocRibIpv4Routes(2);
         checkLocRibIpv6Routes(1);
-        org.opendaylight.protocol.util.CheckUtil.checkReceivedMessages(listener, 3);
-        // verify sending of Ipv4 EOT, Ipv6 EOT and Ipv4 update with route
-        checkReceivedMessages(listener, 3);
+        // verify sending of Ipv4 EOT, Ipv6 EOT
+        checkReceivedMessages(listener, 2);
         assertTrue(listener.getListMsg().get(0) instanceof Update);
         assertTrue(BgpPeerUtil.isEndOfRib((Update)listener.getListMsg().get(0)));
         assertTrue(listener.getListMsg().get(1) instanceof Update);
         assertTrue(BgpPeerUtil.isEndOfRib((Update)listener.getListMsg().get(1)));
-        assertTrue(listener.getListMsg().get(2) instanceof Update);
-        assertFalse(BgpPeerUtil.isEndOfRib((Update)listener.getListMsg().get(2)));
 
         session.close();
         checkIdleState(peer);
         checkLocRibIpv4Routes(2);
         checkLocRibIpv6Routes(0);
         // verify nothing new was sent
-        checkReceivedMessages(listener, 3);
+        checkReceivedMessages(listener, 2);
 
         session = createPeerSession(PEER1, createParameter(false, true,
                 Collections.singletonMap(TABLES_KEY, true)), listener);
         checkUpState(listener);
         checkUpState(peer);
-        org.opendaylight.protocol.util.CheckUtil.checkReceivedMessages(listener, 6);
-        // verify sending of Ipv4 update with route, Ipv4 EOT and Ipv6 EOT; order can vary based on ODTC order
-        final List<Notification<?>> subList = listener.getListMsg().subList(3, 6);
+        checkReceivedMessages(listener, 4);
+        // verify sending of Ipv4 EOT and Ipv6 EOT; order can vary based on ODTC order
+        final List<Notification<?>> subList = listener.getListMsg().subList(2, 4);
         int eotCount = 0;
         int routeUpdateCount = 0;
         for (Notification<?> message : subList) {
@@ -379,7 +373,7 @@ public class GracefulRestartTest extends AbstractAddPathTest {
             }
         }
         assertEquals(2, eotCount);
-        assertEquals(1, routeUpdateCount);
+        assertEquals(0, routeUpdateCount);
     }
 
     private void checkLocRibIpv4Routes(final int expectedRoutesOnDS) throws Exception {
index c841215f27129eb282468c324175da4d967c87bc..e1107cfbc4d6325adbb033dd67b9e7cb98a6d8f8 100644 (file)
@@ -56,8 +56,6 @@ public class BmpDispatcherImplTest {
         doNothing().when(mockedSession).handlerAdded(any(ChannelHandlerContext.class));
         doNothing().when(mockedSession).channelRegistered(any(ChannelHandlerContext.class));
         doNothing().when(mockedSession).channelActive(any(ChannelHandlerContext.class));
-        doNothing().when(mockedSession).channelInactive(any(ChannelHandlerContext.class));
-        doNothing().when(mockedSession).channelUnregistered(any(ChannelHandlerContext.class));
 
         bgpActivator = new BGPActivator();
         final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
index 53a8af9026051996017684a8eec3819ac321d787..6a70e6da9a415a255f343ce33ccbad82b343976a 100644 (file)
@@ -5,7 +5,7 @@ RIB Policy Configuration
 
 The OpenDaylight BGP implementation supports configurable RIB policies that allow the modification of import and export policies.
 
-.. note:: Default ODL BGP RIB Config Policy is provided. Any config policy to be used by Protocol must be configured and present before than Protocol configuration is added. If policy is reconfigured, protocol must be re configured again.
+.. note:: Default ODL BGP RIB Config Policy is provided. Default policy is compliant with default behaviour from `RFC8212 <https://tools.ietf.org/html/rfc8212>`_. Any config policy to be used by Protocol must be configured and present before than Protocol configuration is added. If policy is reconfigured, protocol must be re configured again.
 
 **URL:** ``/restconf/config/openconfig-routing-policy:routing-policy``
 
index 9329d2950d2a05359695cf1d54e9f9fcc71e2266..bcabb328b13e70f0aedfd19b4798ae6dda8b7ddd 100644 (file)
@@ -42,3 +42,4 @@ In addition to the base protocol implementation, the plugin provides many extens
 * `RFC4724 <https://tools.ietf.org/html/rfc4724>`_  - Graceful Restart Mechanism for BGP
    * `draft-uttaro-idr-bgp-persistence-04 <https://tools.ietf.org/html/draft-uttaro-idr-bgp-persistence-04>`_ - Support for Long-lived BGP Graceful Restart
 * `RFC7606 <https://tools.ietf.org/html/rfc7606>`_ - Revised Error Handling for BGP UPDATE Messages
+* `RFC8212 <https://tools.ietf.org/html/rfc8212>`_ - Default External BGP (EBGP) Route Propagation Behavior without Policies
\ No newline at end of file