Package org.onosproject.net
Class DefaultDevice
- java.lang.Object
-
- All Implemented Interfaces:
Annotated
,Device
,Projectable
,Element
,Provided
public class DefaultDevice extends AbstractElement implements Device
Default infrastructure device model implementation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
DefaultDevice.DeviceDriverData
Projection of the parent entity as a driver data entity.-
Nested classes/interfaces inherited from class org.onosproject.net.AbstractProjectableModel
AbstractProjectableModel.AnnotationDriverData
-
Nested classes/interfaces inherited from interface org.onosproject.net.Device
Device.Type
-
-
Field Summary
-
Fields inherited from class org.onosproject.net.AbstractElement
id
-
Fields inherited from class org.onosproject.net.AbstractProjectableModel
NO_DRIVER, NO_DRIVER_SERVICE
-
-
Constructor Summary
Constructors Constructor Description DefaultDevice(ProviderId providerId, DeviceId id, Device.Type type, java.lang.String manufacturer, java.lang.String hwVersion, java.lang.String swVersion, java.lang.String serialNumber, ChassisId chassisId, Annotations... annotations)
Creates a network element attributed to the specified provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <B extends Behaviour>
Bas(java.lang.Class<B> projectionClass)
Returns the specified projection of this entity if such projection is supported.protected DriverData
asData()
Returns self as an immutable driver data instance.ChassisId
chassisId()
Returns the device chassis id.boolean
equals(java.lang.Object obj)
int
hashCode()
java.lang.String
hwVersion()
Returns the device hardware version.DeviceId
id()
Returns the device identifier.protected Driver
locateDriver()
Locates the driver to be used by this entity.java.lang.String
manufacturer()
Returns the device manufacturer name.java.lang.String
serialNumber()
Returns the device serial number.java.lang.String
swVersion()
Returns the device software version.java.lang.String
toString()
Device.Type
type()
Returns the type of the infrastructure device.-
Methods inherited from class org.onosproject.net.AbstractProjectableModel
bindAndCheckDriver, bindDriver, driver, driverService, is, setDriverService
-
Methods inherited from class org.onosproject.net.AbstractModel
providerId
-
Methods inherited from class org.onosproject.net.AbstractAnnotated
annotations
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.onosproject.net.Annotated
annotations
-
Methods inherited from interface org.onosproject.net.driver.Projectable
is, project
-
Methods inherited from interface org.onosproject.net.Provided
providerId
-
-
-
-
Constructor Detail
-
DefaultDevice
public DefaultDevice(ProviderId providerId, DeviceId id, Device.Type type, java.lang.String manufacturer, java.lang.String hwVersion, java.lang.String swVersion, java.lang.String serialNumber, ChassisId chassisId, Annotations... annotations)
Creates a network element attributed to the specified provider.- Parameters:
providerId
- identity of the providerid
- device identifiertype
- device typemanufacturer
- device manufacturerhwVersion
- device HW versionswVersion
- device SW versionserialNumber
- device serial numberchassisId
- chassis idannotations
- optional key/value annotations
-
-
Method Detail
-
type
public Device.Type type()
Description copied from interface:Device
Returns the type of the infrastructure device.
-
manufacturer
public java.lang.String manufacturer()
Description copied from interface:Device
Returns the device manufacturer name.- Specified by:
manufacturer
in interfaceDevice
- Returns:
- manufacturer name
-
hwVersion
public java.lang.String hwVersion()
Description copied from interface:Device
Returns the device hardware version.
-
swVersion
public java.lang.String swVersion()
Description copied from interface:Device
Returns the device software version.
-
serialNumber
public java.lang.String serialNumber()
Description copied from interface:Device
Returns the device serial number.- Specified by:
serialNumber
in interfaceDevice
- Returns:
- serial number
-
chassisId
public ChassisId chassisId()
Description copied from interface:Device
Returns the device chassis id.
-
as
public <B extends Behaviour> B as(java.lang.Class<B> projectionClass)
Description copied from interface:Projectable
Returns the specified projection of this entity if such projection is supported.- Specified by:
as
in interfaceProjectable
- Overrides:
as
in classAbstractProjectableModel
- Type Parameters:
B
- type of behaviour- Parameters:
projectionClass
- requested projection class- Returns:
- projection instance
-
asData
protected DriverData asData()
Returns self as an immutable driver data instance.- Overrides:
asData
in classAbstractProjectableModel
- Returns:
- self as driver data
-
locateDriver
protected Driver locateDriver()
Description copied from class:AbstractProjectableModel
Locates the driver to be used by this entity.The default implementation derives the driver based on the
driver
annotation value.- Overrides:
locateDriver
in classAbstractProjectableModel
- Returns:
- driver for alternate projections of this model entity or null if no driver is expected or driver is not found
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-