cosmetic fixes in openstacknode
Change-Id: I9de67b2248007c772e21331811d0f15f04919324
diff --git a/apps/openstacknode/src/main/java/org/onosproject/openstacknode/OpenstackNodeManager.java b/apps/openstacknode/src/main/java/org/onosproject/openstacknode/OpenstackNodeManager.java
index bea3a41..3eb8095 100644
--- a/apps/openstacknode/src/main/java/org/onosproject/openstacknode/OpenstackNodeManager.java
+++ b/apps/openstacknode/src/main/java/org/onosproject/openstacknode/OpenstackNodeManager.java
@@ -16,7 +16,6 @@
package org.onosproject.openstacknode;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import org.apache.felix.scr.annotations.Activate;
@@ -378,7 +377,7 @@
@Override
public OpenstackNode gatewayNode(DeviceId deviceId) {
OpenstackNode gatewayNode = nodeByDeviceId(deviceId);
- if (gatewayNode == null) {
+ if (gatewayNode == null || gatewayNode.type() != NodeType.GATEWAY) {
log.warn("Gateway with device ID {} does not exist");
return null;
}
@@ -412,15 +411,8 @@
@Override
public List<DeviceId> gatewayDeviceIds() {
- List<DeviceId> deviceIdList = Lists.newArrayList();
-
- nodeStore.values()
- .stream()
- .map(Versioned::value)
- .filter(node -> node.type().equals(NodeType.GATEWAY))
- .filter(node -> node.state().equals(COMPLETE))
- .forEach(node -> deviceIdList.add(node.intBridge()));
- return deviceIdList;
+ return gatewayNodes().stream().map(OpenstackNode::intBridge)
+ .collect(Collectors.toList());
}
private void updateGatewayGroup(OpenstackNode gatewayNode, boolean isInsert) {