Search in sources :

Example 1 with RoutingTable

use of org.opendaylight.controller.remote.rpc.registry.RoutingTable in project controller by opendaylight.

the class RemoteRpcRegistryMXBeanImpl method findRpcByName.

@Override
public Map<String, String> findRpcByName(final String name) {
    RoutingTable localTable = getLocalData();
    // Get all RPCs from local bucket
    Map<String, String> rpcMap = new HashMap<>(getRpcMemberMapByName(localTable, name, LOCAL_CONSTANT));
    // Get all RPCs from remote bucket
    Map<Address, Bucket<RoutingTable>> buckets = getRemoteBuckets();
    for (Entry<Address, Bucket<RoutingTable>> entry : buckets.entrySet()) {
        RoutingTable table = entry.getValue().getData();
        rpcMap.putAll(getRpcMemberMapByName(table, name, entry.getKey().toString()));
    }
    log.debug("list of RPCs {} searched by name {}", rpcMap, name);
    return rpcMap;
}
Also used : RoutingTable(org.opendaylight.controller.remote.rpc.registry.RoutingTable) Address(akka.actor.Address) HashMap(java.util.HashMap) Bucket(org.opendaylight.controller.remote.rpc.registry.gossip.Bucket)

Example 2 with RoutingTable

use of org.opendaylight.controller.remote.rpc.registry.RoutingTable 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;
}
Also used : RoutingTable(org.opendaylight.controller.remote.rpc.registry.RoutingTable) DOMRpcIdentifier(org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier) HashSet(java.util.HashSet)

Example 3 with RoutingTable

use of org.opendaylight.controller.remote.rpc.registry.RoutingTable 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;
}
Also used : RoutingTable(org.opendaylight.controller.remote.rpc.registry.RoutingTable) DOMRpcIdentifier(org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier) HashSet(java.util.HashSet)

Example 4 with RoutingTable

use of org.opendaylight.controller.remote.rpc.registry.RoutingTable in project controller by opendaylight.

the class RemoteRpcRegistryMXBeanImpl method findRpcByRoute.

@Override
public Map<String, String> findRpcByRoute(final String routeId) {
    RoutingTable localTable = getLocalData();
    Map<String, String> rpcMap = new HashMap<>(getRpcMemberMapByRoute(localTable, routeId, LOCAL_CONSTANT));
    Map<Address, Bucket<RoutingTable>> buckets = getRemoteBuckets();
    for (Entry<Address, Bucket<RoutingTable>> entry : buckets.entrySet()) {
        RoutingTable table = entry.getValue().getData();
        rpcMap.putAll(getRpcMemberMapByRoute(table, routeId, entry.getKey().toString()));
    }
    log.debug("list of RPCs {} searched by route {}", rpcMap, routeId);
    return rpcMap;
}
Also used : RoutingTable(org.opendaylight.controller.remote.rpc.registry.RoutingTable) Address(akka.actor.Address) HashMap(java.util.HashMap) Bucket(org.opendaylight.controller.remote.rpc.registry.gossip.Bucket)

Aggregations

RoutingTable (org.opendaylight.controller.remote.rpc.registry.RoutingTable)4 Address (akka.actor.Address)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 DOMRpcIdentifier (org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier)2 Bucket (org.opendaylight.controller.remote.rpc.registry.gossip.Bucket)2