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(createMatch1().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());
670 LOG.warn("flow type not understood: {}", flowType);
673 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
674 if (null == flow.isBarrier()) {
675 flow.setBarrier(Boolean.FALSE);
677 // flow.setBufferId(new Long(12));
678 BigInteger value = new BigInteger("10", 10);
679 // BigInteger outputPort = new BigInteger("65535", 10);
680 flow.setCookie(new FlowCookie(value));
681 flow.setCookieMask(new FlowCookie(value));
682 flow.setHardTimeout(0);
683 flow.setIdleTimeout(0);
684 flow.setInstallHw(false);
685 flow.setStrict(false);
686 flow.setContainerName(null);
687 flow.setFlags(new FlowModFlags(false, false, false, false, true));
688 flow.setId(new FlowId("12"));
689 flow.setTableId(getTableId(tableId));
690 // commenting setOutGroup and setOutPort, as by default
692 // enable setOutGroup and setOutPort to enable output filtering
693 // flow.setOutGroup(new Long(2));
694 // set outport to OFPP_NONE (65535) to disable remove restriction for
696 // flow.setOutPort(outputPort);
699 flow.setFlowName(originalFlowName + "X" + flowType);
705 private FlowBuilder createTestFlow_perfTest(NodeBuilder nodeBuilder, String flowTypeArg, String tableId, int id) {
707 FlowBuilder flow = new FlowBuilder();
710 String flowType = flowTypeArg;
711 if (flowType == null) {
715 flow.setPriority(id);
720 flow.setMatch(createMatch1().build());
721 flow.setInstructions(createDecNwTtlInstructions().build());
724 LOG.warn("flow type not understood: {}", flowType);
727 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
728 if (null == flow.isBarrier()) {
729 flow.setBarrier(Boolean.FALSE);
731 // flow.setBufferId(new Long(12));
732 BigInteger value = new BigInteger("10", 10);
733 // BigInteger outputPort = new BigInteger("65535", 10);
734 flow.setCookie(new FlowCookie(value));
735 flow.setCookieMask(new FlowCookie(value));
736 flow.setHardTimeout(0);
737 flow.setIdleTimeout(0);
738 flow.setInstallHw(false);
739 flow.setStrict(false);
740 flow.setContainerName(null);
741 flow.setFlags(new FlowModFlags(false, false, false, false, true));
742 flow.setId(new FlowId("12"));
743 flow.setTableId(getTableId(tableId));
744 // commenting setOutGroup and setOutPort, as by default
746 // enable setOutGroup and setOutPort to enable output filtering
747 // flow.setOutGroup(new Long(2));
748 // set outport to OFPP_NONE (65535) to disable remove restriction for
750 // flow.setOutPort(outputPort);
753 flow.setFlowName(originalFlowName + "X" + flowType);
757 private FlowBuilder createtablemiss(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
758 FlowBuilder flow = new FlowBuilder();
760 MatchBuilder matchBuilder = new MatchBuilder();
761 flow.setMatch(matchBuilder.build());
762 flow.setInstructions(createSentToControllerInstructions().build());
764 flow.setTableId((short) 0);
765 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
771 private short getTableId(String tableId) {
774 table = Short.parseShort(tableId);
775 } catch (Exception ex) {
776 // ignore exception and continue with default value
786 private static InstructionsBuilder createDecNwTtlInstructions() {
787 DecNwTtlBuilder ta = new DecNwTtlBuilder();
788 DecNwTtl decNwTtl = ta.build();
789 ActionBuilder ab = new ActionBuilder();
790 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
791 ab.setKey(new ActionKey(0));
792 // Add our drop action to a list
793 List<Action> actionList = new ArrayList<Action>();
794 actionList.add(ab.build());
796 // Create an Apply Action
797 ApplyActionsBuilder aab = new ApplyActionsBuilder();
798 aab.setAction(actionList);
800 // Wrap our Apply Action in an Instruction
801 InstructionBuilder ib = new InstructionBuilder();
802 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
803 ib.setKey(new InstructionKey(0));
806 // Put our Instruction in a list of Instructions
807 InstructionsBuilder isb = new InstructionsBuilder();
808 List<Instruction> instructions = new ArrayList<Instruction>();
809 instructions.add(ib.build());
810 ib.setKey(new InstructionKey(0));
811 isb.setInstruction(instructions);
818 private static InstructionsBuilder createMeterInstructions() {
820 MeterBuilder aab = new MeterBuilder();
821 aab.setMeterId(new MeterId(new Long(1)));
823 InstructionBuilder ib = new InstructionBuilder();
824 ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
826 // Put our Instruction in a list of Instructions
827 InstructionsBuilder isb = new InstructionsBuilder();
828 List<Instruction> instructions = new ArrayList<Instruction>();
829 ib.setKey(new InstructionKey(0));
830 instructions.add(ib.build());
831 isb.setInstruction(instructions);
835 private static InstructionsBuilder createMetadataInstructions() {
837 WriteMetadataBuilder aab = new WriteMetadataBuilder();
838 aab.setMetadata(new BigInteger("10", 10));
839 aab.setMetadataMask(new BigInteger("12", 10));
841 InstructionBuilder ib = new InstructionBuilder();
842 ib.setInstruction(new WriteMetadataCaseBuilder().setWriteMetadata(aab.build()).build());
844 // Put our Instruction in a list of Instructions
845 InstructionsBuilder isb = new InstructionsBuilder();
846 List<Instruction> instructions = new ArrayList<Instruction>();
847 ib.setKey(new InstructionKey(0));
848 instructions.add(ib.build());
849 isb.setInstruction(instructions);
853 private static InstructionsBuilder createGotoTableInstructions() {
855 GoToTableBuilder aab = new GoToTableBuilder();
856 aab.setTableId((short) 5);
858 InstructionBuilder ib = new InstructionBuilder();
859 ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(aab.build()).build());
861 // Put our Instruction in a list of Instructions
862 InstructionsBuilder isb = new InstructionsBuilder();
863 List<Instruction> instructions = new ArrayList<Instruction>();
864 ib.setKey(new InstructionKey(0));
865 instructions.add(ib.build());
866 isb.setInstruction(instructions);
870 private static InstructionsBuilder createDropInstructions() {
871 DropActionBuilder dab = new DropActionBuilder();
872 DropAction dropAction = dab.build();
873 ActionBuilder ab = new ActionBuilder();
874 ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build());
875 ab.setKey(new ActionKey(0));
876 // Add our drop action to a list
877 List<Action> actionList = new ArrayList<Action>();
878 actionList.add(ab.build());
879 ab.setKey(new ActionKey(0));
880 // Create an Apply Action
881 ApplyActionsBuilder aab = new ApplyActionsBuilder();
882 aab.setAction(actionList);
884 // Wrap our Apply Action in an Instruction
885 InstructionBuilder ib = new InstructionBuilder();
886 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
888 // Put our Instruction in a list of Instructions
889 InstructionsBuilder isb = new InstructionsBuilder();
890 List<Instruction> instructions = new ArrayList<Instruction>();
891 ib.setKey(new InstructionKey(0));
892 instructions.add(ib.build());
893 isb.setInstruction(instructions);
897 private static InstructionsBuilder createAppyActionInstruction() {
899 List<Action> actionList = new ArrayList<Action>();
900 ActionBuilder ab = new ActionBuilder();
901 ControllerActionBuilder controller = new ControllerActionBuilder();
902 controller.setMaxLength(5);
903 ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.build()).build());
904 ab.setKey(new ActionKey(0));
905 actionList.add(ab.build());
906 // Create an Apply Action
907 ApplyActionsBuilder aab = new ApplyActionsBuilder();
908 aab.setAction(actionList);
910 // Wrap our Apply Action in an Instruction
911 InstructionBuilder ib = new InstructionBuilder();
912 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
914 // Put our Instruction in a list of Instructions
915 InstructionsBuilder isb = new InstructionsBuilder();
916 List<Instruction> instructions = new ArrayList<Instruction>();
917 ib.setKey(new InstructionKey(0));
918 instructions.add(ib.build());
919 isb.setInstruction(instructions);
923 private static InstructionsBuilder createAppyActionInstruction1() {
925 List<Action> actionList = new ArrayList<Action>();
926 ActionBuilder ab = new ActionBuilder();
928 OutputActionBuilder output = new OutputActionBuilder();
929 output.setMaxLength(56);
930 Uri value = new Uri("PCEP");
931 output.setOutputNodeConnector(value);
932 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
933 ab.setKey(new ActionKey(0));
934 actionList.add(ab.build());
935 // Create an Apply Action
936 ApplyActionsBuilder aab = new ApplyActionsBuilder();
937 aab.setAction(actionList);
939 // Wrap our Apply Action in an Instruction
940 InstructionBuilder ib = new InstructionBuilder();
941 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
943 // Put our Instruction in a list of Instructions
944 InstructionsBuilder isb = new InstructionsBuilder();
945 List<Instruction> instructions = new ArrayList<Instruction>();
946 ib.setKey(new InstructionKey(0));
947 instructions.add(ib.build());
948 isb.setInstruction(instructions);
952 private static InstructionsBuilder createOutputInstructions() {
954 // test case for Output Port works if the particular port exists
955 // this particular test-case is for Port : 1
956 // tested as (addMDFlow openflow:<dpid> f82)
957 List<Action> actionList = new ArrayList<Action>();
958 ActionBuilder ab = new ActionBuilder();
959 OutputActionBuilder output = new OutputActionBuilder();
961 Uri value = new Uri("1");
962 output.setOutputNodeConnector(value);
963 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
965 ab.setKey(new ActionKey(0));
966 actionList.add(ab.build());
967 // Create an Apply Action
968 ApplyActionsBuilder aab = new ApplyActionsBuilder();
969 aab.setAction(actionList);
971 // Wrap our Apply Action in an Instruction
972 InstructionBuilder ib = new InstructionBuilder();
973 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
975 ib.setKey(new InstructionKey(0));
977 // Put our Instruction in a list of Instructions
978 InstructionsBuilder isb = new InstructionsBuilder();
979 List<Instruction> instructions = new ArrayList<Instruction>();
980 instructions.add(ib.build());
981 isb.setInstruction(instructions);
985 private static InstructionsBuilder createSentToControllerInstructions() {
986 List<Action> actionList = new ArrayList<Action>();
987 ActionBuilder ab = new ActionBuilder();
989 OutputActionBuilder output = new OutputActionBuilder();
990 output.setMaxLength(new Integer(0xffff));
991 Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
992 output.setOutputNodeConnector(value);
993 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
995 ab.setKey(new ActionKey(0));
996 actionList.add(ab.build());
997 // Create an Apply Action
998 ApplyActionsBuilder aab = new ApplyActionsBuilder();
999 aab.setAction(actionList);
1001 // Wrap our Apply Action in an Instruction
1002 InstructionBuilder ib = new InstructionBuilder();
1003 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1005 ib.setKey(new InstructionKey(0));
1007 // Put our Instruction in a list of Instructions
1008 InstructionsBuilder isb = new InstructionsBuilder();
1009 List<Instruction> instructions = new ArrayList<Instruction>();
1010 instructions.add(ib.build());
1011 isb.setInstruction(instructions);
1015 private static InstructionsBuilder createOutputInstructions(String outputType, int outputValue) {
1016 List<Action> actionList = new ArrayList<Action>();
1017 ActionBuilder ab = new ActionBuilder();
1019 OutputActionBuilder output = new OutputActionBuilder();
1020 output.setMaxLength(outputValue);
1021 Uri value = new Uri(outputType);
1022 output.setOutputNodeConnector(value);
1023 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
1025 ab.setKey(new ActionKey(0));
1026 actionList.add(ab.build());
1027 // Create an Apply Action
1028 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1029 aab.setAction(actionList);
1031 // Wrap our Apply Action in an Instruction
1032 InstructionBuilder ib = new InstructionBuilder();
1033 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1035 ib.setKey(new InstructionKey(0));
1037 // Put our Instruction in a list of Instructions
1038 InstructionsBuilder isb = new InstructionsBuilder();
1039 List<Instruction> instructions = new ArrayList<Instruction>();
1040 instructions.add(ib.build());
1041 isb.setInstruction(instructions);
1045 private static InstructionsBuilder createStripVlanInstructions() {
1046 List<Action> actionList = new ArrayList<Action>();
1047 ActionBuilder ab = new ActionBuilder();
1049 StripVlanActionBuilder stripActionBuilder = new StripVlanActionBuilder();
1050 ab.setAction(new StripVlanActionCaseBuilder().setStripVlanAction(stripActionBuilder.build()).build());
1052 ab.setKey(new ActionKey(0));
1053 actionList.add(ab.build());
1054 // Create an Apply Action
1055 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1056 aab.setAction(actionList);
1058 // Wrap our Apply Action in an Instruction
1059 InstructionBuilder ib = new InstructionBuilder();
1060 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1062 ib.setKey(new InstructionKey(0));
1064 // Put our Instruction in a list of Instructions
1065 InstructionsBuilder isb = new InstructionsBuilder();
1066 List<Instruction> instructions = new ArrayList<Instruction>();
1067 instructions.add(ib.build());
1068 isb.setInstruction(instructions);
1072 private static InstructionsBuilder createAppyActionInstruction2() {
1074 List<Action> actionList = new ArrayList<Action>();
1075 ActionBuilder ab = new ActionBuilder();
1077 PushMplsActionBuilder push = new PushMplsActionBuilder();
1078 push.setEthernetType(new Integer(0x8847));
1079 ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
1080 ab.setKey(new ActionKey(0));
1081 actionList.add(ab.build());
1082 // Create an Apply Action
1083 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1084 aab.setAction(actionList);
1086 // Wrap our Apply Action in an Instruction
1087 InstructionBuilder ib = new InstructionBuilder();
1088 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1090 // Put our Instruction in a list of Instructions
1091 InstructionsBuilder isb = new InstructionsBuilder();
1092 List<Instruction> instructions = new ArrayList<Instruction>();
1093 ib.setKey(new InstructionKey(0));
1094 instructions.add(ib.build());
1095 isb.setInstruction(instructions);
1099 private static InstructionsBuilder createAppyActionInstruction3() {
1101 List<Action> actionList = new ArrayList<Action>();
1102 ActionBuilder ab = new ActionBuilder();
1104 PushPbbActionBuilder pbb = new PushPbbActionBuilder();
1105 pbb.setEthernetType(new Integer(0x88E7));
1106 ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
1107 ab.setKey(new ActionKey(0));
1108 actionList.add(ab.build());
1109 // Create an Apply Action
1110 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1111 aab.setAction(actionList);
1113 // Wrap our Apply Action in an Instruction
1114 InstructionBuilder ib = new InstructionBuilder();
1115 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1117 // Put our Instruction in a list of Instructions
1118 InstructionsBuilder isb = new InstructionsBuilder();
1119 List<Instruction> instructions = new ArrayList<Instruction>();
1120 ib.setKey(new InstructionKey(0));
1121 instructions.add(ib.build());
1122 isb.setInstruction(instructions);
1126 private static InstructionsBuilder createAppyActionInstruction4() {
1128 List<Action> actionList = new ArrayList<Action>();
1129 ActionBuilder ab = new ActionBuilder();
1131 PushVlanActionBuilder vlan = new PushVlanActionBuilder();
1132 vlan.setEthernetType(new Integer(0x8100));
1133 ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
1134 ab.setKey(new ActionKey(0));
1135 actionList.add(ab.build());
1137 // Create an Apply Action
1138 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1139 aab.setAction(actionList);
1141 // Wrap our Apply Action in an Instruction
1142 InstructionBuilder ib = new InstructionBuilder();
1143 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1145 // Put our Instruction in a list of Instructions
1146 InstructionsBuilder isb = new InstructionsBuilder();
1147 List<Instruction> instructions = new ArrayList<Instruction>();
1148 ib.setKey(new InstructionKey(0));
1149 instructions.add(ib.build());
1150 isb.setInstruction(instructions);
1154 private static InstructionsBuilder createAppyActionInstruction5() {
1156 List<Action> actionList = new ArrayList<Action>();
1157 ActionBuilder ab = new ActionBuilder();
1159 SetDlDstActionBuilder setdl = new SetDlDstActionBuilder();
1160 setdl.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1161 ab.setAction(new SetDlDstActionCaseBuilder().setSetDlDstAction(setdl.build()).build());
1162 ab.setKey(new ActionKey(0));
1163 actionList.add(ab.build());
1164 // Create an Apply Action
1165 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1166 aab.setAction(actionList);
1168 // Wrap our Apply Action in an Instruction
1169 InstructionBuilder ib = new InstructionBuilder();
1170 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1172 // Put our Instruction in a list of Instructions
1173 InstructionsBuilder isb = new InstructionsBuilder();
1174 List<Instruction> instructions = new ArrayList<Instruction>();
1175 ib.setKey(new InstructionKey(0));
1176 instructions.add(ib.build());
1177 isb.setInstruction(instructions);
1181 private static InstructionsBuilder createAppyActionInstruction6() {
1183 List<Action> actionList = new ArrayList<Action>();
1184 ActionBuilder ab = new ActionBuilder();
1186 SetDlSrcActionBuilder src = new SetDlSrcActionBuilder();
1187 src.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1188 ab.setAction(new SetDlSrcActionCaseBuilder().setSetDlSrcAction(src.build()).build());
1189 ab.setKey(new ActionKey(0));
1190 actionList.add(ab.build());
1192 // Create an Apply Action
1193 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1194 aab.setAction(actionList);
1196 // Wrap our Apply Action in an Instruction
1197 InstructionBuilder ib = new InstructionBuilder();
1198 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1200 // Put our Instruction in a list of Instructions
1201 InstructionsBuilder isb = new InstructionsBuilder();
1202 List<Instruction> instructions = new ArrayList<Instruction>();
1203 ib.setKey(new InstructionKey(0));
1204 instructions.add(ib.build());
1205 isb.setInstruction(instructions);
1209 private static InstructionsBuilder createAppyActionInstruction7() {
1211 List<Action> actionList = new ArrayList<Action>();
1212 ActionBuilder ab = new ActionBuilder();
1214 SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
1215 VlanId a = new VlanId(4000);
1217 ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
1218 ab.setKey(new ActionKey(0));
1219 actionList.add(ab.build());
1220 // Create an Apply Action
1221 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1222 aab.setAction(actionList);
1224 // Wrap our Apply Action in an Instruction
1225 InstructionBuilder ib = new InstructionBuilder();
1226 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1228 // Put our Instruction in a list of Instructions
1229 InstructionsBuilder isb = new InstructionsBuilder();
1230 List<Instruction> instructions = new ArrayList<Instruction>();
1231 ib.setKey(new InstructionKey(0));
1232 instructions.add(ib.build());
1233 isb.setInstruction(instructions);
1237 private static InstructionsBuilder createAppyActionInstruction8() {
1239 List<Action> actionList = new ArrayList<Action>();
1240 ActionBuilder ab = new ActionBuilder();
1242 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1243 VlanPcp pcp1 = new VlanPcp((short) 2);
1244 pcp.setVlanPcp(pcp1);
1245 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1246 ab.setKey(new ActionKey(0));
1247 actionList.add(ab.build());
1248 // Create an Apply Action
1249 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1250 aab.setAction(actionList);
1252 // Wrap our Apply Action in an Instruction
1253 InstructionBuilder ib = new InstructionBuilder();
1254 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1256 // Put our Instruction in a list of Instructions
1257 InstructionsBuilder isb = new InstructionsBuilder();
1258 List<Instruction> instructions = new ArrayList<Instruction>();
1259 ib.setKey(new InstructionKey(0));
1260 instructions.add(ib.build());
1261 isb.setInstruction(instructions);
1265 private static InstructionsBuilder createAppyActionInstruction88() {
1267 List<Action> actionList = new ArrayList<Action>();
1268 ActionBuilder ab = new ActionBuilder();
1270 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1271 // the code point is a 3-bit(0-7) field representing the frame priority level
1272 VlanPcp pcp1 = new VlanPcp((short) 4);
1273 pcp.setVlanPcp(pcp1);
1274 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1275 ab.setKey(new ActionKey(0));
1276 actionList.add(ab.build());
1277 // Create an Apply Action
1278 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1279 aab.setAction(actionList);
1281 // Wrap our Apply Action in an Instruction
1282 InstructionBuilder ib = new InstructionBuilder();
1283 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1285 // Put our Instruction in a list of Instructions
1286 InstructionsBuilder isb = new InstructionsBuilder();
1287 List<Instruction> instructions = new ArrayList<Instruction>();
1288 ib.setKey(new InstructionKey(0));
1289 instructions.add(ib.build());
1290 isb.setInstruction(instructions);
1294 private static InstructionsBuilder createAppyActionInstruction9() {
1296 List<Action> actionList = new ArrayList<Action>();
1297 ActionBuilder ab = new ActionBuilder();
1299 CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
1300 ab.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
1301 ab.setKey(new ActionKey(0));
1302 actionList.add(ab.build());
1303 // Create an Apply Action
1304 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1305 aab.setAction(actionList);
1307 // Wrap our Apply Action in an Instruction
1308 InstructionBuilder ib = new InstructionBuilder();
1309 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1311 // Put our Instruction in a list of Instructions
1312 InstructionsBuilder isb = new InstructionsBuilder();
1313 List<Instruction> instructions = new ArrayList<Instruction>();
1314 ib.setKey(new InstructionKey(0));
1315 instructions.add(ib.build());
1316 isb.setInstruction(instructions);
1320 private static InstructionsBuilder createAppyActionInstruction10() {
1322 List<Action> actionList = new ArrayList<Action>();
1323 ActionBuilder ab = new ActionBuilder();
1325 CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
1326 ab.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
1327 ab.setKey(new ActionKey(0));
1328 actionList.add(ab.build());
1329 // Create an Apply Action
1330 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1331 aab.setAction(actionList);
1333 // Wrap our Apply Action in an Instruction
1334 InstructionBuilder ib = new InstructionBuilder();
1335 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1337 // Put our Instruction in a list of Instructions
1338 InstructionsBuilder isb = new InstructionsBuilder();
1339 List<Instruction> instructions = new ArrayList<Instruction>();
1340 ib.setKey(new InstructionKey(0));
1341 instructions.add(ib.build());
1342 isb.setInstruction(instructions);
1346 private static InstructionsBuilder createAppyActionInstruction11() {
1348 List<Action> actionList = new ArrayList<Action>();
1349 ActionBuilder ab = new ActionBuilder();
1351 DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
1352 ab.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
1353 ab.setKey(new ActionKey(0));
1354 actionList.add(ab.build());
1355 // Create an Apply Action
1356 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1357 aab.setAction(actionList);
1359 // Wrap our Apply Action in an Instruction
1360 InstructionBuilder ib = new InstructionBuilder();
1361 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1362 ib.setKey(new InstructionKey(0));
1365 // Put our Instruction in a list of Instruction
1366 InstructionsBuilder isb = new InstructionsBuilder();
1367 List<Instruction> instructions = new ArrayList<Instruction>();
1368 instructions.add(ib.build());
1369 isb.setInstruction(instructions);
1373 private static InstructionsBuilder createAppyActionInstruction12() {
1375 List<Action> actionList = new ArrayList<Action>();
1376 ActionBuilder ab = new ActionBuilder();
1378 DecNwTtlBuilder nwttl = new DecNwTtlBuilder();
1379 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(nwttl.build()).build());
1380 ab.setKey(new ActionKey(0));
1381 actionList.add(ab.build());
1383 // Create an Apply Action
1384 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1385 aab.setAction(actionList);
1387 // Wrap our Apply Action in an Instruction
1388 InstructionBuilder ib = new InstructionBuilder();
1389 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1391 // Put our Instruction in a list of Instructions
1392 InstructionsBuilder isb = new InstructionsBuilder();
1393 List<Instruction> instructions = new ArrayList<Instruction>();
1394 ib.setKey(new InstructionKey(0));
1395 instructions.add(ib.build());
1396 isb.setInstruction(instructions);
1400 private static InstructionsBuilder createAppyActionInstruction13() {
1402 List<Action> actionList = new ArrayList<Action>();
1403 ActionBuilder ab = new ActionBuilder();
1405 DropActionBuilder drop = new DropActionBuilder();
1406 ab.setAction(new DropActionCaseBuilder().setDropAction(drop.build()).build());
1407 ab.setKey(new ActionKey(0));
1408 actionList.add(ab.build());
1410 // Create an Apply Action
1411 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1412 aab.setAction(actionList);
1414 // Wrap our Apply Action in an Instruction
1415 InstructionBuilder ib = new InstructionBuilder();
1416 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1418 // Put our Instruction in a list of Instructions
1419 InstructionsBuilder isb = new InstructionsBuilder();
1420 List<Instruction> instructions = new ArrayList<Instruction>();
1421 ib.setKey(new InstructionKey(0));
1422 instructions.add(ib.build());
1423 isb.setInstruction(instructions);
1427 private static InstructionsBuilder createAppyActionInstruction14() {
1429 List<Action> actionList = new ArrayList<Action>();
1430 ActionBuilder ab = new ActionBuilder();
1432 FloodActionBuilder fld = new FloodActionBuilder();
1433 ab.setAction(new FloodActionCaseBuilder().setFloodAction(fld.build()).build());
1434 ab.setKey(new ActionKey(0));
1435 actionList.add(ab.build());
1436 // Create an Apply Action
1437 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1438 aab.setAction(actionList);
1440 // Wrap our Apply Action in an Instruction
1441 InstructionBuilder ib = new InstructionBuilder();
1442 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1444 // Put our Instruction in a list of Instructions
1445 InstructionsBuilder isb = new InstructionsBuilder();
1446 List<Instruction> instructions = new ArrayList<Instruction>();
1447 ib.setKey(new InstructionKey(0));
1448 instructions.add(ib.build());
1449 isb.setInstruction(instructions);
1453 private static InstructionsBuilder createAppyActionInstruction15() {
1455 List<Action> actionList = new ArrayList<Action>();
1456 ActionBuilder ab = new ActionBuilder();
1458 FloodAllActionBuilder fldall = new FloodAllActionBuilder();
1459 ab.setAction(new FloodAllActionCaseBuilder().setFloodAllAction(fldall.build()).build());
1460 ab.setKey(new ActionKey(0));
1461 actionList.add(ab.build());
1462 // Create an Apply Action
1463 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1464 aab.setAction(actionList);
1466 // Wrap our Apply Action in an Instruction
1467 InstructionBuilder ib = new InstructionBuilder();
1468 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1470 // Put our Instruction in a list of Instructions
1471 InstructionsBuilder isb = new InstructionsBuilder();
1472 List<Instruction> instructions = new ArrayList<Instruction>();
1473 ib.setKey(new InstructionKey(0));
1474 instructions.add(ib.build());
1475 isb.setInstruction(instructions);
1479 private static InstructionsBuilder createAppyActionInstruction16() {
1481 List<Action> actionList = new ArrayList<Action>();
1482 ActionBuilder ab = new ActionBuilder();
1484 GroupActionBuilder groupActionB = new GroupActionBuilder();
1485 groupActionB.setGroupId(1L);
1486 groupActionB.setGroup("0");
1487 ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
1488 ab.setKey(new ActionKey(0));
1489 actionList.add(ab.build());
1491 // Create an Apply Action
1492 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1493 aab.setAction(actionList);
1495 // Wrap our Apply Action in an Instruction
1496 InstructionBuilder ib = new InstructionBuilder();
1497 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1499 // Put our Instruction in a list of Instructions
1500 InstructionsBuilder isb = new InstructionsBuilder();
1501 List<Instruction> instructions = new ArrayList<Instruction>();
1502 ib.setKey(new InstructionKey(0));
1503 instructions.add(ib.build());
1504 isb.setInstruction(instructions);
1508 private static InstructionsBuilder createAppyActionInstruction17() {
1510 List<Action> actionList = new ArrayList<Action>();
1511 ActionBuilder ab = new ActionBuilder();
1513 HwPathActionBuilder hwPathB = new HwPathActionBuilder();
1514 ab.setAction(new HwPathActionCaseBuilder().setHwPathAction(hwPathB.build()).build());
1515 ab.setKey(new ActionKey(0));
1516 actionList.add(ab.build());
1517 // Create an Apply Action
1518 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1519 aab.setAction(actionList);
1521 // Wrap our Apply Action in an Instruction
1522 InstructionBuilder ib = new InstructionBuilder();
1523 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1525 // Put our Instruction in a list of Instructions
1526 InstructionsBuilder isb = new InstructionsBuilder();
1527 List<Instruction> instructions = new ArrayList<Instruction>();
1528 ib.setKey(new InstructionKey(0));
1529 instructions.add(ib.build());
1530 isb.setInstruction(instructions);
1534 private static InstructionsBuilder createAppyActionInstruction18() {
1536 List<Action> actionList = new ArrayList<Action>();
1537 ActionBuilder ab = new ActionBuilder();
1539 LoopbackActionBuilder loopbackActionBuilder = new LoopbackActionBuilder();
1540 ab.setAction(new LoopbackActionCaseBuilder().setLoopbackAction(loopbackActionBuilder.build()).build());
1541 ab.setKey(new ActionKey(0));
1542 actionList.add(ab.build());
1544 // Create an Apply Action
1545 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1546 aab.setAction(actionList);
1548 // Wrap our Apply Action in an Instruction
1549 InstructionBuilder ib = new InstructionBuilder();
1550 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1552 // Put our Instruction in a list of Instructions
1553 InstructionsBuilder isb = new InstructionsBuilder();
1554 List<Instruction> instructions = new ArrayList<Instruction>();
1555 ib.setKey(new InstructionKey(0));
1556 instructions.add(ib.build());
1557 isb.setInstruction(instructions);
1561 private static InstructionsBuilder createAppyActionInstruction19() {
1563 List<Action> actionList = new ArrayList<Action>();
1564 ActionBuilder ab = new ActionBuilder();
1566 PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
1567 popMplsActionBuilder.setEthernetType(0XB);
1568 ab.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
1569 ab.setKey(new ActionKey(0));
1570 actionList.add(ab.build());
1571 // Create an Apply Action
1572 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1573 aab.setAction(actionList);
1575 // Wrap our Apply Action in an Instruction
1576 InstructionBuilder ib = new InstructionBuilder();
1577 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1579 // Put our Instruction in a list of Instructions
1580 InstructionsBuilder isb = new InstructionsBuilder();
1581 List<Instruction> instructions = new ArrayList<Instruction>();
1582 ib.setKey(new InstructionKey(0));
1583 instructions.add(ib.build());
1584 isb.setInstruction(instructions);
1588 private static InstructionsBuilder createAppyActionInstruction20() {
1590 List<Action> actionList = new ArrayList<Action>();
1591 ActionBuilder ab = new ActionBuilder();
1593 PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
1594 ab.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
1595 ab.setKey(new ActionKey(0));
1596 actionList.add(ab.build());
1597 // Create an Apply Action
1598 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1599 aab.setAction(actionList);
1601 // Wrap our Apply Action in an Instruction
1602 InstructionBuilder ib = new InstructionBuilder();
1603 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1605 // Put our Instruction in a list of Instructions
1606 InstructionsBuilder isb = new InstructionsBuilder();
1607 List<Instruction> instructions = new ArrayList<Instruction>();
1608 ib.setKey(new InstructionKey(0));
1609 instructions.add(ib.build());
1610 isb.setInstruction(instructions);
1614 private static InstructionsBuilder createAppyActionInstruction21() {
1616 List<Action> actionList = new ArrayList<Action>();
1617 ActionBuilder ab = new ActionBuilder();
1619 PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder();
1620 ab.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(popVlanActionBuilder.build()).build());
1621 ab.setKey(new ActionKey(0));
1622 actionList.add(ab.build());
1624 // Create an Apply Action
1625 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1626 aab.setAction(actionList);
1628 // Wrap our Apply Action in an Instruction
1629 InstructionBuilder ib = new InstructionBuilder();
1630 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1632 // Put our Instruction in a list of Instructions
1633 InstructionsBuilder isb = new InstructionsBuilder();
1634 List<Instruction> instructions = new ArrayList<Instruction>();
1635 ib.setKey(new InstructionKey(0));
1636 instructions.add(ib.build());
1637 isb.setInstruction(instructions);
1641 private static InstructionsBuilder createAppyActionInstruction22() {
1643 List<Action> actionList = new ArrayList<Action>();
1644 ActionBuilder ab = new ActionBuilder();
1646 SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
1647 setDlTypeActionBuilder.setDlType(new EtherType(8L));
1648 ab.setAction(new SetDlTypeActionCaseBuilder().setSetDlTypeAction(setDlTypeActionBuilder.build()).build());
1649 ab.setKey(new ActionKey(0));
1650 actionList.add(ab.build());
1652 // Create an Apply Action
1653 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1654 aab.setAction(actionList);
1656 // Wrap our Apply Action in an Instruction
1657 InstructionBuilder ib = new InstructionBuilder();
1658 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1660 // Put our Instruction in a list of Instructions
1661 InstructionsBuilder isb = new InstructionsBuilder();
1662 List<Instruction> instructions = new ArrayList<Instruction>();
1663 ib.setKey(new InstructionKey(0));
1664 instructions.add(ib.build());
1665 isb.setInstruction(instructions);
1669 private static InstructionsBuilder createAppyActionInstruction23(NodeId nodeId) {
1671 List<Action> actionList = new ArrayList<Action>();
1672 ActionBuilder ab = new ActionBuilder();
1674 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1675 setFieldBuilder.setInPort(new NodeConnectorId(nodeId + ":2"));
1676 ab.setKey(new ActionKey(0));
1677 actionList.add(ab.build());
1679 // Create an Apply Action
1680 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1681 aab.setAction(actionList);
1683 // Wrap our Apply Action in an Instruction
1684 InstructionBuilder ib = new InstructionBuilder();
1685 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1687 // Put our Instruction in a list of Instructions
1688 InstructionsBuilder isb = new InstructionsBuilder();
1689 List<Instruction> instructions = new ArrayList<Instruction>();
1690 ib.setKey(new InstructionKey(0));
1691 instructions.add(ib.build());
1692 isb.setInstruction(instructions);
1696 private static InstructionsBuilder createAppyActionInstruction24() {
1698 List<Action> actionList = new ArrayList<Action>();
1699 ActionBuilder ab = new ActionBuilder();
1701 SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
1702 setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
1703 ab.setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(setMplsTtlActionBuilder.build()).build());
1704 ab.setKey(new ActionKey(0));
1705 actionList.add(ab.build());
1707 // Create an Apply Action
1708 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1709 aab.setAction(actionList);
1711 // Wrap our Apply Action in an Instruction
1712 InstructionBuilder ib = new InstructionBuilder();
1713 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1715 // Put our Instruction in a list of Instructions
1716 InstructionsBuilder isb = new InstructionsBuilder();
1717 List<Instruction> instructions = new ArrayList<Instruction>();
1718 ib.setKey(new InstructionKey(0));
1719 instructions.add(ib.build());
1720 isb.setInstruction(instructions);
1724 private static InstructionsBuilder createAppyActionInstruction25() {
1726 List<Action> actionList = new ArrayList<Action>();
1727 ActionBuilder ab = new ActionBuilder();
1729 SetNextHopActionBuilder setNextHopActionBuilder = new SetNextHopActionBuilder();
1730 Ipv4Builder ipnext = new Ipv4Builder();
1731 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
1732 ipnext.setIpv4Address(prefix);
1733 setNextHopActionBuilder.setAddress(ipnext.build());
1734 ab.setAction(new SetNextHopActionCaseBuilder().setSetNextHopAction(setNextHopActionBuilder.build()).build());
1735 ab.setKey(new ActionKey(0));
1736 actionList.add(ab.build());
1738 // Create an Apply Action
1739 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1740 aab.setAction(actionList);
1742 // Wrap our Apply Action in an Instruction
1743 InstructionBuilder ib = new InstructionBuilder();
1744 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1746 // Put our Instruction in a list of Instructions
1747 InstructionsBuilder isb = new InstructionsBuilder();
1748 List<Instruction> instructions = new ArrayList<Instruction>();
1749 ib.setKey(new InstructionKey(0));
1750 instructions.add(ib.build());
1751 isb.setInstruction(instructions);
1755 private static InstructionsBuilder createAppyActionInstruction26() {
1757 List<Action> actionList = new ArrayList<Action>();
1758 ActionBuilder ab = new ActionBuilder();
1760 SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
1761 Ipv4Builder ipdst = new Ipv4Builder();
1762 Ipv4Prefix prefixdst = new Ipv4Prefix("10.0.0.21/24");
1763 ipdst.setIpv4Address(prefixdst);
1764 setNwDstActionBuilder.setAddress(ipdst.build());
1765 ab.setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build());
1766 ab.setKey(new ActionKey(0));
1767 actionList.add(ab.build());
1769 // Create an Apply Action
1770 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1771 aab.setAction(actionList);
1773 // Wrap our Apply Action in an Instruction
1774 InstructionBuilder ib = new InstructionBuilder();
1775 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1777 // Put our Instruction in a list of Instructions
1778 InstructionsBuilder isb = new InstructionsBuilder();
1779 List<Instruction> instructions = new ArrayList<Instruction>();
1780 ib.setKey(new InstructionKey(0));
1781 instructions.add(ib.build());
1782 isb.setInstruction(instructions);
1786 private static InstructionsBuilder createAppyActionInstruction27() {
1788 List<Action> actionList = new ArrayList<Action>();
1789 ActionBuilder ab = new ActionBuilder();
1791 SetNwSrcActionBuilder setNwsrcActionBuilder = new SetNwSrcActionBuilder();
1792 Ipv4Builder ipsrc = new Ipv4Builder();
1793 Ipv4Prefix prefixsrc = new Ipv4Prefix("10.0.23.21/24");
1794 ipsrc.setIpv4Address(prefixsrc);
1795 setNwsrcActionBuilder.setAddress(ipsrc.build());
1796 ab.setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwsrcActionBuilder.build()).build());
1797 ab.setKey(new ActionKey(0));
1798 actionList.add(ab.build());
1800 // Create an Apply Action
1801 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1802 aab.setAction(actionList);
1804 // Wrap our Apply Action in an Instruction
1805 InstructionBuilder ib = new InstructionBuilder();
1806 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1808 // Put our Instruction in a list of Instructions
1809 InstructionsBuilder isb = new InstructionsBuilder();
1810 List<Instruction> instructions = new ArrayList<Instruction>();
1811 ib.setKey(new InstructionKey(0));
1812 instructions.add(ib.build());
1813 isb.setInstruction(instructions);
1817 private static InstructionsBuilder createAppyActionInstruction28() {
1819 List<Action> actionList = new ArrayList<Action>();
1820 ActionBuilder ab = new ActionBuilder();
1822 SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
1823 setNwTosActionBuilder.setTos(8);
1824 ab.setAction(new SetNwTosActionCaseBuilder().setSetNwTosAction(setNwTosActionBuilder.build()).build());
1825 ab.setKey(new ActionKey(0));
1826 actionList.add(ab.build());
1827 // Create an Apply Action
1828 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1829 aab.setAction(actionList);
1831 // Wrap our Apply Action in an Instruction
1832 InstructionBuilder ib = new InstructionBuilder();
1833 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1835 // Put our Instruction in a list of Instructions
1836 InstructionsBuilder isb = new InstructionsBuilder();
1837 List<Instruction> instructions = new ArrayList<Instruction>();
1838 ib.setKey(new InstructionKey(0));
1839 instructions.add(ib.build());
1840 isb.setInstruction(instructions);
1844 private static InstructionsBuilder createAppyActionInstruction29() {
1846 List<Action> actionList = new ArrayList<Action>();
1847 ActionBuilder ab = new ActionBuilder();
1849 SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
1850 setNwTtlActionBuilder.setNwTtl((short) 1);
1851 ab.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
1852 ab.setKey(new ActionKey(0));
1853 actionList.add(ab.build());
1855 // Create an Apply Action
1856 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1857 aab.setAction(actionList);
1859 // Wrap our Apply Action in an Instruction
1860 InstructionBuilder ib = new InstructionBuilder();
1861 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1863 // Put our Instruction in a list of Instructions
1864 InstructionsBuilder isb = new InstructionsBuilder();
1865 List<Instruction> instructions = new ArrayList<Instruction>();
1866 ib.setKey(new InstructionKey(0));
1867 instructions.add(ib.build());
1868 isb.setInstruction(instructions);
1872 private static InstructionsBuilder createAppyActionInstruction30() {
1874 List<Action> actionList = new ArrayList<Action>();
1875 ActionBuilder ab = new ActionBuilder();
1877 SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
1878 setQueueActionBuilder.setQueueId(1L);
1879 ab.setAction(new SetQueueActionCaseBuilder().setSetQueueAction(setQueueActionBuilder.build()).build());
1880 ab.setKey(new ActionKey(0));
1881 actionList.add(ab.build());
1882 // Create an Apply Action
1883 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1884 aab.setAction(actionList);
1886 // Wrap our Apply Action in an Instruction
1887 InstructionBuilder ib = new InstructionBuilder();
1888 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1890 // Put our Instruction in a list of Instructions
1891 InstructionsBuilder isb = new InstructionsBuilder();
1892 List<Instruction> instructions = new ArrayList<Instruction>();
1893 ib.setKey(new InstructionKey(0));
1894 instructions.add(ib.build());
1895 isb.setInstruction(instructions);
1899 private static InstructionsBuilder createAppyActionInstruction31() {
1901 List<Action> actionList = new ArrayList<Action>();
1902 ActionBuilder ab = new ActionBuilder();
1904 SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
1905 setTpDstActionBuilder.setPort(new PortNumber(109));
1907 ab.setAction(new SetTpDstActionCaseBuilder().setSetTpDstAction(setTpDstActionBuilder.build()).build());
1908 ab.setKey(new ActionKey(0));
1909 actionList.add(ab.build());
1910 // Create an Apply Action
1911 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1912 aab.setAction(actionList);
1914 // Wrap our Apply Action in an Instruction
1915 InstructionBuilder ib = new InstructionBuilder();
1916 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1918 // Put our Instruction in a list of Instructions
1919 InstructionsBuilder isb = new InstructionsBuilder();
1920 List<Instruction> instructions = new ArrayList<Instruction>();
1921 ib.setKey(new InstructionKey(0));
1922 instructions.add(ib.build());
1923 isb.setInstruction(instructions);
1927 private static InstructionsBuilder createAppyActionInstruction32() {
1929 List<Action> actionList = new ArrayList<Action>();
1930 ActionBuilder ab = new ActionBuilder();
1932 SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
1933 setTpSrcActionBuilder.setPort(new PortNumber(109));
1934 ab.setAction(new SetTpSrcActionCaseBuilder().setSetTpSrcAction(setTpSrcActionBuilder.build()).build());
1935 ab.setKey(new ActionKey(0));
1936 actionList.add(ab.build());
1938 // Create an Apply Action
1939 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1940 aab.setAction(actionList);
1942 // Wrap our Apply Action in an Instruction
1943 InstructionBuilder ib = new InstructionBuilder();
1944 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1946 // Put our Instruction in a list of Instructions
1947 InstructionsBuilder isb = new InstructionsBuilder();
1948 List<Instruction> instructions = new ArrayList<Instruction>();
1949 ib.setKey(new InstructionKey(0));
1950 instructions.add(ib.build());
1951 isb.setInstruction(instructions);
1955 private static InstructionsBuilder createAppyActionInstruction33() {
1957 List<Action> actionList = new ArrayList<Action>();
1958 ActionBuilder ab = new ActionBuilder();
1960 SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
1961 setVlanCfiActionBuilder.setVlanCfi(new VlanCfi(2));
1962 ab.setAction(new SetVlanCfiActionCaseBuilder().setSetVlanCfiAction(setVlanCfiActionBuilder.build()).build());
1963 ab.setKey(new ActionKey(0));
1964 actionList.add(ab.build());
1966 // Create an Apply Action
1967 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1968 aab.setAction(actionList);
1970 // Wrap our Apply Action in an Instruction
1971 InstructionBuilder ib = new InstructionBuilder();
1972 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1974 // Put our Instruction in a list of Instructions
1975 InstructionsBuilder isb = new InstructionsBuilder();
1976 List<Instruction> instructions = new ArrayList<Instruction>();
1977 ib.setKey(new InstructionKey(0));
1978 instructions.add(ib.build());
1979 isb.setInstruction(instructions);
1983 private static InstructionsBuilder createAppyActionInstruction34() {
1985 List<Action> actionList = new ArrayList<Action>();
1986 ActionBuilder ab = new ActionBuilder();
1988 SwPathActionBuilder swPathAction = new SwPathActionBuilder();
1989 ab.setAction(new SwPathActionCaseBuilder().setSwPathAction(swPathAction.build()).build());
1990 ab.setKey(new ActionKey(0));
1991 actionList.add(ab.build());
1993 // Create an Apply Action
1994 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1995 aab.setAction(actionList);
1997 // Wrap our Apply Action in an Instruction
1998 InstructionBuilder ib = new InstructionBuilder();
1999 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2001 // Put our Instruction in a list of Instructions
2002 InstructionsBuilder isb = new InstructionsBuilder();
2003 List<Instruction> instructions = new ArrayList<Instruction>();
2004 ib.setKey(new InstructionKey(0));
2005 instructions.add(ib.build());
2006 isb.setInstruction(instructions);
2010 private static InstructionsBuilder createAppyActionInstruction35() {
2012 List<Action> actionList = new ArrayList<Action>();
2013 ActionBuilder ab = new ActionBuilder();
2014 ActionBuilder ab1 = new ActionBuilder();
2015 ActionBuilder ab2 = new ActionBuilder();
2017 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2018 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2019 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2022 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
2023 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
2024 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
2025 EthernetMatchBuilder ethernetMatch1 = new EthernetMatchBuilder();
2026 EthernetDestinationBuilder ethDestBuilder = new EthernetDestinationBuilder();
2027 ethDestBuilder.setAddress(new MacAddress("00:00:00:00:00:02"));
2028 EthernetMatchBuilder ethernetMatch2 = new EthernetMatchBuilder();
2029 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2030 ethTypeBuilder.setType(new EtherType(0x86ddL));
2032 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
2033 ethernetMatch1.setEthernetDestination(ethDestBuilder.build());
2034 ethernetMatch2.setEthernetType(ethTypeBuilder.build());
2035 setFieldBuilder.setEthernetMatch(ethernetMatch.build());
2036 setFieldBuilder1.setEthernetMatch(ethernetMatch1.build());
2037 setFieldBuilder2.setEthernetMatch(ethernetMatch2.build());
2038 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2039 ab.setKey(new ActionKey(0));
2040 actionList.add(ab.build());
2042 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2043 ab1.setKey(new ActionKey(1));
2044 actionList.add(ab1.build());
2046 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2047 ab2.setKey(new ActionKey(2));
2048 actionList.add(ab2.build());
2050 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2051 aab.setAction(actionList);
2053 InstructionBuilder ib = new InstructionBuilder();
2054 ib.setKey(new InstructionKey(0));
2055 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2057 // Put our Instruction in a list of Instructions
2058 InstructionsBuilder isb = new InstructionsBuilder();
2059 List<Instruction> instructions = new ArrayList<Instruction>();
2060 ib.setKey(new InstructionKey(0));
2061 instructions.add(ib.build());
2062 isb.setInstruction(instructions);
2066 private static InstructionsBuilder createAppyActionInstruction36() {
2068 List<Action> actionList = new ArrayList<Action>();
2069 ActionBuilder ab = new ActionBuilder();
2070 ActionBuilder ab1 = new ActionBuilder();
2072 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2073 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2076 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
2077 VlanMatchBuilder vlanBuilder1 = new VlanMatchBuilder();
2078 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
2079 VlanId vlanId = new VlanId(10);
2080 VlanPcp vpcp = new VlanPcp((short) 3);
2081 vlanBuilder.setVlanPcp(vpcp);
2082 vlanBuilder1.setVlanId(vlanIdBuilder.setVlanId(vlanId).setVlanIdPresent(true).build());
2083 setFieldBuilder.setVlanMatch(vlanBuilder.build());
2084 setFieldBuilder1.setVlanMatch(vlanBuilder1.build());
2085 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2086 ab.setKey(new ActionKey(0));
2087 actionList.add(ab.build());
2088 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2089 ab1.setKey(new ActionKey(1));
2090 actionList.add(ab1.build());
2092 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2093 aab.setAction(actionList);
2095 InstructionBuilder ib = new InstructionBuilder();
2096 ib.setKey(new InstructionKey(0));
2097 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2099 // Put our Instruction in a list of Instructions
2100 InstructionsBuilder isb = new InstructionsBuilder();
2101 List<Instruction> instructions = new ArrayList<Instruction>();
2102 instructions.add(ib.build());
2103 isb.setInstruction(instructions);
2107 private static InstructionsBuilder createAppyActionInstruction37() {
2109 List<Action> actionList = new ArrayList<Action>();
2110 ActionBuilder ab = new ActionBuilder();
2111 ActionBuilder ab1 = new ActionBuilder();
2112 ActionBuilder ab2 = new ActionBuilder();
2114 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2115 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2116 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2118 IpMatchBuilder ipmatch = new IpMatchBuilder();
2119 IpMatchBuilder ipmatch1 = new IpMatchBuilder();
2120 IpMatchBuilder ipmatch2 = new IpMatchBuilder();
2121 Dscp dscp = new Dscp((short) 3);
2122 ipmatch.setIpDscp(dscp);
2123 ipmatch1.setIpEcn((short) 2);
2124 ipmatch2.setIpProtocol((short) 120);
2125 setFieldBuilder.setIpMatch(ipmatch.build());
2126 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2127 ab.setKey(new ActionKey(0));
2128 actionList.add(ab.build());
2130 setFieldBuilder1.setIpMatch(ipmatch1.build());
2131 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2132 ab1.setKey(new ActionKey(1));
2133 actionList.add(ab1.build());
2135 setFieldBuilder2.setIpMatch(ipmatch2.build());
2136 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2137 ab2.setKey(new ActionKey(2));
2138 actionList.add(ab2.build());
2140 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2141 aab.setAction(actionList);
2143 InstructionBuilder ib = new InstructionBuilder();
2144 ib.setKey(new InstructionKey(0));
2145 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2147 // Put our Instruction in a list of Instructions
2148 InstructionsBuilder isb = new InstructionsBuilder();
2149 List<Instruction> instructions = new ArrayList<Instruction>();
2150 instructions.add(ib.build());
2151 isb.setInstruction(instructions);
2155 private static InstructionsBuilder createAppyActionInstruction38() {
2157 List<Action> actionList = new ArrayList<Action>();
2158 ActionBuilder ab = new ActionBuilder();
2159 ActionBuilder ab1 = new ActionBuilder();
2161 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2162 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2164 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2165 Ipv4MatchBuilder ipv4Match1 = new Ipv4MatchBuilder();
2166 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.5210");
2167 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1");
2168 ipv4Match1.setIpv4Destination(dstip);
2169 ipv4Match.setIpv4Source(srcip);
2170 setFieldBuilder.setLayer3Match(ipv4Match.build());
2171 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2172 ab.setKey(new ActionKey(0));
2173 actionList.add(ab.build());
2175 setFieldBuilder1.setLayer3Match(ipv4Match1.build());
2176 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2177 ab1.setKey(new ActionKey(1));
2178 actionList.add(ab1.build());
2180 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2181 aab.setAction(actionList);
2183 InstructionBuilder ib = new InstructionBuilder();
2184 ib.setKey(new InstructionKey(0));
2185 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2187 // Put our Instruction in a list of Instructions
2188 InstructionsBuilder isb = new InstructionsBuilder();
2189 List<Instruction> instructions = new ArrayList<Instruction>();
2190 instructions.add(ib.build());
2191 isb.setInstruction(instructions);
2195 private static InstructionsBuilder createAppyActionInstruction39() {
2197 List<Action> actionList = new ArrayList<Action>();
2198 ActionBuilder ab = new ActionBuilder();
2199 ActionBuilder ab1 = new ActionBuilder();
2201 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2202 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2205 PortNumber tcpsrcport = new PortNumber(1213);
2206 PortNumber tcpdstport = new PortNumber(646);
2207 TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
2208 TcpMatchBuilder tcpmatch1 = new TcpMatchBuilder();
2209 tcpmatch.setTcpSourcePort(tcpsrcport);
2210 tcpmatch1.setTcpDestinationPort(tcpdstport);
2211 setFieldBuilder.setLayer4Match(tcpmatch.build());
2212 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2213 ab.setKey(new ActionKey(0));
2214 actionList.add(ab.build());
2216 setFieldBuilder1.setLayer4Match(tcpmatch1.build());
2217 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2218 ab1.setKey(new ActionKey(1));
2219 actionList.add(ab.build());
2221 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2222 aab.setAction(actionList);
2224 InstructionBuilder ib = new InstructionBuilder();
2225 ib.setKey(new InstructionKey(0));
2226 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2228 // Put our Instruction in a list of Instructions
2229 InstructionsBuilder isb = new InstructionsBuilder();
2230 List<Instruction> instructions = new ArrayList<Instruction>();
2231 instructions.add(ib.build());
2232 isb.setInstruction(instructions);
2236 private static InstructionsBuilder createAppyActionInstruction40() {
2238 List<Action> actionList = new ArrayList<Action>();
2239 ActionBuilder ab = new ActionBuilder();
2240 ActionBuilder ab1 = new ActionBuilder();
2242 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2243 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2246 PortNumber udpsrcport = new PortNumber(1325);
2247 PortNumber udpdstport = new PortNumber(42);
2248 UdpMatchBuilder udpmatch = new UdpMatchBuilder();
2249 UdpMatchBuilder udpmatch1 = new UdpMatchBuilder();
2250 udpmatch.setUdpDestinationPort(udpdstport);
2251 udpmatch1.setUdpSourcePort(udpsrcport);
2252 setFieldBuilder.setLayer4Match(udpmatch.build());
2253 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2254 ab.setKey(new ActionKey(0));
2255 actionList.add(ab.build());
2257 setFieldBuilder1.setLayer4Match(udpmatch1.build());
2258 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2259 ab1.setKey(new ActionKey(1));
2260 actionList.add(ab1.build());
2262 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2263 aab.setAction(actionList);
2265 InstructionBuilder ib = new InstructionBuilder();
2266 ib.setKey(new InstructionKey(0));
2267 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2269 // Put our Instruction in a list of Instructions
2270 InstructionsBuilder isb = new InstructionsBuilder();
2271 List<Instruction> instructions = new ArrayList<Instruction>();
2272 instructions.add(ib.build());
2273 isb.setInstruction(instructions);
2277 private static InstructionsBuilder createAppyActionInstruction41() {
2279 List<Action> actionList = new ArrayList<Action>();
2280 ActionBuilder ab = new ActionBuilder();
2281 ActionBuilder ab1 = new ActionBuilder();
2283 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2284 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2287 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
2288 SctpMatchBuilder sctpmatch1 = new SctpMatchBuilder();
2289 PortNumber srcport = new PortNumber(1435);
2290 PortNumber dstport = new PortNumber(22);
2291 sctpmatch.setSctpSourcePort(srcport);
2292 sctpmatch1.setSctpDestinationPort(dstport);
2293 setFieldBuilder.setLayer4Match(sctpmatch.build());
2294 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2295 ab.setKey(new ActionKey(0));
2296 actionList.add(ab.build());
2298 setFieldBuilder1.setLayer4Match(sctpmatch1.build());
2299 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2300 ab1.setKey(new ActionKey(1));
2301 actionList.add(ab1.build());
2303 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2304 aab.setAction(actionList);
2306 InstructionBuilder ib = new InstructionBuilder();
2307 ib.setKey(new InstructionKey(0));
2308 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2310 // Put our Instruction in a list of Instructions
2311 InstructionsBuilder isb = new InstructionsBuilder();
2312 List<Instruction> instructions = new ArrayList<Instruction>();
2313 instructions.add(ib.build());
2314 isb.setInstruction(instructions);
2318 private static InstructionsBuilder createAppyActionInstruction42() {
2320 List<Action> actionList = new ArrayList<Action>();
2321 ActionBuilder ab = new ActionBuilder();
2322 ActionBuilder ab1 = new ActionBuilder();
2323 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2324 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2327 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
2328 Icmpv4MatchBuilder icmpv4match1 = new Icmpv4MatchBuilder();
2329 icmpv4match.setIcmpv4Type((short) 8);
2330 icmpv4match1.setIcmpv4Code((short) 0);
2331 setFieldBuilder.setIcmpv4Match(icmpv4match.build());
2332 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2333 ab.setKey(new ActionKey(0));
2334 actionList.add(ab.build());
2336 setFieldBuilder1.setIcmpv4Match(icmpv4match1.build());
2337 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2338 ab1.setKey(new ActionKey(1));
2339 actionList.add(ab1.build());
2341 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2342 aab.setAction(actionList);
2344 InstructionBuilder ib = new InstructionBuilder();
2345 ib.setKey(new InstructionKey(0));
2346 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2348 // Put our Instruction in a list of Instructions
2349 InstructionsBuilder isb = new InstructionsBuilder();
2350 List<Instruction> instructions = new ArrayList<Instruction>();
2351 instructions.add(ib.build());
2352 isb.setInstruction(instructions);
2356 private static InstructionsBuilder createAppyActionInstruction43() {
2358 List<Action> actionList = new ArrayList<Action>();
2359 ActionBuilder ab = new ActionBuilder();
2360 ActionBuilder ab1 = new ActionBuilder();
2361 ActionBuilder ab2 = new ActionBuilder();
2362 ActionBuilder ab3 = new ActionBuilder();
2363 ActionBuilder ab4 = new ActionBuilder();
2365 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2366 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2367 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2368 SetFieldBuilder setFieldBuilder3 = new SetFieldBuilder();
2369 SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder();
2371 // setting the values of ARP
2372 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2373 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2374 Ipv4Prefix dstiparp = new Ipv4Prefix("200.71.9.52");
2375 Ipv4Prefix srciparp = new Ipv4Prefix("100.1.1.1");
2376 // create ARP match action
2377 ArpMatchBuilder arpmatch = new ArpMatchBuilder();
2378 ArpMatchBuilder arpmatch1 = new ArpMatchBuilder();
2379 ArpMatchBuilder arpmatch2 = new ArpMatchBuilder();
2380 ArpMatchBuilder arpmatch3 = new ArpMatchBuilder();
2381 ArpMatchBuilder arpmatch4 = new ArpMatchBuilder();
2382 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2383 arpsrc.setAddress(macsrc);
2384 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2385 arpdst.setAddress(macdest);
2386 arpmatch.setArpOp(2);
2387 arpmatch1.setArpSourceHardwareAddress(arpsrc.build());
2388 arpmatch2.setArpTargetHardwareAddress(arpdst.build());
2389 arpmatch3.setArpSourceTransportAddress(srciparp);
2390 arpmatch4.setArpTargetTransportAddress(dstiparp);
2391 setFieldBuilder.setLayer3Match(arpmatch.build());
2392 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2393 ab.setKey(new ActionKey(0));
2394 actionList.add(ab.build());
2396 setFieldBuilder1.setLayer3Match(arpmatch1.build());
2397 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2398 ab1.setKey(new ActionKey(1));
2399 actionList.add(ab1.build());
2401 setFieldBuilder2.setLayer3Match(arpmatch2.build());
2402 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2403 ab2.setKey(new ActionKey(2));
2404 actionList.add(ab2.build());
2406 setFieldBuilder3.setLayer3Match(arpmatch3.build());
2407 ab3.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2408 ab3.setKey(new ActionKey(3));
2409 actionList.add(ab3.build());
2411 setFieldBuilder4.setLayer3Match(arpmatch4.build());
2412 ab4.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2413 ab4.setKey(new ActionKey(4));
2414 actionList.add(ab4.build());
2416 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2417 aab.setAction(actionList);
2419 InstructionBuilder ib = new InstructionBuilder();
2420 ib.setKey(new InstructionKey(0));
2421 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2423 // Put our Instruction in a list of Instructions
2424 InstructionsBuilder isb = new InstructionsBuilder();
2425 List<Instruction> instructions = new ArrayList<Instruction>();
2426 instructions.add(ib.build());
2427 isb.setInstruction(instructions);
2431 private static InstructionsBuilder createAppyActionInstruction44() {
2433 List<Action> actionLists = new ArrayList<Action>();
2434 ActionBuilder ab = new ActionBuilder();
2435 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2436 ActionBuilder ab1 = new ActionBuilder();
2437 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2439 * ActionBuilder ab2 = new ActionBuilder(); SetFieldBuilder
2440 * setFieldBuilder2 = new SetFieldBuilder(); ActionBuilder ab3 = new
2441 * ActionBuilder(); SetFieldBuilder setFieldBuilder3 = new
2442 * SetFieldBuilder(); ActionBuilder ab4 = new ActionBuilder();
2443 * SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder();
2445 ActionBuilder ab5 = new ActionBuilder();
2446 SetFieldBuilder setFieldBuilder5 = new SetFieldBuilder();
2447 ActionBuilder ab6 = new ActionBuilder();
2448 SetFieldBuilder setFieldBuilder6 = new SetFieldBuilder();
2451 Ipv6MatchBuilder ipv6Builder = new Ipv6MatchBuilder();
2452 Ipv6MatchBuilder ipv6Builder1 = new Ipv6MatchBuilder();
2453 // Ipv6MatchBuilder ipv6Builder2 = new Ipv6MatchBuilder();
2454 // Ipv6MatchBuilder ipv6Builder3 = new Ipv6MatchBuilder();
2455 // Ipv6MatchBuilder ipv6Builder4 = new Ipv6MatchBuilder();
2456 Ipv6MatchBuilder ipv6Builder5 = new Ipv6MatchBuilder();
2457 Ipv6MatchBuilder ipv6Builder6 = new Ipv6MatchBuilder();
2459 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2");
2460 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1");
2461 // Ipv6Address ndtarget = new
2462 // Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
2463 // MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
2464 // MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
2465 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2466 nextheader.setIpv6Exthdr(58);
2467 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2468 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2469 ipv6label.setIpv6Flabel(label);
2471 ipv6Builder.setIpv6Source(srcip6);
2472 ipv6Builder1.setIpv6Destination(dstip6);
2473 // ipv6Builder2.setIpv6NdTarget(ndtarget);
2474 // ipv6Builder3.setIpv6NdSll(ndsll);
2475 // ipv6Builder4.setIpv6NdTll(ndtll);
2476 ipv6Builder5.setIpv6ExtHeader(nextheader.build());
2477 ipv6Builder6.setIpv6Label(ipv6label.build());
2479 setFieldBuilder.setLayer3Match(ipv6Builder.build());
2480 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2481 ab.setKey(new ActionKey(0));
2482 actionLists.add(ab.build());
2484 setFieldBuilder1.setLayer3Match(ipv6Builder1.build());
2485 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2486 ab1.setKey(new ActionKey(1));
2487 actionLists.add(ab1.build());
2490 * setFieldBuilder2.setLayer3Match(ipv6Builder2.build());
2492 * SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2493 * ab2.setKey(new ActionKey(2)); actionLists.add(ab2.build());
2495 * setFieldBuilder3.setLayer3Match(ipv6Builder3.build());
2497 * SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2498 * ab3.setKey(new ActionKey(3)); actionLists.add(ab3.build());
2500 * setFieldBuilder4.setLayer3Match(ipv6Builder4.build());
2502 * SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2503 * ab4.setKey(new ActionKey(4)); actionLists.add(ab4.build());
2505 setFieldBuilder5.setLayer3Match(ipv6Builder5.build());
2506 ab5.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder5.build()).build());
2507 ab5.setKey(new ActionKey(5));
2508 actionLists.add(ab5.build());
2510 setFieldBuilder6.setLayer3Match(ipv6Builder6.build());
2511 ab6.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder6.build()).build());
2512 ab6.setKey(new ActionKey(6));
2513 actionLists.add(ab6.build());
2515 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2516 aab.setAction(actionLists);
2518 InstructionBuilder ib = new InstructionBuilder();
2519 ib.setKey(new InstructionKey(0));
2520 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2522 // Put our Instruction in a list of Instructions
2523 InstructionsBuilder isb = new InstructionsBuilder();
2524 List<Instruction> instructions = new ArrayList<Instruction>();
2525 instructions.add(ib.build());
2526 isb.setInstruction(instructions);
2530 private static InstructionsBuilder createAppyActionInstruction45() {
2532 List<Action> actionList = new ArrayList<Action>();
2533 ActionBuilder ab = new ActionBuilder();
2534 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2535 ActionBuilder ab1 = new ActionBuilder();
2536 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2539 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
2540 Icmpv6MatchBuilder icmpv6match1 = new Icmpv6MatchBuilder();
2541 icmpv6match.setIcmpv6Type((short) 135);
2542 icmpv6match1.setIcmpv6Code((short) 0);
2543 setFieldBuilder.setIcmpv6Match(icmpv6match.build());
2544 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2545 ab.setKey(new ActionKey(0));
2546 actionList.add(ab.build());
2548 setFieldBuilder1.setIcmpv6Match(icmpv6match1.build());
2549 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2550 ab1.setKey(new ActionKey(1));
2551 actionList.add(ab1.build());
2553 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2554 aab.setAction(actionList);
2556 InstructionBuilder ib = new InstructionBuilder();
2557 ib.setKey(new InstructionKey(0));
2558 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2560 // Put our Instruction in a list of Instructions
2561 InstructionsBuilder isb = new InstructionsBuilder();
2562 List<Instruction> instructions = new ArrayList<Instruction>();
2563 instructions.add(ib.build());
2564 isb.setInstruction(instructions);
2568 private static InstructionsBuilder createAppyActionInstruction46() {
2570 List<Action> actionList = new ArrayList<Action>();
2571 ActionBuilder ab = new ActionBuilder();
2572 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2573 ActionBuilder ab1 = new ActionBuilder();
2574 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2575 ActionBuilder ab2 = new ActionBuilder();
2576 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2579 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2580 ProtocolMatchFieldsBuilder protomatch1 = new ProtocolMatchFieldsBuilder();
2581 ProtocolMatchFieldsBuilder protomatch2 = new ProtocolMatchFieldsBuilder();
2582 protomatch.setMplsLabel((long) 36008);
2583 protomatch1.setMplsTc((short) 4);
2584 protomatch2.setMplsBos((short) 1);
2585 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2586 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2587 ab.setKey(new ActionKey(0));
2588 actionList.add(ab.build());
2590 setFieldBuilder1.setProtocolMatchFields(protomatch1.build());
2591 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2592 ab1.setKey(new ActionKey(1));
2593 actionList.add(ab1.build());
2595 setFieldBuilder2.setProtocolMatchFields(protomatch2.build());
2596 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2597 ab2.setKey(new ActionKey(2));
2598 actionList.add(ab2.build());
2600 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2601 aab.setAction(actionList);
2603 InstructionBuilder ib = new InstructionBuilder();
2604 ib.setKey(new InstructionKey(0));
2605 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2607 // Put our Instruction in a list of Instructions
2608 InstructionsBuilder isb = new InstructionsBuilder();
2609 List<Instruction> instructions = new ArrayList<Instruction>();
2610 instructions.add(ib.build());
2611 isb.setInstruction(instructions);
2615 private static InstructionsBuilder createAppyActionInstruction47() {
2617 List<Action> actionList = new ArrayList<Action>();
2618 ActionBuilder ab = new ActionBuilder();
2619 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2621 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2622 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask((new BigInteger(new byte[] { 0, 1, 0, 0 }).longValue())).build());
2623 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2624 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2625 actionList.add(ab.build());
2627 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2628 aab.setAction(actionList);
2630 InstructionBuilder ib = new InstructionBuilder();
2631 ib.setKey(new InstructionKey(0));
2632 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2634 // Put our Instruction in a list of Instructions
2635 InstructionsBuilder isb = new InstructionsBuilder();
2636 List<Instruction> instructions = new ArrayList<Instruction>();
2637 instructions.add(ib.build());
2638 isb.setInstruction(instructions);
2642 private static InstructionsBuilder createAppyActionInstruction48() {
2644 List<Action> actionList = new ArrayList<Action>();
2645 ActionBuilder ab = new ActionBuilder();
2646 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2648 TunnelBuilder tunnel = new TunnelBuilder();
2649 tunnel.setTunnelId(BigInteger.valueOf(10668));
2650 setFieldBuilder.setTunnel(tunnel.build());
2651 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2652 ab.setKey(new ActionKey(0));
2653 actionList.add(ab.build());
2655 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2656 aab.setAction(actionList);
2658 InstructionBuilder ib = new InstructionBuilder();
2659 ib.setKey(new InstructionKey(0));
2660 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2662 // Put our Instruction in a list of Instructions
2663 InstructionsBuilder isb = new InstructionsBuilder();
2664 List<Instruction> instructions = new ArrayList<Instruction>();
2665 instructions.add(ib.build());
2666 isb.setInstruction(instructions);
2670 private static MatchBuilder createLLDPMatch() {
2671 MatchBuilder match = new MatchBuilder();
2672 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2673 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2674 ethTypeBuilder.setType(new EtherType(0x88ccL));
2675 eth.setEthernetType(ethTypeBuilder.build());
2676 match.setEthernetMatch(eth.build());
2683 private static MatchBuilder createMatch1() {
2684 MatchBuilder match = new MatchBuilder();
2685 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2686 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2687 ipv4Match.setIpv4Destination(prefix);
2688 Ipv4Match i4m = ipv4Match.build();
2689 match.setLayer3Match(i4m);
2691 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2692 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2693 ethTypeBuilder.setType(new EtherType(0x0800L));
2694 eth.setEthernetType(ethTypeBuilder.build());
2695 match.setEthernetMatch(eth.build());
2702 private static MatchBuilder createIPv4DstMatch() {
2703 MatchBuilder match = new MatchBuilder();
2704 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2705 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2706 ipv4Match.setIpv4Destination(prefix);
2707 Ipv4Match i4m = ipv4Match.build();
2708 match.setLayer3Match(i4m);
2716 private static MatchBuilder createIPv4SrcMatch() {
2717 MatchBuilder match = new MatchBuilder();
2718 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2719 Ipv4Prefix prefix = new Ipv4Prefix("10.20.30.40/24");
2720 ipv4Match.setIpv4Source(prefix);
2721 Ipv4Match i4m = ipv4Match.build();
2722 match.setLayer3Match(i4m);
2724 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2725 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2726 ethTypeBuilder.setType(new EtherType(0x0800L));
2727 eth.setEthernetType(ethTypeBuilder.build());
2728 match.setEthernetMatch(eth.build());
2735 private static MatchBuilder createMatch2() {
2736 MatchBuilder match = new MatchBuilder();
2737 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2738 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1");
2739 ipv4Match.setIpv4Source(prefix);
2740 Ipv4Match i4m = ipv4Match.build();
2741 match.setLayer3Match(i4m);
2743 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2744 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2745 ethTypeBuilder.setType(new EtherType(0x0800L));
2746 eth.setEthernetType(ethTypeBuilder.build());
2747 match.setEthernetMatch(eth.build());
2754 private static MatchBuilder createMatch3() {
2755 MatchBuilder match = new MatchBuilder();
2756 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
2757 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
2758 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
2759 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
2760 match.setEthernetMatch(ethernetMatch.build());
2768 private static MatchBuilder createICMPv6Match1() {
2770 MatchBuilder match = new MatchBuilder();
2771 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2772 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2773 ethTypeBuilder.setType(new EtherType(0x86ddL));
2774 eth.setEthernetType(ethTypeBuilder.build());
2775 match.setEthernetMatch(eth.build());
2777 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2778 ipmatch.setIpProtocol((short) 256);
2779 match.setIpMatch(ipmatch.build());
2781 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2783 icmpv6match.setIcmpv6Type((short) 135);
2784 icmpv6match.setIcmpv6Code((short) 1);
2785 match.setIcmpv6Match(icmpv6match.build());
2790 private static MatchBuilder createMatch33() {
2792 MatchBuilder match = new MatchBuilder();
2793 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2794 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.10");
2795 ipv4Match.setIpv4Source(prefix);
2796 Ipv4Match i4m = ipv4Match.build();
2797 match.setLayer3Match(i4m);
2799 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2800 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2801 ethTypeBuilder.setType(new EtherType(0xfffeL));
2802 eth.setEthernetType(ethTypeBuilder.build());
2803 match.setEthernetMatch(eth.build());
2807 private static MatchBuilder createInphyportMatch(NodeId nodeId) {
2808 MatchBuilder match = new MatchBuilder();
2809 match.setInPort(new NodeConnectorId(nodeId + ":202"));
2810 match.setInPhyPort(new NodeConnectorId(nodeId + ":10122"));
2814 private static MatchBuilder createEthernetMatch() {
2815 MatchBuilder match = new MatchBuilder();
2817 byte[] mask1 = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2818 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2820 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
2822 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2823 EtherType type = new EtherType(0x0800L);
2824 ethmatch.setEthernetType(ethtype.setType(type).build());
2826 EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet
2829 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2830 ethdest.setAddress(macdest);
2831 ethdest.setMask(new MacAddress("ff:ff:ff:00:00:00"));
2833 ethmatch.setEthernetDestination(ethdest.build());
2835 EthernetSourceBuilder ethsrc = new EthernetSourceBuilder();
2836 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2837 ethsrc.setAddress(macsrc);
2838 ethsrc.setMask(new MacAddress("ff:ff:00:00:00:00"));
2840 ethmatch.setEthernetSource(ethsrc.build());
2841 match.setEthernetMatch(ethmatch.build());
2850 private static MatchBuilder createVlanMatch() {
2851 MatchBuilder match = new MatchBuilder();
2852 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder(); // vlan match
2853 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
2854 VlanId vlanId = new VlanId(10);
2855 VlanPcp vpcp = new VlanPcp((short) 3);
2856 vlanBuilder.setVlanPcp(vpcp);
2857 vlanIdBuilder.setVlanId(vlanId);
2858 vlanIdBuilder.setVlanIdPresent(true);
2859 vlanBuilder.setVlanId(vlanIdBuilder.build());
2860 match.setVlanMatch(vlanBuilder.build());
2867 private static MatchBuilder createArpMatch() {
2868 MatchBuilder match = new MatchBuilder();
2870 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2871 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2872 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2874 byte[] mask = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2875 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2877 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2878 EtherType type = new EtherType(0x0806L);
2879 ethmatch.setEthernetType(ethtype.setType(type).build());
2881 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
2882 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2884 ArpMatchBuilder arpmatch = new ArpMatchBuilder(); // arp match
2885 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2886 arpsrc.setAddress(macsrc);
2887 arpsrc.setMask(new MacAddress("ff:ff:ff:00:00:00"));
2888 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2889 arpdst.setAddress(macdest);
2890 arpdst.setMask(new MacAddress("ff:ff:00:00:00:00"));
2891 arpmatch.setArpOp(2);
2892 arpmatch.setArpSourceHardwareAddress(arpsrc.build());
2893 arpmatch.setArpTargetHardwareAddress(arpdst.build());
2894 arpmatch.setArpSourceTransportAddress(srcip);
2895 arpmatch.setArpTargetTransportAddress(dstip);
2897 match.setEthernetMatch(ethmatch.build());
2898 match.setLayer3Match(arpmatch.build());
2906 private static MatchBuilder createIPMatch() {
2907 MatchBuilder match = new MatchBuilder();
2908 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2909 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2910 EtherType type = new EtherType(0x0800L);
2911 ethmatch.setEthernetType(ethtype.setType(type).build());
2912 match.setEthernetMatch(ethmatch.build());
2914 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2915 ipmatch.setIpProtocol((short) 1);
2916 Dscp dscp = new Dscp((short) 3);
2917 ipmatch.setIpDscp(dscp);
2918 ipmatch.setIpEcn((short) 2);
2919 match.setIpMatch(ipmatch.build());
2926 private static MatchBuilder createL3IPv4Match() {
2927 MatchBuilder match = new MatchBuilder();
2929 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2930 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2931 ethTypeBuilder.setType(new EtherType(0x0800L));
2932 eth.setEthernetType(ethTypeBuilder.build());
2933 match.setEthernetMatch(eth.build());
2935 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2936 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
2937 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2938 Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
2939 ipv4match.setIpv4Destination(dstip);
2940 ipv4match.setIpv4Source(srcip);
2941 match.setLayer3Match(ipv4match.build());
2950 private static MatchBuilder createL3IPv6Match() {
2951 MatchBuilder match = new MatchBuilder();
2953 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2954 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2955 ethTypeBuilder.setType(new EtherType(0x86ddL));
2956 eth.setEthernetType(ethTypeBuilder.build());
2957 match.setEthernetMatch(eth.build());
2959 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2/64");
2960 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1/56");
2961 Ipv6Address ndtarget = new Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
2962 MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
2963 MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
2964 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2965 nextheader.setIpv6Exthdr(58);
2966 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2967 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2968 ipv6label.setIpv6Flabel(label);
2969 ipv6label.setFlabelMask(new Ipv6FlowLabel(1L));
2971 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2973 icmpv6match.setIcmpv6Type((short) 135);
2974 icmpv6match.setIcmpv6Code((short) 0);
2975 match.setIcmpv6Match(icmpv6match.build());
2977 Ipv6MatchBuilder ipv6match = new Ipv6MatchBuilder();
2978 // ipv6match.setIpv6Source(srcip6);
2979 // ipv6match.setIpv6Destination(dstip6);
2980 // ipv6match.setIpv6ExtHeader(nextheader.build());
2981 ipv6match.setIpv6NdSll(ndsll);
2982 ipv6match.setIpv6NdTll(ndtll);
2983 // ipv6match.setIpv6NdTarget(ndtarget);
2984 ipv6match.setIpv6Label(ipv6label.build());
2986 match.setLayer3Match(ipv6match.build());
2995 private static MatchBuilder createICMPv4Match() {
2996 MatchBuilder match = new MatchBuilder();
2997 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2998 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2999 ethTypeBuilder.setType(new EtherType(0x0800L));
3000 eth.setEthernetType(ethTypeBuilder.build());
3001 match.setEthernetMatch(eth.build());
3003 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3004 ipmatch.setIpProtocol((short) 1);
3005 match.setIpMatch(ipmatch.build());
3007 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder(); // icmpv4
3009 icmpv4match.setIcmpv4Type((short) 8);
3010 icmpv4match.setIcmpv4Code((short) 0);
3011 match.setIcmpv4Match(icmpv4match.build());
3018 private static MatchBuilder createICMPv6Match() {
3020 MatchBuilder match = new MatchBuilder();
3021 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3022 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3023 ethTypeBuilder.setType(new EtherType(0x86ddL));
3024 eth.setEthernetType(ethTypeBuilder.build());
3025 match.setEthernetMatch(eth.build());
3027 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3028 ipmatch.setIpProtocol((short) 58);
3029 match.setIpMatch(ipmatch.build());
3031 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
3033 icmpv6match.setIcmpv6Type((short) 135);
3034 icmpv6match.setIcmpv6Code((short) 1);
3035 match.setIcmpv6Match(icmpv6match.build());
3043 private static MatchBuilder createToSMatch() {
3044 MatchBuilder match = new MatchBuilder();
3045 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
3046 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
3047 EtherType type = new EtherType(0x0800L);
3048 ethmatch.setEthernetType(ethtype.setType(type).build());
3049 match.setEthernetMatch(ethmatch.build());
3051 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3052 ipmatch.setIpProtocol((short) 6);
3053 Dscp dscp = new Dscp((short) 8);
3054 ipmatch.setIpDscp(dscp);
3055 match.setIpMatch(ipmatch.build());
3063 private static MatchBuilder createL4TCPMatch() {
3064 MatchBuilder match = new MatchBuilder();
3066 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3067 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3068 ethTypeBuilder.setType(new EtherType(0x0800L));
3069 eth.setEthernetType(ethTypeBuilder.build());
3070 match.setEthernetMatch(eth.build());
3072 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3073 ipmatch.setIpProtocol((short) 6);
3074 match.setIpMatch(ipmatch.build());
3076 PortNumber srcport = new PortNumber(1213);
3077 PortNumber dstport = new PortNumber(646);
3078 TcpMatchBuilder tcpmatch = new TcpMatchBuilder(); // tcp match
3079 tcpmatch.setTcpSourcePort(srcport);
3080 tcpmatch.setTcpDestinationPort(dstport);
3081 match.setLayer4Match(tcpmatch.build());
3089 private static MatchBuilder createL4UDPMatch() {
3090 MatchBuilder match = new MatchBuilder();
3092 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3093 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3094 ethTypeBuilder.setType(new EtherType(0x0800L));
3095 eth.setEthernetType(ethTypeBuilder.build());
3096 match.setEthernetMatch(eth.build());
3098 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3099 ipmatch.setIpProtocol((short) 17);
3100 match.setIpMatch(ipmatch.build());
3102 PortNumber srcport = new PortNumber(1325);
3103 PortNumber dstport = new PortNumber(42);
3104 UdpMatchBuilder udpmatch = new UdpMatchBuilder(); // udp match
3105 udpmatch.setUdpDestinationPort(dstport);
3106 udpmatch.setUdpSourcePort(srcport);
3107 match.setLayer4Match(udpmatch.build());
3115 private static MatchBuilder createL4SCTPMatch() {
3116 MatchBuilder match = new MatchBuilder();
3118 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3119 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3120 ethTypeBuilder.setType(new EtherType(0x0800L));
3121 eth.setEthernetType(ethTypeBuilder.build());
3122 match.setEthernetMatch(eth.build());
3124 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3125 ipmatch.setIpProtocol((short) 132);
3126 match.setIpMatch(ipmatch.build());
3128 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
3129 PortNumber srcport = new PortNumber(1435);
3130 PortNumber dstport = new PortNumber(22);
3131 sctpmatch.setSctpSourcePort(srcport);
3132 sctpmatch.setSctpDestinationPort(dstport);
3133 match.setLayer4Match(sctpmatch.build());
3141 private static MatchBuilder createMetadataMatch() {
3142 MatchBuilder match = new MatchBuilder();
3143 byte[] metamask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
3144 MetadataBuilder metadata = new MetadataBuilder(); // metadata match
3145 metadata.setMetadata(BigInteger.valueOf(500L));
3146 metadata.setMetadataMask(new BigInteger(metamask));
3147 match.setMetadata(metadata.build());
3155 private static MatchBuilder createMplsMatch() {
3156 MatchBuilder match = new MatchBuilder();
3158 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3159 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3160 ethTypeBuilder.setType(new EtherType(0x8847L));
3161 eth.setEthernetType(ethTypeBuilder.build());
3162 match.setEthernetMatch(eth.build());
3164 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3166 protomatch.setMplsLabel((long) 36008);
3167 protomatch.setMplsTc((short) 4);
3168 protomatch.setMplsBos((short) 1);
3169 match.setProtocolMatchFields(protomatch.build());
3178 private static MatchBuilder createPbbMatch() {
3179 MatchBuilder match = new MatchBuilder();
3181 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3182 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3183 ethTypeBuilder.setType(new EtherType(0x88E7L));
3184 eth.setEthernetType(ethTypeBuilder.build());
3185 match.setEthernetMatch(eth.build());
3187 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3189 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new BigInteger(new byte[] { 0, 1, 0, 0 }).longValue()).build());
3190 match.setProtocolMatchFields(protomatch.build());
3199 private static MatchBuilder createTunnelIDMatch() {
3200 MatchBuilder match = new MatchBuilder();
3201 TunnelBuilder tunnel = new TunnelBuilder(); // tunnel id match
3202 tunnel.setTunnelId(BigInteger.valueOf(10668));
3203 byte[] mask = new byte[] {(byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
3204 tunnel.setTunnelMask(new BigInteger(1, mask));
3205 match.setTunnel(tunnel.build());
3211 * Test match for TCP_Flags
3212 * @return match containing Ethertype (0x0800), IP Protocol (TCP), TCP_Flag (SYN)
3214 //FIXME: move to extensible support
3215 private static MatchBuilder createTcpFlagMatch() {
3216 MatchBuilder match = new MatchBuilder();
3219 EthernetMatchBuilder ethernetType = new EthernetMatchBuilder();
3220 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3221 ethTypeBuilder.setType(new EtherType(0x0800L));
3222 ethernetType.setEthernetType(ethTypeBuilder.build());
3223 match.setEthernetMatch(ethernetType.build());
3225 // TCP Protocol Match
3226 IpMatchBuilder ipMatch = new IpMatchBuilder(); // ipv4 version
3227 ipMatch.setIpProtocol((short) 6);
3228 match.setIpMatch(ipMatch.build());
3231 PortNumber dstPort = new PortNumber(80);
3232 TcpMatchBuilder tcpMatch = new TcpMatchBuilder();
3233 tcpMatch.setTcpDestinationPort(dstPort);
3234 match.setLayer4Match(tcpMatch.build());
3236 * Defined TCP Flag values in OVS v2.1+
3237 * TCP_FIN 0x001 / TCP_SYN 0x002 / TCP_RST 0x004
3238 * TCP_PSH 0x008 / TCP_ACK 0x010 / TCP_URG 0x020
3239 * TCP_ECE 0x040 / TCP_CWR 0x080 / TCP_NS 0x100
3241 TcpFlagMatchBuilder tcpFlagMatch = new TcpFlagMatchBuilder();
3242 tcpFlagMatch.setTcpFlag(0x002);
3243 match.setTcpFlagMatch(tcpFlagMatch.build());
3248 public void _removeMDFlow(CommandInterpreter ci) {
3249 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
3250 NodeBuilder tn = createTestNode(ci.nextArgument());
3251 String flowtype = ci.nextArgument();
3253 if (flowtype.equals("fTM")) {
3254 tf = createtablemiss(tn, flowtype, ci.nextArgument());
3256 tf = createTestFlow(tn, flowtype, ci.nextArgument());
3258 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class).child(Node.class, tn.getKey())
3259 .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf.getTableId()))
3260 .child(Flow.class, tf.getKey()).build();
3261 modification.removeConfigurationData(path1);
3262 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
3264 RpcResult<TransactionStatus> result = commitFuture.get();
3265 TransactionStatus status = result.getResult();
3266 ci.println("Status of Flow Data Loaded Transaction: " + status);
3268 } catch (InterruptedException e) {
3269 LOG.error(e.getMessage(), e);
3270 } catch (ExecutionException e) {
3271 LOG.error(e.getMessage(), e);
3276 * @param ci arguments: switchId flowType tableNum
3279 * e.g.: addMDFlow openflow:1 f1 42
3282 public void _addMDFlow(CommandInterpreter ci) {
3283 NodeBuilder tn = createTestNode(ci.nextArgument());
3284 String flowtype = ci.nextArgument();
3286 if (flowtype.equals("fTM")) {
3287 tf = createtablemiss(tn, flowtype, ci.nextArgument());
3289 tf = createTestFlow(tn, flowtype, ci.nextArgument());
3291 writeFlow(ci, tf, tn);
3294 private void writeFlow(CommandInterpreter ci, FlowBuilder flow, NodeBuilder nodeBuilder) {
3295 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
3296 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class)
3297 .child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
3298 .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.getKey()).build();
3299 modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
3300 modification.putConfigurationData(path1, flow.build());
3301 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
3303 RpcResult<TransactionStatus> result = commitFuture.get();
3304 TransactionStatus status = result.getResult();
3305 ci.println("Status of Flow Data Loaded Transaction: " + status);
3307 } catch (InterruptedException e) {
3308 LOG.error(e.getMessage(), e);
3309 } catch (ExecutionException e) {
3310 LOG.error(e.getMessage(), e);
3314 public void _modifyMDFlow(CommandInterpreter ci) {
3315 NodeBuilder tn = createTestNode(ci.nextArgument());
3316 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
3317 tf.setFlowName(updatedFlowName);
3318 writeFlow(ci, tf, tn);
3319 tf.setFlowName(originalFlowName);
3320 writeFlow(ci, tf, tn);
3323 private static NodeRef createNodeRef(String string) {
3324 NodeKey key = new NodeKey(new NodeId(string));
3325 InstanceIdentifier<Node> path = InstanceIdentifier.builder(Nodes.class).child(Node.class, key)
3328 return new NodeRef(path);
3332 public String getHelp() {
3337 * usage testSwitchFlows <numberOfSwitches> <numberOfFlows> <warmup iterations> <Number Of Threads>
3338 * ex: _perfFlowTest 10 5 1 2
3340 public void _perfFlowTest(CommandInterpreter ci) {
3342 String numberOfSwtichesStr = ci.nextArgument();
3343 String numberOfFlowsStr = ci.nextArgument();
3344 String warmupIterationsStr = ci.nextArgument();
3345 String threadCountStr = ci.nextArgument();
3346 String warmUpStr = ci.nextArgument();
3348 Collection<String> testResults = null;
3349 if(testResults == null){
3350 testResults = new ArrayList<String>();
3353 int numberOfSwtiches = 0;
3354 int numberOfFlows = 0;
3355 int warmupIterations = 0;
3356 boolean warmUpIterations = false;
3358 int threadCount = 0;
3359 if(numberOfSwtichesStr !=null && !numberOfSwtichesStr.trim().equals("")){
3360 numberOfSwtiches = new Integer(numberOfSwtichesStr).intValue();
3362 numberOfSwtiches = 2;
3365 if(numberOfFlowsStr !=null && !numberOfFlowsStr.trim().equals("")){
3366 numberOfFlows = new Integer(numberOfFlowsStr).intValue();
3371 if(warmupIterationsStr !=null && !warmupIterationsStr.trim().equals("")){
3372 warmupIterations = new Integer(warmupIterationsStr).intValue();
3374 warmupIterations = 2;
3377 if(threadCountStr !=null && !threadCountStr.trim().equals("")){
3378 threadCount = new Integer(threadCountStr).intValue();
3382 if(warmUpStr !=null && !warmUpStr.trim().equals("") && warmUpStr.trim().equals("true")){
3383 warmUpIterations = true;
3385 warmUpIterations = false;
3387 ci.println("* Test Configurations*");
3388 ci.println("* numberOfSwtiches:::"+numberOfSwtiches+"");
3389 ci.println("* numberOfFlows:::"+numberOfFlows+"");
3390 ci.println("* warmupIterations:::"+warmupIterations+"");
3391 ci.println("* Number of Threads :::"+threadCount+"");
3392 ci.println("* Warmup Required? :::"+warmUpIterations+"");
3394 String dataPath="openflow:1";
3395 String flowType = "fTM";
3398 String tableId = "0";
3399 if(warmUpIterations){
3400 ci.println("----Warmup Started-----");
3401 for(int j =1; j<= warmupIterations; j++){
3402 for(int i =1;i<=numberOfSwtiches;i++){
3403 dataPath = "openflow:"+i;
3404 tn = createTestNode(dataPath);
3405 for (int flow=1;flow<numberOfFlows;flow++){
3406 tf = createTestFlow_perfTest(tn, "f1", tableId, flow);
3407 writeFlow(ci, tf, tn);
3412 ci.println("----Warmup Done-----");
3415 ExecutorService executor = Executors.newFixedThreadPool(threadCount);
3418 for ( int t=0;t< threadCount;t++){
3420 Runnable tRunnable = new TestFlowThread(numberOfSwtiches, numberOfFlows, ci, t, tableID);
3421 executor.execute(tRunnable);
3423 executor.shutdown();
3424 executor.awaitTermination(1, TimeUnit.SECONDS);
3425 } catch(Exception e){
3426 ci.println("Exception:"+e.getMessage());
3430 public class TestFlowThread implements Runnable {
3432 int numberOfSwitches;
3435 CommandInterpreter ci;
3438 Collection<String> testResults = null;
3441 TestFlowThread(int numberOfSwtiches, int numberOfFlows, CommandInterpreter ci, int t, int tableID) {
3442 this.numberOfSwitches = numberOfSwtiches;
3443 this.numberOfFlows = numberOfFlows;
3445 this.theadNumber = t;
3446 this.tableID = tableID;
3454 public void executeFlow() {
3456 String dataPath = "openflow:1";
3459 //String tableId = "0";
3461 ci.println("New Thread started with id: ID_"
3462 + this.theadNumber);
3463 int totalNumberOfFlows = 0;
3464 long startTime = System.currentTimeMillis();
3466 for (int i = 1; i <= this.numberOfSwitches; i++) {
3467 dataPath = "openflow:" + i;
3468 tn = createTestNode(dataPath);
3469 for (int flow2 = 1; flow2 <= this.numberOfFlows; flow2++) {
3470 tf = createTestFlow_perfTest(tn, "f1", ""+this.tableID, flow2);
3471 writeFlow(this.ci, tf, tn);
3472 totalNumberOfFlows++;
3475 long endTime = System.currentTimeMillis();
3476 long timeInSeconds = Math.round((endTime - startTime) / 1000);
3477 if (timeInSeconds > 0) {
3478 ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::" + Math.round(totalNumberOfFlows / timeInSeconds));
3480 ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::" + totalNumberOfFlows);
3486 * usage testAllFlows <dp>
3487 * ex: _perfFlowTest 1
3489 public void _testAllFlows(CommandInterpreter ci) {
3490 String dataPathID = ci.nextArgument();
3491 int numberOfFlows = 82;
3492 int threadCount = 0;
3493 if(dataPathID ==null || dataPathID.trim().equals("")){
3496 ci.println("* Test All Flows *");
3497 ci.println("* dataPathID:::"+dataPathID+"");
3498 String dataPath="openflow:"+dataPathID;
3499 String tableId = "0";
3500 NodeBuilder tn = createTestNode(dataPath);
3502 for (int flow=1;flow<numberOfFlows;flow++){
3503 String flowID = "f"+flow;
3505 tf = createTestFlow(tn, flowID, tableId);
3506 writeFlow(ci, tf, tn);
3507 } catch(Exception e){
3508 ci.println("--Test Failed--Issue found while adding flow"+ flow);