use of org.opendaylight.netconf.dom.api.NetconfDataTreeService in project netconf by opendaylight.
the class MasterSalFacade method registerMasterMountPoint.
private void registerMasterMountPoint() {
requireNonNull(id);
requireNonNull(currentMountContext, "Device has no remote schema context yet. Probably not fully connected.");
requireNonNull(netconfSessionPreferences, "Device has no capabilities yet. Probably not fully connected.");
final NetconfDeviceNotificationService notificationService = new NetconfDeviceNotificationService();
deviceDataBroker = newDeviceDataBroker();
netconfService = newNetconfDataTreeService();
// We need to create ProxyDOMDataBroker so accessing mountpoint
// on leader node would be same as on follower node
final ProxyDOMDataBroker proxyDataBroker = new ProxyDOMDataBroker(id, masterActorRef, actorSystem.dispatcher(), actorResponseWaitTime);
final NetconfDataTreeService proxyNetconfService = new ProxyNetconfDataTreeService(id, masterActorRef, actorSystem.dispatcher(), actorResponseWaitTime);
salProvider.getMountInstance().onTopologyDeviceConnected(currentMountContext.getEffectiveModelContext(), proxyDataBroker, proxyNetconfService, deviceRpc, notificationService, deviceAction);
}
use of org.opendaylight.netconf.dom.api.NetconfDataTreeService in project netconf by opendaylight.
the class NetconfNodeActorTest method testSlaveNewNetconfDataTreeServiceRequest.
@Test
public void testSlaveNewNetconfDataTreeServiceRequest() {
initializeMaster(Collections.emptyList());
registerSlaveMountPoint();
ArgumentCaptor<NetconfDataTreeService> netconfCaptor = ArgumentCaptor.forClass(NetconfDataTreeService.class);
verify(mockMountPointBuilder).addService(eq(NetconfDataTreeService.class), netconfCaptor.capture());
final NetconfDataTreeService slaveNetconfService = netconfCaptor.getValue();
assertTrue(slaveNetconfService instanceof ProxyNetconfDataTreeService);
final YangInstanceIdentifier PATH = YangInstanceIdentifier.empty();
final LogicalDatastoreType STORE = LogicalDatastoreType.CONFIGURATION;
final ContainerNode NODE = Builders.containerBuilder().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(QName.create("", "cont"))).build();
final FluentFuture<Optional<Object>> result = immediateFluentFuture(Optional.of(NODE));
doReturn(result).when(netconfService).get(PATH);
doReturn(result).when(netconfService).getConfig(PATH);
doReturn(emptyFluentFuture()).when(netconfService).commit();
slaveNetconfService.get(PATH);
slaveNetconfService.getConfig(PATH);
slaveNetconfService.lock();
slaveNetconfService.merge(STORE, PATH, NODE, Optional.empty());
slaveNetconfService.replace(STORE, PATH, NODE, Optional.empty());
slaveNetconfService.create(STORE, PATH, NODE, Optional.empty());
slaveNetconfService.delete(STORE, PATH);
slaveNetconfService.remove(STORE, PATH);
slaveNetconfService.discardChanges();
slaveNetconfService.commit();
verify(netconfService, timeout(1000)).get(PATH);
verify(netconfService, timeout(1000)).getConfig(PATH);
verify(netconfService, timeout(1000)).lock();
verify(netconfService, timeout(1000)).merge(STORE, PATH, NODE, Optional.empty());
verify(netconfService, timeout(1000)).replace(STORE, PATH, NODE, Optional.empty());
verify(netconfService, timeout(1000)).create(STORE, PATH, NODE, Optional.empty());
verify(netconfService, timeout(1000)).delete(STORE, PATH);
verify(netconfService, timeout(1000)).remove(STORE, PATH);
verify(netconfService, timeout(1000)).discardChanges();
verify(netconfService, timeout(1000)).commit();
}
use of org.opendaylight.netconf.dom.api.NetconfDataTreeService in project netconf by opendaylight.
the class SlaveSalFacade method registerSlaveMountPoint.
public void registerSlaveMountPoint(final EffectiveModelContext remoteSchemaContext, final DOMRpcService deviceRpc, final DOMActionService deviceAction, final ActorRef masterActorRef) {
if (!registered.compareAndSet(false, true)) {
return;
}
final NetconfDeviceNotificationService notificationService = new NetconfDeviceNotificationService();
final ProxyDOMDataBroker netconfDeviceDataBroker = new ProxyDOMDataBroker(id, masterActorRef, actorSystem.dispatcher(), actorResponseWaitTime);
final NetconfDataTreeService proxyNetconfService = new ProxyNetconfDataTreeService(id, masterActorRef, actorSystem.dispatcher(), actorResponseWaitTime);
salProvider.getMountInstance().onTopologyDeviceConnected(remoteSchemaContext, netconfDeviceDataBroker, proxyNetconfService, deviceRpc, notificationService, deviceAction);
LOG.info("{}: Slave mount point registered.", id);
}
use of org.opendaylight.netconf.dom.api.NetconfDataTreeService in project netconf by opendaylight.
the class NetconfDeviceSalFacade method onDeviceConnected.
@Override
public synchronized void onDeviceConnected(final MountPointContext mountContext, final NetconfSessionPreferences netconfSessionPreferences, final DOMRpcService deviceRpc, final DOMActionService deviceAction) {
final EffectiveModelContext schemaContext = mountContext.getEffectiveModelContext();
final NetconfDeviceDataBroker netconfDeviceDataBroker = new NetconfDeviceDataBroker(id, mountContext, deviceRpc, netconfSessionPreferences);
final NetconfDataTreeService netconfService = AbstractNetconfDataTreeService.of(id, mountContext, deviceRpc, netconfSessionPreferences);
registerLockListener(netconfDeviceDataBroker, netconfService);
final NetconfDeviceNotificationService notificationService = new NetconfDeviceNotificationService();
salProvider.getMountInstance().onTopologyDeviceConnected(schemaContext, netconfDeviceDataBroker, netconfService, deviceRpc, notificationService, deviceAction);
salProvider.getTopologyDatastoreAdapter().updateDeviceData(true, netconfSessionPreferences.getNetconfDeviceCapabilities());
}
Aggregations