use of org.opendaylight.controller.md.sal.dom.broker.spi.rpc.RpcRoutingStrategy in project controller by opendaylight.
the class RpcUtil method decomposeRpcService.
static Collection<SchemaPath> decomposeRpcService(final Class<RpcService> service, final SchemaContext schemaContext, final Predicate<RpcRoutingStrategy> filter) {
final QNameModule moduleName = BindingReflections.getQNameModule(service);
final Module module = schemaContext.findModule(moduleName).get();
LOG.debug("Resolved service {} to module {}", service, module);
final Collection<RpcDefinition> rpcs = module.getRpcs();
final Collection<SchemaPath> ret = new ArrayList<>(rpcs.size());
for (RpcDefinition rpc : rpcs) {
final RpcRoutingStrategy strategy = RpcRoutingStrategy.from(rpc);
if (filter.test(strategy)) {
ret.add(rpc.getPath());
}
}
return ret;
}
use of org.opendaylight.controller.md.sal.dom.broker.spi.rpc.RpcRoutingStrategy in project controller by opendaylight.
the class DOMRpcRoutingTable method createRpcEntry.
private static AbstractDOMRpcRoutingTableEntry createRpcEntry(final SchemaContext context, final SchemaPath key, final Map<YangInstanceIdentifier, List<DOMRpcImplementation>> implementations) {
final RpcDefinition rpcDef = findRpcDefinition(context, key);
if (rpcDef == null) {
return new UnknownDOMRpcRoutingTableEntry(key, implementations);
}
final RpcRoutingStrategy strategy = RpcRoutingStrategy.from(rpcDef);
if (strategy.isContextBasedRouted()) {
return new RoutedDOMRpcRoutingTableEntry(rpcDef, YangInstanceIdentifier.of(strategy.getLeaf()), implementations);
}
return new GlobalDOMRpcRoutingTableEntry(rpcDef, implementations);
}
Aggregations