Hyunsun Moon
Committed by Gerrit Code Review

CORD-280 Fix the way to add and remove a node to consistent store

Change-Id: Iff55398d0a78acf3cdce8a5b43146f95b562d5a5
......@@ -146,9 +146,7 @@ public class CordVtn implements CordVtnService {
public void addNode(OvsdbNode ovsdb) {
checkNotNull(ovsdb);
if (!nodeStore.containsKey(ovsdb.deviceId())) {
nodeStore.put(ovsdb.deviceId(), ovsdb);
}
nodeStore.putIfAbsent(ovsdb.deviceId(), ovsdb);
if (isNodeConnected(ovsdb)) {
init(ovsdb);
......@@ -161,10 +159,6 @@ public class CordVtn implements CordVtnService {
public void deleteNode(OvsdbNode ovsdb) {
checkNotNull(ovsdb);
if (!nodeStore.containsKey(ovsdb.deviceId())) {
return;
}
if (deviceService.getDevice(ovsdb.deviceId()) != null) {
if (deviceService.isAvailable(ovsdb.deviceId())) {
log.warn("Cannot delete connected node {}", ovsdb.host());
......