- classes originating from deprecated org.opendaylight.controller.sal.binding.api.data
and org.opendaylight.controller.sal.core.api.data
replaced by classes originating from org.opendaylight.controller.md.sal.binding.api
Change-Id: I53d1c1cb3fa56103b97d7333153e9d145f14559d
Signed-off-by: Martin Bobak <mbobak@cisco.com>
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-
import org.eclipse.osgi.framework.console.CommandInterpreter;
import org.eclipse.osgi.framework.console.CommandProvider;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.NotificationService;
-import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowListener;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
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.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.osgi.framework.BundleContext;
public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvider {
private static final Logger LOG = LoggerFactory.getLogger(OpenflowPluginBulkGroupTransactionProvider.class);
private NodeBuilder testNode;
- private DataBrokerService dataBrokerService;
+ private DataBroker dataBroker;
private final BundleContext ctx;
private ProviderContext pc;
private FlowBuilder testFlow;
pc = session;
notificationService = session.getSALService(NotificationService.class);
listener2Reg = notificationService.registerNotificationListener(nodeErrorListener);
- dataBrokerService = session.getSALService(DataBrokerService.class);
+ dataBroker = session.getSALService(DataBroker.class);
ctx.registerService(CommandProvider.class.getName(), this, null);
createTestFlow(createTestNode(null), null, null);
}
private static MatchBuilder createEthernetMatch() {
MatchBuilder match = new MatchBuilder();
- byte[] mask1 = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
- byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
+ byte[] mask1 = new byte[]{(byte) -1, (byte) -1, 0, 0, 0, 0};
+ byte[] mask2 = new byte[]{(byte) -1, (byte) -1, (byte) -1, 0, 0, 0};
EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
- // match
+ // match
EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
EtherType type = new EtherType(0x0800L);
ethmatch.setEthernetType(ethtype.setType(type).build());
EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet
- // macaddress
- // match
+ // macaddress
+ // match
MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
ethdest.setAddress(macdest);
// ethdest.setMask(mask1);
}
switch (flowType) {
- case "f1":
- id += 1;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createDecNwTtlInstructions().build());
- break;
- case "f2":
- id += 2;
- flow.setMatch(createMatch2().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f3":
- id += 3;
- flow.setMatch(createMatch3().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f4":
- id += 4;
- flow.setMatch(createEthernetMatch().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f82":
- id += 1;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f5":
- id += 5;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction().build());
- break;
- case "f6":
- id += 6;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createGotoTableInstructions().build());
- break;
- case "f7":
- id += 7;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createMeterInstructions().build());
- break;
- case "f8":
- id += 8;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction7().build());
- break;
- case "f9":
- id += 9;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction2().build());
- break;
- case "f10":
- id += 10;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction3().build());
- break;
- case "f14":
- id += 14;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction7().build());
- break;
- case "f29":
- id += 29;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction21().build());
- break;
-
- default:
- LOG.warn("flow type not understood: {}", flowType);
+ case "f1":
+ id += 1;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createDecNwTtlInstructions().build());
+ break;
+ case "f2":
+ id += 2;
+ flow.setMatch(createMatch2().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f3":
+ id += 3;
+ flow.setMatch(createMatch3().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f4":
+ id += 4;
+ flow.setMatch(createEthernetMatch().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f82":
+ id += 1;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f5":
+ id += 5;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction().build());
+ break;
+ case "f6":
+ id += 6;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createGotoTableInstructions().build());
+ break;
+ case "f7":
+ id += 7;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createMeterInstructions().build());
+ break;
+ case "f8":
+ id += 8;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction7().build());
+ break;
+ case "f9":
+ id += 9;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction2().build());
+ break;
+ case "f10":
+ id += 10;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction3().build());
+ break;
+ case "f14":
+ id += 14;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction7().build());
+ break;
+ case "f29":
+ id += 29;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction21().build());
+ break;
+
+ default:
+ LOG.warn("flow type not understood: {}", flowType);
}
FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
}
Integer count = Integer.parseInt(ci.nextArgument());
switch (count) {
- case 1:
- GroupBuilder group = createTestGroup("a7", "g1", "add", "1");
- GroupBuilder group1 = createTestGroup("a3", "g1", "add", "2");
- writeGroup(ci, group.build(), group1.build());
- break;
- case 2:
- GroupBuilder group2 = createTestGroup("a4", "g1", "add", "4");
- GroupBuilder group3 = createTestGroup("a5", "g1", "add", "5");
- writeGroup(ci, group2.build(), group3.build());
- break;
- case 3:
- GroupBuilder group4 = createTestGroup("a6", "g1", "add", "6");
- GroupBuilder group5 = createTestGroup("a7", "g1", "add", "7");
- writeGroup(ci, group4.build(), group5.build());
- break;
- case 4:
- // -ve
- GroupBuilder group6 = createTestGroup("a14", "g1", "add", "5");
- GroupBuilder group7 = createTestGroup("a3", "g1", "add", "6");
- writeGroup(ci, group6.build(), group7.build());
- break;
+ case 1:
+ GroupBuilder group = createTestGroup("a7", "g1", "add", "1");
+ GroupBuilder group1 = createTestGroup("a3", "g1", "add", "2");
+ writeGroup(ci, group.build(), group1.build());
+ break;
+ case 2:
+ GroupBuilder group2 = createTestGroup("a4", "g1", "add", "4");
+ GroupBuilder group3 = createTestGroup("a5", "g1", "add", "5");
+ writeGroup(ci, group2.build(), group3.build());
+ break;
+ case 3:
+ GroupBuilder group4 = createTestGroup("a6", "g1", "add", "6");
+ GroupBuilder group5 = createTestGroup("a7", "g1", "add", "7");
+ writeGroup(ci, group4.build(), group5.build());
+ break;
+ case 4:
+ // -ve
+ GroupBuilder group6 = createTestGroup("a14", "g1", "add", "5");
+ GroupBuilder group7 = createTestGroup("a3", "g1", "add", "6");
+ writeGroup(ci, group6.build(), group7.build());
+ break;
}
}
Integer count = Integer.parseInt(ci.nextArgument());
switch (count) {
- case 1:
- GroupBuilder group = createTestGroup("a4", "g1", "modify", "1");
- GroupBuilder group1 = createTestGroup("a5", "g1", "modify", "2");
- writeGroup(ci, group.build(), group1.build());
- break;
- case 2:
- GroupBuilder group2 = createTestGroup("a1", "g1", "modify", "4");
- GroupBuilder group3 = createTestGroup("a2", "g1", "modify", "5");
- writeGroup(ci, group2.build(), group3.build());
- break;
- case 3:
- GroupBuilder group4 = createTestGroup("a9", "g1", "modify", "6");
- GroupBuilder group5 = createTestGroup("a10", "g1", "modify", "7");
- writeGroup(ci, group4.build(), group5.build());
- break;
-
- case 4:
- GroupBuilder group6 = createTestGroup("a6", "g1", "modify", "5");
- GroupBuilder group7 = createTestGroup("a29", "g1", "modify", "6");
- writeGroup(ci, group6.build(), group7.build());
- break;
+ case 1:
+ GroupBuilder group = createTestGroup("a4", "g1", "modify", "1");
+ GroupBuilder group1 = createTestGroup("a5", "g1", "modify", "2");
+ writeGroup(ci, group.build(), group1.build());
+ break;
+ case 2:
+ GroupBuilder group2 = createTestGroup("a1", "g1", "modify", "4");
+ GroupBuilder group3 = createTestGroup("a2", "g1", "modify", "5");
+ writeGroup(ci, group2.build(), group3.build());
+ break;
+ case 3:
+ GroupBuilder group4 = createTestGroup("a9", "g1", "modify", "6");
+ GroupBuilder group5 = createTestGroup("a10", "g1", "modify", "7");
+ writeGroup(ci, group4.build(), group5.build());
+ break;
+
+ case 4:
+ GroupBuilder group6 = createTestGroup("a6", "g1", "modify", "5");
+ GroupBuilder group7 = createTestGroup("a29", "g1", "modify", "6");
+ writeGroup(ci, group6.build(), group7.build());
+ break;
}
}
Integer count = Integer.parseInt(ci.nextArgument());
switch (count) {
- case 1:
- GroupBuilder group = createTestGroup("a2", "g1", "remove", "1");
- GroupBuilder group1 = createTestGroup("a3", "g1", "remove", "2");
- deleteGroup(ci, group.build(), group1.build());
- break;
- case 2:
- GroupBuilder group2 = createTestGroup("a4", "g1", "remove", "4");
- GroupBuilder group3 = createTestGroup("a5", "g1", "remove", "5");
- deleteGroup(ci, group2.build(), group3.build());
- break;
- case 3:
- GroupBuilder group4 = createTestGroup("a6", "g1", "remove", "6");
- GroupBuilder group5 = createTestGroup("a7", "g1", "remove", "7");
- deleteGroup(ci, group4.build(), group5.build());
- break;
- case 4:
- GroupBuilder group6 = createTestGroup("a14", "g1", "remove", "5");
- GroupBuilder group7 = createTestGroup("a3", "g1", "remove", "6");
- deleteGroup(ci, group6.build(), group7.build());
- break;
- case 5:
- GroupBuilder group8 = createTestGroup("a4", "g1", "modify", "1");
- GroupBuilder group9 = createTestGroup("a5", "g1", "modify", "2");
- writeGroup(ci, group8.build(), group9.build());
- break;
- case 6:
- GroupBuilder group10 = createTestGroup("a1", "g1", "modify", "4");
- GroupBuilder group11 = createTestGroup("a2", "g1", "modify", "5");
- writeGroup(ci, group10.build(), group11.build());
- break;
- case 7:
- GroupBuilder group12 = createTestGroup("a9", "g1", "modify", "6");
- GroupBuilder group13 = createTestGroup("a10", "g1", "modify", "7");
- writeGroup(ci, group12.build(), group13.build());
- break;
-
- case 8:
- GroupBuilder group14 = createTestGroup("a6", "g1", "modify", "5");
- GroupBuilder group15 = createTestGroup("a29", "g1", "modify", "6");
- writeGroup(ci, group14.build(), group15.build());
- break;
+ case 1:
+ GroupBuilder group = createTestGroup("a2", "g1", "remove", "1");
+ GroupBuilder group1 = createTestGroup("a3", "g1", "remove", "2");
+ deleteGroup(ci, group.build(), group1.build());
+ break;
+ case 2:
+ GroupBuilder group2 = createTestGroup("a4", "g1", "remove", "4");
+ GroupBuilder group3 = createTestGroup("a5", "g1", "remove", "5");
+ deleteGroup(ci, group2.build(), group3.build());
+ break;
+ case 3:
+ GroupBuilder group4 = createTestGroup("a6", "g1", "remove", "6");
+ GroupBuilder group5 = createTestGroup("a7", "g1", "remove", "7");
+ deleteGroup(ci, group4.build(), group5.build());
+ break;
+ case 4:
+ GroupBuilder group6 = createTestGroup("a14", "g1", "remove", "5");
+ GroupBuilder group7 = createTestGroup("a3", "g1", "remove", "6");
+ deleteGroup(ci, group6.build(), group7.build());
+ break;
+ case 5:
+ GroupBuilder group8 = createTestGroup("a4", "g1", "modify", "1");
+ GroupBuilder group9 = createTestGroup("a5", "g1", "modify", "2");
+ writeGroup(ci, group8.build(), group9.build());
+ break;
+ case 6:
+ GroupBuilder group10 = createTestGroup("a1", "g1", "modify", "4");
+ GroupBuilder group11 = createTestGroup("a2", "g1", "modify", "5");
+ writeGroup(ci, group10.build(), group11.build());
+ break;
+ case 7:
+ GroupBuilder group12 = createTestGroup("a9", "g1", "modify", "6");
+ GroupBuilder group13 = createTestGroup("a10", "g1", "modify", "7");
+ writeGroup(ci, group12.build(), group13.build());
+ break;
+
+ case 8:
+ GroupBuilder group14 = createTestGroup("a6", "g1", "modify", "5");
+ GroupBuilder group15 = createTestGroup("a29", "g1", "modify", "6");
+ writeGroup(ci, group14.build(), group15.build());
+ break;
}
}
private void writeGroup(CommandInterpreter ci, Group group, Group group1) {
- DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
+ ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
+
InstanceIdentifier<Group> path1 = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, testNode12.getKey()).augmentation(FlowCapableNode.class)
.child(Group.class, new GroupKey(group.getGroupId())).build();
- modification.putConfigurationData(nodeToInstanceId(testNode12), testNode12);
- modification.putConfigurationData(path1, group);
+ modification.put(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode12), testNode12);
+ modification.put(LogicalDatastoreType.CONFIGURATION, path1, group);
InstanceIdentifier<Group> path2 = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, testNode12.getKey()).augmentation(FlowCapableNode.class)
.child(Group.class, new GroupKey(group1.getGroupId())).build();
- modification.putConfigurationData(nodeToInstanceId(testNode12), testNode12);
- modification.putConfigurationData(path2, group1);
+ modification.put(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode12), testNode12);
+ modification.put(LogicalDatastoreType.CONFIGURATION, path2, group1);
Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
try {
}
private void deleteGroup(CommandInterpreter ci, Group group, Group group1) {
- DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
+ ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Group> path1 = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, testNode12.getKey()).augmentation(FlowCapableNode.class)
.child(Group.class, new GroupKey(group.getGroupId())).build();
- modification.removeOperationalData(path1);
- modification.removeConfigurationData(path1);
+ modification.delete(LogicalDatastoreType.OPERATIONAL, path1);
+ modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
InstanceIdentifier<Group> path2 = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, testNode12.getKey()).augmentation(FlowCapableNode.class)
.child(Group.class, new GroupKey(group1.getGroupId())).build();
- modification.removeOperationalData(path2);
- modification.removeConfigurationData(path2);
+ modification.delete(LogicalDatastoreType.OPERATIONAL, path2);
+ modification.delete(LogicalDatastoreType.CONFIGURATION, path2);
Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
try {
RpcResult<TransactionStatus> result = commitFuture.get();
}
switch (GroupType) {
- case "g1":
- group.setGroupType(GroupTypes.GroupSelect);
- break;
- case "g2":
- group.setGroupType(GroupTypes.GroupAll);
- break;
- case "g3":
- group.setGroupType(GroupTypes.GroupIndirect);
- break;
- case "g4":
- group.setGroupType(GroupTypes.GroupFf);
- break;
+ case "g1":
+ group.setGroupType(GroupTypes.GroupSelect);
+ break;
+ case "g2":
+ group.setGroupType(GroupTypes.GroupAll);
+ break;
+ case "g3":
+ group.setGroupType(GroupTypes.GroupIndirect);
+ break;
+ case "g4":
+ group.setGroupType(GroupTypes.GroupFf);
+ break;
}
switch (ActionType) {
- case "a1":
- bucket.setAction(createPopVlanAction());
- break;
- case "a2":
- bucket.setAction(createPushVlanAction());
- break;
- case "a3":
- bucket.setAction(createPushMplsAction());
- break;
- case "a4":
- bucket.setAction(createPopMplsAction());
- break;
- case "a5":
- bucket.setAction(createPopPbbAction());
- break;
- case "a6":
- bucket.setAction(createPushPbbAction());
- break;
- case "a7":
- bucket.setAction(createPushPbbAction());
- break;
- case "a8":
- bucket.setAction(createCopyTtlInAction());
- break;
- case "a9":
- bucket.setAction(createCopyTtlOutAction());
- break;
- case "a10":
- bucket.setAction(createDecMplsTtlAction());
- break;
- case "a14":
- bucket.setAction(createGroupAction());
- break;
- case "a29":
- bucket.setAction(createNonAppyPushVlanAction());
- break;
+ case "a1":
+ bucket.setAction(createPopVlanAction());
+ break;
+ case "a2":
+ bucket.setAction(createPushVlanAction());
+ break;
+ case "a3":
+ bucket.setAction(createPushMplsAction());
+ break;
+ case "a4":
+ bucket.setAction(createPopMplsAction());
+ break;
+ case "a5":
+ bucket.setAction(createPopPbbAction());
+ break;
+ case "a6":
+ bucket.setAction(createPushPbbAction());
+ break;
+ case "a7":
+ bucket.setAction(createPushPbbAction());
+ break;
+ case "a8":
+ bucket.setAction(createCopyTtlInAction());
+ break;
+ case "a9":
+ bucket.setAction(createCopyTtlOutAction());
+ break;
+ case "a10":
+ bucket.setAction(createDecMplsTtlAction());
+ break;
+ case "a14":
+ bucket.setAction(createGroupAction());
+ break;
+ case "a29":
+ bucket.setAction(createNonAppyPushVlanAction());
+ break;
}
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-
import org.eclipse.osgi.framework.console.CommandInterpreter;
import org.eclipse.osgi.framework.console.CommandProvider;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.NotificationService;
-import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6FlowLabel;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowListener;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.OutputPortValues;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
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.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.osgi.framework.BundleContext;
public class OpenflowPluginBulkTransactionProvider implements CommandProvider {
private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
- private DataBrokerService dataBrokerService;
+ private DataBroker dataBroker;
private final BundleContext ctx;
private NodeBuilder testNode;
private ProviderContext pc;
pc = session;
notificationService = session.getSALService(NotificationService.class);
listener2Reg = notificationService.registerNotificationListener(nodeErrorListener);
- dataBrokerService = session.getSALService(DataBrokerService.class);
+ dataBroker = session.getSALService(DataBroker.class);
ctx.registerService(CommandProvider.class.getName(), this, null);
createTestFlow(createTestNode(null), null, null);
}
}
switch (flowType) {
- case "f1":
- id += 1;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createDecNwTtlInstructions().build());
- break;
- case "f2":
- id += 2;
- flow.setMatch(createMatch2().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f3":
- id += 3;
- flow.setMatch(createMatch3().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f4":
- id += 4;
- flow.setMatch(createEthernetMatch().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f5":
- id += 5;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction().build());
- break;
- case "f6":
- id += 6;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createGotoTableInstructions().build());
- break;
- case "f7":
- id += 7;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createMeterInstructions().build());
- break;
- case "f8":
- id += 8;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction7().build());
- break;
- case "f9":
- id += 9;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction2().build());
- break;
- case "f10":
- id += 10;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction3().build());
- break;
- case "f23":
- id += 23;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction16().build());
- break;
- case "f230":
- id += 23;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction160().build());
- break;
- case "f34":
- id += 34;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction26().build());
- break;
- case "f35":
- id += 35;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction27().build());
- break;
- case "f36":
- id += 36;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction28().build());
- break;
- case "f42":
- id += 42;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction34().build());
- break;
- case "f43":
- id += 43;
- flow.setMatch(createICMPv6Match().build());
- flow.setInstructions(createDecNwTtlInstructions().build());
- break;
- case "f44":
- id += 44;
- flow.setMatch(createInphyportMatch(nodeBuilder.getId()).build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f45":
- id += 45;
- flow.setMatch(createMetadataMatch().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f46":
- id += 46;
- flow.setMatch(createL3IPv6Match().build());
- flow.setInstructions(createDecNwTtlInstructions().build());
- break;
- case "f81":
- id += 81;
- flow.setMatch(createLLDPMatch().build());
- flow.setInstructions(createSentToControllerInstructions().build());
- break;
-
- case "f82":
- id += 1;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f83":
- id += 2;
- flow.setMatch(createMatch2().build());
- flow.setInstructions(createDecNwTtlInstructions().build());
- break;
- case "f84":
- id += 3;
- flow.setMatch(createMatch3().build());
- flow.setInstructions(createDecNwTtlInstructions().build());
- break;
- case "f85":
- id += 4;
- flow.setMatch(createEthernetMatch().build());
- flow.setInstructions(createMeterInstructions().build());
- break;
- case "f86":
- id += 6;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createDecNwTtlInstructions().build());
- break;
- case "f87":
- id += 12;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction7().build());
- break;
- case "f88":
- id += 13;
- flow.setMatch(createEthernetMatch().build());
- flow.setInstructions(createAppyActionInstruction6().build());
- break;
- case "f89":
- id += 14;
- flow.setMatch(createEthernetMatch().build());
- flow.setInstructions(createAppyActionInstruction7().build());
- break;
- case "f90":
- id += 15;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction9().build());
- break;
- case "f91":
- id += 7;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction9().build());
- break;
- case "f92":
- id += 8;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction6().build());
- break;
- case "f93":
- id += 9;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createDecNwTtlInstructions().build());
- break;
- case "f94":
- id += 10;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createDecNwTtlInstructions().build());
- break;
- case "f95":
- id += 42;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createDecNwTtlInstructions().build());
- break;
- case "f96":
- id += 43;
- flow.setMatch(createICMPv6Match().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f97":
- id += 44;
- flow.setMatch(createInphyportMatch(nodeBuilder.getId()).build());
- flow.setInstructions(createMeterInstructions().build());
- break;
- case "f98":
- id += 45;
- flow.setMatch(createMetadataMatch().build());
- flow.setInstructions(createAppyActionInstruction6().build());
- break;
- case "f99":
- id += 34;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction6().build());
- break;
- case "f100":
- id += 35;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction7().build());
- break;
- case "f101":
- id += 36;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction8().build());
- break;
- case "f700":
- id += 3;
- flow.setMatch(createMatch3().build());
- flow.setInstructions(createMeterInstructions().build());
- break;
- case "f800":
- id += 8;
- flow.setMatch(createMatch1000().build());
- flow.setInstructions(createAppyActionInstruction6().build());
- break;
- case "f900":
- id += 5;
- flow.setMatch(createMatch1000().build());
- flow.setInstructions(createAppyActionInstruction2().build());
- break;
- case "f1000":
- id += 10;
- flow.setMatch(createMatch1000().build());
- flow.setInstructions(createAppyActionInstruction3().build());
- break;
- default:
- LOG.warn("flow type not understood: {}", flowType);
+ case "f1":
+ id += 1;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createDecNwTtlInstructions().build());
+ break;
+ case "f2":
+ id += 2;
+ flow.setMatch(createMatch2().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f3":
+ id += 3;
+ flow.setMatch(createMatch3().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f4":
+ id += 4;
+ flow.setMatch(createEthernetMatch().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f5":
+ id += 5;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction().build());
+ break;
+ case "f6":
+ id += 6;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createGotoTableInstructions().build());
+ break;
+ case "f7":
+ id += 7;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createMeterInstructions().build());
+ break;
+ case "f8":
+ id += 8;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction7().build());
+ break;
+ case "f9":
+ id += 9;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction2().build());
+ break;
+ case "f10":
+ id += 10;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction3().build());
+ break;
+ case "f23":
+ id += 23;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction16().build());
+ break;
+ case "f230":
+ id += 23;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction160().build());
+ break;
+ case "f34":
+ id += 34;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction26().build());
+ break;
+ case "f35":
+ id += 35;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction27().build());
+ break;
+ case "f36":
+ id += 36;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction28().build());
+ break;
+ case "f42":
+ id += 42;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction34().build());
+ break;
+ case "f43":
+ id += 43;
+ flow.setMatch(createICMPv6Match().build());
+ flow.setInstructions(createDecNwTtlInstructions().build());
+ break;
+ case "f44":
+ id += 44;
+ flow.setMatch(createInphyportMatch(nodeBuilder.getId()).build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f45":
+ id += 45;
+ flow.setMatch(createMetadataMatch().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f46":
+ id += 46;
+ flow.setMatch(createL3IPv6Match().build());
+ flow.setInstructions(createDecNwTtlInstructions().build());
+ break;
+ case "f81":
+ id += 81;
+ flow.setMatch(createLLDPMatch().build());
+ flow.setInstructions(createSentToControllerInstructions().build());
+ break;
+
+ case "f82":
+ id += 1;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f83":
+ id += 2;
+ flow.setMatch(createMatch2().build());
+ flow.setInstructions(createDecNwTtlInstructions().build());
+ break;
+ case "f84":
+ id += 3;
+ flow.setMatch(createMatch3().build());
+ flow.setInstructions(createDecNwTtlInstructions().build());
+ break;
+ case "f85":
+ id += 4;
+ flow.setMatch(createEthernetMatch().build());
+ flow.setInstructions(createMeterInstructions().build());
+ break;
+ case "f86":
+ id += 6;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createDecNwTtlInstructions().build());
+ break;
+ case "f87":
+ id += 12;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction7().build());
+ break;
+ case "f88":
+ id += 13;
+ flow.setMatch(createEthernetMatch().build());
+ flow.setInstructions(createAppyActionInstruction6().build());
+ break;
+ case "f89":
+ id += 14;
+ flow.setMatch(createEthernetMatch().build());
+ flow.setInstructions(createAppyActionInstruction7().build());
+ break;
+ case "f90":
+ id += 15;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction9().build());
+ break;
+ case "f91":
+ id += 7;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction9().build());
+ break;
+ case "f92":
+ id += 8;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction6().build());
+ break;
+ case "f93":
+ id += 9;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createDecNwTtlInstructions().build());
+ break;
+ case "f94":
+ id += 10;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createDecNwTtlInstructions().build());
+ break;
+ case "f95":
+ id += 42;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createDecNwTtlInstructions().build());
+ break;
+ case "f96":
+ id += 43;
+ flow.setMatch(createICMPv6Match().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f97":
+ id += 44;
+ flow.setMatch(createInphyportMatch(nodeBuilder.getId()).build());
+ flow.setInstructions(createMeterInstructions().build());
+ break;
+ case "f98":
+ id += 45;
+ flow.setMatch(createMetadataMatch().build());
+ flow.setInstructions(createAppyActionInstruction6().build());
+ break;
+ case "f99":
+ id += 34;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction6().build());
+ break;
+ case "f100":
+ id += 35;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction7().build());
+ break;
+ case "f101":
+ id += 36;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction8().build());
+ break;
+ case "f700":
+ id += 3;
+ flow.setMatch(createMatch3().build());
+ flow.setInstructions(createMeterInstructions().build());
+ break;
+ case "f800":
+ id += 8;
+ flow.setMatch(createMatch1000().build());
+ flow.setInstructions(createAppyActionInstruction6().build());
+ break;
+ case "f900":
+ id += 5;
+ flow.setMatch(createMatch1000().build());
+ flow.setInstructions(createAppyActionInstruction2().build());
+ break;
+ case "f1000":
+ id += 10;
+ flow.setMatch(createMatch1000().build());
+ flow.setInstructions(createAppyActionInstruction3().build());
+ break;
+ default:
+ LOG.warn("flow type not understood: {}", flowType);
}
FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
FlowBuilder tf2;
FlowBuilder tf3;
switch (flowcnt) {
- case 1:
- tf = createTestFlow(tn, "f1", "10");
- tf1 = createTestFlow(tn, "f2", "11");
- tf2 = createTestFlow(tn, "f3", "12");
- tf3 = createTestFlow(tn, "f4", "13");
- break;
- case 2:
- tf = createTestFlow(tn, "f3", "3");
- tf1 = createTestFlow(tn, "f4", "4");
- tf2 = createTestFlow(tn, "f5", "5");
- tf3 = createTestFlow(tn, "f6", "6");
- break;
- case 3:
- tf = createTestFlow(tn, "f7", "7");
- tf1 = createTestFlow(tn, "f8", "8");
- tf2 = createTestFlow(tn, "f9", "9");
- tf3 = createTestFlow(tn, "f10", "10");
- break;
- case 4:
- // -ve scenario
- tf = createTestFlow(tn, "f23", "3");
- tf1 = createTestFlow(tn, "f34", "4");
- tf2 = createTestFlow(tn, "f35", "5");
- tf3 = createTestFlow(tn, "f36", "6");
- break;
- case 5:
- // +ve scenario
- // modify case 6 -ve
- tf = createTestFlow(tn, "f230", "3");
- tf1 = createTestFlow(tn, "f34", "4");
- tf2 = createTestFlow(tn, "f35", "5");
- tf3 = createTestFlow(tn, "f36", "6");
- break;
-
- default:
- tf = createTestFlow(tn, "f42", "42");
- tf1 = createTestFlow(tn, "f43", "43");
- tf2 = createTestFlow(tn, "f44", "44");
- tf3 = createTestFlow(tn, "f45", "45");
+ case 1:
+ tf = createTestFlow(tn, "f1", "10");
+ tf1 = createTestFlow(tn, "f2", "11");
+ tf2 = createTestFlow(tn, "f3", "12");
+ tf3 = createTestFlow(tn, "f4", "13");
+ break;
+ case 2:
+ tf = createTestFlow(tn, "f3", "3");
+ tf1 = createTestFlow(tn, "f4", "4");
+ tf2 = createTestFlow(tn, "f5", "5");
+ tf3 = createTestFlow(tn, "f6", "6");
+ break;
+ case 3:
+ tf = createTestFlow(tn, "f7", "7");
+ tf1 = createTestFlow(tn, "f8", "8");
+ tf2 = createTestFlow(tn, "f9", "9");
+ tf3 = createTestFlow(tn, "f10", "10");
+ break;
+ case 4:
+ // -ve scenario
+ tf = createTestFlow(tn, "f23", "3");
+ tf1 = createTestFlow(tn, "f34", "4");
+ tf2 = createTestFlow(tn, "f35", "5");
+ tf3 = createTestFlow(tn, "f36", "6");
+ break;
+ case 5:
+ // +ve scenario
+ // modify case 6 -ve
+ tf = createTestFlow(tn, "f230", "3");
+ tf1 = createTestFlow(tn, "f34", "4");
+ tf2 = createTestFlow(tn, "f35", "5");
+ tf3 = createTestFlow(tn, "f36", "6");
+ break;
+
+ default:
+ tf = createTestFlow(tn, "f42", "42");
+ tf1 = createTestFlow(tn, "f43", "43");
+ tf2 = createTestFlow(tn, "f44", "44");
+ tf3 = createTestFlow(tn, "f45", "45");
}
writeFlow(ci, tf, tf1, tf2, tf3, tn);
FlowBuilder tf2;
FlowBuilder tf3;
switch (flowcnt) {
- case 1:
- tf = createTestFlow(tn, "f82", "10");
- tf1 = createTestFlow(tn, "f83", "11");
- tf2 = createTestFlow(tn, "f84", "12");
- tf3 = createTestFlow(tn, "f85", "13");
- break;
- case 2:
- tf = createTestFlow(tn, "f700", "3");
- tf1 = createTestFlow(tn, "f4", "4");
- tf2 = createTestFlow(tn, "f900", "5");
- tf3 = createTestFlow(tn, "f86", "6");
- break;
- case 3:
- // +
- tf = createTestFlow(tn, "f91", "7");
- tf1 = createTestFlow(tn, "f92", "8");
- tf2 = createTestFlow(tn, "f93", "9");
- tf3 = createTestFlow(tn, "f94", "10");
- break;
- case 4:
- // +ve scenario
- tf = createTestFlow(tn, "f230", "3");
- tf1 = createTestFlow(tn, "f99", "4");
- tf2 = createTestFlow(tn, "f100", "5");
- tf3 = createTestFlow(tn, "f101", "6");
- break;
- case 5:
- // -
- tf = createTestFlow(tn, "f23", "3");
- tf1 = createTestFlow(tn, "f99", "4");
- tf2 = createTestFlow(tn, "f100", "5");
- tf3 = createTestFlow(tn, "f101", "6");
- break;
-
- default:
- tf = createTestFlow(tn, "f87", "12");
- tf1 = createTestFlow(tn, "f88", "13");
- tf2 = createTestFlow(tn, "f89", "14");
- tf3 = createTestFlow(tn, "f90", "15");
+ case 1:
+ tf = createTestFlow(tn, "f82", "10");
+ tf1 = createTestFlow(tn, "f83", "11");
+ tf2 = createTestFlow(tn, "f84", "12");
+ tf3 = createTestFlow(tn, "f85", "13");
+ break;
+ case 2:
+ tf = createTestFlow(tn, "f700", "3");
+ tf1 = createTestFlow(tn, "f4", "4");
+ tf2 = createTestFlow(tn, "f900", "5");
+ tf3 = createTestFlow(tn, "f86", "6");
+ break;
+ case 3:
+ // +
+ tf = createTestFlow(tn, "f91", "7");
+ tf1 = createTestFlow(tn, "f92", "8");
+ tf2 = createTestFlow(tn, "f93", "9");
+ tf3 = createTestFlow(tn, "f94", "10");
+ break;
+ case 4:
+ // +ve scenario
+ tf = createTestFlow(tn, "f230", "3");
+ tf1 = createTestFlow(tn, "f99", "4");
+ tf2 = createTestFlow(tn, "f100", "5");
+ tf3 = createTestFlow(tn, "f101", "6");
+ break;
+ case 5:
+ // -
+ tf = createTestFlow(tn, "f23", "3");
+ tf1 = createTestFlow(tn, "f99", "4");
+ tf2 = createTestFlow(tn, "f100", "5");
+ tf3 = createTestFlow(tn, "f101", "6");
+ break;
+
+ default:
+ tf = createTestFlow(tn, "f87", "12");
+ tf1 = createTestFlow(tn, "f88", "13");
+ tf2 = createTestFlow(tn, "f89", "14");
+ tf3 = createTestFlow(tn, "f90", "15");
}
}
public void _removeFlows(CommandInterpreter ci) {
- DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
+ ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
NodeBuilder tn = createTestNode(ci.nextArgument());
String flowtype = ci.nextArgument();
Integer flowcnt = Integer.parseInt(flowtype);
FlowBuilder tf2 = null;
FlowBuilder tf3 = null;
switch (flowcnt) {
- case 1:
- // add case 1
- tf = createTestFlow(tn, "f1", "10");
- tf1 = createTestFlow(tn, "f2", "11");
- tf2 = createTestFlow(tn, "f3", "12");
- tf3 = createTestFlow(tn, "f4", "13");
- break;
- case 2:
- // modify case 1
- tf = createTestFlow(tn, "f82", "10");
- tf1 = createTestFlow(tn, "f83", "11");
- tf2 = createTestFlow(tn, "f84", "12");
- tf3 = createTestFlow(tn, "f85", "13");
- break;
- case 3:
- // add case 2
- tf = createTestFlow(tn, "f3", "3");
- tf1 = createTestFlow(tn, "f4", "4");
- tf2 = createTestFlow(tn, "f5", "5");
- tf3 = createTestFlow(tn, "f6", "6");
- break;
- case 4:
- // modify case 2
- tf = createTestFlow(tn, "f700", "3");
- tf1 = createTestFlow(tn, "f4", "4");
- tf2 = createTestFlow(tn, "f900", "5");
- tf3 = createTestFlow(tn, "f86", "6");
- break;
- case 5:
- // add case 3
- tf = createTestFlow(tn, "f7", "7");
- tf1 = createTestFlow(tn, "f8", "8");
- tf2 = createTestFlow(tn, "f9", "9");
- tf3 = createTestFlow(tn, "f10", "10");
- break;
- case 6:
- // modify case 3
- tf = createTestFlow(tn, "f91", "7");
- tf1 = createTestFlow(tn, "f92", "8");
- tf2 = createTestFlow(tn, "f93", "9");
- tf3 = createTestFlow(tn, "f94", "10");
- break;
- case 7:
- // -ve scenario
- tf = createTestFlow(tn, "f23", "3");
- tf1 = createTestFlow(tn, "f34", "4");
- tf2 = createTestFlow(tn, "f35", "5");
- tf3 = createTestFlow(tn, "f36", "6");
- break;
- case 8:
- // +ve scenario
- // modify case 6 -ve
- tf = createTestFlow(tn, "f23", "3");
- tf1 = createTestFlow(tn, "f99", "4");
- tf2 = createTestFlow(tn, "f100", "5");
- tf3 = createTestFlow(tn, "f101", "6");
- break;
- case 9:
- // modify case 6
- tf = createTestFlow(tn, "f700", "7");
- tf1 = createTestFlow(tn, "f230", "23");
- tf2 = createTestFlow(tn, "f900", "9");
- tf3 = createTestFlow(tn, "f1000", "10");
- break;
+ case 1:
+ // add case 1
+ tf = createTestFlow(tn, "f1", "10");
+ tf1 = createTestFlow(tn, "f2", "11");
+ tf2 = createTestFlow(tn, "f3", "12");
+ tf3 = createTestFlow(tn, "f4", "13");
+ break;
+ case 2:
+ // modify case 1
+ tf = createTestFlow(tn, "f82", "10");
+ tf1 = createTestFlow(tn, "f83", "11");
+ tf2 = createTestFlow(tn, "f84", "12");
+ tf3 = createTestFlow(tn, "f85", "13");
+ break;
+ case 3:
+ // add case 2
+ tf = createTestFlow(tn, "f3", "3");
+ tf1 = createTestFlow(tn, "f4", "4");
+ tf2 = createTestFlow(tn, "f5", "5");
+ tf3 = createTestFlow(tn, "f6", "6");
+ break;
+ case 4:
+ // modify case 2
+ tf = createTestFlow(tn, "f700", "3");
+ tf1 = createTestFlow(tn, "f4", "4");
+ tf2 = createTestFlow(tn, "f900", "5");
+ tf3 = createTestFlow(tn, "f86", "6");
+ break;
+ case 5:
+ // add case 3
+ tf = createTestFlow(tn, "f7", "7");
+ tf1 = createTestFlow(tn, "f8", "8");
+ tf2 = createTestFlow(tn, "f9", "9");
+ tf3 = createTestFlow(tn, "f10", "10");
+ break;
+ case 6:
+ // modify case 3
+ tf = createTestFlow(tn, "f91", "7");
+ tf1 = createTestFlow(tn, "f92", "8");
+ tf2 = createTestFlow(tn, "f93", "9");
+ tf3 = createTestFlow(tn, "f94", "10");
+ break;
+ case 7:
+ // -ve scenario
+ tf = createTestFlow(tn, "f23", "3");
+ tf1 = createTestFlow(tn, "f34", "4");
+ tf2 = createTestFlow(tn, "f35", "5");
+ tf3 = createTestFlow(tn, "f36", "6");
+ break;
+ case 8:
+ // +ve scenario
+ // modify case 6 -ve
+ tf = createTestFlow(tn, "f23", "3");
+ tf1 = createTestFlow(tn, "f99", "4");
+ tf2 = createTestFlow(tn, "f100", "5");
+ tf3 = createTestFlow(tn, "f101", "6");
+ break;
+ case 9:
+ // modify case 6
+ tf = createTestFlow(tn, "f700", "7");
+ tf1 = createTestFlow(tn, "f230", "23");
+ tf2 = createTestFlow(tn, "f900", "9");
+ tf3 = createTestFlow(tn, "f1000", "10");
+ break;
}
InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class).child(Node.class, tn.getKey())
.augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf.getTableId()))
.child(Flow.class, tf.getKey()).build();
- modification.removeOperationalData(path1);
- modification.removeConfigurationData(nodeBuilderToInstanceId(tn));
- modification.removeConfigurationData(path1);
+ modification.delete(LogicalDatastoreType.OPERATIONAL, path1);
+ modification.delete(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(tn));
+ modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
InstanceIdentifier<Flow> path2 = InstanceIdentifier.builder(Nodes.class).child(Node.class, tn.getKey())
.augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf1.getTableId()))
.child(Flow.class, tf1.getKey()).build();
- modification.removeOperationalData(path2);
- modification.removeConfigurationData(nodeBuilderToInstanceId(tn));
- modification.removeConfigurationData(path2);
+ modification.delete(LogicalDatastoreType.OPERATIONAL, path2);
+ modification.delete(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(tn));
+ modification.delete(LogicalDatastoreType.CONFIGURATION, path2);
InstanceIdentifier<Flow> path3 = InstanceIdentifier.builder(Nodes.class).child(Node.class, tn.getKey())
.augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf2.getTableId()))
.child(Flow.class, tf2.getKey()).build();
- modification.removeOperationalData(path3);
- modification.removeConfigurationData(nodeBuilderToInstanceId(tn));
- modification.removeConfigurationData(path3);
+ modification.delete(LogicalDatastoreType.OPERATIONAL, path3);
+ modification.delete(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(tn));
+ modification.delete(LogicalDatastoreType.CONFIGURATION, path3);
InstanceIdentifier<Flow> path4 = InstanceIdentifier.builder(Nodes.class).child(Node.class, tn.getKey())
.augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf3.getTableId()))
.child(Flow.class, tf3.getKey()).build();
- modification.removeOperationalData(path4);
- modification.removeConfigurationData(nodeBuilderToInstanceId(tn));
- modification.removeConfigurationData(path4);
+ modification.delete(LogicalDatastoreType.OPERATIONAL, path4);
+ modification.delete(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(tn));
+ modification.delete(LogicalDatastoreType.CONFIGURATION, path4);
Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
try {
RpcResult<TransactionStatus> result = commitFuture.get();
}
private void writeFlow(CommandInterpreter ci, FlowBuilder flow, FlowBuilder flow1, FlowBuilder flow2,
- FlowBuilder flow3, NodeBuilder nodeBuilder) {
- DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
+ FlowBuilder flow3, NodeBuilder nodeBuilder) {
+ ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
.child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.getKey()).build();
- modification.putOperationalData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
- modification.putOperationalData(path1, flow.build());
- modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
- modification.putConfigurationData(path1, flow.build());
+ modification.put(LogicalDatastoreType.OPERATIONAL, nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
+ modification.put(LogicalDatastoreType.OPERATIONAL, path1, flow.build());
+ modification.put(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
+ modification.put(LogicalDatastoreType.CONFIGURATION, path1, flow.build());
InstanceIdentifier<Flow> path2 = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
.child(Table.class, new TableKey(flow1.getTableId())).child(Flow.class, flow1.getKey()).build();
- modification.putOperationalData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
- modification.putOperationalData(path2, flow1.build());
- modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
- modification.putConfigurationData(path2, flow1.build());
+ modification.put(LogicalDatastoreType.OPERATIONAL, nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
+ modification.put(LogicalDatastoreType.OPERATIONAL, path2, flow1.build());
+ modification.put(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
+ modification.put(LogicalDatastoreType.CONFIGURATION, path2, flow1.build());
InstanceIdentifier<Flow> path3 = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
.child(Table.class, new TableKey(flow2.getTableId())).child(Flow.class, flow2.getKey()).build();
- modification.putOperationalData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
- modification.putOperationalData(path3, flow2.build());
- modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
- modification.putConfigurationData(path3, flow2.build());
+ modification.put(LogicalDatastoreType.OPERATIONAL, nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
+ modification.put(LogicalDatastoreType.OPERATIONAL, path3, flow2.build());
+ modification.put(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
+ modification.put(LogicalDatastoreType.CONFIGURATION, path3, flow2.build());
InstanceIdentifier<Flow> path4 = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
.child(Table.class, new TableKey(flow3.getTableId())).child(Flow.class, flow3.getKey()).build();
- modification.putOperationalData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
- modification.putOperationalData(path4, flow3.build());
- modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
- modification.putConfigurationData(path4, flow3.build());
+ modification.put(LogicalDatastoreType.OPERATIONAL, nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
+ modification.put(LogicalDatastoreType.OPERATIONAL, path4, flow3.build());
+ modification.put(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
+ modification.put(LogicalDatastoreType.CONFIGURATION, path4, flow3.build());
Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
try {
RpcResult<TransactionStatus> result = commitFuture.get();
private static MatchBuilder createEthernetMatch() {
MatchBuilder match = new MatchBuilder();
- byte[] mask1 = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
- byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
+ byte[] mask1 = new byte[]{(byte) -1, (byte) -1, 0, 0, 0, 0};
+ byte[] mask2 = new byte[]{(byte) -1, (byte) -1, (byte) -1, 0, 0, 0};
EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
- // match
+ // match
EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
EtherType type = new EtherType(0x0800L);
ethmatch.setEthernetType(ethtype.setType(type).build());
EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet
- // macaddress
- // match
+ // macaddress
+ // match
MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
ethdest.setAddress(macdest);
// ethdest.setMask(mask1);
// ipv6label.setFlabelMask(new byte[] { 0, 1, -1, -1 });
Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
- // match
+ // match
icmpv6match.setIcmpv6Type((short) 135);
icmpv6match.setIcmpv6Code((short) 0);
match.setIcmpv6Match(icmpv6match.build());
match.setIpMatch(ipmatch.build());
Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
- // match
+ // match
icmpv6match.setIcmpv6Type((short) 135);
icmpv6match.setIcmpv6Code((short) 1);
match.setIcmpv6Match(icmpv6match.build());
*/
private static MatchBuilder createMetadataMatch() {
MatchBuilder match = new MatchBuilder();
- byte[] metamask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
+ byte[] metamask = new byte[]{(byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1};
MetadataBuilder metadata = new MetadataBuilder(); // metadata match
metadata.setMetadata(BigInteger.valueOf(500L));
// metadata.setMetadataMask(metamask);
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-
import org.eclipse.osgi.framework.console.CommandInterpreter;
import org.eclipse.osgi.framework.console.CommandProvider;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAllActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.HwPathActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.LoopbackActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopPbbActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlTypeActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNextHopActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanCfiActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SwPathActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.controller.action._case.ControllerActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.in._case.CopyTtlInBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.out._case.CopyTtlOutBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.mpls.ttl._case.DecMplsTtlBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.action._case.FloodActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.all.action._case.FloodAllActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.hw.path.action._case.HwPathActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.loopback.action._case.LoopbackActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.type.action._case.SetDlTypeActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.next.hop.action._case.SetNextHopActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.tos.action._case.SetNwTosActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.queue.action._case.SetQueueActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.cfi.action._case.SetVlanCfiActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.pcp.action._case.SetVlanPcpActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.sw.path.action._case.SwPathActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.OutputPortValues;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Groups;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.BucketsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketBuilder;
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.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
-import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.osgi.framework.BundleContext;
public class OpenflowpluginGroupTestCommandProvider implements CommandProvider {
- private DataBrokerService dataBrokerService;
+ private DataBroker dataBroker;
private ProviderContext pc;
private final BundleContext ctx;
private Group testGroup;
public void onSessionInitiated(ProviderContext session) {
pc = session;
- dataBrokerService = session.getSALService(DataBrokerService.class);
+ dataBroker = session.getSALService(DataBroker.class);
ctx.registerService(CommandProvider.class.getName(), this, null);
createTestNode();
}
return InstanceIdentifier.builder(Nodes.class).child(Node.class, node.getKey()).toInstance();
}
- private GroupBuilder createTestGroup(String actiontype,String type,String mod) {
+ private GroupBuilder createTestGroup(String actiontype, String type, String mod) {
// Sample data , committing to DataStore
-
- String GroupType = type;
- String ActionType = actiontype;
- String Groupmod = mod;
- DataModification modification = dataBrokerService.beginTransaction();
+
+ String GroupType = type;
+ String ActionType = actiontype;
+ String Groupmod = mod;
long id = 1;
GroupKey key = new GroupKey(new GroupId(id));
- GroupBuilder group = new GroupBuilder();
- BucketBuilder bucket = new BucketBuilder();
+ GroupBuilder group = new GroupBuilder();
+ BucketBuilder bucket = new BucketBuilder();
bucket.setBucketId(new BucketId((long) 12));
- bucket.setKey(new BucketKey(new BucketId((long) 12)));
-
+ bucket.setKey(new BucketKey(new BucketId((long) 12)));
+
if (GroupType == null) {
GroupType = "g1";
}
- if(ActionType==null){
- ActionType="a1";
+ if (ActionType == null) {
+ ActionType = "a1";
}
switch (GroupType) {
- case "g1":
- group.setGroupType(GroupTypes.GroupSelect);
- break;
- case "g2":
- group.setGroupType(GroupTypes.GroupAll);
- break;
- case "g3":
- group.setGroupType(GroupTypes.GroupIndirect);
- break;
- case "g4":
- group.setGroupType(GroupTypes.GroupFf);
- break;
+ case "g1":
+ group.setGroupType(GroupTypes.GroupSelect);
+ break;
+ case "g2":
+ group.setGroupType(GroupTypes.GroupAll);
+ break;
+ case "g3":
+ group.setGroupType(GroupTypes.GroupIndirect);
+ break;
+ case "g4":
+ group.setGroupType(GroupTypes.GroupFf);
+ break;
}
-
- switch (ActionType){
- case "a1":
- bucket.setAction(createPopVlanAction());
- break;
- case "a2":
- bucket.setAction(createPushVlanAction());
- break;
- case "a3":
- bucket.setAction(createPushMplsAction());
- break;
- case "a4":
- bucket.setAction(createPopMplsAction());
- break;
- case "a5":
- bucket.setAction(createPopPbbAction());
- break;
- case "a6":
- bucket.setAction(createPushPbbAction());
- break;
- case "a7":
- bucket.setAction(createPushPbbAction());
- break;
- case "a8":
- bucket.setAction(createCopyTtlInAction());
- break;
- case "a9":
- bucket.setAction(createCopyTtlOutAction());
- break;
- case "a10":
- bucket.setAction(createDecMplsTtlAction());
- break;
- case "a11":
- bucket.setAction(createDecNwTtlAction());
- break;
- case "a12":
- bucket.setAction(createSetQueueAction());
- break;
- case "a13":
- bucket.setAction(createSetNwTtlAction());
- break;
- case "a14":
- bucket.setAction(createGroupAction());
- break;
- case "a15":
- bucket.setAction(createSetMplsTtlAction());
- break;
- case "a16":
- bucket.setAction(createFloodOutputAction());
- break;
- case "a17":
- bucket.setAction(createAllOutputAction());
- break;
- case "a18":
- bucket.setAction(createNormalOutputAction());
- break;
- case "a19":
- bucket.setAction(creatTableOutputAction());
- break;
- case "a20":
- bucket.setAction(createControllerAction());
- break;
- case "a21":
- bucket.setAction(createLocalOutputAction());
- break;
- case "a22":
- bucket.setAction(createAnyOutputAction());
- break;
- case "a23":
- bucket.setAction(createInportOutputAction());
- break;
- case "a24" :
- bucket.setAction(null);
- break;
- case "a25" :
- bucket.setAction(createNonAppyOutputAction());
- break;
- case "a26" :
- bucket.setAction(createNonAppyPushMplsAction());
- break;
- case "a27" :
- bucket.setAction(createNonAppyPushPbbAction());
- break;
- case "a28" :
- bucket.setAction(createNonAppyPushVlanAction());
- break;
-
+
+ switch (ActionType) {
+ case "a1":
+ bucket.setAction(createPopVlanAction());
+ break;
+ case "a2":
+ bucket.setAction(createPushVlanAction());
+ break;
+ case "a3":
+ bucket.setAction(createPushMplsAction());
+ break;
+ case "a4":
+ bucket.setAction(createPopMplsAction());
+ break;
+ case "a5":
+ bucket.setAction(createPopPbbAction());
+ break;
+ case "a6":
+ bucket.setAction(createPushPbbAction());
+ break;
+ case "a7":
+ bucket.setAction(createPushPbbAction());
+ break;
+ case "a8":
+ bucket.setAction(createCopyTtlInAction());
+ break;
+ case "a9":
+ bucket.setAction(createCopyTtlOutAction());
+ break;
+ case "a10":
+ bucket.setAction(createDecMplsTtlAction());
+ break;
+ case "a11":
+ bucket.setAction(createDecNwTtlAction());
+ break;
+ case "a12":
+ bucket.setAction(createSetQueueAction());
+ break;
+ case "a13":
+ bucket.setAction(createSetNwTtlAction());
+ break;
+ case "a14":
+ bucket.setAction(createGroupAction());
+ break;
+ case "a15":
+ bucket.setAction(createSetMplsTtlAction());
+ break;
+ case "a16":
+ bucket.setAction(createFloodOutputAction());
+ break;
+ case "a17":
+ bucket.setAction(createAllOutputAction());
+ break;
+ case "a18":
+ bucket.setAction(createNormalOutputAction());
+ break;
+ case "a19":
+ bucket.setAction(creatTableOutputAction());
+ break;
+ case "a20":
+ bucket.setAction(createControllerAction());
+ break;
+ case "a21":
+ bucket.setAction(createLocalOutputAction());
+ break;
+ case "a22":
+ bucket.setAction(createAnyOutputAction());
+ break;
+ case "a23":
+ bucket.setAction(createInportOutputAction());
+ break;
+ case "a24":
+ bucket.setAction(null);
+ break;
+ case "a25":
+ bucket.setAction(createNonAppyOutputAction());
+ break;
+ case "a26":
+ bucket.setAction(createNonAppyPushMplsAction());
+ break;
+ case "a27":
+ bucket.setAction(createNonAppyPushPbbAction());
+ break;
+ case "a28":
+ bucket.setAction(createNonAppyPushVlanAction());
+ break;
+
}
-
- if(Groupmod=="add"){
- bucket.setWatchGroup((long) 14);
- bucket.setWatchPort((long) 1234);
- bucket.setWeight(50);
- }else {
- bucket.setWatchGroup((long) 13);
- bucket.setWatchPort((long) 134);
- bucket.setWeight(30);
+
+ if (Groupmod == "add") {
+ bucket.setWatchGroup((long) 14);
+ bucket.setWatchPort((long) 1234);
+ bucket.setWeight(50);
+ } else {
+ bucket.setWatchGroup((long) 13);
+ bucket.setWatchPort((long) 134);
+ bucket.setWeight(30);
}
group.setKey(key);
- // group.setInstall(false);
- group.setGroupId(new GroupId(id));
+ // group.setInstall(false);
+ group.setGroupId(new GroupId(id));
group.setGroupName(originalGroupName);
group.setBarrier(false);
BucketsBuilder value = new BucketsBuilder();
testGroup = group.build();
return group;
}
-
-
- private List<Action> createPopVlanAction(){
- PopVlanActionBuilder vlanAction = new PopVlanActionBuilder();
+
+ private List<Action> createPopVlanAction() {
+ PopVlanActionBuilder vlanAction = new PopVlanActionBuilder();
ActionBuilder action = new ActionBuilder();
action.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(vlanAction.build()).build());
action.setKey(new ActionKey(0));
List<Action> actions = new ArrayList<Action>();
actions.add(action.build());
- return actions;
+ return actions;
}
-
- private List<Action> createPushVlanAction(){
- PushVlanActionBuilder vlan = new PushVlanActionBuilder();
- vlan.setEthernetType(new Integer(0x8100));
+
+ private List<Action> createPushVlanAction() {
+ PushVlanActionBuilder vlan = new PushVlanActionBuilder();
+ vlan.setEthernetType(new Integer(0x8100));
ActionBuilder action = new ActionBuilder();
action.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
List<Action> actions = new ArrayList<Action>();
actions.add(action.build());
- return actions;
+ return actions;
}
- private List<Action> createPushMplsAction(){
- PushMplsActionBuilder push = new PushMplsActionBuilder();
- push.setEthernetType(new Integer(0x8847));
- ActionBuilder action = new ActionBuilder();
- action.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
+
+ private List<Action> createPushMplsAction() {
+ PushMplsActionBuilder push = new PushMplsActionBuilder();
+ push.setEthernetType(new Integer(0x8847));
+ ActionBuilder action = new ActionBuilder();
+ action.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
List<Action> actions = new ArrayList<Action>();
actions.add(action.build());
- return actions;
+ return actions;
}
- private List<Action> createPopMplsAction(){
- PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
- popMplsActionBuilder.setEthernetType(0XB);
- ActionBuilder action = new ActionBuilder();
- action.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
+
+ private List<Action> createPopMplsAction() {
+ PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
+ popMplsActionBuilder.setEthernetType(0XB);
+ ActionBuilder action = new ActionBuilder();
+ action.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
List<Action> actions = new ArrayList<Action>();
actions.add(action.build());
- return actions;
+ return actions;
}
-
- private List<Action> createPopPbbAction(){
- PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
- ActionBuilder action = new ActionBuilder();
- action.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
+
+ private List<Action> createPopPbbAction() {
+ PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
+ ActionBuilder action = new ActionBuilder();
+ action.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
List<Action> actions = new ArrayList<Action>();
actions.add(action.build());
- return actions;
+ return actions;
}
- private List<Action> createPushPbbAction(){
- PushPbbActionBuilder pbb = new PushPbbActionBuilder();
- pbb.setEthernetType(new Integer(0x88E7));
- ActionBuilder action = new ActionBuilder();
- action.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
+
+ private List<Action> createPushPbbAction() {
+ PushPbbActionBuilder pbb = new PushPbbActionBuilder();
+ pbb.setEthernetType(new Integer(0x88E7));
+ ActionBuilder action = new ActionBuilder();
+ action.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
List<Action> actions = new ArrayList<Action>();
actions.add(action.build());
- return actions;
+ return actions;
}
- private List<Action> createSetMplsTtlAction(){
- SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
+
+ private List<Action> createSetMplsTtlAction() {
+ SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
- ActionBuilder action = new ActionBuilder();
- action.setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(setMplsTtlActionBuilder.build()).build());
+ ActionBuilder action = new ActionBuilder();
+ action.setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(setMplsTtlActionBuilder.build()).build());
List<Action> actions = new ArrayList<Action>();
actions.add(action.build());
- return actions;
+ return actions;
}
- private List<Action> createSetNwTtlAction(){
- SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
+
+ private List<Action> createSetNwTtlAction() {
+ SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
setNwTtlActionBuilder.setNwTtl((short) 1);
- ActionBuilder action = new ActionBuilder();
- action.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
+ ActionBuilder action = new ActionBuilder();
+ action.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
List<Action> actions = new ArrayList<Action>();
actions.add(action.build());
- return actions;
+ return actions;
}
- private List<Action> createSetQueueAction(){
- SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
+
+ private List<Action> createSetQueueAction() {
+ SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
setQueueActionBuilder.setQueueId(1L);
- ActionBuilder action = new ActionBuilder();
- action.setAction(new SetQueueActionCaseBuilder().setSetQueueAction(setQueueActionBuilder.build()).build());
- action.setKey(new ActionKey(0));
+ ActionBuilder action = new ActionBuilder();
+ action.setAction(new SetQueueActionCaseBuilder().setSetQueueAction(setQueueActionBuilder.build()).build());
+ action.setKey(new ActionKey(0));
+ List<Action> actions = new ArrayList<Action>();
+ actions.add(action.build());
+ return actions;
+ }
+
+
+ private List<Action> createCopyTtlInAction() {
+ CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
+ ActionBuilder action = new ActionBuilder();
+ action.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
+ List<Action> actions = new ArrayList<Action>();
+ actions.add(action.build());
+ return actions;
+ }
+
+ private List<Action> createCopyTtlOutAction() {
+ CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
+ ActionBuilder action = new ActionBuilder();
+ action.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
+ List<Action> actions = new ArrayList<Action>();
+ actions.add(action.build());
+ return actions;
+ }
+
+ private List<Action> createDecMplsTtlAction() {
+ DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
+ ActionBuilder action = new ActionBuilder();
+ action.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
+ List<Action> actions = new ArrayList<Action>();
+ actions.add(action.build());
+ return actions;
+ }
+
+ private List<Action> createDecNwTtlAction() {
+ DecNwTtlBuilder nwttl = new DecNwTtlBuilder();
+ ActionBuilder action = new ActionBuilder();
+ action.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(nwttl.build()).build());
+ List<Action> actions = new ArrayList<Action>();
+
+ ActionBuilder ab = new ActionBuilder();
+ OutputActionBuilder output = new OutputActionBuilder();
+ // output.setMaxLength(30);
+ Uri value = new Uri("2");
+ output.setOutputNodeConnector(value);
+ ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
+ ab.setKey(new ActionKey(0));
+ ab.setOrder(0);
+ actions.add(ab.build());
+ actions.add(action.build());
+ return actions;
+ }
+
+ private List<Action> createFloodOutputAction() {
+
+ List<Action> actions = new ArrayList<Action>();
+ ActionBuilder ab = new ActionBuilder();
+ OutputActionBuilder output = new OutputActionBuilder();
+ output.setMaxLength(30);
+ Uri value = new Uri(OutputPortValues.FLOOD.toString());
+ output.setOutputNodeConnector(value);
+ ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
+ ab.setKey(new ActionKey(0));
+ actions.add(ab.build());
+ return actions;
+ }
+
+ private List<Action> createAllOutputAction() {
+
+ List<Action> actions = new ArrayList<Action>();
+ ActionBuilder ab = new ActionBuilder();
+ OutputActionBuilder output = new OutputActionBuilder();
+ output.setMaxLength(30);
+ Uri value = new Uri(OutputPortValues.ALL.toString());
+ output.setOutputNodeConnector(value);
+ ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
+ ab.setKey(new ActionKey(0));
+ actions.add(ab.build());
+ return actions;
+ }
+
+ private List<Action> createAnyOutputAction() {
+
+ List<Action> actions = new ArrayList<Action>();
+ ActionBuilder ab = new ActionBuilder();
+ OutputActionBuilder output = new OutputActionBuilder();
+ output.setMaxLength(30);
+ Uri value = new Uri(OutputPortValues.ANY.toString());
+ output.setOutputNodeConnector(value);
+ ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
+ ab.setKey(new ActionKey(0));
+ actions.add(ab.build());
+ return actions;
+ }
+
+ private List<Action> createNormalOutputAction() {
+
+ List<Action> actions = new ArrayList<Action>();
+ ActionBuilder ab = new ActionBuilder();
+ OutputActionBuilder output = new OutputActionBuilder();
+ output.setMaxLength(30);
+ Uri value = new Uri(OutputPortValues.NORMAL.toString());
+ output.setOutputNodeConnector(value);
+ ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
+ ab.setKey(new ActionKey(0));
+ actions.add(ab.build());
+ return actions;
+ }
+
+ private List<Action> createInportOutputAction() {
+
+ List<Action> actions = new ArrayList<Action>();
+ ActionBuilder ab = new ActionBuilder();
+ OutputActionBuilder output = new OutputActionBuilder();
+ output.setMaxLength(30);
+ Uri value = new Uri(OutputPortValues.INPORT.toString());
+ output.setOutputNodeConnector(value);
+ ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
+ ab.setKey(new ActionKey(0));
+ actions.add(ab.build());
+ return actions;
+ }
+
+ private List<Action> creatTableOutputAction() {
+
+ List<Action> actions = new ArrayList<Action>();
+ ActionBuilder ab = new ActionBuilder();
+ OutputActionBuilder output = new OutputActionBuilder();
+ output.setMaxLength(30);
+ Uri value = new Uri(OutputPortValues.TABLE.toString());
+ output.setOutputNodeConnector(value);
+ ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
+ ab.setKey(new ActionKey(0));
+ actions.add(ab.build());
+ return actions;
+ }
+
+ private List<Action> createControllerAction() {
+
+ List<Action> actions = new ArrayList<Action>();
+ ActionBuilder ab = new ActionBuilder();
+ OutputActionBuilder output = new OutputActionBuilder();
+ output.setMaxLength(30);
+ Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
+ output.setOutputNodeConnector(value);
+ ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
+ ab.setKey(new ActionKey(0));
+ actions.add(ab.build());
+ return actions;
+ }
+
+ private List<Action> createLocalOutputAction() {
+
+ List<Action> actions = new ArrayList<Action>();
+ ActionBuilder ab = new ActionBuilder();
+ OutputActionBuilder output = new OutputActionBuilder();
+ output.setMaxLength(30);
+ Uri value = new Uri(OutputPortValues.LOCAL.toString());
+ output.setOutputNodeConnector(value);
+ ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
+ ab.setKey(new ActionKey(0));
+ actions.add(ab.build());
+ return actions;
+ }
+
+ private List<Action> createGroupAction() {
+
+ GroupActionBuilder groupActionB = new GroupActionBuilder();
+ groupActionB.setGroupId(1L);
+ groupActionB.setGroup("0");
+ ActionBuilder action = new ActionBuilder();
+ action.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
+ action.setKey(new ActionKey(0));
List<Action> actions = new ArrayList<Action>();
actions.add(action.build());
- return actions;
- }
-
-
- private List<Action> createCopyTtlInAction(){
- CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
- ActionBuilder action = new ActionBuilder();
- action.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
- List<Action> actions = new ArrayList<Action>();
- actions.add(action.build());
- return actions;
- }
-
- private List<Action> createCopyTtlOutAction(){
- CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
- ActionBuilder action = new ActionBuilder();
- action.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
- List<Action> actions = new ArrayList<Action>();
- actions.add(action.build());
- return actions;
- }
-
- private List<Action> createDecMplsTtlAction(){
- DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
- ActionBuilder action = new ActionBuilder();
- action.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
- List<Action> actions = new ArrayList<Action>();
- actions.add(action.build());
- return actions;
- }
- private List<Action> createDecNwTtlAction(){
- DecNwTtlBuilder nwttl = new DecNwTtlBuilder();
- ActionBuilder action = new ActionBuilder();
- action.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(nwttl.build()).build());
- List<Action> actions = new ArrayList<Action>();
-
- ActionBuilder ab = new ActionBuilder();
- OutputActionBuilder output = new OutputActionBuilder();
- // output.setMaxLength(30);
- Uri value = new Uri("2");
- output.setOutputNodeConnector(value);
- ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
- ab.setKey(new ActionKey(0));
- ab.setOrder(0);
- actions.add(ab.build());
- actions.add(action.build());
- return actions;
- }
-
- private List<Action> createFloodOutputAction(){
-
- List<Action> actions = new ArrayList<Action>();
- ActionBuilder ab = new ActionBuilder();
- OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(30);
- Uri value = new Uri(OutputPortValues.FLOOD.toString());
- output.setOutputNodeConnector(value);
- ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
- ab.setKey(new ActionKey(0));
- actions.add(ab.build());
- return actions;
- }
-
- private List<Action> createAllOutputAction(){
-
- List<Action> actions = new ArrayList<Action>();
- ActionBuilder ab = new ActionBuilder();
- OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(30);
- Uri value = new Uri(OutputPortValues.ALL.toString());
- output.setOutputNodeConnector(value);
- ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
- ab.setKey(new ActionKey(0));
- actions.add(ab.build());
- return actions;
- }
-
- private List<Action> createAnyOutputAction(){
-
- List<Action> actions = new ArrayList<Action>();
- ActionBuilder ab = new ActionBuilder();
- OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(30);
- Uri value = new Uri(OutputPortValues.ANY.toString());
- output.setOutputNodeConnector(value);
- ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
- ab.setKey(new ActionKey(0));
- actions.add(ab.build());
- return actions;
- }
- private List<Action> createNormalOutputAction(){
-
- List<Action> actions = new ArrayList<Action>();
- ActionBuilder ab = new ActionBuilder();
- OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(30);
- Uri value = new Uri(OutputPortValues.NORMAL.toString());
- output.setOutputNodeConnector(value);
- ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
- ab.setKey(new ActionKey(0));
- actions.add(ab.build());
- return actions;
- }
- private List<Action> createInportOutputAction(){
-
- List<Action> actions = new ArrayList<Action>();
- ActionBuilder ab = new ActionBuilder();
- OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(30);
- Uri value = new Uri(OutputPortValues.INPORT.toString());
- output.setOutputNodeConnector(value);
- ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
- ab.setKey(new ActionKey(0));
- actions.add(ab.build());
- return actions;
- }
- private List<Action> creatTableOutputAction(){
-
- List<Action> actions = new ArrayList<Action>();
- ActionBuilder ab = new ActionBuilder();
- OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(30);
- Uri value = new Uri(OutputPortValues.TABLE.toString());
- output.setOutputNodeConnector(value);
- ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
- ab.setKey(new ActionKey(0));
- actions.add(ab.build());
- return actions;
- }
-
- private List<Action> createControllerAction(){
-
- List<Action> actions = new ArrayList<Action>();
- ActionBuilder ab = new ActionBuilder();
- OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(30);
- Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
- output.setOutputNodeConnector(value);
- ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
- ab.setKey(new ActionKey(0));
- actions.add(ab.build());
- return actions;
- }
-
- private List<Action> createLocalOutputAction(){
-
- List<Action> actions = new ArrayList<Action>();
- ActionBuilder ab = new ActionBuilder();
- OutputActionBuilder output = new OutputActionBuilder();
- output.setMaxLength(30);
- Uri value = new Uri(OutputPortValues.LOCAL.toString());
- output.setOutputNodeConnector(value);
- ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
- ab.setKey(new ActionKey(0));
- actions.add(ab.build());
- return actions;
- }
- private List<Action> createGroupAction(){
-
- GroupActionBuilder groupActionB = new GroupActionBuilder();
- groupActionB.setGroupId(1L);
- groupActionB.setGroup("0");
- ActionBuilder action = new ActionBuilder();
- action.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
- action.setKey(new ActionKey(0));
- List<Action> actions = new ArrayList<Action>();
- actions.add(action.build());
- return actions;
- }
-
- private static List<Action> createNonAppyOutputAction(){
+ return actions;
+ }
+
+ private static List<Action> createNonAppyOutputAction() {
List<Action> actionList = new ArrayList<Action>();
ActionBuilder ab = new ActionBuilder();
Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
output.setOutputNodeConnector(value);
//output.setMaxLength(null);
- output.setMaxLength(66000);
+ output.setMaxLength(66000);
ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
actionList.add(ab.build());
return actionList;
}
-
- private static List<Action> createNonAppyPushMplsAction(){
+
+ private static List<Action> createNonAppyPushMplsAction() {
List<Action> actionList = new ArrayList<Action>();
ActionBuilder ab = new ActionBuilder();
ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
actionList.add(ab.build());
return actionList;
-
+
}
- private static List<Action> createNonAppyPushPbbAction(){
+
+ private static List<Action> createNonAppyPushPbbAction() {
List<Action> actionList = new ArrayList<Action>();
ActionBuilder ab = new ActionBuilder();
PushPbbActionBuilder pbb = new PushPbbActionBuilder();
pbb.setEthernetType(new Integer(0x88E8));
ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
- actionList.add(ab.build());
+ actionList.add(ab.build());
return actionList;
-
+
}
-
- private static List<Action> createNonAppyPushVlanAction(){
+
+ private static List<Action> createNonAppyPushVlanAction() {
List<Action> actionList = new ArrayList<Action>();
ActionBuilder ab = new ActionBuilder();
ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
actionList.add(ab.build());
return actionList;
-
+
}
-
- private GroupBuilder createTestRemoveGroup(){
- // Sample data , committing to DataStore
- DataModification modification = dataBrokerService.beginTransaction();
+ private GroupBuilder createTestRemoveGroup() {
long id = 123;
GroupKey key = new GroupKey(new GroupId(id));
GroupBuilder group = new GroupBuilder();
bucket.setBucketId(new BucketId((long) 12));
bucket.setKey(new BucketKey(new BucketId((long) 12))); */
group.setKey(key);
- // group.setInstall(false);
+ // group.setInstall(false);
group.setGroupId(new GroupId(id));
/* PopVlanActionBuilder vlanAction = new PopVlanActionBuilder();
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());
+ // 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());
testGroup2 = group.build();
return group;
}
-
-
-
- public void _removeGroup(CommandInterpreter ci){
+
+
+ public void _removeGroup(CommandInterpreter ci) {
String nref = ci.nextArgument();
if (nref == null) {
ci.println("User node added" + nref);
createUserNode(nref);
}
- GroupBuilder gbuilder = createTestGroup(ci.nextArgument(),ci.nextArgument(),"add");
- DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
+ GroupBuilder gbuilder = createTestGroup(ci.nextArgument(), ci.nextArgument(), "add");
+ ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Group> path1 = InstanceIdentifier.builder(Nodes.class).child(Node.class, testNode.getKey())
.augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(gbuilder.getGroupId())).build();
- modification.removeConfigurationData(path1);
+ modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
try {
RpcResult<TransactionStatus> result = commitFuture.get();
ci.println("User node added" + nref);
createUserNode(nref);
}
- createTestGroup(ci.nextArgument(),ci.nextArgument(),"add");
+ createTestGroup(ci.nextArgument(), ci.nextArgument(), "add");
writeGroup(ci, testGroup);
}
private void writeGroup(CommandInterpreter ci, Group group) {
- DataModification modification = dataBrokerService.beginTransaction();
+ ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Group> path1 = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
.child(Group.class, new GroupKey(group.getGroupId()))
.build();
- modification.putConfigurationData(nodeToInstanceId(testNode), testNode);
- modification.putConfigurationData(path1, group);
+ modification.put(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode);
+ modification.put(LogicalDatastoreType.CONFIGURATION, path1, group);
Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
try {
RpcResult<TransactionStatus> result = commitFuture.get();
ci.println("User node added" + nref);
createUserNode(nref);
}
- GroupBuilder group = createTestGroup(ci.nextArgument(),ci.nextArgument(),"modify");
+ GroupBuilder group = createTestGroup(ci.nextArgument(), ci.nextArgument(), "modify");
writeGroup(ci, group.build());
-
- // group.setGroupName(originalGroupName);
- // writeGroup(ci, group.build());
+
+ // group.setGroupName(originalGroupName);
+ // writeGroup(ci, group.build());
}
@Override
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-
import org.eclipse.osgi.framework.console.CommandInterpreter;
import org.eclipse.osgi.framework.console.CommandProvider;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
-import org.opendaylight.controller.sal.binding.api.NotificationService;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
+import org.opendaylight.controller.sal.binding.api.NotificationService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupListener;
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.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.config.rev131024.Meters;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterAdded;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterRemoved;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterUpdated;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterListener;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.BandId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.BandType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterBandType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.DscpRemark;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.DscpRemarkBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.MeterBandHeadersBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeader;
public class OpenflowpluginMeterTestCommandProvider implements CommandProvider {
private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginMeterTestCommandProvider.class);
- private DataBrokerService dataBrokerService;
+ private DataBroker dataBroker;
private ProviderContext pc;
private final BundleContext ctx;
private Meter testMeter;
public void onSessionInitiated(ProviderContext session) {
pc = session;
- dataBrokerService = session.getSALService(DataBrokerService.class);
+ dataBroker = session.getSALService(DataBroker.class);
ctx.registerService(CommandProvider.class.getName(), this, null);
notificationService = session.getSALService(NotificationService.class);
// For switch events
private MeterBuilder createTestMeter() {
// Sample data , committing to DataStore
- DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
long id = 12;
MeterKey key = new MeterKey(new MeterId(id));
createUserNode(nref);
}
MeterBuilder mBuilder = createTestMeter();
- DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
+ ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Meter> path1 = InstanceIdentifier.builder(Nodes.class).child(Node.class, testNode.getKey())
.augmentation(FlowCapableNode.class).child(Meter.class, new MeterKey(testMeter.getMeterId())).build();
- modification.removeConfigurationData(path1);
+ modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
try {
RpcResult<TransactionStatus> result = commitFuture.get();
Integer count = Integer.parseInt(ci.nextArgument());
- DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
+ ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
switch (count) {
- case 1:
- MeterBuilder mBuilder = createTestMeters("1", "remove");
- InstanceIdentifier<Meter> path1 = InstanceIdentifier.builder(Nodes.class)
- .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
- .child(Meter.class, new MeterKey(testMeter1.getMeterId())).build();
- modification.removeConfigurationData(path1);
- MeterBuilder mBuilder1 = createTestMeters("2", "remove");
- InstanceIdentifier<Meter> path2 = InstanceIdentifier.builder(Nodes.class)
- .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
- .child(Meter.class, new MeterKey(testMeter2.getMeterId())).build();
- modification.removeConfigurationData(path2);
-
- break;
- case 2:
- MeterBuilder mBuilder2 = createTestMeters("3", "remove");
- InstanceIdentifier<Meter> path3 = InstanceIdentifier.builder(Nodes.class)
- .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
- .child(Meter.class, new MeterKey(testMeter1.getMeterId())).build();
- modification.removeConfigurationData(path3);
- MeterBuilder mBuilder22 = createTestMeters("4", "remove");
- InstanceIdentifier<Meter> path4 = InstanceIdentifier.builder(Nodes.class)
- .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
- .child(Meter.class, new MeterKey(testMeter2.getMeterId())).build();
- modification.removeConfigurationData(path4);
- break;
- case 3:
- MeterBuilder mBuilder3 = createTestMeters("5", "remove");
- InstanceIdentifier<Meter> path5 = InstanceIdentifier.builder(Nodes.class)
- .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
- .child(Meter.class, new MeterKey(testMeter1.getMeterId())).build();
- modification.removeConfigurationData(path5);
- MeterBuilder mBuilder4 = createTestMeters("6", "remove");
- InstanceIdentifier<Meter> path6 = InstanceIdentifier.builder(Nodes.class)
- .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
- .child(Meter.class, new MeterKey(testMeter2.getMeterId())).build();
- modification.removeConfigurationData(path6);
- break;
- case 4:
- MeterBuilder mBuilder5 = createTestMeters("7", "remove");
- InstanceIdentifier<Meter> path7 = InstanceIdentifier.builder(Nodes.class)
- .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
- .child(Meter.class, new MeterKey(testMeter1.getMeterId())).build();
- modification.removeConfigurationData(path7);
- MeterBuilder mBuilder6 = createTestMeters("8", "remove");
- InstanceIdentifier<Meter> path8 = InstanceIdentifier.builder(Nodes.class)
- .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
- .child(Meter.class, new MeterKey(testMeter2.getMeterId())).build();
- modification.removeConfigurationData(path8);
- break;
+ case 1:
+ MeterBuilder mBuilder = createTestMeters("1", "remove");
+ InstanceIdentifier<Meter> path1 = InstanceIdentifier.builder(Nodes.class)
+ .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
+ .child(Meter.class, new MeterKey(testMeter1.getMeterId())).build();
+ modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
+ MeterBuilder mBuilder1 = createTestMeters("2", "remove");
+ InstanceIdentifier<Meter> path2 = InstanceIdentifier.builder(Nodes.class)
+ .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
+ .child(Meter.class, new MeterKey(testMeter2.getMeterId())).build();
+ modification.delete(LogicalDatastoreType.CONFIGURATION, path2);
+
+ break;
+ case 2:
+ MeterBuilder mBuilder2 = createTestMeters("3", "remove");
+ InstanceIdentifier<Meter> path3 = InstanceIdentifier.builder(Nodes.class)
+ .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
+ .child(Meter.class, new MeterKey(testMeter1.getMeterId())).build();
+ modification.delete(LogicalDatastoreType.CONFIGURATION, path3);
+ MeterBuilder mBuilder22 = createTestMeters("4", "remove");
+ InstanceIdentifier<Meter> path4 = InstanceIdentifier.builder(Nodes.class)
+ .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
+ .child(Meter.class, new MeterKey(testMeter2.getMeterId())).build();
+ modification.delete(LogicalDatastoreType.CONFIGURATION, path4);
+ break;
+ case 3:
+ MeterBuilder mBuilder3 = createTestMeters("5", "remove");
+ InstanceIdentifier<Meter> path5 = InstanceIdentifier.builder(Nodes.class)
+ .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
+ .child(Meter.class, new MeterKey(testMeter1.getMeterId())).build();
+ modification.delete(LogicalDatastoreType.CONFIGURATION, path5);
+ MeterBuilder mBuilder4 = createTestMeters("6", "remove");
+ InstanceIdentifier<Meter> path6 = InstanceIdentifier.builder(Nodes.class)
+ .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
+ .child(Meter.class, new MeterKey(testMeter2.getMeterId())).build();
+ modification.delete(LogicalDatastoreType.CONFIGURATION, path6);
+ break;
+ case 4:
+ MeterBuilder mBuilder5 = createTestMeters("7", "remove");
+ InstanceIdentifier<Meter> path7 = InstanceIdentifier.builder(Nodes.class)
+ .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
+ .child(Meter.class, new MeterKey(testMeter1.getMeterId())).build();
+ modification.delete(LogicalDatastoreType.CONFIGURATION, path7);
+ MeterBuilder mBuilder6 = createTestMeters("8", "remove");
+ InstanceIdentifier<Meter> path8 = InstanceIdentifier.builder(Nodes.class)
+ .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
+ .child(Meter.class, new MeterKey(testMeter2.getMeterId())).build();
+ modification.delete(LogicalDatastoreType.CONFIGURATION, path8);
+ break;
}
}
Integer count = Integer.parseInt(ci.nextArgument());
switch (count) {
- case 1:
- createTestMeters("1", "add");
- createTestMeters("2", "add");
- writeMeter(ci, testMeter1, testMeter2);
- break;
- case 2:
- createTestMeters("3", "add");
- createTestMeters("4", "add");
- writeMeter(ci, testMeter1, testMeter2);
- break;
- case 3:
- createTestMeters("5", "add");
- createTestMeters("6", "add");
- writeMeter(ci, testMeter1, testMeter2);
- break;
- case 4:
- createTestMeters("7", "add");
- createTestMeters("8", "add");
- writeMeter(ci, testMeter1, testMeter2);
- break;
+ case 1:
+ createTestMeters("1", "add");
+ createTestMeters("2", "add");
+ writeMeter(ci, testMeter1, testMeter2);
+ break;
+ case 2:
+ createTestMeters("3", "add");
+ createTestMeters("4", "add");
+ writeMeter(ci, testMeter1, testMeter2);
+ break;
+ case 3:
+ createTestMeters("5", "add");
+ createTestMeters("6", "add");
+ writeMeter(ci, testMeter1, testMeter2);
+ break;
+ case 4:
+ createTestMeters("7", "add");
+ createTestMeters("8", "add");
+ writeMeter(ci, testMeter1, testMeter2);
+ break;
}
// createTestMeters();
}
private void writeMeter(CommandInterpreter ci, Meter meter) {
- DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
+ ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Meter> path1 = InstanceIdentifier.builder(Nodes.class).child(Node.class, testNode.getKey())
.augmentation(FlowCapableNode.class).child(Meter.class, new MeterKey(meter.getMeterId())).build();
- DataObject cls = modification.readConfigurationData(path1);
- modification.putConfigurationData(nodeToInstanceId(testNode), testNode);
- modification.putConfigurationData(path1, meter);
+ DataObject cls = (DataObject) modification.read(LogicalDatastoreType.CONFIGURATION, path1);
+ modification.put(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode);
+ modification.put(LogicalDatastoreType.CONFIGURATION, path1, meter);
Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
try {
RpcResult<TransactionStatus> result = commitFuture.get();
}
private void writeMeter(CommandInterpreter ci, Meter meter, Meter meter1) {
- DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
+ ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Meter> path1 = InstanceIdentifier.builder(Nodes.class).child(Node.class, testNode.getKey())
.augmentation(FlowCapableNode.class).child(Meter.class, new MeterKey(meter.getMeterId())).build();
- DataObject cls = modification.readConfigurationData(path1);
- modification.putConfigurationData(nodeToInstanceId(testNode), testNode);
- modification.putConfigurationData(path1, meter);
+ DataObject cls = (DataObject) modification.read(LogicalDatastoreType.CONFIGURATION, path1);
+ modification.put(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode);
+ modification.put(LogicalDatastoreType.CONFIGURATION, path1, meter);
InstanceIdentifier<Meter> path2 = InstanceIdentifier.builder(Nodes.class).child(Node.class, testNode.getKey())
.augmentation(FlowCapableNode.class).child(Meter.class, new MeterKey(meter1.getMeterId())).build();
- DataObject cls1 = modification.readConfigurationData(path2);
- modification.putConfigurationData(nodeToInstanceId(testNode), testNode);
- modification.putConfigurationData(path2, meter1);
+ DataObject cls1 = (DataObject) modification.read(LogicalDatastoreType.CONFIGURATION, path2);
+ modification.put(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode);
+ modification.put(LogicalDatastoreType.CONFIGURATION, path2, meter1);
Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
try {
Integer count = Integer.parseInt(ci.nextArgument());
switch (count) {
- case 1:
- createTestMeters("1", "modify");
- createTestMeters("2", "modify");
- writeMeter(ci, testMeter1, testMeter2);
- break;
- case 2:
- createTestMeters("3", "modify");
- createTestMeters("4", "modify");
- writeMeter(ci, testMeter1, testMeter2);
- break;
+ case 1:
+ createTestMeters("1", "modify");
+ createTestMeters("2", "modify");
+ writeMeter(ci, testMeter1, testMeter2);
+ break;
+ case 2:
+ createTestMeters("3", "modify");
+ createTestMeters("4", "modify");
+ writeMeter(ci, testMeter1, testMeter2);
+ break;
}
}
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration
import org.opendaylight.controller.sal.binding.api.NotificationProviderService
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.controller.md.sal.binding.api.DataBroker
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes
static val LOG = LoggerFactory.getLogger(OpenflowpluginMeterTestServiceProvider);
@Property
- DataProviderService dataService;
+ DataBroker dataService;
@Property
RoutedRpcRegistration<SalMeterService> meterRegistration;
import java.util.Iterator;
import java.util.List;
-
import org.eclipse.osgi.framework.console.CommandInterpreter;
import org.eclipse.osgi.framework.console.CommandProvider;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.AggregateFlowStatisticsData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowStatisticsData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupDescStats;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupStatistics;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatistics;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
- private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginStatsTestCommandProvider.class);
- private DataProviderService dataProviderService;
+ private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginStatsTestCommandProvider.class);
+ private DataBroker dataProviderService;
private final BundleContext ctx;
public OpenflowpluginStatsTestCommandProvider(BundleContext ctx) {
this.ctx = ctx;
}
-
+
public void onSessionInitiated(ProviderContext session) {
- dataProviderService = session.getSALService(DataProviderService.class);
+ dataProviderService = session.getSALService(DataBroker.class);
ctx.registerService(CommandProvider.class.getName(), this, null);
-
+
}
public void _portStats(CommandInterpreter ci) {
int nodeConnectorCount = 0;
int nodeConnectorStatsCount = 0;
- List<Node> nodes = getNodes();
- for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext();) {
- NodeKey nodeKey = iterator.next().getKey();
- InstanceIdentifier<Node> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).toInstance();
- Node node = (Node)dataProviderService.readOperationalData(nodeRef);
- List<NodeConnector> ports = node.getNodeConnector();
- for (Iterator<NodeConnector> iterator2 = ports.iterator(); iterator2.hasNext();) {
- nodeConnectorCount++;
- NodeConnectorKey nodeConnectorKey = iterator2.next().getKey();
- InstanceIdentifier<NodeConnector> connectorRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).child(NodeConnector.class, nodeConnectorKey).toInstance();
- NodeConnector nodeConnector = (NodeConnector)dataProviderService.readOperationalData(connectorRef);
- FlowCapableNodeConnectorStatisticsData data = nodeConnector.getAugmentation(FlowCapableNodeConnectorStatisticsData.class);
- if(null != data)
- {
- nodeConnectorStatsCount++;
- }
+ List<Node> nodes = getNodes();
+ for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext(); ) {
+ NodeKey nodeKey = iterator.next().getKey();
+ InstanceIdentifier<Node> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).toInstance();
+
+ ReadOnlyTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
+ Node node = (Node) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, nodeRef);
+
+ List<NodeConnector> ports = node.getNodeConnector();
+ for (Iterator<NodeConnector> iterator2 = ports.iterator(); iterator2.hasNext(); ) {
+ nodeConnectorCount++;
+ NodeConnectorKey nodeConnectorKey = iterator2.next().getKey();
+ InstanceIdentifier<NodeConnector> connectorRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).child(NodeConnector.class, nodeConnectorKey).toInstance();
+ NodeConnector nodeConnector = (NodeConnector) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, connectorRef);
+ FlowCapableNodeConnectorStatisticsData data = nodeConnector.getAugmentation(FlowCapableNodeConnectorStatisticsData.class);
+ if (null != data) {
+ nodeConnectorStatsCount++;
}
}
-
- if(nodeConnectorCount == nodeConnectorStatsCount)
- {
- LOG.debug("portStats - Success");
- }
- else
- {
- LOG.debug("portStats - Failed");
- LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
- }
-
- }
+ }
+
+ if (nodeConnectorCount == nodeConnectorStatsCount) {
+ LOG.debug("portStats - Success");
+ } else {
+ LOG.debug("portStats - Failed");
+ LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
+ }
+
+ }
+
-
public void _portDescStats(CommandInterpreter ci) {
int nodeConnectorCount = 0;
int nodeConnectorDescStatsCount = 0;
- List<Node> nodes = getNodes();
- for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext();) {
- NodeKey nodeKey = iterator.next().getKey();
- InstanceIdentifier<Node> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).toInstance();
- Node node = (Node)dataProviderService.readOperationalData(nodeRef);
-
- List<NodeConnector> ports = node.getNodeConnector();
- for (Iterator<NodeConnector> iterator2 = ports.iterator(); iterator2.hasNext();) {
- nodeConnectorCount++;
- NodeConnectorKey nodeConnectorKey = iterator2.next().getKey();
- InstanceIdentifier<FlowCapableNodeConnector> connectorRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).child(NodeConnector.class, nodeConnectorKey).augmentation(FlowCapableNodeConnector.class).toInstance();
- FlowCapableNodeConnector nodeConnector = (FlowCapableNodeConnector)dataProviderService.readOperationalData(connectorRef);
- if(null != nodeConnector.getName() &&
- null != nodeConnector.getCurrentFeature() &&
- null != nodeConnector.getState() &&
- null != nodeConnector.getHardwareAddress() &&
- null != nodeConnector.getPortNumber())
- {
- nodeConnectorDescStatsCount++;
- }
+ List<Node> nodes = getNodes();
+ for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext(); ) {
+ NodeKey nodeKey = iterator.next().getKey();
+ InstanceIdentifier<Node> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).toInstance();
+
+ ReadOnlyTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
+ Node node = (Node) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, nodeRef);
+
+ List<NodeConnector> ports = node.getNodeConnector();
+ for (Iterator<NodeConnector> iterator2 = ports.iterator(); iterator2.hasNext(); ) {
+ nodeConnectorCount++;
+ NodeConnectorKey nodeConnectorKey = iterator2.next().getKey();
+ InstanceIdentifier<FlowCapableNodeConnector> connectorRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).child(NodeConnector.class, nodeConnectorKey).augmentation(FlowCapableNodeConnector.class).toInstance();
+ FlowCapableNodeConnector nodeConnector = (FlowCapableNodeConnector) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, connectorRef);
+ if (null != nodeConnector.getName() &&
+ null != nodeConnector.getCurrentFeature() &&
+ null != nodeConnector.getState() &&
+ null != nodeConnector.getHardwareAddress() &&
+ null != nodeConnector.getPortNumber()) {
+ nodeConnectorDescStatsCount++;
}
}
-
- if(nodeConnectorCount == nodeConnectorDescStatsCount)
- {
- LOG.debug("portDescStats - Success");
- }
- else
- {
- LOG.debug("portDescStats - Failed");
- LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
- }
-
- }
+ }
+
+ if (nodeConnectorCount == nodeConnectorDescStatsCount) {
+ LOG.debug("portDescStats - Success");
+ } else {
+ LOG.debug("portDescStats - Failed");
+ LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
+ }
+
+ }
public void _flowStats(CommandInterpreter ci) {
int flowCount = 0;
int flowStatsCount = 0;
- List<Node> nodes = getNodes();
- for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext();) {
- NodeKey nodeKey = iterator.next().getKey();
- InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).toInstance();
- FlowCapableNode node = (FlowCapableNode)dataProviderService.readOperationalData(nodeRef);
- List<Table> tables = node.getTable();
- for (Iterator<Table> iterator2 = tables.iterator(); iterator2.hasNext();) {
- TableKey tableKey = iterator2.next().getKey();
- InstanceIdentifier<Table> tableRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Table.class, tableKey).toInstance();
- Table table = (Table)dataProviderService.readOperationalData(tableRef);
- List<Flow> flows = table.getFlow();
- for (Iterator<Flow> iterator3 = flows.iterator(); iterator3.hasNext();) {
- flowCount++;
- FlowKey flowKey = iterator3.next().getKey();
- InstanceIdentifier<Flow> flowRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Table.class, tableKey).child(Flow.class, flowKey).toInstance();
- Flow flow = (Flow)dataProviderService.readOperationalData(flowRef);
- FlowStatisticsData data = flow.getAugmentation(FlowStatisticsData.class);
- if(null != data)
- {
- flowStatsCount++;
- LOG.debug("--------------------------------------------");
- ci.print(data);
- }
- }
+ List<Node> nodes = getNodes();
+ for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext(); ) {
+ NodeKey nodeKey = iterator.next().getKey();
+ InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).toInstance();
+
+ ReadOnlyTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
+ FlowCapableNode node = (FlowCapableNode) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, nodeRef);
+
+ List<Table> tables = node.getTable();
+ for (Iterator<Table> iterator2 = tables.iterator(); iterator2.hasNext(); ) {
+ TableKey tableKey = iterator2.next().getKey();
+ InstanceIdentifier<Table> tableRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Table.class, tableKey).toInstance();
+ Table table = (Table) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, tableRef);
+ List<Flow> flows = table.getFlow();
+ for (Iterator<Flow> iterator3 = flows.iterator(); iterator3.hasNext(); ) {
+ flowCount++;
+ FlowKey flowKey = iterator3.next().getKey();
+ InstanceIdentifier<Flow> flowRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Table.class, tableKey).child(Flow.class, flowKey).toInstance();
+ Flow flow = (Flow) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, flowRef);
+ FlowStatisticsData data = flow.getAugmentation(FlowStatisticsData.class);
+ if (null != data) {
+ flowStatsCount++;
+ LOG.debug("--------------------------------------------");
+ ci.print(data);
+ }
}
}
-
- if(flowCount == flowStatsCount)
- {
- LOG.debug("flowStats - Success");
- }
- else
- {
- LOG.debug("flowStats - Failed");
- LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
- }
-
- }
+ }
+
+ if (flowCount == flowStatsCount) {
+ LOG.debug("flowStats - Success");
+ } else {
+ LOG.debug("flowStats - Failed");
+ LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
+ }
+
+ }
-
-
public void _tableStats(CommandInterpreter ci) {
int tableCount = 0;
int tableStatsCount = 0;
- List<Node> nodes = getNodes();
- for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext();) {
- NodeKey nodeKey = iterator.next().getKey();
- InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).toInstance();
- FlowCapableNode node = (FlowCapableNode)dataProviderService.readOperationalData(nodeRef);
-
- List<Table> tables = node.getTable();
- for (Iterator<Table> iterator2 = tables.iterator(); iterator2.hasNext();) {
- tableCount++;
- TableKey tableKey = iterator2.next().getKey();
- InstanceIdentifier<Table> tableRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Table.class, tableKey).toInstance();
- Table table = (Table)dataProviderService.readOperationalData(tableRef);
- FlowTableStatisticsData data = table.getAugmentation(FlowTableStatisticsData.class);
- if(null != data)
- {
- tableStatsCount++;
- }
+ List<Node> nodes = getNodes();
+ for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext(); ) {
+ NodeKey nodeKey = iterator.next().getKey();
+ InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).toInstance();
+
+ ReadOnlyTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
+ FlowCapableNode node = (FlowCapableNode) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, nodeRef);
+
+ List<Table> tables = node.getTable();
+ for (Iterator<Table> iterator2 = tables.iterator(); iterator2.hasNext(); ) {
+ tableCount++;
+ TableKey tableKey = iterator2.next().getKey();
+ InstanceIdentifier<Table> tableRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Table.class, tableKey).toInstance();
+ Table table = (Table) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, tableRef);
+ FlowTableStatisticsData data = table.getAugmentation(FlowTableStatisticsData.class);
+ if (null != data) {
+ tableStatsCount++;
}
}
-
- if(tableCount == tableStatsCount)
- {
- LOG.debug("tableStats - Success");
- }
- else
- {
- LOG.debug("tableStats - Failed");
- LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
- }
-
- }
+ }
+
+ if (tableCount == tableStatsCount) {
+ LOG.debug("tableStats - Success");
+ } else {
+ LOG.debug("tableStats - Failed");
+ LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
+ }
+
+ }
public void _groupStats(CommandInterpreter ci) {
int groupCount = 0;
int groupStatsCount = 0;
NodeGroupStatistics data = null;
- List<Node> nodes = getNodes();
- for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext();) {
- NodeKey nodeKey = iterator.next().getKey();
- InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).toInstance();
- FlowCapableNode node = (FlowCapableNode)dataProviderService.readOperationalData(nodeRef);
-
- List<Group> groups = node.getGroup();
- for (Iterator<Group> iterator2 = groups.iterator(); iterator2.hasNext();) {
- groupCount++;
- GroupKey groupKey = iterator2.next().getKey();
- InstanceIdentifier<Group> groupRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Group.class, groupKey).toInstance();
- Group group = (Group)dataProviderService.readOperationalData(groupRef);
- data = group.getAugmentation(NodeGroupStatistics.class);
- if(null != data)
- {
- groupStatsCount++;
- }
+ List<Node> nodes = getNodes();
+ for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext(); ) {
+ NodeKey nodeKey = iterator.next().getKey();
+ InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).toInstance();
+ ReadOnlyTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
+ FlowCapableNode node = (FlowCapableNode) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, nodeRef);
+
+ List<Group> groups = node.getGroup();
+ for (Iterator<Group> iterator2 = groups.iterator(); iterator2.hasNext(); ) {
+ groupCount++;
+ GroupKey groupKey = iterator2.next().getKey();
+ InstanceIdentifier<Group> groupRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Group.class, groupKey).toInstance();
+ Group group = (Group) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, groupRef);
+ data = group.getAugmentation(NodeGroupStatistics.class);
+ if (null != data) {
+ groupStatsCount++;
}
}
-
- if(groupCount == groupStatsCount)
- {
- LOG.debug("---------------------groupStats - Success-------------------------------");
- }
- else
- {
- LOG.debug("------------------------------groupStats - Failed--------------------------");
- LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
- }
- }
-
+ }
+
+ if (groupCount == groupStatsCount) {
+ LOG.debug("---------------------groupStats - Success-------------------------------");
+ } else {
+ LOG.debug("------------------------------groupStats - Failed--------------------------");
+ LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
+ }
+ }
+
public void _groupDescStats(CommandInterpreter ci) {
int groupCount = 0;
int groupDescStatsCount = 0;
NodeGroupDescStats data = null;
- List<Node> nodes = getNodes();
- for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext();) {
- NodeKey nodeKey = iterator.next().getKey();
- InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).toInstance();
- FlowCapableNode node = (FlowCapableNode)dataProviderService.readOperationalData(nodeRef);
-
- List<Group> groups = node.getGroup();
- for (Iterator<Group> iterator2 = groups.iterator(); iterator2.hasNext();) {
- groupCount++;
- GroupKey groupKey = iterator2.next().getKey();
- InstanceIdentifier<Group> groupRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Group.class, groupKey).toInstance();
- Group group = (Group)dataProviderService.readOperationalData(groupRef);
- data = group.getAugmentation(NodeGroupDescStats.class);
- if(null != data)
- {
- groupDescStatsCount++;
- }
+ List<Node> nodes = getNodes();
+ for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext(); ) {
+ NodeKey nodeKey = iterator.next().getKey();
+ InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).toInstance();
+ ReadOnlyTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
+ FlowCapableNode node = (FlowCapableNode) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, nodeRef);
+
+ List<Group> groups = node.getGroup();
+ for (Iterator<Group> iterator2 = groups.iterator(); iterator2.hasNext(); ) {
+ groupCount++;
+ GroupKey groupKey = iterator2.next().getKey();
+ InstanceIdentifier<Group> groupRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Group.class, groupKey).toInstance();
+ Group group = (Group) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, groupRef);
+ data = group.getAugmentation(NodeGroupDescStats.class);
+ if (null != data) {
+ groupDescStatsCount++;
}
}
-
- if(groupCount == groupDescStatsCount)
- {
- LOG.debug("---------------------groupDescStats - Success-------------------------------");
- }
- else
- {
- LOG.debug("------------------------------groupDescStats - Failed--------------------------");
- LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
- }
- }
-
+ }
+
+ if (groupCount == groupDescStatsCount) {
+ LOG.debug("---------------------groupDescStats - Success-------------------------------");
+ } else {
+ LOG.debug("------------------------------groupDescStats - Failed--------------------------");
+ LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
+ }
+ }
+
public void _meterStats(CommandInterpreter ci) {
int meterCount = 0;
int meterStatsCount = 0;
NodeMeterStatistics data = null;
- List<Node> nodes = getNodes();
- for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext();) {
- NodeKey nodeKey = iterator.next().getKey();
- InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).toInstance();
- FlowCapableNode node = (FlowCapableNode)dataProviderService.readOperationalData(nodeRef);
-
- List<Meter> meters = node.getMeter();
- for (Iterator<Meter> iterator2 = meters.iterator(); iterator2.hasNext();) {
- meterCount++;
- MeterKey meterKey = iterator2.next().getKey();
- InstanceIdentifier<Meter> meterRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Meter.class, meterKey).toInstance();
- Meter meter = (Meter)dataProviderService.readOperationalData(meterRef);
- data = meter.getAugmentation(NodeMeterStatistics.class);
- if(null != data)
- {
- meterStatsCount++;
- }
+ List<Node> nodes = getNodes();
+ for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext(); ) {
+ NodeKey nodeKey = iterator.next().getKey();
+ InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).toInstance();
+ ReadOnlyTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
+ FlowCapableNode node = (FlowCapableNode) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, nodeRef);
+
+ List<Meter> meters = node.getMeter();
+ for (Iterator<Meter> iterator2 = meters.iterator(); iterator2.hasNext(); ) {
+ meterCount++;
+ MeterKey meterKey = iterator2.next().getKey();
+ InstanceIdentifier<Meter> meterRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Meter.class, meterKey).toInstance();
+ Meter meter = (Meter) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, meterRef);
+ data = meter.getAugmentation(NodeMeterStatistics.class);
+ if (null != data) {
+ meterStatsCount++;
}
}
-
- if(meterCount == meterStatsCount)
- {
- LOG.debug("---------------------------meterStats - Success-------------------------------------");
- }
- else
- {
- LOG.debug("----------------------------meterStats - Failed-------------------------------------");
- LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
- }
- }
-
+ }
+
+ if (meterCount == meterStatsCount) {
+ LOG.debug("---------------------------meterStats - Success-------------------------------------");
+ } else {
+ LOG.debug("----------------------------meterStats - Failed-------------------------------------");
+ LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
+ }
+ }
+
public void _meterConfigStats(CommandInterpreter ci) {
int meterCount = 0;
int meterConfigStatsCount = 0;
NodeMeterConfigStats data = null;
- List<Node> nodes = getNodes();
- for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext();) {
- NodeKey nodeKey = iterator.next().getKey();
- InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).toInstance();
- FlowCapableNode node = (FlowCapableNode)dataProviderService.readOperationalData(nodeRef);
-
- List<Meter> meters = node.getMeter();
- for (Iterator<Meter> iterator2 = meters.iterator(); iterator2.hasNext();) {
- meterCount++;
- MeterKey meterKey = iterator2.next().getKey();
- InstanceIdentifier<Meter> meterRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Meter.class, meterKey).toInstance();
- Meter meter = (Meter)dataProviderService.readOperationalData(meterRef);
- data = meter.getAugmentation(NodeMeterConfigStats.class);
- if(null != data)
- {
- meterConfigStatsCount++;
- }
+ List<Node> nodes = getNodes();
+ for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext(); ) {
+ NodeKey nodeKey = iterator.next().getKey();
+ InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).toInstance();
+ ReadOnlyTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
+ FlowCapableNode node = (FlowCapableNode) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, nodeRef);
+
+ List<Meter> meters = node.getMeter();
+ for (Iterator<Meter> iterator2 = meters.iterator(); iterator2.hasNext(); ) {
+ meterCount++;
+ MeterKey meterKey = iterator2.next().getKey();
+ InstanceIdentifier<Meter> meterRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Meter.class, meterKey).toInstance();
+ Meter meter = (Meter) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, meterRef);
+ data = meter.getAugmentation(NodeMeterConfigStats.class);
+ if (null != data) {
+ meterConfigStatsCount++;
}
}
-
- if(meterCount == meterConfigStatsCount)
- {
- LOG.debug("---------------------------meterConfigStats - Success-------------------------------------");
- ci.print(data);
- }
- else
- {
- LOG.debug("----------------------------meterConfigStats - Failed-------------------------------------");
- LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
- }
- }
-
-
+ }
+
+ if (meterCount == meterConfigStatsCount) {
+ LOG.debug("---------------------------meterConfigStats - Success-------------------------------------");
+ ci.print(data);
+ } else {
+ LOG.debug("----------------------------meterConfigStats - Failed-------------------------------------");
+ LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
+ }
+ }
+
+
public void _aggregateStats(CommandInterpreter ci) {
int aggregateFlowCount = 0;
int aggerateFlowStatsCount = 0;
- List<Node> nodes = getNodes();
- for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext();) {
- NodeKey nodeKey = iterator.next().getKey();
- InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).toInstance();
- FlowCapableNode node = (FlowCapableNode)dataProviderService.readOperationalData(nodeRef);
-
- List<Table> tables = node.getTable();
- for (Iterator<Table> iterator2 = tables.iterator(); iterator2.hasNext();) {
- aggregateFlowCount++;
- TableKey tableKey = iterator2.next().getKey();
- InstanceIdentifier<Table> tableRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Table.class, tableKey).toInstance();
- Table table = (Table)dataProviderService.readOperationalData(tableRef);
- AggregateFlowStatisticsData data = table.getAugmentation(AggregateFlowStatisticsData.class);
- if(null != data)
- {
- aggerateFlowStatsCount++;
- }
+ List<Node> nodes = getNodes();
+ for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext(); ) {
+ NodeKey nodeKey = iterator.next().getKey();
+ InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).toInstance();
+ ReadOnlyTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
+ FlowCapableNode node = (FlowCapableNode) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, nodeRef);
+
+ List<Table> tables = node.getTable();
+ for (Iterator<Table> iterator2 = tables.iterator(); iterator2.hasNext(); ) {
+ aggregateFlowCount++;
+ TableKey tableKey = iterator2.next().getKey();
+ InstanceIdentifier<Table> tableRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Table.class, tableKey).toInstance();
+ Table table = (Table) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, tableRef);
+ AggregateFlowStatisticsData data = table.getAugmentation(AggregateFlowStatisticsData.class);
+ if (null != data) {
+ aggerateFlowStatsCount++;
}
}
-
- if(aggregateFlowCount == aggerateFlowStatsCount)
- {
- LOG.debug("aggregateStats - Success");
- }
- else
- {
- LOG.debug("aggregateStats - Failed");
- LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
- }
-
- }
+ }
+
+ if (aggregateFlowCount == aggerateFlowStatsCount) {
+ LOG.debug("aggregateStats - Success");
+ } else {
+ LOG.debug("aggregateStats - Failed");
+ LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
+ }
+
+ }
public void _descStats(CommandInterpreter ci) {
int descCount = 0;
int descStatsCount = 0;
- List<Node> nodes = getNodes();
- for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext();) {
- descCount++;
- NodeKey nodeKey = iterator.next().getKey();
- InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).toInstance();
- FlowCapableNode node = (FlowCapableNode)dataProviderService.readOperationalData(nodeRef);
- if(null != node.getHardware() &&
- null != node.getManufacturer() &&
- null != node.getSoftware())
- {
- descStatsCount++;
- }
+ List<Node> nodes = getNodes();
+ for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext(); ) {
+ descCount++;
+ NodeKey nodeKey = iterator.next().getKey();
+ InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).toInstance();
+ ReadOnlyTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
+ FlowCapableNode node = (FlowCapableNode) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, nodeRef);
+ if (null != node.getHardware() &&
+ null != node.getManufacturer() &&
+ null != node.getSoftware()) {
+ descStatsCount++;
}
-
- if(descCount == descStatsCount)
- {
- LOG.debug("descStats - Success");
- }
- else
- {
- LOG.debug("descStats - Failed");
- LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
- }
-
- }
-
- private List<Node> getNodes()
- {
- Nodes nodes = (Nodes)dataProviderService.readOperationalData(InstanceIdentifier.builder(Nodes.class).toInstance());
- if(null == nodes)
- {
+ }
+
+ if (descCount == descStatsCount) {
+ LOG.debug("descStats - Success");
+ } else {
+ LOG.debug("descStats - Failed");
+ LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
+ }
+
+ }
+
+ private List<Node> getNodes() {
+ ReadOnlyTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
+ Nodes nodes = (Nodes) readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(Nodes.class).toInstance());
+ if (null == nodes) {
throw new RuntimeException("nodes are not found, pls add the node.");
}
return nodes.getNode();
-
+
}
-
-
+
+
@Override
public String getHelp() {
StringBuffer help = new StringBuffer();
return help.toString();
}
-
+
}
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-
import org.eclipse.osgi.framework.console.CommandInterpreter;
import org.eclipse.osgi.framework.console.CommandProvider;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAllActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCaseBuilder;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.pcp.action._case.SetVlanPcpActionBuilder;
-
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
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.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Metadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv4Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsBos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsLabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableConfig;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMissBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableMissBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMissBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.ApplyActionsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss.ApplyActionsMissBuilder;
-
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfieldBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.TablesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.miss.TablesMissBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.wildcards.WildcardSetfieldBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TablePropertiesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.Instructions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfieldBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.TablesBuilder ;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.miss.TablesMissBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.wildcards.WildcardSetfieldBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.metadata._case.WriteMetadataBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsBuilder ;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthDst;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthSrc;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv4Code;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPort;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv4Dst;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdTarget;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsBos;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsLabel;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.SctpDst;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableConfig;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpDst;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpSrc;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.osgi.framework.BundleContext;
public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandProvider {
- private DataBrokerService dataBrokerService;
+ private DataBroker dataBroker;
private ProviderContext pc;
private final BundleContext ctx;
private Table testTable;
public void onSessionInitiated(ProviderContext session) {
pc = session;
- dataBrokerService = session.getSALService(DataBrokerService.class);
+ dataBroker = session.getSALService(DataBroker.class);
ctx.registerService(CommandProvider.class.getName(), this, null);
- // createTestNode();
- // createTestTable();
+ // createTestNode();
+ // createTestTable();
}
- private void createUserNode(String nodeRef) {
+ private void createUserNode(String nodeRef) {
NodeBuilder builder = new NodeBuilder();
builder.setId(new NodeId(nodeRef));
builder.setKey(new NodeKey(builder.getId()));
testNode = builder.build();
}
-
- private void createTestNode() {
+
+ private void createTestNode() {
NodeBuilder builder = new NodeBuilder();
builder.setId(new NodeId(OpenflowpluginTestActivator.NODE_ID));
builder.setKey(new NodeKey(builder.getId()));
}
private TableBuilder createTestTable(String tableFeatureTypeArg) {
-
- String tableFeatureType = tableFeatureTypeArg;
- if (tableFeatureType == null) {
- tableFeatureType = "t1";
- }
+
+ String tableFeatureType = tableFeatureTypeArg;
+ if (tableFeatureType == null) {
+ tableFeatureType = "t1";
+ }
// Sample data , committing to DataStore
- DataModification modification = dataBrokerService.beginTransaction();
short id = 12;
- TableKey key = new TableKey(id) ;
-
+ TableKey key = new TableKey(id);
+
TableBuilder table = new TableBuilder();
- table.setId((short)12) ;
- table.setId(id) ;
- table.setKey(key) ;
-
-
- List<TableFeatures> ofTablefeatures = new ArrayList<TableFeatures>() ;
-
- // Skip this to send empty table features
- if( ! tableFeatureType.equals( "t1")) {
-
-
- TableFeaturesBuilder tableFeature1 = new TableFeaturesBuilder() ;
- tableFeature1.setTableId(new Short((short)0));
- tableFeature1.setName("Table 0");
-
-
- tableFeature1.setMetadataMatch((new BigInteger("10", 10)));
- tableFeature1.setMetadataWrite((new BigInteger("10", 10)));
- tableFeature1.setMaxEntries(new Long(10000)) ;
-
- tableFeature1.setConfig(new TableConfig(false));
-
- List<TableFeatureProperties> properties = new ArrayList<TableFeatureProperties>() ;
-
-
- switch( tableFeatureType) {
- case "t2" :
- //To set the ApplyActionsMiss
- properties.add(createApplyActionsMissTblFeatureProp().build()) ;
- break;
- case "t3" :
- // To set the Next Table
- properties.add(createNextTblFeatureProp().build()) ;
- break ;
- case "t4" :
- // To set the Next Table Miss
- properties.add(createNextTableMissTblFeatureProp().build()) ;
- break ;
- case "t5" :
- //To set the ApplyActions
- properties.add(createApplyActionsTblFeatureProp().build()) ;
- break;
- case "t6" :
- // To set the instructions
- properties.add(createInstructionsTblFeatureProp().build());
- break ;
- case "t7" :
- // To set the instructions miss
- properties.add(createInstructionsMissTblFeatureProp().build());
- break ;
- case "t8" :
- // To set the write actions
- properties.add(createWriteActionsTblFeatureProp().build()) ;
- break ;
- case "t9" :
- // To set the write actions miss
- properties.add(createWriteActionsMissTblFeatureProp().build()) ;
- break ;
- case "t10" :
- // To set the match field
- properties.add(createMatchFieldTblFeatureProp().build()) ;
- break ;
- case "t11" :
- // To set the write set-field
- properties.add( createWriteSetFieldTblFeatureProp().build()) ;
- break ;
- case "t12" :
- // To set the write set-field miss
- properties.add( createWriteSetFieldMissTblFeatureProp().build()) ;
- break ;
- case "t13" :
- // To set the apply set field
- properties.add( createApplySetFieldTblFeatureProp().build()) ;
- break ;
- case "t14" :
- // To set the apply set field miss
- properties.add( createApplySetFieldMissTblFeatureProp().build()) ;
- break ;
- case "t15" :
- // To set the wildcards set field match
- properties.add( createWildCardsTblFeatureProp().build()) ;
- break ;
- }
-
-
- TablePropertiesBuilder propertyBld = new TablePropertiesBuilder() ;
- propertyBld.setTableFeatureProperties(properties) ;
- tableFeature1.setTableProperties(propertyBld.build());
-
-
- ofTablefeatures.add(tableFeature1.build()) ;
-
- }
- table.setTableFeatures(ofTablefeatures) ;
-
+ table.setId((short) 12);
+ table.setId(id);
+ table.setKey(key);
+
+
+ List<TableFeatures> ofTablefeatures = new ArrayList<TableFeatures>();
+
+ // Skip this to send empty table features
+ if (!tableFeatureType.equals("t1")) {
+
+
+ TableFeaturesBuilder tableFeature1 = new TableFeaturesBuilder();
+ tableFeature1.setTableId(new Short((short) 0));
+ tableFeature1.setName("Table 0");
+
+
+ tableFeature1.setMetadataMatch((new BigInteger("10", 10)));
+ tableFeature1.setMetadataWrite((new BigInteger("10", 10)));
+ tableFeature1.setMaxEntries(new Long(10000));
+
+ tableFeature1.setConfig(new TableConfig(false));
+
+ List<TableFeatureProperties> properties = new ArrayList<TableFeatureProperties>();
+
+
+ switch (tableFeatureType) {
+ case "t2":
+ //To set the ApplyActionsMiss
+ properties.add(createApplyActionsMissTblFeatureProp().build());
+ break;
+ case "t3":
+ // To set the Next Table
+ properties.add(createNextTblFeatureProp().build());
+ break;
+ case "t4":
+ // To set the Next Table Miss
+ properties.add(createNextTableMissTblFeatureProp().build());
+ break;
+ case "t5":
+ //To set the ApplyActions
+ properties.add(createApplyActionsTblFeatureProp().build());
+ break;
+ case "t6":
+ // To set the instructions
+ properties.add(createInstructionsTblFeatureProp().build());
+ break;
+ case "t7":
+ // To set the instructions miss
+ properties.add(createInstructionsMissTblFeatureProp().build());
+ break;
+ case "t8":
+ // To set the write actions
+ properties.add(createWriteActionsTblFeatureProp().build());
+ break;
+ case "t9":
+ // To set the write actions miss
+ properties.add(createWriteActionsMissTblFeatureProp().build());
+ break;
+ case "t10":
+ // To set the match field
+ properties.add(createMatchFieldTblFeatureProp().build());
+ break;
+ case "t11":
+ // To set the write set-field
+ properties.add(createWriteSetFieldTblFeatureProp().build());
+ break;
+ case "t12":
+ // To set the write set-field miss
+ properties.add(createWriteSetFieldMissTblFeatureProp().build());
+ break;
+ case "t13":
+ // To set the apply set field
+ properties.add(createApplySetFieldTblFeatureProp().build());
+ break;
+ case "t14":
+ // To set the apply set field miss
+ properties.add(createApplySetFieldMissTblFeatureProp().build());
+ break;
+ case "t15":
+ // To set the wildcards set field match
+ properties.add(createWildCardsTblFeatureProp().build());
+ break;
+ }
+
+
+ TablePropertiesBuilder propertyBld = new TablePropertiesBuilder();
+ propertyBld.setTableFeatureProperties(properties);
+ tableFeature1.setTableProperties(propertyBld.build());
+
+
+ ofTablefeatures.add(tableFeature1.build());
+
+ }
+ table.setTableFeatures(ofTablefeatures);
+
testTable = table.build();
return table;
}
private TableFeaturePropertiesBuilder createApplyActionsMissTblFeatureProp() {
- TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
-
- //To set the ApplyActionsMiss
- List<Action> actionList = new ArrayList<Action>();
- ActionBuilder ab = new ActionBuilder();
-
- ab.setAction(new PopMplsActionCaseBuilder().build());
- actionList.add(ab.build());
-
- tableFeatureProperty.setTableFeaturePropType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMissBuilder()
- .setApplyActionsMiss(new ApplyActionsMissBuilder().setAction(actionList).build()).build()) ;
-
- TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
- tableFeatureProperty.setKey(keyValue) ;
- tableFeatureProperty.setOrder(1) ;
-
- return tableFeatureProperty ;
-
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
+
+ //To set the ApplyActionsMiss
+ List<Action> actionList = new ArrayList<Action>();
+ ActionBuilder ab = new ActionBuilder();
+
+ ab.setAction(new PopMplsActionCaseBuilder().build());
+ actionList.add(ab.build());
+
+ tableFeatureProperty.setTableFeaturePropType(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMissBuilder()
+ .setApplyActionsMiss(new ApplyActionsMissBuilder().setAction(actionList).build()).build());
+
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
+ tableFeatureProperty.setKey(keyValue);
+ tableFeatureProperty.setOrder(1);
+
+ return tableFeatureProperty;
+
}
-
+
private TableFeaturePropertiesBuilder createApplyActionsTblFeatureProp() {
- TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
- List<Action> actionListt5 = new ArrayList<Action>();
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
+ List<Action> actionListt5 = new ArrayList<Action>();
ActionBuilder abt5 = new ActionBuilder();
abt5.setAction(new PopMplsActionCaseBuilder().build());
actionListt5.add(abt5.build());
-
+
tableFeatureProperty.setTableFeaturePropType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsBuilder()
- .setApplyActions(new ApplyActionsBuilder().setAction(actionListt5).build()).build()) ;
-
- TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
- tableFeatureProperty.setKey(keyValue) ;
- tableFeatureProperty.setOrder(1) ;
-
- return tableFeatureProperty ;
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsBuilder()
+ .setApplyActions(new ApplyActionsBuilder().setAction(actionListt5).build()).build());
+
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
+ tableFeatureProperty.setKey(keyValue);
+ tableFeatureProperty.setOrder(1);
+
+ return tableFeatureProperty;
}
-
+
private TableFeaturePropertiesBuilder createNextTblFeatureProp() {
- TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
- List<Short> nextTblIds = Arrays.asList(new Short[] { 2, 3} );
- NextTableBuilder nextTblBld = new NextTableBuilder() ;
-
- nextTblBld.setTables( new TablesBuilder().setTableIds(nextTblIds).build()) ;
- tableFeatureProperty.setTableFeaturePropType(nextTblBld.build() ) ;
-
- TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
- tableFeatureProperty.setKey(keyValue) ;
- tableFeatureProperty.setOrder(1) ;
-
- return tableFeatureProperty ;
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
+ List<Short> nextTblIds = Arrays.asList(new Short[]{2, 3});
+ NextTableBuilder nextTblBld = new NextTableBuilder();
+
+ nextTblBld.setTables(new TablesBuilder().setTableIds(nextTblIds).build());
+ tableFeatureProperty.setTableFeaturePropType(nextTblBld.build());
+
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
+ tableFeatureProperty.setKey(keyValue);
+ tableFeatureProperty.setOrder(1);
+
+ return tableFeatureProperty;
}
-
+
private TableFeaturePropertiesBuilder createNextTableMissTblFeatureProp() {
- TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
- List<Short> nextTblMissIds = Arrays.asList( new Short[] { 23, 24, 25, 27, 28, 29 , 30 } );
- NextTableMissBuilder nextTblMissBld = new NextTableMissBuilder() ;
-
- nextTblMissBld.setTablesMiss(new TablesMissBuilder().setTableIds(nextTblMissIds).build()) ;
- tableFeatureProperty.setTableFeaturePropType(nextTblMissBld.build() ) ;
-
- TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
- tableFeatureProperty.setKey(keyValue) ;
- tableFeatureProperty.setOrder(1) ;
-
- return tableFeatureProperty ;
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
+ List<Short> nextTblMissIds = Arrays.asList(new Short[]{23, 24, 25, 27, 28, 29, 30});
+ NextTableMissBuilder nextTblMissBld = new NextTableMissBuilder();
+
+ nextTblMissBld.setTablesMiss(new TablesMissBuilder().setTableIds(nextTblMissIds).build());
+ tableFeatureProperty.setTableFeaturePropType(nextTblMissBld.build());
+
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
+ tableFeatureProperty.setKey(keyValue);
+ tableFeatureProperty.setOrder(1);
+
+ return tableFeatureProperty;
}
-
-
-
+
+
private TableFeaturePropertiesBuilder createInstructionsTblFeatureProp() {
- TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
-
- List<Instruction> instLst = new ArrayList<Instruction>() ;
- InstructionBuilder ib = new InstructionBuilder() ;
- ib.setOrder(1) ;
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
+
+ List<Instruction> instLst = new ArrayList<Instruction>();
+ InstructionBuilder ib = new InstructionBuilder();
+ ib.setOrder(1);
ib.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder().build());
- ib.setKey(new InstructionKey(1)) ;
-
- tableFeatureProperty.setTableFeaturePropType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsBuilder().setInstructions(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.InstructionsBuilder().setInstruction(instLst).build()).build() ) ;
-
-
-
- TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
- tableFeatureProperty.setKey(keyValue) ;
- tableFeatureProperty.setOrder(1) ;
-
- return tableFeatureProperty ;
+ ib.setKey(new InstructionKey(1));
+
+ tableFeatureProperty.setTableFeaturePropType(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsBuilder().setInstructions(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.InstructionsBuilder().setInstruction(instLst).build()).build());
+
+
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
+ tableFeatureProperty.setKey(keyValue);
+ tableFeatureProperty.setOrder(1);
+
+ return tableFeatureProperty;
}
-
+
private TableFeaturePropertiesBuilder createInstructionsMissTblFeatureProp() {
- // To set the instructions miss -- "t7"
- TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
-
- List<Instruction> instLst = new ArrayList<Instruction>() ;
- InstructionBuilder ib1 = new InstructionBuilder() ;
- ib1.setOrder(1) ;
+ // To set the instructions miss -- "t7"
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
+
+ List<Instruction> instLst = new ArrayList<Instruction>();
+ InstructionBuilder ib1 = new InstructionBuilder();
+ ib1.setOrder(1);
ib1.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCaseBuilder().build());
- ib1.setKey(new InstructionKey(1)) ;
-
- InstructionBuilder ib2 = new InstructionBuilder() ;
- ib2.setOrder(2) ;
+ ib1.setKey(new InstructionKey(1));
+
+ InstructionBuilder ib2 = new InstructionBuilder();
+ ib2.setOrder(2);
ib2.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCaseBuilder().build());
- ib2.setKey(new InstructionKey(2)) ;
-
- tableFeatureProperty.setTableFeaturePropType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMissBuilder().setInstructionsMiss(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMissBuilder().setInstruction(instLst).build()).build() ) ;
-
-
-
- TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
- tableFeatureProperty.setKey(keyValue) ;
- tableFeatureProperty.setOrder(1) ;
-
- return tableFeatureProperty ;
+ ib2.setKey(new InstructionKey(2));
+
+ tableFeatureProperty.setTableFeaturePropType(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMissBuilder().setInstructionsMiss(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMissBuilder().setInstruction(instLst).build()).build());
+
+
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
+ tableFeatureProperty.setKey(keyValue);
+ tableFeatureProperty.setOrder(1);
+
+ return tableFeatureProperty;
}
-
+
private TableFeaturePropertiesBuilder createWriteActionsTblFeatureProp() {
- // t8
- TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
-
- List<Action> actionList = new ArrayList<Action>();
-
- ActionBuilder abt1 = new ActionBuilder();
+ // t8
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
+
+ List<Action> actionList = new ArrayList<Action>();
+
+ ActionBuilder abt1 = new ActionBuilder();
abt1.setAction(new CopyTtlOutCaseBuilder().build());
actionList.add(abt1.build());
-
+
ActionBuilder abt2 = new ActionBuilder();
abt2.setAction(new PopVlanActionCaseBuilder().build());
actionList.add(abt2.build());
-
+
tableFeatureProperty.setTableFeaturePropType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsBuilder()
- .setWriteActions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.WriteActionsBuilder().setAction(actionList).build()).build()) ;
-
- TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
- tableFeatureProperty.setKey(keyValue) ;
- tableFeatureProperty.setOrder(1) ;
-
- return tableFeatureProperty ;
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsBuilder()
+ .setWriteActions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.WriteActionsBuilder().setAction(actionList).build()).build());
+
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
+ tableFeatureProperty.setKey(keyValue);
+ tableFeatureProperty.setOrder(1);
+
+ return tableFeatureProperty;
}
-
+
private TableFeaturePropertiesBuilder createWriteActionsMissTblFeatureProp() {
- // t9
- TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
-
- List<Action> actionList = new ArrayList<Action>();
-
- ActionBuilder abt1 = new ActionBuilder();
+ // t9
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
+
+ List<Action> actionList = new ArrayList<Action>();
+
+ ActionBuilder abt1 = new ActionBuilder();
abt1.setAction(new CopyTtlInCaseBuilder().build());
actionList.add(abt1.build());
-
+
ActionBuilder abt2 = new ActionBuilder();
abt2.setAction(new PushPbbActionCaseBuilder().build());
actionList.add(abt2.build());
-
+
tableFeatureProperty.setTableFeaturePropType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsMissBuilder()
- .setWriteActionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.miss.WriteActionsMissBuilder().setAction(actionList).build()).build()) ;
-
- TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
- tableFeatureProperty.setKey(keyValue) ;
- tableFeatureProperty.setOrder(1) ;
-
- return tableFeatureProperty ;
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsMissBuilder()
+ .setWriteActionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.miss.WriteActionsMissBuilder().setAction(actionList).build()).build());
+
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
+ tableFeatureProperty.setKey(keyValue);
+ tableFeatureProperty.setOrder(1);
+
+ return tableFeatureProperty;
}
+
private TableFeaturePropertiesBuilder createMatchFieldTblFeatureProp() {
- //t10
- TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
-
-
- List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>() ;
- SetFieldMatchBuilder setFieldMatchBld = new SetFieldMatchBuilder() ;
- setFieldMatchBld.setHasMask(false) ;
- setFieldMatchBld.setMatchType(MplsLabel.class) ;
-
-
- setFieldMatch.add(setFieldMatchBld.build()) ;
- MatchBuilder matchBld = new MatchBuilder() ;
- MatchSetfieldBuilder matchSetfieldBld = new MatchSetfieldBuilder();
- matchSetfieldBld.setSetFieldMatch(setFieldMatch);
- matchBld.setMatchSetfield(matchSetfieldBld.build()) ;
-
- tableFeatureProperty.setTableFeaturePropType(matchBld.build()) ;
- TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
- tableFeatureProperty.setKey(keyValue) ;
- tableFeatureProperty.setOrder(1) ;
-
- return tableFeatureProperty ;
+ //t10
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
+
+
+ List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>();
+ SetFieldMatchBuilder setFieldMatchBld = new SetFieldMatchBuilder();
+ setFieldMatchBld.setHasMask(false);
+ setFieldMatchBld.setMatchType(MplsLabel.class);
+
+
+ setFieldMatch.add(setFieldMatchBld.build());
+ MatchBuilder matchBld = new MatchBuilder();
+ MatchSetfieldBuilder matchSetfieldBld = new MatchSetfieldBuilder();
+ matchSetfieldBld.setSetFieldMatch(setFieldMatch);
+ matchBld.setMatchSetfield(matchSetfieldBld.build());
+
+ tableFeatureProperty.setTableFeaturePropType(matchBld.build());
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
+ tableFeatureProperty.setKey(keyValue);
+ tableFeatureProperty.setOrder(1);
+
+ return tableFeatureProperty;
}
-
-
+
+
private TableFeaturePropertiesBuilder createWriteSetFieldTblFeatureProp() {
- //t11
- TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
-
- List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>() ;
- SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder() ;
- setFieldMatchBld1.setHasMask(false) ;
- setFieldMatchBld1.setMatchType(MplsLabel.class) ;
-
- SetFieldMatchBuilder setFieldMatchBld2 = new SetFieldMatchBuilder() ;
- setFieldMatchBld2.setHasMask(true) ;
- setFieldMatchBld2.setMatchType(MplsBos.class) ;
-
- SetFieldMatchBuilder setFieldMatchBld3 = new SetFieldMatchBuilder() ;
- setFieldMatchBld3.setHasMask(true) ;
- setFieldMatchBld3.setMatchType(EthDst.class) ;
-
- setFieldMatch.add(setFieldMatchBld1.build()) ;
- setFieldMatch.add(setFieldMatchBld2.build()) ;
- setFieldMatch.add(setFieldMatchBld3.build()) ;
-
- WriteSetfieldBuilder writeSetfieldBld = new WriteSetfieldBuilder() ;
- org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.WriteSetfieldBuilder writeSetfieldBuilder =
- new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.WriteSetfieldBuilder();
- writeSetfieldBuilder.setSetFieldMatch(setFieldMatch);
- writeSetfieldBld.setWriteSetfield(writeSetfieldBuilder.build());
-
-
- tableFeatureProperty.setTableFeaturePropType(writeSetfieldBld.build()) ;
- TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
- tableFeatureProperty.setKey(keyValue) ;
- tableFeatureProperty.setOrder(1) ;
-
- return tableFeatureProperty ;
+ //t11
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
+
+ List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>();
+ SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder();
+ setFieldMatchBld1.setHasMask(false);
+ setFieldMatchBld1.setMatchType(MplsLabel.class);
+
+ SetFieldMatchBuilder setFieldMatchBld2 = new SetFieldMatchBuilder();
+ setFieldMatchBld2.setHasMask(true);
+ setFieldMatchBld2.setMatchType(MplsBos.class);
+
+ SetFieldMatchBuilder setFieldMatchBld3 = new SetFieldMatchBuilder();
+ setFieldMatchBld3.setHasMask(true);
+ setFieldMatchBld3.setMatchType(EthDst.class);
+
+ setFieldMatch.add(setFieldMatchBld1.build());
+ setFieldMatch.add(setFieldMatchBld2.build());
+ setFieldMatch.add(setFieldMatchBld3.build());
+
+ WriteSetfieldBuilder writeSetfieldBld = new WriteSetfieldBuilder();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.WriteSetfieldBuilder writeSetfieldBuilder =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.WriteSetfieldBuilder();
+ writeSetfieldBuilder.setSetFieldMatch(setFieldMatch);
+ writeSetfieldBld.setWriteSetfield(writeSetfieldBuilder.build());
+
+
+ tableFeatureProperty.setTableFeaturePropType(writeSetfieldBld.build());
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
+ tableFeatureProperty.setKey(keyValue);
+ tableFeatureProperty.setOrder(1);
+
+ return tableFeatureProperty;
}
-
+
private TableFeaturePropertiesBuilder createWriteSetFieldMissTblFeatureProp() {
- // t12
- TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
-
- List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>() ;
- SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder() ;
- setFieldMatchBld1.setHasMask(false) ;
- setFieldMatchBld1.setMatchType(EthSrc.class) ;
-
- SetFieldMatchBuilder setFieldMatchBld2 = new SetFieldMatchBuilder() ;
- setFieldMatchBld2.setHasMask(true) ;
- setFieldMatchBld2.setMatchType(InPort.class) ;
-
- SetFieldMatchBuilder setFieldMatchBld3 = new SetFieldMatchBuilder() ;
- setFieldMatchBld3.setHasMask(true) ;
- setFieldMatchBld3.setMatchType(Ipv4Dst.class) ;
-
- setFieldMatch.add(setFieldMatchBld1.build()) ;
- setFieldMatch.add(setFieldMatchBld2.build()) ;
- setFieldMatch.add(setFieldMatchBld3.build()) ;
-
- WriteSetfieldMissBuilder writeSetfieldBld = new WriteSetfieldMissBuilder() ;
- org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.miss.WriteSetfieldMissBuilder writeSetfieldMissBuilder =
- new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.miss.WriteSetfieldMissBuilder();
- writeSetfieldMissBuilder.setSetFieldMatch(setFieldMatch);
- writeSetfieldBld.setWriteSetfieldMiss(writeSetfieldMissBuilder.build()) ;
-
- tableFeatureProperty.setTableFeaturePropType(writeSetfieldBld.build()) ;
- TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
- tableFeatureProperty.setKey(keyValue) ;
- tableFeatureProperty.setOrder(1) ;
-
- return tableFeatureProperty ;
+ // t12
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
+
+ List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>();
+ SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder();
+ setFieldMatchBld1.setHasMask(false);
+ setFieldMatchBld1.setMatchType(EthSrc.class);
+
+ SetFieldMatchBuilder setFieldMatchBld2 = new SetFieldMatchBuilder();
+ setFieldMatchBld2.setHasMask(true);
+ setFieldMatchBld2.setMatchType(InPort.class);
+
+ SetFieldMatchBuilder setFieldMatchBld3 = new SetFieldMatchBuilder();
+ setFieldMatchBld3.setHasMask(true);
+ setFieldMatchBld3.setMatchType(Ipv4Dst.class);
+
+ setFieldMatch.add(setFieldMatchBld1.build());
+ setFieldMatch.add(setFieldMatchBld2.build());
+ setFieldMatch.add(setFieldMatchBld3.build());
+
+ WriteSetfieldMissBuilder writeSetfieldBld = new WriteSetfieldMissBuilder();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.miss.WriteSetfieldMissBuilder writeSetfieldMissBuilder =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.miss.WriteSetfieldMissBuilder();
+ writeSetfieldMissBuilder.setSetFieldMatch(setFieldMatch);
+ writeSetfieldBld.setWriteSetfieldMiss(writeSetfieldMissBuilder.build());
+
+ tableFeatureProperty.setTableFeaturePropType(writeSetfieldBld.build());
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
+ tableFeatureProperty.setKey(keyValue);
+ tableFeatureProperty.setOrder(1);
+
+ return tableFeatureProperty;
}
-
+
private TableFeaturePropertiesBuilder createApplySetFieldTblFeatureProp() {
- //t13
- TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
-
- List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>() ;
- SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder() ;
- setFieldMatchBld1.setHasMask(false) ;
- setFieldMatchBld1.setMatchType(ArpOp.class) ;
-
- SetFieldMatchBuilder setFieldMatchBld2 = new SetFieldMatchBuilder() ;
- setFieldMatchBld2.setHasMask(true) ;
- setFieldMatchBld2.setMatchType(InPort.class) ;
-
- SetFieldMatchBuilder setFieldMatchBld3 = new SetFieldMatchBuilder() ;
- setFieldMatchBld3.setHasMask(true) ;
- setFieldMatchBld3.setMatchType(Ipv4Dst.class) ;
-
- setFieldMatch.add(setFieldMatchBld1.build()) ;
- setFieldMatch.add(setFieldMatchBld2.build()) ;
- setFieldMatch.add(setFieldMatchBld3.build()) ;
-
- ApplySetfieldBuilder applySetfieldBld = new ApplySetfieldBuilder();
- org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder applySetfieldBuilder =
- new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder();
- applySetfieldBuilder.setSetFieldMatch(setFieldMatch);
- applySetfieldBld.setApplySetfield(applySetfieldBuilder.build()) ;
-
- tableFeatureProperty.setTableFeaturePropType(applySetfieldBld.build()) ;
- TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
- tableFeatureProperty.setKey(keyValue) ;
- tableFeatureProperty.setOrder(1) ;
-
- return tableFeatureProperty ;
+ //t13
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
+
+ List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>();
+ SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder();
+ setFieldMatchBld1.setHasMask(false);
+ setFieldMatchBld1.setMatchType(ArpOp.class);
+
+ SetFieldMatchBuilder setFieldMatchBld2 = new SetFieldMatchBuilder();
+ setFieldMatchBld2.setHasMask(true);
+ setFieldMatchBld2.setMatchType(InPort.class);
+
+ SetFieldMatchBuilder setFieldMatchBld3 = new SetFieldMatchBuilder();
+ setFieldMatchBld3.setHasMask(true);
+ setFieldMatchBld3.setMatchType(Ipv4Dst.class);
+
+ setFieldMatch.add(setFieldMatchBld1.build());
+ setFieldMatch.add(setFieldMatchBld2.build());
+ setFieldMatch.add(setFieldMatchBld3.build());
+
+ ApplySetfieldBuilder applySetfieldBld = new ApplySetfieldBuilder();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder applySetfieldBuilder =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder();
+ applySetfieldBuilder.setSetFieldMatch(setFieldMatch);
+ applySetfieldBld.setApplySetfield(applySetfieldBuilder.build());
+
+ tableFeatureProperty.setTableFeaturePropType(applySetfieldBld.build());
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
+ tableFeatureProperty.setKey(keyValue);
+ tableFeatureProperty.setOrder(1);
+
+ return tableFeatureProperty;
}
-
+
private TableFeaturePropertiesBuilder createApplySetFieldMissTblFeatureProp() {
- //t14
- TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
-
- List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>() ;
- SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder() ;
- setFieldMatchBld1.setHasMask(false) ;
- setFieldMatchBld1.setMatchType(ArpOp.class) ;
-
- SetFieldMatchBuilder setFieldMatchBld2 = new SetFieldMatchBuilder() ;
- setFieldMatchBld2.setHasMask(true) ;
- setFieldMatchBld2.setMatchType(InPort.class) ;
-
- SetFieldMatchBuilder setFieldMatchBld3 = new SetFieldMatchBuilder() ;
- setFieldMatchBld3.setHasMask(true) ;
- setFieldMatchBld3.setMatchType(Ipv4Dst.class) ;
-
- setFieldMatch.add(setFieldMatchBld1.build()) ;
- setFieldMatch.add(setFieldMatchBld2.build()) ;
- setFieldMatch.add(setFieldMatchBld3.build()) ;
-
- ApplySetfieldMissBuilder applySetfieldMissBld = new ApplySetfieldMissBuilder() ;
- org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMissBuilder applySetfieldMissBuilder =
- new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMissBuilder();
- applySetfieldMissBuilder.setSetFieldMatch(setFieldMatch);
- applySetfieldMissBld.setApplySetfieldMiss(applySetfieldMissBuilder.build()) ;
-
- tableFeatureProperty.setTableFeaturePropType(applySetfieldMissBld.build()) ;
- TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
- tableFeatureProperty.setKey(keyValue) ;
- tableFeatureProperty.setOrder(1) ;
-
- return tableFeatureProperty ;
+ //t14
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
+
+ List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>();
+ SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder();
+ setFieldMatchBld1.setHasMask(false);
+ setFieldMatchBld1.setMatchType(ArpOp.class);
+
+ SetFieldMatchBuilder setFieldMatchBld2 = new SetFieldMatchBuilder();
+ setFieldMatchBld2.setHasMask(true);
+ setFieldMatchBld2.setMatchType(InPort.class);
+
+ SetFieldMatchBuilder setFieldMatchBld3 = new SetFieldMatchBuilder();
+ setFieldMatchBld3.setHasMask(true);
+ setFieldMatchBld3.setMatchType(Ipv4Dst.class);
+
+ setFieldMatch.add(setFieldMatchBld1.build());
+ setFieldMatch.add(setFieldMatchBld2.build());
+ setFieldMatch.add(setFieldMatchBld3.build());
+
+ ApplySetfieldMissBuilder applySetfieldMissBld = new ApplySetfieldMissBuilder();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMissBuilder applySetfieldMissBuilder =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMissBuilder();
+ applySetfieldMissBuilder.setSetFieldMatch(setFieldMatch);
+ applySetfieldMissBld.setApplySetfieldMiss(applySetfieldMissBuilder.build());
+
+ tableFeatureProperty.setTableFeaturePropType(applySetfieldMissBld.build());
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
+ tableFeatureProperty.setKey(keyValue);
+ tableFeatureProperty.setOrder(1);
+
+ return tableFeatureProperty;
}
-
+
private TableFeaturePropertiesBuilder createWildCardsTblFeatureProp() {
- //t15
- TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
-
- List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>() ;
- SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder() ;
- setFieldMatchBld1.setHasMask(false) ;
- setFieldMatchBld1.setMatchType(ArpOp.class) ;
-
- SetFieldMatchBuilder setFieldMatchBld2 = new SetFieldMatchBuilder() ;
- setFieldMatchBld2.setHasMask(true) ;
- setFieldMatchBld2.setMatchType(InPort.class) ;
-
-
- setFieldMatch.add(setFieldMatchBld1.build()) ;
- setFieldMatch.add(setFieldMatchBld2.build()) ;
-
- WildcardsBuilder wildCardsBld = new WildcardsBuilder() ;
- WildcardSetfieldBuilder wildcardsBuilder =
- new WildcardSetfieldBuilder();
- wildcardsBuilder.setSetFieldMatch(setFieldMatch);
- wildCardsBld.setWildcardSetfield(wildcardsBuilder.build()) ;
-
- tableFeatureProperty.setTableFeaturePropType(wildCardsBld.build()) ;
- TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
- tableFeatureProperty.setKey(keyValue) ;
- tableFeatureProperty.setOrder(1) ;
-
- return tableFeatureProperty ;
+ //t15
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
+
+ List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>();
+ SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder();
+ setFieldMatchBld1.setHasMask(false);
+ setFieldMatchBld1.setMatchType(ArpOp.class);
+
+ SetFieldMatchBuilder setFieldMatchBld2 = new SetFieldMatchBuilder();
+ setFieldMatchBld2.setHasMask(true);
+ setFieldMatchBld2.setMatchType(InPort.class);
+
+
+ setFieldMatch.add(setFieldMatchBld1.build());
+ setFieldMatch.add(setFieldMatchBld2.build());
+
+ WildcardsBuilder wildCardsBld = new WildcardsBuilder();
+ WildcardSetfieldBuilder wildcardsBuilder =
+ new WildcardSetfieldBuilder();
+ wildcardsBuilder.setSetFieldMatch(setFieldMatch);
+ wildCardsBld.setWildcardSetfield(wildcardsBuilder.build());
+
+ tableFeatureProperty.setTableFeaturePropType(wildCardsBld.build());
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
+ tableFeatureProperty.setKey(keyValue);
+ tableFeatureProperty.setOrder(1);
+
+ return tableFeatureProperty;
}
-
-
+
+
private void writeTable(CommandInterpreter ci, Table table) {
- DataModification modification = dataBrokerService.beginTransaction();
-
+ ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
+
InstanceIdentifier<Table> path1 = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class).
- child(Table.class, new TableKey(table.getId())).build() ;
-
-
- modification.putOperationalData(nodeToInstanceId(testNode), testNode);
- modification.putOperationalData(path1, table);
- modification.putConfigurationData(nodeToInstanceId(testNode), testNode);
- modification.putConfigurationData(path1, table);
+ child(Table.class, new TableKey(table.getId())).build();
+
+
+ modification.put(LogicalDatastoreType.OPERATIONAL, nodeToInstanceId(testNode), testNode);
+ modification.put(LogicalDatastoreType.OPERATIONAL, path1, table);
+ modification.put(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode);
+ modification.put(LogicalDatastoreType.CONFIGURATION, path1, table);
Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
try {
RpcResult<TransactionStatus> result = commitFuture.get();
public void _modifyTable(CommandInterpreter ci) {
String nref = ci.nextArgument();
- ci.println( " Table Command Provider modify" ) ;
-
+ ci.println(" Table Command Provider modify");
+
if (nref == null) {
ci.println("test node added");
createTestNode();
ci.println("User node added" + nref);
createUserNode(nref);
}
- String tableFeatureType = ci.nextArgument() ;
- TableBuilder table = createTestTable(tableFeatureType);
-
+ String tableFeatureType = ci.nextArgument();
+ TableBuilder table = createTestTable(tableFeatureType);
+
writeTable(ci, table.build());
}
-
+
@Override
public String getHelp() {
StringBuffer help = new StringBuffer();
help.append("---FRM MD-SAL Table test module---\n");
help.append("\t modifyTable <node id> - node ref\n");
-
+
return help.toString();
- }
-
+ }
+
}
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration
import org.opendaylight.controller.sal.binding.api.NotificationProviderService
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.controller.md.sal.binding.api.DataBroker
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService
//import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalTableService
import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext
import org.opendaylight.controller.sal.binding.api.NotificationProviderService
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.controller.md.sal.binding.api.DataBroker
import org.osgi.framework.BundleContext
class OpenflowpluginTestActivator extends AbstractBindingAwareProvider {
public static final String NODE_ID = "foo:node:1";
override onSessionInitiated(ProviderContext session) {
- provider.dataService = session.getSALService(DataProviderService)
+ provider.dataService = session.getSALService(DataBroker)
provider.notificationService = session.getSALService(NotificationProviderService)
provider.start();
provider.register(session);
import java.math.BigInteger;
import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
+import java.util.Collection;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
-import java.util.Collection;
-import java.util.Iterator;
-
import org.eclipse.osgi.framework.console.CommandInterpreter;
import org.eclipse.osgi.framework.console.CommandProvider;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.NotificationService;
-import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
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.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.osgi.framework.BundleContext;
private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
- private DataBrokerService dataBrokerService;
+ private DataBroker dataBroker;
private ProviderContext pc;
private final BundleContext ctx;
private FlowBuilder testFlow;
// For switch events
listener1Reg = notificationService.registerNotificationListener(flowEventListener);
listener2Reg = notificationService.registerNotificationListener(nodeErrorListener);
- dataBrokerService = session.getSALService(DataBrokerService.class);
+ dataBroker = session.getSALService(DataBroker.class);
ctx.registerService(CommandProvider.class.getName(), this, null);
createTestFlow(createTestNode(null), null, null);
}
if (flowType == null) {
flowType = "f1";
}
-
+
flow.setPriority(2);
switch (flowType) {
- case "f1":
- id += 1;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createDecNwTtlInstructions().build());
- break;
- case "f2":
- id += 2;
- flow.setMatch(createMatch2().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f3":
- id += 3;
- flow.setMatch(createMatch3().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f4":
- id += 4;
- flow.setMatch(createEthernetMatch().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f5":
- id += 5;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction().build());
- break;
- case "f6":
- id += 6;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createGotoTableInstructions().build());
- break;
- case "f7":
- id += 7;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createMeterInstructions().build());
- break;
- case "f8":
- id += 8;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction1().build());
- break;
- case "f9":
- id += 9;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction2().build());
- break;
- case "f10":
- id += 10;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction3().build());
- break;
- case "f11":
- id += 11;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction4().build());
- break;
- case "f12":
- id += 12;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction5().build());
- break;
- case "f13":
- id += 13;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction6().build());
- break;
- case "f14":
- id += 14;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction7().build());
- break;
- case "f15":
- id += 15;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction8().build());
- break;
- case "f16":
- id += 16;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction9().build());
- break;
- case "f17":
- id += 17;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction10().build());
- break;
- case "f18":
- id += 18;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction11().build());
- break;
- case "f19":
- id += 19;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction12().build());
- break;
- case "f20":
- id += 20;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction13().build());
- break;
- case "f21":
- id += 21;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction14().build());
- break;
- case "f22":
- id += 22;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction15().build());
- break;
- case "f23":
- id += 23;
- // f23 can be used as test-case for generating error notification
- // if the particular group is not configured - tested
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction16().build());
- break;
- case "f24":
- id += 24;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction17().build());
- break;
- case "f25":
- id += 25;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction18().build());
- break;
- case "f26":
- id += 26;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction19().build());
- break;
- case "f27":
- id += 27;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createMetadataInstructions().build());
- break;
- case "f28":
- id += 28;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction20().build());
- break;
- case "f29":
- id += 29;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction21().build());
- break;
- case "f30":
- id += 30;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction22().build());
- break;
- case "f31":
- id += 31;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction23(nodeBuilder.getId()).build());
- break;
- case "f32":
- id += 32;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction24().build());
- break;
- case "f33":
- id += 33;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction25().build());
- break;
- case "f34":
- id += 34;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction26().build());
- break;
- case "f35":
- id += 35;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction27().build());
- break;
- case "f36":
- id += 36;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction28().build());
- break;
- case "f37":
- id += 37;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction29().build());
- break;
- case "f38":
- id += 38;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction30().build());
- break;
- case "f39":
- id += 39;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction31().build());
- break;
- case "f40":
- id += 40;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction32().build());
- break;
- case "f41":
- id += 41;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction33().build());
- break;
- case "f42":
- id += 42;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction34().build());
- break;
- case "f43":
- id += 43;
- flow.setMatch(createICMPv6Match().build());
- flow.setInstructions(createDecNwTtlInstructions().build());
- break;
- case "f44":
- id += 44;
- flow.setMatch(createInphyportMatch(nodeBuilder.getId()).build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f45":
- id += 45;
- flow.setMatch(createMetadataMatch().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f46":
- id += 46;
- flow.setMatch(createL3IPv6Match().build());
- flow.setInstructions(createDecNwTtlInstructions().build());
- break;
- case "f47":
- id += 47;
- flow.setMatch(createL4SCTPMatch().build());
- flow.setInstructions(createAppyActionInstruction().build());
- break;
- case "f48":
- id += 48;
- flow.setMatch(createTunnelIDMatch().build());
- flow.setInstructions(createGotoTableInstructions().build());
- break;
- case "f49":
- id += 49;
- flow.setMatch(createVlanMatch().build());
- flow.setInstructions(createMeterInstructions().build());
- break;
- case "f50":
- id += 50;
- flow.setMatch(createPbbMatch().build());
- flow.setInstructions(createMeterInstructions().build());
- break;
- case "f51":
- id += 51;
- flow.setMatch(createVlanMatch().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f52":
- id += 52;
- flow.setMatch(createL4TCPMatch().build());
- flow.setInstructions(createDropInstructions().build());
- break;
-
- case "f53":
- id += 53;
- flow.setMatch(createL4UDPMatch().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f54":
- id += 54;
- flow.setMatch(new MatchBuilder().build());
- flow.setInstructions(createSentToControllerInstructions().build());
- flow.setPriority(0);
- break;
- case "f55":
- id += 55;
- flow.setMatch(createToSMatch().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f56":
- id += 56;
- flow.setMatch(createToSMatch().build());
- flow.setInstructions(createOutputInstructions("INPORT", 10).build());
- break;
- case "f57":
- id += 57;
- flow.setMatch(createToSMatch().build());
- flow.setInstructions(createOutputInstructions("FLOOD", 20).build());
- break;
- case "f58":
- id += 58;
- flow.setMatch(createToSMatch().build());
- flow.setInstructions(createOutputInstructions("ALL", 30).build());
- break;
- case "f59":
- id += 59;
- flow.setMatch(createToSMatch().build());
- flow.setInstructions(createOutputInstructions("NORMAL", 40).build());
- break;
- case "f60":
- id += 60;
- flow.setMatch(createToSMatch().build());
- flow.setInstructions(createOutputInstructions("LOCAL", 50).build());
- break;
- case "f61":
- id += 61;
- flow.setMatch(createToSMatch().build());
- flow.setInstructions(createOutputInstructions("TABLE", 60).build());
- break;
- case "f62":
- id += 62;
- flow.setMatch(createToSMatch().build());
- flow.setInstructions(createOutputInstructions("NONE", 70).build());
- break;
- case "f63":
- id += 63;
- flow.setMatch(createToSMatch().build());
- flow.setInstructions(createStripVlanInstructions().build());
- flow.setBarrier(Boolean.TRUE);
- break;
- case "f64":
- id += 64;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction35().build());
- break;
- case "f65":
- id += 65;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction36().build());
- break;
- case "f66":
- id += 66;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction37().build());
- break;
- case "f67":
- id += 67;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createAppyActionInstruction38().build());
- break;
- case "f68":
- id += 68;
- flow.setMatch(createL4TCPMatch().build());
- flow.setInstructions(createAppyActionInstruction39().build());
- break;
- case "f69":
- id += 69;
- flow.setMatch(createL4UDPMatch().build());
- flow.setInstructions(createAppyActionInstruction40().build());
- break;
- case "f70":
- id += 70;
- flow.setMatch(createL4SCTPMatch().build());
- flow.setInstructions(createAppyActionInstruction41().build());
- break;
- case "f71":
- id += 71;
- flow.setMatch(createICMPv4Match().build());
- flow.setInstructions(createAppyActionInstruction42().build());
- break;
- case "f72":
- id += 72;
- flow.setMatch(createArpMatch().build());
- flow.setInstructions(createAppyActionInstruction43().build());
- break;
- case "f73":
- id += 73;
- flow.setMatch(createL3IPv6Match().build());
- flow.setInstructions(createAppyActionInstruction44().build());
- break;
- case "f74":
- id += 74;
- flow.setMatch(createICMPv6Match().build());
- flow.setInstructions(createAppyActionInstruction45().build());
- break;
- case "f75":
- id += 75;
- flow.setMatch(createMplsMatch().build());
- flow.setInstructions(createAppyActionInstruction46().build());
- break;
- case "f76":
- id += 76;
- flow.setMatch(createPbbMatch().build());
- flow.setInstructions(createAppyActionInstruction47().build());
- break;
- case "f77":
- id += 77;
- flow.setMatch(createTunnelIDMatch().build());
- flow.setInstructions(createAppyActionInstruction48().build());
- break;
- case "f78":
- id += 78;
- flow.setMatch(createMatch33().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f79":
- id += 79;
- flow.setMatch(createICMPv6Match1().build());
- flow.setInstructions(createDecNwTtlInstructions().build());
- break;
- case "f80":
- id += 80;
- flow.setMatch(createVlanMatch().build());
- flow.setInstructions(createAppyActionInstruction88().build());
- break;
- case "f81":
- id += 81;
- flow.setMatch(createLLDPMatch().build());
- flow.setInstructions(createSentToControllerInstructions().build());
- break;
- case "f82":
- id += 82;
- flow.setMatch(createToSMatch().build());
- flow.setInstructions(createOutputInstructions().build());
- break;
- case "f83":
- id += 83; // Test TCP_Flag Match
- flow.setMatch(createTcpFlagMatch().build());
- flow.setInstructions(createDropInstructions().build());
- break;
- case "f84":
- id += 84;
- flow.setMatch(createVlanMatch().build()); // match vlan=10,dl_vlan_pcp=3
- flow.setInstructions(createAppyActionInstruction88().build()); // vlan_pcp=4
- break;
- case "f85":
- id += 85; // Test Tunnel IPv4 Src (e.g. set_field:172.16.100.200->tun_src)
- flow.setMatch(createMatch3().build());
- flow.setInstructions(createTunnelIpv4SrcInstructions().build());
- break;
- case "f86":
- id += 86; // Test Tunnel IPv4 Dst (e.g. set_field:172.16.100.100->tun_dst)
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createTunnelIpv4DstInstructions().build());
- break;
- default:
- LOG.warn("flow type not understood: {}", flowType);
+ case "f1":
+ id += 1;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createDecNwTtlInstructions().build());
+ break;
+ case "f2":
+ id += 2;
+ flow.setMatch(createMatch2().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f3":
+ id += 3;
+ flow.setMatch(createMatch3().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f4":
+ id += 4;
+ flow.setMatch(createEthernetMatch().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f5":
+ id += 5;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction().build());
+ break;
+ case "f6":
+ id += 6;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createGotoTableInstructions().build());
+ break;
+ case "f7":
+ id += 7;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createMeterInstructions().build());
+ break;
+ case "f8":
+ id += 8;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction1().build());
+ break;
+ case "f9":
+ id += 9;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction2().build());
+ break;
+ case "f10":
+ id += 10;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction3().build());
+ break;
+ case "f11":
+ id += 11;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction4().build());
+ break;
+ case "f12":
+ id += 12;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction5().build());
+ break;
+ case "f13":
+ id += 13;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction6().build());
+ break;
+ case "f14":
+ id += 14;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction7().build());
+ break;
+ case "f15":
+ id += 15;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction8().build());
+ break;
+ case "f16":
+ id += 16;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction9().build());
+ break;
+ case "f17":
+ id += 17;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction10().build());
+ break;
+ case "f18":
+ id += 18;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction11().build());
+ break;
+ case "f19":
+ id += 19;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction12().build());
+ break;
+ case "f20":
+ id += 20;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction13().build());
+ break;
+ case "f21":
+ id += 21;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction14().build());
+ break;
+ case "f22":
+ id += 22;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction15().build());
+ break;
+ case "f23":
+ id += 23;
+ // f23 can be used as test-case for generating error notification
+ // if the particular group is not configured - tested
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction16().build());
+ break;
+ case "f24":
+ id += 24;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction17().build());
+ break;
+ case "f25":
+ id += 25;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction18().build());
+ break;
+ case "f26":
+ id += 26;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction19().build());
+ break;
+ case "f27":
+ id += 27;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createMetadataInstructions().build());
+ break;
+ case "f28":
+ id += 28;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction20().build());
+ break;
+ case "f29":
+ id += 29;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction21().build());
+ break;
+ case "f30":
+ id += 30;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction22().build());
+ break;
+ case "f31":
+ id += 31;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction23(nodeBuilder.getId()).build());
+ break;
+ case "f32":
+ id += 32;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction24().build());
+ break;
+ case "f33":
+ id += 33;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction25().build());
+ break;
+ case "f34":
+ id += 34;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction26().build());
+ break;
+ case "f35":
+ id += 35;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction27().build());
+ break;
+ case "f36":
+ id += 36;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction28().build());
+ break;
+ case "f37":
+ id += 37;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction29().build());
+ break;
+ case "f38":
+ id += 38;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction30().build());
+ break;
+ case "f39":
+ id += 39;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction31().build());
+ break;
+ case "f40":
+ id += 40;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction32().build());
+ break;
+ case "f41":
+ id += 41;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction33().build());
+ break;
+ case "f42":
+ id += 42;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction34().build());
+ break;
+ case "f43":
+ id += 43;
+ flow.setMatch(createICMPv6Match().build());
+ flow.setInstructions(createDecNwTtlInstructions().build());
+ break;
+ case "f44":
+ id += 44;
+ flow.setMatch(createInphyportMatch(nodeBuilder.getId()).build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f45":
+ id += 45;
+ flow.setMatch(createMetadataMatch().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f46":
+ id += 46;
+ flow.setMatch(createL3IPv6Match().build());
+ flow.setInstructions(createDecNwTtlInstructions().build());
+ break;
+ case "f47":
+ id += 47;
+ flow.setMatch(createL4SCTPMatch().build());
+ flow.setInstructions(createAppyActionInstruction().build());
+ break;
+ case "f48":
+ id += 48;
+ flow.setMatch(createTunnelIDMatch().build());
+ flow.setInstructions(createGotoTableInstructions().build());
+ break;
+ case "f49":
+ id += 49;
+ flow.setMatch(createVlanMatch().build());
+ flow.setInstructions(createMeterInstructions().build());
+ break;
+ case "f50":
+ id += 50;
+ flow.setMatch(createPbbMatch().build());
+ flow.setInstructions(createMeterInstructions().build());
+ break;
+ case "f51":
+ id += 51;
+ flow.setMatch(createVlanMatch().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f52":
+ id += 52;
+ flow.setMatch(createL4TCPMatch().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+
+ case "f53":
+ id += 53;
+ flow.setMatch(createL4UDPMatch().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f54":
+ id += 54;
+ flow.setMatch(new MatchBuilder().build());
+ flow.setInstructions(createSentToControllerInstructions().build());
+ flow.setPriority(0);
+ break;
+ case "f55":
+ id += 55;
+ flow.setMatch(createToSMatch().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f56":
+ id += 56;
+ flow.setMatch(createToSMatch().build());
+ flow.setInstructions(createOutputInstructions("INPORT", 10).build());
+ break;
+ case "f57":
+ id += 57;
+ flow.setMatch(createToSMatch().build());
+ flow.setInstructions(createOutputInstructions("FLOOD", 20).build());
+ break;
+ case "f58":
+ id += 58;
+ flow.setMatch(createToSMatch().build());
+ flow.setInstructions(createOutputInstructions("ALL", 30).build());
+ break;
+ case "f59":
+ id += 59;
+ flow.setMatch(createToSMatch().build());
+ flow.setInstructions(createOutputInstructions("NORMAL", 40).build());
+ break;
+ case "f60":
+ id += 60;
+ flow.setMatch(createToSMatch().build());
+ flow.setInstructions(createOutputInstructions("LOCAL", 50).build());
+ break;
+ case "f61":
+ id += 61;
+ flow.setMatch(createToSMatch().build());
+ flow.setInstructions(createOutputInstructions("TABLE", 60).build());
+ break;
+ case "f62":
+ id += 62;
+ flow.setMatch(createToSMatch().build());
+ flow.setInstructions(createOutputInstructions("NONE", 70).build());
+ break;
+ case "f63":
+ id += 63;
+ flow.setMatch(createToSMatch().build());
+ flow.setInstructions(createStripVlanInstructions().build());
+ flow.setBarrier(Boolean.TRUE);
+ break;
+ case "f64":
+ id += 64;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction35().build());
+ break;
+ case "f65":
+ id += 65;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction36().build());
+ break;
+ case "f66":
+ id += 66;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction37().build());
+ break;
+ case "f67":
+ id += 67;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createAppyActionInstruction38().build());
+ break;
+ case "f68":
+ id += 68;
+ flow.setMatch(createL4TCPMatch().build());
+ flow.setInstructions(createAppyActionInstruction39().build());
+ break;
+ case "f69":
+ id += 69;
+ flow.setMatch(createL4UDPMatch().build());
+ flow.setInstructions(createAppyActionInstruction40().build());
+ break;
+ case "f70":
+ id += 70;
+ flow.setMatch(createL4SCTPMatch().build());
+ flow.setInstructions(createAppyActionInstruction41().build());
+ break;
+ case "f71":
+ id += 71;
+ flow.setMatch(createICMPv4Match().build());
+ flow.setInstructions(createAppyActionInstruction42().build());
+ break;
+ case "f72":
+ id += 72;
+ flow.setMatch(createArpMatch().build());
+ flow.setInstructions(createAppyActionInstruction43().build());
+ break;
+ case "f73":
+ id += 73;
+ flow.setMatch(createL3IPv6Match().build());
+ flow.setInstructions(createAppyActionInstruction44().build());
+ break;
+ case "f74":
+ id += 74;
+ flow.setMatch(createICMPv6Match().build());
+ flow.setInstructions(createAppyActionInstruction45().build());
+ break;
+ case "f75":
+ id += 75;
+ flow.setMatch(createMplsMatch().build());
+ flow.setInstructions(createAppyActionInstruction46().build());
+ break;
+ case "f76":
+ id += 76;
+ flow.setMatch(createPbbMatch().build());
+ flow.setInstructions(createAppyActionInstruction47().build());
+ break;
+ case "f77":
+ id += 77;
+ flow.setMatch(createTunnelIDMatch().build());
+ flow.setInstructions(createAppyActionInstruction48().build());
+ break;
+ case "f78":
+ id += 78;
+ flow.setMatch(createMatch33().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f79":
+ id += 79;
+ flow.setMatch(createICMPv6Match1().build());
+ flow.setInstructions(createDecNwTtlInstructions().build());
+ break;
+ case "f80":
+ id += 80;
+ flow.setMatch(createVlanMatch().build());
+ flow.setInstructions(createAppyActionInstruction88().build());
+ break;
+ case "f81":
+ id += 81;
+ flow.setMatch(createLLDPMatch().build());
+ flow.setInstructions(createSentToControllerInstructions().build());
+ break;
+ case "f82":
+ id += 82;
+ flow.setMatch(createToSMatch().build());
+ flow.setInstructions(createOutputInstructions().build());
+ break;
+ case "f83":
+ id += 83; // Test TCP_Flag Match
+ flow.setMatch(createTcpFlagMatch().build());
+ flow.setInstructions(createDropInstructions().build());
+ break;
+ case "f84":
+ id += 84;
+ flow.setMatch(createVlanMatch().build()); // match vlan=10,dl_vlan_pcp=3
+ flow.setInstructions(createAppyActionInstruction88().build()); // vlan_pcp=4
+ break;
+ case "f85":
+ id += 85; // Test Tunnel IPv4 Src (e.g. set_field:172.16.100.200->tun_src)
+ flow.setMatch(createMatch3().build());
+ flow.setInstructions(createTunnelIpv4SrcInstructions().build());
+ break;
+ case "f86":
+ id += 86; // Test Tunnel IPv4 Dst (e.g. set_field:172.16.100.100->tun_dst)
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createTunnelIpv4DstInstructions().build());
+ break;
+ default:
+ LOG.warn("flow type not understood: {}", flowType);
}
FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
return flow;
}
-
+
private FlowBuilder createTestFlow_perfTest(NodeBuilder nodeBuilder, String flowTypeArg, String tableId, int id) {
FlowBuilder flow = new FlowBuilder();
if (flowType == null) {
flowType = "f1";
}
-
+
flow.setPriority(id);
switch (flowType) {
- case "f1":
- id += 1;
- flow.setMatch(createMatch1().build());
- flow.setInstructions(createDecNwTtlInstructions().build());
- break;
- default:
- LOG.warn("flow type not understood: {}", flowType);
+ case "f1":
+ id += 1;
+ flow.setMatch(createMatch1().build());
+ flow.setInstructions(createDecNwTtlInstructions().build());
+ break;
+ default:
+ LOG.warn("flow type not understood: {}", flowType);
}
FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
testFlow = flow;
return flow;
}
+
private FlowBuilder createtablemiss(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
FlowBuilder flow = new FlowBuilder();
long id = 456;
// Create an Apply Action
ApplyActionsBuilder aab = new ApplyActionsBuilder();
aab.setAction(actionList);
-
+
// Wrap our Apply Action in an Instruction
InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
// PBB
ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
- protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask((new BigInteger(new byte[] { 0, 1, 0, 0 }).longValue())).build());
+ protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask((new BigInteger(new byte[]{0, 1, 0, 0}).longValue())).build());
setFieldBuilder.setProtocolMatchFields(protomatch.build());
ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
actionList.add(ab.build());
match.setIpMatch(ipmatch.build());
Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
- // match
+ // match
icmpv6match.setIcmpv6Type((short) 135);
icmpv6match.setIcmpv6Code((short) 1);
match.setIcmpv6Match(icmpv6match.build());
private static MatchBuilder createEthernetMatch() {
MatchBuilder match = new MatchBuilder();
- byte[] mask1 = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
- byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
+ byte[] mask1 = new byte[]{(byte) -1, (byte) -1, 0, 0, 0, 0};
+ byte[] mask2 = new byte[]{(byte) -1, (byte) -1, (byte) -1, 0, 0, 0};
EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
- // match
+ // match
EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
EtherType type = new EtherType(0x0800L);
ethmatch.setEthernetType(ethtype.setType(type).build());
EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet
- // macaddress
- // match
+ // macaddress
+ // match
MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
ethdest.setAddress(macdest);
ethdest.setMask(new MacAddress("ff:ff:ff:00:00:00"));
MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
- byte[] mask = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
- byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
+ byte[] mask = new byte[]{(byte) -1, (byte) -1, 0, 0, 0, 0};
+ byte[] mask2 = new byte[]{(byte) -1, (byte) -1, (byte) -1, 0, 0, 0};
EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
EtherType type = new EtherType(0x0806L);
ipv6label.setFlabelMask(new Ipv6FlowLabel(1L));
Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
- // match
+ // match
icmpv6match.setIcmpv6Type((short) 135);
icmpv6match.setIcmpv6Code((short) 0);
match.setIcmpv6Match(icmpv6match.build());
match.setIpMatch(ipmatch.build());
Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder(); // icmpv4
- // match
+ // match
icmpv4match.setIcmpv4Type((short) 8);
icmpv4match.setIcmpv4Code((short) 0);
match.setIcmpv4Match(icmpv4match.build());
match.setIpMatch(ipmatch.build());
Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
- // match
+ // match
icmpv6match.setIcmpv6Type((short) 135);
icmpv6match.setIcmpv6Code((short) 1);
match.setIcmpv6Match(icmpv6match.build());
*/
private static MatchBuilder createMetadataMatch() {
MatchBuilder match = new MatchBuilder();
- byte[] metamask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
+ byte[] metamask = new byte[]{(byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1};
MetadataBuilder metadata = new MetadataBuilder(); // metadata match
metadata.setMetadata(BigInteger.valueOf(500L));
metadata.setMetadataMask(new BigInteger(metamask));
ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
// match
- protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new BigInteger(new byte[] { 0, 1, 0, 0 }).longValue()).build());
+ protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new BigInteger(new byte[]{0, 1, 0, 0}).longValue()).build());
match.setProtocolMatchFields(protomatch.build());
return match;
MatchBuilder match = new MatchBuilder();
TunnelBuilder tunnel = new TunnelBuilder(); // tunnel id match
tunnel.setTunnelId(BigInteger.valueOf(10668));
- byte[] mask = new byte[] {(byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
+ byte[] mask = new byte[]{(byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1};
tunnel.setTunnelMask(new BigInteger(1, mask));
match.setTunnel(tunnel.build());
/**
* Test match for TCP_Flags
+ *
* @return match containing Ethertype (0x0800), IP Protocol (TCP), TCP_Flag (SYN)
*/
//FIXME: move to extensible support
tcpMatch.setTcpDestinationPort(dstPort);
match.setLayer4Match(tcpMatch.build());
/**
- * Defined TCP Flag values in OVS v2.1+
- * TCP_FIN 0x001 / TCP_SYN 0x002 / TCP_RST 0x004
- * TCP_PSH 0x008 / TCP_ACK 0x010 / TCP_URG 0x020
- * TCP_ECE 0x040 / TCP_CWR 0x080 / TCP_NS 0x100
- */
+ * Defined TCP Flag values in OVS v2.1+
+ * TCP_FIN 0x001 / TCP_SYN 0x002 / TCP_RST 0x004
+ * TCP_PSH 0x008 / TCP_ACK 0x010 / TCP_URG 0x020
+ * TCP_ECE 0x040 / TCP_CWR 0x080 / TCP_NS 0x100
+ */
TcpFlagMatchBuilder tcpFlagMatch = new TcpFlagMatchBuilder();
tcpFlagMatch.setTcpFlag(0x002);
match.setTcpFlagMatch(tcpFlagMatch.build());
}
public void _removeMDFlow(CommandInterpreter ci) {
- DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
+ ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
NodeBuilder tn = createTestNode(ci.nextArgument());
String flowtype = ci.nextArgument();
FlowBuilder tf;
InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class).child(Node.class, tn.getKey())
.augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf.getTableId()))
.child(Flow.class, tf.getKey()).build();
- modification.removeConfigurationData(path1);
+ modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
try {
RpcResult<TransactionStatus> result = commitFuture.get();
/**
* @param ci arguments: switchId flowType tableNum
- *
- * <pre>
- * e.g.: addMDFlow openflow:1 f1 42
- * </pre>
+ * <p/>
+ * <pre>
+ * e.g.: addMDFlow openflow:1 f1 42
+ * </pre>
*/
public void _addMDFlow(CommandInterpreter ci) {
NodeBuilder tn = createTestNode(ci.nextArgument());
}
private void writeFlow(CommandInterpreter ci, FlowBuilder flow, NodeBuilder nodeBuilder) {
- DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
+ ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
.child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.getKey()).build();
- modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
- modification.putConfigurationData(path1, flow.build());
+ modification.put(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
+ modification.put(LogicalDatastoreType.CONFIGURATION, path1, flow.build());
Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
try {
RpcResult<TransactionStatus> result = commitFuture.get();
public String getHelp() {
return "No help";
}
-
+
/*
* usage testSwitchFlows <numberOfSwitches> <numberOfFlows> <warmup iterations> <Number Of Threads>
* ex: _perfFlowTest 10 5 1 2
*/
public void _perfFlowTest(CommandInterpreter ci) {
-
+
String numberOfSwtichesStr = ci.nextArgument();
String numberOfFlowsStr = ci.nextArgument();
String warmupIterationsStr = ci.nextArgument();
String threadCountStr = ci.nextArgument();
String warmUpStr = ci.nextArgument();
-
+
Collection<String> testResults = null;
- if(testResults == null){
- testResults = new ArrayList<String>();
+ if (testResults == null) {
+ testResults = new ArrayList<String>();
}
-
+
int numberOfSwtiches = 0;
int numberOfFlows = 0;
int warmupIterations = 0;
boolean warmUpIterations = false;
int threadCount = 0;
- if(numberOfSwtichesStr !=null && !numberOfSwtichesStr.trim().equals("")){
- numberOfSwtiches = new Integer(numberOfSwtichesStr).intValue();
- }else {
- numberOfSwtiches = 2;
+ if (numberOfSwtichesStr != null && !numberOfSwtichesStr.trim().equals("")) {
+ numberOfSwtiches = new Integer(numberOfSwtichesStr).intValue();
+ } else {
+ numberOfSwtiches = 2;
}
-
- if(numberOfFlowsStr !=null && !numberOfFlowsStr.trim().equals("")){
- numberOfFlows = new Integer(numberOfFlowsStr).intValue();
- }else {
- numberOfFlows = 2;
+
+ if (numberOfFlowsStr != null && !numberOfFlowsStr.trim().equals("")) {
+ numberOfFlows = new Integer(numberOfFlowsStr).intValue();
+ } else {
+ numberOfFlows = 2;
}
-
- if(warmupIterationsStr !=null && !warmupIterationsStr.trim().equals("")){
- warmupIterations = new Integer(warmupIterationsStr).intValue();
- }else {
- warmupIterations = 2;
+
+ if (warmupIterationsStr != null && !warmupIterationsStr.trim().equals("")) {
+ warmupIterations = new Integer(warmupIterationsStr).intValue();
+ } else {
+ warmupIterations = 2;
}
-
- if(threadCountStr !=null && !threadCountStr.trim().equals("")){
- threadCount = new Integer(threadCountStr).intValue();
- }else {
- threadCount = 2;
+
+ if (threadCountStr != null && !threadCountStr.trim().equals("")) {
+ threadCount = new Integer(threadCountStr).intValue();
+ } else {
+ threadCount = 2;
+ }
+ if (warmUpStr != null && !warmUpStr.trim().equals("") && warmUpStr.trim().equals("true")) {
+ warmUpIterations = true;
+ } else {
+ warmUpIterations = false;
}
- if(warmUpStr !=null && !warmUpStr.trim().equals("") && warmUpStr.trim().equals("true")){
- warmUpIterations = true;
- }else {
- warmUpIterations = false;
- }
ci.println("* Test Configurations*");
- ci.println("* numberOfSwtiches:::"+numberOfSwtiches+"");
- ci.println("* numberOfFlows:::"+numberOfFlows+"");
- ci.println("* warmupIterations:::"+warmupIterations+"");
- ci.println("* Number of Threads :::"+threadCount+"");
- ci.println("* Warmup Required? :::"+warmUpIterations+"");
-
- String dataPath="openflow:1";
+ ci.println("* numberOfSwtiches:::" + numberOfSwtiches + "");
+ ci.println("* numberOfFlows:::" + numberOfFlows + "");
+ ci.println("* warmupIterations:::" + warmupIterations + "");
+ ci.println("* Number of Threads :::" + threadCount + "");
+ ci.println("* Warmup Required? :::" + warmUpIterations + "");
+
+ String dataPath = "openflow:1";
String flowType = "fTM";
NodeBuilder tn;
FlowBuilder tf;
String tableId = "0";
- if(warmUpIterations){
- ci.println("----Warmup Started-----");
- for(int j =1; j<= warmupIterations; j++){
- for(int i =1;i<=numberOfSwtiches;i++){
- dataPath = "openflow:"+i;
- tn = createTestNode(dataPath);
- for (int flow=1;flow<numberOfFlows;flow++){
- tf = createTestFlow_perfTest(tn, "f1", tableId, flow);
- writeFlow(ci, tf, tn);
- }
- }
- }
-
- ci.println("----Warmup Done-----");
+ if (warmUpIterations) {
+ ci.println("----Warmup Started-----");
+ for (int j = 1; j <= warmupIterations; j++) {
+ for (int i = 1; i <= numberOfSwtiches; i++) {
+ dataPath = "openflow:" + i;
+ tn = createTestNode(dataPath);
+ for (int flow = 1; flow < numberOfFlows; flow++) {
+ tf = createTestFlow_perfTest(tn, "f1", tableId, flow);
+ writeFlow(ci, tf, tn);
+ }
+ }
+ }
+
+ ci.println("----Warmup Done-----");
+ }
+ try {
+ ExecutorService executor = Executors.newFixedThreadPool(threadCount);
+ int flowID = 0;
+ int tableID = 0;
+ for (int t = 0; t < threadCount; t++) {
+ tableID = t + 1;
+ Runnable tRunnable = new TestFlowThread(numberOfSwtiches, numberOfFlows, ci, t, tableID);
+ executor.execute(tRunnable);
+ }
+ executor.shutdown();
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (Exception e) {
+ ci.println("Exception:" + e.getMessage());
}
- try{
- ExecutorService executor = Executors.newFixedThreadPool(threadCount);
- int flowID = 0;
- int tableID = 0;
- for ( int t=0;t< threadCount;t++){
- tableID = t+1;
- Runnable tRunnable = new TestFlowThread(numberOfSwtiches, numberOfFlows, ci, t, tableID);
- executor.execute(tRunnable);
- }
- executor.shutdown();
- executor.awaitTermination(1, TimeUnit.SECONDS);
- } catch(Exception e){
- ci.println("Exception:"+e.getMessage());
- }
- }
-
+ }
+
public class TestFlowThread implements Runnable {
int numberOfSwitches;
dataPath = "openflow:" + i;
tn = createTestNode(dataPath);
for (int flow2 = 1; flow2 <= this.numberOfFlows; flow2++) {
- tf = createTestFlow_perfTest(tn, "f1", ""+this.tableID, flow2);
+ tf = createTestFlow_perfTest(tn, "f1", "" + this.tableID, flow2);
writeFlow(this.ci, tf, tn);
totalNumberOfFlows++;
}
}
}
+
/*
* usage testAllFlows <dp>
* ex: _perfFlowTest 1
*/
public void _testAllFlows(CommandInterpreter ci) {
- String dataPathID = ci.nextArgument();
- int numberOfFlows = 82;
+ String dataPathID = ci.nextArgument();
+ int numberOfFlows = 82;
int threadCount = 0;
- if(dataPathID ==null || dataPathID.trim().equals("")){
- dataPathID = "1";
+ if (dataPathID == null || dataPathID.trim().equals("")) {
+ dataPathID = "1";
}
ci.println("* Test All Flows *");
- ci.println("* dataPathID:::"+dataPathID+"");
- String dataPath="openflow:"+dataPathID;
+ ci.println("* dataPathID:::" + dataPathID + "");
+ String dataPath = "openflow:" + dataPathID;
String tableId = "0";
NodeBuilder tn = createTestNode(dataPath);
FlowBuilder tf;
- for (int flow=1;flow<numberOfFlows;flow++){
- String flowID = "f"+flow;
- try{
- tf = createTestFlow(tn, flowID, tableId);
- writeFlow(ci, tf, tn);
- } catch(Exception e){
- ci.println("--Test Failed--Issue found while adding flow"+ flow);
- break;
- }
- }
+ for (int flow = 1; flow < numberOfFlows; flow++) {
+ String flowID = "f" + flow;
+ try {
+ tf = createTestFlow(tn, flowID, tableId);
+ writeFlow(ci, tf, tn);
+ } catch (Exception e) {
+ ci.println("--Test Failed--Issue found while adding flow" + flow);
+ break;
+ }
+ }
}
}
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.controller.sal.binding.api.data.DataBrokerService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemoved;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRemoved;
private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
- private DataBrokerService dataBrokerService;
+ private DataBroker dataBroker;
private ProviderContext pc;
private final BundleContext ctx;
private final PortEventListener portEventListener = new PortEventListener();
notificationService = session.getSALService(NotificationService.class);
// For switch events
listenerReg = notificationService.registerNotificationListener(portEventListener);
- dataBrokerService = session.getSALService(DataBrokerService.class);
+ dataBroker = session.getSALService(DataBroker.class);
}
final class PortEventListener implements OpendaylightInventoryListener {
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration
import org.opendaylight.controller.sal.binding.api.NotificationProviderService
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.controller.md.sal.binding.api.DataBroker
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
static val LOG = LoggerFactory.getLogger(OpenflowpluginTestServiceProvider);
@Property
- DataProviderService dataService;
+ DataBroker dataService;
@Property
RoutedRpcRegistration<SalFlowService> flowRegistration;
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.controller.sal.binding.api.data.DataBrokerService;
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.LinkDiscovered;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkOverutilized;
private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
- private DataBrokerService dataBrokerService;
+ private DataBroker dataBroker;
private ProviderContext pc;
private final BundleContext ctx;
private final TopologyEventListener topologyEventListener = new TopologyEventListener();
notificationService = session.getSALService(NotificationService.class);
// For switch events
listenerReg = notificationService.registerNotificationListener(topologyEventListener);
- dataBrokerService = session.getSALService(DataBrokerService.class);
+ dataBroker = session.getSALService(DataBroker.class);
}
final class TopologyEventListener implements FlowTopologyDiscoveryListener {