use of org.opendaylight.mdsal.dom.api.DOMRpcIdentifier in project controller by opendaylight.
the class ActionProviderBean method registerFallback.
private void registerFallback(final Class<RpcService> interfaceClass) {
final Collection<QName> paths = RpcUtil.decomposeRpcService(interfaceClass, schemaService.getGlobalContext(), RpcRoutingStrategy::isContextBasedRouted);
if (paths.isEmpty()) {
LOG.warn("{}: interface {} has no actions defined", ACTION_PROVIDER, interfaceClass);
return;
}
final Set<DOMRpcIdentifier> rpcs = ImmutableSet.copyOf(Collections2.transform(paths, DOMRpcIdentifier::create));
reg = domRpcProvider.registerRpcImplementation((rpc, input) -> FluentFutures.immediateFailedFluentFuture(new DOMRpcImplementationNotAvailableException("Action %s has no instance matching %s", rpc, input)), rpcs);
LOG.debug("Registered provider for {}", interfaceName);
}
use of org.opendaylight.mdsal.dom.api.DOMRpcIdentifier in project controller by opendaylight.
the class RemoteRpcRegistryMXBeanImpl method getGlobalRpc.
@Override
public Set<String> getGlobalRpc() {
RoutingTable table = localData();
Set<String> globalRpc = new HashSet<>(table.getItems().size());
for (DOMRpcIdentifier route : table.getItems()) {
if (route.getContextReference().isEmpty()) {
globalRpc.add(route.getType().toString());
}
}
log.debug("Locally registered global RPCs {}", globalRpc);
return globalRpc;
}
use of org.opendaylight.mdsal.dom.api.DOMRpcIdentifier in project controller by opendaylight.
the class RemoteRpcRegistryMXBeanImpl method getLocalRegisteredRoutedRpc.
@Override
public Set<String> getLocalRegisteredRoutedRpc() {
RoutingTable table = localData();
Set<String> routedRpc = new HashSet<>(table.getItems().size());
for (DOMRpcIdentifier route : table.getItems()) {
if (!route.getContextReference().isEmpty()) {
routedRpc.add(ROUTE_CONSTANT + route.getContextReference() + NAME_CONSTANT + route.getType());
}
}
log.debug("Locally registered routed RPCs {}", routedRpc);
return routedRpc;
}
use of org.opendaylight.mdsal.dom.api.DOMRpcIdentifier in project controller by opendaylight.
the class RemoteRpcRegistryMXBeanImpl method getRpcMemberMapByRoute.
/**
* Search if the routing table route String contains routeName.
*/
private static Map<String, String> getRpcMemberMapByRoute(final RoutingTable table, final String routeName, final String address) {
Set<DOMRpcIdentifier> routes = table.getItems();
Map<String, String> rpcMap = new HashMap<>(routes.size());
for (DOMRpcIdentifier route : routes) {
if (!route.getContextReference().isEmpty()) {
String routeString = route.getContextReference().toString();
if (routeString.contains(routeName)) {
rpcMap.put(ROUTE_CONSTANT + routeString + NAME_CONSTANT + route.getType(), address);
}
}
}
return rpcMap;
}
use of org.opendaylight.mdsal.dom.api.DOMRpcIdentifier in project netconf by opendaylight.
the class NetconfDeviceRpcTest method testRegisterRpcListener.
@Test
public void testRegisterRpcListener() throws Exception {
ArgumentCaptor<Collection> argument = ArgumentCaptor.forClass(Collection.class);
rpc.registerRpcListener(listener);
verify(listener).onRpcAvailable(argument.capture());
final Collection<DOMRpcIdentifier> argValue = argument.getValue();
final Collection<? extends RpcDefinition> operations = SCHEMA_CONTEXT.getOperations();
assertEquals(argValue.size(), operations.size());
for (RpcDefinition operation : operations) {
final DOMRpcIdentifier domRpcIdentifier = DOMRpcIdentifier.create(operation.getQName());
assertTrue(argValue.contains(domRpcIdentifier));
}
}
Aggregations