use of org.onosproject.ui.model.topo.UiClusterMember in project onos by opennetworkinglab.
the class ModelCache method addOrUpdateClusterMember.
// invoked from UiSharedTopologyModel cluster event listener
void addOrUpdateClusterMember(ControllerNode cnode) {
NodeId id = cnode.id();
String memo = MEMO_UPDATED;
UiClusterMember member = uiTopology.findClusterMember(id);
if (member == null) {
member = addNewClusterMember(cnode);
memo = MEMO_ADDED;
}
updateClusterMember(member);
postEvent(CLUSTER_MEMBER_ADDED_OR_UPDATED, member, memo);
}
use of org.onosproject.ui.model.topo.UiClusterMember in project onos by opennetworkinglab.
the class ModelCache method removeClusterMember.
// invoked from UiSharedTopologyModel cluster event listener
void removeClusterMember(ControllerNode cnode) {
NodeId id = cnode.id();
UiClusterMember member = uiTopology.findClusterMember(id);
if (member != null) {
uiTopology.remove(member);
postEvent(CLUSTER_MEMBER_REMOVED, member, MEMO_REMOVED);
} else {
log.warn(E_NO_ELEMENT, "cluster node", id);
}
}
use of org.onosproject.ui.model.topo.UiClusterMember in project onos by opennetworkinglab.
the class Topo2Jsonifier method instances.
/**
* Returns a JSON representation of the cluster members (ONOS instances).
*
* @param instances the instance model objects
* @return a JSON representation of the data
*/
ObjectNode instances(List<UiClusterMember> instances) {
NodeId local = clusterService.getLocalNode().id();
ObjectNode payload = objectNode();
ArrayNode members = arrayNode();
payload.set("members", members);
for (UiClusterMember member : instances) {
members.add(json(member, member.id().equals(local)));
}
return payload;
}
use of org.onosproject.ui.model.topo.UiClusterMember in project onos by opennetworkinglab.
the class ModelCacheTest method addNodeThenExamineIt.
@Test
public void addNodeThenExamineIt() {
title("addNodeThenExamineIt");
cache.addOrUpdateClusterMember(CNODE_1);
dispatcher.assertLast(Type.CLUSTER_MEMBER_ADDED_OR_UPDATED, C1);
UiClusterMember member = cache.accessClusterMember(nodeId(C1));
print(member);
// see AbstractUiImplTest Mock Environment for expected values...
assertEquals("wrong id str", C1, member.idAsString());
assertEquals("wrong id", nodeId(C1), member.id());
// TODO make assertions through the cluster service; state no longer
// cached in the UiModel...
// assertEquals("not online", true, member.isOnline());
// assertEquals("not ready", true, member.isReady());
}
use of org.onosproject.ui.model.topo.UiClusterMember in project onos by opennetworkinglab.
the class ModelCache method addNewClusterMember.
// === CLUSTER MEMBERS
private UiClusterMember addNewClusterMember(ControllerNode n) {
UiClusterMember member = new UiClusterMember(uiTopology, n);
uiTopology.add(member);
return member;
}
Aggregations