当前位置: 首页>>代码示例>>Java>>正文


Java Device.annotations方法代码示例

本文整理汇总了Java中org.onosproject.net.Device.annotations方法的典型用法代码示例。如果您正苦于以下问题:Java Device.annotations方法的具体用法?Java Device.annotations怎么用?Java Device.annotations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.onosproject.net.Device的用法示例。


在下文中一共展示了Device.annotations方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: populateDescription

import org.onosproject.net.Device; //导入方法依赖的package包/类
private DeviceDescription populateDescription(ISnmpSession session, Device device) {
    NetworkDevice networkDevice = new NetworkDevice(CLASS_REGISTRY,
                                                    session.getAddress().getHostAddress());
    try {
        session.walkDevice(networkDevice, Collections.singletonList(CLASS_REGISTRY.getClassToOidMap().get(
                System.class)));

        com.btisystems.mibbler.mibs.netsnmp.netsnmp.mib_2.System systemTree =
                (com.btisystems.mibbler.mibs.netsnmp.netsnmp.mib_2.System)
                        networkDevice.getRootObject().getEntity(CLASS_REGISTRY.getClassToOidMap().get(
                                com.btisystems.mibbler.mibs.netsnmp.netsnmp.mib_2.System.class));
        if (systemTree != null) {
            // TODO SNMP sys-contacts may be verbose; ONOS-GUI doesn't abbreviate fields neatly;
            // so cut it here until supported in prop displayer
            String manufacturer = StringUtils.abbreviate(systemTree.getSysContact(), 20);
            return new DefaultDeviceDescription(device.id().uri(), device.type(),
                                                manufacturer, UNKNOWN, UNKNOWN, UNKNOWN,
                                                device.chassisId(), (SparseAnnotations) device.annotations());
        }
    } catch (IOException ex) {
        throw new IllegalArgumentException("Error reading details for device." + session.getAddress(), ex);
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:NetSnmpDeviceDescriptor.java

示例2: populateDescription

import org.onosproject.net.Device; //导入方法依赖的package包/类
private DeviceDescription populateDescription(ISnmpSession session, Device device) {
    NetworkDevice networkDevice = new NetworkDevice(CLASS_REGISTRY,
                                                    session.getAddress().getHostAddress());
    try {
        session.walkDevice(networkDevice, Collections.singletonList(CLASS_REGISTRY.getClassToOidMap().get(
                System.class)));

        com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.mib_2.System systemTree =
                (com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.mib_2.System)
                        networkDevice.getRootObject().getEntity(CLASS_REGISTRY.getClassToOidMap().get(
                                com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.mib_2.System.class));
        if (systemTree != null) {
            String[] systemComponents = systemTree.getSysDescr().split(";");
            return new DefaultDeviceDescription(device.id().uri(), device.type(),
                                                systemComponents[0], systemComponents[2],
                                                systemComponents[3], UNKNOWN, device.chassisId(),
                                                (SparseAnnotations) device.annotations());
        }
    } catch (IOException ex) {
        throw new IllegalArgumentException("Error reading details for device." + session.getAddress(), ex);
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:Bti7000DeviceDescriptor.java

示例3: getLsrId

import org.onosproject.net.Device; //导入方法依赖的package包/类
/**
 * Retrieve lsr-id from device annotation.
 *
 * @param deviceId specific device id from which lsr-id needs to be retrieved
 * @return lsr-id of a device
 */
public String getLsrId(DeviceId deviceId) {
    checkNotNull(deviceId, DEVICE_ID_NULL);
    Device device = deviceService.getDevice(deviceId);
    if (device == null) {
        log.debug("Device is not available for device id {} in device service.", deviceId.toString());
        return null;
    }

    // Retrieve lsr-id from device
    if (device.annotations() == null) {
        log.debug("Device {} does not have annotation.", device.toString());
        return null;
    }

    String lsrId = device.annotations().value(LSR_ID);
    if (lsrId == null) {
        log.debug("The lsr-id of device {} is null.", device.toString());
        return null;
    }
    return lsrId;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:PceccSrTeBeHandler.java

示例4: deviceDetails

import org.onosproject.net.Device; //导入方法依赖的package包/类
protected PropertyPanel deviceDetails(DeviceId deviceId, long sid) {
    Device device = deviceService.getDevice(deviceId);
    Annotations annot = device.annotations();
    String name = annot.value(AnnotationKeys.NAME);
    int portCount = deviceService.getPorts(deviceId).size();
    int flowCount = getFlowCount(deviceId);
    int tunnelCount = getTunnelCount(deviceId);

    String title = isNullOrEmpty(name) ? deviceId.toString() : name;
    String typeId = device.type().toString().toLowerCase();

    PropertyPanel pp = new PropertyPanel(title, typeId)
        .id(deviceId.toString())

        .addProp(Properties.URI, deviceId.toString())
        .addProp(Properties.VENDOR, device.manufacturer())
        .addProp(Properties.HW_VERSION, device.hwVersion())
        .addProp(Properties.SW_VERSION, device.swVersion())
        .addProp(Properties.SERIAL_NUMBER, device.serialNumber())
        .addProp(Properties.PROTOCOL, annot.value(AnnotationKeys.PROTOCOL))
        .addSeparator()

        .addProp(Properties.LATITUDE, annot.value(AnnotationKeys.LATITUDE))
        .addProp(Properties.LONGITUDE, annot.value(AnnotationKeys.LONGITUDE))
        .addSeparator()

        .addProp(Properties.PORTS, portCount)
        .addProp(Properties.FLOWS, flowCount)
        .addProp(Properties.TUNNELS, tunnelCount)

        .addButton(CoreButtons.SHOW_DEVICE_VIEW)
        .addButton(CoreButtons.SHOW_FLOW_VIEW)
        .addButton(CoreButtons.SHOW_PORT_VIEW)
        .addButton(CoreButtons.SHOW_GROUP_VIEW)
        .addButton(CoreButtons.SHOW_METER_VIEW);

    return pp;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:39,代码来源:TopologyViewMessageHandlerBase.java

示例5: discoverDeviceDetails

import org.onosproject.net.Device; //导入方法依赖的package包/类
@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());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:LumentumRoadmDeviceDescription.java

示例6: isSuppressed

import org.onosproject.net.Device; //导入方法依赖的package包/类
public boolean isSuppressed(Device device) {
    if (suppressedDeviceType.contains(device.type())) {
        return true;
    }
    final Annotations annotations = device.annotations();
    if (containsSuppressionAnnotation(annotations)) {
        return true;
    }
    return false;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:SuppressionRules.java

示例7: getPeer

import org.onosproject.net.Device; //导入方法依赖的package包/类
BgpPeer getPeer(DeviceId deviceId) {
    Device d = deviceService.getDevice(deviceId);
    Annotations a = d != null ? d.annotations() : null;
    String ipAddress = a.value(FLOW_PEER);
    BgpId bgpId = BgpId.bgpId(IpAddress.valueOf(ipAddress));
    BgpPeer peer = bgpController.getPeer(bgpId);
    return peer;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:BgpcepFlowRuleProvider.java

示例8: validatePeer

import org.onosproject.net.Device; //导入方法依赖的package包/类
/**
 * Validates the device id is a flow peer or not.
 *
 * @param deviceId device to which the flow needed to be pushed.
 * @return true if success else false
 */
boolean validatePeer(DeviceId deviceId) {
    boolean ret = false;
    Device d = deviceService.getDevice(deviceId);
    Annotations a = d != null ? d.annotations() : null;
    String ipAddress = a.value(FLOW_PEER);
    if (ipAddress != null) {
        ret = true;
    }
    return ret;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:BgpFlowForwarderImpl.java

示例9: allocateNodeLabel

import org.onosproject.net.Device; //导入方法依赖的package包/类
/**
 * Allocates node label to specific device.
 *
 * @param specificDevice device to which node label needs to be allocated
 */
public void allocateNodeLabel(Device specificDevice) {
    checkNotNull(specificDevice, DEVICE_NULL);

    DeviceId deviceId = specificDevice.id();

    // Retrieve lsrId of a specific device
    if (specificDevice.annotations() == null) {
        log.debug("Device {} does not have annotations.", specificDevice.toString());
        return;
    }

    String lsrId = specificDevice.annotations().value(LSRID);
    if (lsrId == null) {
        log.debug("Unable to retrieve lsr-id of a device {}.", specificDevice.toString());
        return;
    }

    // Get capability config from netconfig
    DeviceCapability cfg = netCfgService.getConfig(DeviceId.deviceId(lsrId), DeviceCapability.class);
    if (cfg == null) {
        log.error("Unable to find corresponding capability for a lsrd {} from NetConfig.", lsrId);
        // Save info. When PCEP session is comes up then allocate node-label
        lsrIdDeviceIdMap.put(lsrId, specificDevice.id());
        return;
    }

    // Check whether device has SR-TE Capability
    if (cfg.labelStackCap()) {
        srTeHandler.allocateNodeLabel(deviceId, lsrId);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:37,代码来源:PceManager.java

示例10: releaseNodeLabel

import org.onosproject.net.Device; //导入方法依赖的package包/类
/**
 * Releases node label of a specific device.
 *
 * @param specificDevice this device label and lsr-id information will be
 *            released in other existing devices
 */
public void releaseNodeLabel(Device specificDevice) {
    checkNotNull(specificDevice, DEVICE_NULL);

    DeviceId deviceId = specificDevice.id();

    // Retrieve lsrId of a specific device
    if (specificDevice.annotations() == null) {
        log.debug("Device {} does not have annotations.", specificDevice.toString());
        return;
    }

    String lsrId = specificDevice.annotations().value(LSRID);
    if (lsrId == null) {
        log.debug("Unable to retrieve lsr-id of a device {}.", specificDevice.toString());
        return;
    }

    // Get capability config from netconfig
    DeviceCapability cfg = netCfgService.getConfig(DeviceId.deviceId(lsrId), DeviceCapability.class);
    if (cfg == null) {
        log.error("Unable to find corresponding capabilty for a lsrd {} from NetConfig.", lsrId);
        return;
    }

    // Check whether device has SR-TE Capability
    if (cfg.labelStackCap()) {
        if (!srTeHandler.releaseNodeLabel(deviceId, lsrId)) {
            log.error("Unable to release node label for a device id {}.", deviceId.toString());
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:38,代码来源:PceManager.java

示例11: getLocation

import org.onosproject.net.Device; //导入方法依赖的package包/类
private GeoLocation getLocation(DeviceId deviceId) {
    Device d = deviceService.getDevice(deviceId);
    Annotations a = d != null ? d.annotations() : null;
    double latitude = getDouble(a, AnnotationKeys.LATITUDE);
    double longitude = getDouble(a, AnnotationKeys.LONGITUDE);
    return latitude == MAX_VALUE || longitude == MAX_VALUE ? null :
            new GeoLocation(latitude, longitude);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:GeoDistanceLinkWeight.java

示例12: descriptionOf

import org.onosproject.net.Device; //导入方法依赖的package包/类
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());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:BasicDeviceOperator.java

示例13: modifyDeviceDetails

import org.onosproject.net.Device; //导入方法依赖的package包/类
@Override
public void modifyDeviceDetails(PropertyPanel pp, DeviceId deviceId) {

     pp.title(MY_TITLE);

     DeviceService deviceService = AbstractShellCommand.get(DeviceService.class);

     pp.removeAllProps();

     pp.removeButtons(CoreButtons.SHOW_PORT_VIEW)
            .removeButtons(CoreButtons.SHOW_GROUP_VIEW)
            .removeButtons(CoreButtons.SHOW_METER_VIEW);

     if (deviceService != null) {

        Device device = deviceService.getDevice(deviceId);
        Annotations annots = device.annotations();

        String routerId = annots.value(AnnotationKeys.ROUTER_ID);
        String type = annots.value(AnnotationKeys.TYPE);
        String asNumber = annots.value(AS_NUMBER);
        String domain = annots.value(DOMAIN_IDENTIFIER);
        String abrStatus = annots.value(ABR_BIT);
        String asbrStatus = annots.value(ASBR_BIT);

        if (type != null) {
            pp.addProp("Type", type);
        }

        if (routerId != null) {
            pp.addProp("Router-ID", routerId);
        }

        if (asNumber != null) {
            pp.addProp("AS Number", asNumber);
        }

        if (domain != null) {
            pp.addProp("Domain ID", domain);
        }

        if (abrStatus != null) {
            pp.addProp("ABR Role", abrStatus);
        }

        if (asbrStatus != null) {
            pp.addProp("ASBR Role", asbrStatus);
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:51,代码来源:PceWebTopovOverlay.java


注:本文中的org.onosproject.net.Device.annotations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。