use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborAfiSafiStateAugmentationBuilder in project bgpcep by opendaylight.
the class NeighborStateCliUtilsTest method testFullNeighborStateCli.
@Test
public void testFullNeighborStateCli() throws IOException {
final AfiSafi afiSafi = new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).setState(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(Boolean.TRUE).setPrefixes(new PrefixesBuilder().setInstalled(Uint32.ONE).setReceived(Uint32.ONE).setSent(Uint32.TWO).build()).build()).build()).build();
final StateBuilder stateBuilder = new StateBuilder().addAugmentation(new NeighborStateAugmentationBuilder().setSupportedCapabilities(Collections.singletonList(ADDPATHS.class)).setSessionState(BgpNeighborState.SessionState.ACTIVE).build());
final Received received = new ReceivedBuilder().setNOTIFICATION(Uint64.ONE).setUPDATE(Uint64.TEN).build();
final Sent sent = new SentBuilder().setNOTIFICATION(Uint64.TEN).setUPDATE(Uint64.ONE).build();
stateBuilder.addAugmentation(new BgpNeighborStateAugmentationBuilder().setMessages(new MessagesBuilder().setReceived(received).setSent(sent).build()).build());
final Transport transport = new TransportBuilder().setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.StateBuilder().addAugmentation(new NeighborTransportStateAugmentationBuilder().setRemoteAddress(NEIGHBOR_IP_ADDRESS).setLocalPort(new PortNumber(Uint16.valueOf(1234))).setRemotePort(new PortNumber(Uint16.valueOf(4321))).build()).build()).build();
final Timers timers = new TimersBuilder().setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.timers.StateBuilder().addAugmentation(new NeighborTimersStateAugmentationBuilder().setNegotiatedHoldTime(BigDecimal.TEN).setUptime(new Timeticks(Uint32.valueOf(600))).build()).build()).build();
final Neighbor neighbor = new NeighborBuilder().setNeighborAddress(new IpAddress(new Ipv4Address("1.2.3.4"))).setState(stateBuilder.build()).setAfiSafis(new AfiSafisBuilder().setAfiSafi(Map.of(afiSafi.key(), afiSafi)).build()).setTransport(transport).setTimers(timers).build();
NeighborStateCliUtils.displayNeighborOperationalState(NEIGHBOR_ADDRESS, neighbor, this.stream);
final String expected = Resources.toString(getClass().getClassLoader().getResource("neighbor.txt"), StandardCharsets.UTF_8);
assertEquals(expected, this.output.toString());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborAfiSafiStateAugmentationBuilder 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.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborAfiSafiStateAugmentationBuilder in project bgpcep by opendaylight.
the class NeighborStateCliUtilsTest method createBasicNeighbor.
static Neighbor createBasicNeighbor() {
final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.StateBuilder builder = new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.StateBuilder();
builder.addAugmentation(new NeighborAfiSafiStateAugmentationBuilder().setActive(false).build());
final AfiSafi afiSafi = new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).setState(builder.build()).build();
return new NeighborBuilder().setNeighborAddress(NEIGHBOR_IP_ADDRESS).setState(new StateBuilder().build()).setAfiSafis(new AfiSafisBuilder().setAfiSafi(Map.of(afiSafi.key(), afiSafi)).build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborAfiSafiStateAugmentationBuilder 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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborAfiSafiStateAugmentationBuilder in project bgpcep by opendaylight.
the class NeighborUtil method buildAfiSafiState.
private static org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.State buildAfiSafiState(@NonNull final BGPAfiSafiState neighbor, @NonNull final TablesKey tablesKey, final boolean afiSafiSupported) {
final NeighborAfiSafiStateAugmentationBuilder builder = new NeighborAfiSafiStateAugmentationBuilder();
builder.setActive(afiSafiSupported);
if (afiSafiSupported) {
builder.setPrefixes(new PrefixesBuilder().setInstalled(saturatedUint32(neighbor.getPrefixesInstalledCount(tablesKey))).setReceived(saturatedUint32(neighbor.getPrefixesReceivedCount(tablesKey))).setSent(saturatedUint32(neighbor.getPrefixesSentCount(tablesKey))).build());
}
return new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.StateBuilder().addAugmentation(builder.build()).build();
}
Aggregations