*/
@Override
public Object[] getImplementations() {
- Object[] res = { ForwardingRulesManagerImpl.class };
+ Object[] res = { ForwardingRulesManager.class };
return res;
}
*/
@Override
public void configureInstance(Component c, Object imp, String containerName) {
- if (imp.equals(ForwardingRulesManagerImpl.class)) {
+ if (imp.equals(ForwardingRulesManager.class)) {
String interfaces[] = null;
Dictionary<String, Set<String>> props = new Hashtable<String, Set<String>>();
Set<String> propSet = new HashSet<String>();
* the network. It also maintains the central repository of all the forwarding
* rules installed on the network nodes.
*/
-public class ForwardingRulesManagerImpl implements IForwardingRulesManager, PortGroupChangeListener,
+public class ForwardingRulesManager implements IForwardingRulesManager, PortGroupChangeListener,
IContainerListener, ISwitchManagerAware, IConfigurationContainerAware, IInventoryListener, IObjectReader,
ICacheUpdateAware<Long, String>, CommandProvider, IFlowProgrammerListener {
private static final String SAVE = "Save";
private static final String NODEDOWN = "Node is Down";
private static final String SUCCESS = StatusCode.SUCCESS.toString();
- private static final Logger log = LoggerFactory.getLogger(ForwardingRulesManagerImpl.class);
+ private static final Logger log = LoggerFactory.getLogger(ForwardingRulesManager.class);
private Map<Long, String> flowsSaveEvent;
private String frmFileName;
private String portGroupFileName;
FlowEntryInstall flowEntries = mapEntry.getValue();
// Skip internal generated static flows
if (!flowEntries.isInternal()) {
- inactiveFlows.put(flowEntries.getOriginal(), null);
+ inactiveFlows.put(flowEntries.getOriginal(), flowEntries.getOriginal());
}
}
package org.opendaylight.controller.forwardingrulesmanager.internal;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemPackages;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.Bundle;
+
import javax.inject.Inject;
import org.junit.Assert;
-import org.junit.Test;
import org.junit.Before;
+import org.junit.Test;
import org.junit.runner.RunWith;
import org.opendaylight.controller.forwardingrulesmanager.FlowEntry;
import org.opendaylight.controller.forwardingrulesmanager.IForwardingRulesManager;
import org.opendaylight.controller.sal.utils.NodeCreator;
import org.opendaylight.controller.sal.utils.Status;
import org.opendaylight.controller.sal.utils.StatusCode;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.osgi.framework.BundleContext;
-import static org.junit.Assert.*;
-import org.ops4j.pax.exam.junit.Configuration;
-import static org.ops4j.pax.exam.CoreOptions.*;
-
import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.util.PathUtils;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@RunWith(PaxExam.class)
public class ForwardingRulesManagerIT {
// Assert if true, if false we are good to go!
assertFalse(debugit);
- ServiceReference r = bc
- .getServiceReference(IForwardingRulesManager.class.getName());
+ ServiceReference r = bc.getServiceReference(IForwardingRulesManager.class.getName());
if (r != null) {
this.manager = (IForwardingRulesManager) bc.getService(r);
}
Node node = NodeCreator.createOFNode(1L);
FlowEntry fe = new FlowEntry("g1", "f1", flow, node);
- Status stat = manager.installFlowEntry(null);
- Assert.assertTrue(stat.getCode().equals(StatusCode.NOTACCEPTABLE));
+ Status stat = manager.installFlowEntry(fe);
+
+ // OF plugin is not there in integration testing mode
+ Assert.assertTrue(stat.getCode() == StatusCode.NOSERVICE);
}
}
}
// Set the reference to the plugin flow programmer
- public void setService(Map props, IPluginInFlowProgrammerService s) {
+ public void setService(Map<String, Object> props, IPluginInFlowProgrammerService s) {
if (this.pluginFlowProgrammer == null) {
logger.error("pluginFlowProgrammer store null");
return;
}
- logger.trace("Got a service set request {}", s);
- String type = null;
- for (Object e : props.entrySet()) {
- Map.Entry entry = (Map.Entry) e;
- logger.trace("Prop key:({}) value:({})", entry.getKey(),
- entry.getValue());
+ if (logger.isTraceEnabled()) {
+ logger.trace("Got a service set request {}", s);
+ for (Map.Entry<String, Object> entry : props.entrySet()) {
+ logger.trace("Prop key:({}) value:({})", entry.getKey(), entry.getValue());
+ }
}
+ String type = null;
Object value = props.get(GlobalConstants.PROTOCOLPLUGINTYPE.toString());
if (value instanceof String) {
type = (String) value;
}
}
- public void unsetService(Map props, IPluginInFlowProgrammerService s) {
+ public void unsetService(Map<String, Object> props, IPluginInFlowProgrammerService s) {
if (this.pluginFlowProgrammer == null) {
logger.error("pluginFlowProgrammer store null");
return;
}
- String type = null;
logger.debug("Received unsetpluginFlowProgrammer request");
- for (Object e : props.entrySet()) {
- Map.Entry entry = (Map.Entry) e;
- logger.trace("Prop key:({}) value:({})", entry.getKey(),
- entry.getValue());
+ if (logger.isTraceEnabled()) {
+ logger.trace("Got a service set request {}", s);
+ for (Map.Entry<String, Object> entry : props.entrySet()) {
+ logger.trace("Prop key:({}) value:({})", entry.getKey(), entry.getValue());
+ }
}
+ String type = null;
Object value = props.get(GlobalConstants.PROTOCOLPLUGINTYPE.toString());
if (value instanceof String) {
type = (String) value;