Class DeviceAnnotationConfig
- java.lang.Object
-
- org.onosproject.net.config.Config<S>
-
- org.onosproject.net.config.BaseConfig<DeviceId>
-
- org.onosproject.net.config.basics.DeviceAnnotationConfig
-
- All Implemented Interfaces:
CodecContext
public class DeviceAnnotationConfig extends BaseConfig<DeviceId>
Configuration to add extra annotations to a device via netcfg subsystem.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.onosproject.net.config.Config
Config.FieldPresence
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CONFIG_KEY
"annotations" : a netcfg ConfigKey forDeviceAnnotationConfig
.
-
Constructor Summary
Constructors Constructor Description DeviceAnnotationConfig()
Create a detachedDeviceAnnotationConfig
.DeviceAnnotationConfig(DeviceId deviceId)
Create a detachedDeviceAnnotationConfig
for specified device.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DeviceAnnotationConfig
annotation(java.lang.String key)
Remove configuration about specified key.DeviceAnnotationConfig
annotation(java.lang.String key, java.lang.String value)
Add configuration to set or remove annotation entry.java.util.Map<java.lang.String,java.lang.String>
annotations()
Returns annotations to add to a Device.DeviceAnnotationConfig
annotations(java.util.Map<java.lang.String,java.lang.String> replace)
Sets annotations to add to a Device.boolean
isValid()
Indicates whether or not the backing JSON node contains valid data.-
Methods inherited from class org.onosproject.net.config.BaseConfig
codec, decode, getService, mapper
-
Methods inherited from class org.onosproject.net.config.Config
apply, clear, get, get, get, get, get, get, getList, getList, hasField, hasField, hasFields, hasFields, hasOnlyFields, hasOnlyFields, init, isBoolean, isBoolean, isConnectPoint, isConnectPoint, isDecimal, isDecimal, isIntegralNumber, isIntegralNumber, isIpAddress, isIpAddress, isIpPrefix, isIpPrefix, isMacAddress, isMacAddress, isNumber, isNumber, isString, isString, isTpPort, isTpPort, isValidLength, key, node, setList, setOrClear, setOrClear, setOrClear, setOrClear, setOrClear, setOrClear, setOrClear, subject, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.onosproject.codec.CodecContext
decode, encode
-
-
-
-
Field Detail
-
CONFIG_KEY
public static final java.lang.String CONFIG_KEY
"annotations" : a netcfg ConfigKey forDeviceAnnotationConfig
.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DeviceAnnotationConfig
public DeviceAnnotationConfig()
Create a detachedDeviceAnnotationConfig
.Note: created instance needs to be initialized by #init(..) before using.
-
DeviceAnnotationConfig
public DeviceAnnotationConfig(DeviceId deviceId)
Create a detachedDeviceAnnotationConfig
for specified device.Note: created instance is not bound to NetworkConfigService, thus cannot use
Config.apply()
. Must be passed to the service using NetworkConfigService#applyConfig- Parameters:
deviceId
- Device id
-
-
Method Detail
-
isValid
public boolean isValid()
Description copied from class:Config
Indicates whether or not the backing JSON node contains valid data.Default implementation returns true. Subclasses are expected to override this with their own validation. Implementations are free to throw a RuntimeException if data is invalid.
-
annotations
public java.util.Map<java.lang.String,java.lang.String> annotations()
Returns annotations to add to a Device.- Returns:
- annotations as a map. null value represent key removal request
-
annotations
public DeviceAnnotationConfig annotations(java.util.Map<java.lang.String,java.lang.String> replace)
Sets annotations to add to a Device.- Parameters:
replace
- annotations to be added by this configuration. null value represent key removal request- Returns:
- self
-
annotation
public DeviceAnnotationConfig annotation(java.lang.String key, java.lang.String value)
Add configuration to set or remove annotation entry.- Parameters:
key
- annotations keyvalue
- annotations value. specifying null removes the entry.- Returns:
- self
-
annotation
public DeviceAnnotationConfig annotation(java.lang.String key)
Remove configuration about specified key.- Parameters:
key
- annotations key- Returns:
- self
-
-