use of org.opendaylight.mdsal.dom.api.DOMRpcIdentifier in project controller by opendaylight.
the class RemoteRpcRegistryMXBeanImpl method getRpcMemberMapByName.
/**
* Search if the routing table route type contains name.
*/
private static Map<String, String> getRpcMemberMapByName(final RoutingTable table, final String name, 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 type = route.getType().toString();
if (type.contains(name)) {
rpcMap.put(ROUTE_CONSTANT + route.getContextReference() + NAME_CONSTANT + type, address);
}
}
}
return rpcMap;
}
use of org.opendaylight.mdsal.dom.api.DOMRpcIdentifier in project controller by opendaylight.
the class OpsRegistrarTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
system = ActorSystem.create("test");
final TestKit testKit = new TestKit(system);
final RemoteOpsProviderConfig config = new RemoteOpsProviderConfig.Builder("system").build();
final Props props = OpsRegistrar.props(config, rpcService, actionService);
testActorRef = new TestActorRef<>(system, props, testKit.getRef(), "actorRef");
endpointAddress = new Address("http", "local");
final DOMRpcIdentifier firstEndpointId = DOMRpcIdentifier.create(QName.create("first:identifier", "foo"));
final DOMRpcIdentifier secondEndpointId = DOMRpcIdentifier.create(QName.create("second:identifier", "bar"));
final QName firstActionQName = QName.create("first:actionIdentifier", "fooAction");
final DOMActionInstance firstActionInstance = DOMActionInstance.of(Absolute.of(firstActionQName), LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.create(new YangInstanceIdentifier.NodeIdentifier(firstActionQName)));
final DOMActionInstance secondActionInstance = DOMActionInstance.of(Absolute.of(firstActionQName), LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.create(new YangInstanceIdentifier.NodeIdentifier(firstActionQName)));
final TestKit senderKit = new TestKit(system);
firstEndpoint = new RemoteRpcEndpoint(senderKit.getRef(), Collections.singletonList(firstEndpointId));
secondEndpoint = new RemoteRpcEndpoint(senderKit.getRef(), Collections.singletonList(secondEndpointId));
firstActionEndpoint = new RemoteActionEndpoint(senderKit.getRef(), Collections.singletonList(firstActionInstance));
secondActionEndpoint = new RemoteActionEndpoint(senderKit.getRef(), Collections.singletonList(secondActionInstance));
doReturn(oldReg).when(rpcService).registerRpcImplementation(any(RemoteRpcImplementation.class), eq(firstEndpoint.getRpcs()));
doReturn(newReg).when(rpcService).registerRpcImplementation(any(RemoteRpcImplementation.class), eq(secondEndpoint.getRpcs()));
doReturn(oldActionReg).when(actionService).registerActionImplementation(any(RemoteActionImplementation.class), eq(secondActionEndpoint.getActions()));
doReturn(oldActionReg).when(actionService).registerActionImplementation(any(RemoteActionImplementation.class), eq(secondActionEndpoint.getActions()));
opsRegistrar = testActorRef.underlyingActor();
}
use of org.opendaylight.mdsal.dom.api.DOMRpcIdentifier in project mdsal by opendaylight.
the class ForwardingDOMRpcImplementationTest method basicTest.
@Test
public void basicTest() throws Exception {
final DOMRpcIdentifier domRpcIdentifier = mock(DOMRpcIdentifier.class);
doReturn(null).when(domRpcImplementation).invokeRpc(domRpcIdentifier, null);
this.invokeRpc(domRpcIdentifier, null);
verify(domRpcImplementation).invokeRpc(domRpcIdentifier, null);
}
Aggregations