Prevent NPE for Credentials
[netconf.git] / apps / netconf-topology / src / main / java / org / opendaylight / netconf / topology / spi / NetconfTopologyDeviceSalFacade.java
index 2e586b73b913025922fb6cc7a862f5e8cbc0b8e3..fb662223e28fb9ff144fa65ad5db60e6a15e35ba 100644 (file)
@@ -16,6 +16,7 @@ import org.opendaylight.netconf.client.mdsal.api.NetconfSessionPreferences;
 import org.opendaylight.netconf.client.mdsal.api.RemoteDeviceId;
 import org.opendaylight.netconf.client.mdsal.api.RemoteDeviceServices;
 import org.opendaylight.netconf.client.mdsal.spi.NetconfDeviceSalFacade;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev240611.credentials.Credentials;
 
 /**
  * {@link NetconfDeviceSalFacade} specialization for netconf topology.
@@ -23,10 +24,22 @@ import org.opendaylight.netconf.client.mdsal.spi.NetconfDeviceSalFacade;
 public class NetconfTopologyDeviceSalFacade extends NetconfDeviceSalFacade {
     private final NetconfDeviceTopologyAdapter datastoreAdapter;
 
-    public NetconfTopologyDeviceSalFacade(final RemoteDeviceId id, final DOMMountPointService mountPointService,
-            final boolean lockDatastore, final DataBroker dataBroker) {
+    /**
+     * NetconfTopologyDeviceSalFacade is a specialization of NetconfDeviceSalFacade
+     * for the netconf topology. It handles the lifecycle and data updates for
+     * NETCONF devices within the topology.
+     *
+     * @param id                the unique identifier for the remote device
+     * @param credentials       the credentials used to authenticate the remote device
+     * @param mountPointService the mount point service for managing mount points
+     * @param lockDatastore     a flag indicating whether the datastore should be locked
+     * @param dataBroker        the data broker for accessing and modifying data in the data store
+     */
+    public NetconfTopologyDeviceSalFacade(final RemoteDeviceId id, final Credentials credentials,
+            final DOMMountPointService mountPointService, final boolean lockDatastore, final DataBroker dataBroker) {
         super(id, mountPointService, NetconfNodeUtils.defaultTopologyMountPath(id), lockDatastore);
-        datastoreAdapter = new NetconfDeviceTopologyAdapter(dataBroker, NetconfNodeUtils.DEFAULT_TOPOLOGY_IID, id);
+        datastoreAdapter = new NetconfDeviceTopologyAdapter(dataBroker, NetconfNodeUtils.DEFAULT_TOPOLOGY_IID, id,
+            credentials);
     }
 
     @Override