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.StringBANDWIDTHstatic java.lang.StringCONFIG_KEYConfiguration key forDeviceInjectionConfig.static java.lang.StringIS_BIDIRECTIONALstatic java.lang.StringIS_DURABLEstatic java.lang.StringLATENCYstatic java.lang.StringMETRICstatic java.lang.StringTYPE-
Fields inherited from class org.onosproject.net.config.basics.AllowedEntityConfig
ALLOWED
-
-
Constructor Summary
Constructors Constructor Description BasicLinkConfig()Create aBasicLinkConfiginstance.BasicLinkConfig(LinkKey linkKey)Create aBasicLinkConfigfor specified Device.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longbandwidth()Returns link bandwidth in terms of Mbps.BasicLinkConfigbandwidth(java.lang.Long bandwidth)Sets the link bandwidth.booleanisBidirectional()Returns if link is bidirectional in the network model or not.BasicLinkConfigisBidirectional(java.lang.Boolean isBidirectional)Sets durability for this link.java.lang.BooleanisDurable()Returns if link is durable in the network model or not.BasicLinkConfigisDurable(java.lang.Boolean isDurable)Sets durability for this link.booleanisTypeConfigured()Returns if the link type is configured.booleanisValid()Indicates whether or not the backing JSON node contains valid data.java.time.Durationlatency()Returns link latency in terms of nanos.BasicLinkConfiglatency(java.time.Duration latency)Sets the link latency.doublemetric()Returns link metric value for use byMetricLinkWeightfunction.BasicLinkConfigmetric(java.lang.Double metric)Sets the link metric for use byMetricLinkWeightfunction.Link.Typetype()Returns the link type.BasicLinkConfigtype(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 aBasicLinkConfigfor 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 aBasicLinkConfiginstance.Note: created instance needs to be initialized by #init(..) before using.
-
-
Method Detail
-
isValid
public boolean isValid()
Description copied from class:ConfigIndicates 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 byMetricLinkWeightfunction.- Returns:
- link metric; -1 if not set
-
metric
public BasicLinkConfig metric(java.lang.Double metric)
Sets the link metric for use byMetricLinkWeightfunction.- 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
-
-