operational state of LLGR procedures 22/78122/36
authorMatej Perina <matej.perina@pantheon.tech>
Fri, 23 Nov 2018 09:32:16 +0000 (10:32 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 14 Dec 2018 14:58:11 +0000 (15:58 +0100)
State of (LL)GR operations (restart time, enabled afi-safi...)
is now accessible in operational datastore.

JIRA: BGPCEP-809
Change-Id: If03b74e67750970a08cfdc34ae402cbe8283da15
Signed-off-by: Matej Perina <matej.perina@pantheon.tech>
bgp/openconfig-api/src/main/yang/bgp-openconfig-extensions.yang
bgp/openconfig-state/src/main/java/org/opendaylight/protocol/bgp/state/NeighborUtil.java
bgp/openconfig-state/src/test/java/org/opendaylight/protocol/bgp/state/NeighborUtilTest.java
bgp/openconfig-state/src/test/java/org/opendaylight/protocol/bgp/state/StateProviderImplTest.java

index 2d91e2f9ebf955eeb5c94c81ca3d7ab3cd531621..b29dd565b17fea3f4032444e9aa4555f157e5f40 100644 (file)
@@ -112,6 +112,29 @@ module bgp-openconfig-extensions {
         }
     }
 
+    grouping neighbor-afi-safi-ll-graceful-restart-state {
+        leaf ll-received {
+            type boolean;
+            description
+                "This leaf indicates whether the neighbor advertised the
+                ability to support long-lived graceful-restart for this AFI-SAFI";
+        }
+        leaf ll-advertised {
+            type boolean;
+            description
+                "This leaf indicates whether the ability to support
+                long-lived graceful-restart has been advertised to the peer";
+        }
+        leaf ll-stale-timer {
+            type uint32;
+            description
+                "Value of timer used during long-lived graceful restart in nseconds.
+                If table is both advertised and received use lower value. Zero value
+                means table is not supported by any side";
+            units seconds;
+        }
+    }
+
     augment /netinst:network-instances/netinst:network-instance/netinst:protocols/netinst:protocol {
         ext:augment-identifier network-instance-protocol;
         uses openconfig-bgp:bgp-top {
@@ -190,6 +213,7 @@ module bgp-openconfig-extensions {
             augment bgp/neighbors/neighbor/afi-safis/afi-safi/graceful-restart/state {
                 ext:augment-identifier neighbor-afi-safi-graceful-restart_state-augmentation;
                 uses bgp-op:bgp-neighbor-afi-safi-graceful-restart_state;
+                uses neighbor-afi-safi-ll-graceful-restart-state;
             }
             augment bgp/peer-groups/peer-group/state {
                 ext:augment-identifier peer-group_state-augmentation;
index 582bdfffd23bb20988eab2bb40f00da6b18cae39..265f0cc07b9695fcf0a1a0079a199e8c4dba0a5b 100644 (file)
@@ -25,6 +25,7 @@ import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer
 import org.opendaylight.protocol.bgp.rib.spi.state.BGPAfiSafiState;
 import org.opendaylight.protocol.bgp.rib.spi.state.BGPErrorHandlingState;
 import org.opendaylight.protocol.bgp.rib.spi.state.BGPGracelfulRestartState;
+import org.opendaylight.protocol.bgp.rib.spi.state.BGPLlGracelfulRestartState;
 import org.opendaylight.protocol.bgp.rib.spi.state.BGPPeerMessagesState;
 import org.opendaylight.protocol.bgp.rib.spi.state.BGPPeerState;
 import org.opendaylight.protocol.bgp.rib.spi.state.BGPSessionState;
@@ -225,7 +226,7 @@ public final class NeighborUtil {
                 new NeighborGracefulRestartStateAugmentationBuilder()
                         .setLocalRestarting(neighbor.isLocalRestarting())
                         .setPeerRestartTime(neighbor.getPeerRestartTime())
-                        //.setMode(mode) TBD once implemented
+                        .setMode(neighbor.getMode())
                         .setPeerRestarting(neighbor.isPeerRestarting()).build();
 
         return new GracefulRestartBuilder().setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp
@@ -355,11 +356,14 @@ public final class NeighborUtil {
 
     private static org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi
             .safi.list.afi.safi.GracefulRestart buildAfiSafiGracefulRestartState(
-            @Nonnull final BGPGracelfulRestartState neighbor, @Nonnull final TablesKey tablesKey) {
+            @Nonnull final BGPLlGracelfulRestartState neighbor, @Nonnull final TablesKey tablesKey) {
         final NeighborAfiSafiGracefulRestartStateAugmentation builder =
                 new NeighborAfiSafiGracefulRestartStateAugmentationBuilder()
                         .setAdvertised(neighbor.isGracefulRestartAdvertized(tablesKey))
-                        .setReceived(neighbor.isGracefulRestartReceived(tablesKey)).build();
+                        .setReceived(neighbor.isGracefulRestartReceived(tablesKey))
+                        .setLlAdvertised(neighbor.isLlGracefulRestartAdvertised(tablesKey))
+                        .setLlReceived(neighbor.isLlGracefulRestartReceived(tablesKey))
+                        .setLlStaleTimer((long) neighbor.getLlGracefulRestartTimer(tablesKey)).build();
         return new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi
                 .safi.list.afi.safi.GracefulRestartBuilder().setState(new org.opendaylight.yang.gen.v1.http.openconfig
                 .net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.StateBuilder()
index 97b05c74a33cba913071a824c7f08e98d38cc02d..d66059cf2c793e66ccd34e7b2106a451ccd42bc8 100644 (file)
@@ -73,6 +73,11 @@ public class NeighborUtilTest {
         doReturn(false).when(this.bgpAfiSafiState).isAfiSafiSupported(eq(TABLES_KEY));
         doReturn(false).when(this.bgpAfiSafiState).isGracefulRestartAdvertized(eq(TABLES_KEY));
         doReturn(false).when(this.bgpAfiSafiState).isGracefulRestartReceived(eq(TABLES_KEY));
+        doReturn(false).when(this.bgpAfiSafiState).isLlGracefulRestartAdvertised((eq(TABLES_KEY)));
+        doReturn(false).when(this.bgpAfiSafiState).isLlGracefulRestartReceived((eq(TABLES_KEY)));
+        doReturn(0).when(this.bgpAfiSafiState).getLlGracefulRestartTimer((eq(TABLES_KEY)));
+
+
     }
 
     @Test
@@ -139,8 +144,13 @@ public class NeighborUtilTest {
 
         final GracefulRestart graceful = new GracefulRestartBuilder()
                 .setState(new StateBuilder().addAugmentation(NeighborAfiSafiGracefulRestartStateAugmentation.class,
-                        new NeighborAfiSafiGracefulRestartStateAugmentationBuilder().setAdvertised(false)
-                                .setReceived(false).build()).build()).build();
+                        new NeighborAfiSafiGracefulRestartStateAugmentationBuilder()
+                                .setAdvertised(false)
+                                .setReceived(false)
+                                .setLlReceived(false)
+                                .setLlAdvertised(false)
+                                .setLlStaleTimer(0L)
+                                .build()).build()).build();
 
         final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi
                 .list.afi.safi.State afiSafiState = new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp
index 6b7204622a85a29e603a809763221410b398098d..b30e9e00015ff04531c46412210e1a7d46f5357f 100644 (file)
@@ -74,6 +74,7 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.r
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.GracefulRestartBuilder;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.StateBuilder;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.operational.rev151009.BgpAfiSafiGracefulRestartState;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.operational.rev151009.BgpNeighborState;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.operational.rev151009.bgp.neighbor.prefix.counters_state.PrefixesBuilder;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.graceful.restart.GracefulRestart;
@@ -261,6 +262,7 @@ public class StateProviderImplTest extends ConstantSchemaAbstractDataBrokerTest
         doReturn(true).when(this.bgpGracelfulRestartState).isLocalRestarting();
         doReturn(true).when(this.bgpGracelfulRestartState).isPeerRestarting();
         doReturn(this.restartTime).when(this.bgpGracelfulRestartState).getPeerRestartTime();
+        doReturn(BgpAfiSafiGracefulRestartState.Mode.BILATERAL).when(this.bgpGracelfulRestartState).getMode();
 
         doReturn(this.bgpAfiSafiState).when(this.bgpPeerState).getBGPAfiSafiState();
         doReturn(Collections.singleton(TABLES_KEY)).when(this.bgpAfiSafiState).getAfiSafisAdvertized();
@@ -271,6 +273,9 @@ public class StateProviderImplTest extends ConstantSchemaAbstractDataBrokerTest
         doReturn(true).when(this.bgpAfiSafiState).isAfiSafiSupported(any());
         doReturn(true).when(this.bgpAfiSafiState).isGracefulRestartAdvertized(any());
         doReturn(true).when(this.bgpAfiSafiState).isGracefulRestartReceived(any());
+        doReturn(true).when(this.bgpAfiSafiState).isLlGracefulRestartAdvertised(any());
+        doReturn(true).when(this.bgpAfiSafiState).isLlGracefulRestartReceived(any());
+        doReturn(60).when(this.bgpAfiSafiState).getLlGracefulRestartTimer(any());
     }
 
     @Override
@@ -483,7 +488,12 @@ public class StateProviderImplTest extends ConstantSchemaAbstractDataBrokerTest
                 .setGracefulRestart(new GracefulRestartBuilder().setState(new StateBuilder().setEnabled(false)
                         .addAugmentation(NeighborAfiSafiGracefulRestartStateAugmentation.class,
                                 new NeighborAfiSafiGracefulRestartStateAugmentationBuilder()
-                                        .setAdvertised(true).setReceived(true).build())
+                                        .setAdvertised(true)
+                                        .setReceived(true)
+                                        .setLlStaleTimer(60L)
+                                        .setLlAdvertised(true)
+                                        .setLlReceived(true)
+                                        .build())
                         .build()).build())
                 .setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp
                         .common.afi.safi.list.afi.safi.StateBuilder().setEnabled(false).addAugmentation(
@@ -537,7 +547,9 @@ public class StateProviderImplTest extends ConstantSchemaAbstractDataBrokerTest
         gracefulAugmentation.setLocalRestarting(false);
         gracefulAugmentation.setPeerRestartTime(0);
         gracefulAugmentation.setLocalRestarting(true)
-                .setPeerRestarting(true).setPeerRestartTime(this.restartTime);
+                .setPeerRestarting(true)
+                .setPeerRestartTime(this.restartTime)
+                .setMode(BgpAfiSafiGracefulRestartState.Mode.BILATERAL);
         final GracefulRestart gracefulRestart = new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp
                 .rev151009.bgp.graceful.restart.GracefulRestartBuilder().setState(new org.opendaylight.yang.gen.v1.http
                 .openconfig.net.yang.bgp.rev151009.bgp.graceful.restart.graceful.restart.StateBuilder()