Class BasicLinkConfig
- java.lang.Object
-
- org.onosproject.net.config.Config<S>
-
- org.onosproject.net.config.basics.AllowedEntityConfig<LinkKey>
-
- org.onosproject.net.config.basics.BasicLinkConfig
-
public final class BasicLinkConfig extends AllowedEntityConfig<LinkKey>
Basic configuration for network infrastructure link.
-
-
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
BANDWIDTH
static java.lang.String
CONFIG_KEY
Configuration key forDeviceInjectionConfig
.static java.lang.String
IS_BIDIRECTIONAL
static java.lang.String
IS_DURABLE
static java.lang.String
LATENCY
static java.lang.String
METRIC
static java.lang.String
TYPE
-
Fields inherited from class org.onosproject.net.config.basics.AllowedEntityConfig
ALLOWED
-
-
Constructor Summary
Constructors Constructor Description BasicLinkConfig()
Create aBasicLinkConfig
instance.BasicLinkConfig(LinkKey linkKey)
Create aBasicLinkConfig
for specified Device.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
bandwidth()
Returns link bandwidth in terms of Mbps.BasicLinkConfig
bandwidth(java.lang.Long bandwidth)
Sets the link bandwidth.boolean
isBidirectional()
Returns if link is bidirectional in the network model or not.BasicLinkConfig
isBidirectional(java.lang.Boolean isBidirectional)
Sets durability for this link.java.lang.Boolean
isDurable()
Returns if link is durable in the network model or not.BasicLinkConfig
isDurable(java.lang.Boolean isDurable)
Sets durability for this link.boolean
isTypeConfigured()
Returns if the link type is configured.boolean
isValid()
Indicates whether or not the backing JSON node contains valid data.java.time.Duration
latency()
Returns link latency in terms of nanos.BasicLinkConfig
latency(java.time.Duration latency)
Sets the link latency.double
metric()
Returns link metric value for use byMetricLinkWeight
function.BasicLinkConfig
metric(java.lang.Double metric)
Sets the link metric for use byMetricLinkWeight
function.Link.Type
type()
Returns the link type.BasicLinkConfig
type(Link.Type type)
Sets the link type.-
Methods inherited from class org.onosproject.net.config.basics.AllowedEntityConfig
isAllowed, isAllowed
-
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
-
-
-
-
Field Detail
-
CONFIG_KEY
public static final java.lang.String CONFIG_KEY
Configuration key forDeviceInjectionConfig
.- See Also:
- Constant Field Values
-
TYPE
public static final java.lang.String TYPE
- See Also:
- Constant Field Values
-
METRIC
public static final java.lang.String METRIC
- See Also:
- Constant Field Values
-
LATENCY
public static final java.lang.String LATENCY
- See Also:
- Constant Field Values
-
BANDWIDTH
public static final java.lang.String BANDWIDTH
- See Also:
- Constant Field Values
-
IS_DURABLE
public static final java.lang.String IS_DURABLE
- See Also:
- Constant Field Values
-
IS_BIDIRECTIONAL
public static final java.lang.String IS_BIDIRECTIONAL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BasicLinkConfig
public BasicLinkConfig(LinkKey linkKey)
Create aBasicLinkConfig
for specified Device.Note: created instance is not bound to NetworkConfigService, cannot use
Config.apply()
. Must be passed to the service using NetworkConfigService#applyConfig- Parameters:
linkKey
- subject of this Config
-
BasicLinkConfig
public BasicLinkConfig()
Create aBasicLinkConfig
instance.Note: created instance needs to be initialized by #init(..) before using.
-
-
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.
-
isTypeConfigured
public boolean isTypeConfigured()
Returns if the link type is configured.- Returns:
- true if config contains link type
-
type
public Link.Type type()
Returns the link type.- Returns:
- link type override
-
type
public BasicLinkConfig type(Link.Type type)
Sets the link type.- Parameters:
type
- link type override- Returns:
- self
-
metric
public double metric()
Returns link metric value for use byMetricLinkWeight
function.- Returns:
- link metric; -1 if not set
-
metric
public BasicLinkConfig metric(java.lang.Double metric)
Sets the link metric for use byMetricLinkWeight
function.- Parameters:
metric
- new metric; null to clear- Returns:
- self
-
latency
public java.time.Duration latency()
Returns link latency in terms of nanos.- Returns:
- link latency; -1 if not set
-
latency
public BasicLinkConfig latency(java.time.Duration latency)
Sets the link latency.- Parameters:
latency
- new latency; null to clear- Returns:
- self
-
bandwidth
public long bandwidth()
Returns link bandwidth in terms of Mbps.- Returns:
- link bandwidth; -1 if not set
-
bandwidth
public BasicLinkConfig bandwidth(java.lang.Long bandwidth)
Sets the link bandwidth.- Parameters:
bandwidth
- new bandwidth; null to clear- Returns:
- self
-
isDurable
public java.lang.Boolean isDurable()
Returns if link is durable in the network model or not.- Returns:
- true for durable, false otherwise
-
isDurable
public BasicLinkConfig isDurable(java.lang.Boolean isDurable)
Sets durability for this link.- Parameters:
isDurable
- true for durable, false otherwise- Returns:
- this BasicLinkConfig
-
isBidirectional
public boolean isBidirectional()
Returns if link is bidirectional in the network model or not.- Returns:
- true for bidirectional, false otherwise
-
isBidirectional
public BasicLinkConfig isBidirectional(java.lang.Boolean isBidirectional)
Sets durability for this link.- Parameters:
isBidirectional
- true for directional, false otherwise- Returns:
- this BasicLinkConfig
-
-