本文整理汇总了Java中org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode类的典型用法代码示例。如果您正苦于以下问题:Java DataContainerNode类的具体用法?Java DataContainerNode怎么用?Java DataContainerNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataContainerNode类属于org.opendaylight.yangtools.yang.data.api.schema包,在下文中一共展示了DataContainerNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getMapEntryNodeChild
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
protected MapEntryNode getMapEntryNodeChild(DataContainerNode<? extends PathArgument> parent, QName childMap,
QName child, Object key, boolean expectPresent) {
Optional<DataContainerChild<? extends PathArgument, ?>> childNode =
parent.getChild(new NodeIdentifier(childMap));
assertEquals("Missing " + childMap.toString(), true, childNode.isPresent());
MapNode entityTypeMapNode = (MapNode) childNode.get();
Optional<MapEntryNode> entityTypeEntry = entityTypeMapNode.getChild(new NodeIdentifierWithPredicates(
childMap, child, key));
if (expectPresent && !entityTypeEntry.isPresent()) {
fail("Missing " + childMap.toString() + " entry for " + key + ". Actual: " + entityTypeMapNode.getValue());
} else if (!expectPresent && entityTypeEntry.isPresent()) {
fail("Found unexpected " + childMap.toString() + " entry for " + key);
}
return entityTypeEntry.isPresent() ? entityTypeEntry.get() : null;
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:AbstractEntityOwnershipTest.java
示例2: navigateDataContainerNode
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
private void navigateDataContainerNode(int level, final String parentPath,
final DataContainerNode<?> dataContainerNode) {
visitor.visitNode(level, parentPath, dataContainerNode);
String newParentPath = parentPath + "/" + dataContainerNode.getIdentifier().toString();
final Iterable<DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> value = dataContainerNode
.getValue();
for (NormalizedNode<?, ?> node : value) {
if (node instanceof MixinNode && node instanceof NormalizedNodeContainer) {
navigateNormalizedNodeContainerMixin(level, newParentPath, (NormalizedNodeContainer<?, ?, ?>) node);
} else {
navigateNormalizedNode(level, newParentPath, node);
}
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:NormalizedNodeNavigator.java
示例3: extractFlowspec
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
public final List<Flowspec> extractFlowspec(final DataContainerNode<?> route) {
requireNonNull(route, "Cannot extract flowspec from null route.");
final List<Flowspec> fsList = new ArrayList<>();
final Optional<DataContainerChild<? extends PathArgument, ?>> flowspecs = route.getChild(FLOWSPEC_NID);
if (flowspecs.isPresent()) {
for (final UnkeyedListEntryNode flowspec : ((UnkeyedListNode) flowspecs.get()).getValue()) {
final FlowspecBuilder fsBuilder = new FlowspecBuilder();
final Optional<DataContainerChild<?, ?>> flowspecType = flowspec.getChild(FLOWSPEC_TYPE_NID);
if (flowspecType.isPresent()) {
final ChoiceNode fsType = (ChoiceNode) flowspecType.get();
processFlowspecType(fsType, fsBuilder);
}
fsList.add(fsBuilder.build());
}
}
return fsList;
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:18,代码来源:AbstractFlowspecNlriParser.java
示例4: apply
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
@Override
public void apply(final DOMDataWriteTransaction tx, final YangInstanceIdentifier base,
final NodeIdentifierWithPredicates routeKey, final DataContainerNode<?> route,
final ContainerNode attributes) {
// Build the DataContainer data
final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> b =
ImmutableNodes.mapEntryBuilder();
b.withNodeIdentifier(routeKey);
route.getValue().forEach(b::withChild);
// Add attributes
final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> cb =
Builders.containerBuilder(attributes);
cb.withNodeIdentifier(routeAttributesIdentifier());
b.withChild(cb.build());
tx.put(LogicalDatastoreType.OPERATIONAL, base.node(routeKey), b.build());
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:18,代码来源:AbstractRIBSupport.java
示例5: extractLinkstateDestination
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
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();
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:19,代码来源:LinkstateNlriParser.java
示例6: serializeCommonParts
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
private static void serializeCommonParts(final CLinkstateDestinationBuilder builder, final DataContainerNode<? extends PathArgument> linkstate) {
// serialize common parts
final Optional<DataContainerChild<? extends PathArgument, ?>> distinguisher = linkstate.getChild(DISTINGUISHER_NID);
if (distinguisher.isPresent()) {
builder.setDistinguisher(new RouteDistinguisher((BigInteger) distinguisher.get().getValue()));
}
final Optional<DataContainerChild<? extends PathArgument, ?>> protocolId = linkstate.getChild(PROTOCOL_ID_NID);
// DOM representation contains values as are in the model, not as are in generated enum
if (protocolId.isPresent()) {
builder.setProtocolId(ProtocolId.forValue(domProtocolIdValue((String) protocolId.get().getValue())));
}
final Optional<DataContainerChild<? extends PathArgument, ?>> identifier = linkstate.getChild(IDENTIFIER_NID);
if (identifier.isPresent()) {
builder.setIdentifier(new Identifier((BigInteger) identifier.get().getValue()));
}
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:17,代码来源:LinkstateNlriParser.java
示例7: extractLabel
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
public static List<LabelStack> extractLabel(final DataContainerNode<? extends PathArgument> route, final NodeIdentifier labelStackNid,
final NodeIdentifier labelValueNid) {
final List<LabelStack> labels = new ArrayList<>();
final Optional<DataContainerChild<? extends PathArgument, ?>> labelStacks = route.getChild(labelStackNid);
if (labelStacks.isPresent()) {
for (final UnkeyedListEntryNode label : ((UnkeyedListNode) labelStacks.get()).getValue()) {
final Optional<DataContainerChild<? extends PathArgument, ?>> labelStack = label.getChild(labelValueNid);
if (labelStack.isPresent()) {
final LabelStackBuilder labelStackbuilder = new LabelStackBuilder();
labelStackbuilder.setLabelValue(new MplsLabel((Long) labelStack.get().getValue()));
labels.add(labelStackbuilder.build());
}
}
}
return labels;
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:17,代码来源:AbstractLabeledUnicastRIBSupport.java
示例8: navigateNormalizedNode
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
private void navigateNormalizedNode(int level, String parentPath, NormalizedNode<?, ?> normalizedNode) {
if (normalizedNode instanceof DataContainerNode) {
final DataContainerNode<?> dataContainerNode = (DataContainerNode<?>) normalizedNode;
navigateDataContainerNode(level + 1, parentPath, dataContainerNode);
} else {
visitor.visitNode(level + 1, parentPath, normalizedNode);
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:11,代码来源:NormalizedNodeNavigator.java
示例9: canCommit
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
@Override
public CheckedFuture<PostCanCommitStep, DataValidationFailedException> canCommit(final Object txId,
final DOMDataTreeCandidate candidate, final SchemaContext ctx) {
// Simple data validation - verify the year, if present, is >= 1990
final DataTreeCandidateNode rootNode = candidate.getRootNode();
final Optional<NormalizedNode<?, ?>> dataAfter = rootNode.getDataAfter();
LOG.info("In canCommit: modificationType: {}, dataBefore: {}, dataAfter: {}", rootNode.getModificationType(),
rootNode.getDataBefore(), dataAfter);
// Note: we don't want to process DELETE modifications but we don't need to explicitly check the
// ModificationType because dataAfter will not be present. Also dataAfter *should* always contain a
// MapEntryNode but we verify anyway.
if (dataAfter.isPresent()) {
final NormalizedNode<?, ?> normalizedNode = dataAfter.get();
Verify.verify(normalizedNode instanceof DataContainerNode, "Expected type DataContainerNode, actual was %s",
normalizedNode.getClass());
DataContainerNode<?> entryNode = (DataContainerNode<?>) normalizedNode;
final Optional<DataContainerChild<? extends PathArgument, ?>> possibleYear =
entryNode.getChild(YEAR_NODE_ID);
if (possibleYear.isPresent()) {
final Number year = (Number) possibleYear.get().getValue();
LOG.info("year is {}", year);
if (!(year.longValue() >= 1990)) {
return Futures.immediateFailedCheckedFuture(new DataValidationFailedException(
DOMDataTreeIdentifier.class, candidate.getRootPath(),
String.format("Invalid year %d - year must be >= 1990", year)));
}
}
}
// Return the noop PostCanCommitStep as we're only validating input data and not participating in the
// remaining 3PC stages (pre-commit and commit).
return PostCanCommitStep.NOOP_SUCCESS_FUTURE;
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:40,代码来源:CarEntryDataTreeCommitCohort.java
示例10: extractRouteDistinguisher
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
public static RouteDistinguisher extractRouteDistinguisher(final DataContainerNode<?> route,
final NodeIdentifier rdNid) {
final NormalizedNode<?, ?> rdNode = NormalizedNodes.findNode(route, rdNid).orElse(null);
if (rdNode != null) {
return parseRouteDistinguisher(rdNode.getValue());
}
return null;
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:9,代码来源:RouteDistinguisherUtil.java
示例11: stringNlri
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
@Override
public String stringNlri(final DataContainerNode<?> flowspec) {
final StringBuilder buffer = new StringBuilder();
final RouteDistinguisher rd = extractRouteDistinguisher(flowspec, RD_NID);
if (rd != null) {
buffer.append("[l3vpn with route-distinguisher ").append(rd.getValue()).append("] ");
}
buffer.append(super.stringNlri(flowspec));
return buffer.toString();
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:11,代码来源:AbstractFlowspecL3vpnNlriParser.java
示例12: extractCLabeledUnicastDestination
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
/**
* Conversion from DataContainer to LabeledUnicastDestination Object
*
* @param route DataContainer
* @return LabeledUnicastDestination Object
*/
private CLabeledUnicastDestination extractCLabeledUnicastDestination(final DataContainerNode<? extends PathArgument> route) {
final CLabeledUnicastDestinationBuilder builder = new CLabeledUnicastDestinationBuilder();
builder.setPrefix(extractPrefix(route, PREFIX_TYPE_NID));
builder.setLabelStack(extractLabel(route, LABEL_STACK_NID, LV_NID));
builder.setPathId(PathIdUtil.buildPathId(route, routePathIdNid()));
return builder.build();
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:14,代码来源:AbstractLabeledUnicastRIBSupport.java
示例13: extractPrefix
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
@Override
public IpPrefix extractPrefix(final DataContainerNode<? extends PathArgument> route, final NodeIdentifier prefixTypeNid) {
if (route.getChild(prefixTypeNid).isPresent()) {
final String prefixType = (String) route.getChild(prefixTypeNid).get().getValue();
return new IpPrefix(new Ipv4Prefix(prefixType));
}
return null;
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:9,代码来源:LabeledUnicastIpv4RIBSupport.java
示例14: extractPrefix
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
@Override
protected IpPrefix extractPrefix(final DataContainerNode<? extends YangInstanceIdentifier.PathArgument> route, final YangInstanceIdentifier.NodeIdentifier prefixTypeNid) {
if (route.getChild(prefixTypeNid).isPresent()) {
final String prefixType = (String) route.getChild(prefixTypeNid).get().getValue();
return new IpPrefix(new Ipv6Prefix(prefixType));
}
return null;
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:9,代码来源:LabeledUnicastIpv6RIBSupport.java
示例15: extractMplsLabel
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
static MplsLabel extractMplsLabel(final DataContainerNode<? extends PathArgument> evpn,
final NodeIdentifier mplsNid) {
if (evpn.getChild(mplsNid).isPresent()) {
return new MplsLabel((Long) evpn.getChild(mplsNid).get().getValue());
}
return null;
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:8,代码来源:NlriModelUtil.java
示例16: extractDestination
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
private static EvpnDestination extractDestination(final DataContainerNode<? extends PathArgument> evpnChoice,
final ExtractionInterface extract) {
final EvpnRegistry reg = SimpleEvpnNlriRegistry.getInstance();
final ChoiceNode cont = (ChoiceNode) evpnChoice.getChild(EVPN_CHOICE_NID).get();
final EvpnChoice evpnValue = extract.check(reg, cont);
if (evpnValue == null) {
LOG.warn("Unrecognized Nlri {}", cont);
return null;
}
return new EvpnDestinationBuilder().setRouteDistinguisher(extractRouteDistinguisher(evpnChoice))
.setEvpnChoice(evpnValue).build();
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:13,代码来源:EvpnNlriParser.java
示例17: extractPrefix
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
@Override
protected IpPrefix extractPrefix(final DataContainerNode<? extends YangInstanceIdentifier.PathArgument> route,
final YangInstanceIdentifier.NodeIdentifier prefixTypeNid) {
if (route.getChild(prefixTypeNid).isPresent()) {
final String prefixType = (String) route.getChild(prefixTypeNid).get().getValue();
return new IpPrefix(new Ipv4Prefix(prefixType));
}
return null;
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:10,代码来源:VpnIpv4RIBSupport.java
示例18: extractVpnDestination
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
private VpnDestination extractVpnDestination(final DataContainerNode<? extends PathArgument> route) {
final VpnDestination dst = new VpnDestinationBuilder()
.setPrefix(extractPrefix(route, this.prefixTypeNid))
.setLabelStack(LabeledUnicastIpv4RIBSupport.extractLabel(route, this.labelStackNid, this.lvNid))
.setRouteDistinguisher(extractRouteDistinguisher(route))
.build();
return dst;
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:9,代码来源:AbstractVpnRIBSupport.java
示例19: extractRouteDistinguisher
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
private RouteDistinguisher extractRouteDistinguisher(
final DataContainerNode<? extends YangInstanceIdentifier.PathArgument> route) {
if (route.getChild(this.rdNid).isPresent()) {
return RouteDistinguisherBuilder.getDefaultInstance((String) route.getChild(this.rdNid).get().getValue());
}
return null;
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:8,代码来源:AbstractVpnRIBSupport.java
示例20: extractPrefix
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; //导入依赖的package包/类
@Override
protected IpPrefix extractPrefix(final DataContainerNode<? extends YangInstanceIdentifier.PathArgument> route,
final YangInstanceIdentifier.NodeIdentifier prefixTypeNid) {
if (route.getChild(prefixTypeNid).isPresent()) {
final String prefixType = (String) route.getChild(prefixTypeNid).get().getValue();
return new IpPrefix(new Ipv6Prefix(prefixType));
}
return null;
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:10,代码来源:VpnIpv6RIBSupport.java
注:本文中的org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论