本文整理汇总了Java中org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild类的典型用法代码示例。如果您正苦于以下问题:Java DataContainerChild类的具体用法?Java DataContainerChild怎么用?Java DataContainerChild使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataContainerChild类属于org.opendaylight.yangtools.yang.data.api.schema包,在下文中一共展示了DataContainerChild类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: notifyAllListeners
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; //导入依赖的package包/类
private void notifyAllListeners() {
searchForEntities((entityTypeNode, entityNode) -> {
Optional<DataContainerChild<?, ?>> possibleType = entityTypeNode.getChild(ENTITY_TYPE_NODE_ID);
if (possibleType.isPresent()) {
final boolean hasOwner;
final boolean isOwner;
Optional<DataContainerChild<?, ?>> possibleOwner = entityNode.getChild(ENTITY_OWNER_NODE_ID);
if (possibleOwner.isPresent()) {
isOwner = localMemberName.getName().equals(possibleOwner.get().getValue().toString());
hasOwner = true;
} else {
isOwner = false;
hasOwner = false;
}
DOMEntity entity = new DOMEntity(possibleType.get().getValue().toString(),
(YangInstanceIdentifier) entityNode.getChild(ENTITY_ID_NODE_ID).get().getValue());
listenerSupport.notifyEntityOwnershipListeners(entity, isOwner, isOwner, hasOwner);
}
});
}
示例2: searchForEntities
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; //导入依赖的package包/类
private void searchForEntities(final EntityWalker walker) {
Optional<NormalizedNode<?, ?>> possibleEntityTypes = getDataStore().readNode(ENTITY_TYPES_PATH);
if (!possibleEntityTypes.isPresent()) {
return;
}
for (MapEntryNode entityType: ((MapNode) possibleEntityTypes.get()).getValue()) {
Optional<DataContainerChild<?, ?>> possibleEntities = entityType.getChild(ENTITY_NODE_ID);
if (!possibleEntities.isPresent()) {
// shouldn't happen but handle anyway
continue;
}
for (MapEntryNode entity: ((MapNode) possibleEntities.get()).getValue()) {
walker.onEntity(entityType, entity);
}
}
}
示例3: getMapEntryNodeChild
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; //导入依赖的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;
}
示例4: testMergeWithInvalidChildNodeNames
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; //导入依赖的package包/类
@Test
public void testMergeWithInvalidChildNodeNames() throws DataValidationFailedException {
ContainerNode augContainer = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
new YangInstanceIdentifier.NodeIdentifier(AUG_CONTAINER)).withChild(
ImmutableNodes.containerNode(AUG_INNER_CONTAINER)).build();
DataContainerChild<?, ?> outerNode = outerNode(outerNodeEntry(1, innerNode("one", "two")));
ContainerNode normalizedNode = ImmutableContainerNodeBuilder.create()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME)).withChild(outerNode)
.withChild(augContainer).withChild(ImmutableNodes.leafNode(AUG_QNAME, "aug")).build();
YangInstanceIdentifier path = TestModel.TEST_PATH;
pruningDataTreeModification.merge(path, normalizedNode);
dataTree.commit(getCandidate());
ContainerNode prunedNode = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME)).withChild(outerNode).build();
Optional<NormalizedNode<?, ?>> actual = dataTree.takeSnapshot().readNode(path);
assertEquals("After pruning present", true, actual.isPresent());
assertEquals("After pruning", prunedNode, actual.get());
}
示例5: testWriteWithInvalidChildNodeNames
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; //导入依赖的package包/类
@Test
public void testWriteWithInvalidChildNodeNames() throws DataValidationFailedException {
ContainerNode augContainer = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
new YangInstanceIdentifier.NodeIdentifier(AUG_CONTAINER)).withChild(
ImmutableNodes.containerNode(AUG_INNER_CONTAINER)).build();
DataContainerChild<?, ?> outerNode = outerNode(outerNodeEntry(1, innerNode("one", "two")));
ContainerNode normalizedNode = ImmutableContainerNodeBuilder.create()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME)).withChild(outerNode)
.withChild(augContainer).withChild(ImmutableNodes.leafNode(AUG_QNAME, "aug"))
.withChild(ImmutableNodes.leafNode(NAME_QNAME, "name")).build();
YangInstanceIdentifier path = TestModel.TEST_PATH;
pruningDataTreeModification.write(path, normalizedNode);
dataTree.commit(getCandidate());
ContainerNode prunedNode = ImmutableContainerNodeBuilder.create()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME)).withChild(outerNode)
.withChild(ImmutableNodes.leafNode(NAME_QNAME, "name")).build();
Optional<NormalizedNode<?, ?>> actual = dataTree.takeSnapshot().readNode(path);
assertEquals("After pruning present", true, actual.isPresent());
assertEquals("After pruning", prunedNode, actual.get());
}
示例6: navigateDataContainerNode
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; //导入依赖的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);
}
}
}
示例7: createProtocolsIps
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; //导入依赖的package包/类
private static List<ProtocolIps> createProtocolsIps(final UnkeyedListNode protocolIpsData) {
final List<ProtocolIps> protocolIps = new ArrayList<>();
for (final UnkeyedListEntryNode node : protocolIpsData.getValue()) {
final ProtocolIpsBuilder ipsBuilder = new ProtocolIpsBuilder();
final Optional<DataContainerChild<? extends PathArgument, ?>> opValue = node.getChild(AbstractFlowspecNlriParser.OP_NID);
if (opValue.isPresent()) {
ipsBuilder.setOp(NumericOneByteOperandParser.INSTANCE.create((Set<String>) opValue.get().getValue()));
}
final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode = node.getChild(AbstractFlowspecNlriParser.VALUE_NID);
if (valueNode.isPresent()) {
ipsBuilder.setValue((Short) valueNode.get().getValue());
}
protocolIps.add(ipsBuilder.build());
}
return protocolIps;
}
示例8: extractFlowspec
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; //导入依赖的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;
}
示例9: createPorts
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; //导入依赖的package包/类
private static List<Ports> createPorts(final UnkeyedListNode portsData) {
final List<Ports> ports = new ArrayList<>();
for (final UnkeyedListEntryNode node : portsData.getValue()) {
final PortsBuilder portsBuilder = new PortsBuilder();
final Optional<DataContainerChild<? extends PathArgument, ?>> opValue = node.getChild(OP_NID);
if (opValue.isPresent()) {
portsBuilder.setOp(NumericTwoByteOperandParser.INSTANCE.create((Set<String>) opValue.get().getValue()));
}
final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode = node.getChild(VALUE_NID);
if (valueNode.isPresent()) {
portsBuilder.setValue((Integer) valueNode.get().getValue());
}
ports.add(portsBuilder.build());
}
return ports;
}
示例10: createDestinationPorts
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; //导入依赖的package包/类
private static List<DestinationPorts> createDestinationPorts(final UnkeyedListNode destinationPortsData) {
final List<DestinationPorts> destinationPorts = new ArrayList<>();
for (final UnkeyedListEntryNode node : destinationPortsData.getValue()) {
final DestinationPortsBuilder destPortsBuilder = new DestinationPortsBuilder();
final Optional<DataContainerChild<? extends PathArgument, ?>> opValue = node.getChild(OP_NID);
if (opValue.isPresent()) {
destPortsBuilder.setOp(NumericTwoByteOperandParser.INSTANCE.create((Set<String>) opValue.get().getValue()));
}
final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode = node.getChild(VALUE_NID);
if (valueNode.isPresent()) {
destPortsBuilder.setValue((Integer) valueNode.get().getValue());
}
destinationPorts.add(destPortsBuilder.build());
}
return destinationPorts;
}
示例11: createSourcePorts
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; //导入依赖的package包/类
private static List<SourcePorts> createSourcePorts(final UnkeyedListNode sourcePortsData) {
final List<SourcePorts> sourcePorts = new ArrayList<>();
for (final UnkeyedListEntryNode node : sourcePortsData.getValue()) {
final SourcePortsBuilder sourcePortsBuilder = new SourcePortsBuilder();
final Optional<DataContainerChild<? extends PathArgument, ?>> opValue = node.getChild(OP_NID);
if (opValue.isPresent()) {
sourcePortsBuilder.setOp(NumericTwoByteOperandParser.INSTANCE.create((Set<String>) opValue.get().getValue()));
}
final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode = node.getChild(VALUE_NID);
if (valueNode.isPresent()) {
sourcePortsBuilder.setValue((Integer) valueNode.get().getValue());
}
sourcePorts.add(sourcePortsBuilder.build());
}
return sourcePorts;
}
示例12: createTypes
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; //导入依赖的package包/类
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;
}
示例13: createCodes
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; //导入依赖的package包/类
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;
}
示例14: createTcpFlags
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; //导入依赖的package包/类
private static List<TcpFlags> createTcpFlags(final UnkeyedListNode tcpFlagsData) {
final List<TcpFlags> tcpFlags = new ArrayList<>();
for (final UnkeyedListEntryNode node : tcpFlagsData.getValue()) {
final TcpFlagsBuilder tcpFlagsBuilder = new TcpFlagsBuilder();
final Optional<DataContainerChild<? extends PathArgument, ?>> opValue = node.getChild(OP_NID);
if (opValue.isPresent()) {
tcpFlagsBuilder.setOp(BitmaskOperandParser.INSTANCE.create((Set<String>) opValue.get().getValue()));
}
final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode = node.getChild(VALUE_NID);
if (valueNode.isPresent()) {
tcpFlagsBuilder.setValue((Integer) valueNode.get().getValue());
}
tcpFlags.add(tcpFlagsBuilder.build());
}
return tcpFlags;
}
示例15: createDscpsLengths
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; //导入依赖的package包/类
private static List<Dscps> createDscpsLengths(final UnkeyedListNode dscpLengthsData) {
final List<Dscps> dscpsLengths = new ArrayList<>();
for (final UnkeyedListEntryNode node : dscpLengthsData.getValue()) {
final DscpsBuilder dscpsLengthsBuilder = new DscpsBuilder();
final Optional<DataContainerChild<? extends PathArgument, ?>> opValue = node.getChild(OP_NID);
if (opValue.isPresent()) {
dscpsLengthsBuilder.setOp(NumericOneByteOperandParser.INSTANCE.create((Set<String>) opValue.get().getValue()));
}
final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode = node.getChild(VALUE_NID);
if (valueNode.isPresent()) {
dscpsLengthsBuilder.setValue(new Dscp((Short) valueNode.get().getValue()));
}
dscpsLengths.add(dscpsLengthsBuilder.build());
}
return dscpsLengths;
}