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