Fix checkstyle whitespace issues - WHITESPACE ONLY
Change-Id: Ic205c1afd639c6008d61d9de95cb764eeb6238ca
diff --git a/src/main/java/net/floodlightcontroller/core/web/AllSwitchStatisticsResource.java b/src/main/java/net/floodlightcontroller/core/web/AllSwitchStatisticsResource.java
index 5d70cee..276215b 100644
--- a/src/main/java/net/floodlightcontroller/core/web/AllSwitchStatisticsResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/AllSwitchStatisticsResource.java
@@ -1,19 +1,19 @@
/**
-* 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.
-**/
+ * 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;
@@ -35,24 +35,25 @@
/**
* Return switch statistics information for all switches
+ *
* @author readams
*/
public class AllSwitchStatisticsResource extends SwitchResourceBase {
- protected final static Logger log =
- LoggerFactory.getLogger(AllSwitchStatisticsResource.class);
-
+ protected final static Logger log =
+ LoggerFactory.getLogger(AllSwitchStatisticsResource.class);
+
@Get("json")
- public Map<String, Object> retrieve() {
+ public Map<String, Object> retrieve() {
String statType = (String) getRequestAttributes().get("statType");
return retrieveInternal(statType);
}
-
+
public Map<String, Object> retrieveInternal(String statType) {
HashMap<String, Object> model = new HashMap<String, Object>();
OFStatisticsType type = null;
REQUESTTYPE rType = null;
-
+
if (statType.equals("port")) {
type = OFStatisticsType.PORT;
rType = REQUESTTYPE.OFSTATS;
@@ -76,10 +77,10 @@
} else {
return model;
}
-
- IFloodlightProviderService floodlightProvider =
- (IFloodlightProviderService)getContext().getAttributes().
- get(IFloodlightProviderService.class.getCanonicalName());
+
+ IFloodlightProviderService floodlightProvider =
+ (IFloodlightProviderService) getContext().getAttributes().
+ get(IFloodlightProviderService.class.getCanonicalName());
Long[] switchDpids = floodlightProvider.getSwitches().keySet().toArray(new Long[0]);
List<GetConcurrentStatsThread> activeThreads = new ArrayList<GetConcurrentStatsThread>(switchDpids.length);
List<GetConcurrentStatsThread> pendingRemovalThreads = new ArrayList<GetConcurrentStatsThread>();
@@ -89,7 +90,7 @@
activeThreads.add(t);
t.start();
}
-
+
// Join all the threads after the timeout. Set a hard timeout
// of 12 seconds for the threads to finish. If the thread has not
// finished the switch has not replied yet and therefore we won't
@@ -105,19 +106,19 @@
pendingRemovalThreads.add(curThread);
}
}
-
+
// remove the threads that have completed the queries to the switches
for (GetConcurrentStatsThread curThread : pendingRemovalThreads) {
activeThreads.remove(curThread);
}
// clear the list so we don't try to double remove them
pendingRemovalThreads.clear();
-
+
// if we are done finish early so we don't always get the worst case
if (activeThreads.isEmpty()) {
break;
}
-
+
// sleep for 1 s here
try {
Thread.sleep(1000);
@@ -125,17 +126,17 @@
log.error("Interrupted while waiting for statistics", e);
}
}
-
+
return model;
}
-
+
protected class GetConcurrentStatsThread extends Thread {
private List<OFStatistics> switchReply;
private long switchId;
private OFStatisticsType statType;
private REQUESTTYPE requestType;
private OFFeaturesReply featuresReply;
-
+
public GetConcurrentStatsThread(long switchId, REQUESTTYPE requestType, OFStatisticsType statType) {
this.switchId = switchId;
this.requestType = requestType;
@@ -143,19 +144,19 @@
this.switchReply = null;
this.featuresReply = null;
}
-
+
public List<OFStatistics> getStatisticsReply() {
return switchReply;
}
-
+
public OFFeaturesReply getFeaturesReply() {
return featuresReply;
}
-
+
public long getSwitchId() {
return switchId;
}
-
+
public void run() {
if ((requestType == REQUESTTYPE.OFSTATS) && (statType != null)) {
switchReply = getSwitchStatistics(switchId, statType);
diff --git a/src/main/java/net/floodlightcontroller/core/web/ControllerMemoryResource.java b/src/main/java/net/floodlightcontroller/core/web/ControllerMemoryResource.java
index bcb2bd1..371a38f 100644
--- a/src/main/java/net/floodlightcontroller/core/web/ControllerMemoryResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/ControllerMemoryResource.java
@@ -1,19 +1,19 @@
/**
-* 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.
-**/
+ * 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;
@@ -25,6 +25,7 @@
/**
* Retrieve floodlight memory state
+ *
* @author readams
*/
public class ControllerMemoryResource extends ServerResource {
diff --git a/src/main/java/net/floodlightcontroller/core/web/ControllerSwitchesResource.java b/src/main/java/net/floodlightcontroller/core/web/ControllerSwitchesResource.java
index 454f566..223da56 100644
--- a/src/main/java/net/floodlightcontroller/core/web/ControllerSwitchesResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/ControllerSwitchesResource.java
@@ -1,19 +1,19 @@
/**
-* 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.
-**/
+ * 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;
@@ -32,21 +32,22 @@
/**
* Get a list of switches connected to the controller
+ *
* @author readams
*/
public class ControllerSwitchesResource extends ServerResource {
- public static final String DPID_ERROR =
- "Invalid Switch DPID: must be a 64-bit quantity, expressed in " +
- "hex as AA:BB:CC:DD:EE:FF:00:11";
-
+ public static final String DPID_ERROR =
+ "Invalid Switch DPID: must be a 64-bit quantity, expressed in " +
+ "hex as AA:BB:CC:DD:EE:FF:00:11";
+
@Get("json")
public Iterator<IOFSwitch> retrieve() {
- IFloodlightProviderService floodlightProvider =
- (IFloodlightProviderService)getContext().getAttributes().
- get(IFloodlightProviderService.class.getCanonicalName());
+ IFloodlightProviderService floodlightProvider =
+ (IFloodlightProviderService) getContext().getAttributes().
+ get(IFloodlightProviderService.class.getCanonicalName());
Long switchDPID = null;
-
+
Form form = getQuery();
String dpid = form.getFirstValue("dpid", true);
if (dpid != null) {
@@ -58,15 +59,15 @@
}
}
if (switchDPID != null) {
- IOFSwitch sw =
+ IOFSwitch sw =
floodlightProvider.getSwitches().get(switchDPID);
if (sw != null)
return Collections.singleton(sw).iterator();
return Collections.<IOFSwitch>emptySet().iterator();
}
- final String dpidStartsWith =
+ final String dpidStartsWith =
form.getFirstValue("dpid__startswith", true);
- Iterator<IOFSwitch> switer =
+ Iterator<IOFSwitch> switer =
floodlightProvider.getSwitches().values().iterator();
if (dpidStartsWith != null) {
return new FilterIterator<IOFSwitch>(switer) {
@@ -75,7 +76,7 @@
return value.getStringId().startsWith(dpidStartsWith);
}
};
- }
+ }
return switer;
}
}
diff --git a/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java b/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java
index 0e48975..4492643 100644
--- a/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java
+++ b/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java
@@ -1,19 +1,19 @@
/**
-* 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.
-**/
+ * 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;
@@ -26,6 +26,7 @@
/**
* Creates a router to handle all the core web URIs
+ *
* @author readams
*/
public class CoreWebRoutable implements RestletRoutable {
diff --git a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyClusterResource.java b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyClusterResource.java
index 56ff6d9..2bbb1bd 100644
--- a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyClusterResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyClusterResource.java
@@ -12,34 +12,32 @@
/**
* @author subrata
- *
*/
public class EventHistoryTopologyClusterResource extends ServerResource {
// TODO - Move this to the LinkDiscovery rest API
- protected final static Logger log =
+ protected final static Logger log =
LoggerFactory.getLogger(EventHistoryTopologyClusterResource.class);
@Get("json")
public EventHistory<EventHistoryTopologyCluster> handleEvHistReq() {
// Get the event history count. Last <count> events would be returned
- String evHistCount = (String)getRequestAttributes().get("count");
- int count = EventHistory.EV_HISTORY_DEFAULT_SIZE;
+ String evHistCount = (String) getRequestAttributes().get("count");
+ int count = EventHistory.EV_HISTORY_DEFAULT_SIZE;
try {
count = Integer.parseInt(evHistCount);
- }
- catch(NumberFormatException nFE) {
+ } catch (NumberFormatException nFE) {
// Invalid input for event count - use default value
}
LinkDiscoveryManager topoManager =
- (LinkDiscoveryManager)getContext().getAttributes().
- get(ILinkDiscoveryService.class.getCanonicalName());
+ (LinkDiscoveryManager) getContext().getAttributes().
+ get(ILinkDiscoveryService.class.getCanonicalName());
if (topoManager != null) {
return new EventHistory<EventHistoryTopologyCluster>(
topoManager.evHistTopologyCluster, count);
}
-
+
return null;
}
}
diff --git a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyLinkResource.java b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyLinkResource.java
index fbb2e76..90d9198 100644
--- a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyLinkResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyLinkResource.java
@@ -12,34 +12,32 @@
/**
* @author subrata
- *
*/
public class EventHistoryTopologyLinkResource extends ServerResource {
// TODO - Move this to the DeviceManager Rest API
- protected final static Logger log =
+ protected final static Logger log =
LoggerFactory.getLogger(EventHistoryTopologyLinkResource.class);
@Get("json")
public EventHistory<EventHistoryTopologyLink> handleEvHistReq() {
// Get the event history count. Last <count> events would be returned
- String evHistCount = (String)getRequestAttributes().get("count");
- int count = EventHistory.EV_HISTORY_DEFAULT_SIZE;
+ String evHistCount = (String) getRequestAttributes().get("count");
+ int count = EventHistory.EV_HISTORY_DEFAULT_SIZE;
try {
count = Integer.parseInt(evHistCount);
- }
- catch(NumberFormatException nFE) {
+ } catch (NumberFormatException nFE) {
// Invalid input for event count - use default value
}
LinkDiscoveryManager linkDiscoveryManager =
- (LinkDiscoveryManager)getContext().getAttributes().
- get(ILinkDiscoveryService.class.getCanonicalName());
+ (LinkDiscoveryManager) getContext().getAttributes().
+ get(ILinkDiscoveryService.class.getCanonicalName());
if (linkDiscoveryManager != null) {
return new EventHistory<EventHistoryTopologyLink>(
linkDiscoveryManager.evHistTopologyLink, count);
}
-
+
return null;
}
}
diff --git a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologySwitchResource.java b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologySwitchResource.java
index 345020b..e1fbb1b 100644
--- a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologySwitchResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologySwitchResource.java
@@ -10,7 +10,6 @@
/**
* @author subrata
- *
*/
public class EventHistoryTopologySwitchResource extends ServerResource {
@@ -18,20 +17,19 @@
public EventHistory<EventHistoryTopologySwitch> handleEvHistReq() {
// Get the event history count. Last <count> events would be returned
- String evHistCount = (String)getRequestAttributes().get("count");
- int count = EventHistory.EV_HISTORY_DEFAULT_SIZE;
+ String evHistCount = (String) getRequestAttributes().get("count");
+ int count = EventHistory.EV_HISTORY_DEFAULT_SIZE;
try {
count = Integer.parseInt(evHistCount);
- }
- catch(NumberFormatException nFE) {
+ } catch (NumberFormatException nFE) {
// Invalid input for event count - use default value
}
LinkDiscoveryManager topoManager =
- (LinkDiscoveryManager)getContext().getAttributes().
- get(ILinkDiscoveryService.class.getCanonicalName());
+ (LinkDiscoveryManager) getContext().getAttributes().
+ get(ILinkDiscoveryService.class.getCanonicalName());
return new EventHistory<EventHistoryTopologySwitch>(
- topoManager.evHistTopologySwitch, count);
+ topoManager.evHistTopologySwitch, count);
}
}
diff --git a/src/main/java/net/floodlightcontroller/core/web/HealthCheckResource.java b/src/main/java/net/floodlightcontroller/core/web/HealthCheckResource.java
index 12ee545..a0d5c0c 100644
--- a/src/main/java/net/floodlightcontroller/core/web/HealthCheckResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/HealthCheckResource.java
@@ -4,24 +4,24 @@
import org.restlet.resource.ServerResource;
public class HealthCheckResource extends ServerResource {
-
+
public static class HealthCheckInfo {
-
+
protected boolean healthy;
-
+
public HealthCheckInfo() {
this.healthy = true;
}
-
+
public boolean isHealthy() {
return healthy;
}
-
+
public void setHealthy(boolean healthy) {
this.healthy = healthy;
}
}
-
+
@Get("json")
public HealthCheckInfo healthCheck() {
// Currently this is the simplest possible health check -- basically
diff --git a/src/main/java/net/floodlightcontroller/core/web/LoadedModuleLoaderResource.java b/src/main/java/net/floodlightcontroller/core/web/LoadedModuleLoaderResource.java
index 22bdb77..0ffc7b0 100644
--- a/src/main/java/net/floodlightcontroller/core/web/LoadedModuleLoaderResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/LoadedModuleLoaderResource.java
@@ -7,13 +7,14 @@
import org.restlet.resource.Get;
public class LoadedModuleLoaderResource extends ModuleLoaderResource {
- /**
- * Retrieves information about all modules available
- * to Floodlight.
- * @return Information about all modules available.
- */
+ /**
+ * Retrieves information about all modules available
+ * to Floodlight.
+ *
+ * @return Information about all modules available.
+ */
@Get("json")
public Map<String, Object> retrieve() {
- return retrieveInternal(true);
+ return retrieveInternal(true);
}
}
diff --git a/src/main/java/net/floodlightcontroller/core/web/RoleInfo.java b/src/main/java/net/floodlightcontroller/core/web/RoleInfo.java
index e600ea0..879eb04 100644
--- a/src/main/java/net/floodlightcontroller/core/web/RoleInfo.java
+++ b/src/main/java/net/floodlightcontroller/core/web/RoleInfo.java
@@ -4,22 +4,22 @@
public class RoleInfo {
protected String role;
-
+
public RoleInfo() {
}
-
+
public RoleInfo(String role) {
setRole(role);
}
-
+
public RoleInfo(Role role) {
this.role = (role != null) ? role.name() : "DISABLED";
}
-
+
public String getRole() {
return role;
}
-
+
public void setRole(String role) {
this.role = role;
}
diff --git a/src/main/java/net/floodlightcontroller/core/web/SwitchResourceBase.java b/src/main/java/net/floodlightcontroller/core/web/SwitchResourceBase.java
index 1c138f6..835cb17 100644
--- a/src/main/java/net/floodlightcontroller/core/web/SwitchResourceBase.java
+++ b/src/main/java/net/floodlightcontroller/core/web/SwitchResourceBase.java
@@ -1,19 +1,19 @@
/**
-* 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.
-**/
+ * 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;
@@ -44,35 +44,35 @@
/**
* Base class for server resources related to switches
- * @author readams
*
+ * @author readams
*/
public class SwitchResourceBase extends ServerResource {
protected final static Logger log = LoggerFactory.getLogger(SwitchResourceBase.class);
-
+
public enum REQUESTTYPE {
OFSTATS,
OFFEATURES
}
-
+
@Override
protected void doInit() throws ResourceException {
super.doInit();
-
+
}
-
- @LogMessageDoc(level="ERROR",
- message="Failure retrieving statistics from switch {switch}",
- explanation="An error occurred while retrieving statistics" +
- "from the switch",
- recommendation=LogMessageDoc.CHECK_SWITCH + " " +
- LogMessageDoc.GENERIC_ACTION)
- protected List<OFStatistics> getSwitchStatistics(long switchId,
+
+ @LogMessageDoc(level = "ERROR",
+ message = "Failure retrieving statistics from switch {switch}",
+ explanation = "An error occurred while retrieving statistics" +
+ "from the switch",
+ recommendation = LogMessageDoc.CHECK_SWITCH + " " +
+ LogMessageDoc.GENERIC_ACTION)
+ protected List<OFStatistics> getSwitchStatistics(long switchId,
OFStatisticsType statType) {
- IFloodlightProviderService floodlightProvider =
- (IFloodlightProviderService)getContext().getAttributes().
- get(IFloodlightProviderService.class.getCanonicalName());
-
+ IFloodlightProviderService floodlightProvider =
+ (IFloodlightProviderService) getContext().getAttributes().
+ get(IFloodlightProviderService.class.getCanonicalName());
+
IOFSwitch sw = floodlightProvider.getSwitches().get(switchId);
Future<List<OFStatistics>> future;
List<OFStatistics> values = null;
@@ -87,7 +87,7 @@
specificReq.setMatch(match);
specificReq.setOutPort(OFPort.OFPP_NONE.getValue());
specificReq.setTableId((byte) 0xff);
- req.setStatistics(Collections.singletonList((OFStatistics)specificReq));
+ req.setStatistics(Collections.singletonList((OFStatistics) specificReq));
requestLength += specificReq.getLength();
} else if (statType == OFStatisticsType.AGGREGATE) {
OFAggregateStatisticsRequest specificReq = new OFAggregateStatisticsRequest();
@@ -96,23 +96,23 @@
specificReq.setMatch(match);
specificReq.setOutPort(OFPort.OFPP_NONE.getValue());
specificReq.setTableId((byte) 0xff);
- req.setStatistics(Collections.singletonList((OFStatistics)specificReq));
+ req.setStatistics(Collections.singletonList((OFStatistics) specificReq));
requestLength += specificReq.getLength();
} else if (statType == OFStatisticsType.PORT) {
OFPortStatisticsRequest specificReq = new OFPortStatisticsRequest();
- specificReq.setPortNumber((short)OFPort.OFPP_NONE.getValue());
- req.setStatistics(Collections.singletonList((OFStatistics)specificReq));
+ specificReq.setPortNumber((short) OFPort.OFPP_NONE.getValue());
+ req.setStatistics(Collections.singletonList((OFStatistics) specificReq));
requestLength += specificReq.getLength();
} else if (statType == OFStatisticsType.QUEUE) {
OFQueueStatisticsRequest specificReq = new OFQueueStatisticsRequest();
- specificReq.setPortNumber((short)OFPort.OFPP_ALL.getValue());
+ specificReq.setPortNumber((short) OFPort.OFPP_ALL.getValue());
// LOOK! openflowj does not define OFPQ_ALL! pulled this from openflow.h
// note that I haven't seen this work yet though...
specificReq.setQueueId(0xffffffff);
- req.setStatistics(Collections.singletonList((OFStatistics)specificReq));
+ req.setStatistics(Collections.singletonList((OFStatistics) specificReq));
requestLength += specificReq.getLength();
} else if (statType == OFStatisticsType.DESC ||
- statType == OFStatisticsType.TABLE) {
+ statType == OFStatisticsType.TABLE) {
// pass - nothing todo besides set the type above
}
req.setLengthU(requestLength);
@@ -129,11 +129,11 @@
protected List<OFStatistics> getSwitchStatistics(String switchId, OFStatisticsType statType) {
return getSwitchStatistics(HexString.toLong(switchId), statType);
}
-
+
protected OFFeaturesReply getSwitchFeaturesReply(long switchId) {
- IFloodlightProviderService floodlightProvider =
- (IFloodlightProviderService)getContext().getAttributes().
- get(IFloodlightProviderService.class.getCanonicalName());
+ IFloodlightProviderService floodlightProvider =
+ (IFloodlightProviderService) getContext().getAttributes().
+ get(IFloodlightProviderService.class.getCanonicalName());
IOFSwitch sw = floodlightProvider.getSwitches().get(switchId);
Future<OFFeaturesReply> future;
diff --git a/src/main/java/net/floodlightcontroller/core/web/SwitchRoleResource.java b/src/main/java/net/floodlightcontroller/core/web/SwitchRoleResource.java
index f9eb877..d598005 100644
--- a/src/main/java/net/floodlightcontroller/core/web/SwitchRoleResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/SwitchRoleResource.java
@@ -17,29 +17,29 @@
@Get("json")
public Object getRole() {
- IFloodlightProviderService floodlightProvider =
- (IFloodlightProviderService)getContext().getAttributes().
- get(IFloodlightProviderService.class.getCanonicalName());
+ IFloodlightProviderService floodlightProvider =
+ (IFloodlightProviderService) getContext().getAttributes().
+ get(IFloodlightProviderService.class.getCanonicalName());
String switchId = (String) getRequestAttributes().get("switchId");
-
+
RoleInfo roleInfo;
-
+
if (switchId.equalsIgnoreCase("all")) {
- HashMap<String,RoleInfo> model = new HashMap<String,RoleInfo>();
- for (IOFSwitch sw: floodlightProvider.getSwitches().values()) {
- switchId = sw.getStringId();
- roleInfo = new RoleInfo(sw.getRole());
- model.put(switchId, roleInfo);
+ HashMap<String, RoleInfo> model = new HashMap<String, RoleInfo>();
+ for (IOFSwitch sw : floodlightProvider.getSwitches().values()) {
+ switchId = sw.getStringId();
+ roleInfo = new RoleInfo(sw.getRole());
+ model.put(switchId, roleInfo);
}
return model;
}
-
- Long dpid = HexString.toLong(switchId);
- IOFSwitch sw = floodlightProvider.getSwitches().get(dpid);
- if (sw == null)
- return null;
- roleInfo = new RoleInfo(sw.getRole());
- return roleInfo;
+
+ Long dpid = HexString.toLong(switchId);
+ IOFSwitch sw = floodlightProvider.getSwitches().get(dpid);
+ if (sw == null)
+ return null;
+ roleInfo = new RoleInfo(sw.getRole());
+ return roleInfo;
}
}
diff --git a/src/main/java/net/floodlightcontroller/core/web/SwitchStatisticsResource.java b/src/main/java/net/floodlightcontroller/core/web/SwitchStatisticsResource.java
index a0cada7..468a50e 100644
--- a/src/main/java/net/floodlightcontroller/core/web/SwitchStatisticsResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/SwitchStatisticsResource.java
@@ -1,19 +1,19 @@
/**
-* 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.
-**/
+ * 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;
@@ -27,20 +27,21 @@
/**
* Return switch statistics information for specific switches
+ *
* @author readams
*/
public class SwitchStatisticsResource extends SwitchResourceBase {
- protected final static Logger log =
- LoggerFactory.getLogger(SwitchStatisticsResource.class);
+ protected final static Logger log =
+ LoggerFactory.getLogger(SwitchStatisticsResource.class);
@Get("json")
public Map<String, Object> retrieve() {
- HashMap<String,Object> result = new HashMap<String,Object>();
+ HashMap<String, Object> result = new HashMap<String, Object>();
Object values = null;
-
+
String switchId = (String) getRequestAttributes().get("switchId");
String statType = (String) getRequestAttributes().get("statType");
-
+
if (statType.equals("port")) {
values = getSwitchStatistics(switchId, OFStatisticsType.PORT);
} else if (statType.equals("queue")) {
diff --git a/src/main/java/net/floodlightcontroller/core/web/SystemUptimeResource.java b/src/main/java/net/floodlightcontroller/core/web/SystemUptimeResource.java
index a125979..1ea4aa5 100644
--- a/src/main/java/net/floodlightcontroller/core/web/SystemUptimeResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/SystemUptimeResource.java
@@ -6,27 +6,26 @@
import org.restlet.resource.ServerResource;
-
public class SystemUptimeResource extends ServerResource {
-
- public class UptimeRest {
- long systemUptimeMsec;
- public long getSystemUptimeMsec() {
- return systemUptimeMsec;
- }
- }
-
- @Get("json")
- public UptimeRest retrieve() {
- IFloodlightProviderService floodlightProvider =
- (IFloodlightProviderService)getContext().getAttributes().
- get(IFloodlightProviderService.class.getCanonicalName());
-
- UptimeRest uptime = new UptimeRest();
- uptime.systemUptimeMsec =
- System.currentTimeMillis() - floodlightProvider.getSystemStartTime();
-
- return (uptime);
- }
+ public class UptimeRest {
+ long systemUptimeMsec;
+
+ public long getSystemUptimeMsec() {
+ return systemUptimeMsec;
+ }
+ }
+
+ @Get("json")
+ public UptimeRest retrieve() {
+ IFloodlightProviderService floodlightProvider =
+ (IFloodlightProviderService) getContext().getAttributes().
+ get(IFloodlightProviderService.class.getCanonicalName());
+
+ UptimeRest uptime = new UptimeRest();
+ uptime.systemUptimeMsec =
+ System.currentTimeMillis() - floodlightProvider.getSystemStartTime();
+
+ return (uptime);
+ }
}
diff --git a/src/main/java/net/floodlightcontroller/core/web/serializers/ByteArrayMACSerializer.java b/src/main/java/net/floodlightcontroller/core/web/serializers/ByteArrayMACSerializer.java
index 66c33f5..35f810b 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/ByteArrayMACSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/ByteArrayMACSerializer.java
@@ -1,19 +1,19 @@
/**
-* Copyright 2011,2012 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.
-**/
+ * Copyright 2011,2012 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.serializers;
@@ -33,7 +33,7 @@
@Override
public void serialize(byte[] mac, JsonGenerator jGen,
SerializerProvider serializer)
- throws IOException, JsonProcessingException {
+ throws IOException, JsonProcessingException {
jGen.writeString(HexString.toHexString(mac));
}
diff --git a/src/main/java/net/floodlightcontroller/core/web/serializers/DPIDSerializer.java b/src/main/java/net/floodlightcontroller/core/web/serializers/DPIDSerializer.java
index e74cc01..304e835 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/DPIDSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/DPIDSerializer.java
@@ -1,19 +1,19 @@
/**
-* Copyright 2011,2012 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.
-**/
+ * Copyright 2011,2012 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.serializers;
@@ -33,7 +33,7 @@
@Override
public void serialize(Long dpid, JsonGenerator jGen,
SerializerProvider serializer)
- throws IOException, JsonProcessingException {
+ throws IOException, JsonProcessingException {
jGen.writeString(HexString.toHexString(dpid, 8));
}
diff --git a/src/main/java/net/floodlightcontroller/core/web/serializers/IPv4Serializer.java b/src/main/java/net/floodlightcontroller/core/web/serializers/IPv4Serializer.java
index 1bd7caf..d6bc9ba 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/IPv4Serializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/IPv4Serializer.java
@@ -1,19 +1,19 @@
/**
-* Copyright 2011,2012 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.
-**/
+ * Copyright 2011,2012 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.serializers;
@@ -34,7 +34,7 @@
@Override
public void serialize(Integer i, JsonGenerator jGen,
SerializerProvider serializer)
- throws IOException, JsonProcessingException {
+ throws IOException, JsonProcessingException {
jGen.writeString(IPv4.fromIPv4Address(i));
}
diff --git a/src/main/java/net/floodlightcontroller/core/web/serializers/MACSerializer.java b/src/main/java/net/floodlightcontroller/core/web/serializers/MACSerializer.java
index a7c9fb7..eacf515 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/MACSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/MACSerializer.java
@@ -1,19 +1,19 @@
/**
-* Copyright 2011,2012 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.
-**/
+ * Copyright 2011,2012 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.serializers;
@@ -33,7 +33,7 @@
@Override
public void serialize(Long dpid, JsonGenerator jGen,
SerializerProvider serializer)
- throws IOException, JsonProcessingException {
+ throws IOException, JsonProcessingException {
jGen.writeString(HexString.toHexString(dpid, 6));
}
diff --git a/src/main/java/net/floodlightcontroller/core/web/serializers/UShortSerializer.java b/src/main/java/net/floodlightcontroller/core/web/serializers/UShortSerializer.java
index c125c76..0c4fa22 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/UShortSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/UShortSerializer.java
@@ -1,19 +1,19 @@
/**
-* Copyright 2011,2012 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.
-**/
+ * Copyright 2011,2012 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.serializers;
@@ -32,7 +32,7 @@
@Override
public void serialize(Short s, JsonGenerator jGen,
SerializerProvider serializer) throws IOException,
- JsonProcessingException {
+ JsonProcessingException {
if (s == null) jGen.writeNull();
else jGen.writeNumber(s.shortValue() & 0xffff);
}