Set<EpKey> epsNode = new HashSet<EpKey>();
epsNode.add(newEpKey);
endpointsByNode.put(newLoc, epsNode);
- SwitchManager.activateEndpoint(newLoc);
+ SwitchManager.activatingSwitch(newLoc);
} else {
Set<EpKey> epsNode = endpointsByNode.get(newLoc);
epsNode.remove(oldEpKey);
if (epsNode.isEmpty()) {
endpointsByNode.remove(oldLoc);
- SwitchManager.deactivateEndpoint(oldLoc);
+ SwitchManager.deactivatingSwitch(oldLoc);
}
}
// Update endpointsByGroupByNode
epsNode.remove(oldEpKey);
if (epsNode.isEmpty()) {
endpointsByNode.remove(oldLoc);
- SwitchManager.deactivateEndpoint(oldLoc);
+ SwitchManager.deactivatingSwitch(oldLoc);
}
}
// Update endpointsByGroupByNode
Set<EpKey> newEpsNode = new HashSet<EpKey>();
newEpsNode.add(newEpKey);
endpointsByNode.put(newLoc, newEpsNode);
- SwitchManager.activateEndpoint(newLoc);
+ SwitchManager.activatingSwitch(newLoc);
} else {
Set<EpKey> newEpsNode = endpointsByNode.get(newLoc);
newEpsNode.add(newEpKey);
}
// When first endpoint is attached to switch, it can be ready
- public static void activateEndpoint(NodeId nodeId) {
- switches.get(nodeId).hasEndpoints=true;
+ public static void activatingSwitch(NodeId nodeId) {
+ switches.get(nodeId).setHasEndpoints(true);
switches.get(nodeId).updateStatus();
}
// When last endpoint is removed from switch, it is no longer ready
- public static void deactivateEndpoint(NodeId nodeId) {
- switches.get(nodeId).hasEndpoints=false;
+ public static void deactivatingSwitch(NodeId nodeId) {
+ switches.get(nodeId).setHasEndpoints(false);;
switches.get(nodeId).updateStatus();
}
private Map<InstanceIdentifier<NodeConnector>, FlowCapableNodeConnector> fcncByNcIid = Maps.newHashMap();
private boolean hasEndpoints=false;
+
+ public boolean isHasEndpoints() {
+ return hasEndpoints;
+ }
+
+
+ public void setHasEndpoints(boolean hasEndpoints) {
+ this.hasEndpoints = hasEndpoints;
+ }
+
Map<Class<? extends TunnelTypeBase>, TunnelBuilder> tunnelBuilderByType = new HashMap<>();
Set<NodeConnectorId> externalPorts = new HashSet<>();
private void updateStatus() {
boolean tunnelWithIpAndNcExists = tunnelWithIpAndNcExists();
if (fcNode != null) {
- if (tunnelWithIpAndNcExists && hasEndpoints) {
+ if (tunnelWithIpAndNcExists && isHasEndpoints()) {
setStatus(SwitchStatus.READY);
} else {
setStatus(SwitchStatus.PREPARING);