use of org.onosproject.yang.model.InnerNode in project onos by opennetworkinglab.
the class DataNodes method child.
public static Optional<DataNode> child(DataNode node, String name, String namespace) {
if (node instanceof InnerNode) {
InnerNode inode = (InnerNode) node;
NodeKey<?> key = NodeKey.builder().schemaId(name, namespace).build();
return Optional.ofNullable(inode.childNodes().get(key));
} else {
return Optional.empty();
}
}
use of org.onosproject.yang.model.InnerNode in project onos by opennetworkinglab.
the class DataNodes method child.
public static Optional<DataNode> child(DataNode node, SchemaId child) {
if (node instanceof InnerNode) {
InnerNode inode = (InnerNode) node;
NodeKey<?> key = NodeKey.builder().schemaId(child).build();
return Optional.ofNullable(inode.childNodes().get(key));
} else {
return Optional.empty();
}
}
use of org.onosproject.yang.model.InnerNode in project onos by opennetworkinglab.
the class DistributedDynamicConfigStore method traverseInner.
// FIXME this is more like addInnteNode
/**
* @param path pointing to {@code node}
* @param node node
*/
private void traverseInner(String path, InnerNode node) {
log.trace("traverseInner({}, {})", path, node);
addKey(path, node.type());
Map<NodeKey, DataNode> entries = node.childNodes();
if (entries.size() == 0) {
return;
}
// FIXME ignoring results
entries.forEach((k, v) -> {
String tempPath;
tempPath = ResourceIdParser.appendNodeKey(path, v.key());
if (v.type() == DataNode.Type.SINGLE_INSTANCE_LEAF_VALUE_NODE) {
addLeaf(tempPath, (LeafNode) v);
} else if (v.type() == DataNode.Type.MULTI_INSTANCE_LEAF_VALUE_NODE) {
tempPath = ResourceIdParser.appendLeafList(tempPath, (LeafListKey) v.key());
addLeaf(tempPath, (LeafNode) v);
} else if (v.type() == DataNode.Type.SINGLE_INSTANCE_NODE) {
traverseInner(tempPath, (InnerNode) v);
} else if (v.type() == DataNode.Type.MULTI_INSTANCE_NODE) {
tempPath = ResourceIdParser.appendKeyList(tempPath, (ListKey) v.key());
traverseInner(tempPath, (InnerNode) v);
} else {
throw new FailedException("Invalid node type");
}
});
}
Aggregations