Search in sources :

Example 11 with ChoiceNode

use of org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode in project bgpcep by opendaylight.

the class LabeledUnicastIpv4RIBSupportTest method testEmptyRoute.

@Test
public void testEmptyRoute() throws Exception {
    final Routes empty = new LabeledUnicastRoutesCaseBuilder().setLabeledUnicastRoutes(new LabeledUnicastRoutesBuilder().setLabeledUnicastRoute(Collections.emptyList()).build()).build();
    final ChoiceNode emptyRoutes = RIB_SUPPORT.emptyRoutes();
    assertEquals(createRoutes(empty), emptyRoutes);
}
Also used : LabeledUnicastRoutesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.labeled.unicast.routes.LabeledUnicastRoutesBuilder) ChoiceNode(org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode) Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.tables.Routes) LabeledUnicastRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.labeled.unicast.routes.LabeledUnicastRoutes) LabeledUnicastRoutesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.bgp.rib.rib.loc.rib.tables.routes.LabeledUnicastRoutesCaseBuilder) AbstractRIBSupportTest(org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest) Test(org.junit.Test)

Example 12 with ChoiceNode

use of org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode in project bgpcep by opendaylight.

the class LabeledUnicastIpv6RIBSupportTest method testEmptyRoute.

@Test
public void testEmptyRoute() {
    final Routes empty = new LabeledUnicastIpv6RoutesCaseBuilder().setLabeledUnicastIpv6Routes(new LabeledUnicastIpv6RoutesBuilder().setLabeledUnicastRoute(Collections.emptyList()).build()).build();
    final ChoiceNode emptyRoutes = RIB_SUPPORT.emptyRoutes();
    assertEquals(createRoutes(empty), emptyRoutes);
}
Also used : LabeledUnicastIpv6RoutesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.labeled.unicast.ipv6.routes.LabeledUnicastIpv6RoutesBuilder) LabeledUnicastIpv6RoutesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.bgp.rib.rib.loc.rib.tables.routes.LabeledUnicastIpv6RoutesCaseBuilder) ChoiceNode(org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode) Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.tables.Routes) LabeledUnicastIpv6Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.labeled.unicast.ipv6.routes.LabeledUnicastIpv6Routes) AbstractRIBSupportTest(org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest) Test(org.junit.Test)

Example 13 with ChoiceNode

use of org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode in project bgpcep by opendaylight.

the class VpnIpv6RIBSupportTest method testEmptyRoute.

@Test
public void testEmptyRoute() {
    final Routes empty = new VpnIpv6RoutesCaseBuilder().setVpnIpv6Routes(new VpnIpv6RoutesBuilder().setVpnRoute(Collections.emptyList()).build()).build();
    final ChoiceNode emptyRoutes = RIB_SUPPORT.emptyRoutes();
    assertEquals(createRoutes(empty), emptyRoutes);
}
Also used : VpnIpv6RoutesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev171207.bgp.rib.rib.loc.rib.tables.routes.VpnIpv6RoutesCaseBuilder) VpnIpv6RoutesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev171207.l3vpn.ipv6.routes.VpnIpv6RoutesBuilder) ChoiceNode(org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode) Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.tables.Routes) VpnIpv6Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev171207.l3vpn.ipv6.routes.VpnIpv6Routes) AbstractRIBSupportTest(org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest) Test(org.junit.Test)

Example 14 with ChoiceNode

use of org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode in project bgpcep by opendaylight.

the class LinkstateNlriParser method extractLinkstateDestination.

public static CLinkstateDestination extractLinkstateDestination(final DataContainerNode<? extends PathArgument> linkstate) {
    final CLinkstateDestinationBuilder builder = new CLinkstateDestinationBuilder();
    serializeCommonParts(builder, linkstate);
    final ChoiceNode objectType = (ChoiceNode) linkstate.getChild(OBJECT_TYPE_NID).get();
    if (objectType.getChild(ADVERTISING_NODE_DESCRIPTORS_NID).isPresent()) {
        serializeAdvertisedNodeDescriptor(builder, objectType);
    } else if (objectType.getChild(LOCAL_NODE_DESCRIPTORS_NID).isPresent()) {
        serializeLocalNodeDescriptor(builder, objectType);
    } else if (objectType.getChild(NODE_DESCRIPTORS_NID).isPresent()) {
        serializeNodeDescriptor(builder, objectType);
    } else if (AbstractTeLspNlriCodec.isTeLsp(objectType)) {
        builder.setObjectType(AbstractTeLspNlriCodec.serializeTeLsp(objectType));
    } else {
        LOG.warn("Unknown Object Type: {}.", objectType);
    }
    return builder.build();
}
Also used : CLinkstateDestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.destination.CLinkstateDestinationBuilder) ChoiceNode(org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode)

Example 15 with ChoiceNode

use of org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode in project bgpcep by opendaylight.

the class RibImplTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    Mockito.doReturn(mock(GeneratedClassLoadingStrategy.class)).when(this.extension).getClassLoadingStrategy();
    Mockito.doReturn(this.ribSupport).when(this.extension).getRIBSupport(any(TablesKey.class));
    final NodeIdentifier nii = new NodeIdentifier(QName.create("", "test").intern());
    Mockito.doReturn(nii).when(this.ribSupport).routeAttributesIdentifier();
    Mockito.doReturn(ImmutableSet.of()).when(this.ribSupport).cacheableAttributeObjects();
    final ChoiceNode choiceNode = mock(ChoiceNode.class);
    Mockito.doReturn(choiceNode).when(this.ribSupport).emptyRoutes();
    Mockito.doReturn(nii).when(choiceNode).getIdentifier();
    Mockito.doReturn(QName.create("", "test").intern()).when(choiceNode).getNodeType();
    Mockito.doReturn(this.domTx).when(this.domDataBroker).createTransactionChain(any());
    final DOMDataTreeChangeService dOMDataTreeChangeService = mock(DOMDataTreeChangeService.class);
    Mockito.doReturn(Collections.singletonMap(DOMDataTreeChangeService.class, dOMDataTreeChangeService)).when(this.domDataBroker).getSupportedExtensions();
    Mockito.doReturn(this.dataTreeRegistration).when(this.domSchemaService).registerSchemaContextListener(any());
    Mockito.doNothing().when(this.dataTreeRegistration).close();
    Mockito.doReturn(mock(ListenerRegistration.class)).when(dOMDataTreeChangeService).registerDataTreeChangeListener(any(), any());
    Mockito.doNothing().when(this.serviceRegistration).unregister();
}
Also used : GeneratedClassLoadingStrategy(org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy) DOMDataTreeChangeService(org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService) TablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey) ListenerRegistration(org.opendaylight.yangtools.concepts.ListenerRegistration) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) ChoiceNode(org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode) Before(org.junit.Before)

Aggregations

ChoiceNode (org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode)34 Test (org.junit.Test)22 AbstractRIBSupportTest (org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest)12 Routes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.tables.Routes)12 NodeIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)11 ContainerNode (org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)9 UnkeyedListEntryNode (org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode)6 EvpnChoice (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.EvpnChoice)5 MapEntryNode (org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode)5 BigInteger (java.math.BigInteger)4 ImmutableLeafNodeBuilder (org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder)4 ByteBuf (io.netty.buffer.ByteBuf)3 LanParserTest (org.opendaylight.protocol.bgp.evpn.impl.esi.types.LanParserTest)3 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)3 QName (org.opendaylight.yangtools.yang.common.QName)3 Before (org.junit.Before)2 DOMDataWriteTransaction (org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction)2 EsRouteBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.es.route.EsRouteBuilder)2 EsRouteCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.evpn.choice.EsRouteCase)2 EsRouteCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.evpn.choice.EsRouteCaseBuilder)2