Search in sources :

Example 1 with NetconfDevice

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);
    }
}
Also used : NetconfException(org.onosproject.netconf.NetconfException) NetconfDevice(org.onosproject.netconf.NetconfDevice) NetconfDeviceInfo(org.onosproject.netconf.NetconfDeviceInfo) DeviceId(org.onosproject.net.DeviceId) DefaultDriver(org.onosproject.net.driver.DefaultDriver) DefaultDriverData(org.onosproject.net.driver.DefaultDriverData)

Example 2 with NetconfDevice

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();
}
Also used : NetconfDevice(org.onosproject.netconf.NetconfDevice) NetconfController(org.onosproject.netconf.NetconfController)

Example 3 with NetconfDevice

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();
}
Also used : NetconfDevice(org.onosproject.netconf.NetconfDevice) NetconfController(org.onosproject.netconf.NetconfController)

Example 4 with NetconfDevice

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();
}
Also used : NetconfDevice(org.onosproject.netconf.NetconfDevice) NetconfController(org.onosproject.netconf.NetconfController)

Example 5 with NetconfDevice

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();
}
Also used : NetconfDevice(org.onosproject.netconf.NetconfDevice) NetconfController(org.onosproject.netconf.NetconfController)

Aggregations

NetconfDevice (org.onosproject.netconf.NetconfDevice)37 NetconfController (org.onosproject.netconf.NetconfController)20 NetconfException (org.onosproject.netconf.NetconfException)13 DeviceId (org.onosproject.net.DeviceId)8 NetconfSession (org.onosproject.netconf.NetconfSession)6 Test (org.junit.Test)5 NetconfDeviceInfo (org.onosproject.netconf.NetconfDeviceInfo)5 ExecutionException (java.util.concurrent.ExecutionException)4 NetconfDeviceConfig (org.onosproject.netconf.config.NetconfDeviceConfig)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 TimeoutException (java.util.concurrent.TimeoutException)2 Lock (java.util.concurrent.locks.Lock)2 ReentrantLock (java.util.concurrent.locks.ReentrantLock)2 IpAddress (org.onlab.packet.IpAddress)2 MastershipService (org.onosproject.mastership.MastershipService)2 DefaultDeviceDescription (org.onosproject.net.device.DefaultDeviceDescription)2 DeviceDescription (org.onosproject.net.device.DeviceDescription)2 DefaultDriver (org.onosproject.net.driver.DefaultDriver)2 DefaultDriverData (org.onosproject.net.driver.DefaultDriverData)2 DriverHandler (org.onosproject.net.driver.DriverHandler)2