use of org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode 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.UnkeyedListEntryNode 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.UnkeyedListEntryNode 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.UnkeyedListEntryNode 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.UnkeyedListEntryNode in project bgpcep by opendaylight.
the class EvpnRibSupport method processDestination.
@Override
protected void processDestination(final DOMDataWriteTransaction tx, final YangInstanceIdentifier routesPath, final ContainerNode destination, final ContainerNode attributes, final ApplyRoute function) {
if (destination != null) {
final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRoutes = destination.getChild(NLRI_ROUTES_LIST);
if (maybeRoutes.isPresent()) {
final DataContainerChild<? extends PathArgument, ?> routes = maybeRoutes.get();
if (routes instanceof UnkeyedListNode) {
final YangInstanceIdentifier base = routesPath.node(routesContainerIdentifier()).node(routeNid());
for (final UnkeyedListEntryNode e : ((UnkeyedListNode) routes).getValue()) {
final NodeIdentifierWithPredicates routeKey = createRouteKey(e);
function.apply(tx, base, routeKey, e, attributes);
}
} else {
LOG.warn("Routes {} are not a map", routes);
}
}
}
}
Aggregations