use of org.opendaylight.yangtools.yang.model.api.RpcDefinition in project controller by opendaylight.
the class BindingToNormalizedNodeCodec method getRpcMethodToSchemaPath.
// FIXME: This should be probably part of Binding Runtime context
public ImmutableBiMap<Method, SchemaPath> getRpcMethodToSchemaPath(final Class<? extends RpcService> key) {
final Module module = getModuleBlocking(key);
final ImmutableBiMap.Builder<Method, SchemaPath> ret = ImmutableBiMap.<Method, SchemaPath>builder();
try {
for (final RpcDefinition rpcDef : module.getRpcs()) {
final Method method = findRpcMethod(key, rpcDef);
ret.put(method, rpcDef.getPath());
}
} catch (final NoSuchMethodException e) {
throw new IllegalStateException("Rpc defined in model does not have representation in generated class.", e);
}
return ret.build();
}
use of org.opendaylight.yangtools.yang.model.api.RpcDefinition in project controller by opendaylight.
the class DOMRpcRoutingTable method findRpcDefinition.
private static RpcDefinition findRpcDefinition(final SchemaContext context, final SchemaPath schemaPath) {
if (context != null) {
final QName qname = schemaPath.getPathFromRoot().iterator().next();
final Module module = context.findModule(qname.getModule()).orElse(null);
if (module != null && module.getRpcs() != null) {
for (RpcDefinition rpc : module.getRpcs()) {
if (qname.equals(rpc.getQName())) {
return rpc;
}
}
}
}
return null;
}
Aggregations