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


Java BasicDeviceConfig.name方法代码示例

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


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

示例1: process

import org.onosproject.net.config.basics.BasicDeviceConfig; //导入方法依赖的package包/类
@Override
public void process(long sid, ObjectNode payload) {
    DeviceId deviceId = deviceId(string(payload, ID, ZERO_URI));
    String name = emptyToNull(string(payload, NAME, null));
    log.debug("Name change request: {} -- '{}'", deviceId, name);

    NetworkConfigService service = get(NetworkConfigService.class);
    BasicDeviceConfig cfg =
            service.addConfig(deviceId, BasicDeviceConfig.class);

    // Name attribute missing from the payload (or empty string)
    // means that the friendly name should be unset.
    cfg.name(name);
    cfg.apply();
    sendMessage(DEV_NAME_CHANGE_RESP, 0, payload);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:DeviceViewMessageHandler.java

示例2: process

import org.onosproject.net.config.basics.BasicDeviceConfig; //导入方法依赖的package包/类
@Override
public void process(ObjectNode payload) {
    DeviceId deviceId = deviceId(string(payload, ID, ZERO_URI));
    String name = emptyToNull(string(payload, NAME, null));
    log.debug("Name change request: {} -- '{}'", deviceId, name);

    NetworkConfigService service = get(NetworkConfigService.class);
    BasicDeviceConfig cfg =
            service.addConfig(deviceId, BasicDeviceConfig.class);

    // Name attribute missing from the payload (or empty string)
    // means that the friendly name should be unset.
    cfg.name(name);
    cfg.apply();
    sendMessage(DEV_NAME_CHANGE_RESP, payload);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:17,代码来源:DeviceViewMessageHandler.java

示例3: combine

import org.onosproject.net.config.basics.BasicDeviceConfig; //导入方法依赖的package包/类
/**
 * Generates an annotation from an existing annotation and DeviceConfig.
 *
 * @param bdc the device config entity from network config
 * @param an  the annotation
 * @return annotation combining both sources
 */
public static SparseAnnotations combine(BasicDeviceConfig bdc, SparseAnnotations an) {
    DefaultAnnotations.Builder newBuilder = DefaultAnnotations.builder();
    if (!Objects.equals(bdc.driver(), an.value(AnnotationKeys.DRIVER))) {
        newBuilder.set(AnnotationKeys.DRIVER, bdc.driver());
    }
    if (bdc.name() != null) {
        newBuilder.set(AnnotationKeys.NAME, bdc.name());
    }
    if (bdc.latitude() != DEFAULT_COORD) {
        newBuilder.set(AnnotationKeys.LATITUDE, Double.toString(bdc.latitude()));
    }
    if (bdc.longitude() != DEFAULT_COORD) {
        newBuilder.set(AnnotationKeys.LONGITUDE, Double.toString(bdc.longitude()));
    }
    if (bdc.rackAddress() != null) {
        newBuilder.set(AnnotationKeys.RACK_ADDRESS, bdc.rackAddress());
    }
    if (bdc.owner() != null) {
        newBuilder.set(AnnotationKeys.OWNER, bdc.owner());
    }
    if (bdc.managementAddress() != null) {
        newBuilder.set(AnnotationKeys.MANAGEMENT_ADDRESS, bdc.managementAddress());
    }
    DefaultAnnotations newAnnotations = newBuilder.build();
    return DefaultAnnotations.union(an, newAnnotations);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:34,代码来源:BasicDeviceOperator.java


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