use of org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild 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;
}
use of org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild 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;
}
use of org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild 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;
}
use of org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild 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;
}
use of org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild 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);
}
}
Aggregations