use of org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier in project controller by opendaylight.
the class RemoteRpcRegistryMXBeanImplTest method setUp.
@Before
public void setUp() throws Exception {
system = ActorSystem.create("test");
final DOMRpcIdentifier emptyRpcIdentifier = DOMRpcIdentifier.create(EMPTY_SCHEMA_PATH, YangInstanceIdentifier.EMPTY);
final DOMRpcIdentifier localRpcIdentifier = DOMRpcIdentifier.create(LOCAL_SCHEMA_PATH, YangInstanceIdentifier.of(LOCAL_QNAME));
buckets = Lists.newArrayList(emptyRpcIdentifier, localRpcIdentifier);
final RemoteRpcProviderConfig config = new RemoteRpcProviderConfig.Builder("system").build();
final TestKit invoker = new TestKit(system);
final TestKit registrar = new TestKit(system);
final TestKit supervisor = new TestKit(system);
final Props props = RpcRegistry.props(config, invoker.getRef(), registrar.getRef()).withDispatcher(Dispatchers.DefaultDispatcherId());
testActor = new TestActorRef<>(system, props, supervisor.getRef(), "testActor");
final Timeout timeout = Timeout.apply(10, TimeUnit.SECONDS);
mxBean = new RemoteRpcRegistryMXBeanImpl(new BucketStoreAccess(testActor, system.dispatcher(), timeout), timeout);
}
use of org.opendaylight.controller.md.sal.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.getRoutes();
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.controller.md.sal.dom.api.DOMRpcIdentifier in project controller by opendaylight.
the class RemoteRpcRegistryMXBeanImpl method getGlobalRpc.
@Override
public Set<String> getGlobalRpc() {
RoutingTable table = getLocalData();
Set<String> globalRpc = new HashSet<>(table.getRoutes().size());
for (DOMRpcIdentifier route : table.getRoutes()) {
if (route.getContextReference().isEmpty()) {
globalRpc.add(route.getType().toString());
}
}
log.debug("Locally registered global RPCs {}", globalRpc);
return globalRpc;
}
use of org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier in project controller by opendaylight.
the class RemoteRpcRegistryMXBeanImpl method getLocalRegisteredRoutedRpc.
@Override
public Set<String> getLocalRegisteredRoutedRpc() {
RoutingTable table = getLocalData();
Set<String> routedRpc = new HashSet<>(table.getRoutes().size());
for (DOMRpcIdentifier route : table.getRoutes()) {
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.controller.md.sal.dom.api.DOMRpcIdentifier in project controller by opendaylight.
the class GetConstantService method registerNew.
public static DOMRpcImplementationRegistration<GetConstantService> registerNew(final DOMRpcProviderService rpcProviderService, final String constant) {
LOG.debug("Registering get-constant service, constant value: {}", constant);
final DOMRpcIdentifier id = DOMRpcIdentifier.create(SchemaPath.create(true, GET_CONSTANT));
return rpcProviderService.registerRpcImplementation(new GetConstantService(constant), id);
}
Aggregations