本文整理汇总了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);
}
示例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);
}
示例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);
}