@Argument(index = 0, name = "on-off",
description = "target state of drop responder",
required = true, multiValued = false)
- String targetStateArg = null;
+ String targetStateArg;
@Override
@Argument(index = 0, name = "on-off",
description = "target state of drop responder",
required = true, multiValued = false)
- String targetStateArg = null;
+ String targetStateArg;
@Override
protected Object doExecute() throws Exception {
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.NodeErrorListener;
-import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
@SuppressWarnings("checkstyle:MethodName")
public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvider {
private static final Logger LOG = LoggerFactory.getLogger(OpenflowPluginBulkGroupTransactionProvider.class);
- private NodeBuilder testNode;
private DataBroker dataBroker;
private final BundleContext ctx;
- private ProviderContext pc;
- private FlowBuilder testFlow;
private final String originalFlowName = "Foo";
private final NodeErrorListener nodeErrorListener = new NodeErrorListenerLoggingImpl();
- private Registration listener1Reg;
- private Registration listener2Reg;
- private Group testGroup;
- private Group testGroup2;
private Node testNode12;
private final String originalGroupName = "Foo";
- private static NotificationService notificationService;
+ private NotificationService notificationService;
public OpenflowPluginBulkGroupTransactionProvider(BundleContext ctx) {
this.ctx = ctx;
}
public void onSessionInitiated(ProviderContext session) {
- pc = session;
notificationService = session.getSALService(NotificationService.class);
- listener2Reg = notificationService.registerNotificationListener(nodeErrorListener);
+ notificationService.registerNotificationListener(nodeErrorListener);
dataBroker = session.getSALService(DataBroker.class);
ctx.registerService(CommandProvider.class.getName(), this, null);
createTestFlow(createTestNode(null), null, null);
if (nodeId == null) {
nodeId = OpenflowpluginTestActivator.NODE_ID;
}
- NodeRef nodeOne = createNodeRef(nodeId);
NodeBuilder builder = new NodeBuilder();
builder.setId(new NodeId(nodeId));
builder.setKey(new NodeKey(builder.getId()));
- testNode = builder;
return builder;
}
private void createTestNode() {
- NodeRef nodeOne = createNodeRef(OpenflowpluginTestActivator.NODE_ID);
NodeBuilder builder = new NodeBuilder();
builder.setId(new NodeId(OpenflowpluginTestActivator.NODE_ID));
builder.setKey(new NodeKey(builder.getId()));
testNode12 = builder.build();
}
- private static NodeRef createNodeRef(String string) {
- NodeKey key = new NodeKey(new NodeId(string));
- InstanceIdentifier<Node> path = InstanceIdentifier.create(Nodes.class).child(Node.class, key);
- return new NodeRef(path);
- }
-
@Override
public String getHelp() {
return "No help";
flow.setKey(key);
flow.setPriority(2);
flow.setFlowName(originalFlowName + "X" + flowType);
- testFlow = flow;
return flow;
}
private short getTableId(String tableId) {
short table = 2;
+ if (tableId == null) {
+ return table;
+ }
+
try {
table = Short.parseShort(tableId);
} catch (NumberFormatException ex) {
}
private void createUserNode(String nodeRef) {
- NodeRef nodeOne = createNodeRef(nodeRef);
NodeBuilder builder = new NodeBuilder();
builder.setId(new NodeId(nodeRef));
builder.setKey(new NodeKey(builder.getId()));
bucket.setAction(createPopPbbAction());
break;
case "a6":
- bucket.setAction(createPushPbbAction());
- break;
case "a7":
bucket.setAction(createPushPbbAction());
break;
break;
}
- if (groupmod == "add") {
+ if ("add".equals(groupmod)) {
bucket.setWatchGroup((long) 14);
bucket.setWatchPort((long) 1234);
bucket.setWeight(50);
value1.add(bucket.build());
value.setBucket(value1);
group.setBuckets(value.build());
- testGroup = group.build();
return group;
}
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.NotificationService;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6FlowLabel;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
private static final Logger LOG = LoggerFactory.getLogger(OpenflowPluginBulkTransactionProvider.class);
private DataBroker dataBroker;
private final BundleContext ctx;
- private ProviderContext pc;
private final String originalFlowName = "Foo";
private final NodeErrorListener nodeErrorListener = new NodeErrorListenerLoggingImpl();
- private static NotificationService notificationService;
+ private NotificationService notificationService;
public OpenflowPluginBulkTransactionProvider(BundleContext ctx) {
this.ctx = ctx;
}
public void onSessionInitiated(ProviderContext session) {
- pc = session;
notificationService = session.getSALService(NotificationService.class);
notificationService.registerNotificationListener(nodeErrorListener);
dataBroker = session.getSALService(DataBroker.class);
if (nodeId == null) {
nodeId = OpenflowpluginTestActivator.NODE_ID;
}
- NodeRef nodeOne = createNodeRef(nodeId);
NodeBuilder builder = new NodeBuilder();
builder.setId(new NodeId(nodeId));
builder.setKey(new NodeKey(builder.getId()));
return builder;
}
- private static NodeRef createNodeRef(String string) {
- NodeKey key = new NodeKey(new NodeId(string));
- InstanceIdentifier<Node> path = InstanceIdentifier.create(Nodes.class).child(Node.class, key);
-
- return new NodeRef(path);
- }
-
@Override
public String getHelp() {
return "No help";
private short getTableId(String tableId) {
short table = 2;
+ if (tableId == null) {
+ return table;
+ }
+
try {
table = Short.parseShort(tableId);
} catch (NumberFormatException ex) {
tf3 = createTestFlow(tn, "f1000", "10");
break;
default:
- break;
+ throw new IllegalArgumentException("Invalid flowtype: " + flowtype);
}
InstanceIdentifier<Flow> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, tn.getKey())
return match;
}
- private static MatchBuilder createMatch33() {
-
- MatchBuilder match = new MatchBuilder();
- Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
- Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.10");
- ipv4Match.setIpv4Source(prefix);
- Ipv4Match i4m = ipv4Match.build();
- match.setLayer3Match(i4m);
-
- EthernetMatchBuilder eth = new EthernetMatchBuilder();
- EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0xfffeL));
- eth.setEthernetType(ethTypeBuilder.build());
- match.setEthernetMatch(eth.build());
- return match;
- }
-
private static MatchBuilder createInphyportMatch(NodeId nodeId) {
MatchBuilder match = new MatchBuilder();
match.setInPort(new NodeConnectorId(nodeId + ":202"));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
- Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2/64");
- Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1/56");
- Ipv6Address ndtarget = new Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
nextheader.setIpv6Exthdr(58);
Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
package org.opendaylight.openflowplugin.test;
+import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
@SuppressWarnings("checkstyle:MethodName")
public class OpenflowpluginGroupTestCommandProvider implements CommandProvider {
+ private static final String ORIGINAL_GROUP_NAME = "Foo";
private DataBroker dataBroker;
- private ProviderContext pc;
private final BundleContext ctx;
private Group testGroup;
private Node testNode;
- private final String originalGroupName = "Foo";
public OpenflowpluginGroupTestCommandProvider(BundleContext ctx) {
this.ctx = ctx;
}
public void onSessionInitiated(ProviderContext session) {
- pc = session;
dataBroker = session.getSALService(DataBroker.class);
ctx.registerService(CommandProvider.class.getName(), this, null);
createTestNode();
}
private void createUserNode(String nodeRef) {
- NodeRef nodeOne = createNodeRef(nodeRef);
NodeBuilder builder = new NodeBuilder();
builder.setId(new NodeId(nodeRef));
builder.setKey(new NodeKey(builder.getId()));
}
private void createTestNode() {
- NodeRef nodeOne = createNodeRef(OpenflowpluginTestActivator.NODE_ID);
NodeBuilder builder = new NodeBuilder();
builder.setId(new NodeId(OpenflowpluginTestActivator.NODE_ID));
builder.setKey(new NodeKey(builder.getId()));
bucket.setAction(createPopPbbAction());
break;
case "a6":
- bucket.setAction(createPushPbbAction());
- break;
case "a7":
bucket.setAction(createPushPbbAction());
break;
break;
}
- if (groupMod == "add") {
+ if ("add".equals(groupMod)) {
bucket.setWatchGroup((long) 14);
bucket.setWatchPort((long) 1234);
bucket.setWeight(50);
group.setKey(key);
// group.setInstall(false);
group.setGroupId(new GroupId(id));
- group.setGroupName(originalGroupName);
+ group.setGroupName(ORIGINAL_GROUP_NAME);
group.setBarrier(false);
BucketsBuilder value = new BucketsBuilder();
List<Bucket> value1 = new ArrayList<>();
return actionList;
}
- private GroupBuilder createTestRemoveGroup() {
- long id = 123;
- GroupKey key = new GroupKey(new GroupId(id));
- GroupBuilder group = new GroupBuilder();
- /* BucketBuilder bucket = new BucketBuilder();
- bucket.setBucketId(new BucketId((long) 12));
- bucket.setKey(new BucketKey(new BucketId((long) 12))); */
- group.setKey(key);
- // group.setInstall(false);
-
- group.setGroupId(new GroupId(id));
- /* PopVlanActionBuilder vlanAction = new PopVlanActionBuilder();
- ActionBuilder action = new ActionBuilder();
- action.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(vlanAction.build()).build());
- List<Action> actions = new ArrayList<Action>();
- actions.add(action.build()); */
- /* bucket.setAction(actions);
- bucket.setWatchGroup((long) 14);
- bucket.setWatchPort((long) 1234);
- bucket.setWeight(15); */
- // group.setGroupType(GroupTypes.GroupSelect);
- // group.setGroupName(originalGroupName);
- // group.setBarrier(false);
- // BucketsBuilder value = new BucketsBuilder();
- // List<Bucket> value1 = new ArrayList<Bucket>();
- // value1.add(bucket.build());
- // value.setBucket(value1);
- // group.setBuckets(value.build());
- return group;
- }
-
public void _removeGroup(final CommandInterpreter ci) {
String nref = ci.nextArgument();
createUserNode(nref);
}
GroupBuilder gbuilder = createTestGroup(ci.nextArgument(), ci.nextArgument(), "add");
- ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
+ ReadWriteTransaction modification = Preconditions.checkNotNull(dataBroker).newReadWriteTransaction();
InstanceIdentifier<Group> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode.getKey())
.augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(gbuilder.getGroupId()));
modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
}
private void writeGroup(final CommandInterpreter ci, Group group) {
- ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
+ ReadWriteTransaction modification = Preconditions.checkNotNull(dataBroker).newReadWriteTransaction();
InstanceIdentifier<Group> path1 = InstanceIdentifier.create(Nodes.class)
.child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
.child(Group.class, new GroupKey(group.getGroupId()));
return help.toString();
}
-
- private static NodeRef createNodeRef(String string) {
- NodeKey key = new NodeKey(new NodeId(string));
- InstanceIdentifier<Node> path =
- InstanceIdentifier.create(Nodes.class).child(Node.class, key);
-
- return new NodeRef(path);
- }
}
private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginMeterTestCommandProvider.class);
private DataBroker dataBroker;
- private ProviderContext pc;
private final BundleContext ctx;
private Meter testMeter;
private Meter testMeter1;
private final String originalMeterName = "Foo";
private final String updatedMeterName = "Bar";
private final MeterEventListener meterEventListener = new MeterEventListener();
- private static NotificationService notificationService;
+ private NotificationService notificationService;
private Registration listener1Reg;
public OpenflowpluginMeterTestCommandProvider(BundleContext ctx) {
}
public void onSessionInitiated(ProviderContext session) {
- pc = session;
dataBroker = session.getSALService(DataBroker.class);
ctx.registerService(CommandProvider.class.getName(), this, null);
notificationService = session.getSALService(NotificationService.class);
return InstanceIdentifier.create(Nodes.class).child(Node.class, node.getKey());
}
- final class MeterEventListener implements SalMeterListener {
+ private static final class MeterEventListener implements SalMeterListener {
@Override
public void onMeterAdded(MeterAdded notification) {
*/
package org.opendaylight.openflowplugin.test;
+import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
}
private void writeTableFeatures(final CommandInterpreter ci, TableFeatures tableFeatures) {
- ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
+ ReadWriteTransaction modification = Preconditions.checkNotNull(dataBroker).newReadWriteTransaction();
KeyedInstanceIdentifier<TableFeatures, TableFeaturesKey> path1 = InstanceIdentifier.create(Nodes.class)
.child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
import com.google.common.util.concurrent.MoreExecutors;
import java.math.BigInteger;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.opendaylight.controller.sal.binding.api.NotificationService;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6FlowLabel;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
private DataBroker dataBroker;
private final BundleContext ctx;
- private FlowBuilder testFlow;
private static final String ORIGINAL_FLOW_NAME = "Foo";
private static final String UPDATED_FLOW_NAME = "Bar";
private static final String IPV4_PREFIX = "10.0.0.1/24";
private static final String SRC_MAC_ADDRESS = "00:00:00:00:23:ae";
private final SalFlowListener flowEventListener = new FlowEventListenerLoggingImpl();
private final NodeErrorListener nodeErrorListener = new NodeErrorListenerLoggingImpl();
- private static NotificationService notificationService;
+ private NotificationService notificationService;
public OpenflowpluginTestCommandProvider(final BundleContext ctx) {
this.ctx = ctx;
flow.setKey(key);
flow.setFlowName(ORIGINAL_FLOW_NAME + "X" + flowType);
- testFlow = flow;
return flow;
}
flow.setKey(key);
flow.setFlowName(ORIGINAL_FLOW_NAME + "X" + flowType);
- testFlow = flow;
return flow;
}
flow.setTableId((short) 0);
final FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
flow.setKey(key);
- testFlow = flow;
return flow;
}
private short getTableId(final String tableId) {
final short TABLE_ID = 2;
short table = TABLE_ID;
+
+ if (tableId == null) {
+ return table;
+ }
+
try {
table = Short.parseShort(tableId);
} catch (NumberFormatException ex) {
return match;
}
- private static MatchBuilder createL3IPv4Match() {
- final MatchBuilder match = new MatchBuilder();
-
- final EthernetMatchBuilder eth = new EthernetMatchBuilder();
- final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x0800L));
- eth.setEthernetType(ethTypeBuilder.build());
- match.setEthernetMatch(eth.build());
-
- final Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
- // ipv4 match
- final Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10");
- final Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
- final Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
- ipv4match.setIpv4Destination(dstip);
- ipv4match.setIpv4Source(srcip);
- match.setLayer3Match(ipv4match.build());
-
- return match;
-
- }
-
private static MatchBuilder createL3IPv6Match() {
final MatchBuilder match = new MatchBuilder();
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
- final Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2/64");
- final Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1/56");
- final Ipv6Address ndtarget = new Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
final MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
final MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
final Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
writeFlow(ci, tf, tn);
}
- private static NodeRef createNodeRef(final String string) {
- final NodeKey key = new NodeKey(new NodeId(string));
- final InstanceIdentifier<Node> path = InstanceIdentifier.create(Nodes.class).child(Node.class, key);
-
- return new NodeRef(path);
- }
-
@Override
public String getHelp() {
return "No help";
final String threadCountStr = ci.nextArgument();
final String warmUpStr = ci.nextArgument();
- Collection<String> testResults = null;
- if (testResults == null) {
- testResults = new ArrayList<>();
- }
-
int numberOfSwtiches = 0;
int numberOfFlows = 0;
int warmupIterations = 0;
int numberOfSwitches;
int numberOfFlows;
- int testTime;
CommandInterpreter ci;
- int testFlowsAdded;
int theadNumber;
- Collection<String> testResults = null;
int tableID = 0;
TestFlowThread(final int numberOfSwtiches, final int numberOfFlows, final CommandInterpreter ci,
}
}
final long endTime = System.currentTimeMillis();
- final long timeInSeconds = Math.round((endTime - startTime) / 1000);
+ final long timeInSeconds = Math.round((endTime - startTime) / 1000.0F);
if (timeInSeconds > 0) {
ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::"
- + Math.round(totalNumberOfFlows / timeInSeconds));
+ + Math.round((float)totalNumberOfFlows / timeInSeconds));
} else {
ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::" + totalNumberOfFlows);
}
import java.util.ArrayList;
import java.util.List;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.NotificationService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemoved;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRemoved;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.OpendaylightInventoryListener;
-import org.opendaylight.yangtools.concepts.Registration;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestNodeConnectorNotification.class);
- private DataBroker dataBroker;
- private ProviderContext pc;
- private final BundleContext ctx;
private final PortEventListener portEventListener = new PortEventListener();
- private static NotificationService notificationService;
- private Registration listenerReg;
+ private NotificationService notificationService;
public OpenflowpluginTestNodeConnectorNotification(BundleContext ctx) {
- this.ctx = ctx;
}
public void onSessionInitiated(ProviderContext session) {
- pc = session;
notificationService = session.getSALService(NotificationService.class);
// For switch events
- listenerReg = notificationService.registerNotificationListener(portEventListener);
- dataBroker = session.getSALService(DataBroker.class);
+ notificationService.registerNotificationListener(portEventListener);
}
- final class PortEventListener implements OpendaylightInventoryListener {
+ private static final class PortEventListener implements OpendaylightInventoryListener {
List<NodeUpdated> nodeUpdated = new ArrayList<>();
List<NodeRemoved> nodeRemoved = new ArrayList<>();
*/
package org.opendaylight.openflowplugin.test;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.NotificationService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.FlowTopologyDiscoveryListener;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkOverutilized;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemoved;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkUtilizationNormal;
-import org.opendaylight.yangtools.concepts.Registration;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestTopologyNotification.class);
- private DataBroker dataBroker;
- private ProviderContext pc;
- private final BundleContext ctx;
private final TopologyEventListener topologyEventListener = new TopologyEventListener();
- private static NotificationService notificationService;
- private Registration listenerReg;
+ private NotificationService notificationService;
public OpenflowpluginTestTopologyNotification(BundleContext ctx) {
- this.ctx = ctx;
}
public void onSessionInitiated(ProviderContext session) {
- pc = session;
notificationService = session.getSALService(NotificationService.class);
// For switch events
- listenerReg = notificationService.registerNotificationListener(topologyEventListener);
- dataBroker = session.getSALService(DataBroker.class);
+ notificationService.registerNotificationListener(topologyEventListener);
}
- final class TopologyEventListener implements FlowTopologyDiscoveryListener {
-
- List<LinkDiscovered> linkdiscovered = new ArrayList<>();
- List<LinkOverutilized> linkoverutilized = new ArrayList<>();
- List<LinkRemoved> linkremoved = new ArrayList<>();
- List<LinkUtilizationNormal> linkutilizationnormal = new ArrayList<>();
-
+ private static final class TopologyEventListener implements FlowTopologyDiscoveryListener {
@Override
public void onLinkDiscovered(LinkDiscovered notification) {
LOG.debug("-------------------------------------------");