Search in sources :

Example 1 with NeighborTimersStateAugmentation

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborTimersStateAugmentation in project bgpcep by opendaylight.

the class NeighborStateCliUtils method printTimerState.

private static void printTimerState(final Timers timers, final ShellTable table) {
    if (timers == null) {
        return;
    }
    final NeighborTimersStateAugmentation state = timers.getState().augmentation(NeighborTimersStateAugmentation.class);
    if (state == null) {
        return;
    }
    addHeader(table, "Timer state");
    table.addRow().addContent("Negotiated Hold Time", state.getNegotiatedHoldTime());
    table.addRow().addContent("Uptime", state.getUptime().getValue());
}
Also used : NeighborTimersStateAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborTimersStateAugmentation)

Example 2 with NeighborTimersStateAugmentation

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborTimersStateAugmentation in project bgpcep by opendaylight.

the class NeighborUtilTest method testBuildTimerNormalValue.

@Test
public void testBuildTimerNormalValue() {
    final BGPTimersState timerState = mock(BGPTimersState.class);
    doReturn(90L).when(timerState).getNegotiatedHoldTime();
    doReturn(5000L).when(timerState).getUpTime();
    final NeighborTimersStateAugmentation timerStateAug = new NeighborTimersStateAugmentationBuilder().setNegotiatedHoldTime(BigDecimal.valueOf(90L)).setUptime(new Timeticks(Uint32.valueOf(500))).build();
    final Timers expectedTimers = new TimersBuilder().setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.timers.StateBuilder().addAugmentation(timerStateAug).build()).build();
    assertEquals(expectedTimers, NeighborUtil.buildTimer(timerState));
}
Also used : BGPTimersState(org.opendaylight.protocol.bgp.rib.spi.state.BGPTimersState) NeighborTimersStateAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborTimersStateAugmentationBuilder) StateBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.StateBuilder) Timeticks(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timeticks) NeighborTimersStateAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborTimersStateAugmentation) TimersBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.TimersBuilder) Timers(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.Timers) Test(org.junit.Test)

Example 3 with NeighborTimersStateAugmentation

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborTimersStateAugmentation in project bgpcep by opendaylight.

the class NeighborUtilTest method testBuildTimerRollOverValue.

@Test
public void testBuildTimerRollOverValue() {
    final BGPTimersState timerState = mock(BGPTimersState.class);
    doReturn(90L).when(timerState).getNegotiatedHoldTime();
    doReturn(42949673015L).when(timerState).getUpTime();
    final NeighborTimersStateAugmentation timerStateAug = new NeighborTimersStateAugmentationBuilder().setNegotiatedHoldTime(BigDecimal.valueOf(90L)).setUptime(new Timeticks(Uint32.valueOf(5))).build();
    final Timers expectedTimers = new TimersBuilder().setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.timers.StateBuilder().addAugmentation(timerStateAug).build()).build();
    assertEquals(expectedTimers, NeighborUtil.buildTimer(timerState));
}
Also used : BGPTimersState(org.opendaylight.protocol.bgp.rib.spi.state.BGPTimersState) NeighborTimersStateAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborTimersStateAugmentationBuilder) StateBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.StateBuilder) Timeticks(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timeticks) NeighborTimersStateAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborTimersStateAugmentation) TimersBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.TimersBuilder) Timers(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.Timers) Test(org.junit.Test)

Aggregations

NeighborTimersStateAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborTimersStateAugmentation)3 Test (org.junit.Test)2 BGPTimersState (org.opendaylight.protocol.bgp.rib.spi.state.BGPTimersState)2 StateBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.StateBuilder)2 Timers (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.Timers)2 TimersBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.TimersBuilder)2 Timeticks (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timeticks)2 NeighborTimersStateAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborTimersStateAugmentationBuilder)2