</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>
//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,
//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();
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;
*/
@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) {
}
}
assertEquals(2, eotCount);
- assertEquals(1, routeUpdateCount);
+ assertEquals(0, routeUpdateCount);
}
private void checkLocRibIpv4Routes(final int expectedRoutesOnDS) throws Exception {
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();
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``
* `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