public final class BasicLinkConfig extends AllowedEntityConfig<LinkKey>
Config.FieldPresence
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BANDWIDTH |
static java.lang.String |
CONFIG_KEY
Configuration key for
DeviceInjectionConfig . |
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 |
ALLOWED
Constructor and Description |
---|
BasicLinkConfig()
Create a
BasicLinkConfig instance. |
BasicLinkConfig(LinkKey linkKey)
Create a
BasicLinkConfig for specified Device. |
Modifier and Type | Method and 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 by
MetricLinkWeight function. |
BasicLinkConfig |
metric(java.lang.Double metric)
Sets the link metric for use by
MetricLinkWeight function. |
Link.Type |
type()
Returns the link type.
|
BasicLinkConfig |
type(Link.Type type)
Sets the link type.
|
isAllowed, isAllowed
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
public static final java.lang.String CONFIG_KEY
DeviceInjectionConfig
.public static final java.lang.String TYPE
public static final java.lang.String METRIC
public static final java.lang.String LATENCY
public static final java.lang.String BANDWIDTH
public static final java.lang.String IS_DURABLE
public static final java.lang.String IS_BIDIRECTIONAL
public BasicLinkConfig(LinkKey linkKey)
BasicLinkConfig
for specified Device.
Note: created instance is not bound to NetworkConfigService,
cannot use Config.apply()
. Must be passed to the service
using NetworkConfigService#applyConfig
linkKey
- subject of this Configpublic BasicLinkConfig()
BasicLinkConfig
instance.
Note: created instance needs to be initialized by #init(..) before using.
public boolean isValid()
Config
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.
public boolean isTypeConfigured()
public Link.Type type()
public BasicLinkConfig type(Link.Type type)
type
- link type overridepublic double metric()
MetricLinkWeight
function.public BasicLinkConfig metric(java.lang.Double metric)
MetricLinkWeight
function.metric
- new metric; null to clearpublic java.time.Duration latency()
public BasicLinkConfig latency(java.time.Duration latency)
latency
- new latency; null to clearpublic long bandwidth()
public BasicLinkConfig bandwidth(java.lang.Long bandwidth)
bandwidth
- new bandwidth; null to clearpublic java.lang.Boolean isDurable()
public BasicLinkConfig isDurable(java.lang.Boolean isDurable)
isDurable
- true for durable, false otherwisepublic boolean isBidirectional()
public BasicLinkConfig isBidirectional(java.lang.Boolean isBidirectional)
isBidirectional
- true for directional, false otherwise