+/*
+ * Copyright (c) 2014, 2015 Ericsson, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.openflowplugin.test;
-import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
import java.math.BigInteger;
import java.util.ArrayList;
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.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.NotificationService;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationService;
+import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.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.group.types.rev131018.groups.GroupBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.NodeErrorListener;
-import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-//import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.M
-
+@SuppressWarnings("checkstyle:MethodName")
public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvider {
private static final Logger LOG = LoggerFactory.getLogger(OpenflowPluginBulkGroupTransactionProvider.class);
- private NodeBuilder testNode;
- private DataBroker dataBroker;
+ private final DataBroker dataBroker;
private final BundleContext ctx;
- private ProviderContext pc;
- private FlowBuilder testFlow;
private final String originalFlowName = "Foo";
private final NodeErrorListener nodeErrorListener = new NodeErrorListenerLoggingImpl();
- private Registration listener1Reg;
- private Registration listener2Reg;
- private Group testGroup;
- private Group testGroup2;
private Node testNode12;
private final String originalGroupName = "Foo";
- private static NotificationService notificationService;
+ private final NotificationService notificationService;
- public OpenflowPluginBulkGroupTransactionProvider(BundleContext ctx) {
+ public OpenflowPluginBulkGroupTransactionProvider(DataBroker dataBroker, NotificationService notificationService,
+ BundleContext ctx) {
+ this.dataBroker = dataBroker;
+ this.notificationService = notificationService;
this.ctx = ctx;
}
- public void onSessionInitiated(ProviderContext session) {
- pc = session;
- notificationService = session.getSALService(NotificationService.class);
- listener2Reg = notificationService.registerNotificationListener(nodeErrorListener);
- dataBroker = session.getSALService(DataBroker.class);
+ public void init() {
+ notificationService.registerNotificationListener(nodeErrorListener);
ctx.registerService(CommandProvider.class.getName(), this, null);
createTestFlow(createTestNode(null), null, null);
}
if (nodeId == null) {
nodeId = OpenflowpluginTestActivator.NODE_ID;
}
- NodeRef nodeOne = createNodeRef(nodeId);
NodeBuilder builder = new NodeBuilder();
builder.setId(new NodeId(nodeId));
- builder.setKey(new NodeKey(builder.getId()));
- testNode = builder;
+ builder.withKey(new NodeKey(builder.getId()));
return builder;
}
- private static NodeRef createNodeRef(String string) {
- NodeKey key = new NodeKey(new NodeId(string));
- InstanceIdentifier<Node> path = InstanceIdentifier.create(Nodes.class).child(Node.class, key);
- return new NodeRef(path);
+ private void createTestNode() {
+ NodeBuilder builder = new NodeBuilder();
+ builder.setId(new NodeId(OpenflowpluginTestActivator.NODE_ID));
+ builder.withKey(new NodeKey(builder.getId()));
+ testNode12 = builder.build();
}
@Override
return "No help";
}
- /**
- * @return
- */
private static MatchBuilder createMatch1() {
MatchBuilder match = new MatchBuilder();
Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
return match;
}
- /**
- * @return
- */
private static InstructionsBuilder createDecNwTtlInstructions() {
DecNwTtlBuilder ta = new DecNwTtlBuilder();
DecNwTtl decNwTtl = ta.build();
ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
// Add our drop action to a list
- List<Action> actionList = new ArrayList<Action>();
+ List<Action> actionList = new ArrayList<>();
actionList.add(ab.build());
// Create an Apply Action
// Wrap our Apply Action in an Instruction
InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
- ib.setKey(new InstructionKey(0));
+ ib.withKey(new InstructionKey(0));
ib.setOrder(0);
// Put our Instruction in a list of Instructions
InstructionsBuilder isb = new InstructionsBuilder();
- List<Instruction> instructions = new ArrayList<Instruction>();
+ List<Instruction> instructions = new ArrayList<>();
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
}
- /**
- * @return
- */
private static MatchBuilder createMatch2() {
MatchBuilder match = new MatchBuilder();
Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
return match;
}
- /**
- * @return
- */
private static MatchBuilder createMatch3() {
MatchBuilder match = new MatchBuilder();
EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build());
// Add our drop action to a list
- List<Action> actionList = new ArrayList<Action>();
+ List<Action> actionList = new ArrayList<>();
actionList.add(ab.build());
// Create an Apply Action
// Put our Instruction in a list of Instructions
InstructionsBuilder isb = new InstructionsBuilder();
- List<Instruction> instructions = new ArrayList<Instruction>();
+ List<Instruction> instructions = new ArrayList<>();
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
}
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};
-
EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
// match
EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
// ethsrc.setMask(mask2);
ethmatch.setEthernetSource(ethsrc.build());
+ MatchBuilder match = new MatchBuilder();
match.setEthernetMatch(ethmatch.build());
return match;
}
- /**
- * @return
- */
private static InstructionsBuilder createMeterInstructions() {
MeterBuilder aab = new MeterBuilder();
- aab.setMeterId(new MeterId(new Long(1)));
+ aab.setMeterId(new MeterId(1L));
InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
// Put our Instruction in a list of Instructions
InstructionsBuilder isb = new InstructionsBuilder();
- List<Instruction> instructions = new ArrayList<Instruction>();
+ List<Instruction> instructions = new ArrayList<>();
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
private static InstructionsBuilder createAppyActionInstruction() {
- List<Action> actionList = new ArrayList<Action>();
+ List<Action> actionList = new ArrayList<>();
ActionBuilder ab = new ActionBuilder();
ControllerActionBuilder controller = new ControllerActionBuilder();
controller.setMaxLength(5);
// Put our Instruction in a list of Instructions
InstructionsBuilder isb = new InstructionsBuilder();
- List<Instruction> instructions = new ArrayList<Instruction>();
+ List<Instruction> instructions = new ArrayList<>();
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
private static InstructionsBuilder createAppyActionInstruction7() {
- List<Action> actionList = new ArrayList<Action>();
+ List<Action> actionList = new ArrayList<>();
ActionBuilder ab = new ActionBuilder();
SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
- VlanId a = new VlanId(4012);
- vl.setVlanId(a);
+ VlanId vlanId = new VlanId(4012);
+ vl.setVlanId(vlanId);
ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
actionList.add(ab.build());
// Create an Apply Action
// Put our Instruction in a list of Instructions
InstructionsBuilder isb = new InstructionsBuilder();
- List<Instruction> instructions = new ArrayList<Instruction>();
+ List<Instruction> instructions = new ArrayList<>();
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
private static InstructionsBuilder createAppyActionInstruction21() {
- List<Action> actionList = new ArrayList<Action>();
+ List<Action> actionList = new ArrayList<>();
ActionBuilder ab = new ActionBuilder();
PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder();
// Put our Instruction in a list of Instructions
InstructionsBuilder isb = new InstructionsBuilder();
- List<Instruction> instructions = new ArrayList<Instruction>();
+ List<Instruction> instructions = new ArrayList<>();
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
private static InstructionsBuilder createAppyActionInstruction2() {
- List<Action> actionList = new ArrayList<Action>();
+ List<Action> actionList = new ArrayList<>();
ActionBuilder ab = new ActionBuilder();
PushMplsActionBuilder push = new PushMplsActionBuilder();
- push.setEthernetType(new Integer(0x8847));
+ push.setEthernetType(0x8847);
ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
actionList.add(ab.build());
// Create an Apply Action
// Put our Instruction in a list of Instructions
InstructionsBuilder isb = new InstructionsBuilder();
- List<Instruction> instructions = new ArrayList<Instruction>();
+ List<Instruction> instructions = new ArrayList<>();
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
private static InstructionsBuilder createAppyActionInstruction3() {
- List<Action> actionList = new ArrayList<Action>();
+ List<Action> actionList = new ArrayList<>();
ActionBuilder ab = new ActionBuilder();
PushPbbActionBuilder pbb = new PushPbbActionBuilder();
- pbb.setEthernetType(new Integer(0x88E7));
+ pbb.setEthernetType(0x88E7);
ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
actionList.add(ab.build());
// Create an Apply Action
// Put our Instruction in a list of Instructions
InstructionsBuilder isb = new InstructionsBuilder();
- List<Instruction> instructions = new ArrayList<Instruction>();
+ List<Instruction> instructions = new ArrayList<>();
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
// Put our Instruction in a list of Instructions
InstructionsBuilder isb = new InstructionsBuilder();
- List<Instruction> instructions = new ArrayList<Instruction>();
+ List<Instruction> instructions = new ArrayList<>();
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
LOG.warn("flow type not understood: {}", flowType);
}
- FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
+ final FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
if (null == flow.isBarrier()) {
flow.setBarrier(Boolean.FALSE);
}
- // flow.setBufferId(new Long(12));
- BigInteger value = new BigInteger("10", 10);
- BigInteger outputPort = new BigInteger("4294967295", 10);
+ // flow.setBufferId(12L);
+ BigInteger value = BigInteger.valueOf(10);
+ BigInteger outputPort = BigInteger.valueOf(4294967295L);
flow.setCookie(new FlowCookie(value));
flow.setCookieMask(new FlowCookie(value));
flow.setHardTimeout(0);
flow.setFlags(new FlowModFlags(false, false, false, false, true));
flow.setId(new FlowId("12"));
flow.setTableId(getTableId(tableId));
- flow.setOutGroup(new Long("4294967295"));
+ flow.setOutGroup(4294967295L);
// set outport to OFPP_NONE (65535) to disable remove restriction for
// flow
flow.setOutPort(outputPort);
- flow.setKey(key);
+ flow.withKey(key);
flow.setPriority(2);
flow.setFlowName(originalFlowName + "X" + flowType);
- testFlow = flow;
return flow;
}
private short getTableId(String tableId) {
short table = 2;
+ if (tableId == null) {
+ return table;
+ }
+
try {
table = Short.parseShort(tableId);
- } catch (Exception ex) {
+ } catch (NumberFormatException ex) {
// ignore exception and continue with default value
}
GroupBuilder group7 = createTestGroup("a3", "g1", "add", "6");
writeGroup(ci, group6.build(), group7.build());
break;
-
+ default:
+ break;
}
-
}
private void createUserNode(String nodeRef) {
- NodeRef nodeOne = createNodeRef(nodeRef);
NodeBuilder builder = new NodeBuilder();
builder.setId(new NodeId(nodeRef));
- builder.setKey(new NodeKey(builder.getId()));
+ builder.withKey(new NodeKey(builder.getId()));
testNode12 = builder.build();
}
GroupBuilder group7 = createTestGroup("a29", "g1", "modify", "6");
writeGroup(ci, group6.build(), group7.build());
break;
+ default:
+ break;
}
}
private InstanceIdentifier<Node> nodeToInstanceId(Node node) {
- return InstanceIdentifier.create(Nodes.class).child(Node.class, node.getKey());
- }
-
- private void createTestNode() {
- NodeRef nodeOne = createNodeRef(OpenflowpluginTestActivator.NODE_ID);
- NodeBuilder builder = new NodeBuilder();
- builder.setId(new NodeId(OpenflowpluginTestActivator.NODE_ID));
- builder.setKey(new NodeKey(builder.getId()));
- testNode12 = builder.build();
+ return InstanceIdentifier.create(Nodes.class).child(Node.class, node.key());
}
public void _removeGroups(CommandInterpreter ci) {
GroupBuilder group15 = createTestGroup("a29", "g1", "modify", "6");
writeGroup(ci, group14.build(), group15.build());
break;
-
+ default:
+ break;
}
-
}
private void writeGroup(final CommandInterpreter ci, Group group, Group group1) {
ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Group> path1 = InstanceIdentifier.create(Nodes.class)
- .child(Node.class, testNode12.getKey()).augmentation(FlowCapableNode.class)
+ .child(Node.class, testNode12.key()).augmentation(FlowCapableNode.class)
.child(Group.class, new GroupKey(group.getGroupId()));
modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode12), testNode12, true);
modification.merge(LogicalDatastoreType.CONFIGURATION, path1, group, true);
InstanceIdentifier<Group> path2 = InstanceIdentifier.create(Nodes.class)
- .child(Node.class, testNode12.getKey()).augmentation(FlowCapableNode.class)
+ .child(Node.class, testNode12.key()).augmentation(FlowCapableNode.class)
.child(Group.class, new GroupKey(group1.getGroupId()));
modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode12), testNode12, true);
modification.merge(LogicalDatastoreType.CONFIGURATION, path2, group1, true);
- CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
- Futures.addCallback(commitFuture, new FutureCallback<Void>() {
+ modification.commit().addCallback(new FutureCallback<Object>() {
@Override
- public void onSuccess(Void aVoid) {
+ public void onSuccess(Object notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
@Override
public void onFailure(Throwable throwable) {
- ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s",throwable));
+ ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
}
- });
+ }, MoreExecutors.directExecutor());
}
private void deleteGroup(final CommandInterpreter ci, Group group, Group group1) {
ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Group> path1 = InstanceIdentifier.create(Nodes.class)
- .child(Node.class, testNode12.getKey()).augmentation(FlowCapableNode.class)
+ .child(Node.class, testNode12.key()).augmentation(FlowCapableNode.class)
.child(Group.class, new GroupKey(group.getGroupId()));
modification.delete(LogicalDatastoreType.OPERATIONAL, path1);
modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
InstanceIdentifier<Group> path2 = InstanceIdentifier.create(Nodes.class)
- .child(Node.class, testNode12.getKey()).augmentation(FlowCapableNode.class)
+ .child(Node.class, testNode12.key()).augmentation(FlowCapableNode.class)
.child(Group.class, new GroupKey(group1.getGroupId()));
modification.delete(LogicalDatastoreType.OPERATIONAL, path2);
modification.delete(LogicalDatastoreType.CONFIGURATION, path2);
- CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
- Futures.addCallback(commitFuture, new FutureCallback<Void>() {
+ modification.commit().addCallback(new FutureCallback<Object>() {
@Override
- public void onSuccess(Void aVoid) {
+ public void onSuccess(Object notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
@Override
public void onFailure(Throwable throwable) {
- ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s",throwable));
+ ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
}
- });
+ }, MoreExecutors.directExecutor());
}
- private GroupBuilder createTestGroup(String actiontype, String type, String mod, String iD) {
+ private GroupBuilder createTestGroup(String actionType, String groupType, String groupmod, String strId) {
// Sample data , committing to DataStore
- String GroupType = type;
- String ActionType = actiontype;
- String Groupmod = mod;
-
- long id = Long.parseLong(iD);
- GroupKey key = new GroupKey(new GroupId(id));
GroupBuilder group = new GroupBuilder();
BucketBuilder bucket = new BucketBuilder();
bucket.setBucketId(new BucketId((long) 12));
- bucket.setKey(new BucketKey(new BucketId((long) 12)));
+ bucket.withKey(new BucketKey(new BucketId((long) 12)));
- if (GroupType == null) {
- GroupType = "g1";
+ if (groupType == null) {
+ groupType = "g1";
}
- if (ActionType == null) {
- ActionType = "a1";
+ if (actionType == null) {
+ actionType = "a1";
}
- switch (GroupType) {
+ switch (groupType) {
case "g1":
group.setGroupType(GroupTypes.GroupSelect);
break;
case "g4":
group.setGroupType(GroupTypes.GroupFf);
break;
+ default:
+ break;
}
- switch (ActionType) {
+ switch (actionType) {
case "a1":
bucket.setAction(createPopVlanAction());
break;
bucket.setAction(createPopPbbAction());
break;
case "a6":
- bucket.setAction(createPushPbbAction());
- break;
case "a7":
bucket.setAction(createPushPbbAction());
break;
case "a29":
bucket.setAction(createNonAppyPushVlanAction());
break;
-
+ default:
+ break;
}
- if (Groupmod == "add") {
+ if ("add".equals(groupmod)) {
bucket.setWatchGroup((long) 14);
bucket.setWatchPort((long) 1234);
bucket.setWeight(50);
bucket.setWatchPort((long) 134);
bucket.setWeight(30);
}
- group.setKey(key);
+
+ long id = Long.parseLong(strId);
+ GroupKey key = new GroupKey(new GroupId(id));
+ group.withKey(key);
// group.setInstall(false);
group.setGroupId(new GroupId(id));
group.setGroupName(originalGroupName);
group.setBarrier(false);
BucketsBuilder value = new BucketsBuilder();
- List<Bucket> value1 = new ArrayList<Bucket>();
+ List<Bucket> value1 = new ArrayList<>();
value1.add(bucket.build());
value.setBucket(value1);
group.setBuckets(value.build());
- testGroup = group.build();
return group;
}
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>();
+ action.withKey(new ActionKey(0));
+ List<Action> actions = new ArrayList<>();
actions.add(action.build());
return actions;
}
private List<Action> createPushVlanAction() {
PushVlanActionBuilder vlan = new PushVlanActionBuilder();
- vlan.setEthernetType(new Integer(0x8100));
- VlanId v = new VlanId(2);
- vlan.setVlanId(v);
+ vlan.setEthernetType(0x8100);
+ VlanId vlanId = new VlanId(2);
+ vlan.setVlanId(vlanId);
ActionBuilder action = new ActionBuilder();
action.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
- List<Action> actions = new ArrayList<Action>();
+ List<Action> actions = new ArrayList<>();
actions.add(action.build());
return actions;
}
private List<Action> createPushMplsAction() {
PushMplsActionBuilder push = new PushMplsActionBuilder();
- push.setEthernetType(new Integer(0x8847));
+ push.setEthernetType(0x8847);
ActionBuilder action = new ActionBuilder();
action.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
- List<Action> actions = new ArrayList<Action>();
+ List<Action> actions = new ArrayList<>();
actions.add(action.build());
return actions;
}
popMplsActionBuilder.setEthernetType(0XB);
ActionBuilder action = new ActionBuilder();
action.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
- List<Action> actions = new ArrayList<Action>();
+ List<Action> actions = new ArrayList<>();
actions.add(action.build());
return actions;
}
PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
ActionBuilder action = new ActionBuilder();
action.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
- List<Action> actions = new ArrayList<Action>();
+ List<Action> actions = new ArrayList<>();
actions.add(action.build());
return actions;
}
private List<Action> createPushPbbAction() {
PushPbbActionBuilder pbb = new PushPbbActionBuilder();
- pbb.setEthernetType(new Integer(0x88E7));
+ pbb.setEthernetType(0x88E7);
ActionBuilder action = new ActionBuilder();
action.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
- List<Action> actions = new ArrayList<Action>();
+ List<Action> actions = new ArrayList<>();
actions.add(action.build());
return actions;
}
CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
ActionBuilder action = new ActionBuilder();
action.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
- List<Action> actions = new ArrayList<Action>();
+ List<Action> actions = new ArrayList<>();
actions.add(action.build());
return actions;
}
CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
ActionBuilder action = new ActionBuilder();
action.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
- List<Action> actions = new ArrayList<Action>();
+ List<Action> actions = new ArrayList<>();
actions.add(action.build());
return actions;
}
DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
ActionBuilder action = new ActionBuilder();
action.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
- List<Action> actions = new ArrayList<Action>();
+ List<Action> actions = new ArrayList<>();
actions.add(action.build());
return actions;
}
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>();
+ action.withKey(new ActionKey(0));
+ List<Action> actions = new ArrayList<>();
actions.add(action.build());
return actions;
}
private static List<Action> createNonAppyPushVlanAction() {
- List<Action> actionList = new ArrayList<Action>();
ActionBuilder ab = new ActionBuilder();
GroupActionBuilder groupActionB = new GroupActionBuilder();
groupActionB.setGroupId(1L);
groupActionB.setGroup("0");
ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
+
+ List<Action> actionList = new ArrayList<>();
actionList.add(ab.build());
return actionList;
}
-
}