Search in sources :

Example 41 with PathArgument

use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument in project bgpcep by opendaylight.

the class AbstractFlowspecNlriParser method createPacketLengths.

private static List<PacketLengths> createPacketLengths(final UnkeyedListNode packetLengthsData) {
    final List<PacketLengths> packetLengths = new ArrayList<>();
    for (final UnkeyedListEntryNode node : packetLengthsData.getValue()) {
        final PacketLengthsBuilder packetLengthsBuilder = new PacketLengthsBuilder();
        final Optional<DataContainerChild<? extends PathArgument, ?>> opValue = node.getChild(OP_NID);
        if (opValue.isPresent()) {
            packetLengthsBuilder.setOp(NumericTwoByteOperandParser.INSTANCE.create((Set<String>) opValue.get().getValue()));
        }
        final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode = node.getChild(VALUE_NID);
        if (valueNode.isPresent()) {
            packetLengthsBuilder.setValue((Integer) valueNode.get().getValue());
        }
        packetLengths.add(packetLengthsBuilder.build());
    }
    return packetLengths;
}
Also used : Set(java.util.Set) DataContainerChild(org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild) ArrayList(java.util.ArrayList) UnkeyedListEntryNode(org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode) PacketLengthsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.packet.length._case.PacketLengthsBuilder) PacketLengths(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.packet.length._case.PacketLengths) PathArgument(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument)

Example 42 with PathArgument

use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument in project bgpcep by opendaylight.

the class AbstractFlowspecNlriParser method createCodes.

private static List<Codes> createCodes(final UnkeyedListNode codesData) {
    final List<Codes> codes = new ArrayList<>();
    for (final UnkeyedListEntryNode node : codesData.getValue()) {
        final CodesBuilder codesBuilder = new CodesBuilder();
        final Optional<DataContainerChild<? extends PathArgument, ?>> opValue = node.getChild(OP_NID);
        if (opValue.isPresent()) {
            codesBuilder.setOp(NumericOneByteOperandParser.INSTANCE.create((Set<String>) opValue.get().getValue()));
        }
        final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode = node.getChild(VALUE_NID);
        if (valueNode.isPresent()) {
            codesBuilder.setValue((Short) valueNode.get().getValue());
        }
        codes.add(codesBuilder.build());
    }
    return codes;
}
Also used : Codes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.icmp.code._case.Codes) Set(java.util.Set) DataContainerChild(org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild) ArrayList(java.util.ArrayList) UnkeyedListEntryNode(org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode) PathArgument(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument) CodesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.icmp.code._case.CodesBuilder)

Example 43 with PathArgument

use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument in project bgpcep by opendaylight.

the class AbstractFlowspecNlriParser method createFragments.

private static List<Fragments> createFragments(final UnkeyedListNode fragmentsData) {
    final List<Fragments> fragments = new ArrayList<>();
    for (final UnkeyedListEntryNode node : fragmentsData.getValue()) {
        final FragmentsBuilder fragmentsBuilder = new FragmentsBuilder();
        final Optional<DataContainerChild<? extends PathArgument, ?>> opValue = node.getChild(OP_NID);
        if (opValue.isPresent()) {
            fragmentsBuilder.setOp(BitmaskOperandParser.INSTANCE.create((Set<String>) opValue.get().getValue()));
        }
        final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode = node.getChild(VALUE_NID);
        if (valueNode.isPresent()) {
            fragmentsBuilder.setValue(createFragment((Set<String>) valueNode.get().getValue()));
        }
        fragments.add(fragmentsBuilder.build());
    }
    return fragments;
}
Also used : FragmentsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.fragment._case.FragmentsBuilder) Set(java.util.Set) DataContainerChild(org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild) Fragments(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.fragment._case.Fragments) ArrayList(java.util.ArrayList) UnkeyedListEntryNode(org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode) PathArgument(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument)

Example 44 with PathArgument

use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument in project bgpcep by opendaylight.

the class AbstractFlowspecNlriParser method createTypes.

private static List<Types> createTypes(final UnkeyedListNode typesData) {
    final List<Types> types = new ArrayList<>();
    for (final UnkeyedListEntryNode node : typesData.getValue()) {
        final TypesBuilder typesBuilder = new TypesBuilder();
        final Optional<DataContainerChild<? extends PathArgument, ?>> opValue = node.getChild(OP_NID);
        if (opValue.isPresent()) {
            typesBuilder.setOp(NumericOneByteOperandParser.INSTANCE.create((Set<String>) opValue.get().getValue()));
        }
        final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode = node.getChild(VALUE_NID);
        if (valueNode.isPresent()) {
            typesBuilder.setValue((Short) valueNode.get().getValue());
        }
        types.add(typesBuilder.build());
    }
    return types;
}
Also used : Types(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types) Set(java.util.Set) TypesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.icmp.type._case.TypesBuilder) DataContainerChild(org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild) ArrayList(java.util.ArrayList) UnkeyedListEntryNode(org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode) PathArgument(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument)

Example 45 with PathArgument

use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument in project bgpcep by opendaylight.

the class AbstractFlowspecRIBSupport method processDestination.

@Override
protected final void processDestination(final DOMDataWriteTransaction tx, final YangInstanceIdentifier routesPath, final ContainerNode destination, final ContainerNode attributes, final ApplyRoute function) {
    if (destination != null) {
        final YangInstanceIdentifier base = routesPath.node(routesContainerIdentifier()).node(routeQName());
        final Optional<DataContainerChild<? extends PathArgument, ?>> maybePathIdLeaf = destination.getChild(routePathIdNid());
        final String routeKeyValue = this.nlriParser.stringNlri(destination);
        final NodeIdentifierWithPredicates routeKey = PathIdUtil.createNidKey(routeQName(), routeKeyQName(), pathIdQName(), routeKeyValue, maybePathIdLeaf);
        function.apply(tx, base, routeKey, destination, attributes);
    }
}
Also used : DataContainerChild(org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild) PathArgument(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument) NodeIdentifierWithPredicates(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)

Aggregations

PathArgument (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument)55 DataContainerChild (org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild)31 UnkeyedListEntryNode (org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode)18 ArrayList (java.util.ArrayList)17 Set (java.util.Set)12 YangInstanceIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)11 NodeIdentifierWithPredicates (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates)11 UnkeyedListNode (org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode)6 NormalizedNode (org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode)5 MapEntryNode (org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode)4 Test (org.junit.Test)3 AbstractDataTreeModificationCursor (org.opendaylight.controller.cluster.datastore.util.AbstractDataTreeModificationCursor)3 DataNormalizationException (org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException)3 ContainerNode (org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)3 DataTreeCandidate (org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate)3 DataTreeCandidateNode (org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode)3 DataTreeModification (org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification)3 ImmutableList (com.google.common.collect.ImmutableList)2 TransactionDelete (org.opendaylight.controller.cluster.access.commands.TransactionDelete)2 TransactionMerge (org.opendaylight.controller.cluster.access.commands.TransactionMerge)2