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 class
DeviceKey.Type
type of the device key.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CommunityName
asCommunityName()
Returns a community name object from the device key.UsernamePassword
asUsernamePassword()
Returns a username and password object from the device key.static DeviceKey
createDeviceKeyUsingCommunityName(DeviceKeyId id, java.lang.String label, java.lang.String name)
Method to create a device key of type CommunityName.static DeviceKey
createDeviceKeyUsingSshKey(DeviceKeyId id, java.lang.String label, java.lang.String username, java.lang.String password, java.lang.String sshkey)
Method to create a device key of type SSL_KEY.static DeviceKey
createDeviceKeyUsingUsernamePassword(DeviceKeyId id, java.lang.String label, java.lang.String username, java.lang.String password)
Method to create a device key of type USERNAME_PASSWORD.DeviceKeyId
deviceKeyId()
Returns the device key identifier of the device key.java.lang.String
label()
Returns the label of device key.DeviceKey.Type
type()
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 java.lang.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, java.lang.String label, java.lang.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, java.lang.String label, java.lang.String username, java.lang.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, java.lang.String label, java.lang.String username, java.lang.String password, java.lang.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
-
-