Package org.onosproject.ui.model.topo
Class UiTopology
- java.lang.Object
-
- org.onosproject.ui.model.topo.UiElement
-
- org.onosproject.ui.model.topo.UiTopology
-
public class UiTopology extends UiElement
Represents the overall network topology.
-
-
Constructor Summary
Constructors Constructor Description UiTopology(ServiceBundle services)
Creates a new UI topology backed by the specified service bundle.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(UiClusterMember member)
Adds the given cluster member to the topology model.void
add(UiDevice uiDevice)
Adds the given device to the topology model.void
add(UiDeviceLink uiDeviceLink)
Adds the given UI device link to the topology model.void
add(UiEdgeLink uiEdgeLink)
Adds the given UI edge link to the topology model.void
add(UiHost uiHost)
Adds the given host to the topology model.void
add(UiRegion uiRegion)
Adds the given region to the topology model.java.util.List<UiClusterMember>
allClusterMembers()
Returns all the cluster members, sorted by their ID.java.util.Set<UiDeviceLink>
allDeviceLinks()
Returns all device links in the model.java.util.Set<UiDevice>
allDevices()
Returns all devices in the model.java.util.Set<UiHost>
allHosts()
Returns all hosts in the model.java.util.Set<UiRegion>
allRegions()
Returns all regions in the model (except thenull region
).void
clear()
Clears the topology state; that is, drops all regions, devices, hosts, links, and cluster members.int
clusterMemberCount()
Returns the number of members in the cluster.void
computeSynthLinks()
Uses the device-device links and data about the regions to compute the set of synthetic links that are required per region.int
deviceCount()
Returns the number of devices configured in the topology.int
deviceLinkCount()
Returns the number of device links configured in the topology.java.lang.String
dumpString()
Returns a detailed (multi-line) string showing the contents of the topology.int
edgeLinkCount()
Returns the number of edge links configured in the topology.UiClusterMember
findClusterMember(NodeId id)
Returns the cluster member with the given identifier, or null if no such member exists.UiDevice
findDevice(DeviceId id)
Returns the device with the specified identifier, or null if no such device exists.UiDeviceLink
findDeviceLink(UiLinkId id)
Returns the device link with the specified identifier, or null if no such link exists.UiEdgeLink
findEdgeLink(UiLinkId id)
Returns the edge link with the specified identifier, or null if no such link exists.UiHost
findHost(HostId id)
Returns the host with the specified identifier, or null if no such host exists.UiRegion
findRegion(RegionId id)
Returns the region with the specified identifier, or null if no such region exists.java.util.List<UiSynthLink>
findSynthLinks(RegionId regionId)
Returns the synthetic links associated with the specified region.int
hostCount()
Returns the number of hosts configured in the topology.java.lang.String
idAsString()
Returns a string representation of the element identifier.UiRegion
nullRegion()
Returns a reference to the null-region.int
regionCount()
Returns the number of regions configured in the topology.void
remove(UiClusterMember member)
Removes the given cluster member from the topology model.void
remove(UiDevice uiDevice)
Removes the given device from the topology model.void
remove(UiDeviceLink uiDeviceLink)
Removes the given UI device link from the model.void
remove(UiEdgeLink uiEdgeLink)
Removes the given UI edge link from the model.void
remove(UiHost uiHost)
Removes the given host from the topology model.void
remove(UiRegion uiRegion)
Removes the given region from the topology model.int
synthLinkCount()
Returns the number of synthetic links in the topology.java.lang.String
toString()
-
-
-
Constructor Detail
-
UiTopology
public UiTopology(ServiceBundle services)
Creates a new UI topology backed by the specified service bundle.- Parameters:
services
- service bundle
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
idAsString
public java.lang.String idAsString()
Description copied from class:UiElement
Returns a string representation of the element identifier.- Specified by:
idAsString
in classUiElement
- Returns:
- the element unique identifier
-
clear
public void clear()
Clears the topology state; that is, drops all regions, devices, hosts, links, and cluster members.
-
allClusterMembers
public java.util.List<UiClusterMember> allClusterMembers()
Returns all the cluster members, sorted by their ID.- Returns:
- all cluster members
-
findClusterMember
public UiClusterMember findClusterMember(NodeId id)
Returns the cluster member with the given identifier, or null if no such member exists.- Parameters:
id
- cluster node identifier- Returns:
- corresponding UI cluster member
-
add
public void add(UiClusterMember member)
Adds the given cluster member to the topology model.- Parameters:
member
- cluster member to add
-
remove
public void remove(UiClusterMember member)
Removes the given cluster member from the topology model.- Parameters:
member
- cluster member to remove
-
clusterMemberCount
public int clusterMemberCount()
Returns the number of members in the cluster.- Returns:
- number of cluster members
-
allRegions
public java.util.Set<UiRegion> allRegions()
Returns all regions in the model (except thenull region
).- Returns:
- all regions
-
nullRegion
public UiRegion nullRegion()
Returns a reference to the null-region. That is, the container for devices, hosts, and links that belong to no region.- Returns:
- the null-region
-
findRegion
public UiRegion findRegion(RegionId id)
Returns the region with the specified identifier, or null if no such region exists.- Parameters:
id
- region identifier- Returns:
- corresponding UI region
-
add
public void add(UiRegion uiRegion)
Adds the given region to the topology model.- Parameters:
uiRegion
- region to add
-
remove
public void remove(UiRegion uiRegion)
Removes the given region from the topology model.- Parameters:
uiRegion
- region to remove
-
regionCount
public int regionCount()
Returns the number of regions configured in the topology.- Returns:
- number of regions
-
allDevices
public java.util.Set<UiDevice> allDevices()
Returns all devices in the model.- Returns:
- all devices
-
findDevice
public UiDevice findDevice(DeviceId id)
Returns the device with the specified identifier, or null if no such device exists.- Parameters:
id
- device identifier- Returns:
- corresponding UI device
-
add
public void add(UiDevice uiDevice)
Adds the given device to the topology model.- Parameters:
uiDevice
- device to add
-
remove
public void remove(UiDevice uiDevice)
Removes the given device from the topology model.- Parameters:
uiDevice
- device to remove
-
deviceCount
public int deviceCount()
Returns the number of devices configured in the topology.- Returns:
- number of devices
-
allDeviceLinks
public java.util.Set<UiDeviceLink> allDeviceLinks()
Returns all device links in the model.- Returns:
- all device links
-
findDeviceLink
public UiDeviceLink findDeviceLink(UiLinkId id)
Returns the device link with the specified identifier, or null if no such link exists.- Parameters:
id
- the canonicalized link identifier- Returns:
- corresponding UI device link
-
findEdgeLink
public UiEdgeLink findEdgeLink(UiLinkId id)
Returns the edge link with the specified identifier, or null if no such link exists.- Parameters:
id
- the canonicalized link identifier- Returns:
- corresponding UI edge link
-
add
public void add(UiDeviceLink uiDeviceLink)
Adds the given UI device link to the topology model.- Parameters:
uiDeviceLink
- link to add
-
add
public void add(UiEdgeLink uiEdgeLink)
Adds the given UI edge link to the topology model.- Parameters:
uiEdgeLink
- link to add
-
remove
public void remove(UiDeviceLink uiDeviceLink)
Removes the given UI device link from the model.- Parameters:
uiDeviceLink
- link to remove
-
remove
public void remove(UiEdgeLink uiEdgeLink)
Removes the given UI edge link from the model.- Parameters:
uiEdgeLink
- link to remove
-
deviceLinkCount
public int deviceLinkCount()
Returns the number of device links configured in the topology.- Returns:
- number of device links
-
edgeLinkCount
public int edgeLinkCount()
Returns the number of edge links configured in the topology.- Returns:
- number of edge links
-
allHosts
public java.util.Set<UiHost> allHosts()
Returns all hosts in the model.- Returns:
- all hosts
-
findHost
public UiHost findHost(HostId id)
Returns the host with the specified identifier, or null if no such host exists.- Parameters:
id
- host identifier- Returns:
- corresponding UI host
-
add
public void add(UiHost uiHost)
Adds the given host to the topology model.- Parameters:
uiHost
- host to add
-
remove
public void remove(UiHost uiHost)
Removes the given host from the topology model.- Parameters:
uiHost
- host to remove
-
hostCount
public int hostCount()
Returns the number of hosts configured in the topology.- Returns:
- number of hosts
-
computeSynthLinks
public void computeSynthLinks()
Uses the device-device links and data about the regions to compute the set of synthetic links that are required per region.
-
findSynthLinks
public java.util.List<UiSynthLink> findSynthLinks(RegionId regionId)
Returns the synthetic links associated with the specified region.- Parameters:
regionId
- the region ID- Returns:
- synthetic links for this region
-
synthLinkCount
public int synthLinkCount()
Returns the number of synthetic links in the topology.- Returns:
- the synthetic link count
-
dumpString
public java.lang.String dumpString()
Returns a detailed (multi-line) string showing the contents of the topology.- Returns:
- detailed string
-
-