mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-23 13:21:21 +02:00
minor formatting changes
Change-Id: I361955b820489793ffb8f6b9b9ff24d429e1dd99
This commit is contained in:
parent
82fd63255c
commit
fe3308fa13
@ -25,8 +25,10 @@ package org.onosproject.net;
|
||||
*/
|
||||
public final class AnnotationKeys {
|
||||
|
||||
|
||||
// Prohibit instantiation
|
||||
private AnnotationKeys() {}
|
||||
private AnnotationKeys() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Annotation key for instance name.
|
||||
@ -124,6 +126,16 @@ public final class AnnotationKeys {
|
||||
*/
|
||||
public static final String OWNER = "owner";
|
||||
|
||||
/**
|
||||
* Annotation key for the channel id.
|
||||
*/
|
||||
public static final String CHANNEL_ID = "channelId";
|
||||
|
||||
/**
|
||||
* Annotation key for the management address.
|
||||
*/
|
||||
public static final String MANAGEMENT_ADDRESS = "managementAddress";
|
||||
|
||||
/**
|
||||
* Returns the value annotated object for the specified annotation key.
|
||||
* The annotated value is expected to be String that can be parsed as double.
|
||||
|
@ -25,6 +25,7 @@ public class BasicDeviceConfig extends BasicElementConfig<DeviceId> {
|
||||
|
||||
public static final String TYPE = "type";
|
||||
public static final String DRIVER = "driver";
|
||||
public static final String MANAGEMENT_ADDRESS = "managementAddress";
|
||||
|
||||
/**
|
||||
* Returns the device type.
|
||||
@ -64,6 +65,25 @@ public class BasicDeviceConfig extends BasicElementConfig<DeviceId> {
|
||||
return (BasicElementConfig) setOrClear(DRIVER, driverName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the device management ip (ip:port).
|
||||
*
|
||||
* @return device management address (ip:port) or null if not set
|
||||
*/
|
||||
public String managementAddress() {
|
||||
return get(MANAGEMENT_ADDRESS, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the driver name.
|
||||
*
|
||||
* @param managementAddress new device management address (ip:port); null to clear
|
||||
* @return self
|
||||
*/
|
||||
public BasicElementConfig managementAddress(String managementAddress) {
|
||||
return (BasicElementConfig) setOrClear(MANAGEMENT_ADDRESS, managementAddress);
|
||||
}
|
||||
|
||||
// TODO: device port meta-data to be configured via BasicPortsConfig
|
||||
// TODO: device credentials/keys
|
||||
|
||||
|
@ -15,21 +15,21 @@
|
||||
*/
|
||||
package org.onosproject.net.device.impl;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import org.onosproject.net.config.ConfigOperator;
|
||||
import org.onosproject.net.config.basics.BasicDeviceConfig;
|
||||
import org.onosproject.net.AnnotationKeys;
|
||||
import org.onosproject.net.DefaultAnnotations;
|
||||
import org.onosproject.net.Device;
|
||||
import org.onosproject.net.SparseAnnotations;
|
||||
import org.onosproject.net.config.ConfigOperator;
|
||||
import org.onosproject.net.config.basics.BasicDeviceConfig;
|
||||
import org.onosproject.net.device.DefaultDeviceDescription;
|
||||
import org.onosproject.net.device.DeviceDescription;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
/**
|
||||
* Implementations of merge policies for various sources of device configuration
|
||||
* information. This includes applications, provides, and network configurations.
|
||||
@ -93,6 +93,9 @@ public final class BasicDeviceOperator implements ConfigOperator {
|
||||
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);
|
||||
}
|
||||
|
@ -323,8 +323,9 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
|
||||
ChassisId cId = new ChassisId(dpid.value());
|
||||
|
||||
SparseAnnotations annotations = DefaultAnnotations.builder()
|
||||
.set("protocol", sw.factory().getVersion().toString())
|
||||
.set("channelId", sw.channelId())
|
||||
.set(AnnotationKeys.PROTOCOL, sw.factory().getVersion().toString())
|
||||
.set(AnnotationKeys.CHANNEL_ID, sw.channelId())
|
||||
.set(AnnotationKeys.MANAGEMENT_ADDRESS, sw.channelId().split(":")[0])
|
||||
.build();
|
||||
|
||||
DeviceDescription description =
|
||||
|
Loading…
x
Reference in New Issue
Block a user