Search in sources :

Example 31 with DeviceDescription

use of org.onosproject.net.device.DeviceDescription in project onos by opennetworkinglab.

the class InternalDeviceEventSerializer method read.

@Override
public InternalDeviceEvent read(Kryo kryo, Input input, Class<InternalDeviceEvent> type) {
    ProviderId providerId = (ProviderId) kryo.readClassAndObject(input);
    DeviceId deviceId = kryo.readObject(input, DeviceId.class, deviceIdSerializer());
    @SuppressWarnings("unchecked") Timestamped<DeviceDescription> deviceDescription = (Timestamped<DeviceDescription>) kryo.readClassAndObject(input);
    return new InternalDeviceEvent(providerId, deviceId, deviceDescription);
}
Also used : ProviderId(org.onosproject.net.provider.ProviderId) DeviceDescription(org.onosproject.net.device.DeviceDescription) DeviceId(org.onosproject.net.DeviceId) Timestamped(org.onosproject.store.impl.Timestamped)

Example 32 with DeviceDescription

use of org.onosproject.net.device.DeviceDescription in project onos by opennetworkinglab.

the class BasicDeviceOperatorTest method testDescOps.

@Test
public void testDescOps() {
    DeviceDescription desc = BasicDeviceOperator.combine(null, DEV1);
    assertEquals(desc, DEV1);
    // override driver name
    desc = BasicDeviceOperator.combine(SW_BDC, DEV1);
    assertEquals(NAME1, desc.annotations().value(AnnotationKeys.DRIVER));
    // override Device Information
    desc = BasicDeviceOperator.combine(RD_BDC, DEV1);
    assertEquals("Wrong type", ROADM, desc.type());
    assertEquals("Wrong manufacturer", MANUFACTURER, desc.manufacturer());
    assertEquals("Wrong HwVersion", HW_VERSION, desc.hwVersion());
    assertEquals("Wrong swVersion", SW_VERSION, desc.swVersion());
    assertEquals("Wrong serial", SERIAL, desc.serialNumber());
    assertEquals("Wrong management Address", MANAGEMENT_ADDRESS, desc.annotations().value(AnnotationKeys.MANAGEMENT_ADDRESS));
    // override Device type
    desc = BasicDeviceOperator.combine(OT_BDC, DEV1);
    assertEquals(OTN, desc.type());
}
Also used : DefaultDeviceDescription(org.onosproject.net.device.DefaultDeviceDescription) DeviceDescription(org.onosproject.net.device.DeviceDescription) Test(org.junit.Test)

Example 33 with DeviceDescription

use of org.onosproject.net.device.DeviceDescription in project onos by opennetworkinglab.

the class DeviceManagerTest method connectDevice.

private void connectDevice(DeviceId deviceId, String swVersion) {
    DeviceDescription description = new DefaultDeviceDescription(deviceId.uri(), SWITCH, MFR, HW, swVersion, SN, CID);
    providerService.deviceConnected(deviceId, description);
    assertNotNull("device should be found", service.getDevice(DID1));
}
Also used : DefaultDeviceDescription(org.onosproject.net.device.DefaultDeviceDescription) DeviceDescription(org.onosproject.net.device.DeviceDescription) DefaultDeviceDescription(org.onosproject.net.device.DefaultDeviceDescription)

Example 34 with DeviceDescription

use of org.onosproject.net.device.DeviceDescription in project onos by opennetworkinglab.

the class TopologySimulator method createDevice.

/**
 * Creates simulated device.
 *
 * @param id        device identifier
 * @param chassisId chassis identifier number
 * @param type      device type
 * @param hw        hardware revision
 * @param sw        software revision
 * @param portCount number of device ports
 */
public void createDevice(DeviceId id, int chassisId, Device.Type type, String hw, String sw, int portCount) {
    DeviceDescription desc = new DefaultDeviceDescription(id.uri(), type, "ONF", hw, sw, "1234", new ChassisId(chassisId), DefaultAnnotations.builder().set(AnnotationKeys.NAME, "Switch " + chassisId).build());
    deviceIds.add(id);
    mastershipAdminService.setRoleSync(localNode, id, MASTER);
    deviceProviderService.deviceConnected(id, desc);
    deviceProviderService.updatePorts(id, buildPorts(portCount));
}
Also used : DefaultDeviceDescription(org.onosproject.net.device.DefaultDeviceDescription) DeviceDescription(org.onosproject.net.device.DeviceDescription) ChassisId(org.onlab.packet.ChassisId) DefaultDeviceDescription(org.onosproject.net.device.DefaultDeviceDescription)

Example 35 with DeviceDescription

use of org.onosproject.net.device.DeviceDescription in project onos by opennetworkinglab.

the class AbstractDeviceProvider method discoverDevice.

/**
 * Discovers the device details using the device discovery behaviour of
 * the supplied driver handler context for interacting with a specific
 * device.
 *
 * @param handler driver handler context
 */
protected void discoverDevice(DriverHandler handler) {
    DeviceId deviceId = handler.data().deviceId();
    DeviceDescriptionDiscovery discovery = handler.behaviour(DeviceDescriptionDiscovery.class);
    DeviceDescription description = discovery.discoverDeviceDetails();
    if (description != null) {
        providerService.deviceConnected(deviceId, description);
    } else {
        log.info("No other description given for device {}", deviceId);
    }
    providerService.updatePorts(deviceId, discovery.discoverPortDetails());
}
Also used : DeviceDescription(org.onosproject.net.device.DeviceDescription) DeviceDescriptionDiscovery(org.onosproject.net.device.DeviceDescriptionDiscovery) DeviceId(org.onosproject.net.DeviceId)

Aggregations

DeviceDescription (org.onosproject.net.device.DeviceDescription)44 DefaultDeviceDescription (org.onosproject.net.device.DefaultDeviceDescription)32 ChassisId (org.onlab.packet.ChassisId)14 DeviceId (org.onosproject.net.DeviceId)14 Test (org.junit.Test)11 ProviderId (org.onosproject.net.provider.ProviderId)10 DefaultAnnotations (org.onosproject.net.DefaultAnnotations)9 DeviceEvent (org.onosproject.net.device.DeviceEvent)8 SparseAnnotations (org.onosproject.net.SparseAnnotations)6 DeviceDescriptionDiscovery (org.onosproject.net.device.DeviceDescriptionDiscovery)6 Device (org.onosproject.net.Device)5 PortDescription (org.onosproject.net.device.PortDescription)5 IOException (java.io.IOException)4 ExecutionException (java.util.concurrent.ExecutionException)4 BiFunction (java.util.function.BiFunction)4 Function (java.util.function.Function)4 NodeId (org.onosproject.cluster.NodeId)4 NetconfException (org.onosproject.netconf.NetconfException)4 Arrays (java.util.Arrays)3 HashMap (java.util.HashMap)3