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 String
GRID_X
Key for grid X coordinate.static String
GRID_Y
Key for grid Y coordinate.static String
LATITUDE
Key for latitude.static String
LOC_TYPE
Key for location type (geo or grid).static String
LOC_TYPE_GEO
static String
LOC_TYPE_GRID
static String
LOC_TYPE_NONE
static String
LONGITUDE
Key for longitude.static String
NAME
Key for friendly name.protected static String
OWNER
Key for owner.protected static String
RACK_ADDRESS
Key for rack address.protected static String
ROLES
Key for roles.static 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(Double x)
Sets the element grid x-coordinate.double
gridY()
Returns element grid y-coordinate.BasicElementConfig
gridY(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(Double latitude)
Sets the element latitude.String
locType()
Returns the location type (geo or grid) for the element in the Topology View.BasicElementConfig
locType(String locType)
Sets the location type (geo or grid) for the element in the Topology View.double
longitude()
Returns element longitude.BasicElementConfig
longitude(Double longitude)
Sets the element longitude.String
name()
Returns friendly label for the element.BasicElementConfig
name(String name)
Sets friendly label for the element.String
owner()
Returns owner of the element.BasicElementConfig
owner(String owner)
Sets the owner of the element.String
rackAddress()
Returns the element rack address.BasicElementConfig
rackAddress(String address)
Sets element rack address.Set<String>
roles()
Returns set of roles assigned to the element.BasicElementConfig
roles(Set<String> roles)
Sets the roles of the element.String
uiType()
Returns the UI type (glyph image to be used) for the element in the Topology View.BasicElementConfig
uiType(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 String NAME
Key for friendly name.- See Also:
- Constant Field Values
-
UI_TYPE
public static final String UI_TYPE
Key for UI type (glyph identifier).- See Also:
- Constant Field Values
-
LOC_TYPE
public static final String LOC_TYPE
Key for location type (geo or grid).- See Also:
- Constant Field Values
-
LATITUDE
public static final String LATITUDE
Key for latitude.- See Also:
- Constant Field Values
-
LONGITUDE
public static final String LONGITUDE
Key for longitude.- See Also:
- Constant Field Values
-
GRID_Y
public static final String GRID_Y
Key for grid Y coordinate.- See Also:
- Constant Field Values
-
GRID_X
public static final String GRID_X
Key for grid X coordinate.- See Also:
- Constant Field Values
-
RACK_ADDRESS
protected static final String RACK_ADDRESS
Key for rack address.- See Also:
- Constant Field Values
-
OWNER
protected static final String OWNER
Key for owner.- See Also:
- Constant Field Values
-
ROLES
protected static final 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 String LOC_TYPE_GEO
- See Also:
- Constant Field Values
-
LOC_TYPE_GRID
public static final String LOC_TYPE_GRID
- See Also:
- Constant Field Values
-
LOC_TYPE_NONE
public static final String LOC_TYPE_NONE
- See Also:
- Constant Field Values
-
-
Method Detail
-
name
public 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(String name)
Sets friendly label for the element.- Parameters:
name
- new friendly label; null to clear- Returns:
- self
-
uiType
public 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(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 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(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(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(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(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(Double x)
Sets the element grid x-coordinate.- Parameters:
x
- new x-coordinate; null to clear- Returns:
- self
-
rackAddress
public String rackAddress()
Returns the element rack address.- Returns:
- rack address; null if not set
-
rackAddress
public BasicElementConfig rackAddress(String address)
Sets element rack address.- Parameters:
address
- new rack address; null to clear- Returns:
- self
-
owner
public String owner()
Returns owner of the element.- Returns:
- owner or null if not set
-
owner
public BasicElementConfig owner(String owner)
Sets the owner of the element.- Parameters:
owner
- new owner; null to clear- Returns:
- self
-
roles
public Set<String> roles()
Returns set of roles assigned to the element.- Returns:
- set of roles
-
roles
public BasicElementConfig roles(Set<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.
-
-