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);
- }
- }
-
-}