Class BasicElementConfig<S>
- java.lang.Object
-
- org.onosproject.net.config.Config<S>
-
- org.onosproject.net.config.basics.AllowedEntityConfig<S>
-
- org.onosproject.net.config.basics.BasicElementConfig<S>
-
- Direct Known Subclasses:
BasicDeviceConfig
,BasicHostConfig
,BasicRegionConfig
public abstract class BasicElementConfig<S> extends AllowedEntityConfig<S>
Basic configuration for network elements, e.g. devices, hosts. Such elements can have a friendly name, geo-coordinates (or grid-coordinates), logical rack coordinates and an owner entity.
-
-
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
GRID_X
Key for grid X coordinate.static java.lang.String
GRID_Y
Key for grid Y coordinate.static java.lang.String
LATITUDE
Key for latitude.static java.lang.String
LOC_TYPE
Key for location type (geo or grid).static java.lang.String
LOC_TYPE_GEO
static java.lang.String
LOC_TYPE_GRID
static java.lang.String
LOC_TYPE_NONE
static java.lang.String
LONGITUDE
Key for longitude.static java.lang.String
NAME
Key for friendly name.protected static java.lang.String
OWNER
Key for owner.protected static java.lang.String
RACK_ADDRESS
Key for rack address.protected static java.lang.String
ROLES
Key for roles.static java.lang.String
UI_TYPE
Key for UI type (glyph identifier).protected static double
ZERO_THRESHOLD
Threshold for detecting double value is zero.-
Fields inherited from class org.onosproject.net.config.basics.AllowedEntityConfig
ALLOWED
-
-
Constructor Summary
Constructors Constructor Description BasicElementConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
geoCoordsSet()
Returns true if the geographical coordinates (latitude and longitude) are set on this element; false otherwise.boolean
gridCoordsSet()
Returns true if the grid coordinates (gridY and gridX) are set on this element, i.e.double
gridX()
Returns element grid x-coordinate.BasicElementConfig
gridX(java.lang.Double x)
Sets the element grid x-coordinate.double
gridY()
Returns element grid y-coordinate.BasicElementConfig
gridY(java.lang.Double y)
Sets the element grid y-coordinate.boolean
isValid()
Indicates whether or not the backing JSON node contains valid data.double
latitude()
Returns element latitude.BasicElementConfig
latitude(java.lang.Double latitude)
Sets the element latitude.java.lang.String
locType()
Returns the location type (geo or grid) for the element in the Topology View.BasicElementConfig
locType(java.lang.String locType)
Sets the location type (geo or grid) for the element in the Topology View.double
longitude()
Returns element longitude.BasicElementConfig
longitude(java.lang.Double longitude)
Sets the element longitude.java.lang.String
name()
Returns friendly label for the element.BasicElementConfig
name(java.lang.String name)
Sets friendly label for the element.java.lang.String
owner()
Returns owner of the element.BasicElementConfig
owner(java.lang.String owner)
Sets the owner of the element.java.lang.String
rackAddress()
Returns the element rack address.BasicElementConfig
rackAddress(java.lang.String address)
Sets element rack address.java.util.Set<java.lang.String>
roles()
Returns set of roles assigned to the element.BasicElementConfig
roles(java.util.Set<java.lang.String> roles)
Sets the roles of the element.java.lang.String
uiType()
Returns the UI type (glyph image to be used) for the element in the Topology View.BasicElementConfig
uiType(java.lang.String uiType)
Sets the UI type (glyph image to be used) for the element in the Topology View.-
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
-
NAME
public static final java.lang.String NAME
Key for friendly name.- See Also:
- Constant Field Values
-
UI_TYPE
public static final java.lang.String UI_TYPE
Key for UI type (glyph identifier).- See Also:
- Constant Field Values
-
LOC_TYPE
public static final java.lang.String LOC_TYPE
Key for location type (geo or grid).- See Also:
- Constant Field Values
-
LATITUDE
public static final java.lang.String LATITUDE
Key for latitude.- See Also:
- Constant Field Values
-
LONGITUDE
public static final java.lang.String LONGITUDE
Key for longitude.- See Also:
- Constant Field Values
-
GRID_Y
public static final java.lang.String GRID_Y
Key for grid Y coordinate.- See Also:
- Constant Field Values
-
GRID_X
public static final java.lang.String GRID_X
Key for grid X coordinate.- See Also:
- Constant Field Values
-
RACK_ADDRESS
protected static final java.lang.String RACK_ADDRESS
Key for rack address.- See Also:
- Constant Field Values
-
OWNER
protected static final java.lang.String OWNER
Key for owner.- See Also:
- Constant Field Values
-
ROLES
protected static final java.lang.String ROLES
Key for roles.- See Also:
- Constant Field Values
-
ZERO_THRESHOLD
protected static final double ZERO_THRESHOLD
Threshold for detecting double value is zero.- See Also:
- Constant Field Values
-
LOC_TYPE_GEO
public static final java.lang.String LOC_TYPE_GEO
- See Also:
- Constant Field Values
-
LOC_TYPE_GRID
public static final java.lang.String LOC_TYPE_GRID
- See Also:
- Constant Field Values
-
LOC_TYPE_NONE
public static final java.lang.String LOC_TYPE_NONE
- See Also:
- Constant Field Values
-
-
Method Detail
-
name
public java.lang.String name()
Returns friendly label for the element. If not set, returns the element identifier.- Returns:
- friendly label or element identifier itself if not set
-
name
public BasicElementConfig name(java.lang.String name)
Sets friendly label for the element.- Parameters:
name
- new friendly label; null to clear- Returns:
- self
-
uiType
public java.lang.String uiType()
Returns the UI type (glyph image to be used) for the element in the Topology View. If not set, null is returned.- Returns:
- the UI type
-
uiType
public BasicElementConfig uiType(java.lang.String uiType)
Sets the UI type (glyph image to be used) for the element in the Topology View. Setting this to null will indicate that the default glyph image should be used for the element type.- Parameters:
uiType
- the UI type; null for default- Returns:
- self
-
locType
public java.lang.String locType()
Returns the location type (geo or grid) for the element in the Topology View. If not set, the type will be determined implicitly by latitude being set ("geo") or gridX being set ("grid"); otherwise returns the default of "none".- Returns:
- location type (string)
-
locType
public BasicElementConfig locType(java.lang.String locType)
Sets the location type (geo or grid) for the element in the Topology View. If null is passed, it will default to "geo".- Parameters:
locType
- the UI type; null for default- Returns:
- self
-
geoCoordsSet
public boolean geoCoordsSet()
Returns true if the geographical coordinates (latitude and longitude) are set on this element; false otherwise.- Returns:
- true if geo-coordinates are set; false otherwise
-
latitude
public double latitude()
Returns element latitude.- Returns:
- element latitude; 0.0 if (possibly) not set
- See Also:
geoCoordsSet()
-
latitude
public BasicElementConfig latitude(java.lang.Double latitude)
Sets the element latitude.- Parameters:
latitude
- new latitude; null to clear- Returns:
- self
-
longitude
public double longitude()
Returns element longitude.- Returns:
- element longitude; 0 if (possibly) not set
- See Also:
geoCoordsSet()
-
longitude
public BasicElementConfig longitude(java.lang.Double longitude)
Sets the element longitude.- Parameters:
longitude
- new longitude; null to clear- Returns:
- self
-
gridCoordsSet
public boolean gridCoordsSet()
Returns true if the grid coordinates (gridY and gridX) are set on this element, i.e. if locType is set to 'grid'; false otherwise.- Returns:
- true if grid coordinates are set; false otherwise.
-
gridY
public double gridY()
Returns element grid y-coordinate.- Returns:
- element y-coordinate
-
gridY
public BasicElementConfig gridY(java.lang.Double y)
Sets the element grid y-coordinate.- Parameters:
y
- new y-coordinate; null to clear- Returns:
- self
-
gridX
public double gridX()
Returns element grid x-coordinate.- Returns:
- element x-coordinate
-
gridX
public BasicElementConfig gridX(java.lang.Double x)
Sets the element grid x-coordinate.- Parameters:
x
- new x-coordinate; null to clear- Returns:
- self
-
rackAddress
public java.lang.String rackAddress()
Returns the element rack address.- Returns:
- rack address; null if not set
-
rackAddress
public BasicElementConfig rackAddress(java.lang.String address)
Sets element rack address.- Parameters:
address
- new rack address; null to clear- Returns:
- self
-
owner
public java.lang.String owner()
Returns owner of the element.- Returns:
- owner or null if not set
-
owner
public BasicElementConfig owner(java.lang.String owner)
Sets the owner of the element.- Parameters:
owner
- new owner; null to clear- Returns:
- self
-
roles
public java.util.Set<java.lang.String> roles()
Returns set of roles assigned to the element.- Returns:
- set of roles
-
roles
public BasicElementConfig roles(java.util.Set<java.lang.String> roles)
Sets the roles of the element.- Parameters:
roles
- new roles; null to clear- Returns:
- self
-
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.
-
-