use of org.onosproject.config.Filter in project onos by opennetworkinglab.
the class DynamicDeviceConfigServiceViewTest method testReadNode.
@Test
public void testReadNode() {
Filter filter = null;
DataNode returned = view.readNode(relIntf, filter);
assertTrue(ResourceIds.isPrefix(rid, realPath));
// FIXME test realFilter
// TODO do we expect something to happen on returned?
}
use of org.onosproject.config.Filter in project onos by opennetworkinglab.
the class DcsBasedTapiDataProducer method getNodes.
/**
* Extract Tapi Nodes from context modelObject and convert them to NodeRefs.
*
* @param context
* @return List of NodeRef
*/
private List<TapiNodeRef> getNodes(DefaultContext context) {
DefaultAugmentedTapiCommonContext topologyContext = context.augmentation(DefaultAugmentedTapiCommonContext.class);
Topology topology = topologyContext.topologyContext().topology().get(0);
if (topology.node() == null) {
return Collections.emptyList();
}
return topology.node().stream().map(node -> {
TapiNodeRef nodeRef = DcsBasedTapiObjectRefFactory.create(topology, node);
if (node.name() != null) {
String deviceId = node.name().stream().filter(kv -> kv.valueName().equals(DEVICE_ID)).findFirst().map(Name::value).get();
nodeRef.setDeviceId(DeviceId.deviceId(deviceId));
}
return nodeRef;
}).collect(Collectors.toList());
}
use of org.onosproject.config.Filter in project onos by opennetworkinglab.
the class RestconfManager method runGetOperationOnDataResource.
@Override
public ObjectNode runGetOperationOnDataResource(URI uri) throws RestconfException {
DataResourceLocator rl = DataResourceLocator.newInstance(uri);
// TODO: define Filter (if there is any requirement).
Filter filter = Filter.builder().build();
DataNode dataNode;
try {
if (!dynamicConfigService.nodeExist(rl.ridForDynConfig())) {
return null;
}
dataNode = dynamicConfigService.readNode(rl.ridForDynConfig(), filter);
} catch (FailedException e) {
log.error("ERROR: DynamicConfigService: ", e);
throw new RestconfException("ERROR: DynamicConfigService", e, RestconfError.ErrorTag.OPERATION_FAILED, INTERNAL_SERVER_ERROR, Optional.of(uri.getPath()));
}
ObjectNode rootNode = convertDataNodeToJson(rl.ridForYangRuntime(), dataNode);
return rootNode;
}
Aggregations