Listen for OpenFlow connections on 6633 and 6653
Also, cleaning up OFController config
Change-Id: I5f1fe159a6c59d3bea99bd89303f2afc4cf269b6
diff --git a/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java b/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java
index c52f4bb..cff8cdc 100644
--- a/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java
+++ b/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java
@@ -15,7 +15,6 @@
*/
package org.onosproject.openflow.controller.impl;
-import com.google.common.base.Strings;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
@@ -67,11 +66,8 @@
import java.util.Collection;
import java.util.Collections;
-import java.util.Dictionary;
-import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
@@ -80,13 +76,12 @@
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
-import static org.onlab.util.Tools.get;
import static org.onlab.util.Tools.groupedThreads;
@Component(immediate = true)
@Service
public class OpenFlowControllerImpl implements OpenFlowController {
- private static final int DEFAULT_OFPORT = 6653;
+ private static final String DEFAULT_OFPORT = "6633,6653";
private static final int DEFAULT_WORKER_THREADS = 16;
private static final Logger log =
@@ -102,9 +97,9 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected ComponentConfigService cfgService;
- @Property(name = "openflowPort", intValue = DEFAULT_OFPORT,
+ @Property(name = "openflowPort", value = DEFAULT_OFPORT,
label = "Port number used by OpenFlow protocol; default is 6653")
- private int openflowPort = DEFAULT_OFPORT;
+ private String openflowPort = DEFAULT_OFPORT;
@Property(name = "workerThreads", intValue = DEFAULT_WORKER_THREADS,
label = "Number of controller worker threads; default is 16")
@@ -148,8 +143,7 @@
@Activate
public void activate(ComponentContext context) {
cfgService.registerProperties(getClass());
- Map<String, String> properties = readComponentConfiguration(context);
- ctrl.setConfigParams(properties);
+ ctrl.setConfigParams(context.getProperties());
ctrl.start(agent, driverService);
}
@@ -159,33 +153,10 @@
ctrl.stop();
}
- /**
- * Extracts properties from the component configuration context.
- *
- * @param context the component context
- */
- private Map<String, String> readComponentConfiguration(ComponentContext context) {
- Dictionary<?, ?> properties = context.getProperties();
- Map<String, String> outProperties = new HashMap<>();
-
- String port = get(properties, "openflowPort");
- if (!Strings.isNullOrEmpty(port)) {
- outProperties.put("openflowport", port);
- }
-
- String thread = get(properties, "workerThreads");
- if (!Strings.isNullOrEmpty(thread)) {
- outProperties.put("workerthreads", thread);
- }
-
- return outProperties;
- }
-
@Modified
public void modified(ComponentContext context) {
- Map<String, String> properties = readComponentConfiguration(context);
ctrl.stop();
- ctrl.setConfigParams(properties);
+ ctrl.setConfigParams(context.getProperties());
ctrl.start(agent, driverService);
}