Search in sources :

Example 1 with AfiSafisBuilder

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder in project bgpcep by opendaylight.

the class NeighborStateCliUtilsTest method testFullNeighborStateCli.

@Test
public void testFullNeighborStateCli() throws IOException {
    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(NeighborAfiSafiStateAugmentation.class, new NeighborAfiSafiStateAugmentationBuilder().setActive(true).setPrefixes(new PrefixesBuilder().setInstalled(1L).setReceived(1L).setSent(2L).build()).build());
    final AfiSafi afiSafi = new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).setState(builder.build()).build();
    final StateBuilder stateBuilder = new StateBuilder();
    stateBuilder.addAugmentation(NeighborStateAugmentation.class, new NeighborStateAugmentationBuilder().setSupportedCapabilities(Collections.singletonList(ADDPATHS.class)).setSessionState(BgpNeighborState.SessionState.ACTIVE).build());
    final Received received = new ReceivedBuilder().setNOTIFICATION(BigInteger.ONE).setUPDATE(BigInteger.TEN).build();
    final Sent sent = new SentBuilder().setNOTIFICATION(BigInteger.TEN).setUPDATE(BigInteger.ONE).build();
    stateBuilder.addAugmentation(BgpNeighborStateAugmentation.class, 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(NeighborTransportStateAugmentation.class, new NeighborTransportStateAugmentationBuilder().setRemoteAddress(NEIGHBOR_IP_ADDRESS).setLocalPort(new PortNumber(1234)).setRemotePort(new PortNumber(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(NeighborTimersStateAugmentation.class, new NeighborTimersStateAugmentationBuilder().setNegotiatedHoldTime(BigDecimal.TEN).setUptime(new Timeticks(600L)).build()).build()).build();
    final Neighbor neighbor = new NeighborBuilder().setState(stateBuilder.build()).setAfiSafis(new AfiSafisBuilder().setAfiSafi(Collections.singletonList(afiSafi)).build()).setTransport(transport).setTimers(timers).build();
    NeighborStateCliUtils.displayNeighborOperationalState(NEIGHBOR_ADDRESS, neighbor, this.stream);
    final String expected = IOUtils.toString(getClass().getClassLoader().getResourceAsStream("neighbor.txt"), UTF8);
    assertEquals(expected, this.output.toString());
}
Also used : NeighborTransportStateAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborTransportStateAugmentationBuilder) NeighborStateAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborStateAugmentationBuilder) BgpNeighborStateAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.BgpNeighborStateAugmentationBuilder) AfiSafi(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi) TransportBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.TransportBuilder) StateBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.StateBuilder) SentBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.SentBuilder) MessagesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.MessagesBuilder) AfiSafiBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder) NeighborTimersStateAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborTimersStateAugmentation) AfiSafisBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder) NeighborTransportStateAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborTransportStateAugmentation) TimersBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.TimersBuilder) Sent(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Sent) AfiSafi(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi) BgpNeighborStateAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.BgpNeighborStateAugmentationBuilder) NeighborTimersStateAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborTimersStateAugmentationBuilder) Received(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Received) Neighbor(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.Neighbor) Timeticks(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timeticks) NeighborBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.NeighborBuilder) NeighborAfiSafiStateAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAfiSafiStateAugmentationBuilder) PrefixesBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.operational.rev151009.bgp.neighbor.prefix.counters_state.PrefixesBuilder) ReceivedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.ReceivedBuilder) Transport(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.Transport) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) Timers(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.Timers) Test(org.junit.Test)

Example 2 with AfiSafisBuilder

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder in project bgpcep by opendaylight.

the class OpenConfigMappingUtilTest method testGetAfiSafiWithDefault.

@Test
public void testGetAfiSafiWithDefault() {
    final ImmutableList<AfiSafi> defaultValue = ImmutableList.of(new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).build());
    assertEquals(defaultValue, OpenConfigMappingUtil.getAfiSafiWithDefault(null, true));
    final AfiSafis afiSafi = new AfiSafisBuilder().build();
    assertEquals(defaultValue, OpenConfigMappingUtil.getAfiSafiWithDefault(afiSafi, true));
    final AfiSafi afiSafiIpv6 = new AfiSafiBuilder().setAfiSafiName(IPV6UNICAST.class).addAugmentation(NeighborAddPathsConfig.class, new NeighborAddPathsConfigBuilder().setReceive(true).setSendMax(SHORT).build()).build();
    final List<AfiSafi> afiSafiIpv6List = new ArrayList<>();
    afiSafiIpv6List.add(afiSafiIpv6);
    final List<AfiSafi> expected = new ArrayList<>(afiSafiIpv6List);
    expected.add(AFI_SAFI_IPV4);
    assertEquals(afiSafiIpv6, OpenConfigMappingUtil.getAfiSafiWithDefault(new AfiSafisBuilder().setAfiSafi(afiSafiIpv6List).build(), true).get(0));
    assertEquals(new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).build(), OpenConfigMappingUtil.getAfiSafiWithDefault(new AfiSafisBuilder().setAfiSafi(afiSafiIpv6List).build(), true).get(1));
    assertEquals(AFI_SAFI, OpenConfigMappingUtil.getAfiSafiWithDefault(createAfiSafi(), true));
    assertTrue(OpenConfigMappingUtil.getAfiSafiWithDefault(null, false).isEmpty());
    assertTrue(OpenConfigMappingUtil.getAfiSafiWithDefault(afiSafi, false).isEmpty());
    assertEquals(afiSafiIpv6, OpenConfigMappingUtil.getAfiSafiWithDefault(new AfiSafisBuilder().setAfiSafi(afiSafiIpv6List).build(), false).get(0));
    assertEquals(new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).build(), OpenConfigMappingUtil.getAfiSafiWithDefault(new AfiSafisBuilder().setAfiSafi(afiSafiIpv6List).build(), false).get(1));
    assertEquals(AFI_SAFI, OpenConfigMappingUtil.getAfiSafiWithDefault(createAfiSafi(), false));
}
Also used : NeighborAddPathsConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAddPathsConfig) AfiSafiBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder) AfiSafi(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi) BgpPeerTest.createAfiSafi(org.opendaylight.protocol.bgp.rib.impl.config.BgpPeerTest.createAfiSafi) AfiSafisBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder) ArrayList(java.util.ArrayList) AfiSafis(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafis) NeighborAddPathsConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAddPathsConfigBuilder) Test(org.junit.Test)

Example 3 with AfiSafisBuilder

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder 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(1L).setReceived(2L).setInstalled(1L).build());
    final AfiSafi afiSafi = new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).setGracefulRestart(new GracefulRestartBuilder().setState(new StateBuilder().setEnabled(false).addAugmentation(NeighborAfiSafiGracefulRestartStateAugmentation.class, new NeighborAfiSafiGracefulRestartStateAugmentationBuilder().setAdvertised(true).setReceived(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.class, neighborAfiSafiStateAugmentation.build()).build()).build();
    return new AfiSafisBuilder().setAfiSafi(Collections.singletonList(afiSafi)).build();
}
Also used : AfiSafi(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi) AfiSafi(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi) StateBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.StateBuilder) NeighborAfiSafiGracefulRestartStateAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAfiSafiGracefulRestartStateAugmentationBuilder) GracefulRestartBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.GracefulRestartBuilder) AfiSafiBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder) NeighborAfiSafiStateAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAfiSafiStateAugmentationBuilder) PrefixesBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.operational.rev151009.bgp.neighbor.prefix.counters_state.PrefixesBuilder) AfiSafisBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder) NeighborAfiSafiStateAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAfiSafiStateAugmentation) IPV4UNICAST(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4UNICAST)

Example 4 with AfiSafisBuilder

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder in project bgpcep by opendaylight.

the class GlobalStateCliUtilsTest method buildGlobal.

static GlobalBuilder buildGlobal(final boolean withStateAug) {
    final GlobalBuilder builder = new GlobalBuilder().setState(new StateBuilder().setAs(AsNumber.getDefaultInstance("100")).setTotalPaths(1L).setTotalPrefixes(2L).build());
    final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.StateBuilder stateBuilder = new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.StateBuilder();
    if (withStateAug) {
        stateBuilder.addAugmentation(GlobalAfiSafiStateAugmentation.class, new GlobalAfiSafiStateAugmentationBuilder().setTotalPaths(3L).setTotalPrefixes(4L).build());
    }
    builder.setAfiSafis(new AfiSafisBuilder().setAfiSafi(Collections.singletonList(new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).setState(stateBuilder.build()).build())).build());
    return builder;
}
Also used : GlobalBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.GlobalBuilder) StateBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.StateBuilder) AfiSafiBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder) GlobalAfiSafiStateAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.GlobalAfiSafiStateAugmentationBuilder) AfiSafisBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.AfiSafisBuilder)

Example 5 with AfiSafisBuilder

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder 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(NeighborAfiSafiStateAugmentation.class, 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(Collections.singletonList(afiSafi)).build()).build();
}
Also used : AfiSafi(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi) AfiSafi(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi) StateBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.StateBuilder) NeighborBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.NeighborBuilder) AfiSafiBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder) NeighborAfiSafiStateAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAfiSafiStateAugmentationBuilder) AfiSafisBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder)

Aggregations

AfiSafiBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder)5 AfiSafi (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi)4 AfiSafisBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder)4 NeighborAfiSafiStateAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAfiSafiStateAugmentationBuilder)3 Test (org.junit.Test)2 PrefixesBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.operational.rev151009.bgp.neighbor.prefix.counters_state.PrefixesBuilder)2 StateBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.StateBuilder)2 NeighborBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.NeighborBuilder)2 ArrayList (java.util.ArrayList)1 BgpPeerTest.createAfiSafi (org.opendaylight.protocol.bgp.rib.impl.config.BgpPeerTest.createAfiSafi)1 GracefulRestartBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.GracefulRestartBuilder)1 StateBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.StateBuilder)1 AfiSafisBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.AfiSafisBuilder)1 StateBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.StateBuilder)1 AfiSafis (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafis)1 Timers (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.Timers)1 TimersBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.TimersBuilder)1 Transport (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.Transport)1 TransportBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.TransportBuilder)1 Neighbor (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.Neighbor)1