PCEP to support Device ID

Change-Id: I451da663c8a89499bad8dc78d687f418fdcbaafe
This commit is contained in:
harikrushna-Huawei 2017-04-12 17:58:38 +05:30 committed by Thomas Vachuska
parent 7d96d6ab7a
commit bbb3dd58eb

View File

@ -19,12 +19,14 @@ import java.net.URI;
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;
@ -64,6 +66,21 @@ public final class PcepDpid {
return uri(dpid.nodeId);
}
/**
* 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.