Skip to content
Snippets Groups Projects
Commit cd85d1e4 authored by Shudong Zhou's avatar Shudong Zhou
Browse files

Fix show switch xxx features [BSC-2513]

parent ef0cc8a2
No related branches found
No related tags found
No related merge requests found
...@@ -24,9 +24,11 @@ import java.util.List; ...@@ -24,9 +24,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import net.floodlightcontroller.core.IFloodlightProviderService; import net.floodlightcontroller.core.IFloodlightProviderService;
import net.floodlightcontroller.core.IOFSwitch;
import net.floodlightcontroller.core.types.MacVlanPair; import net.floodlightcontroller.core.types.MacVlanPair;
import org.openflow.protocol.OFFeaturesReply; import org.openflow.protocol.OFFeaturesReply;
import org.openflow.protocol.OFPhysicalPort;
import org.openflow.protocol.statistics.OFStatistics; import org.openflow.protocol.statistics.OFStatistics;
import org.openflow.protocol.statistics.OFStatisticsType; import org.openflow.protocol.statistics.OFStatisticsType;
import org.openflow.util.HexString; import org.openflow.util.HexString;
...@@ -171,7 +173,9 @@ public class AllSwitchStatisticsResource extends SwitchResourceBase { ...@@ -171,7 +173,9 @@ public class AllSwitchStatisticsResource extends SwitchResourceBase {
if ((requestType == REQUESTTYPE.OFSTATS) && (statType != null)) { if ((requestType == REQUESTTYPE.OFSTATS) && (statType != null)) {
switchReply = getSwitchStatistics(switchId, statType); switchReply = getSwitchStatistics(switchId, statType);
} else if (requestType == REQUESTTYPE.OFFEATURES) { } else if (requestType == REQUESTTYPE.OFFEATURES) {
featuresReply = floodlightProvider.getSwitches().get(switchId).getFeaturesReply(); IOFSwitch sw = floodlightProvider.getSwitches().get(switchId);
featuresReply = sw.getFeaturesReply();
featuresReply.setPorts(new ArrayList<OFPhysicalPort>(sw.getPorts().values()));
} }
} }
} }
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
package net.floodlightcontroller.core.web; package net.floodlightcontroller.core.web;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -25,6 +26,7 @@ import net.floodlightcontroller.core.IFloodlightProviderService; ...@@ -25,6 +26,7 @@ import net.floodlightcontroller.core.IFloodlightProviderService;
import net.floodlightcontroller.core.IOFSwitch; import net.floodlightcontroller.core.IOFSwitch;
import org.openflow.protocol.OFFeaturesReply; import org.openflow.protocol.OFFeaturesReply;
import org.openflow.protocol.OFPhysicalPort;
import org.openflow.protocol.statistics.OFStatistics; import org.openflow.protocol.statistics.OFStatistics;
import org.openflow.protocol.statistics.OFStatisticsType; import org.openflow.protocol.statistics.OFStatisticsType;
import org.openflow.util.HexString; import org.openflow.util.HexString;
...@@ -68,6 +70,7 @@ public class SwitchStatisticsResource extends SwitchResourceBase { ...@@ -68,6 +70,7 @@ public class SwitchStatisticsResource extends SwitchResourceBase {
IOFSwitch sw = floodlightProvider.getSwitches().get(HexString.toLong(switchId)); IOFSwitch sw = floodlightProvider.getSwitches().get(HexString.toLong(switchId));
if (sw != null) { if (sw != null) {
OFFeaturesReply fr = sw.getFeaturesReply(); OFFeaturesReply fr = sw.getFeaturesReply();
fr.setPorts(new ArrayList<OFPhysicalPort>(sw.getPorts().values()));
result.put(sw.getStringId(), fr); result.put(sw.getStringId(), fr);
} }
return result; return result;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment