Package org.onosproject.net.key
Class DeviceKey
- java.lang.Object
-
- org.onosproject.net.AbstractAnnotated
-
- org.onosproject.net.key.DeviceKey
-
- All Implemented Interfaces:
Annotated
- Direct Known Subclasses:
CommunityName,UsernamePassword
@Beta public class DeviceKey extends AbstractAnnotated
Abstraction of a device key.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDeviceKey.Typetype of the device key.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CommunityNameasCommunityName()Returns a community name object from the device key.UsernamePasswordasUsernamePassword()Returns a username and password object from the device key.static DeviceKeycreateDeviceKeyUsingCommunityName(DeviceKeyId id, String label, String name)Method to create a device key of type CommunityName.static DeviceKeycreateDeviceKeyUsingSshKey(DeviceKeyId id, String label, String username, String password, String sshkey)Method to create a device key of type SSL_KEY.static DeviceKeycreateDeviceKeyUsingUsernamePassword(DeviceKeyId id, String label, String username, String password)Method to create a device key of type USERNAME_PASSWORD.DeviceKeyIddeviceKeyId()Returns the device key identifier of the device key.Stringlabel()Returns the label of device key.DeviceKey.Typetype()Returns the type of the device key.-
Methods inherited from class org.onosproject.net.AbstractAnnotated
annotations
-
-
-
-
Method Detail
-
deviceKeyId
public DeviceKeyId deviceKeyId()
Returns the device key identifier of the device key.- Returns:
- device key identifier
-
label
public String label()
Returns the label of device key.- Returns:
- label
-
type
public DeviceKey.Type type()
Returns the type of the device key.- Returns:
- type
-
createDeviceKeyUsingCommunityName
public static DeviceKey createDeviceKeyUsingCommunityName(DeviceKeyId id, String label, String name)
Method to create a device key of type CommunityName.- Parameters:
id- device key identifierlabel- optional label for this device keyname- community name for this device key- Returns:
- device key
-
asCommunityName
public CommunityName asCommunityName()
Returns a community name object from the device key.- Returns:
- community name
-
createDeviceKeyUsingUsernamePassword
public static DeviceKey createDeviceKeyUsingUsernamePassword(DeviceKeyId id, String label, String username, String password)
Method to create a device key of type USERNAME_PASSWORD.- Parameters:
id- device key identifierlabel- optional label for this device keyusername- username for accessing this devicepassword- password for accessing this device- Returns:
- device key
-
createDeviceKeyUsingSshKey
public static DeviceKey createDeviceKeyUsingSshKey(DeviceKeyId id, String label, String username, String password, String sshkey)
Method to create a device key of type SSL_KEY.- Parameters:
id- device key identifierlabel- optional label for this device keyusername- username for accessing this devicepassword- password for accessing this device SSH keysshkey- SSH key for accessing this device- Returns:
- device key
-
asUsernamePassword
public UsernamePassword asUsernamePassword()
Returns a username and password object from the device key.- Returns:
- username and password
-
-