use of org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild 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);
}
}
}
}
use of org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild in project bgpcep by opendaylight.
the class FlowspecIpv6NlriParserHelper method createNextHeaders.
private static List<NextHeaders> createNextHeaders(final UnkeyedListNode nextHeadersData) {
final List<NextHeaders> nextHeaders = new ArrayList<>();
for (final UnkeyedListEntryNode node : nextHeadersData.getValue()) {
final NextHeadersBuilder nextHeadersBuilder = new NextHeadersBuilder();
final Optional<DataContainerChild<? extends PathArgument, ?>> opValue = node.getChild(AbstractFlowspecNlriParser.OP_NID);
if (opValue.isPresent()) {
nextHeadersBuilder.setOp(NumericOneByteOperandParser.INSTANCE.create((Set<String>) opValue.get().getValue()));
}
final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode = node.getChild(AbstractFlowspecNlriParser.VALUE_NID);
if (valueNode.isPresent()) {
nextHeadersBuilder.setValue((Short) valueNode.get().getValue());
}
nextHeaders.add(nextHeadersBuilder.build());
}
return nextHeaders;
}
use of org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild in project bgpcep by opendaylight.
the class FlowspecIpv6NlriParserHelper method createFlowLabels.
private static List<FlowLabel> createFlowLabels(final UnkeyedListNode flowLabelsData) {
final List<FlowLabel> flowLabels = new ArrayList<>();
for (final UnkeyedListEntryNode node : flowLabelsData.getValue()) {
final FlowLabelBuilder flowLabelsBuilder = new FlowLabelBuilder();
final Optional<DataContainerChild<? extends PathArgument, ?>> opValue = node.getChild(AbstractFlowspecNlriParser.OP_NID);
if (opValue.isPresent()) {
flowLabelsBuilder.setOp(NumericOneByteOperandParser.INSTANCE.create((Set<String>) opValue.get().getValue()));
}
final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode = node.getChild(AbstractFlowspecNlriParser.VALUE_NID);
if (valueNode.isPresent()) {
flowLabelsBuilder.setValue((Long) valueNode.get().getValue());
}
flowLabels.add(flowLabelsBuilder.build());
}
return flowLabels;
}
use of org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild in project bgpcep by opendaylight.
the class AbstractIPRibSupport method createRouteKey.
/**
* Prefix and Path Id are the route key.
*
* @param prefixes UnkeyedListEntryNode containing route
* @return Nid with Route Key
*/
private NodeIdentifierWithPredicates createRouteKey(final UnkeyedListEntryNode prefixes) {
final Optional<DataContainerChild<? extends PathArgument, ?>> maybePrefixLeaf = prefixes.getChild(routePrefixIdentifier());
final Optional<DataContainerChild<? extends PathArgument, ?>> maybePathIdLeaf = prefixes.getChild(routePathIdNid());
Preconditions.checkState(maybePrefixLeaf.isPresent());
final Object prefixValue = maybePrefixLeaf.get().getValue();
return PathIdUtil.createNidKey(routeQName(), routeKeyQName(), pathIdQName(), prefixValue, maybePathIdLeaf);
}
use of org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild in project bgpcep by opendaylight.
the class AbstractIPRibSupport 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(this.nlriRoutesList);
if (maybeRoutes.isPresent()) {
final DataContainerChild<? extends PathArgument, ?> routes = maybeRoutes.get();
if (routes instanceof UnkeyedListNode) {
// Instance identifier to table/(choice routes)/(map of route)
// FIXME: cache on per-table basis (in TableContext, for example)
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