Package org.onosproject.ui.model.topo
Class UiLinkId
- java.lang.Object
-
- org.onosproject.ui.model.topo.UiLinkId
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UiLinkId.Direction
Designates the directionality of an underlying (uni-directional) link.static class
UiLinkId.Type
Designates the type of link the identifier represents.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ElementId
elementA()
Returns the identifier of the first element.ElementId
elementB()
Returns the identifier of the second element.boolean
equals(Object o)
int
hashCode()
String
idA()
String representation of endpoint A.String
idB()
String representation of endpoint B.boolean
isDeviceDevice()
Returns true if this identifier represents a device-device (infrastructure) link.boolean
isHostDevice()
Returns true if this identifier represents a host-device (edge) link.boolean
isRegionDevice()
Returns true if this identifier represents a region-device link.boolean
isRegionRegion()
Returns true if this identifier represents a region-region link.PortNumber
portA()
Returns the port of the first element.PortNumber
portB()
Returns the port of the second element.RegionId
regionA()
Returns the identity of the first region.RegionId
regionB()
Returns the identity of the second region.String
toString()
UiLinkId.Type
type()
Returns the type of link this identifier represents.static UiLinkId
uiLinkId(DeviceId a, PortNumber pa, DeviceId b, PortNumber pb)
Generates an identifier for a link between two devices.static UiLinkId
uiLinkId(HostId h, DeviceId d, PortNumber p)
Generates an identifier for an edge link.static UiLinkId
uiLinkId(Link link)
Generates the canonical link identifier for the given link.static UiLinkId
uiLinkId(LinkKey lk)
Creates the canonical link identifier from the given link key.static UiLinkId
uiLinkId(RegionId regionId, DeviceId deviceId, PortNumber portNumber)
Generates the canonical link identifier for a link between the specified region and device/port.static UiLinkId
uiLinkId(RegionId one, RegionId two)
Generates the canonical link identifier for a link between the specified region nodes.
-
-
-
Method Detail
-
idA
public String idA()
String representation of endpoint A.- Returns:
- string rep of endpoint A
-
idB
public String idB()
String representation of endpoint B.- Returns:
- string rep of endpoint B
-
elementA
public ElementId elementA()
Returns the identifier of the first element. Note that the returned value will be null if this identifier is for a region-region link.- Returns:
- first element identity
-
portA
public PortNumber portA()
Returns the port of the first element. Note that the returned value will be null if this identifier is for a region-region link.- Returns:
- first element port
-
elementB
public ElementId elementB()
Returns the identifier of the second element. Note that the returned value will be null if this identifier is for a region-region link.- Returns:
- second element identity
-
portB
public PortNumber portB()
Returns the port of the second element. Note that the returned value will be null if this identifier is for a region-region link.- Returns:
- second element port
-
regionA
public RegionId regionA()
Returns the identity of the first region. Note that the returned value will be null if this identifier is for a device-device or device-host link.- Returns:
- first region ID
-
regionB
public RegionId regionB()
Returns the identity of the second region. Note that the returned value will be null if this identifier is for a device-device or device-host link.- Returns:
- second region ID
-
type
public UiLinkId.Type type()
Returns the type of link this identifier represents.- Returns:
- the link identifier type
-
isRegionRegion
public boolean isRegionRegion()
Returns true if this identifier represents a region-region link.- Returns:
- true if region-region link identifier; false otherwise
-
isRegionDevice
public boolean isRegionDevice()
Returns true if this identifier represents a region-device link.- Returns:
- true if region-device link identifier; false otherwise
-
isDeviceDevice
public boolean isDeviceDevice()
Returns true if this identifier represents a device-device (infrastructure) link.- Returns:
- true if device-device link identifier; false otherwise
-
isHostDevice
public boolean isHostDevice()
Returns true if this identifier represents a host-device (edge) link.- Returns:
- true if host-device link identifier; false otherwise
-
uiLinkId
public static UiLinkId uiLinkId(Link link)
Generates the canonical link identifier for the given link.- Parameters:
link
- link for which the identifier is required- Returns:
- link identifier
- Throws:
NullPointerException
- if src or dst connect point is null
-
uiLinkId
public static UiLinkId uiLinkId(LinkKey lk)
Creates the canonical link identifier from the given link key.- Parameters:
lk
- link key- Returns:
- equivalent link identifier
- Throws:
NullPointerException
- if src or dst connect point is null
-
uiLinkId
public static UiLinkId uiLinkId(RegionId one, RegionId two)
Generates the canonical link identifier for a link between the specified region nodes.- Parameters:
one
- the first region IDtwo
- the second region ID- Returns:
- link identifier
- Throws:
NullPointerException
- if any of the required fields are nullIllegalArgumentException
- if the identifiers are identical
-
uiLinkId
public static UiLinkId uiLinkId(RegionId regionId, DeviceId deviceId, PortNumber portNumber)
Generates the canonical link identifier for a link between the specified region and device/port.- Parameters:
regionId
- region IDdeviceId
- device IDportNumber
- port number- Returns:
- link identifier
- Throws:
NullPointerException
- if any of the required fields are null
-
uiLinkId
public static UiLinkId uiLinkId(DeviceId a, PortNumber pa, DeviceId b, PortNumber pb)
Generates an identifier for a link between two devices.- Parameters:
a
- device Apa
- port Ab
- device Bpb
- port B- Returns:
- link identifier
- Throws:
NullPointerException
- if any of the required fields are null
-
uiLinkId
public static UiLinkId uiLinkId(HostId h, DeviceId d, PortNumber p)
Generates an identifier for an edge link. Note that host is always element A.- Parameters:
h
- hostd
- devicep
- port- Returns:
- link identifier
- Throws:
NullPointerException
- if any of the required fields are null
-
-