connect netconf devices through ssh key
Change-Id: I1a0961ffffd33559f903ead0634dbb5492e9a154
diff --git a/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java b/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
index 9e68636..b950b9f 100644
--- a/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
+++ b/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
@@ -161,6 +161,11 @@
public static final String REST_SERVER = "restServer";
/**
+ * Annotation key for the sshkey.
+ */
+ public static final String SSHKEY = "sshkey";
+
+ /**
* Returns the value annotated object for the specified annotation key.
* The annotated value is expected to be String that can be parsed as double.
* If parsing fails, the returned value will be 1.0.
diff --git a/core/api/src/main/java/org/onosproject/net/key/DeviceKey.java b/core/api/src/main/java/org/onosproject/net/key/DeviceKey.java
index 971a233..7511735 100644
--- a/core/api/src/main/java/org/onosproject/net/key/DeviceKey.java
+++ b/core/api/src/main/java/org/onosproject/net/key/DeviceKey.java
@@ -144,6 +144,25 @@
}
/**
+ * Method to create a device key of type SSL_KEY.
+ *
+ * @param id device key identifier
+ * @param label optional label for this device key
+ * @param username username for this device key
+ * @param password password for this device key
+ * @param sshkey sshkey for this device key
+ * @return device key
+ */
+ public static DeviceKey createDeviceKeyUsingSshKey(DeviceKeyId id, String label,
+ String username, String password, String sshkey) {
+ DefaultAnnotations annotations = builder().set(AnnotationKeys.USERNAME, username)
+ .set(AnnotationKeys.PASSWORD, password)
+ .set(AnnotationKeys.SSHKEY, sshkey).build();
+
+ return new DeviceKey(id, label, Type.SSL_KEY, annotations);
+ }
+
+ /**
* Returns a username and password object from the device key.
*
* @return username and password