use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.graceful.restart.GracefulRestartBuilder in project bgpcep by opendaylight.
the class NeighborUtilTest method buildAfisSafisState.
@Test
public void buildAfisSafisState() {
assertEquals(Collections.emptyMap(), NeighborUtil.buildAfisSafisState(this.bgpAfiSafiState, this.tableRegistry));
final GracefulRestart graceful = new GracefulRestartBuilder().setState(new StateBuilder().addAugmentation(new NeighborAfiSafiGracefulRestartStateAugmentationBuilder().setAdvertised(false).setReceived(false).setLlReceived(false).setLlAdvertised(false).setLlStaleTimer(Uint32.ZERO).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.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.StateBuilder().addAugmentation(new NeighborAfiSafiStateAugmentationBuilder().setActive(false).build()).build();
this.afiSafi = IPV4UNICAST.class;
final AfiSafi expected = new AfiSafiBuilder().setAfiSafiName(this.afiSafi).setState(afiSafiState).setGracefulRestart(graceful).build();
assertEquals(Collections.singletonMap(expected.key(), expected), NeighborUtil.buildAfisSafisState(this.bgpAfiSafiState, this.tableRegistry));
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.graceful.restart.GracefulRestartBuilder in project bgpcep by opendaylight.
the class OpenConfigMappingUtilTest method getGracefulRestartTimerTest.
@Test
public void getGracefulRestartTimerTest() {
final int neighborTimer = 5;
final int peerGroupTimer = 10;
Neighbor neighbor = new NeighborBuilder().setNeighborAddress(NEIGHBOR_ADDRESS).setGracefulRestart(new GracefulRestartBuilder().setConfig(createGracefulConfig(Uint16.valueOf(neighborTimer))).build()).build();
PeerGroup peerGroup = new PeerGroupBuilder().setPeerGroupName("foo").setGracefulRestart(new GracefulRestartBuilder().setConfig(createGracefulConfig(Uint16.valueOf(peerGroupTimer))).build()).build();
// both timers present, pick peer group one
int timer = OpenConfigMappingUtil.getGracefulRestartTimer(neighbor, peerGroup, HOLDTIMER);
assertEquals(peerGroupTimer, timer);
// peer group missing graceful restart, use neighbor timer
timer = OpenConfigMappingUtil.getGracefulRestartTimer(neighbor, EMPTY_PEERGROUP, HOLDTIMER);
assertEquals(neighborTimer, timer);
// graceful restart enabled but timer not set, use hold time
peerGroup = new PeerGroupBuilder().setPeerGroupName("bar").setGracefulRestart(new GracefulRestartBuilder().setConfig(createGracefulConfig(null)).build()).build();
timer = OpenConfigMappingUtil.getGracefulRestartTimer(EMPTY_NEIGHBOR, peerGroup, HOLDTIMER);
assertEquals(HOLDTIMER, timer);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.graceful.restart.GracefulRestartBuilder in project netvirt by opendaylight.
the class BgpConfigurationManager method addGracefulRestart.
public void addGracefulRestart(int staleTime) {
InstanceIdentifier.InstanceIdentifierBuilder<GracefulRestart> iib = InstanceIdentifier.builder(Bgp.class).child(GracefulRestart.class);
InstanceIdentifier<GracefulRestart> iid = iib.build();
GracefulRestart dto = new GracefulRestartBuilder().setStalepathTime((long) staleTime).build();
update(iid, dto);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.graceful.restart.GracefulRestartBuilder in project bgpcep by opendaylight.
the class GracefulRestartUtilTest method getLlGracefulTimersTest.
@Test
public void getLlGracefulTimersTest() {
final List<AfiSafi> afiSafi = new ArrayList<>();
afiSafi.add(new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).setGracefulRestart(new GracefulRestartBuilder().setConfig(new ConfigBuilder().addAugmentation(new Config1Builder().setLlGracefulRestart(new LlGracefulRestartBuilder().setConfig(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.ll.graceful.restart.rev181112.afi.safi.ll.graceful.restart.ll.graceful.restart.ConfigBuilder().setLongLivedStaleTime(new Uint24(Uint32.valueOf(STALE_TIME))).build()).build()).build()).build()).build()).build());
final Map<TablesKey, Integer> llGracefulTimers = GracefulRestartUtil.getLlGracefulTimers(afiSafi, this.tableRegistry);
assertNotNull(llGracefulTimers);
assertEquals(1, llGracefulTimers.size());
assertEquals(STALE_TIME, llGracefulTimers.get(IPV4_KEY).intValue());
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.graceful.restart.GracefulRestartBuilder in project bgpcep by opendaylight.
the class StateProviderImplTest method buildAfiSafis.
private static AfiSafis buildAfiSafis() {
final NeighborAfiSafiStateAugmentationBuilder neighborAfiSafiStateAugmentation = new NeighborAfiSafiStateAugmentationBuilder().setActive(true).setPrefixes(new PrefixesBuilder().setSent(Uint32.ONE).setReceived(Uint32.TWO).setInstalled(Uint32.ONE).build());
final AfiSafi afiSafi = new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).setGracefulRestart(new GracefulRestartBuilder().setState(new StateBuilder().setEnabled(false).addAugmentation(new NeighborAfiSafiGracefulRestartStateAugmentationBuilder().setAdvertised(true).setReceived(true).setLlStaleTimer(Uint32.valueOf(60)).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(neighborAfiSafiStateAugmentation.build()).build()).build();
return new AfiSafisBuilder().setAfiSafi(Map.of(afiSafi.key(), afiSafi)).build();
}
Aggregations