2 * Copyright (c) 2013 Ericsson , Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.openflowplugin.test;
11 import java.math.BigInteger;
12 import java.util.ArrayList;
13 import java.util.List;
14 import java.util.concurrent.ExecutionException;
15 import java.util.concurrent.Future;
16 import java.util.List;
17 import java.util.concurrent.ExecutionException;
18 import java.util.concurrent.ExecutorService;
19 import java.util.concurrent.Executors;
20 import java.util.concurrent.Future;
21 import java.util.concurrent.TimeUnit;
22 import java.util.Collection;
23 import java.util.Iterator;
25 import org.eclipse.osgi.framework.console.CommandInterpreter;
26 import org.eclipse.osgi.framework.console.CommandProvider;
27 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
28 import org.opendaylight.controller.md.sal.common.api.data.DataModification;
29 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
30 import org.opendaylight.controller.sal.binding.api.NotificationService;
31 import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
32 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
33 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
34 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
35 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6FlowLabel;
36 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Prefix;
37 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
38 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
39 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionCaseBuilder;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCaseBuilder;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCaseBuilder;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCaseBuilder;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCaseBuilder;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodActionCaseBuilder;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAllActionCaseBuilder;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCaseBuilder;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.HwPathActionCaseBuilder;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.LoopbackActionCaseBuilder;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCaseBuilder;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopPbbActionCaseBuilder;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCaseBuilder;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCaseBuilder;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCaseBuilder;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCaseBuilder;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCaseBuilder;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCaseBuilder;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlTypeActionCaseBuilder;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCaseBuilder;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNextHopActionCaseBuilder;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCaseBuilder;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionCaseBuilder;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCaseBuilder;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCaseBuilder;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCaseBuilder;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCaseBuilder;
72 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanCfiActionCaseBuilder;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCaseBuilder;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.StripVlanActionCaseBuilder;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SwPathActionCaseBuilder;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.controller.action._case.ControllerActionBuilder;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.in._case.CopyTtlInBuilder;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.out._case.CopyTtlOutBuilder;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.mpls.ttl._case.DecMplsTtlBuilder;
81 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtl;
82 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder;
83 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropAction;
84 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder;
85 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.action._case.FloodActionBuilder;
86 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.all.action._case.FloodAllActionBuilder;
87 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder;
88 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.hw.path.action._case.HwPathActionBuilder;
89 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.loopback.action._case.LoopbackActionBuilder;
90 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder;
91 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
92 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbActionBuilder;
93 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder;
94 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder;
95 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder;
96 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder;
97 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstActionBuilder;
98 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder;
99 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.type.action._case.SetDlTypeActionBuilder;
100 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;
101 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlActionBuilder;
102 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.next.hop.action._case.SetNextHopActionBuilder;
103 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder;
104 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder;
105 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.tos.action._case.SetNwTosActionBuilder;
106 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder;
107 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.queue.action._case.SetQueueActionBuilder;
108 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstActionBuilder;
109 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder;
110 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.cfi.action._case.SetVlanCfiActionBuilder;
111 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder;
112 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.pcp.action._case.SetVlanPcpActionBuilder;
113 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.strip.vlan.action._case.StripVlanActionBuilder;
114 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.sw.path.action._case.SwPathActionBuilder;
115 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
116 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
117 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
118 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
119 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
120 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
121 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
122 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
123 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
124 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
125 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
126 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowListener;
127 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
128 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
129 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.OutputPortValues;
130 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
131 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
132 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
133 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCaseBuilder;
134 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCaseBuilder;
135 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCaseBuilder;
136 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
137 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.go.to.table._case.GoToTableBuilder;
138 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.meter._case.MeterBuilder;
139 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.metadata._case.WriteMetadataBuilder;
140 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
141 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
142 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
143 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
144 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
145 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
146 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
147 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
148 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
149 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
150 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
151 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
152 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
153 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
154 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddressBuilder;
155 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpTargetHardwareAddressBuilder;
156 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
157 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder;
158 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
159 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6ExtHeaderBuilder;
160 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6LabelBuilder;
161 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
162 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder;
163 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder;
164 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
165 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.MetadataBuilder;
166 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder;
167 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TunnelBuilder;
168 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
169 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder;
170 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match;
171 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
172 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
173 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder;
174 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
175 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
176 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.protocol.match.fields.PbbBuilder;
177 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
178 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.NodeErrorListener;
179 import org.opendaylight.yangtools.concepts.Registration;
180 import org.opendaylight.yangtools.yang.binding.DataObject;
181 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
182 import org.opendaylight.yangtools.yang.common.RpcResult;
183 import org.osgi.framework.BundleContext;
184 import org.slf4j.Logger;
185 import org.slf4j.LoggerFactory;
187 public class OpenflowpluginTestCommandProvider implements CommandProvider {
189 private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
191 private DataBrokerService dataBrokerService;
192 private ProviderContext pc;
193 private final BundleContext ctx;
194 private FlowBuilder testFlow;
195 private NodeBuilder testNode;
196 private final String originalFlowName = "Foo";
197 private final String updatedFlowName = "Bar";
198 private final SalFlowListener flowEventListener = new FlowEventListenerLoggingImpl();
199 private final NodeErrorListener nodeErrorListener = new NodeErrorListenerLoggingImpl();
200 private static NotificationService notificationService;
201 private Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> listener1Reg;
202 private Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> listener2Reg;
204 public OpenflowpluginTestCommandProvider(BundleContext ctx) {
208 public void onSessionInitiated(ProviderContext session) {
210 notificationService = session.getSALService(NotificationService.class);
212 listener1Reg = notificationService.registerNotificationListener(flowEventListener);
213 listener2Reg = notificationService.registerNotificationListener(nodeErrorListener);
214 dataBrokerService = session.getSALService(DataBrokerService.class);
215 ctx.registerService(CommandProvider.class.getName(), this, null);
216 createTestFlow(createTestNode(null), null, null);
219 private NodeBuilder createTestNode(String nodeId) {
220 if (nodeId == null) {
221 nodeId = OpenflowpluginTestActivator.NODE_ID;
223 NodeRef nodeOne = createNodeRef(nodeId);
224 NodeBuilder builder = new NodeBuilder();
225 builder.setId(new NodeId(nodeId));
226 builder.setKey(new NodeKey(builder.getId()));
231 private InstanceIdentifier<Node> nodeBuilderToInstanceId(NodeBuilder node) {
232 return InstanceIdentifier.builder(Nodes.class).child(Node.class, node.getKey()).toInstance();
235 private FlowBuilder createTestFlow(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
237 FlowBuilder flow = new FlowBuilder();
240 String flowType = flowTypeArg;
241 if (flowType == null) {
250 flow.setMatch(createMatch1().build());
251 flow.setInstructions(createDecNwTtlInstructions().build());
255 flow.setMatch(createMatch2().build());
256 flow.setInstructions(createDropInstructions().build());
260 flow.setMatch(createMatch3().build());
261 flow.setInstructions(createDropInstructions().build());
265 flow.setMatch(createEthernetMatch().build());
266 flow.setInstructions(createDropInstructions().build());
270 flow.setMatch(createMatch1().build());
271 flow.setInstructions(createAppyActionInstruction().build());
275 flow.setMatch(createMatch1().build());
276 flow.setInstructions(createGotoTableInstructions().build());
280 flow.setMatch(createMatch1().build());
281 flow.setInstructions(createMeterInstructions().build());
285 flow.setMatch(createMatch1().build());
286 flow.setInstructions(createAppyActionInstruction1().build());
290 flow.setMatch(createMatch1().build());
291 flow.setInstructions(createAppyActionInstruction2().build());
295 flow.setMatch(createMatch1().build());
296 flow.setInstructions(createAppyActionInstruction3().build());
300 flow.setMatch(createMatch1().build());
301 flow.setInstructions(createAppyActionInstruction4().build());
305 flow.setMatch(createMatch1().build());
306 flow.setInstructions(createAppyActionInstruction5().build());
310 flow.setMatch(createMatch1().build());
311 flow.setInstructions(createAppyActionInstruction6().build());
315 flow.setMatch(createMatch1().build());
316 flow.setInstructions(createAppyActionInstruction7().build());
320 flow.setMatch(createMatch1().build());
321 flow.setInstructions(createAppyActionInstruction8().build());
325 flow.setMatch(createMatch1().build());
326 flow.setInstructions(createAppyActionInstruction9().build());
330 flow.setMatch(createMatch1().build());
331 flow.setInstructions(createAppyActionInstruction10().build());
335 flow.setMatch(createMatch1().build());
336 flow.setInstructions(createAppyActionInstruction11().build());
340 flow.setMatch(createMatch1().build());
341 flow.setInstructions(createAppyActionInstruction12().build());
345 flow.setMatch(createMatch1().build());
346 flow.setInstructions(createAppyActionInstruction13().build());
350 flow.setMatch(createMatch1().build());
351 flow.setInstructions(createAppyActionInstruction14().build());
355 flow.setMatch(createMatch1().build());
356 flow.setInstructions(createAppyActionInstruction15().build());
360 // f23 can be used as test-case for generating error notification
361 // if the particular group is not configured - tested
362 flow.setMatch(createMatch1().build());
363 flow.setInstructions(createAppyActionInstruction16().build());
367 flow.setMatch(createMatch1().build());
368 flow.setInstructions(createAppyActionInstruction17().build());
372 flow.setMatch(createMatch1().build());
373 flow.setInstructions(createAppyActionInstruction18().build());
377 flow.setMatch(createMatch1().build());
378 flow.setInstructions(createAppyActionInstruction19().build());
382 flow.setMatch(createMatch1().build());
383 flow.setInstructions(createMetadataInstructions().build());
387 flow.setMatch(createMatch1().build());
388 flow.setInstructions(createAppyActionInstruction20().build());
392 flow.setMatch(createMatch1().build());
393 flow.setInstructions(createAppyActionInstruction21().build());
397 flow.setMatch(createMatch1().build());
398 flow.setInstructions(createAppyActionInstruction22().build());
402 flow.setMatch(createMatch1().build());
403 flow.setInstructions(createAppyActionInstruction23(nodeBuilder.getId()).build());
407 flow.setMatch(createMatch1().build());
408 flow.setInstructions(createAppyActionInstruction24().build());
412 flow.setMatch(createMatch1().build());
413 flow.setInstructions(createAppyActionInstruction25().build());
417 flow.setMatch(createMatch1().build());
418 flow.setInstructions(createAppyActionInstruction26().build());
422 flow.setMatch(createMatch1().build());
423 flow.setInstructions(createAppyActionInstruction27().build());
427 flow.setMatch(createMatch1().build());
428 flow.setInstructions(createAppyActionInstruction28().build());
432 flow.setMatch(createMatch1().build());
433 flow.setInstructions(createAppyActionInstruction29().build());
437 flow.setMatch(createMatch1().build());
438 flow.setInstructions(createAppyActionInstruction30().build());
442 flow.setMatch(createMatch1().build());
443 flow.setInstructions(createAppyActionInstruction31().build());
447 flow.setMatch(createMatch1().build());
448 flow.setInstructions(createAppyActionInstruction32().build());
452 flow.setMatch(createMatch1().build());
453 flow.setInstructions(createAppyActionInstruction33().build());
457 flow.setMatch(createMatch1().build());
458 flow.setInstructions(createAppyActionInstruction34().build());
462 flow.setMatch(createICMPv6Match().build());
463 flow.setInstructions(createDecNwTtlInstructions().build());
467 flow.setMatch(createInphyportMatch(nodeBuilder.getId()).build());
468 flow.setInstructions(createDropInstructions().build());
472 flow.setMatch(createMetadataMatch().build());
473 flow.setInstructions(createDropInstructions().build());
477 flow.setMatch(createL3IPv6Match().build());
478 flow.setInstructions(createDecNwTtlInstructions().build());
482 flow.setMatch(createL4SCTPMatch().build());
483 flow.setInstructions(createAppyActionInstruction().build());
487 flow.setMatch(createTunnelIDMatch().build());
488 flow.setInstructions(createGotoTableInstructions().build());
492 flow.setMatch(createVlanMatch().build());
493 flow.setInstructions(createMeterInstructions().build());
497 flow.setMatch(createPbbMatch().build());
498 flow.setInstructions(createMeterInstructions().build());
502 flow.setMatch(createVlanMatch().build());
503 flow.setInstructions(createDropInstructions().build());
507 flow.setMatch(createL4TCPMatch().build());
508 flow.setInstructions(createDropInstructions().build());
513 flow.setMatch(createL4UDPMatch().build());
514 flow.setInstructions(createDropInstructions().build());
518 flow.setMatch(new MatchBuilder().build());
519 flow.setInstructions(createSentToControllerInstructions().build());
524 flow.setMatch(createToSMatch().build());
525 flow.setInstructions(createDropInstructions().build());
529 flow.setMatch(createToSMatch().build());
530 flow.setInstructions(createOutputInstructions("INPORT", 10).build());
534 flow.setMatch(createToSMatch().build());
535 flow.setInstructions(createOutputInstructions("FLOOD", 20).build());
539 flow.setMatch(createToSMatch().build());
540 flow.setInstructions(createOutputInstructions("ALL", 30).build());
544 flow.setMatch(createToSMatch().build());
545 flow.setInstructions(createOutputInstructions("NORMAL", 40).build());
549 flow.setMatch(createToSMatch().build());
550 flow.setInstructions(createOutputInstructions("LOCAL", 50).build());
554 flow.setMatch(createToSMatch().build());
555 flow.setInstructions(createOutputInstructions("TABLE", 60).build());
559 flow.setMatch(createToSMatch().build());
560 flow.setInstructions(createOutputInstructions("NONE", 70).build());
564 flow.setMatch(createToSMatch().build());
565 flow.setInstructions(createStripVlanInstructions().build());
566 flow.setBarrier(Boolean.TRUE);
570 flow.setMatch(createMatch1().build());
571 flow.setInstructions(createAppyActionInstruction35().build());
575 flow.setMatch(createMatch1().build());
576 flow.setInstructions(createAppyActionInstruction36().build());
580 flow.setMatch(createMatch1().build());
581 flow.setInstructions(createAppyActionInstruction37().build());
585 flow.setMatch(createMatch1().build());
586 flow.setInstructions(createAppyActionInstruction38().build());
590 flow.setMatch(createL4TCPMatch().build());
591 flow.setInstructions(createAppyActionInstruction39().build());
595 flow.setMatch(createL4UDPMatch().build());
596 flow.setInstructions(createAppyActionInstruction40().build());
600 flow.setMatch(createL4SCTPMatch().build());
601 flow.setInstructions(createAppyActionInstruction41().build());
605 flow.setMatch(createICMPv4Match().build());
606 flow.setInstructions(createAppyActionInstruction42().build());
610 flow.setMatch(createArpMatch().build());
611 flow.setInstructions(createAppyActionInstruction43().build());
615 flow.setMatch(createL3IPv6Match().build());
616 flow.setInstructions(createAppyActionInstruction44().build());
620 flow.setMatch(createICMPv6Match().build());
621 flow.setInstructions(createAppyActionInstruction45().build());
625 flow.setMatch(createMplsMatch().build());
626 flow.setInstructions(createAppyActionInstruction46().build());
630 flow.setMatch(createPbbMatch().build());
631 flow.setInstructions(createAppyActionInstruction47().build());
635 flow.setMatch(createTunnelIDMatch().build());
636 flow.setInstructions(createAppyActionInstruction48().build());
640 flow.setMatch(createMatch33().build());
641 flow.setInstructions(createDropInstructions().build());
645 flow.setMatch(createICMPv6Match1().build());
646 flow.setInstructions(createDecNwTtlInstructions().build());
650 flow.setMatch(createMatch1().build());
651 flow.setInstructions(createAppyActionInstruction88().build());
655 flow.setMatch(createLLDPMatch().build());
656 flow.setInstructions(createSentToControllerInstructions().build());
660 flow.setMatch(createToSMatch().build());
661 flow.setInstructions(createOutputInstructions().build());
664 LOG.warn("flow type not understood: {}", flowType);
667 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
668 if (null == flow.isBarrier()) {
669 flow.setBarrier(Boolean.FALSE);
671 // flow.setBufferId(new Long(12));
672 BigInteger value = new BigInteger("10", 10);
673 // BigInteger outputPort = new BigInteger("65535", 10);
674 flow.setCookie(new FlowCookie(value));
675 flow.setCookieMask(new FlowCookie(value));
676 flow.setHardTimeout(0);
677 flow.setIdleTimeout(0);
678 flow.setInstallHw(false);
679 flow.setStrict(false);
680 flow.setContainerName(null);
681 flow.setFlags(new FlowModFlags(false, false, false, false, true));
682 flow.setId(new FlowId("12"));
683 flow.setTableId(getTableId(tableId));
684 // commenting setOutGroup and setOutPort, as by default
686 // enable setOutGroup and setOutPort to enable output filtering
687 // flow.setOutGroup(new Long(2));
688 // set outport to OFPP_NONE (65535) to disable remove restriction for
690 // flow.setOutPort(outputPort);
693 flow.setFlowName(originalFlowName + "X" + flowType);
699 private FlowBuilder createTestFlow_perfTest(NodeBuilder nodeBuilder, String flowTypeArg, String tableId, int id) {
701 FlowBuilder flow = new FlowBuilder();
704 String flowType = flowTypeArg;
705 if (flowType == null) {
709 flow.setPriority(id);
714 flow.setMatch(createMatch1().build());
715 flow.setInstructions(createDecNwTtlInstructions().build());
718 LOG.warn("flow type not understood: {}", flowType);
721 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
722 if (null == flow.isBarrier()) {
723 flow.setBarrier(Boolean.FALSE);
725 // flow.setBufferId(new Long(12));
726 BigInteger value = new BigInteger("10", 10);
727 // BigInteger outputPort = new BigInteger("65535", 10);
728 flow.setCookie(new FlowCookie(value));
729 flow.setCookieMask(new FlowCookie(value));
730 flow.setHardTimeout(0);
731 flow.setIdleTimeout(0);
732 flow.setInstallHw(false);
733 flow.setStrict(false);
734 flow.setContainerName(null);
735 flow.setFlags(new FlowModFlags(false, false, false, false, true));
736 flow.setId(new FlowId("12"));
737 flow.setTableId(getTableId(tableId));
738 // commenting setOutGroup and setOutPort, as by default
740 // enable setOutGroup and setOutPort to enable output filtering
741 // flow.setOutGroup(new Long(2));
742 // set outport to OFPP_NONE (65535) to disable remove restriction for
744 // flow.setOutPort(outputPort);
747 flow.setFlowName(originalFlowName + "X" + flowType);
751 private FlowBuilder createtablemiss(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
752 FlowBuilder flow = new FlowBuilder();
754 MatchBuilder matchBuilder = new MatchBuilder();
755 flow.setMatch(matchBuilder.build());
756 flow.setInstructions(createSentToControllerInstructions().build());
758 flow.setTableId((short) 0);
759 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
765 private short getTableId(String tableId) {
768 table = Short.parseShort(tableId);
769 } catch (Exception ex) {
770 // ignore exception and continue with default value
780 private static InstructionsBuilder createDecNwTtlInstructions() {
781 DecNwTtlBuilder ta = new DecNwTtlBuilder();
782 DecNwTtl decNwTtl = ta.build();
783 ActionBuilder ab = new ActionBuilder();
784 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
785 ab.setKey(new ActionKey(0));
786 // Add our drop action to a list
787 List<Action> actionList = new ArrayList<Action>();
788 actionList.add(ab.build());
790 // Create an Apply Action
791 ApplyActionsBuilder aab = new ApplyActionsBuilder();
792 aab.setAction(actionList);
794 // Wrap our Apply Action in an Instruction
795 InstructionBuilder ib = new InstructionBuilder();
796 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
797 ib.setKey(new InstructionKey(0));
800 // Put our Instruction in a list of Instructions
801 InstructionsBuilder isb = new InstructionsBuilder();
802 List<Instruction> instructions = new ArrayList<Instruction>();
803 instructions.add(ib.build());
804 ib.setKey(new InstructionKey(0));
805 isb.setInstruction(instructions);
812 private static InstructionsBuilder createMeterInstructions() {
814 MeterBuilder aab = new MeterBuilder();
815 aab.setMeterId(new MeterId(new Long(1)));
817 InstructionBuilder ib = new InstructionBuilder();
818 ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
820 // Put our Instruction in a list of Instructions
821 InstructionsBuilder isb = new InstructionsBuilder();
822 List<Instruction> instructions = new ArrayList<Instruction>();
823 ib.setKey(new InstructionKey(0));
824 instructions.add(ib.build());
825 isb.setInstruction(instructions);
829 private static InstructionsBuilder createMetadataInstructions() {
831 WriteMetadataBuilder aab = new WriteMetadataBuilder();
832 aab.setMetadata(new BigInteger("10", 10));
833 aab.setMetadataMask(new BigInteger("12", 10));
835 InstructionBuilder ib = new InstructionBuilder();
836 ib.setInstruction(new WriteMetadataCaseBuilder().setWriteMetadata(aab.build()).build());
838 // Put our Instruction in a list of Instructions
839 InstructionsBuilder isb = new InstructionsBuilder();
840 List<Instruction> instructions = new ArrayList<Instruction>();
841 ib.setKey(new InstructionKey(0));
842 instructions.add(ib.build());
843 isb.setInstruction(instructions);
847 private static InstructionsBuilder createGotoTableInstructions() {
849 GoToTableBuilder aab = new GoToTableBuilder();
850 aab.setTableId((short) 2);
852 InstructionBuilder ib = new InstructionBuilder();
853 ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(aab.build()).build());
855 // Put our Instruction in a list of Instructions
856 InstructionsBuilder isb = new InstructionsBuilder();
857 List<Instruction> instructions = new ArrayList<Instruction>();
858 ib.setKey(new InstructionKey(0));
859 instructions.add(ib.build());
860 isb.setInstruction(instructions);
864 private static InstructionsBuilder createDropInstructions() {
865 DropActionBuilder dab = new DropActionBuilder();
866 DropAction dropAction = dab.build();
867 ActionBuilder ab = new ActionBuilder();
868 ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build());
869 ab.setKey(new ActionKey(0));
870 // Add our drop action to a list
871 List<Action> actionList = new ArrayList<Action>();
872 actionList.add(ab.build());
873 ab.setKey(new ActionKey(0));
874 // Create an Apply Action
875 ApplyActionsBuilder aab = new ApplyActionsBuilder();
876 aab.setAction(actionList);
878 // Wrap our Apply Action in an Instruction
879 InstructionBuilder ib = new InstructionBuilder();
880 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
882 // Put our Instruction in a list of Instructions
883 InstructionsBuilder isb = new InstructionsBuilder();
884 List<Instruction> instructions = new ArrayList<Instruction>();
885 ib.setKey(new InstructionKey(0));
886 instructions.add(ib.build());
887 isb.setInstruction(instructions);
891 private static InstructionsBuilder createAppyActionInstruction() {
893 List<Action> actionList = new ArrayList<Action>();
894 ActionBuilder ab = new ActionBuilder();
895 ControllerActionBuilder controller = new ControllerActionBuilder();
896 controller.setMaxLength(5);
897 ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.build()).build());
898 ab.setKey(new ActionKey(0));
899 actionList.add(ab.build());
900 // Create an Apply Action
901 ApplyActionsBuilder aab = new ApplyActionsBuilder();
902 aab.setAction(actionList);
904 // Wrap our Apply Action in an Instruction
905 InstructionBuilder ib = new InstructionBuilder();
906 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
908 // Put our Instruction in a list of Instructions
909 InstructionsBuilder isb = new InstructionsBuilder();
910 List<Instruction> instructions = new ArrayList<Instruction>();
911 ib.setKey(new InstructionKey(0));
912 instructions.add(ib.build());
913 isb.setInstruction(instructions);
917 private static InstructionsBuilder createAppyActionInstruction1() {
919 List<Action> actionList = new ArrayList<Action>();
920 ActionBuilder ab = new ActionBuilder();
922 OutputActionBuilder output = new OutputActionBuilder();
923 output.setMaxLength(56);
924 Uri value = new Uri("PCEP");
925 output.setOutputNodeConnector(value);
926 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
927 ab.setKey(new ActionKey(0));
928 actionList.add(ab.build());
929 // Create an Apply Action
930 ApplyActionsBuilder aab = new ApplyActionsBuilder();
931 aab.setAction(actionList);
933 // Wrap our Apply Action in an Instruction
934 InstructionBuilder ib = new InstructionBuilder();
935 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
937 // Put our Instruction in a list of Instructions
938 InstructionsBuilder isb = new InstructionsBuilder();
939 List<Instruction> instructions = new ArrayList<Instruction>();
940 ib.setKey(new InstructionKey(0));
941 instructions.add(ib.build());
942 isb.setInstruction(instructions);
946 private static InstructionsBuilder createOutputInstructions() {
948 // test case for Output Port works if the particular port exists
949 // this particular test-case is for Port : 1
950 // tested as (addMDFlow openflow:<dpid> f82)
951 List<Action> actionList = new ArrayList<Action>();
952 ActionBuilder ab = new ActionBuilder();
953 OutputActionBuilder output = new OutputActionBuilder();
955 Uri value = new Uri("1");
956 output.setOutputNodeConnector(value);
957 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
959 ab.setKey(new ActionKey(0));
960 actionList.add(ab.build());
961 // Create an Apply Action
962 ApplyActionsBuilder aab = new ApplyActionsBuilder();
963 aab.setAction(actionList);
965 // Wrap our Apply Action in an Instruction
966 InstructionBuilder ib = new InstructionBuilder();
967 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
969 ib.setKey(new InstructionKey(0));
971 // Put our Instruction in a list of Instructions
972 InstructionsBuilder isb = new InstructionsBuilder();
973 List<Instruction> instructions = new ArrayList<Instruction>();
974 instructions.add(ib.build());
975 isb.setInstruction(instructions);
979 private static InstructionsBuilder createSentToControllerInstructions() {
980 List<Action> actionList = new ArrayList<Action>();
981 ActionBuilder ab = new ActionBuilder();
983 OutputActionBuilder output = new OutputActionBuilder();
984 output.setMaxLength(new Integer(0xffff));
985 Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
986 output.setOutputNodeConnector(value);
987 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
989 ab.setKey(new ActionKey(0));
990 actionList.add(ab.build());
991 // Create an Apply Action
992 ApplyActionsBuilder aab = new ApplyActionsBuilder();
993 aab.setAction(actionList);
995 // Wrap our Apply Action in an Instruction
996 InstructionBuilder ib = new InstructionBuilder();
997 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
999 ib.setKey(new InstructionKey(0));
1001 // Put our Instruction in a list of Instructions
1002 InstructionsBuilder isb = new InstructionsBuilder();
1003 List<Instruction> instructions = new ArrayList<Instruction>();
1004 instructions.add(ib.build());
1005 isb.setInstruction(instructions);
1009 private static InstructionsBuilder createOutputInstructions(String outputType, int outputValue) {
1010 List<Action> actionList = new ArrayList<Action>();
1011 ActionBuilder ab = new ActionBuilder();
1013 OutputActionBuilder output = new OutputActionBuilder();
1014 output.setMaxLength(outputValue);
1015 Uri value = new Uri(outputType);
1016 output.setOutputNodeConnector(value);
1017 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
1019 ab.setKey(new ActionKey(0));
1020 actionList.add(ab.build());
1021 // Create an Apply Action
1022 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1023 aab.setAction(actionList);
1025 // Wrap our Apply Action in an Instruction
1026 InstructionBuilder ib = new InstructionBuilder();
1027 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1029 ib.setKey(new InstructionKey(0));
1031 // Put our Instruction in a list of Instructions
1032 InstructionsBuilder isb = new InstructionsBuilder();
1033 List<Instruction> instructions = new ArrayList<Instruction>();
1034 instructions.add(ib.build());
1035 isb.setInstruction(instructions);
1039 private static InstructionsBuilder createStripVlanInstructions() {
1040 List<Action> actionList = new ArrayList<Action>();
1041 ActionBuilder ab = new ActionBuilder();
1043 StripVlanActionBuilder stripActionBuilder = new StripVlanActionBuilder();
1044 ab.setAction(new StripVlanActionCaseBuilder().setStripVlanAction(stripActionBuilder.build()).build());
1046 ab.setKey(new ActionKey(0));
1047 actionList.add(ab.build());
1048 // Create an Apply Action
1049 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1050 aab.setAction(actionList);
1052 // Wrap our Apply Action in an Instruction
1053 InstructionBuilder ib = new InstructionBuilder();
1054 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1056 ib.setKey(new InstructionKey(0));
1058 // Put our Instruction in a list of Instructions
1059 InstructionsBuilder isb = new InstructionsBuilder();
1060 List<Instruction> instructions = new ArrayList<Instruction>();
1061 instructions.add(ib.build());
1062 isb.setInstruction(instructions);
1066 private static InstructionsBuilder createAppyActionInstruction2() {
1068 List<Action> actionList = new ArrayList<Action>();
1069 ActionBuilder ab = new ActionBuilder();
1071 PushMplsActionBuilder push = new PushMplsActionBuilder();
1072 push.setEthernetType(new Integer(0x8847));
1073 ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
1074 ab.setKey(new ActionKey(0));
1075 actionList.add(ab.build());
1076 // Create an Apply Action
1077 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1078 aab.setAction(actionList);
1080 // Wrap our Apply Action in an Instruction
1081 InstructionBuilder ib = new InstructionBuilder();
1082 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1084 // Put our Instruction in a list of Instructions
1085 InstructionsBuilder isb = new InstructionsBuilder();
1086 List<Instruction> instructions = new ArrayList<Instruction>();
1087 ib.setKey(new InstructionKey(0));
1088 instructions.add(ib.build());
1089 isb.setInstruction(instructions);
1093 private static InstructionsBuilder createAppyActionInstruction3() {
1095 List<Action> actionList = new ArrayList<Action>();
1096 ActionBuilder ab = new ActionBuilder();
1098 PushPbbActionBuilder pbb = new PushPbbActionBuilder();
1099 pbb.setEthernetType(new Integer(0x88E7));
1100 ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
1101 ab.setKey(new ActionKey(0));
1102 actionList.add(ab.build());
1103 // Create an Apply Action
1104 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1105 aab.setAction(actionList);
1107 // Wrap our Apply Action in an Instruction
1108 InstructionBuilder ib = new InstructionBuilder();
1109 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1111 // Put our Instruction in a list of Instructions
1112 InstructionsBuilder isb = new InstructionsBuilder();
1113 List<Instruction> instructions = new ArrayList<Instruction>();
1114 ib.setKey(new InstructionKey(0));
1115 instructions.add(ib.build());
1116 isb.setInstruction(instructions);
1120 private static InstructionsBuilder createAppyActionInstruction4() {
1122 List<Action> actionList = new ArrayList<Action>();
1123 ActionBuilder ab = new ActionBuilder();
1125 PushVlanActionBuilder vlan = new PushVlanActionBuilder();
1126 vlan.setEthernetType(new Integer(0x8100));
1127 ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
1128 ab.setKey(new ActionKey(0));
1129 actionList.add(ab.build());
1131 // Create an Apply Action
1132 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1133 aab.setAction(actionList);
1135 // Wrap our Apply Action in an Instruction
1136 InstructionBuilder ib = new InstructionBuilder();
1137 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1139 // Put our Instruction in a list of Instructions
1140 InstructionsBuilder isb = new InstructionsBuilder();
1141 List<Instruction> instructions = new ArrayList<Instruction>();
1142 ib.setKey(new InstructionKey(0));
1143 instructions.add(ib.build());
1144 isb.setInstruction(instructions);
1148 private static InstructionsBuilder createAppyActionInstruction5() {
1150 List<Action> actionList = new ArrayList<Action>();
1151 ActionBuilder ab = new ActionBuilder();
1153 SetDlDstActionBuilder setdl = new SetDlDstActionBuilder();
1154 setdl.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1155 ab.setAction(new SetDlDstActionCaseBuilder().setSetDlDstAction(setdl.build()).build());
1156 ab.setKey(new ActionKey(0));
1157 actionList.add(ab.build());
1158 // Create an Apply Action
1159 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1160 aab.setAction(actionList);
1162 // Wrap our Apply Action in an Instruction
1163 InstructionBuilder ib = new InstructionBuilder();
1164 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1166 // Put our Instruction in a list of Instructions
1167 InstructionsBuilder isb = new InstructionsBuilder();
1168 List<Instruction> instructions = new ArrayList<Instruction>();
1169 ib.setKey(new InstructionKey(0));
1170 instructions.add(ib.build());
1171 isb.setInstruction(instructions);
1175 private static InstructionsBuilder createAppyActionInstruction6() {
1177 List<Action> actionList = new ArrayList<Action>();
1178 ActionBuilder ab = new ActionBuilder();
1180 SetDlSrcActionBuilder src = new SetDlSrcActionBuilder();
1181 src.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1182 ab.setAction(new SetDlSrcActionCaseBuilder().setSetDlSrcAction(src.build()).build());
1183 ab.setKey(new ActionKey(0));
1184 actionList.add(ab.build());
1186 // Create an Apply Action
1187 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1188 aab.setAction(actionList);
1190 // Wrap our Apply Action in an Instruction
1191 InstructionBuilder ib = new InstructionBuilder();
1192 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1194 // Put our Instruction in a list of Instructions
1195 InstructionsBuilder isb = new InstructionsBuilder();
1196 List<Instruction> instructions = new ArrayList<Instruction>();
1197 ib.setKey(new InstructionKey(0));
1198 instructions.add(ib.build());
1199 isb.setInstruction(instructions);
1203 private static InstructionsBuilder createAppyActionInstruction7() {
1205 List<Action> actionList = new ArrayList<Action>();
1206 ActionBuilder ab = new ActionBuilder();
1208 SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
1209 VlanId a = new VlanId(4000);
1211 ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
1212 ab.setKey(new ActionKey(0));
1213 actionList.add(ab.build());
1214 // Create an Apply Action
1215 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1216 aab.setAction(actionList);
1218 // Wrap our Apply Action in an Instruction
1219 InstructionBuilder ib = new InstructionBuilder();
1220 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1222 // Put our Instruction in a list of Instructions
1223 InstructionsBuilder isb = new InstructionsBuilder();
1224 List<Instruction> instructions = new ArrayList<Instruction>();
1225 ib.setKey(new InstructionKey(0));
1226 instructions.add(ib.build());
1227 isb.setInstruction(instructions);
1231 private static InstructionsBuilder createAppyActionInstruction8() {
1233 List<Action> actionList = new ArrayList<Action>();
1234 ActionBuilder ab = new ActionBuilder();
1236 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1237 VlanPcp pcp1 = new VlanPcp((short) 2);
1238 pcp.setVlanPcp(pcp1);
1239 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1240 ab.setKey(new ActionKey(0));
1241 actionList.add(ab.build());
1242 // Create an Apply Action
1243 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1244 aab.setAction(actionList);
1246 // Wrap our Apply Action in an Instruction
1247 InstructionBuilder ib = new InstructionBuilder();
1248 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1250 // Put our Instruction in a list of Instructions
1251 InstructionsBuilder isb = new InstructionsBuilder();
1252 List<Instruction> instructions = new ArrayList<Instruction>();
1253 ib.setKey(new InstructionKey(0));
1254 instructions.add(ib.build());
1255 isb.setInstruction(instructions);
1259 private static InstructionsBuilder createAppyActionInstruction88() {
1261 List<Action> actionList = new ArrayList<Action>();
1262 ActionBuilder ab = new ActionBuilder();
1264 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1265 // the code point is a 3-bit(0-7) field representing the frame priority level
1266 VlanPcp pcp1 = new VlanPcp((short) 4);
1267 pcp.setVlanPcp(pcp1);
1268 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1269 ab.setKey(new ActionKey(0));
1270 actionList.add(ab.build());
1271 // Create an Apply Action
1272 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1273 aab.setAction(actionList);
1275 // Wrap our Apply Action in an Instruction
1276 InstructionBuilder ib = new InstructionBuilder();
1277 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1279 // Put our Instruction in a list of Instructions
1280 InstructionsBuilder isb = new InstructionsBuilder();
1281 List<Instruction> instructions = new ArrayList<Instruction>();
1282 ib.setKey(new InstructionKey(0));
1283 instructions.add(ib.build());
1284 isb.setInstruction(instructions);
1288 private static InstructionsBuilder createAppyActionInstruction9() {
1290 List<Action> actionList = new ArrayList<Action>();
1291 ActionBuilder ab = new ActionBuilder();
1293 CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
1294 ab.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
1295 ab.setKey(new ActionKey(0));
1296 actionList.add(ab.build());
1297 // Create an Apply Action
1298 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1299 aab.setAction(actionList);
1301 // Wrap our Apply Action in an Instruction
1302 InstructionBuilder ib = new InstructionBuilder();
1303 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1305 // Put our Instruction in a list of Instructions
1306 InstructionsBuilder isb = new InstructionsBuilder();
1307 List<Instruction> instructions = new ArrayList<Instruction>();
1308 ib.setKey(new InstructionKey(0));
1309 instructions.add(ib.build());
1310 isb.setInstruction(instructions);
1314 private static InstructionsBuilder createAppyActionInstruction10() {
1316 List<Action> actionList = new ArrayList<Action>();
1317 ActionBuilder ab = new ActionBuilder();
1319 CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
1320 ab.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
1321 ab.setKey(new ActionKey(0));
1322 actionList.add(ab.build());
1323 // Create an Apply Action
1324 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1325 aab.setAction(actionList);
1327 // Wrap our Apply Action in an Instruction
1328 InstructionBuilder ib = new InstructionBuilder();
1329 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1331 // Put our Instruction in a list of Instructions
1332 InstructionsBuilder isb = new InstructionsBuilder();
1333 List<Instruction> instructions = new ArrayList<Instruction>();
1334 ib.setKey(new InstructionKey(0));
1335 instructions.add(ib.build());
1336 isb.setInstruction(instructions);
1340 private static InstructionsBuilder createAppyActionInstruction11() {
1342 List<Action> actionList = new ArrayList<Action>();
1343 ActionBuilder ab = new ActionBuilder();
1345 DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
1346 ab.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
1347 ab.setKey(new ActionKey(0));
1348 actionList.add(ab.build());
1349 // Create an Apply Action
1350 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1351 aab.setAction(actionList);
1353 // Wrap our Apply Action in an Instruction
1354 InstructionBuilder ib = new InstructionBuilder();
1355 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1356 ib.setKey(new InstructionKey(0));
1359 // Put our Instruction in a list of Instruction
1360 InstructionsBuilder isb = new InstructionsBuilder();
1361 List<Instruction> instructions = new ArrayList<Instruction>();
1362 instructions.add(ib.build());
1363 isb.setInstruction(instructions);
1367 private static InstructionsBuilder createAppyActionInstruction12() {
1369 List<Action> actionList = new ArrayList<Action>();
1370 ActionBuilder ab = new ActionBuilder();
1372 DecNwTtlBuilder nwttl = new DecNwTtlBuilder();
1373 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(nwttl.build()).build());
1374 ab.setKey(new ActionKey(0));
1375 actionList.add(ab.build());
1377 // Create an Apply Action
1378 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1379 aab.setAction(actionList);
1381 // Wrap our Apply Action in an Instruction
1382 InstructionBuilder ib = new InstructionBuilder();
1383 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1385 // Put our Instruction in a list of Instructions
1386 InstructionsBuilder isb = new InstructionsBuilder();
1387 List<Instruction> instructions = new ArrayList<Instruction>();
1388 ib.setKey(new InstructionKey(0));
1389 instructions.add(ib.build());
1390 isb.setInstruction(instructions);
1394 private static InstructionsBuilder createAppyActionInstruction13() {
1396 List<Action> actionList = new ArrayList<Action>();
1397 ActionBuilder ab = new ActionBuilder();
1399 DropActionBuilder drop = new DropActionBuilder();
1400 ab.setAction(new DropActionCaseBuilder().setDropAction(drop.build()).build());
1401 ab.setKey(new ActionKey(0));
1402 actionList.add(ab.build());
1404 // Create an Apply Action
1405 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1406 aab.setAction(actionList);
1408 // Wrap our Apply Action in an Instruction
1409 InstructionBuilder ib = new InstructionBuilder();
1410 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1412 // Put our Instruction in a list of Instructions
1413 InstructionsBuilder isb = new InstructionsBuilder();
1414 List<Instruction> instructions = new ArrayList<Instruction>();
1415 ib.setKey(new InstructionKey(0));
1416 instructions.add(ib.build());
1417 isb.setInstruction(instructions);
1421 private static InstructionsBuilder createAppyActionInstruction14() {
1423 List<Action> actionList = new ArrayList<Action>();
1424 ActionBuilder ab = new ActionBuilder();
1426 FloodActionBuilder fld = new FloodActionBuilder();
1427 ab.setAction(new FloodActionCaseBuilder().setFloodAction(fld.build()).build());
1428 ab.setKey(new ActionKey(0));
1429 actionList.add(ab.build());
1430 // Create an Apply Action
1431 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1432 aab.setAction(actionList);
1434 // Wrap our Apply Action in an Instruction
1435 InstructionBuilder ib = new InstructionBuilder();
1436 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1438 // Put our Instruction in a list of Instructions
1439 InstructionsBuilder isb = new InstructionsBuilder();
1440 List<Instruction> instructions = new ArrayList<Instruction>();
1441 ib.setKey(new InstructionKey(0));
1442 instructions.add(ib.build());
1443 isb.setInstruction(instructions);
1447 private static InstructionsBuilder createAppyActionInstruction15() {
1449 List<Action> actionList = new ArrayList<Action>();
1450 ActionBuilder ab = new ActionBuilder();
1452 FloodAllActionBuilder fldall = new FloodAllActionBuilder();
1453 ab.setAction(new FloodAllActionCaseBuilder().setFloodAllAction(fldall.build()).build());
1454 ab.setKey(new ActionKey(0));
1455 actionList.add(ab.build());
1456 // Create an Apply Action
1457 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1458 aab.setAction(actionList);
1460 // Wrap our Apply Action in an Instruction
1461 InstructionBuilder ib = new InstructionBuilder();
1462 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1464 // Put our Instruction in a list of Instructions
1465 InstructionsBuilder isb = new InstructionsBuilder();
1466 List<Instruction> instructions = new ArrayList<Instruction>();
1467 ib.setKey(new InstructionKey(0));
1468 instructions.add(ib.build());
1469 isb.setInstruction(instructions);
1473 private static InstructionsBuilder createAppyActionInstruction16() {
1475 List<Action> actionList = new ArrayList<Action>();
1476 ActionBuilder ab = new ActionBuilder();
1478 GroupActionBuilder groupActionB = new GroupActionBuilder();
1479 groupActionB.setGroupId(1L);
1480 groupActionB.setGroup("0");
1481 ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
1482 ab.setKey(new ActionKey(0));
1483 actionList.add(ab.build());
1485 // Create an Apply Action
1486 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1487 aab.setAction(actionList);
1489 // Wrap our Apply Action in an Instruction
1490 InstructionBuilder ib = new InstructionBuilder();
1491 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1493 // Put our Instruction in a list of Instructions
1494 InstructionsBuilder isb = new InstructionsBuilder();
1495 List<Instruction> instructions = new ArrayList<Instruction>();
1496 ib.setKey(new InstructionKey(0));
1497 instructions.add(ib.build());
1498 isb.setInstruction(instructions);
1502 private static InstructionsBuilder createAppyActionInstruction17() {
1504 List<Action> actionList = new ArrayList<Action>();
1505 ActionBuilder ab = new ActionBuilder();
1507 HwPathActionBuilder hwPathB = new HwPathActionBuilder();
1508 ab.setAction(new HwPathActionCaseBuilder().setHwPathAction(hwPathB.build()).build());
1509 ab.setKey(new ActionKey(0));
1510 actionList.add(ab.build());
1511 // Create an Apply Action
1512 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1513 aab.setAction(actionList);
1515 // Wrap our Apply Action in an Instruction
1516 InstructionBuilder ib = new InstructionBuilder();
1517 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1519 // Put our Instruction in a list of Instructions
1520 InstructionsBuilder isb = new InstructionsBuilder();
1521 List<Instruction> instructions = new ArrayList<Instruction>();
1522 ib.setKey(new InstructionKey(0));
1523 instructions.add(ib.build());
1524 isb.setInstruction(instructions);
1528 private static InstructionsBuilder createAppyActionInstruction18() {
1530 List<Action> actionList = new ArrayList<Action>();
1531 ActionBuilder ab = new ActionBuilder();
1533 LoopbackActionBuilder loopbackActionBuilder = new LoopbackActionBuilder();
1534 ab.setAction(new LoopbackActionCaseBuilder().setLoopbackAction(loopbackActionBuilder.build()).build());
1535 ab.setKey(new ActionKey(0));
1536 actionList.add(ab.build());
1538 // Create an Apply Action
1539 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1540 aab.setAction(actionList);
1542 // Wrap our Apply Action in an Instruction
1543 InstructionBuilder ib = new InstructionBuilder();
1544 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1546 // Put our Instruction in a list of Instructions
1547 InstructionsBuilder isb = new InstructionsBuilder();
1548 List<Instruction> instructions = new ArrayList<Instruction>();
1549 ib.setKey(new InstructionKey(0));
1550 instructions.add(ib.build());
1551 isb.setInstruction(instructions);
1555 private static InstructionsBuilder createAppyActionInstruction19() {
1557 List<Action> actionList = new ArrayList<Action>();
1558 ActionBuilder ab = new ActionBuilder();
1560 PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
1561 popMplsActionBuilder.setEthernetType(0XB);
1562 ab.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
1563 ab.setKey(new ActionKey(0));
1564 actionList.add(ab.build());
1565 // Create an Apply Action
1566 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1567 aab.setAction(actionList);
1569 // Wrap our Apply Action in an Instruction
1570 InstructionBuilder ib = new InstructionBuilder();
1571 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1573 // Put our Instruction in a list of Instructions
1574 InstructionsBuilder isb = new InstructionsBuilder();
1575 List<Instruction> instructions = new ArrayList<Instruction>();
1576 ib.setKey(new InstructionKey(0));
1577 instructions.add(ib.build());
1578 isb.setInstruction(instructions);
1582 private static InstructionsBuilder createAppyActionInstruction20() {
1584 List<Action> actionList = new ArrayList<Action>();
1585 ActionBuilder ab = new ActionBuilder();
1587 PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
1588 ab.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
1589 ab.setKey(new ActionKey(0));
1590 actionList.add(ab.build());
1591 // Create an Apply Action
1592 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1593 aab.setAction(actionList);
1595 // Wrap our Apply Action in an Instruction
1596 InstructionBuilder ib = new InstructionBuilder();
1597 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1599 // Put our Instruction in a list of Instructions
1600 InstructionsBuilder isb = new InstructionsBuilder();
1601 List<Instruction> instructions = new ArrayList<Instruction>();
1602 ib.setKey(new InstructionKey(0));
1603 instructions.add(ib.build());
1604 isb.setInstruction(instructions);
1608 private static InstructionsBuilder createAppyActionInstruction21() {
1610 List<Action> actionList = new ArrayList<Action>();
1611 ActionBuilder ab = new ActionBuilder();
1613 PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder();
1614 ab.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(popVlanActionBuilder.build()).build());
1615 ab.setKey(new ActionKey(0));
1616 actionList.add(ab.build());
1618 // Create an Apply Action
1619 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1620 aab.setAction(actionList);
1622 // Wrap our Apply Action in an Instruction
1623 InstructionBuilder ib = new InstructionBuilder();
1624 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1626 // Put our Instruction in a list of Instructions
1627 InstructionsBuilder isb = new InstructionsBuilder();
1628 List<Instruction> instructions = new ArrayList<Instruction>();
1629 ib.setKey(new InstructionKey(0));
1630 instructions.add(ib.build());
1631 isb.setInstruction(instructions);
1635 private static InstructionsBuilder createAppyActionInstruction22() {
1637 List<Action> actionList = new ArrayList<Action>();
1638 ActionBuilder ab = new ActionBuilder();
1640 SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
1641 setDlTypeActionBuilder.setDlType(new EtherType(8L));
1642 ab.setAction(new SetDlTypeActionCaseBuilder().setSetDlTypeAction(setDlTypeActionBuilder.build()).build());
1643 ab.setKey(new ActionKey(0));
1644 actionList.add(ab.build());
1646 // Create an Apply Action
1647 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1648 aab.setAction(actionList);
1650 // Wrap our Apply Action in an Instruction
1651 InstructionBuilder ib = new InstructionBuilder();
1652 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1654 // Put our Instruction in a list of Instructions
1655 InstructionsBuilder isb = new InstructionsBuilder();
1656 List<Instruction> instructions = new ArrayList<Instruction>();
1657 ib.setKey(new InstructionKey(0));
1658 instructions.add(ib.build());
1659 isb.setInstruction(instructions);
1663 private static InstructionsBuilder createAppyActionInstruction23(NodeId nodeId) {
1665 List<Action> actionList = new ArrayList<Action>();
1666 ActionBuilder ab = new ActionBuilder();
1668 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1669 setFieldBuilder.setInPort(new NodeConnectorId(nodeId + ":2"));
1670 ab.setKey(new ActionKey(0));
1671 actionList.add(ab.build());
1673 // Create an Apply Action
1674 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1675 aab.setAction(actionList);
1677 // Wrap our Apply Action in an Instruction
1678 InstructionBuilder ib = new InstructionBuilder();
1679 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1681 // Put our Instruction in a list of Instructions
1682 InstructionsBuilder isb = new InstructionsBuilder();
1683 List<Instruction> instructions = new ArrayList<Instruction>();
1684 ib.setKey(new InstructionKey(0));
1685 instructions.add(ib.build());
1686 isb.setInstruction(instructions);
1690 private static InstructionsBuilder createAppyActionInstruction24() {
1692 List<Action> actionList = new ArrayList<Action>();
1693 ActionBuilder ab = new ActionBuilder();
1695 SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
1696 setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
1697 ab.setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(setMplsTtlActionBuilder.build()).build());
1698 ab.setKey(new ActionKey(0));
1699 actionList.add(ab.build());
1701 // Create an Apply Action
1702 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1703 aab.setAction(actionList);
1705 // Wrap our Apply Action in an Instruction
1706 InstructionBuilder ib = new InstructionBuilder();
1707 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1709 // Put our Instruction in a list of Instructions
1710 InstructionsBuilder isb = new InstructionsBuilder();
1711 List<Instruction> instructions = new ArrayList<Instruction>();
1712 ib.setKey(new InstructionKey(0));
1713 instructions.add(ib.build());
1714 isb.setInstruction(instructions);
1718 private static InstructionsBuilder createAppyActionInstruction25() {
1720 List<Action> actionList = new ArrayList<Action>();
1721 ActionBuilder ab = new ActionBuilder();
1723 SetNextHopActionBuilder setNextHopActionBuilder = new SetNextHopActionBuilder();
1724 Ipv4Builder ipnext = new Ipv4Builder();
1725 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
1726 ipnext.setIpv4Address(prefix);
1727 setNextHopActionBuilder.setAddress(ipnext.build());
1728 ab.setAction(new SetNextHopActionCaseBuilder().setSetNextHopAction(setNextHopActionBuilder.build()).build());
1729 ab.setKey(new ActionKey(0));
1730 actionList.add(ab.build());
1732 // Create an Apply Action
1733 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1734 aab.setAction(actionList);
1736 // Wrap our Apply Action in an Instruction
1737 InstructionBuilder ib = new InstructionBuilder();
1738 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1740 // Put our Instruction in a list of Instructions
1741 InstructionsBuilder isb = new InstructionsBuilder();
1742 List<Instruction> instructions = new ArrayList<Instruction>();
1743 ib.setKey(new InstructionKey(0));
1744 instructions.add(ib.build());
1745 isb.setInstruction(instructions);
1749 private static InstructionsBuilder createAppyActionInstruction26() {
1751 List<Action> actionList = new ArrayList<Action>();
1752 ActionBuilder ab = new ActionBuilder();
1754 SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
1755 Ipv4Builder ipdst = new Ipv4Builder();
1756 Ipv4Prefix prefixdst = new Ipv4Prefix("10.0.0.21/24");
1757 ipdst.setIpv4Address(prefixdst);
1758 setNwDstActionBuilder.setAddress(ipdst.build());
1759 ab.setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build());
1760 ab.setKey(new ActionKey(0));
1761 actionList.add(ab.build());
1763 // Create an Apply Action
1764 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1765 aab.setAction(actionList);
1767 // Wrap our Apply Action in an Instruction
1768 InstructionBuilder ib = new InstructionBuilder();
1769 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1771 // Put our Instruction in a list of Instructions
1772 InstructionsBuilder isb = new InstructionsBuilder();
1773 List<Instruction> instructions = new ArrayList<Instruction>();
1774 ib.setKey(new InstructionKey(0));
1775 instructions.add(ib.build());
1776 isb.setInstruction(instructions);
1780 private static InstructionsBuilder createAppyActionInstruction27() {
1782 List<Action> actionList = new ArrayList<Action>();
1783 ActionBuilder ab = new ActionBuilder();
1785 SetNwSrcActionBuilder setNwsrcActionBuilder = new SetNwSrcActionBuilder();
1786 Ipv4Builder ipsrc = new Ipv4Builder();
1787 Ipv4Prefix prefixsrc = new Ipv4Prefix("10.0.23.21/24");
1788 ipsrc.setIpv4Address(prefixsrc);
1789 setNwsrcActionBuilder.setAddress(ipsrc.build());
1790 ab.setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwsrcActionBuilder.build()).build());
1791 ab.setKey(new ActionKey(0));
1792 actionList.add(ab.build());
1794 // Create an Apply Action
1795 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1796 aab.setAction(actionList);
1798 // Wrap our Apply Action in an Instruction
1799 InstructionBuilder ib = new InstructionBuilder();
1800 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1802 // Put our Instruction in a list of Instructions
1803 InstructionsBuilder isb = new InstructionsBuilder();
1804 List<Instruction> instructions = new ArrayList<Instruction>();
1805 ib.setKey(new InstructionKey(0));
1806 instructions.add(ib.build());
1807 isb.setInstruction(instructions);
1811 private static InstructionsBuilder createAppyActionInstruction28() {
1813 List<Action> actionList = new ArrayList<Action>();
1814 ActionBuilder ab = new ActionBuilder();
1816 SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
1817 setNwTosActionBuilder.setTos(8);
1818 ab.setAction(new SetNwTosActionCaseBuilder().setSetNwTosAction(setNwTosActionBuilder.build()).build());
1819 ab.setKey(new ActionKey(0));
1820 actionList.add(ab.build());
1821 // Create an Apply Action
1822 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1823 aab.setAction(actionList);
1825 // Wrap our Apply Action in an Instruction
1826 InstructionBuilder ib = new InstructionBuilder();
1827 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1829 // Put our Instruction in a list of Instructions
1830 InstructionsBuilder isb = new InstructionsBuilder();
1831 List<Instruction> instructions = new ArrayList<Instruction>();
1832 ib.setKey(new InstructionKey(0));
1833 instructions.add(ib.build());
1834 isb.setInstruction(instructions);
1838 private static InstructionsBuilder createAppyActionInstruction29() {
1840 List<Action> actionList = new ArrayList<Action>();
1841 ActionBuilder ab = new ActionBuilder();
1843 SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
1844 setNwTtlActionBuilder.setNwTtl((short) 1);
1845 ab.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
1846 ab.setKey(new ActionKey(0));
1847 actionList.add(ab.build());
1849 // Create an Apply Action
1850 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1851 aab.setAction(actionList);
1853 // Wrap our Apply Action in an Instruction
1854 InstructionBuilder ib = new InstructionBuilder();
1855 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1857 // Put our Instruction in a list of Instructions
1858 InstructionsBuilder isb = new InstructionsBuilder();
1859 List<Instruction> instructions = new ArrayList<Instruction>();
1860 ib.setKey(new InstructionKey(0));
1861 instructions.add(ib.build());
1862 isb.setInstruction(instructions);
1866 private static InstructionsBuilder createAppyActionInstruction30() {
1868 List<Action> actionList = new ArrayList<Action>();
1869 ActionBuilder ab = new ActionBuilder();
1871 SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
1872 setQueueActionBuilder.setQueueId(1L);
1873 ab.setAction(new SetQueueActionCaseBuilder().setSetQueueAction(setQueueActionBuilder.build()).build());
1874 ab.setKey(new ActionKey(0));
1875 actionList.add(ab.build());
1876 // Create an Apply Action
1877 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1878 aab.setAction(actionList);
1880 // Wrap our Apply Action in an Instruction
1881 InstructionBuilder ib = new InstructionBuilder();
1882 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1884 // Put our Instruction in a list of Instructions
1885 InstructionsBuilder isb = new InstructionsBuilder();
1886 List<Instruction> instructions = new ArrayList<Instruction>();
1887 ib.setKey(new InstructionKey(0));
1888 instructions.add(ib.build());
1889 isb.setInstruction(instructions);
1893 private static InstructionsBuilder createAppyActionInstruction31() {
1895 List<Action> actionList = new ArrayList<Action>();
1896 ActionBuilder ab = new ActionBuilder();
1898 SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
1899 setTpDstActionBuilder.setPort(new PortNumber(109));
1901 ab.setAction(new SetTpDstActionCaseBuilder().setSetTpDstAction(setTpDstActionBuilder.build()).build());
1902 ab.setKey(new ActionKey(0));
1903 actionList.add(ab.build());
1904 // Create an Apply Action
1905 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1906 aab.setAction(actionList);
1908 // Wrap our Apply Action in an Instruction
1909 InstructionBuilder ib = new InstructionBuilder();
1910 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1912 // Put our Instruction in a list of Instructions
1913 InstructionsBuilder isb = new InstructionsBuilder();
1914 List<Instruction> instructions = new ArrayList<Instruction>();
1915 ib.setKey(new InstructionKey(0));
1916 instructions.add(ib.build());
1917 isb.setInstruction(instructions);
1921 private static InstructionsBuilder createAppyActionInstruction32() {
1923 List<Action> actionList = new ArrayList<Action>();
1924 ActionBuilder ab = new ActionBuilder();
1926 SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
1927 setTpSrcActionBuilder.setPort(new PortNumber(109));
1928 ab.setAction(new SetTpSrcActionCaseBuilder().setSetTpSrcAction(setTpSrcActionBuilder.build()).build());
1929 ab.setKey(new ActionKey(0));
1930 actionList.add(ab.build());
1932 // Create an Apply Action
1933 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1934 aab.setAction(actionList);
1936 // Wrap our Apply Action in an Instruction
1937 InstructionBuilder ib = new InstructionBuilder();
1938 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1940 // Put our Instruction in a list of Instructions
1941 InstructionsBuilder isb = new InstructionsBuilder();
1942 List<Instruction> instructions = new ArrayList<Instruction>();
1943 ib.setKey(new InstructionKey(0));
1944 instructions.add(ib.build());
1945 isb.setInstruction(instructions);
1949 private static InstructionsBuilder createAppyActionInstruction33() {
1951 List<Action> actionList = new ArrayList<Action>();
1952 ActionBuilder ab = new ActionBuilder();
1954 SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
1955 setVlanCfiActionBuilder.setVlanCfi(new VlanCfi(2));
1956 ab.setAction(new SetVlanCfiActionCaseBuilder().setSetVlanCfiAction(setVlanCfiActionBuilder.build()).build());
1957 ab.setKey(new ActionKey(0));
1958 actionList.add(ab.build());
1960 // Create an Apply Action
1961 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1962 aab.setAction(actionList);
1964 // Wrap our Apply Action in an Instruction
1965 InstructionBuilder ib = new InstructionBuilder();
1966 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1968 // Put our Instruction in a list of Instructions
1969 InstructionsBuilder isb = new InstructionsBuilder();
1970 List<Instruction> instructions = new ArrayList<Instruction>();
1971 ib.setKey(new InstructionKey(0));
1972 instructions.add(ib.build());
1973 isb.setInstruction(instructions);
1977 private static InstructionsBuilder createAppyActionInstruction34() {
1979 List<Action> actionList = new ArrayList<Action>();
1980 ActionBuilder ab = new ActionBuilder();
1982 SwPathActionBuilder swPathAction = new SwPathActionBuilder();
1983 ab.setAction(new SwPathActionCaseBuilder().setSwPathAction(swPathAction.build()).build());
1984 ab.setKey(new ActionKey(0));
1985 actionList.add(ab.build());
1987 // Create an Apply Action
1988 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1989 aab.setAction(actionList);
1991 // Wrap our Apply Action in an Instruction
1992 InstructionBuilder ib = new InstructionBuilder();
1993 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1995 // Put our Instruction in a list of Instructions
1996 InstructionsBuilder isb = new InstructionsBuilder();
1997 List<Instruction> instructions = new ArrayList<Instruction>();
1998 ib.setKey(new InstructionKey(0));
1999 instructions.add(ib.build());
2000 isb.setInstruction(instructions);
2004 private static InstructionsBuilder createAppyActionInstruction35() {
2006 List<Action> actionList = new ArrayList<Action>();
2007 ActionBuilder ab = new ActionBuilder();
2008 ActionBuilder ab1 = new ActionBuilder();
2009 ActionBuilder ab2 = new ActionBuilder();
2011 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2012 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2013 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2016 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
2017 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
2018 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
2019 EthernetMatchBuilder ethernetMatch1 = new EthernetMatchBuilder();
2020 EthernetDestinationBuilder ethDestBuilder = new EthernetDestinationBuilder();
2021 ethDestBuilder.setAddress(new MacAddress("00:00:00:00:00:02"));
2022 EthernetMatchBuilder ethernetMatch2 = new EthernetMatchBuilder();
2023 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2024 ethTypeBuilder.setType(new EtherType(0x86ddL));
2026 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
2027 ethernetMatch1.setEthernetDestination(ethDestBuilder.build());
2028 ethernetMatch2.setEthernetType(ethTypeBuilder.build());
2029 setFieldBuilder.setEthernetMatch(ethernetMatch.build());
2030 setFieldBuilder1.setEthernetMatch(ethernetMatch1.build());
2031 setFieldBuilder2.setEthernetMatch(ethernetMatch2.build());
2032 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2033 ab.setKey(new ActionKey(0));
2034 actionList.add(ab.build());
2036 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2037 ab1.setKey(new ActionKey(1));
2038 actionList.add(ab1.build());
2040 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2041 ab2.setKey(new ActionKey(2));
2042 actionList.add(ab2.build());
2044 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2045 aab.setAction(actionList);
2047 InstructionBuilder ib = new InstructionBuilder();
2048 ib.setKey(new InstructionKey(0));
2049 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2051 // Put our Instruction in a list of Instructions
2052 InstructionsBuilder isb = new InstructionsBuilder();
2053 List<Instruction> instructions = new ArrayList<Instruction>();
2054 ib.setKey(new InstructionKey(0));
2055 instructions.add(ib.build());
2056 isb.setInstruction(instructions);
2060 private static InstructionsBuilder createAppyActionInstruction36() {
2062 List<Action> actionList = new ArrayList<Action>();
2063 ActionBuilder ab = new ActionBuilder();
2064 ActionBuilder ab1 = new ActionBuilder();
2066 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2067 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2070 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
2071 VlanMatchBuilder vlanBuilder1 = new VlanMatchBuilder();
2072 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
2073 VlanId vlanId = new VlanId(10);
2074 VlanPcp vpcp = new VlanPcp((short) 3);
2075 vlanBuilder.setVlanPcp(vpcp);
2076 vlanBuilder1.setVlanId(vlanIdBuilder.setVlanId(vlanId).setVlanIdPresent(true).build());
2077 setFieldBuilder.setVlanMatch(vlanBuilder.build());
2078 setFieldBuilder1.setVlanMatch(vlanBuilder1.build());
2079 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2080 ab.setKey(new ActionKey(0));
2081 actionList.add(ab.build());
2082 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2083 ab1.setKey(new ActionKey(1));
2084 actionList.add(ab1.build());
2086 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2087 aab.setAction(actionList);
2089 InstructionBuilder ib = new InstructionBuilder();
2090 ib.setKey(new InstructionKey(0));
2091 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2093 // Put our Instruction in a list of Instructions
2094 InstructionsBuilder isb = new InstructionsBuilder();
2095 List<Instruction> instructions = new ArrayList<Instruction>();
2096 instructions.add(ib.build());
2097 isb.setInstruction(instructions);
2101 private static InstructionsBuilder createAppyActionInstruction37() {
2103 List<Action> actionList = new ArrayList<Action>();
2104 ActionBuilder ab = new ActionBuilder();
2105 ActionBuilder ab1 = new ActionBuilder();
2106 ActionBuilder ab2 = new ActionBuilder();
2108 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2109 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2110 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2112 IpMatchBuilder ipmatch = new IpMatchBuilder();
2113 IpMatchBuilder ipmatch1 = new IpMatchBuilder();
2114 IpMatchBuilder ipmatch2 = new IpMatchBuilder();
2115 Dscp dscp = new Dscp((short) 3);
2116 ipmatch.setIpDscp(dscp);
2117 ipmatch1.setIpEcn((short) 2);
2118 ipmatch2.setIpProtocol((short) 120);
2119 setFieldBuilder.setIpMatch(ipmatch.build());
2120 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2121 ab.setKey(new ActionKey(0));
2122 actionList.add(ab.build());
2124 setFieldBuilder1.setIpMatch(ipmatch1.build());
2125 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2126 ab1.setKey(new ActionKey(1));
2127 actionList.add(ab1.build());
2129 setFieldBuilder2.setIpMatch(ipmatch2.build());
2130 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2131 ab2.setKey(new ActionKey(2));
2132 actionList.add(ab2.build());
2134 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2135 aab.setAction(actionList);
2137 InstructionBuilder ib = new InstructionBuilder();
2138 ib.setKey(new InstructionKey(0));
2139 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2141 // Put our Instruction in a list of Instructions
2142 InstructionsBuilder isb = new InstructionsBuilder();
2143 List<Instruction> instructions = new ArrayList<Instruction>();
2144 instructions.add(ib.build());
2145 isb.setInstruction(instructions);
2149 private static InstructionsBuilder createAppyActionInstruction38() {
2151 List<Action> actionList = new ArrayList<Action>();
2152 ActionBuilder ab = new ActionBuilder();
2153 ActionBuilder ab1 = new ActionBuilder();
2155 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2156 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2158 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2159 Ipv4MatchBuilder ipv4Match1 = new Ipv4MatchBuilder();
2160 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.5210");
2161 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1");
2162 ipv4Match1.setIpv4Destination(dstip);
2163 ipv4Match.setIpv4Source(srcip);
2164 setFieldBuilder.setLayer3Match(ipv4Match.build());
2165 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2166 ab.setKey(new ActionKey(0));
2167 actionList.add(ab.build());
2169 setFieldBuilder1.setLayer3Match(ipv4Match1.build());
2170 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2171 ab1.setKey(new ActionKey(1));
2172 actionList.add(ab1.build());
2174 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2175 aab.setAction(actionList);
2177 InstructionBuilder ib = new InstructionBuilder();
2178 ib.setKey(new InstructionKey(0));
2179 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2181 // Put our Instruction in a list of Instructions
2182 InstructionsBuilder isb = new InstructionsBuilder();
2183 List<Instruction> instructions = new ArrayList<Instruction>();
2184 instructions.add(ib.build());
2185 isb.setInstruction(instructions);
2189 private static InstructionsBuilder createAppyActionInstruction39() {
2191 List<Action> actionList = new ArrayList<Action>();
2192 ActionBuilder ab = new ActionBuilder();
2193 ActionBuilder ab1 = new ActionBuilder();
2195 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2196 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2199 PortNumber tcpsrcport = new PortNumber(1213);
2200 PortNumber tcpdstport = new PortNumber(646);
2201 TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
2202 TcpMatchBuilder tcpmatch1 = new TcpMatchBuilder();
2203 tcpmatch.setTcpSourcePort(tcpsrcport);
2204 tcpmatch1.setTcpDestinationPort(tcpdstport);
2205 setFieldBuilder.setLayer4Match(tcpmatch.build());
2206 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2207 ab.setKey(new ActionKey(0));
2208 actionList.add(ab.build());
2210 setFieldBuilder1.setLayer4Match(tcpmatch1.build());
2211 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2212 ab1.setKey(new ActionKey(1));
2213 actionList.add(ab.build());
2215 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2216 aab.setAction(actionList);
2218 InstructionBuilder ib = new InstructionBuilder();
2219 ib.setKey(new InstructionKey(0));
2220 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2222 // Put our Instruction in a list of Instructions
2223 InstructionsBuilder isb = new InstructionsBuilder();
2224 List<Instruction> instructions = new ArrayList<Instruction>();
2225 instructions.add(ib.build());
2226 isb.setInstruction(instructions);
2230 private static InstructionsBuilder createAppyActionInstruction40() {
2232 List<Action> actionList = new ArrayList<Action>();
2233 ActionBuilder ab = new ActionBuilder();
2234 ActionBuilder ab1 = new ActionBuilder();
2236 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2237 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2240 PortNumber udpsrcport = new PortNumber(1325);
2241 PortNumber udpdstport = new PortNumber(42);
2242 UdpMatchBuilder udpmatch = new UdpMatchBuilder();
2243 UdpMatchBuilder udpmatch1 = new UdpMatchBuilder();
2244 udpmatch.setUdpDestinationPort(udpdstport);
2245 udpmatch1.setUdpSourcePort(udpsrcport);
2246 setFieldBuilder.setLayer4Match(udpmatch.build());
2247 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2248 ab.setKey(new ActionKey(0));
2249 actionList.add(ab.build());
2251 setFieldBuilder1.setLayer4Match(udpmatch1.build());
2252 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2253 ab1.setKey(new ActionKey(1));
2254 actionList.add(ab1.build());
2256 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2257 aab.setAction(actionList);
2259 InstructionBuilder ib = new InstructionBuilder();
2260 ib.setKey(new InstructionKey(0));
2261 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2263 // Put our Instruction in a list of Instructions
2264 InstructionsBuilder isb = new InstructionsBuilder();
2265 List<Instruction> instructions = new ArrayList<Instruction>();
2266 instructions.add(ib.build());
2267 isb.setInstruction(instructions);
2271 private static InstructionsBuilder createAppyActionInstruction41() {
2273 List<Action> actionList = new ArrayList<Action>();
2274 ActionBuilder ab = new ActionBuilder();
2275 ActionBuilder ab1 = new ActionBuilder();
2277 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2278 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2281 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
2282 SctpMatchBuilder sctpmatch1 = new SctpMatchBuilder();
2283 PortNumber srcport = new PortNumber(1435);
2284 PortNumber dstport = new PortNumber(22);
2285 sctpmatch.setSctpSourcePort(srcport);
2286 sctpmatch1.setSctpDestinationPort(dstport);
2287 setFieldBuilder.setLayer4Match(sctpmatch.build());
2288 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2289 ab.setKey(new ActionKey(0));
2290 actionList.add(ab.build());
2292 setFieldBuilder1.setLayer4Match(sctpmatch1.build());
2293 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2294 ab1.setKey(new ActionKey(1));
2295 actionList.add(ab1.build());
2297 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2298 aab.setAction(actionList);
2300 InstructionBuilder ib = new InstructionBuilder();
2301 ib.setKey(new InstructionKey(0));
2302 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2304 // Put our Instruction in a list of Instructions
2305 InstructionsBuilder isb = new InstructionsBuilder();
2306 List<Instruction> instructions = new ArrayList<Instruction>();
2307 instructions.add(ib.build());
2308 isb.setInstruction(instructions);
2312 private static InstructionsBuilder createAppyActionInstruction42() {
2314 List<Action> actionList = new ArrayList<Action>();
2315 ActionBuilder ab = new ActionBuilder();
2316 ActionBuilder ab1 = new ActionBuilder();
2317 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2318 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2321 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
2322 Icmpv4MatchBuilder icmpv4match1 = new Icmpv4MatchBuilder();
2323 icmpv4match.setIcmpv4Type((short) 8);
2324 icmpv4match1.setIcmpv4Code((short) 0);
2325 setFieldBuilder.setIcmpv4Match(icmpv4match.build());
2326 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2327 ab.setKey(new ActionKey(0));
2328 actionList.add(ab.build());
2330 setFieldBuilder1.setIcmpv4Match(icmpv4match1.build());
2331 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2332 ab1.setKey(new ActionKey(1));
2333 actionList.add(ab1.build());
2335 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2336 aab.setAction(actionList);
2338 InstructionBuilder ib = new InstructionBuilder();
2339 ib.setKey(new InstructionKey(0));
2340 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2342 // Put our Instruction in a list of Instructions
2343 InstructionsBuilder isb = new InstructionsBuilder();
2344 List<Instruction> instructions = new ArrayList<Instruction>();
2345 instructions.add(ib.build());
2346 isb.setInstruction(instructions);
2350 private static InstructionsBuilder createAppyActionInstruction43() {
2352 List<Action> actionList = new ArrayList<Action>();
2353 ActionBuilder ab = new ActionBuilder();
2354 ActionBuilder ab1 = new ActionBuilder();
2355 ActionBuilder ab2 = new ActionBuilder();
2356 ActionBuilder ab3 = new ActionBuilder();
2357 ActionBuilder ab4 = new ActionBuilder();
2359 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2360 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2361 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2362 SetFieldBuilder setFieldBuilder3 = new SetFieldBuilder();
2363 SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder();
2365 // setting the values of ARP
2366 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2367 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2368 Ipv4Prefix dstiparp = new Ipv4Prefix("200.71.9.52");
2369 Ipv4Prefix srciparp = new Ipv4Prefix("100.1.1.1");
2370 // create ARP match action
2371 ArpMatchBuilder arpmatch = new ArpMatchBuilder();
2372 ArpMatchBuilder arpmatch1 = new ArpMatchBuilder();
2373 ArpMatchBuilder arpmatch2 = new ArpMatchBuilder();
2374 ArpMatchBuilder arpmatch3 = new ArpMatchBuilder();
2375 ArpMatchBuilder arpmatch4 = new ArpMatchBuilder();
2376 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2377 arpsrc.setAddress(macsrc);
2378 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2379 arpdst.setAddress(macdest);
2380 arpmatch.setArpOp(2);
2381 arpmatch1.setArpSourceHardwareAddress(arpsrc.build());
2382 arpmatch2.setArpTargetHardwareAddress(arpdst.build());
2383 arpmatch3.setArpSourceTransportAddress(srciparp);
2384 arpmatch4.setArpTargetTransportAddress(dstiparp);
2385 setFieldBuilder.setLayer3Match(arpmatch.build());
2386 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2387 ab.setKey(new ActionKey(0));
2388 actionList.add(ab.build());
2390 setFieldBuilder1.setLayer3Match(arpmatch1.build());
2391 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2392 ab1.setKey(new ActionKey(1));
2393 actionList.add(ab1.build());
2395 setFieldBuilder2.setLayer3Match(arpmatch2.build());
2396 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2397 ab2.setKey(new ActionKey(2));
2398 actionList.add(ab2.build());
2400 setFieldBuilder3.setLayer3Match(arpmatch3.build());
2401 ab3.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2402 ab3.setKey(new ActionKey(3));
2403 actionList.add(ab3.build());
2405 setFieldBuilder4.setLayer3Match(arpmatch4.build());
2406 ab4.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2407 ab4.setKey(new ActionKey(4));
2408 actionList.add(ab4.build());
2410 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2411 aab.setAction(actionList);
2413 InstructionBuilder ib = new InstructionBuilder();
2414 ib.setKey(new InstructionKey(0));
2415 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2417 // Put our Instruction in a list of Instructions
2418 InstructionsBuilder isb = new InstructionsBuilder();
2419 List<Instruction> instructions = new ArrayList<Instruction>();
2420 instructions.add(ib.build());
2421 isb.setInstruction(instructions);
2425 private static InstructionsBuilder createAppyActionInstruction44() {
2427 List<Action> actionLists = new ArrayList<Action>();
2428 ActionBuilder ab = new ActionBuilder();
2429 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2430 ActionBuilder ab1 = new ActionBuilder();
2431 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2433 * ActionBuilder ab2 = new ActionBuilder(); SetFieldBuilder
2434 * setFieldBuilder2 = new SetFieldBuilder(); ActionBuilder ab3 = new
2435 * ActionBuilder(); SetFieldBuilder setFieldBuilder3 = new
2436 * SetFieldBuilder(); ActionBuilder ab4 = new ActionBuilder();
2437 * SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder();
2439 ActionBuilder ab5 = new ActionBuilder();
2440 SetFieldBuilder setFieldBuilder5 = new SetFieldBuilder();
2441 ActionBuilder ab6 = new ActionBuilder();
2442 SetFieldBuilder setFieldBuilder6 = new SetFieldBuilder();
2445 Ipv6MatchBuilder ipv6Builder = new Ipv6MatchBuilder();
2446 Ipv6MatchBuilder ipv6Builder1 = new Ipv6MatchBuilder();
2447 // Ipv6MatchBuilder ipv6Builder2 = new Ipv6MatchBuilder();
2448 // Ipv6MatchBuilder ipv6Builder3 = new Ipv6MatchBuilder();
2449 // Ipv6MatchBuilder ipv6Builder4 = new Ipv6MatchBuilder();
2450 Ipv6MatchBuilder ipv6Builder5 = new Ipv6MatchBuilder();
2451 Ipv6MatchBuilder ipv6Builder6 = new Ipv6MatchBuilder();
2453 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2");
2454 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1");
2455 // Ipv6Address ndtarget = new
2456 // Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
2457 // MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
2458 // MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
2459 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2460 nextheader.setIpv6Exthdr(58);
2461 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2462 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2463 ipv6label.setIpv6Flabel(label);
2465 ipv6Builder.setIpv6Source(srcip6);
2466 ipv6Builder1.setIpv6Destination(dstip6);
2467 // ipv6Builder2.setIpv6NdTarget(ndtarget);
2468 // ipv6Builder3.setIpv6NdSll(ndsll);
2469 // ipv6Builder4.setIpv6NdTll(ndtll);
2470 ipv6Builder5.setIpv6ExtHeader(nextheader.build());
2471 ipv6Builder6.setIpv6Label(ipv6label.build());
2473 setFieldBuilder.setLayer3Match(ipv6Builder.build());
2474 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2475 ab.setKey(new ActionKey(0));
2476 actionLists.add(ab.build());
2478 setFieldBuilder1.setLayer3Match(ipv6Builder1.build());
2479 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2480 ab1.setKey(new ActionKey(1));
2481 actionLists.add(ab1.build());
2484 * setFieldBuilder2.setLayer3Match(ipv6Builder2.build());
2486 * SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2487 * ab2.setKey(new ActionKey(2)); actionLists.add(ab2.build());
2489 * setFieldBuilder3.setLayer3Match(ipv6Builder3.build());
2491 * SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2492 * ab3.setKey(new ActionKey(3)); actionLists.add(ab3.build());
2494 * setFieldBuilder4.setLayer3Match(ipv6Builder4.build());
2496 * SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2497 * ab4.setKey(new ActionKey(4)); actionLists.add(ab4.build());
2499 setFieldBuilder5.setLayer3Match(ipv6Builder5.build());
2500 ab5.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder5.build()).build());
2501 ab5.setKey(new ActionKey(5));
2502 actionLists.add(ab5.build());
2504 setFieldBuilder6.setLayer3Match(ipv6Builder6.build());
2505 ab6.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder6.build()).build());
2506 ab6.setKey(new ActionKey(6));
2507 actionLists.add(ab6.build());
2509 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2510 aab.setAction(actionLists);
2512 InstructionBuilder ib = new InstructionBuilder();
2513 ib.setKey(new InstructionKey(0));
2514 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2516 // Put our Instruction in a list of Instructions
2517 InstructionsBuilder isb = new InstructionsBuilder();
2518 List<Instruction> instructions = new ArrayList<Instruction>();
2519 instructions.add(ib.build());
2520 isb.setInstruction(instructions);
2524 private static InstructionsBuilder createAppyActionInstruction45() {
2526 List<Action> actionList = new ArrayList<Action>();
2527 ActionBuilder ab = new ActionBuilder();
2528 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2529 ActionBuilder ab1 = new ActionBuilder();
2530 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2533 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
2534 Icmpv6MatchBuilder icmpv6match1 = new Icmpv6MatchBuilder();
2535 icmpv6match.setIcmpv6Type((short) 135);
2536 icmpv6match1.setIcmpv6Code((short) 0);
2537 setFieldBuilder.setIcmpv6Match(icmpv6match.build());
2538 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2539 ab.setKey(new ActionKey(0));
2540 actionList.add(ab.build());
2542 setFieldBuilder1.setIcmpv6Match(icmpv6match1.build());
2543 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2544 ab1.setKey(new ActionKey(1));
2545 actionList.add(ab1.build());
2547 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2548 aab.setAction(actionList);
2550 InstructionBuilder ib = new InstructionBuilder();
2551 ib.setKey(new InstructionKey(0));
2552 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2554 // Put our Instruction in a list of Instructions
2555 InstructionsBuilder isb = new InstructionsBuilder();
2556 List<Instruction> instructions = new ArrayList<Instruction>();
2557 instructions.add(ib.build());
2558 isb.setInstruction(instructions);
2562 private static InstructionsBuilder createAppyActionInstruction46() {
2564 List<Action> actionList = new ArrayList<Action>();
2565 ActionBuilder ab = new ActionBuilder();
2566 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2567 ActionBuilder ab1 = new ActionBuilder();
2568 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2569 ActionBuilder ab2 = new ActionBuilder();
2570 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2573 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2574 ProtocolMatchFieldsBuilder protomatch1 = new ProtocolMatchFieldsBuilder();
2575 ProtocolMatchFieldsBuilder protomatch2 = new ProtocolMatchFieldsBuilder();
2576 protomatch.setMplsLabel((long) 36008);
2577 protomatch1.setMplsTc((short) 4);
2578 protomatch2.setMplsBos((short) 1);
2579 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2580 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2581 ab.setKey(new ActionKey(0));
2582 actionList.add(ab.build());
2584 setFieldBuilder1.setProtocolMatchFields(protomatch1.build());
2585 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2586 ab1.setKey(new ActionKey(1));
2587 actionList.add(ab1.build());
2589 setFieldBuilder2.setProtocolMatchFields(protomatch2.build());
2590 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2591 ab2.setKey(new ActionKey(2));
2592 actionList.add(ab2.build());
2594 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2595 aab.setAction(actionList);
2597 InstructionBuilder ib = new InstructionBuilder();
2598 ib.setKey(new InstructionKey(0));
2599 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2601 // Put our Instruction in a list of Instructions
2602 InstructionsBuilder isb = new InstructionsBuilder();
2603 List<Instruction> instructions = new ArrayList<Instruction>();
2604 instructions.add(ib.build());
2605 isb.setInstruction(instructions);
2609 private static InstructionsBuilder createAppyActionInstruction47() {
2611 List<Action> actionList = new ArrayList<Action>();
2612 ActionBuilder ab = new ActionBuilder();
2613 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2615 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2616 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask((new BigInteger(new byte[] { 0, 1, 0, 0 }).longValue())).build());
2617 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2618 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2619 actionList.add(ab.build());
2621 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2622 aab.setAction(actionList);
2624 InstructionBuilder ib = new InstructionBuilder();
2625 ib.setKey(new InstructionKey(0));
2626 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2628 // Put our Instruction in a list of Instructions
2629 InstructionsBuilder isb = new InstructionsBuilder();
2630 List<Instruction> instructions = new ArrayList<Instruction>();
2631 instructions.add(ib.build());
2632 isb.setInstruction(instructions);
2636 private static InstructionsBuilder createAppyActionInstruction48() {
2638 List<Action> actionList = new ArrayList<Action>();
2639 ActionBuilder ab = new ActionBuilder();
2640 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2642 TunnelBuilder tunnel = new TunnelBuilder();
2643 tunnel.setTunnelId(BigInteger.valueOf(10668));
2644 setFieldBuilder.setTunnel(tunnel.build());
2645 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2646 ab.setKey(new ActionKey(0));
2647 actionList.add(ab.build());
2649 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2650 aab.setAction(actionList);
2652 InstructionBuilder ib = new InstructionBuilder();
2653 ib.setKey(new InstructionKey(0));
2654 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2656 // Put our Instruction in a list of Instructions
2657 InstructionsBuilder isb = new InstructionsBuilder();
2658 List<Instruction> instructions = new ArrayList<Instruction>();
2659 instructions.add(ib.build());
2660 isb.setInstruction(instructions);
2664 private static MatchBuilder createLLDPMatch() {
2665 MatchBuilder match = new MatchBuilder();
2666 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2667 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2668 ethTypeBuilder.setType(new EtherType(0x88ccL));
2669 eth.setEthernetType(ethTypeBuilder.build());
2670 match.setEthernetMatch(eth.build());
2677 private static MatchBuilder createMatch1() {
2678 MatchBuilder match = new MatchBuilder();
2679 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2680 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2681 ipv4Match.setIpv4Destination(prefix);
2682 Ipv4Match i4m = ipv4Match.build();
2683 match.setLayer3Match(i4m);
2685 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2686 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2687 ethTypeBuilder.setType(new EtherType(0x0800L));
2688 eth.setEthernetType(ethTypeBuilder.build());
2689 match.setEthernetMatch(eth.build());
2696 private static MatchBuilder createIPv4DstMatch() {
2697 MatchBuilder match = new MatchBuilder();
2698 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2699 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2700 ipv4Match.setIpv4Destination(prefix);
2701 Ipv4Match i4m = ipv4Match.build();
2702 match.setLayer3Match(i4m);
2710 private static MatchBuilder createIPv4SrcMatch() {
2711 MatchBuilder match = new MatchBuilder();
2712 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2713 Ipv4Prefix prefix = new Ipv4Prefix("10.20.30.40/24");
2714 ipv4Match.setIpv4Source(prefix);
2715 Ipv4Match i4m = ipv4Match.build();
2716 match.setLayer3Match(i4m);
2718 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2719 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2720 ethTypeBuilder.setType(new EtherType(0x0800L));
2721 eth.setEthernetType(ethTypeBuilder.build());
2722 match.setEthernetMatch(eth.build());
2729 private static MatchBuilder createMatch2() {
2730 MatchBuilder match = new MatchBuilder();
2731 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2732 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1");
2733 ipv4Match.setIpv4Source(prefix);
2734 Ipv4Match i4m = ipv4Match.build();
2735 match.setLayer3Match(i4m);
2737 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2738 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2739 ethTypeBuilder.setType(new EtherType(0x0800L));
2740 eth.setEthernetType(ethTypeBuilder.build());
2741 match.setEthernetMatch(eth.build());
2748 private static MatchBuilder createMatch3() {
2749 MatchBuilder match = new MatchBuilder();
2750 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
2751 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
2752 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
2753 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
2754 match.setEthernetMatch(ethernetMatch.build());
2762 private static MatchBuilder createICMPv6Match1() {
2764 MatchBuilder match = new MatchBuilder();
2765 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2766 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2767 ethTypeBuilder.setType(new EtherType(0x86ddL));
2768 eth.setEthernetType(ethTypeBuilder.build());
2769 match.setEthernetMatch(eth.build());
2771 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2772 ipmatch.setIpProtocol((short) 256);
2773 match.setIpMatch(ipmatch.build());
2775 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2777 icmpv6match.setIcmpv6Type((short) 135);
2778 icmpv6match.setIcmpv6Code((short) 1);
2779 match.setIcmpv6Match(icmpv6match.build());
2784 private static MatchBuilder createMatch33() {
2786 MatchBuilder match = new MatchBuilder();
2787 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2788 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.10");
2789 ipv4Match.setIpv4Source(prefix);
2790 Ipv4Match i4m = ipv4Match.build();
2791 match.setLayer3Match(i4m);
2793 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2794 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2795 ethTypeBuilder.setType(new EtherType(0xfffeL));
2796 eth.setEthernetType(ethTypeBuilder.build());
2797 match.setEthernetMatch(eth.build());
2801 private static MatchBuilder createInphyportMatch(NodeId nodeId) {
2802 MatchBuilder match = new MatchBuilder();
2803 match.setInPort(new NodeConnectorId(nodeId + ":202"));
2804 match.setInPhyPort(new NodeConnectorId(nodeId + ":10122"));
2808 private static MatchBuilder createEthernetMatch() {
2809 MatchBuilder match = new MatchBuilder();
2811 byte[] mask1 = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2812 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2814 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
2816 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2817 EtherType type = new EtherType(0x0800L);
2818 ethmatch.setEthernetType(ethtype.setType(type).build());
2820 EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet
2823 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2824 ethdest.setAddress(macdest);
2825 ethdest.setMask(new MacAddress("ff:ff:ff:00:00:00"));
2827 ethmatch.setEthernetDestination(ethdest.build());
2829 EthernetSourceBuilder ethsrc = new EthernetSourceBuilder();
2830 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2831 ethsrc.setAddress(macsrc);
2832 ethsrc.setMask(new MacAddress("ff:ff:00:00:00:00"));
2834 ethmatch.setEthernetSource(ethsrc.build());
2835 match.setEthernetMatch(ethmatch.build());
2844 private static MatchBuilder createVlanMatch() {
2845 MatchBuilder match = new MatchBuilder();
2846 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder(); // vlan match
2847 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
2848 VlanId vlanId = new VlanId(10);
2849 VlanPcp vpcp = new VlanPcp((short) 3);
2850 vlanBuilder.setVlanPcp(vpcp);
2851 vlanIdBuilder.setVlanId(vlanId);
2852 vlanIdBuilder.setVlanIdPresent(true);
2853 vlanBuilder.setVlanId(vlanIdBuilder.build());
2854 match.setVlanMatch(vlanBuilder.build());
2861 private static MatchBuilder createArpMatch() {
2862 MatchBuilder match = new MatchBuilder();
2864 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2865 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2866 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2868 byte[] mask = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2869 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2871 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2872 EtherType type = new EtherType(0x0806L);
2873 ethmatch.setEthernetType(ethtype.setType(type).build());
2875 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
2876 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2878 ArpMatchBuilder arpmatch = new ArpMatchBuilder(); // arp match
2879 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2880 arpsrc.setAddress(macsrc);
2881 arpsrc.setMask(new MacAddress("ff:ff:ff:00:00:00"));
2882 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2883 arpdst.setAddress(macdest);
2884 arpdst.setMask(new MacAddress("ff:ff:00:00:00:00"));
2885 arpmatch.setArpOp(2);
2886 arpmatch.setArpSourceHardwareAddress(arpsrc.build());
2887 arpmatch.setArpTargetHardwareAddress(arpdst.build());
2888 arpmatch.setArpSourceTransportAddress(srcip);
2889 arpmatch.setArpTargetTransportAddress(dstip);
2891 match.setEthernetMatch(ethmatch.build());
2892 match.setLayer3Match(arpmatch.build());
2900 private static MatchBuilder createIPMatch() {
2901 MatchBuilder match = new MatchBuilder();
2902 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2903 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2904 EtherType type = new EtherType(0x0800L);
2905 ethmatch.setEthernetType(ethtype.setType(type).build());
2906 match.setEthernetMatch(ethmatch.build());
2908 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2909 ipmatch.setIpProtocol((short) 1);
2910 Dscp dscp = new Dscp((short) 3);
2911 ipmatch.setIpDscp(dscp);
2912 ipmatch.setIpEcn((short) 2);
2913 match.setIpMatch(ipmatch.build());
2920 private static MatchBuilder createL3IPv4Match() {
2921 MatchBuilder match = new MatchBuilder();
2923 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2924 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2925 ethTypeBuilder.setType(new EtherType(0x0800L));
2926 eth.setEthernetType(ethTypeBuilder.build());
2927 match.setEthernetMatch(eth.build());
2929 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2930 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
2931 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2932 Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
2933 ipv4match.setIpv4Destination(dstip);
2934 ipv4match.setIpv4Source(srcip);
2935 match.setLayer3Match(ipv4match.build());
2944 private static MatchBuilder createL3IPv6Match() {
2945 MatchBuilder match = new MatchBuilder();
2947 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2948 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2949 ethTypeBuilder.setType(new EtherType(0x86ddL));
2950 eth.setEthernetType(ethTypeBuilder.build());
2951 match.setEthernetMatch(eth.build());
2953 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2/64");
2954 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1/56");
2955 Ipv6Address ndtarget = new Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
2956 MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
2957 MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
2958 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2959 nextheader.setIpv6Exthdr(58);
2960 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2961 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2962 ipv6label.setIpv6Flabel(label);
2963 ipv6label.setFlabelMask(new Ipv6FlowLabel(1L));
2965 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2967 icmpv6match.setIcmpv6Type((short) 135);
2968 icmpv6match.setIcmpv6Code((short) 0);
2969 match.setIcmpv6Match(icmpv6match.build());
2971 Ipv6MatchBuilder ipv6match = new Ipv6MatchBuilder();
2972 // ipv6match.setIpv6Source(srcip6);
2973 // ipv6match.setIpv6Destination(dstip6);
2974 // ipv6match.setIpv6ExtHeader(nextheader.build());
2975 ipv6match.setIpv6NdSll(ndsll);
2976 ipv6match.setIpv6NdTll(ndtll);
2977 // ipv6match.setIpv6NdTarget(ndtarget);
2978 ipv6match.setIpv6Label(ipv6label.build());
2980 match.setLayer3Match(ipv6match.build());
2989 private static MatchBuilder createICMPv4Match() {
2990 MatchBuilder match = new MatchBuilder();
2991 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2992 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2993 ethTypeBuilder.setType(new EtherType(0x0800L));
2994 eth.setEthernetType(ethTypeBuilder.build());
2995 match.setEthernetMatch(eth.build());
2997 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2998 ipmatch.setIpProtocol((short) 1);
2999 match.setIpMatch(ipmatch.build());
3001 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder(); // icmpv4
3003 icmpv4match.setIcmpv4Type((short) 8);
3004 icmpv4match.setIcmpv4Code((short) 0);
3005 match.setIcmpv4Match(icmpv4match.build());
3012 private static MatchBuilder createICMPv6Match() {
3014 MatchBuilder match = new MatchBuilder();
3015 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3016 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3017 ethTypeBuilder.setType(new EtherType(0x86ddL));
3018 eth.setEthernetType(ethTypeBuilder.build());
3019 match.setEthernetMatch(eth.build());
3021 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3022 ipmatch.setIpProtocol((short) 58);
3023 match.setIpMatch(ipmatch.build());
3025 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
3027 icmpv6match.setIcmpv6Type((short) 135);
3028 icmpv6match.setIcmpv6Code((short) 1);
3029 match.setIcmpv6Match(icmpv6match.build());
3037 private static MatchBuilder createToSMatch() {
3038 MatchBuilder match = new MatchBuilder();
3039 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
3040 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
3041 EtherType type = new EtherType(0x0800L);
3042 ethmatch.setEthernetType(ethtype.setType(type).build());
3043 match.setEthernetMatch(ethmatch.build());
3045 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3046 ipmatch.setIpProtocol((short) 6);
3047 Dscp dscp = new Dscp((short) 8);
3048 ipmatch.setIpDscp(dscp);
3049 match.setIpMatch(ipmatch.build());
3057 private static MatchBuilder createL4TCPMatch() {
3058 MatchBuilder match = new MatchBuilder();
3060 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3061 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3062 ethTypeBuilder.setType(new EtherType(0x0800L));
3063 eth.setEthernetType(ethTypeBuilder.build());
3064 match.setEthernetMatch(eth.build());
3066 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3067 ipmatch.setIpProtocol((short) 6);
3068 match.setIpMatch(ipmatch.build());
3070 PortNumber srcport = new PortNumber(1213);
3071 PortNumber dstport = new PortNumber(646);
3072 TcpMatchBuilder tcpmatch = new TcpMatchBuilder(); // tcp match
3073 tcpmatch.setTcpSourcePort(srcport);
3074 tcpmatch.setTcpDestinationPort(dstport);
3075 match.setLayer4Match(tcpmatch.build());
3083 private static MatchBuilder createL4UDPMatch() {
3084 MatchBuilder match = new MatchBuilder();
3086 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3087 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3088 ethTypeBuilder.setType(new EtherType(0x0800L));
3089 eth.setEthernetType(ethTypeBuilder.build());
3090 match.setEthernetMatch(eth.build());
3092 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3093 ipmatch.setIpProtocol((short) 17);
3094 match.setIpMatch(ipmatch.build());
3096 PortNumber srcport = new PortNumber(1325);
3097 PortNumber dstport = new PortNumber(42);
3098 UdpMatchBuilder udpmatch = new UdpMatchBuilder(); // udp match
3099 udpmatch.setUdpDestinationPort(dstport);
3100 udpmatch.setUdpSourcePort(srcport);
3101 match.setLayer4Match(udpmatch.build());
3109 private static MatchBuilder createL4SCTPMatch() {
3110 MatchBuilder match = new MatchBuilder();
3112 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3113 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3114 ethTypeBuilder.setType(new EtherType(0x0800L));
3115 eth.setEthernetType(ethTypeBuilder.build());
3116 match.setEthernetMatch(eth.build());
3118 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3119 ipmatch.setIpProtocol((short) 132);
3120 match.setIpMatch(ipmatch.build());
3122 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
3123 PortNumber srcport = new PortNumber(1435);
3124 PortNumber dstport = new PortNumber(22);
3125 sctpmatch.setSctpSourcePort(srcport);
3126 sctpmatch.setSctpDestinationPort(dstport);
3127 match.setLayer4Match(sctpmatch.build());
3135 private static MatchBuilder createMetadataMatch() {
3136 MatchBuilder match = new MatchBuilder();
3137 byte[] metamask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
3138 MetadataBuilder metadata = new MetadataBuilder(); // metadata match
3139 metadata.setMetadata(BigInteger.valueOf(500L));
3140 metadata.setMetadataMask(new BigInteger(metamask));
3141 match.setMetadata(metadata.build());
3149 private static MatchBuilder createMplsMatch() {
3150 MatchBuilder match = new MatchBuilder();
3152 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3153 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3154 ethTypeBuilder.setType(new EtherType(0x8847L));
3155 eth.setEthernetType(ethTypeBuilder.build());
3156 match.setEthernetMatch(eth.build());
3158 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3160 protomatch.setMplsLabel((long) 36008);
3161 protomatch.setMplsTc((short) 4);
3162 protomatch.setMplsBos((short) 1);
3163 match.setProtocolMatchFields(protomatch.build());
3172 private static MatchBuilder createPbbMatch() {
3173 MatchBuilder match = new MatchBuilder();
3175 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3176 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3177 ethTypeBuilder.setType(new EtherType(0x88E7L));
3178 eth.setEthernetType(ethTypeBuilder.build());
3179 match.setEthernetMatch(eth.build());
3181 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3183 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new BigInteger(new byte[] { 0, 1, 0, 0 }).longValue()).build());
3184 match.setProtocolMatchFields(protomatch.build());
3193 private static MatchBuilder createTunnelIDMatch() {
3194 MatchBuilder match = new MatchBuilder();
3195 TunnelBuilder tunnel = new TunnelBuilder(); // tunnel id match
3196 tunnel.setTunnelId(BigInteger.valueOf(10668));
3197 byte[] mask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
3198 tunnel.setTunnelMask(new BigInteger(mask));
3199 match.setTunnel(tunnel.build());
3204 public void _removeMDFlow(CommandInterpreter ci) {
3205 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
3206 NodeBuilder tn = createTestNode(ci.nextArgument());
3207 String flowtype = ci.nextArgument();
3209 if (flowtype.equals("fTM")) {
3210 tf = createtablemiss(tn, flowtype, ci.nextArgument());
3212 tf = createTestFlow(tn, flowtype, ci.nextArgument());
3214 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class).child(Node.class, tn.getKey())
3215 .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf.getTableId()))
3216 .child(Flow.class, tf.getKey()).build();
3217 modification.removeConfigurationData(path1);
3218 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
3220 RpcResult<TransactionStatus> result = commitFuture.get();
3221 TransactionStatus status = result.getResult();
3222 ci.println("Status of Flow Data Loaded Transaction: " + status);
3224 } catch (InterruptedException e) {
3225 LOG.error(e.getMessage(), e);
3226 } catch (ExecutionException e) {
3227 LOG.error(e.getMessage(), e);
3232 * @param ci arguments: switchId flowType tableNum
3235 * e.g.: addMDFlow openflow:1 f1 42
3238 public void _addMDFlow(CommandInterpreter ci) {
3239 NodeBuilder tn = createTestNode(ci.nextArgument());
3240 String flowtype = ci.nextArgument();
3242 if (flowtype.equals("fTM")) {
3243 tf = createtablemiss(tn, flowtype, ci.nextArgument());
3245 tf = createTestFlow(tn, flowtype, ci.nextArgument());
3247 writeFlow(ci, tf, tn);
3250 private void writeFlow(CommandInterpreter ci, FlowBuilder flow, NodeBuilder nodeBuilder) {
3251 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
3252 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class)
3253 .child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
3254 .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.getKey()).build();
3255 modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
3256 modification.putConfigurationData(path1, flow.build());
3257 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
3259 RpcResult<TransactionStatus> result = commitFuture.get();
3260 TransactionStatus status = result.getResult();
3261 ci.println("Status of Flow Data Loaded Transaction: " + status);
3263 } catch (InterruptedException e) {
3264 LOG.error(e.getMessage(), e);
3265 } catch (ExecutionException e) {
3266 LOG.error(e.getMessage(), e);
3270 public void _modifyMDFlow(CommandInterpreter ci) {
3271 NodeBuilder tn = createTestNode(ci.nextArgument());
3272 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
3273 tf.setFlowName(updatedFlowName);
3274 writeFlow(ci, tf, tn);
3275 tf.setFlowName(originalFlowName);
3276 writeFlow(ci, tf, tn);
3279 private static NodeRef createNodeRef(String string) {
3280 NodeKey key = new NodeKey(new NodeId(string));
3281 InstanceIdentifier<Node> path = InstanceIdentifier.builder(Nodes.class).child(Node.class, key)
3284 return new NodeRef(path);
3288 public String getHelp() {
3293 * usage testSwitchFlows <numberOfSwitches> <numberOfFlows> <warmup iterations> <Number Of Threads>
3294 * ex: _perfFlowTest 10 5 1 2
3296 public void _perfFlowTest(CommandInterpreter ci) {
3298 String numberOfSwtichesStr = ci.nextArgument();
3299 String numberOfFlowsStr = ci.nextArgument();
3300 String warmupIterationsStr = ci.nextArgument();
3301 String threadCountStr = ci.nextArgument();
3302 String warmUpStr = ci.nextArgument();
3304 Collection<String> testResults = null;
3305 if(testResults == null){
3306 testResults = new ArrayList<String>();
3309 int numberOfSwtiches = 0;
3310 int numberOfFlows = 0;
3311 int warmupIterations = 0;
3312 boolean warmUpIterations = false;
3314 int threadCount = 0;
3315 if(numberOfSwtichesStr !=null && !numberOfSwtichesStr.trim().equals("")){
3316 numberOfSwtiches = new Integer(numberOfSwtichesStr).intValue();
3318 numberOfSwtiches = 2;
3321 if(numberOfFlowsStr !=null && !numberOfFlowsStr.trim().equals("")){
3322 numberOfFlows = new Integer(numberOfFlowsStr).intValue();
3327 if(warmupIterationsStr !=null && !warmupIterationsStr.trim().equals("")){
3328 warmupIterations = new Integer(warmupIterationsStr).intValue();
3330 warmupIterations = 2;
3333 if(threadCountStr !=null && !threadCountStr.trim().equals("")){
3334 threadCount = new Integer(threadCountStr).intValue();
3338 if(warmUpStr !=null && !warmUpStr.trim().equals("") && warmUpStr.trim().equals("true")){
3339 warmUpIterations = true;
3341 warmUpIterations = false;
3343 ci.println("* Test Configurations*");
3344 ci.println("* numberOfSwtiches:::"+numberOfSwtiches+"");
3345 ci.println("* numberOfFlows:::"+numberOfFlows+"");
3346 ci.println("* warmupIterations:::"+warmupIterations+"");
3347 ci.println("* Number of Threads :::"+threadCount+"");
3348 ci.println("* Warmup Required? :::"+warmUpIterations+"");
3350 String dataPath="openflow:1";
3351 String flowType = "fTM";
3354 String tableId = "0";
3355 if(warmUpIterations){
3356 ci.println("----Warmup Started-----");
3357 for(int j =1; j<= warmupIterations; j++){
3358 for(int i =1;i<=numberOfSwtiches;i++){
3359 dataPath = "openflow:"+i;
3360 tn = createTestNode(dataPath);
3361 for (int flow=1;flow<numberOfFlows;flow++){
3362 tf = createTestFlow_perfTest(tn, "f1", tableId, flow);
3363 writeFlow(ci, tf, tn);
3368 ci.println("----Warmup Done-----");
3371 ExecutorService executor = Executors.newFixedThreadPool(threadCount);
3374 for ( int t=0;t< threadCount;t++){
3376 Runnable tRunnable = new TestFlowThread(numberOfSwtiches, numberOfFlows, ci, t, tableID);
3377 executor.execute(tRunnable);
3379 executor.shutdown();
3380 executor.awaitTermination(1, TimeUnit.SECONDS);
3381 } catch(Exception e){
3382 ci.println("Exception:"+e.getMessage());
3386 public class TestFlowThread implements Runnable {
3388 int numberOfSwitches;
3391 CommandInterpreter ci;
3394 Collection<String> testResults = null;
3397 TestFlowThread(int numberOfSwtiches, int numberOfFlows, CommandInterpreter ci, int t, int tableID) {
3398 this.numberOfSwitches = numberOfSwtiches;
3399 this.numberOfFlows = numberOfFlows;
3401 this.theadNumber = t;
3402 this.tableID = tableID;
3410 public void executeFlow() {
3412 String dataPath = "openflow:1";
3415 //String tableId = "0";
3417 ci.println("New Thread started with id: ID_"
3418 + this.theadNumber);
3419 int totalNumberOfFlows = 0;
3420 long startTime = System.currentTimeMillis();
3422 for (int i = 1; i <= this.numberOfSwitches; i++) {
3423 dataPath = "openflow:" + i;
3424 tn = createTestNode(dataPath);
3425 for (int flow2 = 1; flow2 <= this.numberOfFlows; flow2++) {
3426 tf = createTestFlow_perfTest(tn, "f1", ""+this.tableID, flow2);
3427 writeFlow(this.ci, tf, tn);
3428 totalNumberOfFlows++;
3431 long endTime = System.currentTimeMillis();
3432 long timeInSeconds = Math.round((endTime - startTime) / 1000);
3433 if (timeInSeconds > 0) {
3434 ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::" + Math.round(totalNumberOfFlows / timeInSeconds));
3436 ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::" + totalNumberOfFlows);
3442 * usage testAllFlows <dp>
3443 * ex: _perfFlowTest 1
3445 public void _testAllFlows(CommandInterpreter ci) {
3446 String dataPathID = ci.nextArgument();
3447 int numberOfFlows = 82;
3448 int threadCount = 0;
3449 if(dataPathID ==null || dataPathID.trim().equals("")){
3452 ci.println("* Test All Flows *");
3453 ci.println("* dataPathID:::"+dataPathID+"");
3454 String dataPath="openflow:"+dataPathID;
3455 String tableId = "0";
3456 NodeBuilder tn = createTestNode(dataPath);
3458 for (int flow=1;flow<numberOfFlows;flow++){
3459 String flowID = "f"+flow;
3461 tf = createTestFlow(tn, flowID, tableId);
3462 writeFlow(ci, tf, tn);
3463 } catch(Exception e){
3464 ci.println("--Test Failed--Issue found while adding flow"+ flow);