PCEP to support Device ID
Change-Id: I451da663c8a89499bad8dc78d687f418fdcbaafe
diff --git a/apps/pcep-api/src/main/java/org/onosproject/pcep/api/PcepDpid.java b/apps/pcep-api/src/main/java/org/onosproject/pcep/api/PcepDpid.java
index d5a9599..3ac5269 100644
--- a/apps/pcep-api/src/main/java/org/onosproject/pcep/api/PcepDpid.java
+++ b/apps/pcep-api/src/main/java/org/onosproject/pcep/api/PcepDpid.java
@@ -19,12 +19,14 @@
import java.net.URISyntaxException;
import org.onosproject.pcep.tools.PcepTools;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The class representing a network switch PCEPDid. This class is immutable.
*/
public final class PcepDpid {
-
+ private static final Logger log = LoggerFactory.getLogger(PcepDpid.class);
private static final String SCHEME = "l3";
private static final long UNKNOWN = 0;
private long nodeId;
@@ -65,6 +67,21 @@
}
/**
+ * Produces pcep URI.
+ *
+ * @param value string to get URI
+ * @return pcep URI, otherwise null
+ */
+ public static URI uri(String value) {
+ try {
+ return new URI(SCHEME, value, null);
+ } catch (URISyntaxException e) {
+ log.debug("Exception PcepId URI: " + e.toString());
+ }
+ return null;
+ }
+
+ /**
* Produces device long from the given string which comes from the uri
* method.
*