Java Code Examples for org.onosproject.net.Device#chassisId()

The following examples show how to use org.onosproject.net.Device#chassisId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PolatisDeviceDescription.java    From onos with Apache License 2.0 6 votes vote down vote up
private DeviceDescription parseProductInformation() {
    DeviceService devsvc = checkNotNull(handler().get(DeviceService.class));
    DeviceId devid = handler().data().deviceId();
    Device dev = devsvc.getDevice(devid);
    if (dev == null) {
        return new DefaultDeviceDescription(devid.uri(), FIBER_SWITCH,
                DEFAULT_MANUFACTURER, DEFAULT_DESCRIPTION_DATA,
                DEFAULT_DESCRIPTION_DATA, DEFAULT_DESCRIPTION_DATA,
                new ChassisId());
    }
    String reply = netconfGet(handler(), getProductInformationFilter());
    subscribe(handler());
    HierarchicalConfiguration cfg = configAt(reply, KEY_DATA_PRODINF);
    return new DefaultDeviceDescription(dev.id().uri(), FIBER_SWITCH,
            cfg.getString(KEY_MANUFACTURER), cfg.getString(KEY_HWVERSION),
            cfg.getString(KEY_SWVERSION), cfg.getString(KEY_SERIALNUMBER),
            dev.chassisId());
}
 
Example 2
Source File: CienaWaveserverDeviceDescription.java    From onos with Apache License 2.0 6 votes vote down vote up
@Override
public DeviceDescription discoverDeviceDetails() {
    log.debug("getting device description");
    DeviceService deviceService = checkNotNull(handler().get(DeviceService.class));
    DeviceId deviceId = handler().data().deviceId();
    Device device = deviceService.getDevice(deviceId);

    if (device == null) {
        return new DefaultDeviceDescription(deviceId.uri(),
                                            Device.Type.OTN,
                                            "Ciena",
                                            "WaveServer",
                                            "Unknown",
                                            "Unknown",
                                            new ChassisId());
    } else {
        return new DefaultDeviceDescription(device.id().uri(),
                                            Device.Type.OTN,
                                            device.manufacturer(),
                                            device.hwVersion(),
                                            device.swVersion(),
                                            device.serialNumber(),
                                            device.chassisId());
    }
}
 
Example 3
Source File: HuaweiDeviceDescription.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * Discovers device details, for huawei device by getting the system
 * information.
 *
 * @return device description
 */
@Override
public DeviceDescription discoverDeviceDetails() {
    NetconfSession session = getNetconfSession();
    String sysInfo;
    try {
        sysInfo = session.get(getVersionReq());
    } catch (NetconfException e) {
        throw new IllegalArgumentException(
                new NetconfException(DEV_INFO_FAILURE));
    }

    String[] details = parseSysInfoXml(sysInfo);
    DeviceService devSvc = checkNotNull(handler().get(DeviceService.class));
    DeviceId devId = handler().data().deviceId();
    Device dev = devSvc.getDevice(devId);
    return new DefaultDeviceDescription(dev.id().uri(), ROUTER,
                                        details[0], details[1],
                                        details[2], details[3],
                                        dev.chassisId());
}
 
Example 4
Source File: TapiDeviceDescriptionDiscovery.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public DeviceDescription discoverDeviceDetails() {
    log.debug("Getting device description");
    DeviceService deviceService = checkNotNull(handler().get(DeviceService.class));
    DeviceId deviceId = handler().data().deviceId();
    Device device = deviceService.getDevice(deviceId);

    if (device == null) {
        //TODO need to obtain from the device.
        return new DefaultDeviceDescription(deviceId.uri(),
                Device.Type.OLS,
                "Tapi",
                "0",
                "2.1",
                "Unknown",
                new ChassisId(),
                DefaultAnnotations.builder().set("protocol", "REST").build());
    } else {
        return new DefaultDeviceDescription(device.id().uri(),
                Device.Type.OLS,
                device.manufacturer(),
                device.hwVersion(),
                device.swVersion(),
                device.serialNumber(),
                device.chassisId());
    }
}
 
Example 5
Source File: CienaWaveserverAiDeviceDescription.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public DeviceDescription discoverDeviceDetails() {
    log.debug("Adding description for Waveserver Ai device");

    NetconfSession session = getNetconfSession();
    Device device = getDevice(handler().data().deviceId());

    try {
        XPath xp = XPathFactory.newInstance().newXPath();

        Node node = TEMPLATE_MANAGER.doRequest(session, "discoverDeviceDetails");
        String chassisId = xp.evaluate("waveserver-chassis/mac-addresses/chassis/base/text()", node);
        chassisId = chassisId.replace(":", "");
        SparseAnnotations annotationDevice = DefaultAnnotations.builder()
                .set("name", xp.evaluate("waveserver-system/host-name/current-host-name/text()", node))
                .build();
        return new DefaultDeviceDescription(device.id().uri(),
                                            Device.Type.OTN,
                                            "Ciena",
                                            "WaverserverAi",
                                            xp.evaluate("waveserver-software/status/active-version/text()",
                                                        node),
                                            xp.evaluate("waveserver-chassis/identification/serial-number/text()",
                                                        node),
                                            new ChassisId(Long.valueOf(chassisId, 16)),
                                            (SparseAnnotations) annotationDevice);
    } catch (NetconfException | XPathExpressionException e) {
        log.error("Unable to retrieve device information for device {}, {}", device.chassisId(), e);
    }

    return new DefaultDeviceDescription(device.id().uri(), Device.Type.OTN, "Ciena", "WaverserverAi", "unknown",
                                        "unknown", device.chassisId());
}
 
Example 6
Source File: LumentumRoadmDiscovery.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public DeviceDescription discoverDeviceDetails() {
    //TODO get device description
    DeviceService deviceService = checkNotNull(handler().get(DeviceService.class));
    DeviceId deviceId = handler().data().deviceId();
    Device device = deviceService.getDevice(deviceId);
    return new DefaultDeviceDescription(device.id().uri(), Device.Type.ROADM,
                                        "Lumentum", "SDN ROADM", "1.0", "v1",
                                        device.chassisId(), (SparseAnnotations) device.annotations());
}
 
Example 7
Source File: TopologySimulator.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Produces a device description from the given device.
 *
 * @param device device to copy
 * @return device description
 */
static DeviceDescription description(Device device) {
    return new DefaultDeviceDescription(device.id().uri(), device.type(),
                                        device.manufacturer(),
                                        device.hwVersion(), device.swVersion(),
                                        device.serialNumber(), device.chassisId());
}
 
Example 8
Source File: BasicDeviceOperator.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a description of the given device.
 *
 * @param device the device
 * @return a description of the device
 */
public static DeviceDescription descriptionOf(Device device) {
    checkNotNull(device, "Must supply non-null Device");
    return new DefaultDeviceDescription(device.id().uri(), device.type(),
            device.manufacturer(), device.hwVersion(),
            device.swVersion(), device.serialNumber(),
            device.chassisId(), (SparseAnnotations) device.annotations());
}