use of org.opendaylight.netconf.sal.connect.impl.DefaultSchemaResourceManager in project netconf by opendaylight.
the class MountPointEndToEndTest method setUp.
@Before
public void setUp() throws Exception {
deleteCacheDir();
resourceManager = new DefaultSchemaResourceManager(new DefaultYangParserFactory(), TEST_ROOT_DIRECTORY, TEST_DEFAULT_SUBDIR);
topModuleInfo = BindingReflections.getModuleInfo(Top.class);
deviceSchemaContext = BindingRuntimeHelpers.createEffectiveModel(Top.class);
deviceRpcService.onModelContextUpdated(deviceSchemaContext);
putTopRpcSchemaPath = findRpcDefinition("put-top").getQName();
getTopRpcSchemaPath = findRpcDefinition("get-top").getQName();
deviceRpcService.getRpcProviderService().registerRpcImplementation(topRpcImplementation, DOMRpcIdentifier.create(putTopRpcSchemaPath), DOMRpcIdentifier.create(getTopRpcSchemaPath));
setupMaster();
setupSlave();
yangNodeInstanceId = bindingToNormalized.toYangInstanceIdentifier(NODE_INSTANCE_ID);
doReturn(mock(ReconnectFuture.class)).when(mockClientDispatcher).createReconnectingClient(any());
LOG.info("****** Setup complete");
}
use of org.opendaylight.netconf.sal.connect.impl.DefaultSchemaResourceManager in project netconf by opendaylight.
the class RemoteDeviceConnectorImplTest method testKeapAliveFacade.
@SuppressWarnings("unchecked")
@Test
public void testKeapAliveFacade() {
final Credentials credentials = new LoginPasswordBuilder().setPassword("admin").setUsername("admin").build();
final NetconfNode netconfNode = new NetconfNodeBuilder().setHost(new Host(new IpAddress(new Ipv4Address("127.0.0.1")))).setPort(new PortNumber(Uint16.valueOf(9999))).setReconnectOnChangedSchema(true).setDefaultRequestTimeoutMillis(Uint32.valueOf(1000)).setBetweenAttemptsTimeoutMillis(Uint16.valueOf(100)).setSchemaless(false).setTcpOnly(false).setCredentials(credentials).setKeepaliveDelay(Uint32.ONE).build();
final Node node = new NodeBuilder().setNodeId(NODE_ID).addAugmentation(netconfNode).build();
builder.setSchemaResourceDTO(new DefaultSchemaResourceManager(new DefaultYangParserFactory()).getSchemaResources(netconfNode, "foo"));
final RemoteDeviceConnectorImpl remoteDeviceConnection = new RemoteDeviceConnectorImpl(builder.build(), remoteDeviceId, deviceActionFactory);
final RemoteDeviceHandler<NetconfSessionPreferences> salFacade = mock(RemoteDeviceHandler.class);
final NetconfConnectorDTO connectorDTO = remoteDeviceConnection.createDeviceCommunicator(NODE_ID, netconfNode, salFacade);
assertTrue(connectorDTO.getFacade() instanceof KeepaliveSalFacade);
}
use of org.opendaylight.netconf.sal.connect.impl.DefaultSchemaResourceManager in project netconf by opendaylight.
the class NetconfTopologyManagerTest method setUp.
@Before
public void setUp() throws Exception {
AbstractDataBrokerTest dataBrokerTest = new AbstractDataBrokerTest() {
@Override
protected Set<YangModuleInfo> getModuleInfos() throws Exception {
return ImmutableSet.of(BindingReflections.getModuleInfo(NetworkTopology.class), BindingReflections.getModuleInfo(Topology.class));
}
};
dataBrokerTest.setup();
dataBroker = spy(dataBrokerTest.getDataBroker());
final DOMRpcProviderService rpcProviderRegistry = mock(DOMRpcProviderService.class);
final ScheduledThreadPool keepaliveExecutor = mock(ScheduledThreadPool.class);
final DOMActionProviderService actionProviderRegistry = mock(DOMActionProviderService.class);
final ThreadPool processingThreadPool = mock(ThreadPool.class);
final ExecutorService processingService = mock(ExecutorService.class);
doReturn(processingService).when(processingThreadPool).getExecutor();
final ActorSystemProvider actorSystemProvider = mock(ActorSystemProvider.class);
final EventExecutor eventExecutor = mock(EventExecutor.class);
final NetconfClientDispatcher clientDispatcher = mock(NetconfClientDispatcher.class);
final DOMMountPointService mountPointService = mock(DOMMountPointService.class);
final AAAEncryptionService encryptionService = mock(AAAEncryptionService.class);
final DeviceActionFactory deviceActionFactory = mock(DeviceActionFactory.class);
final RpcProviderService rpcProviderService = mock(RpcProviderService.class);
final Config config = new ConfigBuilder().setWriteTransactionIdleTimeout(Uint16.ZERO).build();
netconfTopologyManager = new NetconfTopologyManager(BASE_SCHEMAS, dataBroker, rpcProviderRegistry, actionProviderRegistry, clusterSingletonServiceProvider, keepaliveExecutor, processingThreadPool, actorSystemProvider, eventExecutor, clientDispatcher, TOPOLOGY_ID, config, mountPointService, encryptionService, rpcProviderService, deviceActionFactory, new DefaultSchemaResourceManager(new DefaultYangParserFactory())) {
@Override
protected NetconfTopologyContext newNetconfTopologyContext(final NetconfTopologySetup setup, final ServiceGroupIdentifier serviceGroupIdent, final Timeout actorResponseWaitTime, final DeviceActionFactory deviceActionFactory) {
assertEquals(ACTOR_RESPONSE_WAIT_TIME.toJava(), actorResponseWaitTime.duration().toSeconds());
return Objects.requireNonNull(mockContextMap.get(setup.getInstanceIdentifier()), "No mock context for " + setup.getInstanceIdentifier()).apply(setup);
}
};
doNothing().when(mockListenerReg).close();
doReturn(mockListenerReg).when(dataBroker).registerDataTreeChangeListener(any(), any());
}
Aggregations