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.TcpFlagMatchBuilder;
168 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TunnelBuilder;
169 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
170 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder;
171 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match;
172 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
173 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
174 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder;
175 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
176 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
177 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.protocol.match.fields.PbbBuilder;
178 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
179 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.NodeErrorListener;
180 import org.opendaylight.yangtools.concepts.Registration;
181 import org.opendaylight.yangtools.yang.binding.DataObject;
182 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
183 import org.opendaylight.yangtools.yang.common.RpcResult;
184 import org.osgi.framework.BundleContext;
185 import org.slf4j.Logger;
186 import org.slf4j.LoggerFactory;
188 public class OpenflowpluginTestCommandProvider implements CommandProvider {
190 private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
192 private DataBrokerService dataBrokerService;
193 private ProviderContext pc;
194 private final BundleContext ctx;
195 private FlowBuilder testFlow;
196 private NodeBuilder testNode;
197 private final String originalFlowName = "Foo";
198 private final String updatedFlowName = "Bar";
199 private final SalFlowListener flowEventListener = new FlowEventListenerLoggingImpl();
200 private final NodeErrorListener nodeErrorListener = new NodeErrorListenerLoggingImpl();
201 private static NotificationService notificationService;
202 private Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> listener1Reg;
203 private Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> listener2Reg;
205 public OpenflowpluginTestCommandProvider(BundleContext ctx) {
209 public void onSessionInitiated(ProviderContext session) {
211 notificationService = session.getSALService(NotificationService.class);
213 listener1Reg = notificationService.registerNotificationListener(flowEventListener);
214 listener2Reg = notificationService.registerNotificationListener(nodeErrorListener);
215 dataBrokerService = session.getSALService(DataBrokerService.class);
216 ctx.registerService(CommandProvider.class.getName(), this, null);
217 createTestFlow(createTestNode(null), null, null);
220 private NodeBuilder createTestNode(String nodeId) {
221 if (nodeId == null) {
222 nodeId = OpenflowpluginTestActivator.NODE_ID;
224 NodeRef nodeOne = createNodeRef(nodeId);
225 NodeBuilder builder = new NodeBuilder();
226 builder.setId(new NodeId(nodeId));
227 builder.setKey(new NodeKey(builder.getId()));
232 private InstanceIdentifier<Node> nodeBuilderToInstanceId(NodeBuilder node) {
233 return InstanceIdentifier.builder(Nodes.class).child(Node.class, node.getKey()).toInstance();
236 private FlowBuilder createTestFlow(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
238 FlowBuilder flow = new FlowBuilder();
241 String flowType = flowTypeArg;
242 if (flowType == null) {
251 flow.setMatch(createMatch1().build());
252 flow.setInstructions(createDecNwTtlInstructions().build());
256 flow.setMatch(createMatch2().build());
257 flow.setInstructions(createDropInstructions().build());
261 flow.setMatch(createMatch3().build());
262 flow.setInstructions(createDropInstructions().build());
266 flow.setMatch(createEthernetMatch().build());
267 flow.setInstructions(createDropInstructions().build());
271 flow.setMatch(createMatch1().build());
272 flow.setInstructions(createAppyActionInstruction().build());
276 flow.setMatch(createMatch1().build());
277 flow.setInstructions(createGotoTableInstructions().build());
281 flow.setMatch(createMatch1().build());
282 flow.setInstructions(createMeterInstructions().build());
286 flow.setMatch(createMatch1().build());
287 flow.setInstructions(createAppyActionInstruction1().build());
291 flow.setMatch(createMatch1().build());
292 flow.setInstructions(createAppyActionInstruction2().build());
296 flow.setMatch(createMatch1().build());
297 flow.setInstructions(createAppyActionInstruction3().build());
301 flow.setMatch(createMatch1().build());
302 flow.setInstructions(createAppyActionInstruction4().build());
306 flow.setMatch(createMatch1().build());
307 flow.setInstructions(createAppyActionInstruction5().build());
311 flow.setMatch(createMatch1().build());
312 flow.setInstructions(createAppyActionInstruction6().build());
316 flow.setMatch(createMatch1().build());
317 flow.setInstructions(createAppyActionInstruction7().build());
321 flow.setMatch(createMatch1().build());
322 flow.setInstructions(createAppyActionInstruction8().build());
326 flow.setMatch(createMatch1().build());
327 flow.setInstructions(createAppyActionInstruction9().build());
331 flow.setMatch(createMatch1().build());
332 flow.setInstructions(createAppyActionInstruction10().build());
336 flow.setMatch(createMatch1().build());
337 flow.setInstructions(createAppyActionInstruction11().build());
341 flow.setMatch(createMatch1().build());
342 flow.setInstructions(createAppyActionInstruction12().build());
346 flow.setMatch(createMatch1().build());
347 flow.setInstructions(createAppyActionInstruction13().build());
351 flow.setMatch(createMatch1().build());
352 flow.setInstructions(createAppyActionInstruction14().build());
356 flow.setMatch(createMatch1().build());
357 flow.setInstructions(createAppyActionInstruction15().build());
361 // f23 can be used as test-case for generating error notification
362 // if the particular group is not configured - tested
363 flow.setMatch(createMatch1().build());
364 flow.setInstructions(createAppyActionInstruction16().build());
368 flow.setMatch(createMatch1().build());
369 flow.setInstructions(createAppyActionInstruction17().build());
373 flow.setMatch(createMatch1().build());
374 flow.setInstructions(createAppyActionInstruction18().build());
378 flow.setMatch(createMatch1().build());
379 flow.setInstructions(createAppyActionInstruction19().build());
383 flow.setMatch(createMatch1().build());
384 flow.setInstructions(createMetadataInstructions().build());
388 flow.setMatch(createMatch1().build());
389 flow.setInstructions(createAppyActionInstruction20().build());
393 flow.setMatch(createMatch1().build());
394 flow.setInstructions(createAppyActionInstruction21().build());
398 flow.setMatch(createMatch1().build());
399 flow.setInstructions(createAppyActionInstruction22().build());
403 flow.setMatch(createMatch1().build());
404 flow.setInstructions(createAppyActionInstruction23(nodeBuilder.getId()).build());
408 flow.setMatch(createMatch1().build());
409 flow.setInstructions(createAppyActionInstruction24().build());
413 flow.setMatch(createMatch1().build());
414 flow.setInstructions(createAppyActionInstruction25().build());
418 flow.setMatch(createMatch1().build());
419 flow.setInstructions(createAppyActionInstruction26().build());
423 flow.setMatch(createMatch1().build());
424 flow.setInstructions(createAppyActionInstruction27().build());
428 flow.setMatch(createMatch1().build());
429 flow.setInstructions(createAppyActionInstruction28().build());
433 flow.setMatch(createMatch1().build());
434 flow.setInstructions(createAppyActionInstruction29().build());
438 flow.setMatch(createMatch1().build());
439 flow.setInstructions(createAppyActionInstruction30().build());
443 flow.setMatch(createMatch1().build());
444 flow.setInstructions(createAppyActionInstruction31().build());
448 flow.setMatch(createMatch1().build());
449 flow.setInstructions(createAppyActionInstruction32().build());
453 flow.setMatch(createMatch1().build());
454 flow.setInstructions(createAppyActionInstruction33().build());
458 flow.setMatch(createMatch1().build());
459 flow.setInstructions(createAppyActionInstruction34().build());
463 flow.setMatch(createICMPv6Match().build());
464 flow.setInstructions(createDecNwTtlInstructions().build());
468 flow.setMatch(createInphyportMatch(nodeBuilder.getId()).build());
469 flow.setInstructions(createDropInstructions().build());
473 flow.setMatch(createMetadataMatch().build());
474 flow.setInstructions(createDropInstructions().build());
478 flow.setMatch(createL3IPv6Match().build());
479 flow.setInstructions(createDecNwTtlInstructions().build());
483 flow.setMatch(createL4SCTPMatch().build());
484 flow.setInstructions(createAppyActionInstruction().build());
488 flow.setMatch(createTunnelIDMatch().build());
489 flow.setInstructions(createGotoTableInstructions().build());
493 flow.setMatch(createVlanMatch().build());
494 flow.setInstructions(createMeterInstructions().build());
498 flow.setMatch(createPbbMatch().build());
499 flow.setInstructions(createMeterInstructions().build());
503 flow.setMatch(createVlanMatch().build());
504 flow.setInstructions(createDropInstructions().build());
508 flow.setMatch(createL4TCPMatch().build());
509 flow.setInstructions(createDropInstructions().build());
514 flow.setMatch(createL4UDPMatch().build());
515 flow.setInstructions(createDropInstructions().build());
519 flow.setMatch(new MatchBuilder().build());
520 flow.setInstructions(createSentToControllerInstructions().build());
525 flow.setMatch(createToSMatch().build());
526 flow.setInstructions(createDropInstructions().build());
530 flow.setMatch(createToSMatch().build());
531 flow.setInstructions(createOutputInstructions("INPORT", 10).build());
535 flow.setMatch(createToSMatch().build());
536 flow.setInstructions(createOutputInstructions("FLOOD", 20).build());
540 flow.setMatch(createToSMatch().build());
541 flow.setInstructions(createOutputInstructions("ALL", 30).build());
545 flow.setMatch(createToSMatch().build());
546 flow.setInstructions(createOutputInstructions("NORMAL", 40).build());
550 flow.setMatch(createToSMatch().build());
551 flow.setInstructions(createOutputInstructions("LOCAL", 50).build());
555 flow.setMatch(createToSMatch().build());
556 flow.setInstructions(createOutputInstructions("TABLE", 60).build());
560 flow.setMatch(createToSMatch().build());
561 flow.setInstructions(createOutputInstructions("NONE", 70).build());
565 flow.setMatch(createToSMatch().build());
566 flow.setInstructions(createStripVlanInstructions().build());
567 flow.setBarrier(Boolean.TRUE);
571 flow.setMatch(createMatch1().build());
572 flow.setInstructions(createAppyActionInstruction35().build());
576 flow.setMatch(createMatch1().build());
577 flow.setInstructions(createAppyActionInstruction36().build());
581 flow.setMatch(createMatch1().build());
582 flow.setInstructions(createAppyActionInstruction37().build());
586 flow.setMatch(createMatch1().build());
587 flow.setInstructions(createAppyActionInstruction38().build());
591 flow.setMatch(createL4TCPMatch().build());
592 flow.setInstructions(createAppyActionInstruction39().build());
596 flow.setMatch(createL4UDPMatch().build());
597 flow.setInstructions(createAppyActionInstruction40().build());
601 flow.setMatch(createL4SCTPMatch().build());
602 flow.setInstructions(createAppyActionInstruction41().build());
606 flow.setMatch(createICMPv4Match().build());
607 flow.setInstructions(createAppyActionInstruction42().build());
611 flow.setMatch(createArpMatch().build());
612 flow.setInstructions(createAppyActionInstruction43().build());
616 flow.setMatch(createL3IPv6Match().build());
617 flow.setInstructions(createAppyActionInstruction44().build());
621 flow.setMatch(createICMPv6Match().build());
622 flow.setInstructions(createAppyActionInstruction45().build());
626 flow.setMatch(createMplsMatch().build());
627 flow.setInstructions(createAppyActionInstruction46().build());
631 flow.setMatch(createPbbMatch().build());
632 flow.setInstructions(createAppyActionInstruction47().build());
636 flow.setMatch(createTunnelIDMatch().build());
637 flow.setInstructions(createAppyActionInstruction48().build());
641 flow.setMatch(createMatch33().build());
642 flow.setInstructions(createDropInstructions().build());
646 flow.setMatch(createICMPv6Match1().build());
647 flow.setInstructions(createDecNwTtlInstructions().build());
651 flow.setMatch(createVlanMatch().build());
652 flow.setInstructions(createAppyActionInstruction88().build());
656 flow.setMatch(createLLDPMatch().build());
657 flow.setInstructions(createSentToControllerInstructions().build());
661 flow.setMatch(createToSMatch().build());
662 flow.setInstructions(createOutputInstructions().build());
665 id += 83; // Test TCP_Flag Match
666 flow.setMatch(createTcpFlagMatch().build());
667 flow.setInstructions(createDropInstructions().build());
671 flow.setMatch(createVlanMatch().build()); // match vlan=10,dl_vlan_pcp=3
672 flow.setInstructions(createAppyActionInstruction88().build()); // vlan_pcp=4
675 LOG.warn("flow type not understood: {}", flowType);
678 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
679 if (null == flow.isBarrier()) {
680 flow.setBarrier(Boolean.FALSE);
682 // flow.setBufferId(new Long(12));
683 BigInteger value = new BigInteger("10", 10);
684 // BigInteger outputPort = new BigInteger("65535", 10);
685 flow.setCookie(new FlowCookie(value));
686 flow.setCookieMask(new FlowCookie(value));
687 flow.setHardTimeout(0);
688 flow.setIdleTimeout(0);
689 flow.setInstallHw(false);
690 flow.setStrict(false);
691 flow.setContainerName(null);
692 flow.setFlags(new FlowModFlags(false, false, false, false, true));
693 flow.setId(new FlowId("12"));
694 flow.setTableId(getTableId(tableId));
695 // commenting setOutGroup and setOutPort, as by default
697 // enable setOutGroup and setOutPort to enable output filtering
698 // flow.setOutGroup(new Long(2));
699 // set outport to OFPP_NONE (65535) to disable remove restriction for
701 // flow.setOutPort(outputPort);
704 flow.setFlowName(originalFlowName + "X" + flowType);
710 private FlowBuilder createTestFlow_perfTest(NodeBuilder nodeBuilder, String flowTypeArg, String tableId, int id) {
712 FlowBuilder flow = new FlowBuilder();
715 String flowType = flowTypeArg;
716 if (flowType == null) {
720 flow.setPriority(id);
725 flow.setMatch(createMatch1().build());
726 flow.setInstructions(createDecNwTtlInstructions().build());
729 LOG.warn("flow type not understood: {}", flowType);
732 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
733 if (null == flow.isBarrier()) {
734 flow.setBarrier(Boolean.FALSE);
736 // flow.setBufferId(new Long(12));
737 BigInteger value = new BigInteger("10", 10);
738 // BigInteger outputPort = new BigInteger("65535", 10);
739 flow.setCookie(new FlowCookie(value));
740 flow.setCookieMask(new FlowCookie(value));
741 flow.setHardTimeout(0);
742 flow.setIdleTimeout(0);
743 flow.setInstallHw(false);
744 flow.setStrict(false);
745 flow.setContainerName(null);
746 flow.setFlags(new FlowModFlags(false, false, false, false, true));
747 flow.setId(new FlowId("12"));
748 flow.setTableId(getTableId(tableId));
749 // commenting setOutGroup and setOutPort, as by default
751 // enable setOutGroup and setOutPort to enable output filtering
752 // flow.setOutGroup(new Long(2));
753 // set outport to OFPP_NONE (65535) to disable remove restriction for
755 // flow.setOutPort(outputPort);
758 flow.setFlowName(originalFlowName + "X" + flowType);
762 private FlowBuilder createtablemiss(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
763 FlowBuilder flow = new FlowBuilder();
765 MatchBuilder matchBuilder = new MatchBuilder();
766 flow.setMatch(matchBuilder.build());
767 flow.setInstructions(createSentToControllerInstructions().build());
769 flow.setTableId((short) 0);
770 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
776 private short getTableId(String tableId) {
779 table = Short.parseShort(tableId);
780 } catch (Exception ex) {
781 // ignore exception and continue with default value
791 private static InstructionsBuilder createDecNwTtlInstructions() {
792 DecNwTtlBuilder ta = new DecNwTtlBuilder();
793 DecNwTtl decNwTtl = ta.build();
794 ActionBuilder ab = new ActionBuilder();
795 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
796 ab.setKey(new ActionKey(0));
797 // Add our drop action to a list
798 List<Action> actionList = new ArrayList<Action>();
799 actionList.add(ab.build());
801 // Create an Apply Action
802 ApplyActionsBuilder aab = new ApplyActionsBuilder();
803 aab.setAction(actionList);
805 // Wrap our Apply Action in an Instruction
806 InstructionBuilder ib = new InstructionBuilder();
807 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
808 ib.setKey(new InstructionKey(0));
811 // Put our Instruction in a list of Instructions
812 InstructionsBuilder isb = new InstructionsBuilder();
813 List<Instruction> instructions = new ArrayList<Instruction>();
814 instructions.add(ib.build());
815 ib.setKey(new InstructionKey(0));
816 isb.setInstruction(instructions);
823 private static InstructionsBuilder createMeterInstructions() {
825 MeterBuilder aab = new MeterBuilder();
826 aab.setMeterId(new MeterId(new Long(1)));
828 InstructionBuilder ib = new InstructionBuilder();
829 ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
831 // Put our Instruction in a list of Instructions
832 InstructionsBuilder isb = new InstructionsBuilder();
833 List<Instruction> instructions = new ArrayList<Instruction>();
834 ib.setKey(new InstructionKey(0));
835 instructions.add(ib.build());
836 isb.setInstruction(instructions);
840 private static InstructionsBuilder createMetadataInstructions() {
842 WriteMetadataBuilder aab = new WriteMetadataBuilder();
843 aab.setMetadata(new BigInteger("10", 10));
844 aab.setMetadataMask(new BigInteger("12", 10));
846 InstructionBuilder ib = new InstructionBuilder();
847 ib.setInstruction(new WriteMetadataCaseBuilder().setWriteMetadata(aab.build()).build());
849 // Put our Instruction in a list of Instructions
850 InstructionsBuilder isb = new InstructionsBuilder();
851 List<Instruction> instructions = new ArrayList<Instruction>();
852 ib.setKey(new InstructionKey(0));
853 instructions.add(ib.build());
854 isb.setInstruction(instructions);
858 private static InstructionsBuilder createGotoTableInstructions() {
860 GoToTableBuilder aab = new GoToTableBuilder();
861 aab.setTableId((short) 5);
863 InstructionBuilder ib = new InstructionBuilder();
864 ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(aab.build()).build());
866 // Put our Instruction in a list of Instructions
867 InstructionsBuilder isb = new InstructionsBuilder();
868 List<Instruction> instructions = new ArrayList<Instruction>();
869 ib.setKey(new InstructionKey(0));
870 instructions.add(ib.build());
871 isb.setInstruction(instructions);
875 private static InstructionsBuilder createDropInstructions() {
876 DropActionBuilder dab = new DropActionBuilder();
877 DropAction dropAction = dab.build();
878 ActionBuilder ab = new ActionBuilder();
879 ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build());
880 ab.setKey(new ActionKey(0));
881 // Add our drop action to a list
882 List<Action> actionList = new ArrayList<Action>();
883 actionList.add(ab.build());
884 ab.setKey(new ActionKey(0));
885 // Create an Apply Action
886 ApplyActionsBuilder aab = new ApplyActionsBuilder();
887 aab.setAction(actionList);
889 // Wrap our Apply Action in an Instruction
890 InstructionBuilder ib = new InstructionBuilder();
891 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
893 // Put our Instruction in a list of Instructions
894 InstructionsBuilder isb = new InstructionsBuilder();
895 List<Instruction> instructions = new ArrayList<Instruction>();
896 ib.setKey(new InstructionKey(0));
897 instructions.add(ib.build());
898 isb.setInstruction(instructions);
902 private static InstructionsBuilder createAppyActionInstruction() {
904 List<Action> actionList = new ArrayList<Action>();
905 ActionBuilder ab = new ActionBuilder();
906 ControllerActionBuilder controller = new ControllerActionBuilder();
907 controller.setMaxLength(5);
908 ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.build()).build());
909 ab.setKey(new ActionKey(0));
910 actionList.add(ab.build());
911 // Create an Apply Action
912 ApplyActionsBuilder aab = new ApplyActionsBuilder();
913 aab.setAction(actionList);
915 // Wrap our Apply Action in an Instruction
916 InstructionBuilder ib = new InstructionBuilder();
917 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
919 // Put our Instruction in a list of Instructions
920 InstructionsBuilder isb = new InstructionsBuilder();
921 List<Instruction> instructions = new ArrayList<Instruction>();
922 ib.setKey(new InstructionKey(0));
923 instructions.add(ib.build());
924 isb.setInstruction(instructions);
928 private static InstructionsBuilder createAppyActionInstruction1() {
930 List<Action> actionList = new ArrayList<Action>();
931 ActionBuilder ab = new ActionBuilder();
933 OutputActionBuilder output = new OutputActionBuilder();
934 output.setMaxLength(56);
935 Uri value = new Uri("PCEP");
936 output.setOutputNodeConnector(value);
937 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
938 ab.setKey(new ActionKey(0));
939 actionList.add(ab.build());
940 // Create an Apply Action
941 ApplyActionsBuilder aab = new ApplyActionsBuilder();
942 aab.setAction(actionList);
944 // Wrap our Apply Action in an Instruction
945 InstructionBuilder ib = new InstructionBuilder();
946 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
948 // Put our Instruction in a list of Instructions
949 InstructionsBuilder isb = new InstructionsBuilder();
950 List<Instruction> instructions = new ArrayList<Instruction>();
951 ib.setKey(new InstructionKey(0));
952 instructions.add(ib.build());
953 isb.setInstruction(instructions);
957 private static InstructionsBuilder createOutputInstructions() {
959 // test case for Output Port works if the particular port exists
960 // this particular test-case is for Port : 1
961 // tested as (addMDFlow openflow:<dpid> f82)
962 List<Action> actionList = new ArrayList<Action>();
963 ActionBuilder ab = new ActionBuilder();
964 OutputActionBuilder output = new OutputActionBuilder();
966 Uri value = new Uri("1");
967 output.setOutputNodeConnector(value);
968 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
970 ab.setKey(new ActionKey(0));
971 actionList.add(ab.build());
972 // Create an Apply Action
973 ApplyActionsBuilder aab = new ApplyActionsBuilder();
974 aab.setAction(actionList);
976 // Wrap our Apply Action in an Instruction
977 InstructionBuilder ib = new InstructionBuilder();
978 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
980 ib.setKey(new InstructionKey(0));
982 // Put our Instruction in a list of Instructions
983 InstructionsBuilder isb = new InstructionsBuilder();
984 List<Instruction> instructions = new ArrayList<Instruction>();
985 instructions.add(ib.build());
986 isb.setInstruction(instructions);
990 private static InstructionsBuilder createSentToControllerInstructions() {
991 List<Action> actionList = new ArrayList<Action>();
992 ActionBuilder ab = new ActionBuilder();
994 OutputActionBuilder output = new OutputActionBuilder();
995 output.setMaxLength(new Integer(0xffff));
996 Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
997 output.setOutputNodeConnector(value);
998 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
1000 ab.setKey(new ActionKey(0));
1001 actionList.add(ab.build());
1002 // Create an Apply Action
1003 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1004 aab.setAction(actionList);
1006 // Wrap our Apply Action in an Instruction
1007 InstructionBuilder ib = new InstructionBuilder();
1008 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1010 ib.setKey(new InstructionKey(0));
1012 // Put our Instruction in a list of Instructions
1013 InstructionsBuilder isb = new InstructionsBuilder();
1014 List<Instruction> instructions = new ArrayList<Instruction>();
1015 instructions.add(ib.build());
1016 isb.setInstruction(instructions);
1020 private static InstructionsBuilder createOutputInstructions(String outputType, int outputValue) {
1021 List<Action> actionList = new ArrayList<Action>();
1022 ActionBuilder ab = new ActionBuilder();
1024 OutputActionBuilder output = new OutputActionBuilder();
1025 output.setMaxLength(outputValue);
1026 Uri value = new Uri(outputType);
1027 output.setOutputNodeConnector(value);
1028 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
1030 ab.setKey(new ActionKey(0));
1031 actionList.add(ab.build());
1032 // Create an Apply Action
1033 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1034 aab.setAction(actionList);
1036 // Wrap our Apply Action in an Instruction
1037 InstructionBuilder ib = new InstructionBuilder();
1038 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1040 ib.setKey(new InstructionKey(0));
1042 // Put our Instruction in a list of Instructions
1043 InstructionsBuilder isb = new InstructionsBuilder();
1044 List<Instruction> instructions = new ArrayList<Instruction>();
1045 instructions.add(ib.build());
1046 isb.setInstruction(instructions);
1050 private static InstructionsBuilder createStripVlanInstructions() {
1051 List<Action> actionList = new ArrayList<Action>();
1052 ActionBuilder ab = new ActionBuilder();
1054 StripVlanActionBuilder stripActionBuilder = new StripVlanActionBuilder();
1055 ab.setAction(new StripVlanActionCaseBuilder().setStripVlanAction(stripActionBuilder.build()).build());
1057 ab.setKey(new ActionKey(0));
1058 actionList.add(ab.build());
1059 // Create an Apply Action
1060 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1061 aab.setAction(actionList);
1063 // Wrap our Apply Action in an Instruction
1064 InstructionBuilder ib = new InstructionBuilder();
1065 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1067 ib.setKey(new InstructionKey(0));
1069 // Put our Instruction in a list of Instructions
1070 InstructionsBuilder isb = new InstructionsBuilder();
1071 List<Instruction> instructions = new ArrayList<Instruction>();
1072 instructions.add(ib.build());
1073 isb.setInstruction(instructions);
1077 private static InstructionsBuilder createAppyActionInstruction2() {
1079 List<Action> actionList = new ArrayList<Action>();
1080 ActionBuilder ab = new ActionBuilder();
1082 PushMplsActionBuilder push = new PushMplsActionBuilder();
1083 push.setEthernetType(new Integer(0x8847));
1084 ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
1085 ab.setKey(new ActionKey(0));
1086 actionList.add(ab.build());
1087 // Create an Apply Action
1088 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1089 aab.setAction(actionList);
1091 // Wrap our Apply Action in an Instruction
1092 InstructionBuilder ib = new InstructionBuilder();
1093 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1095 // Put our Instruction in a list of Instructions
1096 InstructionsBuilder isb = new InstructionsBuilder();
1097 List<Instruction> instructions = new ArrayList<Instruction>();
1098 ib.setKey(new InstructionKey(0));
1099 instructions.add(ib.build());
1100 isb.setInstruction(instructions);
1104 private static InstructionsBuilder createAppyActionInstruction3() {
1106 List<Action> actionList = new ArrayList<Action>();
1107 ActionBuilder ab = new ActionBuilder();
1109 PushPbbActionBuilder pbb = new PushPbbActionBuilder();
1110 pbb.setEthernetType(new Integer(0x88E7));
1111 ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
1112 ab.setKey(new ActionKey(0));
1113 actionList.add(ab.build());
1114 // Create an Apply Action
1115 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1116 aab.setAction(actionList);
1118 // Wrap our Apply Action in an Instruction
1119 InstructionBuilder ib = new InstructionBuilder();
1120 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1122 // Put our Instruction in a list of Instructions
1123 InstructionsBuilder isb = new InstructionsBuilder();
1124 List<Instruction> instructions = new ArrayList<Instruction>();
1125 ib.setKey(new InstructionKey(0));
1126 instructions.add(ib.build());
1127 isb.setInstruction(instructions);
1131 private static InstructionsBuilder createAppyActionInstruction4() {
1133 List<Action> actionList = new ArrayList<Action>();
1134 ActionBuilder ab = new ActionBuilder();
1136 PushVlanActionBuilder vlan = new PushVlanActionBuilder();
1137 vlan.setEthernetType(new Integer(0x8100));
1138 ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
1139 ab.setKey(new ActionKey(0));
1140 actionList.add(ab.build());
1142 // Create an Apply Action
1143 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1144 aab.setAction(actionList);
1146 // Wrap our Apply Action in an Instruction
1147 InstructionBuilder ib = new InstructionBuilder();
1148 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1150 // Put our Instruction in a list of Instructions
1151 InstructionsBuilder isb = new InstructionsBuilder();
1152 List<Instruction> instructions = new ArrayList<Instruction>();
1153 ib.setKey(new InstructionKey(0));
1154 instructions.add(ib.build());
1155 isb.setInstruction(instructions);
1159 private static InstructionsBuilder createAppyActionInstruction5() {
1161 List<Action> actionList = new ArrayList<Action>();
1162 ActionBuilder ab = new ActionBuilder();
1164 SetDlDstActionBuilder setdl = new SetDlDstActionBuilder();
1165 setdl.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1166 ab.setAction(new SetDlDstActionCaseBuilder().setSetDlDstAction(setdl.build()).build());
1167 ab.setKey(new ActionKey(0));
1168 actionList.add(ab.build());
1169 // Create an Apply Action
1170 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1171 aab.setAction(actionList);
1173 // Wrap our Apply Action in an Instruction
1174 InstructionBuilder ib = new InstructionBuilder();
1175 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1177 // Put our Instruction in a list of Instructions
1178 InstructionsBuilder isb = new InstructionsBuilder();
1179 List<Instruction> instructions = new ArrayList<Instruction>();
1180 ib.setKey(new InstructionKey(0));
1181 instructions.add(ib.build());
1182 isb.setInstruction(instructions);
1186 private static InstructionsBuilder createAppyActionInstruction6() {
1188 List<Action> actionList = new ArrayList<Action>();
1189 ActionBuilder ab = new ActionBuilder();
1191 SetDlSrcActionBuilder src = new SetDlSrcActionBuilder();
1192 src.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1193 ab.setAction(new SetDlSrcActionCaseBuilder().setSetDlSrcAction(src.build()).build());
1194 ab.setKey(new ActionKey(0));
1195 actionList.add(ab.build());
1197 // Create an Apply Action
1198 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1199 aab.setAction(actionList);
1201 // Wrap our Apply Action in an Instruction
1202 InstructionBuilder ib = new InstructionBuilder();
1203 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1205 // Put our Instruction in a list of Instructions
1206 InstructionsBuilder isb = new InstructionsBuilder();
1207 List<Instruction> instructions = new ArrayList<Instruction>();
1208 ib.setKey(new InstructionKey(0));
1209 instructions.add(ib.build());
1210 isb.setInstruction(instructions);
1214 private static InstructionsBuilder createAppyActionInstruction7() {
1216 List<Action> actionList = new ArrayList<Action>();
1217 ActionBuilder ab = new ActionBuilder();
1219 SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
1220 VlanId a = new VlanId(4000);
1222 ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
1223 ab.setKey(new ActionKey(0));
1224 actionList.add(ab.build());
1225 // Create an Apply Action
1226 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1227 aab.setAction(actionList);
1229 // Wrap our Apply Action in an Instruction
1230 InstructionBuilder ib = new InstructionBuilder();
1231 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1233 // Put our Instruction in a list of Instructions
1234 InstructionsBuilder isb = new InstructionsBuilder();
1235 List<Instruction> instructions = new ArrayList<Instruction>();
1236 ib.setKey(new InstructionKey(0));
1237 instructions.add(ib.build());
1238 isb.setInstruction(instructions);
1242 private static InstructionsBuilder createAppyActionInstruction8() {
1244 List<Action> actionList = new ArrayList<Action>();
1245 ActionBuilder ab = new ActionBuilder();
1247 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1248 VlanPcp pcp1 = new VlanPcp((short) 2);
1249 pcp.setVlanPcp(pcp1);
1250 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1251 ab.setKey(new ActionKey(0));
1252 actionList.add(ab.build());
1253 // Create an Apply Action
1254 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1255 aab.setAction(actionList);
1257 // Wrap our Apply Action in an Instruction
1258 InstructionBuilder ib = new InstructionBuilder();
1259 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1261 // Put our Instruction in a list of Instructions
1262 InstructionsBuilder isb = new InstructionsBuilder();
1263 List<Instruction> instructions = new ArrayList<Instruction>();
1264 ib.setKey(new InstructionKey(0));
1265 instructions.add(ib.build());
1266 isb.setInstruction(instructions);
1270 private static InstructionsBuilder createAppyActionInstruction88() {
1272 List<Action> actionList = new ArrayList<Action>();
1273 ActionBuilder ab = new ActionBuilder();
1275 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1276 // the code point is a 3-bit(0-7) field representing the frame priority level
1277 VlanPcp pcp1 = new VlanPcp((short) 4);
1278 pcp.setVlanPcp(pcp1);
1279 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1280 ab.setKey(new ActionKey(0));
1281 actionList.add(ab.build());
1282 // Create an Apply Action
1283 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1284 aab.setAction(actionList);
1286 // Wrap our Apply Action in an Instruction
1287 InstructionBuilder ib = new InstructionBuilder();
1288 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1290 // Put our Instruction in a list of Instructions
1291 InstructionsBuilder isb = new InstructionsBuilder();
1292 List<Instruction> instructions = new ArrayList<Instruction>();
1293 ib.setKey(new InstructionKey(0));
1294 instructions.add(ib.build());
1295 isb.setInstruction(instructions);
1299 private static InstructionsBuilder createAppyActionInstruction9() {
1301 List<Action> actionList = new ArrayList<Action>();
1302 ActionBuilder ab = new ActionBuilder();
1304 CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
1305 ab.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
1306 ab.setKey(new ActionKey(0));
1307 actionList.add(ab.build());
1308 // Create an Apply Action
1309 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1310 aab.setAction(actionList);
1312 // Wrap our Apply Action in an Instruction
1313 InstructionBuilder ib = new InstructionBuilder();
1314 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1316 // Put our Instruction in a list of Instructions
1317 InstructionsBuilder isb = new InstructionsBuilder();
1318 List<Instruction> instructions = new ArrayList<Instruction>();
1319 ib.setKey(new InstructionKey(0));
1320 instructions.add(ib.build());
1321 isb.setInstruction(instructions);
1325 private static InstructionsBuilder createAppyActionInstruction10() {
1327 List<Action> actionList = new ArrayList<Action>();
1328 ActionBuilder ab = new ActionBuilder();
1330 CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
1331 ab.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
1332 ab.setKey(new ActionKey(0));
1333 actionList.add(ab.build());
1334 // Create an Apply Action
1335 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1336 aab.setAction(actionList);
1338 // Wrap our Apply Action in an Instruction
1339 InstructionBuilder ib = new InstructionBuilder();
1340 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1342 // Put our Instruction in a list of Instructions
1343 InstructionsBuilder isb = new InstructionsBuilder();
1344 List<Instruction> instructions = new ArrayList<Instruction>();
1345 ib.setKey(new InstructionKey(0));
1346 instructions.add(ib.build());
1347 isb.setInstruction(instructions);
1351 private static InstructionsBuilder createAppyActionInstruction11() {
1353 List<Action> actionList = new ArrayList<Action>();
1354 ActionBuilder ab = new ActionBuilder();
1356 DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
1357 ab.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
1358 ab.setKey(new ActionKey(0));
1359 actionList.add(ab.build());
1360 // Create an Apply Action
1361 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1362 aab.setAction(actionList);
1364 // Wrap our Apply Action in an Instruction
1365 InstructionBuilder ib = new InstructionBuilder();
1366 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1367 ib.setKey(new InstructionKey(0));
1370 // Put our Instruction in a list of Instruction
1371 InstructionsBuilder isb = new InstructionsBuilder();
1372 List<Instruction> instructions = new ArrayList<Instruction>();
1373 instructions.add(ib.build());
1374 isb.setInstruction(instructions);
1378 private static InstructionsBuilder createAppyActionInstruction12() {
1380 List<Action> actionList = new ArrayList<Action>();
1381 ActionBuilder ab = new ActionBuilder();
1383 DecNwTtlBuilder nwttl = new DecNwTtlBuilder();
1384 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(nwttl.build()).build());
1385 ab.setKey(new ActionKey(0));
1386 actionList.add(ab.build());
1388 // Create an Apply Action
1389 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1390 aab.setAction(actionList);
1392 // Wrap our Apply Action in an Instruction
1393 InstructionBuilder ib = new InstructionBuilder();
1394 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1396 // Put our Instruction in a list of Instructions
1397 InstructionsBuilder isb = new InstructionsBuilder();
1398 List<Instruction> instructions = new ArrayList<Instruction>();
1399 ib.setKey(new InstructionKey(0));
1400 instructions.add(ib.build());
1401 isb.setInstruction(instructions);
1405 private static InstructionsBuilder createAppyActionInstruction13() {
1407 List<Action> actionList = new ArrayList<Action>();
1408 ActionBuilder ab = new ActionBuilder();
1410 DropActionBuilder drop = new DropActionBuilder();
1411 ab.setAction(new DropActionCaseBuilder().setDropAction(drop.build()).build());
1412 ab.setKey(new ActionKey(0));
1413 actionList.add(ab.build());
1415 // Create an Apply Action
1416 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1417 aab.setAction(actionList);
1419 // Wrap our Apply Action in an Instruction
1420 InstructionBuilder ib = new InstructionBuilder();
1421 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1423 // Put our Instruction in a list of Instructions
1424 InstructionsBuilder isb = new InstructionsBuilder();
1425 List<Instruction> instructions = new ArrayList<Instruction>();
1426 ib.setKey(new InstructionKey(0));
1427 instructions.add(ib.build());
1428 isb.setInstruction(instructions);
1432 private static InstructionsBuilder createAppyActionInstruction14() {
1434 List<Action> actionList = new ArrayList<Action>();
1435 ActionBuilder ab = new ActionBuilder();
1437 FloodActionBuilder fld = new FloodActionBuilder();
1438 ab.setAction(new FloodActionCaseBuilder().setFloodAction(fld.build()).build());
1439 ab.setKey(new ActionKey(0));
1440 actionList.add(ab.build());
1441 // Create an Apply Action
1442 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1443 aab.setAction(actionList);
1445 // Wrap our Apply Action in an Instruction
1446 InstructionBuilder ib = new InstructionBuilder();
1447 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1449 // Put our Instruction in a list of Instructions
1450 InstructionsBuilder isb = new InstructionsBuilder();
1451 List<Instruction> instructions = new ArrayList<Instruction>();
1452 ib.setKey(new InstructionKey(0));
1453 instructions.add(ib.build());
1454 isb.setInstruction(instructions);
1458 private static InstructionsBuilder createAppyActionInstruction15() {
1460 List<Action> actionList = new ArrayList<Action>();
1461 ActionBuilder ab = new ActionBuilder();
1463 FloodAllActionBuilder fldall = new FloodAllActionBuilder();
1464 ab.setAction(new FloodAllActionCaseBuilder().setFloodAllAction(fldall.build()).build());
1465 ab.setKey(new ActionKey(0));
1466 actionList.add(ab.build());
1467 // Create an Apply Action
1468 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1469 aab.setAction(actionList);
1471 // Wrap our Apply Action in an Instruction
1472 InstructionBuilder ib = new InstructionBuilder();
1473 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1475 // Put our Instruction in a list of Instructions
1476 InstructionsBuilder isb = new InstructionsBuilder();
1477 List<Instruction> instructions = new ArrayList<Instruction>();
1478 ib.setKey(new InstructionKey(0));
1479 instructions.add(ib.build());
1480 isb.setInstruction(instructions);
1484 private static InstructionsBuilder createAppyActionInstruction16() {
1486 List<Action> actionList = new ArrayList<Action>();
1487 ActionBuilder ab = new ActionBuilder();
1489 GroupActionBuilder groupActionB = new GroupActionBuilder();
1490 groupActionB.setGroupId(1L);
1491 groupActionB.setGroup("0");
1492 ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
1493 ab.setKey(new ActionKey(0));
1494 actionList.add(ab.build());
1496 // Create an Apply Action
1497 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1498 aab.setAction(actionList);
1500 // Wrap our Apply Action in an Instruction
1501 InstructionBuilder ib = new InstructionBuilder();
1502 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1504 // Put our Instruction in a list of Instructions
1505 InstructionsBuilder isb = new InstructionsBuilder();
1506 List<Instruction> instructions = new ArrayList<Instruction>();
1507 ib.setKey(new InstructionKey(0));
1508 instructions.add(ib.build());
1509 isb.setInstruction(instructions);
1513 private static InstructionsBuilder createAppyActionInstruction17() {
1515 List<Action> actionList = new ArrayList<Action>();
1516 ActionBuilder ab = new ActionBuilder();
1518 HwPathActionBuilder hwPathB = new HwPathActionBuilder();
1519 ab.setAction(new HwPathActionCaseBuilder().setHwPathAction(hwPathB.build()).build());
1520 ab.setKey(new ActionKey(0));
1521 actionList.add(ab.build());
1522 // Create an Apply Action
1523 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1524 aab.setAction(actionList);
1526 // Wrap our Apply Action in an Instruction
1527 InstructionBuilder ib = new InstructionBuilder();
1528 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1530 // Put our Instruction in a list of Instructions
1531 InstructionsBuilder isb = new InstructionsBuilder();
1532 List<Instruction> instructions = new ArrayList<Instruction>();
1533 ib.setKey(new InstructionKey(0));
1534 instructions.add(ib.build());
1535 isb.setInstruction(instructions);
1539 private static InstructionsBuilder createAppyActionInstruction18() {
1541 List<Action> actionList = new ArrayList<Action>();
1542 ActionBuilder ab = new ActionBuilder();
1544 LoopbackActionBuilder loopbackActionBuilder = new LoopbackActionBuilder();
1545 ab.setAction(new LoopbackActionCaseBuilder().setLoopbackAction(loopbackActionBuilder.build()).build());
1546 ab.setKey(new ActionKey(0));
1547 actionList.add(ab.build());
1549 // Create an Apply Action
1550 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1551 aab.setAction(actionList);
1553 // Wrap our Apply Action in an Instruction
1554 InstructionBuilder ib = new InstructionBuilder();
1555 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1557 // Put our Instruction in a list of Instructions
1558 InstructionsBuilder isb = new InstructionsBuilder();
1559 List<Instruction> instructions = new ArrayList<Instruction>();
1560 ib.setKey(new InstructionKey(0));
1561 instructions.add(ib.build());
1562 isb.setInstruction(instructions);
1566 private static InstructionsBuilder createAppyActionInstruction19() {
1568 List<Action> actionList = new ArrayList<Action>();
1569 ActionBuilder ab = new ActionBuilder();
1571 PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
1572 popMplsActionBuilder.setEthernetType(0XB);
1573 ab.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
1574 ab.setKey(new ActionKey(0));
1575 actionList.add(ab.build());
1576 // Create an Apply Action
1577 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1578 aab.setAction(actionList);
1580 // Wrap our Apply Action in an Instruction
1581 InstructionBuilder ib = new InstructionBuilder();
1582 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1584 // Put our Instruction in a list of Instructions
1585 InstructionsBuilder isb = new InstructionsBuilder();
1586 List<Instruction> instructions = new ArrayList<Instruction>();
1587 ib.setKey(new InstructionKey(0));
1588 instructions.add(ib.build());
1589 isb.setInstruction(instructions);
1593 private static InstructionsBuilder createAppyActionInstruction20() {
1595 List<Action> actionList = new ArrayList<Action>();
1596 ActionBuilder ab = new ActionBuilder();
1598 PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
1599 ab.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
1600 ab.setKey(new ActionKey(0));
1601 actionList.add(ab.build());
1602 // Create an Apply Action
1603 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1604 aab.setAction(actionList);
1606 // Wrap our Apply Action in an Instruction
1607 InstructionBuilder ib = new InstructionBuilder();
1608 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1610 // Put our Instruction in a list of Instructions
1611 InstructionsBuilder isb = new InstructionsBuilder();
1612 List<Instruction> instructions = new ArrayList<Instruction>();
1613 ib.setKey(new InstructionKey(0));
1614 instructions.add(ib.build());
1615 isb.setInstruction(instructions);
1619 private static InstructionsBuilder createAppyActionInstruction21() {
1621 List<Action> actionList = new ArrayList<Action>();
1622 ActionBuilder ab = new ActionBuilder();
1624 PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder();
1625 ab.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(popVlanActionBuilder.build()).build());
1626 ab.setKey(new ActionKey(0));
1627 actionList.add(ab.build());
1629 // Create an Apply Action
1630 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1631 aab.setAction(actionList);
1633 // Wrap our Apply Action in an Instruction
1634 InstructionBuilder ib = new InstructionBuilder();
1635 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1637 // Put our Instruction in a list of Instructions
1638 InstructionsBuilder isb = new InstructionsBuilder();
1639 List<Instruction> instructions = new ArrayList<Instruction>();
1640 ib.setKey(new InstructionKey(0));
1641 instructions.add(ib.build());
1642 isb.setInstruction(instructions);
1646 private static InstructionsBuilder createAppyActionInstruction22() {
1648 List<Action> actionList = new ArrayList<Action>();
1649 ActionBuilder ab = new ActionBuilder();
1651 SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
1652 setDlTypeActionBuilder.setDlType(new EtherType(8L));
1653 ab.setAction(new SetDlTypeActionCaseBuilder().setSetDlTypeAction(setDlTypeActionBuilder.build()).build());
1654 ab.setKey(new ActionKey(0));
1655 actionList.add(ab.build());
1657 // Create an Apply Action
1658 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1659 aab.setAction(actionList);
1661 // Wrap our Apply Action in an Instruction
1662 InstructionBuilder ib = new InstructionBuilder();
1663 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1665 // Put our Instruction in a list of Instructions
1666 InstructionsBuilder isb = new InstructionsBuilder();
1667 List<Instruction> instructions = new ArrayList<Instruction>();
1668 ib.setKey(new InstructionKey(0));
1669 instructions.add(ib.build());
1670 isb.setInstruction(instructions);
1674 private static InstructionsBuilder createAppyActionInstruction23(NodeId nodeId) {
1676 List<Action> actionList = new ArrayList<Action>();
1677 ActionBuilder ab = new ActionBuilder();
1679 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1680 setFieldBuilder.setInPort(new NodeConnectorId(nodeId + ":2"));
1681 ab.setKey(new ActionKey(0));
1682 actionList.add(ab.build());
1684 // Create an Apply Action
1685 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1686 aab.setAction(actionList);
1688 // Wrap our Apply Action in an Instruction
1689 InstructionBuilder ib = new InstructionBuilder();
1690 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1692 // Put our Instruction in a list of Instructions
1693 InstructionsBuilder isb = new InstructionsBuilder();
1694 List<Instruction> instructions = new ArrayList<Instruction>();
1695 ib.setKey(new InstructionKey(0));
1696 instructions.add(ib.build());
1697 isb.setInstruction(instructions);
1701 private static InstructionsBuilder createAppyActionInstruction24() {
1703 List<Action> actionList = new ArrayList<Action>();
1704 ActionBuilder ab = new ActionBuilder();
1706 SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
1707 setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
1708 ab.setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(setMplsTtlActionBuilder.build()).build());
1709 ab.setKey(new ActionKey(0));
1710 actionList.add(ab.build());
1712 // Create an Apply Action
1713 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1714 aab.setAction(actionList);
1716 // Wrap our Apply Action in an Instruction
1717 InstructionBuilder ib = new InstructionBuilder();
1718 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1720 // Put our Instruction in a list of Instructions
1721 InstructionsBuilder isb = new InstructionsBuilder();
1722 List<Instruction> instructions = new ArrayList<Instruction>();
1723 ib.setKey(new InstructionKey(0));
1724 instructions.add(ib.build());
1725 isb.setInstruction(instructions);
1729 private static InstructionsBuilder createAppyActionInstruction25() {
1731 List<Action> actionList = new ArrayList<Action>();
1732 ActionBuilder ab = new ActionBuilder();
1734 SetNextHopActionBuilder setNextHopActionBuilder = new SetNextHopActionBuilder();
1735 Ipv4Builder ipnext = new Ipv4Builder();
1736 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
1737 ipnext.setIpv4Address(prefix);
1738 setNextHopActionBuilder.setAddress(ipnext.build());
1739 ab.setAction(new SetNextHopActionCaseBuilder().setSetNextHopAction(setNextHopActionBuilder.build()).build());
1740 ab.setKey(new ActionKey(0));
1741 actionList.add(ab.build());
1743 // Create an Apply Action
1744 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1745 aab.setAction(actionList);
1747 // Wrap our Apply Action in an Instruction
1748 InstructionBuilder ib = new InstructionBuilder();
1749 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1751 // Put our Instruction in a list of Instructions
1752 InstructionsBuilder isb = new InstructionsBuilder();
1753 List<Instruction> instructions = new ArrayList<Instruction>();
1754 ib.setKey(new InstructionKey(0));
1755 instructions.add(ib.build());
1756 isb.setInstruction(instructions);
1760 private static InstructionsBuilder createAppyActionInstruction26() {
1762 List<Action> actionList = new ArrayList<Action>();
1763 ActionBuilder ab = new ActionBuilder();
1765 SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
1766 Ipv4Builder ipdst = new Ipv4Builder();
1767 Ipv4Prefix prefixdst = new Ipv4Prefix("10.0.0.21/24");
1768 ipdst.setIpv4Address(prefixdst);
1769 setNwDstActionBuilder.setAddress(ipdst.build());
1770 ab.setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build());
1771 ab.setKey(new ActionKey(0));
1772 actionList.add(ab.build());
1774 // Create an Apply Action
1775 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1776 aab.setAction(actionList);
1778 // Wrap our Apply Action in an Instruction
1779 InstructionBuilder ib = new InstructionBuilder();
1780 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1782 // Put our Instruction in a list of Instructions
1783 InstructionsBuilder isb = new InstructionsBuilder();
1784 List<Instruction> instructions = new ArrayList<Instruction>();
1785 ib.setKey(new InstructionKey(0));
1786 instructions.add(ib.build());
1787 isb.setInstruction(instructions);
1791 private static InstructionsBuilder createAppyActionInstruction27() {
1793 List<Action> actionList = new ArrayList<Action>();
1794 ActionBuilder ab = new ActionBuilder();
1796 SetNwSrcActionBuilder setNwsrcActionBuilder = new SetNwSrcActionBuilder();
1797 Ipv4Builder ipsrc = new Ipv4Builder();
1798 Ipv4Prefix prefixsrc = new Ipv4Prefix("10.0.23.21/24");
1799 ipsrc.setIpv4Address(prefixsrc);
1800 setNwsrcActionBuilder.setAddress(ipsrc.build());
1801 ab.setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwsrcActionBuilder.build()).build());
1802 ab.setKey(new ActionKey(0));
1803 actionList.add(ab.build());
1805 // Create an Apply Action
1806 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1807 aab.setAction(actionList);
1809 // Wrap our Apply Action in an Instruction
1810 InstructionBuilder ib = new InstructionBuilder();
1811 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1813 // Put our Instruction in a list of Instructions
1814 InstructionsBuilder isb = new InstructionsBuilder();
1815 List<Instruction> instructions = new ArrayList<Instruction>();
1816 ib.setKey(new InstructionKey(0));
1817 instructions.add(ib.build());
1818 isb.setInstruction(instructions);
1822 private static InstructionsBuilder createAppyActionInstruction28() {
1824 List<Action> actionList = new ArrayList<Action>();
1825 ActionBuilder ab = new ActionBuilder();
1827 SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
1828 setNwTosActionBuilder.setTos(8);
1829 ab.setAction(new SetNwTosActionCaseBuilder().setSetNwTosAction(setNwTosActionBuilder.build()).build());
1830 ab.setKey(new ActionKey(0));
1831 actionList.add(ab.build());
1832 // Create an Apply Action
1833 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1834 aab.setAction(actionList);
1836 // Wrap our Apply Action in an Instruction
1837 InstructionBuilder ib = new InstructionBuilder();
1838 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1840 // Put our Instruction in a list of Instructions
1841 InstructionsBuilder isb = new InstructionsBuilder();
1842 List<Instruction> instructions = new ArrayList<Instruction>();
1843 ib.setKey(new InstructionKey(0));
1844 instructions.add(ib.build());
1845 isb.setInstruction(instructions);
1849 private static InstructionsBuilder createAppyActionInstruction29() {
1851 List<Action> actionList = new ArrayList<Action>();
1852 ActionBuilder ab = new ActionBuilder();
1854 SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
1855 setNwTtlActionBuilder.setNwTtl((short) 1);
1856 ab.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
1857 ab.setKey(new ActionKey(0));
1858 actionList.add(ab.build());
1860 // Create an Apply Action
1861 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1862 aab.setAction(actionList);
1864 // Wrap our Apply Action in an Instruction
1865 InstructionBuilder ib = new InstructionBuilder();
1866 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1868 // Put our Instruction in a list of Instructions
1869 InstructionsBuilder isb = new InstructionsBuilder();
1870 List<Instruction> instructions = new ArrayList<Instruction>();
1871 ib.setKey(new InstructionKey(0));
1872 instructions.add(ib.build());
1873 isb.setInstruction(instructions);
1877 private static InstructionsBuilder createAppyActionInstruction30() {
1879 List<Action> actionList = new ArrayList<Action>();
1880 ActionBuilder ab = new ActionBuilder();
1882 SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
1883 setQueueActionBuilder.setQueueId(1L);
1884 ab.setAction(new SetQueueActionCaseBuilder().setSetQueueAction(setQueueActionBuilder.build()).build());
1885 ab.setKey(new ActionKey(0));
1886 actionList.add(ab.build());
1887 // Create an Apply Action
1888 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1889 aab.setAction(actionList);
1891 // Wrap our Apply Action in an Instruction
1892 InstructionBuilder ib = new InstructionBuilder();
1893 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1895 // Put our Instruction in a list of Instructions
1896 InstructionsBuilder isb = new InstructionsBuilder();
1897 List<Instruction> instructions = new ArrayList<Instruction>();
1898 ib.setKey(new InstructionKey(0));
1899 instructions.add(ib.build());
1900 isb.setInstruction(instructions);
1904 private static InstructionsBuilder createAppyActionInstruction31() {
1906 List<Action> actionList = new ArrayList<Action>();
1907 ActionBuilder ab = new ActionBuilder();
1909 SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
1910 setTpDstActionBuilder.setPort(new PortNumber(109));
1912 ab.setAction(new SetTpDstActionCaseBuilder().setSetTpDstAction(setTpDstActionBuilder.build()).build());
1913 ab.setKey(new ActionKey(0));
1914 actionList.add(ab.build());
1915 // Create an Apply Action
1916 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1917 aab.setAction(actionList);
1919 // Wrap our Apply Action in an Instruction
1920 InstructionBuilder ib = new InstructionBuilder();
1921 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1923 // Put our Instruction in a list of Instructions
1924 InstructionsBuilder isb = new InstructionsBuilder();
1925 List<Instruction> instructions = new ArrayList<Instruction>();
1926 ib.setKey(new InstructionKey(0));
1927 instructions.add(ib.build());
1928 isb.setInstruction(instructions);
1932 private static InstructionsBuilder createAppyActionInstruction32() {
1934 List<Action> actionList = new ArrayList<Action>();
1935 ActionBuilder ab = new ActionBuilder();
1937 SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
1938 setTpSrcActionBuilder.setPort(new PortNumber(109));
1939 ab.setAction(new SetTpSrcActionCaseBuilder().setSetTpSrcAction(setTpSrcActionBuilder.build()).build());
1940 ab.setKey(new ActionKey(0));
1941 actionList.add(ab.build());
1943 // Create an Apply Action
1944 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1945 aab.setAction(actionList);
1947 // Wrap our Apply Action in an Instruction
1948 InstructionBuilder ib = new InstructionBuilder();
1949 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1951 // Put our Instruction in a list of Instructions
1952 InstructionsBuilder isb = new InstructionsBuilder();
1953 List<Instruction> instructions = new ArrayList<Instruction>();
1954 ib.setKey(new InstructionKey(0));
1955 instructions.add(ib.build());
1956 isb.setInstruction(instructions);
1960 private static InstructionsBuilder createAppyActionInstruction33() {
1962 List<Action> actionList = new ArrayList<Action>();
1963 ActionBuilder ab = new ActionBuilder();
1965 SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
1966 setVlanCfiActionBuilder.setVlanCfi(new VlanCfi(2));
1967 ab.setAction(new SetVlanCfiActionCaseBuilder().setSetVlanCfiAction(setVlanCfiActionBuilder.build()).build());
1968 ab.setKey(new ActionKey(0));
1969 actionList.add(ab.build());
1971 // Create an Apply Action
1972 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1973 aab.setAction(actionList);
1975 // Wrap our Apply Action in an Instruction
1976 InstructionBuilder ib = new InstructionBuilder();
1977 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1979 // Put our Instruction in a list of Instructions
1980 InstructionsBuilder isb = new InstructionsBuilder();
1981 List<Instruction> instructions = new ArrayList<Instruction>();
1982 ib.setKey(new InstructionKey(0));
1983 instructions.add(ib.build());
1984 isb.setInstruction(instructions);
1988 private static InstructionsBuilder createAppyActionInstruction34() {
1990 List<Action> actionList = new ArrayList<Action>();
1991 ActionBuilder ab = new ActionBuilder();
1993 SwPathActionBuilder swPathAction = new SwPathActionBuilder();
1994 ab.setAction(new SwPathActionCaseBuilder().setSwPathAction(swPathAction.build()).build());
1995 ab.setKey(new ActionKey(0));
1996 actionList.add(ab.build());
1998 // Create an Apply Action
1999 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2000 aab.setAction(actionList);
2002 // Wrap our Apply Action in an Instruction
2003 InstructionBuilder ib = new InstructionBuilder();
2004 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2006 // Put our Instruction in a list of Instructions
2007 InstructionsBuilder isb = new InstructionsBuilder();
2008 List<Instruction> instructions = new ArrayList<Instruction>();
2009 ib.setKey(new InstructionKey(0));
2010 instructions.add(ib.build());
2011 isb.setInstruction(instructions);
2015 private static InstructionsBuilder createAppyActionInstruction35() {
2017 List<Action> actionList = new ArrayList<Action>();
2018 ActionBuilder ab = new ActionBuilder();
2019 ActionBuilder ab1 = new ActionBuilder();
2020 ActionBuilder ab2 = new ActionBuilder();
2022 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2023 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2024 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2027 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
2028 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
2029 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
2030 EthernetMatchBuilder ethernetMatch1 = new EthernetMatchBuilder();
2031 EthernetDestinationBuilder ethDestBuilder = new EthernetDestinationBuilder();
2032 ethDestBuilder.setAddress(new MacAddress("00:00:00:00:00:02"));
2033 EthernetMatchBuilder ethernetMatch2 = new EthernetMatchBuilder();
2034 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2035 ethTypeBuilder.setType(new EtherType(0x86ddL));
2037 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
2038 ethernetMatch1.setEthernetDestination(ethDestBuilder.build());
2039 ethernetMatch2.setEthernetType(ethTypeBuilder.build());
2040 setFieldBuilder.setEthernetMatch(ethernetMatch.build());
2041 setFieldBuilder1.setEthernetMatch(ethernetMatch1.build());
2042 setFieldBuilder2.setEthernetMatch(ethernetMatch2.build());
2043 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2044 ab.setKey(new ActionKey(0));
2045 actionList.add(ab.build());
2047 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2048 ab1.setKey(new ActionKey(1));
2049 actionList.add(ab1.build());
2051 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2052 ab2.setKey(new ActionKey(2));
2053 actionList.add(ab2.build());
2055 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2056 aab.setAction(actionList);
2058 InstructionBuilder ib = new InstructionBuilder();
2059 ib.setKey(new InstructionKey(0));
2060 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2062 // Put our Instruction in a list of Instructions
2063 InstructionsBuilder isb = new InstructionsBuilder();
2064 List<Instruction> instructions = new ArrayList<Instruction>();
2065 ib.setKey(new InstructionKey(0));
2066 instructions.add(ib.build());
2067 isb.setInstruction(instructions);
2071 private static InstructionsBuilder createAppyActionInstruction36() {
2073 List<Action> actionList = new ArrayList<Action>();
2074 ActionBuilder ab = new ActionBuilder();
2075 ActionBuilder ab1 = new ActionBuilder();
2077 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2078 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2081 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
2082 VlanMatchBuilder vlanBuilder1 = new VlanMatchBuilder();
2083 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
2084 VlanId vlanId = new VlanId(10);
2085 VlanPcp vpcp = new VlanPcp((short) 3);
2086 vlanBuilder.setVlanPcp(vpcp);
2087 vlanBuilder1.setVlanId(vlanIdBuilder.setVlanId(vlanId).setVlanIdPresent(true).build());
2088 setFieldBuilder.setVlanMatch(vlanBuilder.build());
2089 setFieldBuilder1.setVlanMatch(vlanBuilder1.build());
2090 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2091 ab.setKey(new ActionKey(0));
2092 actionList.add(ab.build());
2093 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2094 ab1.setKey(new ActionKey(1));
2095 actionList.add(ab1.build());
2097 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2098 aab.setAction(actionList);
2100 InstructionBuilder ib = new InstructionBuilder();
2101 ib.setKey(new InstructionKey(0));
2102 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2104 // Put our Instruction in a list of Instructions
2105 InstructionsBuilder isb = new InstructionsBuilder();
2106 List<Instruction> instructions = new ArrayList<Instruction>();
2107 instructions.add(ib.build());
2108 isb.setInstruction(instructions);
2112 private static InstructionsBuilder createAppyActionInstruction37() {
2114 List<Action> actionList = new ArrayList<Action>();
2115 ActionBuilder ab = new ActionBuilder();
2116 ActionBuilder ab1 = new ActionBuilder();
2117 ActionBuilder ab2 = new ActionBuilder();
2119 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2120 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2121 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2123 IpMatchBuilder ipmatch = new IpMatchBuilder();
2124 IpMatchBuilder ipmatch1 = new IpMatchBuilder();
2125 IpMatchBuilder ipmatch2 = new IpMatchBuilder();
2126 Dscp dscp = new Dscp((short) 3);
2127 ipmatch.setIpDscp(dscp);
2128 ipmatch1.setIpEcn((short) 2);
2129 ipmatch2.setIpProtocol((short) 120);
2130 setFieldBuilder.setIpMatch(ipmatch.build());
2131 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2132 ab.setKey(new ActionKey(0));
2133 actionList.add(ab.build());
2135 setFieldBuilder1.setIpMatch(ipmatch1.build());
2136 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2137 ab1.setKey(new ActionKey(1));
2138 actionList.add(ab1.build());
2140 setFieldBuilder2.setIpMatch(ipmatch2.build());
2141 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2142 ab2.setKey(new ActionKey(2));
2143 actionList.add(ab2.build());
2145 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2146 aab.setAction(actionList);
2148 InstructionBuilder ib = new InstructionBuilder();
2149 ib.setKey(new InstructionKey(0));
2150 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2152 // Put our Instruction in a list of Instructions
2153 InstructionsBuilder isb = new InstructionsBuilder();
2154 List<Instruction> instructions = new ArrayList<Instruction>();
2155 instructions.add(ib.build());
2156 isb.setInstruction(instructions);
2160 private static InstructionsBuilder createAppyActionInstruction38() {
2162 List<Action> actionList = new ArrayList<Action>();
2163 ActionBuilder ab = new ActionBuilder();
2164 ActionBuilder ab1 = new ActionBuilder();
2166 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2167 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2169 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2170 Ipv4MatchBuilder ipv4Match1 = new Ipv4MatchBuilder();
2171 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.5210");
2172 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1");
2173 ipv4Match1.setIpv4Destination(dstip);
2174 ipv4Match.setIpv4Source(srcip);
2175 setFieldBuilder.setLayer3Match(ipv4Match.build());
2176 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2177 ab.setKey(new ActionKey(0));
2178 actionList.add(ab.build());
2180 setFieldBuilder1.setLayer3Match(ipv4Match1.build());
2181 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2182 ab1.setKey(new ActionKey(1));
2183 actionList.add(ab1.build());
2185 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2186 aab.setAction(actionList);
2188 InstructionBuilder ib = new InstructionBuilder();
2189 ib.setKey(new InstructionKey(0));
2190 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2192 // Put our Instruction in a list of Instructions
2193 InstructionsBuilder isb = new InstructionsBuilder();
2194 List<Instruction> instructions = new ArrayList<Instruction>();
2195 instructions.add(ib.build());
2196 isb.setInstruction(instructions);
2200 private static InstructionsBuilder createAppyActionInstruction39() {
2202 List<Action> actionList = new ArrayList<Action>();
2203 ActionBuilder ab = new ActionBuilder();
2204 ActionBuilder ab1 = new ActionBuilder();
2206 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2207 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2210 PortNumber tcpsrcport = new PortNumber(1213);
2211 PortNumber tcpdstport = new PortNumber(646);
2212 TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
2213 TcpMatchBuilder tcpmatch1 = new TcpMatchBuilder();
2214 tcpmatch.setTcpSourcePort(tcpsrcport);
2215 tcpmatch1.setTcpDestinationPort(tcpdstport);
2216 setFieldBuilder.setLayer4Match(tcpmatch.build());
2217 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2218 ab.setKey(new ActionKey(0));
2219 actionList.add(ab.build());
2221 setFieldBuilder1.setLayer4Match(tcpmatch1.build());
2222 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2223 ab1.setKey(new ActionKey(1));
2224 actionList.add(ab.build());
2226 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2227 aab.setAction(actionList);
2229 InstructionBuilder ib = new InstructionBuilder();
2230 ib.setKey(new InstructionKey(0));
2231 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2233 // Put our Instruction in a list of Instructions
2234 InstructionsBuilder isb = new InstructionsBuilder();
2235 List<Instruction> instructions = new ArrayList<Instruction>();
2236 instructions.add(ib.build());
2237 isb.setInstruction(instructions);
2241 private static InstructionsBuilder createAppyActionInstruction40() {
2243 List<Action> actionList = new ArrayList<Action>();
2244 ActionBuilder ab = new ActionBuilder();
2245 ActionBuilder ab1 = new ActionBuilder();
2247 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2248 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2251 PortNumber udpsrcport = new PortNumber(1325);
2252 PortNumber udpdstport = new PortNumber(42);
2253 UdpMatchBuilder udpmatch = new UdpMatchBuilder();
2254 UdpMatchBuilder udpmatch1 = new UdpMatchBuilder();
2255 udpmatch.setUdpDestinationPort(udpdstport);
2256 udpmatch1.setUdpSourcePort(udpsrcport);
2257 setFieldBuilder.setLayer4Match(udpmatch.build());
2258 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2259 ab.setKey(new ActionKey(0));
2260 actionList.add(ab.build());
2262 setFieldBuilder1.setLayer4Match(udpmatch1.build());
2263 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2264 ab1.setKey(new ActionKey(1));
2265 actionList.add(ab1.build());
2267 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2268 aab.setAction(actionList);
2270 InstructionBuilder ib = new InstructionBuilder();
2271 ib.setKey(new InstructionKey(0));
2272 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2274 // Put our Instruction in a list of Instructions
2275 InstructionsBuilder isb = new InstructionsBuilder();
2276 List<Instruction> instructions = new ArrayList<Instruction>();
2277 instructions.add(ib.build());
2278 isb.setInstruction(instructions);
2282 private static InstructionsBuilder createAppyActionInstruction41() {
2284 List<Action> actionList = new ArrayList<Action>();
2285 ActionBuilder ab = new ActionBuilder();
2286 ActionBuilder ab1 = new ActionBuilder();
2288 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2289 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2292 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
2293 SctpMatchBuilder sctpmatch1 = new SctpMatchBuilder();
2294 PortNumber srcport = new PortNumber(1435);
2295 PortNumber dstport = new PortNumber(22);
2296 sctpmatch.setSctpSourcePort(srcport);
2297 sctpmatch1.setSctpDestinationPort(dstport);
2298 setFieldBuilder.setLayer4Match(sctpmatch.build());
2299 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2300 ab.setKey(new ActionKey(0));
2301 actionList.add(ab.build());
2303 setFieldBuilder1.setLayer4Match(sctpmatch1.build());
2304 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2305 ab1.setKey(new ActionKey(1));
2306 actionList.add(ab1.build());
2308 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2309 aab.setAction(actionList);
2311 InstructionBuilder ib = new InstructionBuilder();
2312 ib.setKey(new InstructionKey(0));
2313 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2315 // Put our Instruction in a list of Instructions
2316 InstructionsBuilder isb = new InstructionsBuilder();
2317 List<Instruction> instructions = new ArrayList<Instruction>();
2318 instructions.add(ib.build());
2319 isb.setInstruction(instructions);
2323 private static InstructionsBuilder createAppyActionInstruction42() {
2325 List<Action> actionList = new ArrayList<Action>();
2326 ActionBuilder ab = new ActionBuilder();
2327 ActionBuilder ab1 = new ActionBuilder();
2328 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2329 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2332 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
2333 Icmpv4MatchBuilder icmpv4match1 = new Icmpv4MatchBuilder();
2334 icmpv4match.setIcmpv4Type((short) 8);
2335 icmpv4match1.setIcmpv4Code((short) 0);
2336 setFieldBuilder.setIcmpv4Match(icmpv4match.build());
2337 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2338 ab.setKey(new ActionKey(0));
2339 actionList.add(ab.build());
2341 setFieldBuilder1.setIcmpv4Match(icmpv4match1.build());
2342 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2343 ab1.setKey(new ActionKey(1));
2344 actionList.add(ab1.build());
2346 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2347 aab.setAction(actionList);
2349 InstructionBuilder ib = new InstructionBuilder();
2350 ib.setKey(new InstructionKey(0));
2351 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2353 // Put our Instruction in a list of Instructions
2354 InstructionsBuilder isb = new InstructionsBuilder();
2355 List<Instruction> instructions = new ArrayList<Instruction>();
2356 instructions.add(ib.build());
2357 isb.setInstruction(instructions);
2361 private static InstructionsBuilder createAppyActionInstruction43() {
2363 List<Action> actionList = new ArrayList<Action>();
2364 ActionBuilder ab = new ActionBuilder();
2365 ActionBuilder ab1 = new ActionBuilder();
2366 ActionBuilder ab2 = new ActionBuilder();
2367 ActionBuilder ab3 = new ActionBuilder();
2368 ActionBuilder ab4 = new ActionBuilder();
2370 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2371 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2372 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2373 SetFieldBuilder setFieldBuilder3 = new SetFieldBuilder();
2374 SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder();
2376 // setting the values of ARP
2377 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2378 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2379 Ipv4Prefix dstiparp = new Ipv4Prefix("200.71.9.52");
2380 Ipv4Prefix srciparp = new Ipv4Prefix("100.1.1.1");
2381 // create ARP match action
2382 ArpMatchBuilder arpmatch = new ArpMatchBuilder();
2383 ArpMatchBuilder arpmatch1 = new ArpMatchBuilder();
2384 ArpMatchBuilder arpmatch2 = new ArpMatchBuilder();
2385 ArpMatchBuilder arpmatch3 = new ArpMatchBuilder();
2386 ArpMatchBuilder arpmatch4 = new ArpMatchBuilder();
2387 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2388 arpsrc.setAddress(macsrc);
2389 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2390 arpdst.setAddress(macdest);
2391 arpmatch.setArpOp(2);
2392 arpmatch1.setArpSourceHardwareAddress(arpsrc.build());
2393 arpmatch2.setArpTargetHardwareAddress(arpdst.build());
2394 arpmatch3.setArpSourceTransportAddress(srciparp);
2395 arpmatch4.setArpTargetTransportAddress(dstiparp);
2396 setFieldBuilder.setLayer3Match(arpmatch.build());
2397 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2398 ab.setKey(new ActionKey(0));
2399 actionList.add(ab.build());
2401 setFieldBuilder1.setLayer3Match(arpmatch1.build());
2402 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2403 ab1.setKey(new ActionKey(1));
2404 actionList.add(ab1.build());
2406 setFieldBuilder2.setLayer3Match(arpmatch2.build());
2407 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2408 ab2.setKey(new ActionKey(2));
2409 actionList.add(ab2.build());
2411 setFieldBuilder3.setLayer3Match(arpmatch3.build());
2412 ab3.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2413 ab3.setKey(new ActionKey(3));
2414 actionList.add(ab3.build());
2416 setFieldBuilder4.setLayer3Match(arpmatch4.build());
2417 ab4.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2418 ab4.setKey(new ActionKey(4));
2419 actionList.add(ab4.build());
2421 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2422 aab.setAction(actionList);
2424 InstructionBuilder ib = new InstructionBuilder();
2425 ib.setKey(new InstructionKey(0));
2426 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2428 // Put our Instruction in a list of Instructions
2429 InstructionsBuilder isb = new InstructionsBuilder();
2430 List<Instruction> instructions = new ArrayList<Instruction>();
2431 instructions.add(ib.build());
2432 isb.setInstruction(instructions);
2436 private static InstructionsBuilder createAppyActionInstruction44() {
2438 List<Action> actionLists = new ArrayList<Action>();
2439 ActionBuilder ab = new ActionBuilder();
2440 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2441 ActionBuilder ab1 = new ActionBuilder();
2442 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2444 * ActionBuilder ab2 = new ActionBuilder(); SetFieldBuilder
2445 * setFieldBuilder2 = new SetFieldBuilder(); ActionBuilder ab3 = new
2446 * ActionBuilder(); SetFieldBuilder setFieldBuilder3 = new
2447 * SetFieldBuilder(); ActionBuilder ab4 = new ActionBuilder();
2448 * SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder();
2450 ActionBuilder ab5 = new ActionBuilder();
2451 SetFieldBuilder setFieldBuilder5 = new SetFieldBuilder();
2452 ActionBuilder ab6 = new ActionBuilder();
2453 SetFieldBuilder setFieldBuilder6 = new SetFieldBuilder();
2456 Ipv6MatchBuilder ipv6Builder = new Ipv6MatchBuilder();
2457 Ipv6MatchBuilder ipv6Builder1 = new Ipv6MatchBuilder();
2458 // Ipv6MatchBuilder ipv6Builder2 = new Ipv6MatchBuilder();
2459 // Ipv6MatchBuilder ipv6Builder3 = new Ipv6MatchBuilder();
2460 // Ipv6MatchBuilder ipv6Builder4 = new Ipv6MatchBuilder();
2461 Ipv6MatchBuilder ipv6Builder5 = new Ipv6MatchBuilder();
2462 Ipv6MatchBuilder ipv6Builder6 = new Ipv6MatchBuilder();
2464 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2");
2465 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1");
2466 // Ipv6Address ndtarget = new
2467 // Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
2468 // MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
2469 // MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
2470 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2471 nextheader.setIpv6Exthdr(58);
2472 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2473 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2474 ipv6label.setIpv6Flabel(label);
2476 ipv6Builder.setIpv6Source(srcip6);
2477 ipv6Builder1.setIpv6Destination(dstip6);
2478 // ipv6Builder2.setIpv6NdTarget(ndtarget);
2479 // ipv6Builder3.setIpv6NdSll(ndsll);
2480 // ipv6Builder4.setIpv6NdTll(ndtll);
2481 ipv6Builder5.setIpv6ExtHeader(nextheader.build());
2482 ipv6Builder6.setIpv6Label(ipv6label.build());
2484 setFieldBuilder.setLayer3Match(ipv6Builder.build());
2485 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2486 ab.setKey(new ActionKey(0));
2487 actionLists.add(ab.build());
2489 setFieldBuilder1.setLayer3Match(ipv6Builder1.build());
2490 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2491 ab1.setKey(new ActionKey(1));
2492 actionLists.add(ab1.build());
2495 * setFieldBuilder2.setLayer3Match(ipv6Builder2.build());
2497 * SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2498 * ab2.setKey(new ActionKey(2)); actionLists.add(ab2.build());
2500 * setFieldBuilder3.setLayer3Match(ipv6Builder3.build());
2502 * SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2503 * ab3.setKey(new ActionKey(3)); actionLists.add(ab3.build());
2505 * setFieldBuilder4.setLayer3Match(ipv6Builder4.build());
2507 * SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2508 * ab4.setKey(new ActionKey(4)); actionLists.add(ab4.build());
2510 setFieldBuilder5.setLayer3Match(ipv6Builder5.build());
2511 ab5.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder5.build()).build());
2512 ab5.setKey(new ActionKey(5));
2513 actionLists.add(ab5.build());
2515 setFieldBuilder6.setLayer3Match(ipv6Builder6.build());
2516 ab6.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder6.build()).build());
2517 ab6.setKey(new ActionKey(6));
2518 actionLists.add(ab6.build());
2520 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2521 aab.setAction(actionLists);
2523 InstructionBuilder ib = new InstructionBuilder();
2524 ib.setKey(new InstructionKey(0));
2525 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2527 // Put our Instruction in a list of Instructions
2528 InstructionsBuilder isb = new InstructionsBuilder();
2529 List<Instruction> instructions = new ArrayList<Instruction>();
2530 instructions.add(ib.build());
2531 isb.setInstruction(instructions);
2535 private static InstructionsBuilder createAppyActionInstruction45() {
2537 List<Action> actionList = new ArrayList<Action>();
2538 ActionBuilder ab = new ActionBuilder();
2539 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2540 ActionBuilder ab1 = new ActionBuilder();
2541 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2544 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
2545 Icmpv6MatchBuilder icmpv6match1 = new Icmpv6MatchBuilder();
2546 icmpv6match.setIcmpv6Type((short) 135);
2547 icmpv6match1.setIcmpv6Code((short) 0);
2548 setFieldBuilder.setIcmpv6Match(icmpv6match.build());
2549 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2550 ab.setKey(new ActionKey(0));
2551 actionList.add(ab.build());
2553 setFieldBuilder1.setIcmpv6Match(icmpv6match1.build());
2554 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2555 ab1.setKey(new ActionKey(1));
2556 actionList.add(ab1.build());
2558 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2559 aab.setAction(actionList);
2561 InstructionBuilder ib = new InstructionBuilder();
2562 ib.setKey(new InstructionKey(0));
2563 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2565 // Put our Instruction in a list of Instructions
2566 InstructionsBuilder isb = new InstructionsBuilder();
2567 List<Instruction> instructions = new ArrayList<Instruction>();
2568 instructions.add(ib.build());
2569 isb.setInstruction(instructions);
2573 private static InstructionsBuilder createAppyActionInstruction46() {
2575 List<Action> actionList = new ArrayList<Action>();
2576 ActionBuilder ab = new ActionBuilder();
2577 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2578 ActionBuilder ab1 = new ActionBuilder();
2579 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2580 ActionBuilder ab2 = new ActionBuilder();
2581 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2584 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2585 ProtocolMatchFieldsBuilder protomatch1 = new ProtocolMatchFieldsBuilder();
2586 ProtocolMatchFieldsBuilder protomatch2 = new ProtocolMatchFieldsBuilder();
2587 protomatch.setMplsLabel((long) 36008);
2588 protomatch1.setMplsTc((short) 4);
2589 protomatch2.setMplsBos((short) 1);
2590 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2591 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2592 ab.setKey(new ActionKey(0));
2593 actionList.add(ab.build());
2595 setFieldBuilder1.setProtocolMatchFields(protomatch1.build());
2596 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2597 ab1.setKey(new ActionKey(1));
2598 actionList.add(ab1.build());
2600 setFieldBuilder2.setProtocolMatchFields(protomatch2.build());
2601 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2602 ab2.setKey(new ActionKey(2));
2603 actionList.add(ab2.build());
2605 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2606 aab.setAction(actionList);
2608 InstructionBuilder ib = new InstructionBuilder();
2609 ib.setKey(new InstructionKey(0));
2610 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2612 // Put our Instruction in a list of Instructions
2613 InstructionsBuilder isb = new InstructionsBuilder();
2614 List<Instruction> instructions = new ArrayList<Instruction>();
2615 instructions.add(ib.build());
2616 isb.setInstruction(instructions);
2620 private static InstructionsBuilder createAppyActionInstruction47() {
2622 List<Action> actionList = new ArrayList<Action>();
2623 ActionBuilder ab = new ActionBuilder();
2624 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2626 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2627 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask((new BigInteger(new byte[] { 0, 1, 0, 0 }).longValue())).build());
2628 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2629 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2630 actionList.add(ab.build());
2632 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2633 aab.setAction(actionList);
2635 InstructionBuilder ib = new InstructionBuilder();
2636 ib.setKey(new InstructionKey(0));
2637 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2639 // Put our Instruction in a list of Instructions
2640 InstructionsBuilder isb = new InstructionsBuilder();
2641 List<Instruction> instructions = new ArrayList<Instruction>();
2642 instructions.add(ib.build());
2643 isb.setInstruction(instructions);
2647 private static InstructionsBuilder createAppyActionInstruction48() {
2649 List<Action> actionList = new ArrayList<Action>();
2650 ActionBuilder ab = new ActionBuilder();
2651 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2653 TunnelBuilder tunnel = new TunnelBuilder();
2654 tunnel.setTunnelId(BigInteger.valueOf(10668));
2655 setFieldBuilder.setTunnel(tunnel.build());
2656 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2657 ab.setKey(new ActionKey(0));
2658 actionList.add(ab.build());
2660 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2661 aab.setAction(actionList);
2663 InstructionBuilder ib = new InstructionBuilder();
2664 ib.setKey(new InstructionKey(0));
2665 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2667 // Put our Instruction in a list of Instructions
2668 InstructionsBuilder isb = new InstructionsBuilder();
2669 List<Instruction> instructions = new ArrayList<Instruction>();
2670 instructions.add(ib.build());
2671 isb.setInstruction(instructions);
2675 private static MatchBuilder createLLDPMatch() {
2676 MatchBuilder match = new MatchBuilder();
2677 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2678 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2679 ethTypeBuilder.setType(new EtherType(0x88ccL));
2680 eth.setEthernetType(ethTypeBuilder.build());
2681 match.setEthernetMatch(eth.build());
2688 private static MatchBuilder createMatch1() {
2689 MatchBuilder match = new MatchBuilder();
2690 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2691 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2692 ipv4Match.setIpv4Destination(prefix);
2693 Ipv4Match i4m = ipv4Match.build();
2694 match.setLayer3Match(i4m);
2696 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2697 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2698 ethTypeBuilder.setType(new EtherType(0x0800L));
2699 eth.setEthernetType(ethTypeBuilder.build());
2700 match.setEthernetMatch(eth.build());
2707 private static MatchBuilder createIPv4DstMatch() {
2708 MatchBuilder match = new MatchBuilder();
2709 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2710 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2711 ipv4Match.setIpv4Destination(prefix);
2712 Ipv4Match i4m = ipv4Match.build();
2713 match.setLayer3Match(i4m);
2721 private static MatchBuilder createIPv4SrcMatch() {
2722 MatchBuilder match = new MatchBuilder();
2723 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2724 Ipv4Prefix prefix = new Ipv4Prefix("10.20.30.40/24");
2725 ipv4Match.setIpv4Source(prefix);
2726 Ipv4Match i4m = ipv4Match.build();
2727 match.setLayer3Match(i4m);
2729 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2730 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2731 ethTypeBuilder.setType(new EtherType(0x0800L));
2732 eth.setEthernetType(ethTypeBuilder.build());
2733 match.setEthernetMatch(eth.build());
2740 private static MatchBuilder createMatch2() {
2741 MatchBuilder match = new MatchBuilder();
2742 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2743 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1");
2744 ipv4Match.setIpv4Source(prefix);
2745 Ipv4Match i4m = ipv4Match.build();
2746 match.setLayer3Match(i4m);
2748 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2749 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2750 ethTypeBuilder.setType(new EtherType(0x0800L));
2751 eth.setEthernetType(ethTypeBuilder.build());
2752 match.setEthernetMatch(eth.build());
2759 private static MatchBuilder createMatch3() {
2760 MatchBuilder match = new MatchBuilder();
2761 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
2762 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
2763 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
2764 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
2765 match.setEthernetMatch(ethernetMatch.build());
2773 private static MatchBuilder createICMPv6Match1() {
2775 MatchBuilder match = new MatchBuilder();
2776 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2777 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2778 ethTypeBuilder.setType(new EtherType(0x86ddL));
2779 eth.setEthernetType(ethTypeBuilder.build());
2780 match.setEthernetMatch(eth.build());
2782 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2783 ipmatch.setIpProtocol((short) 256);
2784 match.setIpMatch(ipmatch.build());
2786 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2788 icmpv6match.setIcmpv6Type((short) 135);
2789 icmpv6match.setIcmpv6Code((short) 1);
2790 match.setIcmpv6Match(icmpv6match.build());
2795 private static MatchBuilder createMatch33() {
2797 MatchBuilder match = new MatchBuilder();
2798 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2799 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.10");
2800 ipv4Match.setIpv4Source(prefix);
2801 Ipv4Match i4m = ipv4Match.build();
2802 match.setLayer3Match(i4m);
2804 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2805 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2806 ethTypeBuilder.setType(new EtherType(0xfffeL));
2807 eth.setEthernetType(ethTypeBuilder.build());
2808 match.setEthernetMatch(eth.build());
2812 private static MatchBuilder createInphyportMatch(NodeId nodeId) {
2813 MatchBuilder match = new MatchBuilder();
2814 match.setInPort(new NodeConnectorId(nodeId + ":202"));
2815 match.setInPhyPort(new NodeConnectorId(nodeId + ":10122"));
2819 private static MatchBuilder createEthernetMatch() {
2820 MatchBuilder match = new MatchBuilder();
2822 byte[] mask1 = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2823 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2825 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
2827 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2828 EtherType type = new EtherType(0x0800L);
2829 ethmatch.setEthernetType(ethtype.setType(type).build());
2831 EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet
2834 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2835 ethdest.setAddress(macdest);
2836 ethdest.setMask(new MacAddress("ff:ff:ff:00:00:00"));
2838 ethmatch.setEthernetDestination(ethdest.build());
2840 EthernetSourceBuilder ethsrc = new EthernetSourceBuilder();
2841 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2842 ethsrc.setAddress(macsrc);
2843 ethsrc.setMask(new MacAddress("ff:ff:00:00:00:00"));
2845 ethmatch.setEthernetSource(ethsrc.build());
2846 match.setEthernetMatch(ethmatch.build());
2855 private static MatchBuilder createVlanMatch() {
2856 MatchBuilder match = new MatchBuilder();
2857 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder(); // vlan match
2858 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
2859 VlanId vlanId = new VlanId(10);
2860 VlanPcp vpcp = new VlanPcp((short) 3);
2861 vlanBuilder.setVlanPcp(vpcp);
2862 vlanIdBuilder.setVlanId(vlanId);
2863 vlanIdBuilder.setVlanIdPresent(true);
2864 vlanBuilder.setVlanId(vlanIdBuilder.build());
2865 match.setVlanMatch(vlanBuilder.build());
2872 private static MatchBuilder createArpMatch() {
2873 MatchBuilder match = new MatchBuilder();
2875 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2876 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2877 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2879 byte[] mask = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2880 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2882 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2883 EtherType type = new EtherType(0x0806L);
2884 ethmatch.setEthernetType(ethtype.setType(type).build());
2886 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
2887 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2889 ArpMatchBuilder arpmatch = new ArpMatchBuilder(); // arp match
2890 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2891 arpsrc.setAddress(macsrc);
2892 arpsrc.setMask(new MacAddress("ff:ff:ff:00:00:00"));
2893 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2894 arpdst.setAddress(macdest);
2895 arpdst.setMask(new MacAddress("ff:ff:00:00:00:00"));
2896 arpmatch.setArpOp(2);
2897 arpmatch.setArpSourceHardwareAddress(arpsrc.build());
2898 arpmatch.setArpTargetHardwareAddress(arpdst.build());
2899 arpmatch.setArpSourceTransportAddress(srcip);
2900 arpmatch.setArpTargetTransportAddress(dstip);
2902 match.setEthernetMatch(ethmatch.build());
2903 match.setLayer3Match(arpmatch.build());
2911 private static MatchBuilder createIPMatch() {
2912 MatchBuilder match = new MatchBuilder();
2913 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2914 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2915 EtherType type = new EtherType(0x0800L);
2916 ethmatch.setEthernetType(ethtype.setType(type).build());
2917 match.setEthernetMatch(ethmatch.build());
2919 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2920 ipmatch.setIpProtocol((short) 1);
2921 Dscp dscp = new Dscp((short) 3);
2922 ipmatch.setIpDscp(dscp);
2923 ipmatch.setIpEcn((short) 2);
2924 match.setIpMatch(ipmatch.build());
2931 private static MatchBuilder createL3IPv4Match() {
2932 MatchBuilder match = new MatchBuilder();
2934 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2935 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2936 ethTypeBuilder.setType(new EtherType(0x0800L));
2937 eth.setEthernetType(ethTypeBuilder.build());
2938 match.setEthernetMatch(eth.build());
2940 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2941 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
2942 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2943 Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
2944 ipv4match.setIpv4Destination(dstip);
2945 ipv4match.setIpv4Source(srcip);
2946 match.setLayer3Match(ipv4match.build());
2955 private static MatchBuilder createL3IPv6Match() {
2956 MatchBuilder match = new MatchBuilder();
2958 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2959 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2960 ethTypeBuilder.setType(new EtherType(0x86ddL));
2961 eth.setEthernetType(ethTypeBuilder.build());
2962 match.setEthernetMatch(eth.build());
2964 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2/64");
2965 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1/56");
2966 Ipv6Address ndtarget = new Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
2967 MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
2968 MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
2969 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2970 nextheader.setIpv6Exthdr(58);
2971 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2972 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2973 ipv6label.setIpv6Flabel(label);
2974 ipv6label.setFlabelMask(new Ipv6FlowLabel(1L));
2976 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2978 icmpv6match.setIcmpv6Type((short) 135);
2979 icmpv6match.setIcmpv6Code((short) 0);
2980 match.setIcmpv6Match(icmpv6match.build());
2982 Ipv6MatchBuilder ipv6match = new Ipv6MatchBuilder();
2983 // ipv6match.setIpv6Source(srcip6);
2984 // ipv6match.setIpv6Destination(dstip6);
2985 // ipv6match.setIpv6ExtHeader(nextheader.build());
2986 ipv6match.setIpv6NdSll(ndsll);
2987 ipv6match.setIpv6NdTll(ndtll);
2988 // ipv6match.setIpv6NdTarget(ndtarget);
2989 ipv6match.setIpv6Label(ipv6label.build());
2991 match.setLayer3Match(ipv6match.build());
3000 private static MatchBuilder createICMPv4Match() {
3001 MatchBuilder match = new MatchBuilder();
3002 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3003 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3004 ethTypeBuilder.setType(new EtherType(0x0800L));
3005 eth.setEthernetType(ethTypeBuilder.build());
3006 match.setEthernetMatch(eth.build());
3008 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3009 ipmatch.setIpProtocol((short) 1);
3010 match.setIpMatch(ipmatch.build());
3012 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder(); // icmpv4
3014 icmpv4match.setIcmpv4Type((short) 8);
3015 icmpv4match.setIcmpv4Code((short) 0);
3016 match.setIcmpv4Match(icmpv4match.build());
3023 private static MatchBuilder createICMPv6Match() {
3025 MatchBuilder match = new MatchBuilder();
3026 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3027 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3028 ethTypeBuilder.setType(new EtherType(0x86ddL));
3029 eth.setEthernetType(ethTypeBuilder.build());
3030 match.setEthernetMatch(eth.build());
3032 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3033 ipmatch.setIpProtocol((short) 58);
3034 match.setIpMatch(ipmatch.build());
3036 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
3038 icmpv6match.setIcmpv6Type((short) 135);
3039 icmpv6match.setIcmpv6Code((short) 1);
3040 match.setIcmpv6Match(icmpv6match.build());
3048 private static MatchBuilder createToSMatch() {
3049 MatchBuilder match = new MatchBuilder();
3050 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
3051 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
3052 EtherType type = new EtherType(0x0800L);
3053 ethmatch.setEthernetType(ethtype.setType(type).build());
3054 match.setEthernetMatch(ethmatch.build());
3056 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3057 ipmatch.setIpProtocol((short) 6);
3058 Dscp dscp = new Dscp((short) 8);
3059 ipmatch.setIpDscp(dscp);
3060 match.setIpMatch(ipmatch.build());
3068 private static MatchBuilder createL4TCPMatch() {
3069 MatchBuilder match = new MatchBuilder();
3071 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3072 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3073 ethTypeBuilder.setType(new EtherType(0x0800L));
3074 eth.setEthernetType(ethTypeBuilder.build());
3075 match.setEthernetMatch(eth.build());
3077 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3078 ipmatch.setIpProtocol((short) 6);
3079 match.setIpMatch(ipmatch.build());
3081 PortNumber srcport = new PortNumber(1213);
3082 PortNumber dstport = new PortNumber(646);
3083 TcpMatchBuilder tcpmatch = new TcpMatchBuilder(); // tcp match
3084 tcpmatch.setTcpSourcePort(srcport);
3085 tcpmatch.setTcpDestinationPort(dstport);
3086 match.setLayer4Match(tcpmatch.build());
3094 private static MatchBuilder createL4UDPMatch() {
3095 MatchBuilder match = new MatchBuilder();
3097 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3098 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3099 ethTypeBuilder.setType(new EtherType(0x0800L));
3100 eth.setEthernetType(ethTypeBuilder.build());
3101 match.setEthernetMatch(eth.build());
3103 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3104 ipmatch.setIpProtocol((short) 17);
3105 match.setIpMatch(ipmatch.build());
3107 PortNumber srcport = new PortNumber(1325);
3108 PortNumber dstport = new PortNumber(42);
3109 UdpMatchBuilder udpmatch = new UdpMatchBuilder(); // udp match
3110 udpmatch.setUdpDestinationPort(dstport);
3111 udpmatch.setUdpSourcePort(srcport);
3112 match.setLayer4Match(udpmatch.build());
3120 private static MatchBuilder createL4SCTPMatch() {
3121 MatchBuilder match = new MatchBuilder();
3123 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3124 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3125 ethTypeBuilder.setType(new EtherType(0x0800L));
3126 eth.setEthernetType(ethTypeBuilder.build());
3127 match.setEthernetMatch(eth.build());
3129 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3130 ipmatch.setIpProtocol((short) 132);
3131 match.setIpMatch(ipmatch.build());
3133 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
3134 PortNumber srcport = new PortNumber(1435);
3135 PortNumber dstport = new PortNumber(22);
3136 sctpmatch.setSctpSourcePort(srcport);
3137 sctpmatch.setSctpDestinationPort(dstport);
3138 match.setLayer4Match(sctpmatch.build());
3146 private static MatchBuilder createMetadataMatch() {
3147 MatchBuilder match = new MatchBuilder();
3148 byte[] metamask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
3149 MetadataBuilder metadata = new MetadataBuilder(); // metadata match
3150 metadata.setMetadata(BigInteger.valueOf(500L));
3151 metadata.setMetadataMask(new BigInteger(metamask));
3152 match.setMetadata(metadata.build());
3160 private static MatchBuilder createMplsMatch() {
3161 MatchBuilder match = new MatchBuilder();
3163 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3164 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3165 ethTypeBuilder.setType(new EtherType(0x8847L));
3166 eth.setEthernetType(ethTypeBuilder.build());
3167 match.setEthernetMatch(eth.build());
3169 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3171 protomatch.setMplsLabel((long) 36008);
3172 protomatch.setMplsTc((short) 4);
3173 protomatch.setMplsBos((short) 1);
3174 match.setProtocolMatchFields(protomatch.build());
3183 private static MatchBuilder createPbbMatch() {
3184 MatchBuilder match = new MatchBuilder();
3186 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3187 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3188 ethTypeBuilder.setType(new EtherType(0x88E7L));
3189 eth.setEthernetType(ethTypeBuilder.build());
3190 match.setEthernetMatch(eth.build());
3192 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3194 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new BigInteger(new byte[] { 0, 1, 0, 0 }).longValue()).build());
3195 match.setProtocolMatchFields(protomatch.build());
3204 private static MatchBuilder createTunnelIDMatch() {
3205 MatchBuilder match = new MatchBuilder();
3206 TunnelBuilder tunnel = new TunnelBuilder(); // tunnel id match
3207 tunnel.setTunnelId(BigInteger.valueOf(10668));
3208 byte[] mask = new byte[] {(byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
3209 tunnel.setTunnelMask(new BigInteger(1, mask));
3210 match.setTunnel(tunnel.build());
3216 * Test match for TCP_Flags
3217 * @return match containing Ethertype (0x0800), IP Protocol (TCP), TCP_Flag (SYN)
3219 //FIXME: move to extensible support
3220 private static MatchBuilder createTcpFlagMatch() {
3221 MatchBuilder match = new MatchBuilder();
3224 EthernetMatchBuilder ethernetType = new EthernetMatchBuilder();
3225 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3226 ethTypeBuilder.setType(new EtherType(0x0800L));
3227 ethernetType.setEthernetType(ethTypeBuilder.build());
3228 match.setEthernetMatch(ethernetType.build());
3230 // TCP Protocol Match
3231 IpMatchBuilder ipMatch = new IpMatchBuilder(); // ipv4 version
3232 ipMatch.setIpProtocol((short) 6);
3233 match.setIpMatch(ipMatch.build());
3236 PortNumber dstPort = new PortNumber(80);
3237 TcpMatchBuilder tcpMatch = new TcpMatchBuilder();
3238 tcpMatch.setTcpDestinationPort(dstPort);
3239 match.setLayer4Match(tcpMatch.build());
3241 * Defined TCP Flag values in OVS v2.1+
3242 * TCP_FIN 0x001 / TCP_SYN 0x002 / TCP_RST 0x004
3243 * TCP_PSH 0x008 / TCP_ACK 0x010 / TCP_URG 0x020
3244 * TCP_ECE 0x040 / TCP_CWR 0x080 / TCP_NS 0x100
3246 TcpFlagMatchBuilder tcpFlagMatch = new TcpFlagMatchBuilder();
3247 tcpFlagMatch.setTcpFlag(0x002);
3248 match.setTcpFlagMatch(tcpFlagMatch.build());
3253 public void _removeMDFlow(CommandInterpreter ci) {
3254 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
3255 NodeBuilder tn = createTestNode(ci.nextArgument());
3256 String flowtype = ci.nextArgument();
3258 if (flowtype.equals("fTM")) {
3259 tf = createtablemiss(tn, flowtype, ci.nextArgument());
3261 tf = createTestFlow(tn, flowtype, ci.nextArgument());
3263 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class).child(Node.class, tn.getKey())
3264 .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf.getTableId()))
3265 .child(Flow.class, tf.getKey()).build();
3266 modification.removeConfigurationData(path1);
3267 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
3269 RpcResult<TransactionStatus> result = commitFuture.get();
3270 TransactionStatus status = result.getResult();
3271 ci.println("Status of Flow Data Loaded Transaction: " + status);
3273 } catch (InterruptedException e) {
3274 LOG.error(e.getMessage(), e);
3275 } catch (ExecutionException e) {
3276 LOG.error(e.getMessage(), e);
3281 * @param ci arguments: switchId flowType tableNum
3284 * e.g.: addMDFlow openflow:1 f1 42
3287 public void _addMDFlow(CommandInterpreter ci) {
3288 NodeBuilder tn = createTestNode(ci.nextArgument());
3289 String flowtype = ci.nextArgument();
3291 if (flowtype.equals("fTM")) {
3292 tf = createtablemiss(tn, flowtype, ci.nextArgument());
3294 tf = createTestFlow(tn, flowtype, ci.nextArgument());
3296 writeFlow(ci, tf, tn);
3299 private void writeFlow(CommandInterpreter ci, FlowBuilder flow, NodeBuilder nodeBuilder) {
3300 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
3301 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class)
3302 .child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
3303 .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.getKey()).build();
3304 modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
3305 modification.putConfigurationData(path1, flow.build());
3306 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
3308 RpcResult<TransactionStatus> result = commitFuture.get();
3309 TransactionStatus status = result.getResult();
3310 ci.println("Status of Flow Data Loaded Transaction: " + status);
3312 } catch (InterruptedException e) {
3313 LOG.error(e.getMessage(), e);
3314 } catch (ExecutionException e) {
3315 LOG.error(e.getMessage(), e);
3319 public void _modifyMDFlow(CommandInterpreter ci) {
3320 NodeBuilder tn = createTestNode(ci.nextArgument());
3321 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
3322 tf.setFlowName(updatedFlowName);
3323 writeFlow(ci, tf, tn);
3324 tf.setFlowName(originalFlowName);
3325 writeFlow(ci, tf, tn);
3328 private static NodeRef createNodeRef(String string) {
3329 NodeKey key = new NodeKey(new NodeId(string));
3330 InstanceIdentifier<Node> path = InstanceIdentifier.builder(Nodes.class).child(Node.class, key)
3333 return new NodeRef(path);
3337 public String getHelp() {
3342 * usage testSwitchFlows <numberOfSwitches> <numberOfFlows> <warmup iterations> <Number Of Threads>
3343 * ex: _perfFlowTest 10 5 1 2
3345 public void _perfFlowTest(CommandInterpreter ci) {
3347 String numberOfSwtichesStr = ci.nextArgument();
3348 String numberOfFlowsStr = ci.nextArgument();
3349 String warmupIterationsStr = ci.nextArgument();
3350 String threadCountStr = ci.nextArgument();
3351 String warmUpStr = ci.nextArgument();
3353 Collection<String> testResults = null;
3354 if(testResults == null){
3355 testResults = new ArrayList<String>();
3358 int numberOfSwtiches = 0;
3359 int numberOfFlows = 0;
3360 int warmupIterations = 0;
3361 boolean warmUpIterations = false;
3363 int threadCount = 0;
3364 if(numberOfSwtichesStr !=null && !numberOfSwtichesStr.trim().equals("")){
3365 numberOfSwtiches = new Integer(numberOfSwtichesStr).intValue();
3367 numberOfSwtiches = 2;
3370 if(numberOfFlowsStr !=null && !numberOfFlowsStr.trim().equals("")){
3371 numberOfFlows = new Integer(numberOfFlowsStr).intValue();
3376 if(warmupIterationsStr !=null && !warmupIterationsStr.trim().equals("")){
3377 warmupIterations = new Integer(warmupIterationsStr).intValue();
3379 warmupIterations = 2;
3382 if(threadCountStr !=null && !threadCountStr.trim().equals("")){
3383 threadCount = new Integer(threadCountStr).intValue();
3387 if(warmUpStr !=null && !warmUpStr.trim().equals("") && warmUpStr.trim().equals("true")){
3388 warmUpIterations = true;
3390 warmUpIterations = false;
3392 ci.println("* Test Configurations*");
3393 ci.println("* numberOfSwtiches:::"+numberOfSwtiches+"");
3394 ci.println("* numberOfFlows:::"+numberOfFlows+"");
3395 ci.println("* warmupIterations:::"+warmupIterations+"");
3396 ci.println("* Number of Threads :::"+threadCount+"");
3397 ci.println("* Warmup Required? :::"+warmUpIterations+"");
3399 String dataPath="openflow:1";
3400 String flowType = "fTM";
3403 String tableId = "0";
3404 if(warmUpIterations){
3405 ci.println("----Warmup Started-----");
3406 for(int j =1; j<= warmupIterations; j++){
3407 for(int i =1;i<=numberOfSwtiches;i++){
3408 dataPath = "openflow:"+i;
3409 tn = createTestNode(dataPath);
3410 for (int flow=1;flow<numberOfFlows;flow++){
3411 tf = createTestFlow_perfTest(tn, "f1", tableId, flow);
3412 writeFlow(ci, tf, tn);
3417 ci.println("----Warmup Done-----");
3420 ExecutorService executor = Executors.newFixedThreadPool(threadCount);
3423 for ( int t=0;t< threadCount;t++){
3425 Runnable tRunnable = new TestFlowThread(numberOfSwtiches, numberOfFlows, ci, t, tableID);
3426 executor.execute(tRunnable);
3428 executor.shutdown();
3429 executor.awaitTermination(1, TimeUnit.SECONDS);
3430 } catch(Exception e){
3431 ci.println("Exception:"+e.getMessage());
3435 public class TestFlowThread implements Runnable {
3437 int numberOfSwitches;
3440 CommandInterpreter ci;
3443 Collection<String> testResults = null;
3446 TestFlowThread(int numberOfSwtiches, int numberOfFlows, CommandInterpreter ci, int t, int tableID) {
3447 this.numberOfSwitches = numberOfSwtiches;
3448 this.numberOfFlows = numberOfFlows;
3450 this.theadNumber = t;
3451 this.tableID = tableID;
3459 public void executeFlow() {
3461 String dataPath = "openflow:1";
3464 //String tableId = "0";
3466 ci.println("New Thread started with id: ID_"
3467 + this.theadNumber);
3468 int totalNumberOfFlows = 0;
3469 long startTime = System.currentTimeMillis();
3471 for (int i = 1; i <= this.numberOfSwitches; i++) {
3472 dataPath = "openflow:" + i;
3473 tn = createTestNode(dataPath);
3474 for (int flow2 = 1; flow2 <= this.numberOfFlows; flow2++) {
3475 tf = createTestFlow_perfTest(tn, "f1", ""+this.tableID, flow2);
3476 writeFlow(this.ci, tf, tn);
3477 totalNumberOfFlows++;
3480 long endTime = System.currentTimeMillis();
3481 long timeInSeconds = Math.round((endTime - startTime) / 1000);
3482 if (timeInSeconds > 0) {
3483 ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::" + Math.round(totalNumberOfFlows / timeInSeconds));
3485 ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::" + totalNumberOfFlows);
3491 * usage testAllFlows <dp>
3492 * ex: _perfFlowTest 1
3494 public void _testAllFlows(CommandInterpreter ci) {
3495 String dataPathID = ci.nextArgument();
3496 int numberOfFlows = 82;
3497 int threadCount = 0;
3498 if(dataPathID ==null || dataPathID.trim().equals("")){
3501 ci.println("* Test All Flows *");
3502 ci.println("* dataPathID:::"+dataPathID+"");
3503 String dataPath="openflow:"+dataPathID;
3504 String tableId = "0";
3505 NodeBuilder tn = createTestNode(dataPath);
3507 for (int flow=1;flow<numberOfFlows;flow++){
3508 String flowID = "f"+flow;
3510 tf = createTestFlow(tn, flowID, tableId);
3511 writeFlow(ci, tf, tn);
3512 } catch(Exception e){
3513 ci.println("--Test Failed--Issue found while adding flow"+ flow);