Search in sources :

Example 6 with AfiSafiBuilder

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder in project bgpcep by opendaylight.

the class GlobalUtil method buildAfiSafi.

/**
 * Build Afi Safi containing State.
 *
 * @param ribState             containing RIb Operational State
 * @param tablesKey            table Key
 * @param bgpTableTypeRegistry BGP TableType Registry
 * @return Afi Safi Operational State
 */
public static AfiSafi buildAfiSafi(final BGPRibState ribState, final TablesKey tablesKey, final BGPTableTypeRegistryConsumer bgpTableTypeRegistry) {
    final Optional<Class<? extends AfiSafiType>> optAfiSafi = bgpTableTypeRegistry.getAfiSafiType(tablesKey);
    if (!optAfiSafi.isPresent()) {
        return null;
    }
    final State state = new StateBuilder().addAugmentation(GlobalAfiSafiStateAugmentation.class, new GlobalAfiSafiStateAugmentationBuilder().setTotalPaths(ribState.getPathCount(tablesKey)).setTotalPrefixes(ribState.getPrefixesCount(tablesKey)).build()).build();
    return new AfiSafiBuilder().setAfiSafiName(optAfiSafi.get()).setState(state).build();
}
Also used : GlobalAfiSafiStateAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.GlobalAfiSafiStateAugmentation) 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) BGPRibState(org.opendaylight.protocol.bgp.rib.spi.state.BGPRibState) State(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.State) StateBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.StateBuilder) AfiSafiType(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.AfiSafiType)

Example 7 with AfiSafiBuilder

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder in project bgpcep by opendaylight.

the class OpenConfigMappingUtilTest method toAddPathCapability.

@Test
public void toAddPathCapability() {
    final List<AfiSafi> families = new ArrayList<>();
    families.add(new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).addAugmentation(NeighborAddPathsConfig.class, new NeighborAddPathsConfigBuilder().setReceive(true).setSendMax(Shorts.checkedCast(ALL_PATHS)).build()).build());
    families.add(new AfiSafiBuilder().setAfiSafiName(IPV6UNICAST.class).addAugmentation(NeighborAddPathsConfig.class, new NeighborAddPathsConfigBuilder().setReceive(false).setSendMax(Shorts.checkedCast(N_PATHS)).build()).build());
    families.add(new AfiSafiBuilder().setAfiSafiName(IPV6LABELLEDUNICAST.class).addAugmentation(NeighborAddPathsConfig.class, new NeighborAddPathsConfigBuilder().setReceive(false).build()).build());
    final List<AddressFamilies> result = OpenConfigMappingUtil.toAddPathCapability(families, this.tableTypeRegistry);
    assertEquals(FAMILIES, result);
}
Also used : AfiSafiBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder) IPV6LABELLEDUNICAST(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV6LABELLEDUNICAST) AddressFamilies(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.add.path.capability.AddressFamilies) 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) ArrayList(java.util.ArrayList) IPV4UNICAST(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4UNICAST) NeighborAddPathsConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAddPathsConfigBuilder) IPV6UNICAST(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV6UNICAST) Test(org.junit.Test)

Example 8 with AfiSafiBuilder

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder 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 9 with AfiSafiBuilder

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder 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)9 AfiSafi (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi)7 Test (org.junit.Test)5 AfiSafisBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder)4 IPV4UNICAST (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4UNICAST)4 NeighborAfiSafiStateAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAfiSafiStateAugmentationBuilder)4 ArrayList (java.util.ArrayList)3 BgpPeerTest.createAfiSafi (org.opendaylight.protocol.bgp.rib.impl.config.BgpPeerTest.createAfiSafi)3 GracefulRestartBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.GracefulRestartBuilder)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 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 IPV6UNICAST (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV6UNICAST)2 GlobalAfiSafiStateAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.GlobalAfiSafiStateAugmentationBuilder)2 NeighborAddPathsConfigBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAddPathsConfigBuilder)2 NeighborAfiSafiGracefulRestartStateAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAfiSafiGracefulRestartStateAugmentationBuilder)2 NeighborAfiSafiStateAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAfiSafiStateAugmentation)2 HashMap (java.util.HashMap)1 PathSelectionMode (org.opendaylight.protocol.bgp.mode.api.PathSelectionMode)1