Search in sources :

Example 36 with NetconfDevice

use of org.onosproject.netconf.NetconfDevice in project onos by opennetworkinglab.

the class NetconfControllerImplTest method testConnectCorrectDevice.

/**
 * Check for correct device connection. In this case the device map get modified.
 */
@Test
public void testConnectCorrectDevice() throws Exception {
    reflectedDeviceMap.clear();
    NetconfDevice device1 = ctrl.connectDevice(deviceInfo1.getDeviceId());
    NetconfDevice device2 = ctrl.connectDevice(deviceInfo2.getDeviceId());
    assertTrue(String.format("Incorrect device connection from '%s' we get '%s' contains '%s'", deviceInfo1, ctrl.getDevicesMap(), deviceId1), ctrl.getDevicesMap().containsKey(deviceId1));
    assertTrue("Incorrect device connection", ctrl.getDevicesMap().containsKey(deviceId2));
    assertEquals("Incorrect device connection", 2, ctrl.getDevicesMap().size());
}
Also used : NetconfDevice(org.onosproject.netconf.NetconfDevice) Test(org.junit.Test)

Example 37 with NetconfDevice

use of org.onosproject.netconf.NetconfDevice in project onos by opennetworkinglab.

the class CienaWaveserverAiDeviceDescription method getNetconfSession.

/**
 * Returns the NETCONF session of the device.
 *
 * @return session
 */
private NetconfSession getNetconfSession() {
    NetconfController controller = checkNotNull(handler().get(NetconfController.class));
    NetconfDevice ncDevice = controller.getDevicesMap().get(handler().data().deviceId());
    if (ncDevice == null) {
        log.error("Internal ONOS Error. Device has been marked as reachable, " + "but deviceID {} is not in Devices Map. Continuing with empty description", handler().data().deviceId());
    }
    return controller.getDevicesMap().get(handler().data().deviceId()).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