use of org.onosproject.netconf.NetconfDevice in project onos by opennetworkinglab.
the class FujitsuNetconfControllerMock method setUp.
/**
* Sets up initial test environment.
*
* @param listener listener to be added
* @return driver handler
* @throws NetconfException when there is a problem
*/
public FujitsuDriverHandlerAdapter setUp(FujitsuNetconfSessionListenerTest listener) throws NetconfException {
try {
NetconfDeviceInfo deviceInfo = new NetconfDeviceInfo(VOLT_DEVICE_USERNAME, VOLT_DEVICE_PASSWORD, IpAddress.valueOf(VOLT_DEVICE_IP), VOLT_DEVICE_PORT);
NetconfDevice netconfDevice = connectDevice(deviceInfo.getDeviceId());
FujitsuNetconfSessionMock session = (FujitsuNetconfSessionMock) netconfDevice.getSession();
session.setListener(listener);
DeviceId deviceId = deviceInfo.getDeviceId();
DefaultDriver driver = new DefaultDriver(VOLT_DRIVER_NAME, new ArrayList<>(), "Fujitsu", "1.0", "1.0", ImmutableMap.of(), ImmutableMap.of());
DefaultDriverData driverData = new DefaultDriverData(driver, deviceId);
FujitsuDriverHandlerAdapter driverHandler;
driverHandler = new FujitsuDriverHandlerAdapter(driverData);
driverHandler.setUp(this);
return driverHandler;
} catch (NetconfException e) {
throw new NetconfException("Cannot create a device ", e);
}
}
use of org.onosproject.netconf.NetconfDevice in project onos by opennetworkinglab.
the class JuniperAbstractHandlerBehaviour method lookupNetconfSession.
/**
* Lookup the current NETCONF session for specified device.
* @param deviceId id of device
* @return the current session (which may be null)
*/
NetconfSession lookupNetconfSession(final DeviceId deviceId) {
NetconfController controller = checkNotNull(handler().get(NetconfController.class));
final NetconfDevice netconfDevice = controller.getDevicesMap().get(deviceId);
if (netconfDevice == null) {
log.warn("NETCONF session to device {} not yet established, can be retried", deviceId);
return null;
}
return netconfDevice.getSession();
}
use of org.onosproject.netconf.NetconfDevice in project onos by opennetworkinglab.
the class CassiniTerminalDeviceDiscoveryOld method getNetconfSession.
/**
* Returns the NetconfSession with the device for which the method was called.
*
* @param deviceId device indetifier
*
* @return The netconf session or null
*/
private NetconfSession getNetconfSession(DeviceId deviceId) {
NetconfController controller = handler().get(NetconfController.class);
NetconfDevice ncdev = controller.getDevicesMap().get(deviceId);
if (ncdev == null) {
log.trace("No netconf device, returning null session");
return null;
}
return ncdev.getSession();
}
use of org.onosproject.netconf.NetconfDevice in project onos by opennetworkinglab.
the class CassiniTerminalDevicePowerConfigExt method getNetconfSession.
/**
* Returns the NetconfSession with the device for which the method was called.
*
* @param deviceId device indetifier
*
* @return The netconf session or null
*/
private NetconfSession getNetconfSession(DeviceId deviceId) {
NetconfController controller = handler().get(NetconfController.class);
NetconfDevice ncdev = controller.getDevicesMap().get(deviceId);
if (ncdev == null) {
log.trace("No netconf device, returning null session");
return null;
}
return ncdev.getSession();
}
use of org.onosproject.netconf.NetconfDevice in project onos by opennetworkinglab.
the class GrooveOpenConfigDeviceDiscovery method getNetconfSession.
/**
* Returns the NetconfSession with the device for which the method was called.
*
* @param deviceId device indetifier
*
* @return The netconf session or null
*/
private NetconfSession getNetconfSession(DeviceId deviceId) {
NetconfController controller = handler().get(NetconfController.class);
NetconfDevice ncdev = controller.getDevicesMap().get(deviceId);
if (ncdev == null) {
log.trace("No netconf device, returning null session");
return null;
}
return ncdev.getSession();
}
Aggregations