Search in sources :

Example 1 with UiEdgeLink

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());
}
Also used : UiEdgeLink(org.onosproject.ui.model.topo.UiEdgeLink) DefaultEdgeLink.createEdgeLink(org.onosproject.net.DefaultEdgeLink.createEdgeLink) EdgeLink(org.onosproject.net.EdgeLink) UiEdgeLink(org.onosproject.ui.model.topo.UiEdgeLink) UiLinkId(org.onosproject.ui.model.topo.UiLinkId) HostLocation(org.onosproject.net.HostLocation)

Example 2 with UiEdgeLink

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);
    }
}
Also used : UiEdgeLink(org.onosproject.ui.model.topo.UiEdgeLink) UiHost(org.onosproject.ui.model.topo.UiHost) HostId(org.onosproject.net.HostId)

Example 3 with UiEdgeLink

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;
}
Also used : UiEdgeLink(org.onosproject.ui.model.topo.UiEdgeLink)

Example 4 with 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);
}
Also used : UiEdgeLink(org.onosproject.ui.model.topo.UiEdgeLink) UiHost(org.onosproject.ui.model.topo.UiHost) HostId(org.onosproject.net.HostId)

Aggregations

UiEdgeLink (org.onosproject.ui.model.topo.UiEdgeLink)4 HostId (org.onosproject.net.HostId)2 UiHost (org.onosproject.ui.model.topo.UiHost)2 DefaultEdgeLink.createEdgeLink (org.onosproject.net.DefaultEdgeLink.createEdgeLink)1 EdgeLink (org.onosproject.net.EdgeLink)1 HostLocation (org.onosproject.net.HostLocation)1 UiLinkId (org.onosproject.ui.model.topo.UiLinkId)1