Class HostAnnotationConfig
- java.lang.Object
-
- org.onosproject.net.config.Config<S>
-
- org.onosproject.net.config.BaseConfig<HostId>
-
- org.onosproject.net.config.basics.HostAnnotationConfig
-
- All Implemented Interfaces:
CodecContext
public class HostAnnotationConfig extends BaseConfig<HostId>
Configuration to add extra annotations to a host 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 forHostAnnotationConfig
.
-
Constructor Summary
Constructors Constructor Description HostAnnotationConfig()
Create a detachedHostAnnotationConfig
.HostAnnotationConfig(HostId hostId)
Create a detachedHostAnnotationConfig
for specified host.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HostAnnotationConfig
annotation(java.lang.String key)
Remove configuration about specified key.HostAnnotationConfig
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 Host.HostAnnotationConfig
annotations(java.util.Map<java.lang.String,java.lang.String> replace)
Sets annotations to add to a Host.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 forHostAnnotationConfig
.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HostAnnotationConfig
public HostAnnotationConfig()
Create a detachedHostAnnotationConfig
.Note: created instance needs to be initialized by #init(..) before using.
-
HostAnnotationConfig
public HostAnnotationConfig(HostId hostId)
Create a detachedHostAnnotationConfig
for specified host.Note: created instance is not bound to NetworkConfigService, thus cannot use
Config.apply()
. Must be passed to the service using NetworkConfigService#applyConfig- Parameters:
hostId
- Host 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 Host.- Returns:
- annotations as a map. null value represent key removal request
-
annotations
public HostAnnotationConfig annotations(java.util.Map<java.lang.String,java.lang.String> replace)
Sets annotations to add to a Host.- Parameters:
replace
- annotations to be added by this configuration. null value represent key removal request- Returns:
- self
-
annotation
public HostAnnotationConfig 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 HostAnnotationConfig annotation(java.lang.String key)
Remove configuration about specified key.- Parameters:
key
- annotations key- Returns:
- self
-
-