alshabib

stats reply in progress

package org.onlab.onos.net.flow;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.provider.Provider;
/**
......@@ -27,13 +26,4 @@ public interface FlowRuleProvider extends Provider {
void removeFlowRule(FlowRule... flowRules);
/**
* Returns the collection of flow entries currently applied on the given
* device.
*
* @param deviceId device identifier
* @return collection of flow entries
*/
Iterable<FlowEntry> getFlowMetrics(DeviceId deviceId);
}
......
......@@ -29,4 +29,13 @@ public interface FlowRuleProviderService extends ProviderService<FlowRuleProvide
*/
void flowAdded(FlowRule flowRule);
/**
* Pushes the collection of flow entries currently applied on the given
* device.
*
* @param deviceId device identifier
* @return collection of flow entries
*/
void pushFlowMetrics(Iterable<FlowEntry> flowEntries);
}
......
package org.onlab.onos.net.trivial.flow.impl;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.slf4j.LoggerFactory.getLogger;
import java.util.ArrayList;
......@@ -28,8 +29,6 @@ import org.onlab.onos.net.provider.AbstractProviderRegistry;
import org.onlab.onos.net.provider.AbstractProviderService;
import org.slf4j.Logger;
import static com.google.common.base.Preconditions.checkNotNull;
@Component(immediate = true)
@Service
public class SimpleFlowRuleManager
......@@ -158,6 +157,12 @@ implements FlowRuleService, FlowRuleProviderRegistry {
eventDispatcher.post(event);
}
}
@Override
public void pushFlowMetrics(Iterable<FlowEntry> flowEntries) {
// TODO Auto-generated method stub
}
}
}
......
......@@ -11,7 +11,6 @@ import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.flow.DefaultFlowRule;
import org.onlab.onos.net.flow.FlowEntry;
import org.onlab.onos.net.flow.FlowRule;
import org.onlab.onos.net.flow.FlowRuleProvider;
import org.onlab.onos.net.flow.FlowRuleProviderRegistry;
......@@ -25,10 +24,18 @@ import org.onlab.onos.openflow.controller.OpenFlowEventListener;
import org.onlab.onos.openflow.controller.OpenFlowSwitch;
import org.onlab.onos.openflow.controller.OpenFlowSwitchListener;
import org.projectfloodlight.openflow.protocol.OFFlowRemoved;
import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry;
import org.projectfloodlight.openflow.protocol.OFFlowStatsReply;
import org.projectfloodlight.openflow.protocol.OFMessage;
import org.projectfloodlight.openflow.protocol.OFPortStatus;
import org.projectfloodlight.openflow.protocol.OFStatsReply;
import org.projectfloodlight.openflow.protocol.OFStatsType;
import org.slf4j.Logger;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
rt org.slf4j.Logger;
import com.google.common.collect.Maps;
/**
......@@ -95,12 +102,6 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr
}
@Override
public Iterable<FlowEntry> getFlowMetrics(DeviceId deviceId) {
// TODO Auto-generated method stub
return null;
}
//TODO: InternalFlowRuleProvider listening to stats and error and flowremoved.
// possibly barriers as well. May not be internal at all...
......@@ -119,7 +120,6 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr
@Override
public void switchRemoved(Dpid dpid) {
collectors.remove(dpid).stop();
}
@Override
......@@ -137,6 +137,7 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr
providerService.flowRemoved(fr);
break;
case STATS_REPLY:
pushFlowMetrics((OFStatsReply) msg);
break;
case BARRIER_REPLY:
case ERROR:
......@@ -146,6 +147,19 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr
}
private void pushFlowMetrics(OFStatsReply stats) {
if (stats.getStatsType() != OFStatsType.FLOW) {
return;
}
final OFFlowStatsReply replies = (OFFlowStatsReply) stats;
final List<FlowEntry> entries = Lists.newLinkedList();
for (OFFlowStatsEntry reply : replies.getEntries()) {
}
}
}
......