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);
}
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());
}
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));
}
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));
}
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());
}
Aggregations