This commit allows the controller to be brought up with the following parameters that can be specified in the config.ini file:
- of.listenPort=6633. TCP port on which the controller is listening (default 6633)
- of.messageResponseTimer=5000. The time (in milliseconds) the controller will wait for a response after sending a Barrier Request or a Statistic Request message (default 2000 msec)
If the paramater is not specified in the config.ini, the controller will use the default value.
Change-Id: Ifc805c5cedcbb9e68dc5c8e166b3f0f814b6fb8e
Signed-off-by: Chi-Vien Ly <chivly@cisco.com>
# Embedded Tomcat configuration File
org.eclipse.gemini.web.tomcat.config.path=configuration/tomcat-server.xml
# Embedded Tomcat configuration File
org.eclipse.gemini.web.tomcat.config.path=configuration/tomcat-server.xml
+
+# Open Flow related system parameters
+# TCP port on which the controller is listening (default 6633)
+# of.listenPort=6633
+# The time (in milliseconds) the controller will wait for a response after sending a Barrier Request or a Statistic Request message (default 2000 msec)
+# of.messageResponseTimer=2000
public ControllerIO(IController l) {
this.listener = l;
this.openFlowPort = defaultOpenFlowPort;
public ControllerIO(IController l) {
this.listener = l;
this.openFlowPort = defaultOpenFlowPort;
- String portString = System.getProperty("port");
+ String portString = System.getProperty("of.listenPort");
if (portString != null) {
try {
openFlowPort = Short.decode(portString).shortValue();
if (portString != null) {
try {
openFlowPort = Short.decode(portString).shortValue();
.getLogger(SwitchHandler.class);
private static final int SWITCH_LIVENESS_TIMER = 5000;
private static final int SWITCH_LIVENESS_TIMEOUT = 2 * SWITCH_LIVENESS_TIMER + 500;
.getLogger(SwitchHandler.class);
private static final int SWITCH_LIVENESS_TIMER = 5000;
private static final int SWITCH_LIVENESS_TIMEOUT = 2 * SWITCH_LIVENESS_TIMER + 500;
- private static final int SYNCHRONOUS_FLOW_TIMEOUT = 2000;
- private static final int STATS_COLLECTION_TIMEOUT = 2000;
+ private int MESSAGE_RESPONSE_TIMER = 2000;
private static final int bufferSize = 1024 * 1024;
private String instanceName;
private static final int bufferSize = 1024 * 1024;
private String instanceName;
private ConcurrentHashMap<Integer, Callable<Object>> messageWaitingDone;
private boolean running;
private Thread switchHandlerThread;
private ConcurrentHashMap<Integer, Callable<Object>> messageWaitingDone;
private boolean running;
private Thread switchHandlerThread;
+ private Integer responseTimerValue;
private enum SwitchState {
NON_OPERATIONAL(0), WAIT_FEATURES_REPLY(1), WAIT_CONFIG_REPLY(2), OPERATIONAL(
private enum SwitchState {
NON_OPERATIONAL(0), WAIT_FEATURES_REPLY(1), WAIT_CONFIG_REPLY(2), OPERATIONAL(
this.messageWaitingDone = new ConcurrentHashMap<Integer, Callable<Object>>();
this.inBuffer = ByteBuffer.allocateDirect(bufferSize);
this.outBuffer = ByteBuffer.allocateDirect(bufferSize);
this.messageWaitingDone = new ConcurrentHashMap<Integer, Callable<Object>>();
this.inBuffer = ByteBuffer.allocateDirect(bufferSize);
this.outBuffer = ByteBuffer.allocateDirect(bufferSize);
+ this.responseTimerValue = MESSAGE_RESPONSE_TIMER;
+ String rTimer = System.getProperty("of.messageResponseTimer");
+ if (rTimer != null) {
+ try {
+ responseTimerValue = Integer.decode(rTimer);
+ } catch (NumberFormatException e) {
+ logger.warn("Invalid of.messageResponseTimer:" + rTimer + ", use default("
+ + MESSAGE_RESPONSE_TIMER+ ")");
+ }
+ }
Object result = null;
try {
result = submit
Object result = null;
try {
result = submit
- .get(STATS_COLLECTION_TIMEOUT, TimeUnit.MILLISECONDS);
+ .get(MESSAGE_RESPONSE_TIMER, TimeUnit.MILLISECONDS);
return result;
} catch (Exception e) {
logger.warn("Timeout while waiting for " + req.getType()
return result;
} catch (Exception e) {
logger.warn("Timeout while waiting for " + req.getType()
Future<Object> submit = executor.submit(worker);
try {
result = submit
Future<Object> submit = executor.submit(worker);
try {
result = submit
- .get(SYNCHRONOUS_FLOW_TIMEOUT, TimeUnit.MILLISECONDS);
+ .get(responseTimerValue, TimeUnit.MILLISECONDS);
messageWaitingDone.remove(xid);
if (result == null) {
// if result is null, then it means the switch can handle this message successfully
messageWaitingDone.remove(xid);
if (result == null) {
// if result is null, then it means the switch can handle this message successfully