import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.toRpcMessage;
import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.wrap;
+import com.google.common.base.Preconditions;
import java.io.InputStream;
import java.net.InetSocketAddress;
import java.net.URI;
import org.opendaylight.controller.md.sal.common.api.data.DataModification;
import org.opendaylight.controller.md.sal.common.api.data.DataReader;
import org.opendaylight.controller.netconf.client.NetconfClientDispatcher;
+import org.opendaylight.controller.netconf.client.conf.NetconfClientConfiguration;
import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration;
import org.opendaylight.controller.sal.core.api.Provider;
private boolean rollbackSupported;
+ private NetconfClientConfiguration clientConfig;
public NetconfDevice(String name) {
this.name = name;
checkState(schemaSourceProvider != null, "Schema Source Provider must be set.");
checkState(eventExecutor != null, "Event executor must be set.");
- listener = new NetconfDeviceListener(this);
+ Preconditions.checkArgument(clientConfig.getSessionListener() instanceof NetconfDeviceListener);
+ listener = (NetconfDeviceListener) clientConfig.getSessionListener();
logger.info("Starting NETCONF Client {} for address {}", name, socketAddress);
- dispatcher.createClient(socketAddress, listener, reconnectStrategy);
+ dispatcher.createClient(clientConfig);
}
Optional<SchemaContext> getSchemaContext() {
public void setDispatcher(final NetconfClientDispatcher dispatcher) {
this.dispatcher = dispatcher;
}
+
+ public void setClientConfig(final NetconfClientConfiguration clientConfig) {
+ this.clientConfig = clientConfig;
+ }
+
}
class NetconfDeviceSchemaContextProvider {