Removed the Floodlight counter module
diff --git a/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java b/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java
index cbc8c7c..41676c4 100644
--- a/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java
+++ b/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java
@@ -10,7 +10,6 @@
import net.floodlightcontroller.core.module.FloodlightModuleException;
import net.floodlightcontroller.core.module.IFloodlightModule;
import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.counter.ICounterStoreService;
import net.floodlightcontroller.restserver.IRestApiService;
import net.floodlightcontroller.threadpool.IThreadPoolService;
import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
@@ -43,9 +42,8 @@
@Override
public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
Collection<Class<? extends IFloodlightService>> dependencies =
- new ArrayList<Class<? extends IFloodlightService>>(5);
+ new ArrayList<Class<? extends IFloodlightService>>(4);
dependencies.add(IRestApiService.class);
- dependencies.add(ICounterStoreService.class);
dependencies.add(IThreadPoolService.class);
// Following added by ONOS
dependencies.add(IControllerRegistryService.class);
@@ -56,8 +54,6 @@
@Override
public void init(FloodlightModuleContext context) throws FloodlightModuleException {
- controller.setCounterStore(
- context.getServiceImpl(ICounterStoreService.class));
controller.setRestApiService(
context.getServiceImpl(IRestApiService.class));
controller.setThreadPoolService(
diff --git a/src/main/java/net/floodlightcontroller/core/internal/Controller.java b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
index 38cd5d0..39bdf3c 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/Controller.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
@@ -57,7 +57,6 @@
import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState;
import net.floodlightcontroller.core.util.ListenerDispatcher;
import net.floodlightcontroller.core.web.CoreWebRoutable;
-import net.floodlightcontroller.counter.ICounterStoreService;
import net.floodlightcontroller.packet.Ethernet;
import net.floodlightcontroller.restserver.IRestApiService;
import net.floodlightcontroller.threadpool.IThreadPoolService;
@@ -165,7 +164,6 @@
// Module dependencies
protected IRestApiService restApi;
- protected ICounterStoreService counterStore = null;
protected IThreadPoolService threadPool;
protected IControllerRegistryService registryService;
@@ -257,13 +255,7 @@
// ***************
// Getters/Setters
- // ***************
-
- public void setCounterStore(ICounterStoreService counterStore) {
- this.counterStore = counterStore;
- }
-
-
+ // ***************
public void setRestApiService(IRestApiService restApi) {
this.restApi = restApi;
@@ -1204,7 +1196,6 @@
eth = new Ethernet();
eth.deserialize(pi.getPacketData(), 0,
pi.getPacketData().length);
- counterStore.updatePacketInCounters(sw, m, eth);
}
// fall through to default case...
diff --git a/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java b/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java
index 00127a6..9b22617 100644
--- a/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java
+++ b/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java
@@ -47,9 +47,6 @@
router.attach("/switch/all/{statType}/json", AllSwitchStatisticsResource.class);
router.attach("/switch/{switchId}/{statType}/json", SwitchStatisticsResource.class);
router.attach("/controller/switches/json", ControllerSwitchesResource.class);
- router.attach("/counter/{counterTitle}/json", CounterResource.class);
- router.attach("/counter/{switchId}/{counterName}/json", SwitchCounterResource.class);
- router.attach("/counter/categories/{switchId}/{counterName}/{layer}/json", SwitchCounterCategoriesResource.class);
router.attach("/memory/json", ControllerMemoryResource.class);
// Get the last {count} events from the event histories
router.attach("/event-history/topology-switch/{count}/json",
diff --git a/src/main/java/net/floodlightcontroller/core/web/CounterResource.java b/src/main/java/net/floodlightcontroller/core/web/CounterResource.java
deleted file mode 100644
index fb680d7..0000000
--- a/src/main/java/net/floodlightcontroller/core/web/CounterResource.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
-
-package net.floodlightcontroller.core.web;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import net.floodlightcontroller.counter.CounterValue;
-import net.floodlightcontroller.counter.ICounter;
-
-import org.restlet.resource.Get;
-
-public class CounterResource extends CounterResourceBase {
- @Get("json")
- public Map<String, Object> retrieve() {
- String counterTitle =
- (String) getRequestAttributes().get("counterTitle");
- Map<String, Object> model = new HashMap<String,Object>();
- CounterValue v;
- if (counterTitle.equalsIgnoreCase("all")) {
- Map<String, ICounter> counters = this.counterStore.getAll();
- if (counters != null) {
- Iterator<Map.Entry<String, ICounter>> it =
- counters.entrySet().iterator();
- while (it.hasNext()) {
- Entry<String, ICounter> entry = it.next();
- String counterName = entry.getKey();
- v = entry.getValue().getCounterValue();
-
- if (CounterValue.CounterType.LONG == v.getType()) {
- model.put(counterName, v.getLong());
- } else if (v.getType() == CounterValue.CounterType.DOUBLE) {
- model.put(counterName, v.getDouble());
- }
- }
- }
- } else {
- ICounter counter = this.counterStore.getCounter(counterTitle);
- if (counter != null) {
- v = counter.getCounterValue();
- } else {
- v = new CounterValue(CounterValue.CounterType.LONG);
- }
-
- if (CounterValue.CounterType.LONG == v.getType()) {
- model.put(counterTitle, v.getLong());
- } else if (v.getType() == CounterValue.CounterType.DOUBLE) {
- model.put(counterTitle, v.getDouble());
- }
- }
- return model;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/core/web/CounterResourceBase.java b/src/main/java/net/floodlightcontroller/core/web/CounterResourceBase.java
deleted file mode 100644
index 70e90ed..0000000
--- a/src/main/java/net/floodlightcontroller/core/web/CounterResourceBase.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
-
-package net.floodlightcontroller.core.web;
-
-import net.floodlightcontroller.counter.ICounterStoreService;
-
-import org.restlet.resource.ResourceException;
-import org.restlet.resource.ServerResource;
-
-public class CounterResourceBase extends ServerResource {
- protected ICounterStoreService counterStore;
-
- @Override
- protected void doInit() throws ResourceException {
- super.doInit();
- counterStore =
- (ICounterStoreService)getContext().getAttributes().
- get(ICounterStoreService.class.getCanonicalName());
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/core/web/SwitchCounterCategoriesResource.java b/src/main/java/net/floodlightcontroller/core/web/SwitchCounterCategoriesResource.java
deleted file mode 100644
index f14d706..0000000
--- a/src/main/java/net/floodlightcontroller/core/web/SwitchCounterCategoriesResource.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
-
-package net.floodlightcontroller.core.web;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.openflow.util.HexString;
-import org.restlet.resource.Get;
-
-import net.floodlightcontroller.core.IFloodlightProviderService;
-import net.floodlightcontroller.counter.CounterStore.NetworkLayer;
-import net.floodlightcontroller.counter.ICounterStoreService;
-
-/**
- * Get the counter categories for a particular switch
- * @author readams
- */
-public class SwitchCounterCategoriesResource extends CounterResourceBase {
- @Get("json")
- public Map<String, Object> retrieve() {
- IFloodlightProviderService floodlightProvider =
- (IFloodlightProviderService)getContext().getAttributes().
- get(IFloodlightProviderService.class.getCanonicalName());
- HashMap<String,Object> model = new HashMap<String,Object>();
-
- String switchID = (String) getRequestAttributes().get("switchId");
- String counterName = (String) getRequestAttributes().get("counterName");
- String layer = (String) getRequestAttributes().get("layer");
-
- Long[] switchDpids;
- if (switchID.equalsIgnoreCase("all")) {
- switchDpids = floodlightProvider.getSwitches().keySet().toArray(new Long[0]);
- for (Long dpid : switchDpids) {
- switchID = HexString.toHexString(dpid);
-
- getOneSwitchCounterCategoriesJson(model, switchID, counterName, layer);
- }
- } else {
- getOneSwitchCounterCategoriesJson(model, switchID, counterName, layer);
- }
-
- return model;
- }
-
- protected void getOneSwitchCounterCategoriesJson(Map<String, Object> model,
- String switchID,
- String counterName,
- String layer) {
- String fullCounterName = "";
- NetworkLayer nl = NetworkLayer.L3;
-
- try {
- counterName = URLDecoder.decode(counterName, "UTF-8");
- layer = URLDecoder.decode(layer, "UTF-8");
- fullCounterName = switchID + ICounterStoreService.TitleDelimitor + counterName;
- } catch (UnsupportedEncodingException e) {
- //Just leave counterTitle undecoded if there is an issue - fail silently
- }
-
- if (layer.compareToIgnoreCase("4") == 0) {
- nl = NetworkLayer.L4;
- }
- List<String> categories = this.counterStore.getAllCategories(fullCounterName, nl);
- if (categories != null) {
- model.put(fullCounterName + "." + layer, categories);
- }
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/core/web/SwitchCounterResource.java b/src/main/java/net/floodlightcontroller/core/web/SwitchCounterResource.java
deleted file mode 100644
index 188836d..0000000
--- a/src/main/java/net/floodlightcontroller/core/web/SwitchCounterResource.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
-
-package net.floodlightcontroller.core.web;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.openflow.util.HexString;
-import org.restlet.resource.Get;
-
-import net.floodlightcontroller.core.IFloodlightProviderService;
-import net.floodlightcontroller.counter.ICounter;
-import net.floodlightcontroller.counter.ICounterStoreService;
-
-/**
- * Get counters for a particular switch
- * @author readams
- */
-public class SwitchCounterResource extends CounterResourceBase {
- @Get("json")
- public Map<String, Object> retrieve() {
- IFloodlightProviderService floodlightProvider =
- (IFloodlightProviderService)getContext().getAttributes().
- get(IFloodlightProviderService.class.getCanonicalName());
- HashMap<String,Object> model = new HashMap<String,Object>();
-
- String switchID = (String) getRequestAttributes().get("switchId");
- String counterName = (String) getRequestAttributes().get("counterName");
-
- Long[] switchDpids;
- if (switchID.equalsIgnoreCase("all")) {
- switchDpids = floodlightProvider.getSwitches().keySet().toArray(new Long[0]);
- getOneSwitchCounterJson(model, ICounterStoreService.CONTROLLER_NAME, counterName);
- for (Long dpid : switchDpids) {
- switchID = HexString.toHexString(dpid);
-
- getOneSwitchCounterJson(model, switchID, counterName);
- }
- } else {
- getOneSwitchCounterJson(model, switchID, counterName);
- }
- return model;
- }
-
- protected void getOneSwitchCounterJson(Map<String, Object> model,
- String switchID, String counterName) {
- String fullCounterName = "";
-
- try {
- counterName = URLDecoder.decode(counterName, "UTF-8");
- fullCounterName =
- switchID + ICounterStoreService.TitleDelimitor + counterName;
- } catch (UnsupportedEncodingException e) {
- //Just leave counterTitle undecoded if there is an issue - fail silently
- }
-
- ICounter counter = this.counterStore.getCounter(fullCounterName);
- Map<String, Long> sample = new HashMap<String, Long> ();
- if (counter != null) {
- sample.put(counter.getCounterDate().toString(),
- counter.getCounterValue().getLong());
- model.put(switchID, sample);
- }
- }
-
-}
diff --git a/src/main/java/net/floodlightcontroller/counter/ConcurrentCounter.java b/src/main/java/net/floodlightcontroller/counter/ConcurrentCounter.java
deleted file mode 100644
index cdec1e0..0000000
--- a/src/main/java/net/floodlightcontroller/counter/ConcurrentCounter.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
-
-/**
- *
- */
-package net.floodlightcontroller.counter;
-
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Queue;
-import java.util.Set;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-import net.floodlightcontroller.counter.CounterValue.CounterType;
-
-
-/**
- * This module needs to be updated with CounterValue.
- *
- * This is a crumby attempt at a highly concurrent implementation of the Counter interface.
- *
- * (Help! Help! Someone please re-write me! This will almost certainly break at high loads.)
- *
- * The gist is that this class, ConcurrentCounter, keeps an internal highly transient buffer that is occasionally flushed
- * in to a set of CountBuffers (circular buffers) which store a longer term historical view of the count values at different
- * moments in time.
- *
- * This Counter implementation may be a bit over-engineered... The goal here was to present an implementation that is very
- * predictable with respect to memory and CPU time and, at the same time, present a very fast increment() method. The reasoning
- * here is that this will be a go-to class when it comes to debugging, particularly in high-load situations where logging
- * may introduce so much variability to the system that it foils the results.
- *
- * @author kyle
- *
- */
-public class ConcurrentCounter implements ICounter {
-
- protected static final Map<DateSpan, Integer> MAX_HISTORY = new HashMap<DateSpan, Integer>();
- static {
- MAX_HISTORY.put(DateSpan.REALTIME, new Integer(1));
- MAX_HISTORY.put(DateSpan.SECONDS, new Integer(120));
- MAX_HISTORY.put(DateSpan.MINUTES, new Integer(60));
- MAX_HISTORY.put(DateSpan.HOURS, new Integer(48));
- MAX_HISTORY.put(DateSpan.DAYS, new Integer(60));
- MAX_HISTORY.put(DateSpan.WEEKS, new Integer(2));
- }
-
- protected static Set<ConcurrentCounter> liveCounters;
-
- static {
- liveCounters = Collections.newSetFromMap(new ConcurrentHashMap<ConcurrentCounter, Boolean>()); //nifty way to get concurrent hash set
- //Set a background thread to flush any liveCounters every 100 milliseconds
- Executors.newScheduledThreadPool(1).scheduleAtFixedRate(new Runnable() {
- public void run() {
- for(ConcurrentCounter c : liveCounters) {
- c.flush();
- }
- }}, 100, 100, TimeUnit.MILLISECONDS);
- }
-
- /**
- * Very simple data structure to store off a single count entry at a single point in time
- * @author kyle
- *
- */
- protected static final class CountAtom {
- protected Date date;
- protected Long delta;
-
- protected CountAtom(Date date, Long delta) {
- this.date = date;
- this.delta = delta;
- }
-
- public String toString() {
- return "[" + this.date + ": " + this.delta + "]";
- }
- }
-
-
- protected Queue<CountAtom> unprocessedCountBuffer;
- protected Map<DateSpan, CountBuffer> counts;
- protected Date startDate;
-
- /**
- * Factory method to create a new counter instance. (Design note -
- * use a factory pattern here as it may be necessary to hook in other
- * registrations around counter objects as they are created.)
- *
- * @param startDate
- * @return
- */
- public static ICounter createCounter(Date startDate) {
- ConcurrentCounter cc = new ConcurrentCounter(startDate);
- ConcurrentCounter.liveCounters.add(cc);
- return cc;
-
- }
-
- /**
- * Protected constructor - use createCounter factory method instead
- * @param startDate
- */
- protected ConcurrentCounter(Date startDate) {
- init(startDate);
- }
-
- protected void init(Date startDate) {
- this.startDate = startDate;
- this.unprocessedCountBuffer = new ConcurrentLinkedQueue<CountAtom>();
- this.counts = new HashMap<DateSpan, CountBuffer>();
-
- for(DateSpan ds : DateSpan.values()) {
- CountBuffer cb = new CountBuffer(startDate, ds, MAX_HISTORY.get(ds));
- counts.put(ds, cb);
- }
- }
- /**
- * This is the key method that has to be both fast and very thread-safe.
- */
- @Override
- public void increment() {
- this.increment(new Date(), (long)1);
- }
-
- @Override
- public void increment(Date d, long delta) {
- this.unprocessedCountBuffer.add(new CountAtom(d, delta));
- }
-
- @Override
- public void setCounter(Date d, CounterValue value) {
- // To be done later
- }
-
- /**
- * Reset the value.
- */
- @Override
- public void reset(Date startDate) {
- init(startDate);
- }
-
- /**
- * Flushes values out of the internal buffer and in to structures
- * that can be fetched with a call to snapshot()
- */
- public synchronized void flush() {
- for(CountAtom c = this.unprocessedCountBuffer.poll(); c != null; c = this.unprocessedCountBuffer.poll()) {
- for(DateSpan ds : DateSpan.values()) {
- CountBuffer cb = counts.get(ds);
- cb.increment(c.date, c.delta);
- }
- }
- }
-
- @Override
- public CounterValue getCounterValue() {
- // To be done later
- //CountSeries cs = counts.get(DateSpan.REALTIME).snapshot();
- //return cs.getSeries()[0];
- return new CounterValue(CounterType.LONG);
- }
-
- @Override
- public Date getCounterDate() {
- // To be done later
- //CountSeries cs = counts.get(DateSpan.REALTIME).snapshot();
- //return cs.getSeries()[0];
- return new Date();
- }
-
- @Override
- /**
- * This method returns a disconnected copy of the underlying CountSeries corresponding to dateSpan.
- */
- public CountSeries snapshot(DateSpan dateSpan) {
- flush();
- CountSeries cs = counts.get(dateSpan).snapshot();
- return cs;
- }
-
-
-
-}
diff --git a/src/main/java/net/floodlightcontroller/counter/CountBuffer.java b/src/main/java/net/floodlightcontroller/counter/CountBuffer.java
deleted file mode 100644
index fa45862..0000000
--- a/src/main/java/net/floodlightcontroller/counter/CountBuffer.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
-
-package net.floodlightcontroller.counter;
-
-import java.util.Date;
-
-import net.floodlightcontroller.counter.ICounter.DateSpan;
-
-
-/**
- * Implements a circular buffer to store the last x time-based counter values. This is pretty crumby
- * implementation, basically wrapping everything with synchronized blocks, in order to ensure that threads
- * which will be updating the series don't result in a thread which is reading the series getting stuck with
- * a start date which does not correspond to the count values in getSeries.
- *
- * This could probably use a re-think...
- *
- * @author kyle
- *
- */
-public class CountBuffer {
- protected long[] counterValues;
- protected Date startDate;
- protected DateSpan dateSpan;
- protected int currentIndex;
- protected int seriesLength;
-
-
- public CountBuffer(Date startDate, DateSpan dateSpan, int seriesLength) {
- this.seriesLength = seriesLength;
- this.counterValues = new long[seriesLength];
- this.dateSpan = dateSpan;
-
- this.startDate = startDate;
- this.currentIndex = 0;
- }
-
- /**
- * Increment the count associated with Date d, forgetting some of the older count values if necessary to ensure
- * that the total span of time covered by this series corresponds to DateSpan * seriesLength (circular buffer).
- *
- * Note - fails silently if the Date falls prior to the start of the tracked count values.
- *
- * Note - this should be a reasonably fast method, though it will have to block if there is another thread reading the
- * series at the same time.
- *
- * @param d
- * @param delta
- */
- public synchronized void increment(Date d, long delta) {
-
- long dsMillis = CountSeries.dateSpanToMilliseconds(this.dateSpan);
- Date endDate = new Date(startDate.getTime() + seriesLength * dsMillis - 1);
-
- if(d.getTime() < startDate.getTime()) {
- return; //silently fail rather than insert a count at a time older than the history buffer we're keeping
- }
- else if (d.getTime() >= startDate.getTime() && d.getTime() <= endDate.getTime()) {
- int index = (int) (( d.getTime() - startDate.getTime() ) / dsMillis); // java rounds down on long/long
- int modIndex = (index + currentIndex) % seriesLength;
- long currentValue = counterValues[modIndex];
- counterValues[modIndex] = currentValue + delta;
- }
- else if (d.getTime() > endDate.getTime()) {
- //Initialize new buckets
- int newBuckets = (int)((d.getTime() - endDate.getTime()) / dsMillis) + 1; // java rounds down on long/long
- for(int i = 0; i < newBuckets; i++) {
- int modIndex = (i + currentIndex) % seriesLength;
- counterValues[modIndex] = 0;
- }
- //Update internal vars
- this.startDate = new Date(startDate.getTime() + dsMillis * newBuckets);
- this.currentIndex = (currentIndex + newBuckets) % this.seriesLength;
-
- //Call again (date should be in the range this time)
- this.increment(d, delta);
- }
- }
-
- /**
- * Relatively slow method, expected to be called primarily from UI rather than from in-packet-path.
- *
- * @return the count values associated with each time interval starting with startDate and demarc'ed by dateSpan
- */
- public long[] getSeries() { //synchronized here should lock on 'this', implying that it shares the lock with increment
- long[] ret = new long[this.seriesLength];
- for(int i = 0; i < this.seriesLength; i++) {
- int modIndex = (currentIndex + i) % this.seriesLength;
- ret[i] = this.counterValues[modIndex];
- }
- return ret;
- }
-
-
- /**
- * Returns an immutable count series that represents a snapshot of this
- * series at a specific moment in time.
- * @return
- */
- public synchronized CountSeries snapshot() {
- long[] cvs = new long[this.seriesLength];
- for(int i = 0; i < this.seriesLength; i++) {
- int modIndex = (this.currentIndex + i) % this.seriesLength;
- cvs[i] = this.counterValues[modIndex];
- }
-
- return new CountSeries(this.startDate, this.dateSpan, cvs);
- }
-
-}
diff --git a/src/main/java/net/floodlightcontroller/counter/CountSeries.java b/src/main/java/net/floodlightcontroller/counter/CountSeries.java
deleted file mode 100644
index e8a547a..0000000
--- a/src/main/java/net/floodlightcontroller/counter/CountSeries.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
-
-package net.floodlightcontroller.counter;
-
-import java.util.Arrays;
-import java.util.Date;
-
-import net.floodlightcontroller.counter.ICounter.DateSpan;
-
-/**
- * Simple immutable class to store a series of historic counter values
- *
- * This could probably use a re-think...
- *
- * @author kyle
- *
- */
-public class CountSeries {
- protected long[] counterValues;
- protected Date startDate;
- protected DateSpan dateSpan;
-
- public CountSeries(Date startDate, DateSpan dateSpan, long[] counterValues) {
- this.counterValues = counterValues.clone();
- this.dateSpan = dateSpan;
- this.startDate = startDate;
- }
-
-
- public long[] getSeries() { //synchronized here should lock on 'this', implying that it shares the lock with increment
- return this.counterValues.clone();
- }
-
- /**
- * Returns the startDate of this series. The first long in getSeries represents the sum of deltas from increment calls with dates
- * that correspond to >= startDate and < startDate + DateSpan.
- * @return
- */
- public Date getStartDate() {//synchronized here should lock on 'this', implying that it shares the lock with increment
- return this.startDate;
- }
-
- public String toString() {
- String ret = "{start: " + this.startDate + ", span: " + this.dateSpan + ", series: " + Arrays.toString(getSeries()) + "}";
- return ret;
- }
-
- /**
- * Return a long that is the number of milliseconds in a ds (second/minute/hour/day/week). (Utility method.)
- *
- * @param ds
- * @return
- */
- public static final long dateSpanToMilliseconds(DateSpan ds) {
- long delta = 1;
- switch(ds) {
- case WEEKS:
- delta *= 7;
- case DAYS:
- delta *= 24;
- case HOURS:
- delta *= 60;
- case MINUTES:
- delta *= 60;
- case SECONDS:
- delta *= 1000;
- default:
- break;
- }
- return delta;
- }
-
-}
diff --git a/src/main/java/net/floodlightcontroller/counter/CounterStore.java b/src/main/java/net/floodlightcontroller/counter/CounterStore.java
deleted file mode 100644
index 15ce53b..0000000
--- a/src/main/java/net/floodlightcontroller/counter/CounterStore.java
+++ /dev/null
@@ -1,461 +0,0 @@
-/**
- * Copyright 2011, Big Switch Networks, Inc.
- * Originally created by David Erickson, Stanford University
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License. You may obtain
- * a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- **/
-
-/**
- * Implements a very simple central store for system counters
- */
-package net.floodlightcontroller.counter;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-import javax.annotation.PostConstruct;
-
-import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.module.FloodlightModuleException;
-import net.floodlightcontroller.core.module.IFloodlightModule;
-import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.counter.CounterValue.CounterType;
-import net.floodlightcontroller.packet.Ethernet;
-import net.floodlightcontroller.packet.IPv4;
-
-import org.openflow.protocol.OFMessage;
-import org.openflow.protocol.OFPacketIn;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * @author kyle
- *
- */
-public class CounterStore implements IFloodlightModule, ICounterStoreService {
- protected final static Logger log = LoggerFactory.getLogger(CounterStore.class);
-
- public enum NetworkLayer {
- L2, L3, L4
- }
-
- protected class CounterEntry {
- protected ICounter counter;
- String title;
- }
-
- /**
- * A map of counterName --> Counter
- */
- protected ConcurrentHashMap<String, CounterEntry> nameToCEIndex =
- new ConcurrentHashMap<String, CounterEntry>();
-
- protected ICounter heartbeatCounter;
- protected ICounter randomCounter;
-
- /**
- * Counter Categories grouped by network layers
- * NetworkLayer -> CounterToCategories
- */
- protected static Map<NetworkLayer, Map<String, List<String>>> layeredCategories =
- new ConcurrentHashMap<NetworkLayer, Map<String, List<String>>> ();
-
- public void updatePacketInCounters(IOFSwitch sw, OFMessage m, Ethernet eth) {
- OFPacketIn packet = (OFPacketIn)m;
-
- // Make sure there is data
- if (packet.getPacketData().length <= 0) return;
-
- /* Extract the etherType and protocol field for IPv4 packet.
- */
- String etherType = String.format("%04x", eth.getEtherType());
-
- /*
- * Valid EtherType must be greater than or equal to 0x0600
- * It is V1 Ethernet Frame if EtherType < 0x0600
- */
- if (eth.getEtherType() < 0x0600) {
- etherType = "0599";
- }
-
- if (TypeAliases.l3TypeAliasMap != null &&
- TypeAliases.l3TypeAliasMap.containsKey(etherType)) {
- etherType = TypeAliases.l3TypeAliasMap.get(etherType);
- } else {
- etherType = "L3_" + etherType;
- }
- String switchIdHex = sw.getStringId();
-
- String packetName = m.getType().toClass().getName();
- packetName = packetName.substring(packetName.lastIndexOf('.')+1);
-
- // Construct controller counter for the packet_in
- String controllerCounterName =
- CounterStore.createCounterName(CONTROLLER_NAME,
- -1,
- packetName);
-
- String controllerL3CategoryCounterName =
- CounterStore.createCounterName(CONTROLLER_NAME,
- -1,
- packetName,
- etherType,
- NetworkLayer.L3);
-
- String l2Type = null;
- if (eth.isBroadcast()) {
- l2Type = BROADCAST;
- } else if (eth.isMulticast()) {
- l2Type = MULTICAST;
- } else {
- l2Type = UNICAST;
- }
-
- // Construct both port and switch L3 counter for the packet_in
- String controllerL2CategoryCounterName = CounterStore.createCounterName(CONTROLLER_NAME,
- -1,
- packetName,
- l2Type,
- NetworkLayer.L2);
- String switchL2CategoryCounterName = CounterStore.createCounterName(switchIdHex,
- -1,
- packetName,
- l2Type,
- NetworkLayer.L2);
- String portL2CategoryCounterName = CounterStore.createCounterName(switchIdHex,
- packet.getInPort(),
- packetName,
- l2Type,
- NetworkLayer.L2);
-
- // Construct both port and switch L3 counter for the packet_in
- String portCounterName =
- CounterStore.createCounterName(switchIdHex,
- packet.getInPort(),
- packetName);
- String switchCounterName =
- CounterStore.createCounterName(switchIdHex,
- -1,
- packetName);
-
- String portL3CategoryCounterName =
- CounterStore.createCounterName(switchIdHex,
- packet.getInPort(),
- packetName,
- etherType,
- NetworkLayer.L3);
- String switchL3CategoryCounterName =
- CounterStore.createCounterName(switchIdHex,
- -1,
- packetName,
- etherType,
- NetworkLayer.L3);
-
- // Controller counters
- ICounter controllerCounter = getCounter(controllerCounterName);
- if (controllerCounter == null) {
- controllerCounter = createCounter(controllerCounterName,
- CounterType.LONG);
- }
- controllerCounter.increment();
- ICounter portCounter = getCounter(portCounterName);
- if (portCounter == null) {
- portCounter = createCounter(portCounterName,
- CounterType.LONG);
- }
- portCounter.increment();
- ICounter switchCounter = getCounter(switchCounterName);
- if (switchCounter == null) {
- switchCounter = createCounter(switchCounterName,
- CounterType.LONG);
- }
- switchCounter.increment();
-
- // L2 counters
- ICounter controllerL2Counter = getCounter(controllerL2CategoryCounterName);
- if (controllerL2Counter == null) {
- controllerL2Counter = createCounter(controllerL2CategoryCounterName,
- CounterType.LONG);
- }
- controllerL2Counter.increment();
- ICounter switchL2Counter = getCounter(switchL2CategoryCounterName);
- if (switchL2Counter == null) {
- switchL2Counter = createCounter(switchL2CategoryCounterName,
- CounterType.LONG);
- }
- switchL2Counter.increment();
- ICounter portL2Counter = getCounter(portL2CategoryCounterName);
- if (portL2Counter == null) {
- portL2Counter = createCounter(portL2CategoryCounterName,
- CounterType.LONG);
- }
- portL2Counter.increment();
-
- // L3 counters
- ICounter controllerL3Counter = getCounter(controllerL3CategoryCounterName);
- if (controllerL3Counter == null) {
- controllerL3Counter = createCounter(controllerL3CategoryCounterName,
- CounterType.LONG);
- }
- controllerL3Counter.increment();
- ICounter portL3Counter = getCounter(portL3CategoryCounterName);
- if (portL3Counter == null) {
- portL3Counter = createCounter(portL3CategoryCounterName,
- CounterType.LONG);
- }
- portL3Counter.increment();
- ICounter switchL3Counter = getCounter(switchL3CategoryCounterName);
- if (switchL3Counter == null) {
- switchL3Counter = createCounter(switchL3CategoryCounterName,
- CounterType.LONG);
- }
- switchL3Counter.increment();
-
- // L4 counters
- if (etherType.compareTo(CounterStore.L3ET_IPV4) == 0) {
- IPv4 ipV4 = (IPv4)eth.getPayload();
- String l4Type = String.format("%02x", ipV4.getProtocol());
- if (TypeAliases.l4TypeAliasMap != null &&
- TypeAliases.l4TypeAliasMap.containsKey(l4Type)) {
- l4Type = TypeAliases.l4TypeAliasMap.get(l4Type);
- } else {
- l4Type = "L4_" + l4Type;
- }
- String controllerL4CategoryCounterName =
- CounterStore.createCounterName(CONTROLLER_NAME,
- -1,
- packetName,
- l4Type,
- NetworkLayer.L4);
- String portL4CategoryCounterName =
- CounterStore.createCounterName(switchIdHex,
- packet.getInPort(),
- packetName,
- l4Type,
- NetworkLayer.L4);
- String switchL4CategoryCounterName =
- CounterStore.createCounterName(switchIdHex,
- -1,
- packetName,
- l4Type,
- NetworkLayer.L4);
- ICounter controllerL4Counter = getCounter(controllerL4CategoryCounterName);
- if (controllerL4Counter == null) {
- controllerL4Counter = createCounter(controllerL4CategoryCounterName,
- CounterType.LONG);
- }
- controllerL4Counter.increment();
- ICounter portL4Counter = getCounter(portL4CategoryCounterName);
- if (portL4Counter == null) {
- portL4Counter = createCounter(portL4CategoryCounterName,
- CounterType.LONG);
- }
- portL4Counter.increment();
- ICounter switchL4Counter = getCounter(switchL4CategoryCounterName);
- if (switchL4Counter == null) {
- switchL4Counter = createCounter(switchL4CategoryCounterName,
- CounterType.LONG);
- }
- switchL4Counter.increment();
- }
- }
-
- /**
- * This method can only be used to update packetOut and flowmod counters
- *
- * @param sw
- * @param ofMsg
- */
- public void updatePktOutFMCounterStore(IOFSwitch sw, OFMessage ofMsg) {
- String packetName = ofMsg.getType().toClass().getName();
- packetName = packetName.substring(packetName.lastIndexOf('.')+1);
- // flowmod is per switch and controller. portid = -1
- String controllerFMCounterName = CounterStore.createCounterName(CONTROLLER_NAME, -1, packetName);
- ICounter counter = getCounter(controllerFMCounterName);
- if (counter == null) {
- counter = createCounter(controllerFMCounterName, CounterValue.CounterType.LONG);
- }
- counter.increment();
-
- String switchFMCounterName = CounterStore.createCounterName(sw.getStringId(), -1, packetName);
- counter = getCounter(switchFMCounterName);
- if (counter == null) {
- counter = createCounter(switchFMCounterName, CounterValue.CounterType.LONG);
- }
- counter.increment();
- }
-
-
- /**
- * Create a title based on switch ID, portID, vlanID, and counterName
- * If portID is -1, the title represents the given switch only
- * If portID is a non-negative number, the title represents the port on the given switch
- */
- public static String createCounterName(String switchID, int portID, String counterName) {
- if (portID < 0) {
- return switchID + TitleDelimitor + counterName;
- } else {
- return switchID + TitleDelimitor + portID + TitleDelimitor + counterName;
- }
- }
-
- /**
- * Create a title based on switch ID, portID, vlanID, counterName, and subCategory
- * If portID is -1, the title represents the given switch only
- * If portID is a non-negative number, the title represents the port on the given switch
- * For example: PacketIns can be further categorized based on L2 etherType or L3 protocol
- */
- public static String createCounterName(String switchID, int portID, String counterName,
- String subCategory, NetworkLayer layer) {
- String fullCounterName = "";
- String groupCounterName = "";
-
- if (portID < 0) {
- groupCounterName = switchID + TitleDelimitor + counterName;
- fullCounterName = groupCounterName + TitleDelimitor + subCategory;
- } else {
- groupCounterName = switchID + TitleDelimitor + portID + TitleDelimitor + counterName;
- fullCounterName = groupCounterName + TitleDelimitor + subCategory;
- }
-
- Map<String, List<String>> counterToCategories;
- if (layeredCategories.containsKey(layer)) {
- counterToCategories = layeredCategories.get(layer);
- } else {
- counterToCategories = new ConcurrentHashMap<String, List<String>> ();
- layeredCategories.put(layer, counterToCategories);
- }
-
- List<String> categories;
- if (counterToCategories.containsKey(groupCounterName)) {
- categories = counterToCategories.get(groupCounterName);
- } else {
- categories = new ArrayList<String>();
- counterToCategories.put(groupCounterName, categories);
- }
-
- if (!categories.contains(subCategory)) {
- categories.add(subCategory);
- }
- return fullCounterName;
- }
-
- @Override
- public List<String> getAllCategories(String counterName, NetworkLayer layer) {
- if (layeredCategories.containsKey(layer)) {
- Map<String, List<String>> counterToCategories = layeredCategories.get(layer);
- if (counterToCategories.containsKey(counterName)) {
- return counterToCategories.get(counterName);
- }
- }
- return null;
- }
-
- @Override
- public ICounter createCounter(String key, CounterValue.CounterType type) {
- CounterEntry ce;
- ICounter c;
-
- c = SimpleCounter.createCounter(new Date(), type);
- ce = new CounterEntry();
- ce.counter = c;
- ce.title = key;
- nameToCEIndex.putIfAbsent(key, ce);
-
- return nameToCEIndex.get(key).counter;
- }
-
- /**
- * Post construction init method to kick off the health check and random (test) counter threads
- */
- @PostConstruct
- public void startUp() {
- this.heartbeatCounter = this.createCounter("CounterStore heartbeat", CounterValue.CounterType.LONG);
- this.randomCounter = this.createCounter("CounterStore random", CounterValue.CounterType.LONG);
- //Set a background thread to flush any liveCounters every 100 milliseconds
- Executors.newScheduledThreadPool(1).scheduleAtFixedRate(new Runnable() {
- public void run() {
- heartbeatCounter.increment();
- randomCounter.increment(new Date(), (long) (Math.random() * 100)); //TODO - pull this in to random timing
- }}, 100, 100, TimeUnit.MILLISECONDS);
- }
-
- @Override
- public ICounter getCounter(String key) {
- CounterEntry counter = nameToCEIndex.get(key);
- if (counter != null) {
- return counter.counter;
- } else {
- return null;
- }
- }
-
- /* (non-Javadoc)
- * @see net.floodlightcontroller.counter.ICounterStoreService#getAll()
- */
- @Override
- public Map<String, ICounter> getAll() {
- Map<String, ICounter> ret = new ConcurrentHashMap<String, ICounter>();
- for(Map.Entry<String, CounterEntry> counterEntry : this.nameToCEIndex.entrySet()) {
- String key = counterEntry.getKey();
- ICounter counter = counterEntry.getValue().counter;
- ret.put(key, counter);
- }
- return ret;
- }
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleServices() {
- Collection<Class<? extends IFloodlightService>> services =
- new ArrayList<Class<? extends IFloodlightService>>(1);
- services.add(ICounterStoreService.class);
- return services;
- }
-
- @Override
- public Map<Class<? extends IFloodlightService>, IFloodlightService>
- getServiceImpls() {
- Map<Class<? extends IFloodlightService>,
- IFloodlightService> m =
- new HashMap<Class<? extends IFloodlightService>,
- IFloodlightService>();
- m.put(ICounterStoreService.class, this);
- return m;
- }
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
- // no-op, no dependencies
- return null;
- }
-
- @Override
- public void init(FloodlightModuleContext context)
- throws FloodlightModuleException {
- // no-op for now
- }
-
- @Override
- public void startUp(FloodlightModuleContext context) {
- // no-op for now
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/counter/CounterValue.java b/src/main/java/net/floodlightcontroller/counter/CounterValue.java
deleted file mode 100644
index 1852d5c..0000000
--- a/src/main/java/net/floodlightcontroller/counter/CounterValue.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
-
-package net.floodlightcontroller.counter;
-
-/**
- * The class defines the counter value type and value
- *
- * @author Kanzhe
- *
- */
-public class CounterValue {
- public enum CounterType {
- LONG,
- DOUBLE
- }
-
- protected CounterType type;
- protected long longValue;
- protected double doubleValue;
-
- public CounterValue(CounterType type) {
- this.type = CounterType.LONG;
- this.longValue = 0;
- this.doubleValue = 0.0;
- }
-
- /**
- * This method is only applicable to type long.
- * Setter() should be used for type double
- */
- public void increment(long delta) {
- if (this.type == CounterType.LONG) {
- this.longValue += delta;
- } else {
- throw new IllegalArgumentException("Invalid counter type. This counter is not a long type.");
- }
- }
-
- public void setLongValue(long value) {
- if (this.type == CounterType.LONG) {
- this.longValue = value;
- } else {
- throw new IllegalArgumentException("Invalid counter type. This counter is not a long type.");
- }
- }
-
- public void setDoubleValue(double value) {
- if (this.type == CounterType.DOUBLE) {
- this.doubleValue = value;
- } else {
- throw new IllegalArgumentException("Invalid counter type. This counter is not a double type.");
- }
- }
-
- public long getLong() {
- if (this.type == CounterType.LONG) {
- return this.longValue;
- } else {
- throw new IllegalArgumentException("Invalid counter type. This counter is not a long type.");
- }
- }
-
- public double getDouble() {
- if (this.type == CounterType.DOUBLE) {
- return this.doubleValue;
- } else {
- throw new IllegalArgumentException("Invalid counter type. This counter is not a double type.");
- }
- }
-
-
- public CounterType getType() {
- return this.type;
- }
-
- public String toString() {
- String ret = "{type: ";
- if (this.type == CounterType.DOUBLE) {
- ret += "Double" + ", value: " + this.doubleValue + "}";
- } else {
- ret += "Long" + ", value: " + this.longValue + "}";
- }
- return ret;
- }
-
-
-}
diff --git a/src/main/java/net/floodlightcontroller/counter/ICounter.java b/src/main/java/net/floodlightcontroller/counter/ICounter.java
deleted file mode 100644
index 625bebd..0000000
--- a/src/main/java/net/floodlightcontroller/counter/ICounter.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
-
-/**
- * Simple interface for a counter whose value can be retrieved in several different
- * time increments (last x seconds, minutes, hours, days)
- */
-package net.floodlightcontroller.counter;
-
-import java.util.Date;
-
-/**
- * @author kyle
- *
- */
-public interface ICounter {
-
- /**
- * Most commonly used method
- */
- public void increment();
-
- /**
- * Used primarily for testing - no performance guarantees
- */
- public void increment(Date d, long delta);
-
- /**
- * Counter value setter
- */
- public void setCounter(Date d, CounterValue value);
-
- /**
- * Return the most current value
- */
- public Date getCounterDate();
-
- /**
- * Return the most current value
- */
- public CounterValue getCounterValue();
-
- /**
- * Reset the value
- */
- public void reset(Date d);
-
- /**
- * Returns a CountSeries that is a snapshot of the counter's values for the given dateSpan. (Further changes
- * to this counter won't be reflected in the CountSeries that comes back.)
- *
- * @param dateSpan
- * @return
- */
- public CountSeries snapshot(DateSpan dateSpan);
-
-
- public static enum DateSpan {
- REALTIME,
- SECONDS,
- MINUTES,
- HOURS,
- DAYS,
- WEEKS
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/counter/ICounterStoreService.java b/src/main/java/net/floodlightcontroller/counter/ICounterStoreService.java
deleted file mode 100644
index c89eee0..0000000
--- a/src/main/java/net/floodlightcontroller/counter/ICounterStoreService.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package net.floodlightcontroller.counter;
-
-import java.util.List;
-import java.util.Map;
-
-import org.openflow.protocol.OFMessage;
-
-import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.counter.CounterStore.NetworkLayer;
-import net.floodlightcontroller.packet.Ethernet;
-
-public interface ICounterStoreService extends IFloodlightService {
-
- public final static String CONTROLLER_NAME = "controller";
- public final static String TitleDelimitor = "__";
-
- /** Broadcast and multicast */
- public final static String BROADCAST = "broadcast";
- public final static String MULTICAST = "multicast";
- public final static String UNICAST = "unicast";
-
- /** L2 EtherType subCategories */
- public final static String L3ET_IPV4 = "L3_IPv4";
-
- /**
- * Update packetIn counters
- *
- * @param sw
- * @param m
- * @param eth
- */
- public void updatePacketInCounters(IOFSwitch sw, OFMessage m, Ethernet eth);
-
- /**
- * This method can only be used to update packetOut and flowmod counters
- *
- * @param sw
- * @param ofMsg
- */
- public void updatePktOutFMCounterStore(IOFSwitch sw, OFMessage ofMsg);
-
- /**
- * Retrieve a list of subCategories by counterName.
- * null if nothing.
- */
- public List<String> getAllCategories(String counterName,
- NetworkLayer layer);
-
- /**
- * Create a new ICounter and set the title. Note that the title must be
- * unique, otherwise this will throw an IllegalArgumentException.
- *
- * @param key
- * @param type
- * @return
- */
- public ICounter createCounter(String key, CounterValue.CounterType type);
-
- /**
- * Retrieves a counter with the given title, or null if none can be found.
- */
- public ICounter getCounter(String key);
-
- /**
- * Returns an immutable map of title:counter with all of the counters in the store.
- *
- * (Note - this method may be slow - primarily for debugging/UI)
- */
- public Map<String, ICounter> getAll();
-}
diff --git a/src/main/java/net/floodlightcontroller/counter/NullCounterStore.java b/src/main/java/net/floodlightcontroller/counter/NullCounterStore.java
deleted file mode 100644
index fed8c1e..0000000
--- a/src/main/java/net/floodlightcontroller/counter/NullCounterStore.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package net.floodlightcontroller.counter;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.openflow.protocol.OFMessage;
-
-import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.module.FloodlightModuleException;
-import net.floodlightcontroller.core.module.IFloodlightModule;
-import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.counter.CounterStore.NetworkLayer;
-import net.floodlightcontroller.counter.CounterValue.CounterType;
-import net.floodlightcontroller.packet.Ethernet;
-
-/**
- * An ICounsterStoreService implementation that does nothing.
- * This is used mainly for performance testing or if you don't
- * want to use the counterstore.
- * @author alexreimers
- *
- */
-public class NullCounterStore implements IFloodlightModule,
- ICounterStoreService {
-
- private ICounter emptyCounter;
- private List<String> emptyList;
- private Map<String, ICounter> emptyMap;
-
- @Override
- public void updatePacketInCounters(IOFSwitch sw, OFMessage m, Ethernet eth) {
- // no-op
- }
-
- @Override
- public void updatePktOutFMCounterStore(IOFSwitch sw, OFMessage ofMsg) {
- // no-op
- }
-
- @Override
- public List<String>
- getAllCategories(String counterName, NetworkLayer layer) {
- return emptyList;
- }
-
- @Override
- public ICounter createCounter(String key, CounterType type) {
- return emptyCounter;
- }
-
- @Override
- public ICounter getCounter(String key) {
- return emptyCounter;
- }
-
- @Override
- public Map<String, ICounter> getAll() {
- return emptyMap;
- }
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleServices() {
- Collection<Class<? extends IFloodlightService>> services =
- new ArrayList<Class<? extends IFloodlightService>>(1);
- services.add(ICounterStoreService.class);
- return services;
- }
-
- @Override
- public Map<Class<? extends IFloodlightService>, IFloodlightService>
- getServiceImpls() {
- Map<Class<? extends IFloodlightService>,
- IFloodlightService> m =
- new HashMap<Class<? extends IFloodlightService>,
- IFloodlightService>();
- m.put(ICounterStoreService.class, this);
- return m;
- }
-
- @Override
- public Collection<Class<? extends IFloodlightService>>
- getModuleDependencies() {
- // None, return null
- return null;
- }
-
- @Override
- public void init(FloodlightModuleContext context)
- throws FloodlightModuleException {
- emptyCounter = new SimpleCounter(new Date(), CounterType.LONG);
- emptyList = new ArrayList<String>();
- emptyMap = new HashMap<String, ICounter>();
- }
-
- @Override
- public void startUp(FloodlightModuleContext context) {
- // no-op
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/counter/SimpleCounter.java b/src/main/java/net/floodlightcontroller/counter/SimpleCounter.java
deleted file mode 100644
index 01a0428..0000000
--- a/src/main/java/net/floodlightcontroller/counter/SimpleCounter.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
-
-/**
- *
- */
-package net.floodlightcontroller.counter;
-
-import java.util.Date;
-
-
-
-/**
- * This is a simple counter implementation that doesn't support data series.
- * The idea is that floodlight only keeps the realtime value for each counter,
- * statd, a statistics collection daemon, samples counters at a user-defined interval
- * and pushes the values to a database, which keeps time-based data series.
- * @author Kanzhe
- *
- */
-public class SimpleCounter implements ICounter {
-
- protected CounterValue counter;
- protected Date samplingTime;
- protected Date startDate;
-
- /**
- * Factory method to create a new counter instance.
- *
- * @param startDate
- * @return
- */
- public static ICounter createCounter(Date startDate, CounterValue.CounterType type) {
- SimpleCounter cc = new SimpleCounter(startDate, type);
- return cc;
- }
-
- /**
- * Factory method to create a copy of a counter instance.
- *
- * @param startDate
- * @return
- */
- public static ICounter createCounter(ICounter copy) {
- if (copy == null ||
- copy.getCounterDate() == null ||
- copy.getCounterValue() == null) {
- return null;
- }
-
- SimpleCounter cc = new SimpleCounter(copy.getCounterDate(),
- copy.getCounterValue().getType());
- cc.setCounter(copy.getCounterDate(), copy.getCounterValue());
- return cc;
- }
-
- /**
- * Protected constructor - use createCounter factory method instead
- * @param startDate
- */
- protected SimpleCounter(Date startDate, CounterValue.CounterType type) {
- init(startDate, type);
- }
-
- protected void init(Date startDate, CounterValue.CounterType type) {
- this.startDate = startDate;
- this.samplingTime = new Date();
- this.counter = new CounterValue(type);
- }
-
- /**
- * This is the key method that has to be both fast and very thread-safe.
- */
- @Override
- synchronized public void increment() {
- this.increment(new Date(), (long)1);
- }
-
- @Override
- synchronized public void increment(Date d, long delta) {
- this.samplingTime = d;
- this.counter.increment(delta);
- }
-
- synchronized public void setCounter(Date d, CounterValue value) {
- this.samplingTime = d;
- this.counter = value;
- }
-
- /**
- * This is the method to retrieve the current value.
- */
- @Override
- synchronized public CounterValue getCounterValue() {
- return this.counter;
- }
-
- /**
- * This is the method to retrieve the last sampling time.
- */
- @Override
- synchronized public Date getCounterDate() {
- return this.samplingTime;
- }
-
- /**
- * Reset value.
- */
- @Override
- synchronized public void reset(Date startDate) {
- init(startDate, this.counter.getType());
- }
-
- @Override
- /**
- * This method only returns the real-time value.
- */
- synchronized public CountSeries snapshot(DateSpan dateSpan) {
- long[] values = new long[1];
- values[0] = this.counter.getLong();
- return new CountSeries(this.samplingTime, DateSpan.DAYS, values);
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/counter/TypeAliases.java b/src/main/java/net/floodlightcontroller/counter/TypeAliases.java
deleted file mode 100644
index 0d7e2b5..0000000
--- a/src/main/java/net/floodlightcontroller/counter/TypeAliases.java
+++ /dev/null
@@ -1,190 +0,0 @@
-package net.floodlightcontroller.counter;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Class to contain some statically initialized data
- * @author readams
- *
- */
-public class TypeAliases {
- protected static final Map<String,String> l3TypeAliasMap =
- new HashMap<String, String>();
- static {
- l3TypeAliasMap.put("0599", "L3_V1Ether");
- l3TypeAliasMap.put("0800", "L3_IPv4");
- l3TypeAliasMap.put("0806", "L3_ARP");
- l3TypeAliasMap.put("8035", "L3_RARP");
- l3TypeAliasMap.put("809b", "L3_AppleTalk");
- l3TypeAliasMap.put("80f3", "L3_AARP");
- l3TypeAliasMap.put("8100", "L3_802_1Q");
- l3TypeAliasMap.put("8137", "L3_Novell_IPX");
- l3TypeAliasMap.put("8138", "L3_Novell");
- l3TypeAliasMap.put("86dd", "L3_IPv6");
- l3TypeAliasMap.put("8847", "L3_MPLS_uni");
- l3TypeAliasMap.put("8848", "L3_MPLS_multi");
- l3TypeAliasMap.put("8863", "L3_PPPoE_DS");
- l3TypeAliasMap.put("8864", "L3_PPPoE_SS");
- l3TypeAliasMap.put("886f", "L3_MSFT_NLB");
- l3TypeAliasMap.put("8870", "L3_Jumbo");
- l3TypeAliasMap.put("889a", "L3_HyperSCSI");
- l3TypeAliasMap.put("88a2", "L3_ATA_Ethernet");
- l3TypeAliasMap.put("88a4", "L3_EtherCAT");
- l3TypeAliasMap.put("88a8", "L3_802_1ad");
- l3TypeAliasMap.put("88ab", "L3_Ether_Powerlink");
- l3TypeAliasMap.put("88cc", "L3_LLDP");
- l3TypeAliasMap.put("88cd", "L3_SERCOS_III");
- l3TypeAliasMap.put("88e5", "L3_802_1ae");
- l3TypeAliasMap.put("88f7", "L3_IEEE_1588");
- l3TypeAliasMap.put("8902", "L3_802_1ag_CFM");
- l3TypeAliasMap.put("8906", "L3_FCoE");
- l3TypeAliasMap.put("9000", "L3_Loop");
- l3TypeAliasMap.put("9100", "L3_Q_in_Q");
- l3TypeAliasMap.put("cafe", "L3_LLT");
- }
-
- protected static final Map<String,String> l4TypeAliasMap =
- new HashMap<String, String>();
- static {
- l4TypeAliasMap.put("00", "L4_HOPOPT");
- l4TypeAliasMap.put("01", "L4_ICMP");
- l4TypeAliasMap.put("02", "L4_IGAP_IGMP_RGMP");
- l4TypeAliasMap.put("03", "L4_GGP");
- l4TypeAliasMap.put("04", "L4_IP");
- l4TypeAliasMap.put("05", "L4_ST");
- l4TypeAliasMap.put("06", "L4_TCP");
- l4TypeAliasMap.put("07", "L4_UCL");
- l4TypeAliasMap.put("08", "L4_EGP");
- l4TypeAliasMap.put("09", "L4_IGRP");
- l4TypeAliasMap.put("0a", "L4_BBN");
- l4TypeAliasMap.put("0b", "L4_NVP");
- l4TypeAliasMap.put("0c", "L4_PUP");
- l4TypeAliasMap.put("0d", "L4_ARGUS");
- l4TypeAliasMap.put("0e", "L4_EMCON");
- l4TypeAliasMap.put("0f", "L4_XNET");
- l4TypeAliasMap.put("10", "L4_Chaos");
- l4TypeAliasMap.put("11", "L4_UDP");
- l4TypeAliasMap.put("12", "L4_TMux");
- l4TypeAliasMap.put("13", "L4_DCN");
- l4TypeAliasMap.put("14", "L4_HMP");
- l4TypeAliasMap.put("15", "L4_Packet_Radio");
- l4TypeAliasMap.put("16", "L4_XEROX_NS_IDP");
- l4TypeAliasMap.put("17", "L4_Trunk_1");
- l4TypeAliasMap.put("18", "L4_Trunk_2");
- l4TypeAliasMap.put("19", "L4_Leaf_1");
- l4TypeAliasMap.put("1a", "L4_Leaf_2");
- l4TypeAliasMap.put("1b", "L4_RDP");
- l4TypeAliasMap.put("1c", "L4_IRTP");
- l4TypeAliasMap.put("1d", "L4_ISO_TP4");
- l4TypeAliasMap.put("1e", "L4_NETBLT");
- l4TypeAliasMap.put("1f", "L4_MFE");
- l4TypeAliasMap.put("20", "L4_MERIT");
- l4TypeAliasMap.put("21", "L4_DCCP");
- l4TypeAliasMap.put("22", "L4_Third_Party_Connect");
- l4TypeAliasMap.put("23", "L4_IDPR");
- l4TypeAliasMap.put("24", "L4_XTP");
- l4TypeAliasMap.put("25", "L4_Datagram_Delivery");
- l4TypeAliasMap.put("26", "L4_IDPR");
- l4TypeAliasMap.put("27", "L4_TP");
- l4TypeAliasMap.put("28", "L4_ILTP");
- l4TypeAliasMap.put("29", "L4_IPv6_over_IPv4");
- l4TypeAliasMap.put("2a", "L4_SDRP");
- l4TypeAliasMap.put("2b", "L4_IPv6_RH");
- l4TypeAliasMap.put("2c", "L4_IPv6_FH");
- l4TypeAliasMap.put("2d", "L4_IDRP");
- l4TypeAliasMap.put("2e", "L4_RSVP");
- l4TypeAliasMap.put("2f", "L4_GRE");
- l4TypeAliasMap.put("30", "L4_DSR");
- l4TypeAliasMap.put("31", "L4_BNA");
- l4TypeAliasMap.put("32", "L4_ESP");
- l4TypeAliasMap.put("33", "L4_AH");
- l4TypeAliasMap.put("34", "L4_I_NLSP");
- l4TypeAliasMap.put("35", "L4_SWIPE");
- l4TypeAliasMap.put("36", "L4_NARP");
- l4TypeAliasMap.put("37", "L4_Minimal_Encapsulation");
- l4TypeAliasMap.put("38", "L4_TLSP");
- l4TypeAliasMap.put("39", "L4_SKIP");
- l4TypeAliasMap.put("3a", "L4_ICMPv6");
- l4TypeAliasMap.put("3b", "L4_IPv6_No_Next_Header");
- l4TypeAliasMap.put("3c", "L4_IPv6_Destination_Options");
- l4TypeAliasMap.put("3d", "L4_Any_host_IP");
- l4TypeAliasMap.put("3e", "L4_CFTP");
- l4TypeAliasMap.put("3f", "L4_Any_local");
- l4TypeAliasMap.put("40", "L4_SATNET");
- l4TypeAliasMap.put("41", "L4_Kryptolan");
- l4TypeAliasMap.put("42", "L4_MIT_RVDP");
- l4TypeAliasMap.put("43", "L4_Internet_Pluribus");
- l4TypeAliasMap.put("44", "L4_Distributed_FS");
- l4TypeAliasMap.put("45", "L4_SATNET");
- l4TypeAliasMap.put("46", "L4_VISA");
- l4TypeAliasMap.put("47", "L4_IP_Core");
- l4TypeAliasMap.put("4a", "L4_Wang_Span");
- l4TypeAliasMap.put("4b", "L4_Packet_Video");
- l4TypeAliasMap.put("4c", "L4_Backroom_SATNET");
- l4TypeAliasMap.put("4d", "L4_SUN_ND");
- l4TypeAliasMap.put("4e", "L4_WIDEBAND_Monitoring");
- l4TypeAliasMap.put("4f", "L4_WIDEBAND_EXPAK");
- l4TypeAliasMap.put("50", "L4_ISO_IP");
- l4TypeAliasMap.put("51", "L4_VMTP");
- l4TypeAliasMap.put("52", "L4_SECURE_VMTP");
- l4TypeAliasMap.put("53", "L4_VINES");
- l4TypeAliasMap.put("54", "L4_TTP");
- l4TypeAliasMap.put("55", "L4_NSFNET_IGP");
- l4TypeAliasMap.put("56", "L4_Dissimilar_GP");
- l4TypeAliasMap.put("57", "L4_TCF");
- l4TypeAliasMap.put("58", "L4_EIGRP");
- l4TypeAliasMap.put("59", "L4_OSPF");
- l4TypeAliasMap.put("5a", "L4_Sprite_RPC");
- l4TypeAliasMap.put("5b", "L4_Locus_ARP");
- l4TypeAliasMap.put("5c", "L4_MTP");
- l4TypeAliasMap.put("5d", "L4_AX");
- l4TypeAliasMap.put("5e", "L4_IP_within_IP");
- l4TypeAliasMap.put("5f", "L4_Mobile_ICP");
- l4TypeAliasMap.put("61", "L4_EtherIP");
- l4TypeAliasMap.put("62", "L4_Encapsulation_Header");
- l4TypeAliasMap.put("64", "L4_GMTP");
- l4TypeAliasMap.put("65", "L4_IFMP");
- l4TypeAliasMap.put("66", "L4_PNNI");
- l4TypeAliasMap.put("67", "L4_PIM");
- l4TypeAliasMap.put("68", "L4_ARIS");
- l4TypeAliasMap.put("69", "L4_SCPS");
- l4TypeAliasMap.put("6a", "L4_QNX");
- l4TypeAliasMap.put("6b", "L4_Active_Networks");
- l4TypeAliasMap.put("6c", "L4_IPPCP");
- l4TypeAliasMap.put("6d", "L4_SNP");
- l4TypeAliasMap.put("6e", "L4_Compaq_Peer_Protocol");
- l4TypeAliasMap.put("6f", "L4_IPX_in_IP");
- l4TypeAliasMap.put("70", "L4_VRRP");
- l4TypeAliasMap.put("71", "L4_PGM");
- l4TypeAliasMap.put("72", "L4_0_hop");
- l4TypeAliasMap.put("73", "L4_L2TP");
- l4TypeAliasMap.put("74", "L4_DDX");
- l4TypeAliasMap.put("75", "L4_IATP");
- l4TypeAliasMap.put("76", "L4_ST");
- l4TypeAliasMap.put("77", "L4_SRP");
- l4TypeAliasMap.put("78", "L4_UTI");
- l4TypeAliasMap.put("79", "L4_SMP");
- l4TypeAliasMap.put("7a", "L4_SM");
- l4TypeAliasMap.put("7b", "L4_PTP");
- l4TypeAliasMap.put("7c", "L4_ISIS");
- l4TypeAliasMap.put("7d", "L4_FIRE");
- l4TypeAliasMap.put("7e", "L4_CRTP");
- l4TypeAliasMap.put("7f", "L4_CRUDP");
- l4TypeAliasMap.put("80", "L4_SSCOPMCE");
- l4TypeAliasMap.put("81", "L4_IPLT");
- l4TypeAliasMap.put("82", "L4_SPS");
- l4TypeAliasMap.put("83", "L4_PIPE");
- l4TypeAliasMap.put("84", "L4_SCTP");
- l4TypeAliasMap.put("85", "L4_Fibre_Channel");
- l4TypeAliasMap.put("86", "L4_RSVP_E2E_IGNORE");
- l4TypeAliasMap.put("87", "L4_Mobility_Header");
- l4TypeAliasMap.put("88", "L4_UDP_Lite");
- l4TypeAliasMap.put("89", "L4_MPLS");
- l4TypeAliasMap.put("8a", "L4_MANET");
- l4TypeAliasMap.put("8b", "L4_HIP");
- l4TypeAliasMap.put("8c", "L4_Shim6");
- l4TypeAliasMap.put("8d", "L4_WESP");
- l4TypeAliasMap.put("8e", "L4_ROHC");
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java b/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java
index 28369eb..a245c02 100644
--- a/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java
+++ b/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java
@@ -27,9 +27,6 @@
import net.floodlightcontroller.core.FloodlightContext;
import net.floodlightcontroller.core.IFloodlightProviderService;
import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.devicemanager.IDevice;
-import net.floodlightcontroller.devicemanager.IDeviceService;
-import net.floodlightcontroller.devicemanager.SwitchPort;
import net.floodlightcontroller.core.annotations.LogMessageCategory;
import net.floodlightcontroller.core.annotations.LogMessageDoc;
import net.floodlightcontroller.core.annotations.LogMessageDocs;
@@ -38,7 +35,9 @@
import net.floodlightcontroller.core.module.IFloodlightModule;
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.core.util.AppCookie;
-import net.floodlightcontroller.counter.ICounterStoreService;
+import net.floodlightcontroller.devicemanager.IDevice;
+import net.floodlightcontroller.devicemanager.IDeviceService;
+import net.floodlightcontroller.devicemanager.SwitchPort;
import net.floodlightcontroller.packet.Ethernet;
import net.floodlightcontroller.routing.ForwardingBase;
import net.floodlightcontroller.routing.IRoutingDecision;
@@ -389,7 +388,6 @@
l.add(IDeviceService.class);
l.add(IRoutingService.class);
l.add(ITopologyService.class);
- l.add(ICounterStoreService.class);
return l;
}
@@ -416,7 +414,6 @@
this.deviceManager = context.getServiceImpl(IDeviceService.class);
this.routingEngine = context.getServiceImpl(IRoutingService.class);
this.topology = context.getServiceImpl(ITopologyService.class);
- this.counterStore = context.getServiceImpl(ICounterStoreService.class);
// read our config options
Map<String, String> configOptions = context.getConfigParams(this);
diff --git a/src/main/java/net/floodlightcontroller/routing/ForwardingBase.java b/src/main/java/net/floodlightcontroller/routing/ForwardingBase.java
index 348a7af..c71ff87 100644
--- a/src/main/java/net/floodlightcontroller/routing/ForwardingBase.java
+++ b/src/main/java/net/floodlightcontroller/routing/ForwardingBase.java
@@ -18,9 +18,9 @@
package net.floodlightcontroller.routing;
import java.io.IOException;
-import java.util.EnumSet;
import java.util.ArrayList;
import java.util.Comparator;
+import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -33,16 +33,12 @@
import net.floodlightcontroller.core.annotations.LogMessageDoc;
import net.floodlightcontroller.core.annotations.LogMessageDocs;
import net.floodlightcontroller.core.util.AppCookie;
-import net.floodlightcontroller.counter.ICounterStoreService;
import net.floodlightcontroller.devicemanager.IDevice;
import net.floodlightcontroller.devicemanager.IDeviceListener;
import net.floodlightcontroller.devicemanager.IDeviceService;
import net.floodlightcontroller.devicemanager.SwitchPort;
import net.floodlightcontroller.packet.Ethernet;
import net.floodlightcontroller.packet.IPacket;
-import net.floodlightcontroller.routing.IRoutingService;
-import net.floodlightcontroller.routing.IRoutingDecision;
-import net.floodlightcontroller.routing.Route;
import net.floodlightcontroller.topology.ITopologyService;
import net.floodlightcontroller.topology.NodePortTuple;
import net.floodlightcontroller.util.OFMessageDamper;
@@ -81,7 +77,6 @@
protected IDeviceService deviceManager;
protected IRoutingService routingEngine;
protected ITopologyService topology;
- protected ICounterStoreService counterStore;
protected OFMessageDamper messageDamper;
@@ -265,7 +260,6 @@
((OFActionOutput)fm.getActions().get(0)).setPort(outPort);
try {
- counterStore.updatePktOutFMCounterStore(sw, fm);
if (log.isTraceEnabled()) {
log.trace("Pushing Route flowmod routeIndx={} " +
"sw={} inPort={} outPort={}",
@@ -383,7 +377,6 @@
po.setLength(poLength);
try {
- counterStore.updatePktOutFMCounterStore(sw, po);
messageDamper.write(sw, po, cntx, flush);
} catch (IOException e) {
log.error("Failure writing packet out", e);
@@ -466,7 +459,6 @@
po.setLength(poLength);
try {
- counterStore.updatePktOutFMCounterStore(sw, po);
messageDamper.write(sw, po, cntx);
} catch (IOException e) {
log.error("Failure writing packet out", e);
@@ -518,7 +510,6 @@
po.setLength(poLength);
try {
- counterStore.updatePktOutFMCounterStore(sw, po);
if (log.isTraceEnabled()) {
log.trace("write broadcast packet on switch-id={} " +
"interfaces={} packet-out={}",
diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java
index 5b98593..103cc4d 100644
--- a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java
+++ b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java
@@ -25,7 +25,6 @@
import net.floodlightcontroller.core.module.IFloodlightModule;
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.core.util.SingletonTask;
-import net.floodlightcontroller.counter.ICounterStoreService;
import net.floodlightcontroller.packet.BSN;
import net.floodlightcontroller.packet.Ethernet;
import net.floodlightcontroller.packet.LLDP;
@@ -596,7 +595,6 @@
l.add(ILinkDiscoveryService.class);
l.add(IThreadPoolService.class);
l.add(IFloodlightProviderService.class);
- l.add(ICounterStoreService.class);
l.add(IRestApiService.class);
return l;
}
diff --git a/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule b/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule
index 7a53cff..a842665 100644
--- a/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule
+++ b/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule
@@ -5,8 +5,6 @@
net.floodlightcontroller.topology.TopologyManager
net.floodlightcontroller.forwarding.Forwarding
net.floodlightcontroller.restserver.RestApiServer
-net.floodlightcontroller.counter.CounterStore
-net.floodlightcontroller.counter.NullCounterStore
net.floodlightcontroller.threadpool.ThreadPool
net.floodlightcontroller.ui.web.StaticWebRoutable
net.floodlightcontroller.devicemanager.internal.DefaultEntityClassifier
diff --git a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
index fede0ce..cbb4b17 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
@@ -51,8 +51,6 @@
import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState;
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.test.MockThreadPoolService;
-import net.floodlightcontroller.counter.CounterStore;
-import net.floodlightcontroller.counter.ICounterStoreService;
import net.floodlightcontroller.packet.ARP;
import net.floodlightcontroller.packet.Ethernet;
import net.floodlightcontroller.packet.IPacket;
@@ -117,10 +115,6 @@
RestApiServer restApi = new RestApiServer();
fmc.addService(IRestApiService.class, restApi);
-
- CounterStore cs = new CounterStore();
- fmc.addService(ICounterStoreService.class, cs);
-
tp = new MockThreadPoolService();
fmc.addService(IThreadPoolService.class, tp);
diff --git a/src/test/java/net/floodlightcontroller/core/module/FloodlightTestModuleLoader.java b/src/test/java/net/floodlightcontroller/core/module/FloodlightTestModuleLoader.java
index a4fba5d..89a3591 100644
--- a/src/test/java/net/floodlightcontroller/core/module/FloodlightTestModuleLoader.java
+++ b/src/test/java/net/floodlightcontroller/core/module/FloodlightTestModuleLoader.java
@@ -6,7 +6,6 @@
import net.floodlightcontroller.core.test.MockFloodlightProvider;
import net.floodlightcontroller.core.test.MockThreadPoolService;
-import net.floodlightcontroller.counter.NullCounterStore;
import net.floodlightcontroller.devicemanager.internal.DefaultEntityClassifier;
import net.floodlightcontroller.devicemanager.test.MockDeviceManager;
import net.floodlightcontroller.topology.TopologyManager;
@@ -24,8 +23,6 @@
TopologyManager.class;
public static final Class<? extends IFloodlightModule> DEFAULT_DEVICE_SERVICE =
MockDeviceManager.class;
- public static final Class<? extends IFloodlightModule> DEFAULT_COUNTER_STORE =
- NullCounterStore.class;
public static final Class<? extends IFloodlightModule> DEFAULT_THREADPOOL =
MockThreadPoolService.class;
public static final Class<? extends IFloodlightModule> DEFAULT_ENTITY_CLASSIFIER =
@@ -39,7 +36,6 @@
DEFAULT_MODULE_LIST.add(DEFAULT_DEVICE_SERVICE);
DEFAULT_MODULE_LIST.add(DEFAULT_FLOODLIGHT_PRPOVIDER);
DEFAULT_MODULE_LIST.add(DEFAULT_TOPOLOGY_PROVIDER);
- DEFAULT_MODULE_LIST.add(DEFAULT_COUNTER_STORE);
DEFAULT_MODULE_LIST.add(DEFAULT_THREADPOOL);
DEFAULT_MODULE_LIST.add(DEFAULT_ENTITY_CLASSIFIER);
diff --git a/src/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java b/src/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java
index 3e262af..f29c319 100644
--- a/src/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java
+++ b/src/test/java/net/floodlightcontroller/forwarding/ForwardingTest.java
@@ -17,7 +17,16 @@
package net.floodlightcontroller.forwarding;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.anyLong;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.anyShort;
+import static org.easymock.EasyMock.capture;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.reset;
+import static org.easymock.EasyMock.verify;
import java.util.ArrayList;
import java.util.Date;
@@ -31,13 +40,11 @@
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.test.MockFloodlightProvider;
import net.floodlightcontroller.core.test.MockThreadPoolService;
-import net.floodlightcontroller.devicemanager.internal.DefaultEntityClassifier;
-import net.floodlightcontroller.devicemanager.test.MockDeviceManager;
-import net.floodlightcontroller.counter.CounterStore;
-import net.floodlightcontroller.counter.ICounterStoreService;
import net.floodlightcontroller.devicemanager.IDevice;
import net.floodlightcontroller.devicemanager.IDeviceService;
import net.floodlightcontroller.devicemanager.IEntityClassifierService;
+import net.floodlightcontroller.devicemanager.internal.DefaultEntityClassifier;
+import net.floodlightcontroller.devicemanager.test.MockDeviceManager;
import net.floodlightcontroller.packet.Data;
import net.floodlightcontroller.packet.Ethernet;
import net.floodlightcontroller.packet.IPacket;
@@ -50,7 +57,6 @@
import net.floodlightcontroller.topology.ITopologyListener;
import net.floodlightcontroller.topology.ITopologyService;
import net.floodlightcontroller.topology.NodePortTuple;
-import net.floodlightcontroller.forwarding.Forwarding;
import org.easymock.Capture;
import org.easymock.CaptureType;
@@ -61,10 +67,10 @@
import org.openflow.protocol.OFMatch;
import org.openflow.protocol.OFMessage;
import org.openflow.protocol.OFPacketIn;
+import org.openflow.protocol.OFPacketIn.OFPacketInReason;
import org.openflow.protocol.OFPacketOut;
import org.openflow.protocol.OFPort;
import org.openflow.protocol.OFType;
-import org.openflow.protocol.OFPacketIn.OFPacketInReason;
import org.openflow.protocol.action.OFAction;
import org.openflow.protocol.action.OFActionOutput;
import org.openflow.util.HexString;
@@ -129,7 +135,6 @@
fmc.addService(IThreadPoolService.class, threadPool);
fmc.addService(ITopologyService.class, topology);
fmc.addService(IRoutingService.class, routingEngine);
- fmc.addService(ICounterStoreService.class, new CounterStore());
fmc.addService(IDeviceService.class, deviceManager);
fmc.addService(IEntityClassifierService.class, entityClassifier);