use of org.onosproject.ui.model.topo.UiEdgeLink in project onos by opennetworkinglab.
the class ModelCache method updateHost.
private void updateHost(UiHost uiHost, Host h) {
UiEdgeLink existing = uiTopology.findEdgeLink(uiHost.edgeLinkId());
// TODO: review - do we need EdgeLink now that we are creating from id only?
EdgeLink currentElink = synthesizeLink(h);
UiLinkId currentElinkId = uiLinkId(currentElink);
if (existing != null) {
if (!currentElinkId.equals(existing.id())) {
// edge link has changed
insertNewUiEdgeLink(currentElinkId);
uiHost.setEdgeLinkId(currentElinkId);
uiTopology.remove(existing);
}
} else {
// no previously existing edge link
insertNewUiEdgeLink(currentElinkId);
uiHost.setEdgeLinkId(currentElinkId);
}
HostLocation hloc = h.location();
uiHost.setLocation(hloc.deviceId(), hloc.port());
}
use of org.onosproject.ui.model.topo.UiEdgeLink in project onos by opennetworkinglab.
the class ModelCache method removeHost.
// invoked from UiSharedTopologyModel host listener
void removeHost(Host host) {
HostId id = host.id();
UiHost uiHost = uiTopology.findHost(id);
if (uiHost != null) {
UiEdgeLink edgeLink = uiTopology.findEdgeLink(uiHost.edgeLinkId());
uiTopology.remove(edgeLink);
postEvent(LINK_REMOVED, edgeLink, MEMO_REMOVED);
uiTopology.remove(uiHost);
postEvent(HOST_REMOVED, uiHost, MEMO_REMOVED);
} else {
log.warn(E_NO_ELEMENT, "host", id);
}
}
use of org.onosproject.ui.model.topo.UiEdgeLink in project onos by opennetworkinglab.
the class ModelCache method addNewEdgeLink.
private UiEdgeLink addNewEdgeLink(UiLinkId id) {
UiEdgeLink uiEdgeLink = new UiEdgeLink(uiTopology, id);
uiTopology.add(uiEdgeLink);
return uiEdgeLink;
}
use of org.onosproject.ui.model.topo.UiEdgeLink in project onos by opennetworkinglab.
the class ModelCache method addOrUpdateHost.
// invoked from UiSharedTopologyModel host listener
void addOrUpdateHost(Host host) {
HostId id = host.id();
String memo = MEMO_UPDATED;
UiHost uiHost = uiTopology.findHost(id);
if (uiHost == null) {
uiHost = addNewHost(host);
memo = MEMO_ADDED;
}
updateHost(uiHost, host);
postEvent(HOST_ADDED_OR_UPDATED, uiHost, memo);
// Link event must be sent after the host event
UiEdgeLink uiEdgeLink = uiTopology.findEdgeLink(uiHost.edgeLinkId());
postEvent(LINK_ADDED_OR_UPDATED, uiEdgeLink, memo);
}
Aggregations