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._3.match.TunnelIpv4MatchBuilder;
175 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder;
176 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
177 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
178 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.protocol.match.fields.PbbBuilder;
179 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
180 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.NodeErrorListener;
181 import org.opendaylight.yangtools.concepts.Registration;
182 import org.opendaylight.yangtools.yang.binding.DataObject;
183 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
184 import org.opendaylight.yangtools.yang.common.RpcResult;
185 import org.osgi.framework.BundleContext;
186 import org.slf4j.Logger;
187 import org.slf4j.LoggerFactory;
189 public class OpenflowpluginTestCommandProvider implements CommandProvider {
191 private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
193 private DataBrokerService dataBrokerService;
194 private ProviderContext pc;
195 private final BundleContext ctx;
196 private FlowBuilder testFlow;
197 private NodeBuilder testNode;
198 private final String originalFlowName = "Foo";
199 private final String updatedFlowName = "Bar";
200 private final SalFlowListener flowEventListener = new FlowEventListenerLoggingImpl();
201 private final NodeErrorListener nodeErrorListener = new NodeErrorListenerLoggingImpl();
202 private static NotificationService notificationService;
203 private Registration listener1Reg;
204 private Registration listener2Reg;
206 public OpenflowpluginTestCommandProvider(BundleContext ctx) {
210 public void onSessionInitiated(ProviderContext session) {
212 notificationService = session.getSALService(NotificationService.class);
214 listener1Reg = notificationService.registerNotificationListener(flowEventListener);
215 listener2Reg = notificationService.registerNotificationListener(nodeErrorListener);
216 dataBrokerService = session.getSALService(DataBrokerService.class);
217 ctx.registerService(CommandProvider.class.getName(), this, null);
218 createTestFlow(createTestNode(null), null, null);
221 private NodeBuilder createTestNode(String nodeId) {
222 if (nodeId == null) {
223 nodeId = OpenflowpluginTestActivator.NODE_ID;
225 NodeRef nodeOne = createNodeRef(nodeId);
226 NodeBuilder builder = new NodeBuilder();
227 builder.setId(new NodeId(nodeId));
228 builder.setKey(new NodeKey(builder.getId()));
233 private InstanceIdentifier<Node> nodeBuilderToInstanceId(NodeBuilder node) {
234 return InstanceIdentifier.builder(Nodes.class).child(Node.class, node.getKey()).toInstance();
237 private FlowBuilder createTestFlow(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
239 FlowBuilder flow = new FlowBuilder();
242 String flowType = flowTypeArg;
243 if (flowType == null) {
252 flow.setMatch(createMatch1().build());
253 flow.setInstructions(createDecNwTtlInstructions().build());
257 flow.setMatch(createMatch2().build());
258 flow.setInstructions(createDropInstructions().build());
262 flow.setMatch(createMatch3().build());
263 flow.setInstructions(createDropInstructions().build());
267 flow.setMatch(createEthernetMatch().build());
268 flow.setInstructions(createDropInstructions().build());
272 flow.setMatch(createMatch1().build());
273 flow.setInstructions(createAppyActionInstruction().build());
277 flow.setMatch(createMatch1().build());
278 flow.setInstructions(createGotoTableInstructions().build());
282 flow.setMatch(createMatch1().build());
283 flow.setInstructions(createMeterInstructions().build());
287 flow.setMatch(createMatch1().build());
288 flow.setInstructions(createAppyActionInstruction1().build());
292 flow.setMatch(createMatch1().build());
293 flow.setInstructions(createAppyActionInstruction2().build());
297 flow.setMatch(createMatch1().build());
298 flow.setInstructions(createAppyActionInstruction3().build());
302 flow.setMatch(createMatch1().build());
303 flow.setInstructions(createAppyActionInstruction4().build());
307 flow.setMatch(createMatch1().build());
308 flow.setInstructions(createAppyActionInstruction5().build());
312 flow.setMatch(createMatch1().build());
313 flow.setInstructions(createAppyActionInstruction6().build());
317 flow.setMatch(createMatch1().build());
318 flow.setInstructions(createAppyActionInstruction7().build());
322 flow.setMatch(createMatch1().build());
323 flow.setInstructions(createAppyActionInstruction8().build());
327 flow.setMatch(createMatch1().build());
328 flow.setInstructions(createAppyActionInstruction9().build());
332 flow.setMatch(createMatch1().build());
333 flow.setInstructions(createAppyActionInstruction10().build());
337 flow.setMatch(createMatch1().build());
338 flow.setInstructions(createAppyActionInstruction11().build());
342 flow.setMatch(createMatch1().build());
343 flow.setInstructions(createAppyActionInstruction12().build());
347 flow.setMatch(createMatch1().build());
348 flow.setInstructions(createAppyActionInstruction13().build());
352 flow.setMatch(createMatch1().build());
353 flow.setInstructions(createAppyActionInstruction14().build());
357 flow.setMatch(createMatch1().build());
358 flow.setInstructions(createAppyActionInstruction15().build());
362 // f23 can be used as test-case for generating error notification
363 // if the particular group is not configured - tested
364 flow.setMatch(createMatch1().build());
365 flow.setInstructions(createAppyActionInstruction16().build());
369 flow.setMatch(createMatch1().build());
370 flow.setInstructions(createAppyActionInstruction17().build());
374 flow.setMatch(createMatch1().build());
375 flow.setInstructions(createAppyActionInstruction18().build());
379 flow.setMatch(createMatch1().build());
380 flow.setInstructions(createAppyActionInstruction19().build());
384 flow.setMatch(createMatch1().build());
385 flow.setInstructions(createMetadataInstructions().build());
389 flow.setMatch(createMatch1().build());
390 flow.setInstructions(createAppyActionInstruction20().build());
394 flow.setMatch(createMatch1().build());
395 flow.setInstructions(createAppyActionInstruction21().build());
399 flow.setMatch(createMatch1().build());
400 flow.setInstructions(createAppyActionInstruction22().build());
404 flow.setMatch(createMatch1().build());
405 flow.setInstructions(createAppyActionInstruction23(nodeBuilder.getId()).build());
409 flow.setMatch(createMatch1().build());
410 flow.setInstructions(createAppyActionInstruction24().build());
414 flow.setMatch(createMatch1().build());
415 flow.setInstructions(createAppyActionInstruction25().build());
419 flow.setMatch(createMatch1().build());
420 flow.setInstructions(createAppyActionInstruction26().build());
424 flow.setMatch(createMatch1().build());
425 flow.setInstructions(createAppyActionInstruction27().build());
429 flow.setMatch(createMatch1().build());
430 flow.setInstructions(createAppyActionInstruction28().build());
434 flow.setMatch(createMatch1().build());
435 flow.setInstructions(createAppyActionInstruction29().build());
439 flow.setMatch(createMatch1().build());
440 flow.setInstructions(createAppyActionInstruction30().build());
444 flow.setMatch(createMatch1().build());
445 flow.setInstructions(createAppyActionInstruction31().build());
449 flow.setMatch(createMatch1().build());
450 flow.setInstructions(createAppyActionInstruction32().build());
454 flow.setMatch(createMatch1().build());
455 flow.setInstructions(createAppyActionInstruction33().build());
459 flow.setMatch(createMatch1().build());
460 flow.setInstructions(createAppyActionInstruction34().build());
464 flow.setMatch(createICMPv6Match().build());
465 flow.setInstructions(createDecNwTtlInstructions().build());
469 flow.setMatch(createInphyportMatch(nodeBuilder.getId()).build());
470 flow.setInstructions(createDropInstructions().build());
474 flow.setMatch(createMetadataMatch().build());
475 flow.setInstructions(createDropInstructions().build());
479 flow.setMatch(createL3IPv6Match().build());
480 flow.setInstructions(createDecNwTtlInstructions().build());
484 flow.setMatch(createL4SCTPMatch().build());
485 flow.setInstructions(createAppyActionInstruction().build());
489 flow.setMatch(createTunnelIDMatch().build());
490 flow.setInstructions(createGotoTableInstructions().build());
494 flow.setMatch(createVlanMatch().build());
495 flow.setInstructions(createMeterInstructions().build());
499 flow.setMatch(createPbbMatch().build());
500 flow.setInstructions(createMeterInstructions().build());
504 flow.setMatch(createVlanMatch().build());
505 flow.setInstructions(createDropInstructions().build());
509 flow.setMatch(createL4TCPMatch().build());
510 flow.setInstructions(createDropInstructions().build());
515 flow.setMatch(createL4UDPMatch().build());
516 flow.setInstructions(createDropInstructions().build());
520 flow.setMatch(new MatchBuilder().build());
521 flow.setInstructions(createSentToControllerInstructions().build());
526 flow.setMatch(createToSMatch().build());
527 flow.setInstructions(createDropInstructions().build());
531 flow.setMatch(createToSMatch().build());
532 flow.setInstructions(createOutputInstructions("INPORT", 10).build());
536 flow.setMatch(createToSMatch().build());
537 flow.setInstructions(createOutputInstructions("FLOOD", 20).build());
541 flow.setMatch(createToSMatch().build());
542 flow.setInstructions(createOutputInstructions("ALL", 30).build());
546 flow.setMatch(createToSMatch().build());
547 flow.setInstructions(createOutputInstructions("NORMAL", 40).build());
551 flow.setMatch(createToSMatch().build());
552 flow.setInstructions(createOutputInstructions("LOCAL", 50).build());
556 flow.setMatch(createToSMatch().build());
557 flow.setInstructions(createOutputInstructions("TABLE", 60).build());
561 flow.setMatch(createToSMatch().build());
562 flow.setInstructions(createOutputInstructions("NONE", 70).build());
566 flow.setMatch(createToSMatch().build());
567 flow.setInstructions(createStripVlanInstructions().build());
568 flow.setBarrier(Boolean.TRUE);
572 flow.setMatch(createMatch1().build());
573 flow.setInstructions(createAppyActionInstruction35().build());
577 flow.setMatch(createMatch1().build());
578 flow.setInstructions(createAppyActionInstruction36().build());
582 flow.setMatch(createMatch1().build());
583 flow.setInstructions(createAppyActionInstruction37().build());
587 flow.setMatch(createMatch1().build());
588 flow.setInstructions(createAppyActionInstruction38().build());
592 flow.setMatch(createL4TCPMatch().build());
593 flow.setInstructions(createAppyActionInstruction39().build());
597 flow.setMatch(createL4UDPMatch().build());
598 flow.setInstructions(createAppyActionInstruction40().build());
602 flow.setMatch(createL4SCTPMatch().build());
603 flow.setInstructions(createAppyActionInstruction41().build());
607 flow.setMatch(createICMPv4Match().build());
608 flow.setInstructions(createAppyActionInstruction42().build());
612 flow.setMatch(createArpMatch().build());
613 flow.setInstructions(createAppyActionInstruction43().build());
617 flow.setMatch(createL3IPv6Match().build());
618 flow.setInstructions(createAppyActionInstruction44().build());
622 flow.setMatch(createICMPv6Match().build());
623 flow.setInstructions(createAppyActionInstruction45().build());
627 flow.setMatch(createMplsMatch().build());
628 flow.setInstructions(createAppyActionInstruction46().build());
632 flow.setMatch(createPbbMatch().build());
633 flow.setInstructions(createAppyActionInstruction47().build());
637 flow.setMatch(createTunnelIDMatch().build());
638 flow.setInstructions(createAppyActionInstruction48().build());
642 flow.setMatch(createMatch33().build());
643 flow.setInstructions(createDropInstructions().build());
647 flow.setMatch(createICMPv6Match1().build());
648 flow.setInstructions(createDecNwTtlInstructions().build());
652 flow.setMatch(createVlanMatch().build());
653 flow.setInstructions(createAppyActionInstruction88().build());
657 flow.setMatch(createLLDPMatch().build());
658 flow.setInstructions(createSentToControllerInstructions().build());
662 flow.setMatch(createToSMatch().build());
663 flow.setInstructions(createOutputInstructions().build());
666 id += 83; // Test TCP_Flag Match
667 flow.setMatch(createTcpFlagMatch().build());
668 flow.setInstructions(createDropInstructions().build());
672 flow.setMatch(createVlanMatch().build()); // match vlan=10,dl_vlan_pcp=3
673 flow.setInstructions(createAppyActionInstruction88().build()); // vlan_pcp=4
676 id += 85; // Test Tunnel IPv4 Src (e.g. set_field:172.16.100.200->tun_src)
677 flow.setMatch(createMatch3().build());
678 flow.setInstructions(createTunnelIpv4SrcInstructions().build());
681 id += 86; // Test Tunnel IPv4 Dst (e.g. set_field:172.16.100.100->tun_dst)
682 flow.setMatch(createMatch1().build());
683 flow.setInstructions(createTunnelIpv4DstInstructions().build());
686 LOG.warn("flow type not understood: {}", flowType);
689 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
690 if (null == flow.isBarrier()) {
691 flow.setBarrier(Boolean.FALSE);
693 // flow.setBufferId(new Long(12));
694 BigInteger value = new BigInteger("10", 10);
695 // BigInteger outputPort = new BigInteger("65535", 10);
696 flow.setCookie(new FlowCookie(value));
697 flow.setCookieMask(new FlowCookie(value));
698 flow.setHardTimeout(0);
699 flow.setIdleTimeout(0);
700 flow.setInstallHw(false);
701 flow.setStrict(false);
702 flow.setContainerName(null);
703 flow.setFlags(new FlowModFlags(false, false, false, false, true));
704 flow.setId(new FlowId("12"));
705 flow.setTableId(getTableId(tableId));
706 // commenting setOutGroup and setOutPort, as by default
708 // enable setOutGroup and setOutPort to enable output filtering
709 // flow.setOutGroup(new Long(2));
710 // set outport to OFPP_NONE (65535) to disable remove restriction for
712 // flow.setOutPort(outputPort);
715 flow.setFlowName(originalFlowName + "X" + flowType);
721 private FlowBuilder createTestFlow_perfTest(NodeBuilder nodeBuilder, String flowTypeArg, String tableId, int id) {
723 FlowBuilder flow = new FlowBuilder();
726 String flowType = flowTypeArg;
727 if (flowType == null) {
731 flow.setPriority(id);
736 flow.setMatch(createMatch1().build());
737 flow.setInstructions(createDecNwTtlInstructions().build());
740 LOG.warn("flow type not understood: {}", flowType);
743 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
744 if (null == flow.isBarrier()) {
745 flow.setBarrier(Boolean.FALSE);
747 // flow.setBufferId(new Long(12));
748 BigInteger value = new BigInteger("10", 10);
749 // BigInteger outputPort = new BigInteger("65535", 10);
750 flow.setCookie(new FlowCookie(value));
751 flow.setCookieMask(new FlowCookie(value));
752 flow.setHardTimeout(0);
753 flow.setIdleTimeout(0);
754 flow.setInstallHw(false);
755 flow.setStrict(false);
756 flow.setContainerName(null);
757 flow.setFlags(new FlowModFlags(false, false, false, false, true));
758 flow.setId(new FlowId("12"));
759 flow.setTableId(getTableId(tableId));
760 // commenting setOutGroup and setOutPort, as by default
762 // enable setOutGroup and setOutPort to enable output filtering
763 // flow.setOutGroup(new Long(2));
764 // set outport to OFPP_NONE (65535) to disable remove restriction for
766 // flow.setOutPort(outputPort);
769 flow.setFlowName(originalFlowName + "X" + flowType);
773 private FlowBuilder createtablemiss(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
774 FlowBuilder flow = new FlowBuilder();
776 MatchBuilder matchBuilder = new MatchBuilder();
777 flow.setMatch(matchBuilder.build());
778 flow.setInstructions(createSentToControllerInstructions().build());
780 flow.setTableId((short) 0);
781 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
787 private short getTableId(String tableId) {
790 table = Short.parseShort(tableId);
791 } catch (Exception ex) {
792 // ignore exception and continue with default value
802 private static InstructionsBuilder createDecNwTtlInstructions() {
803 DecNwTtlBuilder ta = new DecNwTtlBuilder();
804 DecNwTtl decNwTtl = ta.build();
805 ActionBuilder ab = new ActionBuilder();
806 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
807 ab.setKey(new ActionKey(0));
808 // Add our drop action to a list
809 List<Action> actionList = new ArrayList<Action>();
810 actionList.add(ab.build());
812 // Create an Apply Action
813 ApplyActionsBuilder aab = new ApplyActionsBuilder();
814 aab.setAction(actionList);
816 // Wrap our Apply Action in an Instruction
817 InstructionBuilder ib = new InstructionBuilder();
818 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
819 ib.setKey(new InstructionKey(0));
822 // Put our Instruction in a list of Instructions
823 InstructionsBuilder isb = new InstructionsBuilder();
824 List<Instruction> instructions = new ArrayList<Instruction>();
825 instructions.add(ib.build());
826 ib.setKey(new InstructionKey(0));
827 isb.setInstruction(instructions);
834 private static InstructionsBuilder createMeterInstructions() {
836 MeterBuilder aab = new MeterBuilder();
837 aab.setMeterId(new MeterId(new Long(1)));
839 InstructionBuilder ib = new InstructionBuilder();
840 ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
842 // Put our Instruction in a list of Instructions
843 InstructionsBuilder isb = new InstructionsBuilder();
844 List<Instruction> instructions = new ArrayList<Instruction>();
845 ib.setKey(new InstructionKey(0));
846 instructions.add(ib.build());
847 isb.setInstruction(instructions);
851 private static InstructionsBuilder createMetadataInstructions() {
853 WriteMetadataBuilder aab = new WriteMetadataBuilder();
854 aab.setMetadata(new BigInteger("10", 10));
855 aab.setMetadataMask(new BigInteger("12", 10));
857 InstructionBuilder ib = new InstructionBuilder();
858 ib.setInstruction(new WriteMetadataCaseBuilder().setWriteMetadata(aab.build()).build());
860 // Put our Instruction in a list of Instructions
861 InstructionsBuilder isb = new InstructionsBuilder();
862 List<Instruction> instructions = new ArrayList<Instruction>();
863 ib.setKey(new InstructionKey(0));
864 instructions.add(ib.build());
865 isb.setInstruction(instructions);
869 private static InstructionsBuilder createGotoTableInstructions() {
871 GoToTableBuilder aab = new GoToTableBuilder();
872 aab.setTableId((short) 5);
874 InstructionBuilder ib = new InstructionBuilder();
875 ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(aab.build()).build());
877 // Put our Instruction in a list of Instructions
878 InstructionsBuilder isb = new InstructionsBuilder();
879 List<Instruction> instructions = new ArrayList<Instruction>();
880 ib.setKey(new InstructionKey(0));
881 instructions.add(ib.build());
882 isb.setInstruction(instructions);
886 private static InstructionsBuilder createDropInstructions() {
887 DropActionBuilder dab = new DropActionBuilder();
888 DropAction dropAction = dab.build();
889 ActionBuilder ab = new ActionBuilder();
890 ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build());
891 ab.setKey(new ActionKey(0));
892 // Add our drop action to a list
893 List<Action> actionList = new ArrayList<Action>();
894 actionList.add(ab.build());
895 ab.setKey(new ActionKey(0));
896 // Create an Apply Action
897 ApplyActionsBuilder aab = new ApplyActionsBuilder();
898 aab.setAction(actionList);
900 // Wrap our Apply Action in an Instruction
901 InstructionBuilder ib = new InstructionBuilder();
902 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
904 // Put our Instruction in a list of Instructions
905 InstructionsBuilder isb = new InstructionsBuilder();
906 List<Instruction> instructions = new ArrayList<Instruction>();
907 ib.setKey(new InstructionKey(0));
908 instructions.add(ib.build());
909 isb.setInstruction(instructions);
913 private static InstructionsBuilder createAppyActionInstruction() {
915 List<Action> actionList = new ArrayList<Action>();
916 ActionBuilder ab = new ActionBuilder();
917 ControllerActionBuilder controller = new ControllerActionBuilder();
918 controller.setMaxLength(5);
919 ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.build()).build());
920 ab.setKey(new ActionKey(0));
921 actionList.add(ab.build());
922 // Create an Apply Action
923 ApplyActionsBuilder aab = new ApplyActionsBuilder();
924 aab.setAction(actionList);
926 // Wrap our Apply Action in an Instruction
927 InstructionBuilder ib = new InstructionBuilder();
928 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
930 // Put our Instruction in a list of Instructions
931 InstructionsBuilder isb = new InstructionsBuilder();
932 List<Instruction> instructions = new ArrayList<Instruction>();
933 ib.setKey(new InstructionKey(0));
934 instructions.add(ib.build());
935 isb.setInstruction(instructions);
939 private static InstructionsBuilder createAppyActionInstruction1() {
941 List<Action> actionList = new ArrayList<Action>();
942 ActionBuilder ab = new ActionBuilder();
944 OutputActionBuilder output = new OutputActionBuilder();
945 output.setMaxLength(56);
946 Uri value = new Uri("PCEP");
947 output.setOutputNodeConnector(value);
948 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
949 ab.setKey(new ActionKey(0));
950 actionList.add(ab.build());
951 // Create an Apply Action
952 ApplyActionsBuilder aab = new ApplyActionsBuilder();
953 aab.setAction(actionList);
955 // Wrap our Apply Action in an Instruction
956 InstructionBuilder ib = new InstructionBuilder();
957 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
959 // Put our Instruction in a list of Instructions
960 InstructionsBuilder isb = new InstructionsBuilder();
961 List<Instruction> instructions = new ArrayList<Instruction>();
962 ib.setKey(new InstructionKey(0));
963 instructions.add(ib.build());
964 isb.setInstruction(instructions);
968 private static InstructionsBuilder createOutputInstructions() {
970 // test case for Output Port works if the particular port exists
971 // this particular test-case is for Port : 1
972 // tested as (addMDFlow openflow:<dpid> f82)
973 List<Action> actionList = new ArrayList<Action>();
974 ActionBuilder ab = new ActionBuilder();
975 OutputActionBuilder output = new OutputActionBuilder();
977 Uri value = new Uri("1");
978 output.setOutputNodeConnector(value);
979 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
981 ab.setKey(new ActionKey(0));
982 actionList.add(ab.build());
983 // Create an Apply Action
984 ApplyActionsBuilder aab = new ApplyActionsBuilder();
985 aab.setAction(actionList);
987 // Wrap our Apply Action in an Instruction
988 InstructionBuilder ib = new InstructionBuilder();
989 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
991 ib.setKey(new InstructionKey(0));
993 // Put our Instruction in a list of Instructions
994 InstructionsBuilder isb = new InstructionsBuilder();
995 List<Instruction> instructions = new ArrayList<Instruction>();
996 instructions.add(ib.build());
997 isb.setInstruction(instructions);
1001 private static InstructionsBuilder createSentToControllerInstructions() {
1002 List<Action> actionList = new ArrayList<Action>();
1003 ActionBuilder ab = new ActionBuilder();
1005 OutputActionBuilder output = new OutputActionBuilder();
1006 output.setMaxLength(new Integer(0xffff));
1007 Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
1008 output.setOutputNodeConnector(value);
1009 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
1011 ab.setKey(new ActionKey(0));
1012 actionList.add(ab.build());
1013 // Create an Apply Action
1014 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1015 aab.setAction(actionList);
1017 // Wrap our Apply Action in an Instruction
1018 InstructionBuilder ib = new InstructionBuilder();
1019 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1021 ib.setKey(new InstructionKey(0));
1023 // Put our Instruction in a list of Instructions
1024 InstructionsBuilder isb = new InstructionsBuilder();
1025 List<Instruction> instructions = new ArrayList<Instruction>();
1026 instructions.add(ib.build());
1027 isb.setInstruction(instructions);
1031 private static InstructionsBuilder createOutputInstructions(String outputType, int outputValue) {
1032 List<Action> actionList = new ArrayList<Action>();
1033 ActionBuilder ab = new ActionBuilder();
1035 OutputActionBuilder output = new OutputActionBuilder();
1036 output.setMaxLength(outputValue);
1037 Uri value = new Uri(outputType);
1038 output.setOutputNodeConnector(value);
1039 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
1041 ab.setKey(new ActionKey(0));
1042 actionList.add(ab.build());
1043 // Create an Apply Action
1044 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1045 aab.setAction(actionList);
1047 // Wrap our Apply Action in an Instruction
1048 InstructionBuilder ib = new InstructionBuilder();
1049 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1051 ib.setKey(new InstructionKey(0));
1053 // Put our Instruction in a list of Instructions
1054 InstructionsBuilder isb = new InstructionsBuilder();
1055 List<Instruction> instructions = new ArrayList<Instruction>();
1056 instructions.add(ib.build());
1057 isb.setInstruction(instructions);
1061 private static InstructionsBuilder createStripVlanInstructions() {
1062 List<Action> actionList = new ArrayList<Action>();
1063 ActionBuilder ab = new ActionBuilder();
1065 StripVlanActionBuilder stripActionBuilder = new StripVlanActionBuilder();
1066 ab.setAction(new StripVlanActionCaseBuilder().setStripVlanAction(stripActionBuilder.build()).build());
1068 ab.setKey(new ActionKey(0));
1069 actionList.add(ab.build());
1070 // Create an Apply Action
1071 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1072 aab.setAction(actionList);
1074 // Wrap our Apply Action in an Instruction
1075 InstructionBuilder ib = new InstructionBuilder();
1076 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1078 ib.setKey(new InstructionKey(0));
1080 // Put our Instruction in a list of Instructions
1081 InstructionsBuilder isb = new InstructionsBuilder();
1082 List<Instruction> instructions = new ArrayList<Instruction>();
1083 instructions.add(ib.build());
1084 isb.setInstruction(instructions);
1088 private static InstructionsBuilder createAppyActionInstruction2() {
1090 List<Action> actionList = new ArrayList<Action>();
1091 ActionBuilder ab = new ActionBuilder();
1093 PushMplsActionBuilder push = new PushMplsActionBuilder();
1094 push.setEthernetType(new Integer(0x8847));
1095 ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
1096 ab.setKey(new ActionKey(0));
1097 actionList.add(ab.build());
1098 // Create an Apply Action
1099 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1100 aab.setAction(actionList);
1102 // Wrap our Apply Action in an Instruction
1103 InstructionBuilder ib = new InstructionBuilder();
1104 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1106 // Put our Instruction in a list of Instructions
1107 InstructionsBuilder isb = new InstructionsBuilder();
1108 List<Instruction> instructions = new ArrayList<Instruction>();
1109 ib.setKey(new InstructionKey(0));
1110 instructions.add(ib.build());
1111 isb.setInstruction(instructions);
1115 private static InstructionsBuilder createAppyActionInstruction3() {
1117 List<Action> actionList = new ArrayList<Action>();
1118 ActionBuilder ab = new ActionBuilder();
1120 PushPbbActionBuilder pbb = new PushPbbActionBuilder();
1121 pbb.setEthernetType(new Integer(0x88E7));
1122 ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
1123 ab.setKey(new ActionKey(0));
1124 actionList.add(ab.build());
1125 // Create an Apply Action
1126 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1127 aab.setAction(actionList);
1129 // Wrap our Apply Action in an Instruction
1130 InstructionBuilder ib = new InstructionBuilder();
1131 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1133 // Put our Instruction in a list of Instructions
1134 InstructionsBuilder isb = new InstructionsBuilder();
1135 List<Instruction> instructions = new ArrayList<Instruction>();
1136 ib.setKey(new InstructionKey(0));
1137 instructions.add(ib.build());
1138 isb.setInstruction(instructions);
1142 private static InstructionsBuilder createAppyActionInstruction4() {
1144 List<Action> actionList = new ArrayList<Action>();
1145 ActionBuilder ab = new ActionBuilder();
1147 PushVlanActionBuilder vlan = new PushVlanActionBuilder();
1148 vlan.setEthernetType(new Integer(0x8100));
1149 ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
1150 ab.setKey(new ActionKey(0));
1151 actionList.add(ab.build());
1153 // Create an Apply Action
1154 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1155 aab.setAction(actionList);
1157 // Wrap our Apply Action in an Instruction
1158 InstructionBuilder ib = new InstructionBuilder();
1159 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1161 // Put our Instruction in a list of Instructions
1162 InstructionsBuilder isb = new InstructionsBuilder();
1163 List<Instruction> instructions = new ArrayList<Instruction>();
1164 ib.setKey(new InstructionKey(0));
1165 instructions.add(ib.build());
1166 isb.setInstruction(instructions);
1170 private static InstructionsBuilder createAppyActionInstruction5() {
1172 List<Action> actionList = new ArrayList<Action>();
1173 ActionBuilder ab = new ActionBuilder();
1175 SetDlDstActionBuilder setdl = new SetDlDstActionBuilder();
1176 setdl.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1177 ab.setAction(new SetDlDstActionCaseBuilder().setSetDlDstAction(setdl.build()).build());
1178 ab.setKey(new ActionKey(0));
1179 actionList.add(ab.build());
1180 // Create an Apply Action
1181 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1182 aab.setAction(actionList);
1184 // Wrap our Apply Action in an Instruction
1185 InstructionBuilder ib = new InstructionBuilder();
1186 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1188 // Put our Instruction in a list of Instructions
1189 InstructionsBuilder isb = new InstructionsBuilder();
1190 List<Instruction> instructions = new ArrayList<Instruction>();
1191 ib.setKey(new InstructionKey(0));
1192 instructions.add(ib.build());
1193 isb.setInstruction(instructions);
1197 private static InstructionsBuilder createAppyActionInstruction6() {
1199 List<Action> actionList = new ArrayList<Action>();
1200 ActionBuilder ab = new ActionBuilder();
1202 SetDlSrcActionBuilder src = new SetDlSrcActionBuilder();
1203 src.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1204 ab.setAction(new SetDlSrcActionCaseBuilder().setSetDlSrcAction(src.build()).build());
1205 ab.setKey(new ActionKey(0));
1206 actionList.add(ab.build());
1208 // Create an Apply Action
1209 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1210 aab.setAction(actionList);
1212 // Wrap our Apply Action in an Instruction
1213 InstructionBuilder ib = new InstructionBuilder();
1214 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1216 // Put our Instruction in a list of Instructions
1217 InstructionsBuilder isb = new InstructionsBuilder();
1218 List<Instruction> instructions = new ArrayList<Instruction>();
1219 ib.setKey(new InstructionKey(0));
1220 instructions.add(ib.build());
1221 isb.setInstruction(instructions);
1225 private static InstructionsBuilder createAppyActionInstruction7() {
1227 List<Action> actionList = new ArrayList<Action>();
1228 ActionBuilder ab = new ActionBuilder();
1230 SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
1231 VlanId a = new VlanId(4000);
1233 ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
1234 ab.setKey(new ActionKey(0));
1235 actionList.add(ab.build());
1236 // Create an Apply Action
1237 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1238 aab.setAction(actionList);
1240 // Wrap our Apply Action in an Instruction
1241 InstructionBuilder ib = new InstructionBuilder();
1242 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1244 // Put our Instruction in a list of Instructions
1245 InstructionsBuilder isb = new InstructionsBuilder();
1246 List<Instruction> instructions = new ArrayList<Instruction>();
1247 ib.setKey(new InstructionKey(0));
1248 instructions.add(ib.build());
1249 isb.setInstruction(instructions);
1253 private static InstructionsBuilder createAppyActionInstruction8() {
1255 List<Action> actionList = new ArrayList<Action>();
1256 ActionBuilder ab = new ActionBuilder();
1258 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1259 VlanPcp pcp1 = new VlanPcp((short) 2);
1260 pcp.setVlanPcp(pcp1);
1261 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1262 ab.setKey(new ActionKey(0));
1263 actionList.add(ab.build());
1264 // Create an Apply Action
1265 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1266 aab.setAction(actionList);
1268 // Wrap our Apply Action in an Instruction
1269 InstructionBuilder ib = new InstructionBuilder();
1270 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1272 // Put our Instruction in a list of Instructions
1273 InstructionsBuilder isb = new InstructionsBuilder();
1274 List<Instruction> instructions = new ArrayList<Instruction>();
1275 ib.setKey(new InstructionKey(0));
1276 instructions.add(ib.build());
1277 isb.setInstruction(instructions);
1281 private static InstructionsBuilder createAppyActionInstruction88() {
1283 List<Action> actionList = new ArrayList<Action>();
1284 ActionBuilder ab = new ActionBuilder();
1286 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1287 // the code point is a 3-bit(0-7) field representing the frame priority level
1288 VlanPcp pcp1 = new VlanPcp((short) 4);
1289 pcp.setVlanPcp(pcp1);
1290 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1291 ab.setKey(new ActionKey(0));
1292 actionList.add(ab.build());
1293 // Create an Apply Action
1294 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1295 aab.setAction(actionList);
1297 // Wrap our Apply Action in an Instruction
1298 InstructionBuilder ib = new InstructionBuilder();
1299 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1301 // Put our Instruction in a list of Instructions
1302 InstructionsBuilder isb = new InstructionsBuilder();
1303 List<Instruction> instructions = new ArrayList<Instruction>();
1304 ib.setKey(new InstructionKey(0));
1305 instructions.add(ib.build());
1306 isb.setInstruction(instructions);
1310 private static InstructionsBuilder createAppyActionInstruction9() {
1312 List<Action> actionList = new ArrayList<Action>();
1313 ActionBuilder ab = new ActionBuilder();
1315 CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
1316 ab.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
1317 ab.setKey(new ActionKey(0));
1318 actionList.add(ab.build());
1319 // Create an Apply Action
1320 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1321 aab.setAction(actionList);
1323 // Wrap our Apply Action in an Instruction
1324 InstructionBuilder ib = new InstructionBuilder();
1325 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1327 // Put our Instruction in a list of Instructions
1328 InstructionsBuilder isb = new InstructionsBuilder();
1329 List<Instruction> instructions = new ArrayList<Instruction>();
1330 ib.setKey(new InstructionKey(0));
1331 instructions.add(ib.build());
1332 isb.setInstruction(instructions);
1336 private static InstructionsBuilder createAppyActionInstruction10() {
1338 List<Action> actionList = new ArrayList<Action>();
1339 ActionBuilder ab = new ActionBuilder();
1341 CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
1342 ab.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
1343 ab.setKey(new ActionKey(0));
1344 actionList.add(ab.build());
1345 // Create an Apply Action
1346 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1347 aab.setAction(actionList);
1349 // Wrap our Apply Action in an Instruction
1350 InstructionBuilder ib = new InstructionBuilder();
1351 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1353 // Put our Instruction in a list of Instructions
1354 InstructionsBuilder isb = new InstructionsBuilder();
1355 List<Instruction> instructions = new ArrayList<Instruction>();
1356 ib.setKey(new InstructionKey(0));
1357 instructions.add(ib.build());
1358 isb.setInstruction(instructions);
1362 private static InstructionsBuilder createAppyActionInstruction11() {
1364 List<Action> actionList = new ArrayList<Action>();
1365 ActionBuilder ab = new ActionBuilder();
1367 DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
1368 ab.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
1369 ab.setKey(new ActionKey(0));
1370 actionList.add(ab.build());
1371 // Create an Apply Action
1372 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1373 aab.setAction(actionList);
1375 // Wrap our Apply Action in an Instruction
1376 InstructionBuilder ib = new InstructionBuilder();
1377 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1378 ib.setKey(new InstructionKey(0));
1381 // Put our Instruction in a list of Instruction
1382 InstructionsBuilder isb = new InstructionsBuilder();
1383 List<Instruction> instructions = new ArrayList<Instruction>();
1384 instructions.add(ib.build());
1385 isb.setInstruction(instructions);
1389 private static InstructionsBuilder createAppyActionInstruction12() {
1391 List<Action> actionList = new ArrayList<Action>();
1392 ActionBuilder ab = new ActionBuilder();
1394 DecNwTtlBuilder nwttl = new DecNwTtlBuilder();
1395 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(nwttl.build()).build());
1396 ab.setKey(new ActionKey(0));
1397 actionList.add(ab.build());
1399 // Create an Apply Action
1400 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1401 aab.setAction(actionList);
1403 // Wrap our Apply Action in an Instruction
1404 InstructionBuilder ib = new InstructionBuilder();
1405 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1407 // Put our Instruction in a list of Instructions
1408 InstructionsBuilder isb = new InstructionsBuilder();
1409 List<Instruction> instructions = new ArrayList<Instruction>();
1410 ib.setKey(new InstructionKey(0));
1411 instructions.add(ib.build());
1412 isb.setInstruction(instructions);
1416 private static InstructionsBuilder createAppyActionInstruction13() {
1418 List<Action> actionList = new ArrayList<Action>();
1419 ActionBuilder ab = new ActionBuilder();
1421 DropActionBuilder drop = new DropActionBuilder();
1422 ab.setAction(new DropActionCaseBuilder().setDropAction(drop.build()).build());
1423 ab.setKey(new ActionKey(0));
1424 actionList.add(ab.build());
1426 // Create an Apply Action
1427 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1428 aab.setAction(actionList);
1430 // Wrap our Apply Action in an Instruction
1431 InstructionBuilder ib = new InstructionBuilder();
1432 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1434 // Put our Instruction in a list of Instructions
1435 InstructionsBuilder isb = new InstructionsBuilder();
1436 List<Instruction> instructions = new ArrayList<Instruction>();
1437 ib.setKey(new InstructionKey(0));
1438 instructions.add(ib.build());
1439 isb.setInstruction(instructions);
1443 private static InstructionsBuilder createAppyActionInstruction14() {
1445 List<Action> actionList = new ArrayList<Action>();
1446 ActionBuilder ab = new ActionBuilder();
1448 FloodActionBuilder fld = new FloodActionBuilder();
1449 ab.setAction(new FloodActionCaseBuilder().setFloodAction(fld.build()).build());
1450 ab.setKey(new ActionKey(0));
1451 actionList.add(ab.build());
1452 // Create an Apply Action
1453 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1454 aab.setAction(actionList);
1456 // Wrap our Apply Action in an Instruction
1457 InstructionBuilder ib = new InstructionBuilder();
1458 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1460 // Put our Instruction in a list of Instructions
1461 InstructionsBuilder isb = new InstructionsBuilder();
1462 List<Instruction> instructions = new ArrayList<Instruction>();
1463 ib.setKey(new InstructionKey(0));
1464 instructions.add(ib.build());
1465 isb.setInstruction(instructions);
1469 private static InstructionsBuilder createAppyActionInstruction15() {
1471 List<Action> actionList = new ArrayList<Action>();
1472 ActionBuilder ab = new ActionBuilder();
1474 FloodAllActionBuilder fldall = new FloodAllActionBuilder();
1475 ab.setAction(new FloodAllActionCaseBuilder().setFloodAllAction(fldall.build()).build());
1476 ab.setKey(new ActionKey(0));
1477 actionList.add(ab.build());
1478 // Create an Apply Action
1479 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1480 aab.setAction(actionList);
1482 // Wrap our Apply Action in an Instruction
1483 InstructionBuilder ib = new InstructionBuilder();
1484 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1486 // Put our Instruction in a list of Instructions
1487 InstructionsBuilder isb = new InstructionsBuilder();
1488 List<Instruction> instructions = new ArrayList<Instruction>();
1489 ib.setKey(new InstructionKey(0));
1490 instructions.add(ib.build());
1491 isb.setInstruction(instructions);
1495 private static InstructionsBuilder createAppyActionInstruction16() {
1497 List<Action> actionList = new ArrayList<Action>();
1498 ActionBuilder ab = new ActionBuilder();
1500 GroupActionBuilder groupActionB = new GroupActionBuilder();
1501 groupActionB.setGroupId(1L);
1502 groupActionB.setGroup("0");
1503 ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
1504 ab.setKey(new ActionKey(0));
1505 actionList.add(ab.build());
1507 // Create an Apply Action
1508 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1509 aab.setAction(actionList);
1511 // Wrap our Apply Action in an Instruction
1512 InstructionBuilder ib = new InstructionBuilder();
1513 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1515 // Put our Instruction in a list of Instructions
1516 InstructionsBuilder isb = new InstructionsBuilder();
1517 List<Instruction> instructions = new ArrayList<Instruction>();
1518 ib.setKey(new InstructionKey(0));
1519 instructions.add(ib.build());
1520 isb.setInstruction(instructions);
1524 private static InstructionsBuilder createAppyActionInstruction17() {
1526 List<Action> actionList = new ArrayList<Action>();
1527 ActionBuilder ab = new ActionBuilder();
1529 HwPathActionBuilder hwPathB = new HwPathActionBuilder();
1530 ab.setAction(new HwPathActionCaseBuilder().setHwPathAction(hwPathB.build()).build());
1531 ab.setKey(new ActionKey(0));
1532 actionList.add(ab.build());
1533 // Create an Apply Action
1534 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1535 aab.setAction(actionList);
1537 // Wrap our Apply Action in an Instruction
1538 InstructionBuilder ib = new InstructionBuilder();
1539 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1541 // Put our Instruction in a list of Instructions
1542 InstructionsBuilder isb = new InstructionsBuilder();
1543 List<Instruction> instructions = new ArrayList<Instruction>();
1544 ib.setKey(new InstructionKey(0));
1545 instructions.add(ib.build());
1546 isb.setInstruction(instructions);
1550 private static InstructionsBuilder createAppyActionInstruction18() {
1552 List<Action> actionList = new ArrayList<Action>();
1553 ActionBuilder ab = new ActionBuilder();
1555 LoopbackActionBuilder loopbackActionBuilder = new LoopbackActionBuilder();
1556 ab.setAction(new LoopbackActionCaseBuilder().setLoopbackAction(loopbackActionBuilder.build()).build());
1557 ab.setKey(new ActionKey(0));
1558 actionList.add(ab.build());
1560 // Create an Apply Action
1561 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1562 aab.setAction(actionList);
1564 // Wrap our Apply Action in an Instruction
1565 InstructionBuilder ib = new InstructionBuilder();
1566 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1568 // Put our Instruction in a list of Instructions
1569 InstructionsBuilder isb = new InstructionsBuilder();
1570 List<Instruction> instructions = new ArrayList<Instruction>();
1571 ib.setKey(new InstructionKey(0));
1572 instructions.add(ib.build());
1573 isb.setInstruction(instructions);
1577 private static InstructionsBuilder createAppyActionInstruction19() {
1579 List<Action> actionList = new ArrayList<Action>();
1580 ActionBuilder ab = new ActionBuilder();
1582 PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
1583 popMplsActionBuilder.setEthernetType(0XB);
1584 ab.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
1585 ab.setKey(new ActionKey(0));
1586 actionList.add(ab.build());
1587 // Create an Apply Action
1588 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1589 aab.setAction(actionList);
1591 // Wrap our Apply Action in an Instruction
1592 InstructionBuilder ib = new InstructionBuilder();
1593 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1595 // Put our Instruction in a list of Instructions
1596 InstructionsBuilder isb = new InstructionsBuilder();
1597 List<Instruction> instructions = new ArrayList<Instruction>();
1598 ib.setKey(new InstructionKey(0));
1599 instructions.add(ib.build());
1600 isb.setInstruction(instructions);
1604 private static InstructionsBuilder createAppyActionInstruction20() {
1606 List<Action> actionList = new ArrayList<Action>();
1607 ActionBuilder ab = new ActionBuilder();
1609 PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
1610 ab.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
1611 ab.setKey(new ActionKey(0));
1612 actionList.add(ab.build());
1613 // Create an Apply Action
1614 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1615 aab.setAction(actionList);
1617 // Wrap our Apply Action in an Instruction
1618 InstructionBuilder ib = new InstructionBuilder();
1619 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1621 // Put our Instruction in a list of Instructions
1622 InstructionsBuilder isb = new InstructionsBuilder();
1623 List<Instruction> instructions = new ArrayList<Instruction>();
1624 ib.setKey(new InstructionKey(0));
1625 instructions.add(ib.build());
1626 isb.setInstruction(instructions);
1630 private static InstructionsBuilder createAppyActionInstruction21() {
1632 List<Action> actionList = new ArrayList<Action>();
1633 ActionBuilder ab = new ActionBuilder();
1635 PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder();
1636 ab.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(popVlanActionBuilder.build()).build());
1637 ab.setKey(new ActionKey(0));
1638 actionList.add(ab.build());
1640 // Create an Apply Action
1641 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1642 aab.setAction(actionList);
1644 // Wrap our Apply Action in an Instruction
1645 InstructionBuilder ib = new InstructionBuilder();
1646 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1648 // Put our Instruction in a list of Instructions
1649 InstructionsBuilder isb = new InstructionsBuilder();
1650 List<Instruction> instructions = new ArrayList<Instruction>();
1651 ib.setKey(new InstructionKey(0));
1652 instructions.add(ib.build());
1653 isb.setInstruction(instructions);
1657 private static InstructionsBuilder createAppyActionInstruction22() {
1659 List<Action> actionList = new ArrayList<Action>();
1660 ActionBuilder ab = new ActionBuilder();
1662 SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
1663 setDlTypeActionBuilder.setDlType(new EtherType(8L));
1664 ab.setAction(new SetDlTypeActionCaseBuilder().setSetDlTypeAction(setDlTypeActionBuilder.build()).build());
1665 ab.setKey(new ActionKey(0));
1666 actionList.add(ab.build());
1668 // Create an Apply Action
1669 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1670 aab.setAction(actionList);
1672 // Wrap our Apply Action in an Instruction
1673 InstructionBuilder ib = new InstructionBuilder();
1674 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1676 // Put our Instruction in a list of Instructions
1677 InstructionsBuilder isb = new InstructionsBuilder();
1678 List<Instruction> instructions = new ArrayList<Instruction>();
1679 ib.setKey(new InstructionKey(0));
1680 instructions.add(ib.build());
1681 isb.setInstruction(instructions);
1685 private static InstructionsBuilder createAppyActionInstruction23(NodeId nodeId) {
1687 List<Action> actionList = new ArrayList<Action>();
1688 ActionBuilder ab = new ActionBuilder();
1690 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1691 setFieldBuilder.setInPort(new NodeConnectorId(nodeId + ":2"));
1692 ab.setKey(new ActionKey(0));
1693 actionList.add(ab.build());
1695 // Create an Apply Action
1696 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1697 aab.setAction(actionList);
1699 // Wrap our Apply Action in an Instruction
1700 InstructionBuilder ib = new InstructionBuilder();
1701 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1703 // Put our Instruction in a list of Instructions
1704 InstructionsBuilder isb = new InstructionsBuilder();
1705 List<Instruction> instructions = new ArrayList<Instruction>();
1706 ib.setKey(new InstructionKey(0));
1707 instructions.add(ib.build());
1708 isb.setInstruction(instructions);
1712 private static InstructionsBuilder createAppyActionInstruction24() {
1714 List<Action> actionList = new ArrayList<Action>();
1715 ActionBuilder ab = new ActionBuilder();
1717 SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
1718 setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
1719 ab.setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(setMplsTtlActionBuilder.build()).build());
1720 ab.setKey(new ActionKey(0));
1721 actionList.add(ab.build());
1723 // Create an Apply Action
1724 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1725 aab.setAction(actionList);
1727 // Wrap our Apply Action in an Instruction
1728 InstructionBuilder ib = new InstructionBuilder();
1729 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1731 // Put our Instruction in a list of Instructions
1732 InstructionsBuilder isb = new InstructionsBuilder();
1733 List<Instruction> instructions = new ArrayList<Instruction>();
1734 ib.setKey(new InstructionKey(0));
1735 instructions.add(ib.build());
1736 isb.setInstruction(instructions);
1740 private static InstructionsBuilder createAppyActionInstruction25() {
1742 List<Action> actionList = new ArrayList<Action>();
1743 ActionBuilder ab = new ActionBuilder();
1745 SetNextHopActionBuilder setNextHopActionBuilder = new SetNextHopActionBuilder();
1746 Ipv4Builder ipnext = new Ipv4Builder();
1747 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
1748 ipnext.setIpv4Address(prefix);
1749 setNextHopActionBuilder.setAddress(ipnext.build());
1750 ab.setAction(new SetNextHopActionCaseBuilder().setSetNextHopAction(setNextHopActionBuilder.build()).build());
1751 ab.setKey(new ActionKey(0));
1752 actionList.add(ab.build());
1754 // Create an Apply Action
1755 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1756 aab.setAction(actionList);
1758 // Wrap our Apply Action in an Instruction
1759 InstructionBuilder ib = new InstructionBuilder();
1760 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1762 // Put our Instruction in a list of Instructions
1763 InstructionsBuilder isb = new InstructionsBuilder();
1764 List<Instruction> instructions = new ArrayList<Instruction>();
1765 ib.setKey(new InstructionKey(0));
1766 instructions.add(ib.build());
1767 isb.setInstruction(instructions);
1771 private static InstructionsBuilder createAppyActionInstruction26() {
1773 List<Action> actionList = new ArrayList<Action>();
1774 ActionBuilder ab = new ActionBuilder();
1776 SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
1777 Ipv4Builder ipdst = new Ipv4Builder();
1778 Ipv4Prefix prefixdst = new Ipv4Prefix("10.0.0.21/24");
1779 ipdst.setIpv4Address(prefixdst);
1780 setNwDstActionBuilder.setAddress(ipdst.build());
1781 ab.setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build());
1782 ab.setKey(new ActionKey(0));
1783 actionList.add(ab.build());
1785 // Create an Apply Action
1786 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1787 aab.setAction(actionList);
1789 // Wrap our Apply Action in an Instruction
1790 InstructionBuilder ib = new InstructionBuilder();
1791 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1793 // Put our Instruction in a list of Instructions
1794 InstructionsBuilder isb = new InstructionsBuilder();
1795 List<Instruction> instructions = new ArrayList<Instruction>();
1796 ib.setKey(new InstructionKey(0));
1797 instructions.add(ib.build());
1798 isb.setInstruction(instructions);
1802 private static InstructionsBuilder createAppyActionInstruction27() {
1804 List<Action> actionList = new ArrayList<Action>();
1805 ActionBuilder ab = new ActionBuilder();
1807 SetNwSrcActionBuilder setNwsrcActionBuilder = new SetNwSrcActionBuilder();
1808 Ipv4Builder ipsrc = new Ipv4Builder();
1809 Ipv4Prefix prefixsrc = new Ipv4Prefix("10.0.23.21/24");
1810 ipsrc.setIpv4Address(prefixsrc);
1811 setNwsrcActionBuilder.setAddress(ipsrc.build());
1812 ab.setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwsrcActionBuilder.build()).build());
1813 ab.setKey(new ActionKey(0));
1814 actionList.add(ab.build());
1816 // Create an Apply Action
1817 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1818 aab.setAction(actionList);
1820 // Wrap our Apply Action in an Instruction
1821 InstructionBuilder ib = new InstructionBuilder();
1822 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1824 // Put our Instruction in a list of Instructions
1825 InstructionsBuilder isb = new InstructionsBuilder();
1826 List<Instruction> instructions = new ArrayList<Instruction>();
1827 ib.setKey(new InstructionKey(0));
1828 instructions.add(ib.build());
1829 isb.setInstruction(instructions);
1833 private static InstructionsBuilder createAppyActionInstruction28() {
1835 List<Action> actionList = new ArrayList<Action>();
1836 ActionBuilder ab = new ActionBuilder();
1838 SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
1839 setNwTosActionBuilder.setTos(8);
1840 ab.setAction(new SetNwTosActionCaseBuilder().setSetNwTosAction(setNwTosActionBuilder.build()).build());
1841 ab.setKey(new ActionKey(0));
1842 actionList.add(ab.build());
1843 // Create an Apply Action
1844 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1845 aab.setAction(actionList);
1847 // Wrap our Apply Action in an Instruction
1848 InstructionBuilder ib = new InstructionBuilder();
1849 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1851 // Put our Instruction in a list of Instructions
1852 InstructionsBuilder isb = new InstructionsBuilder();
1853 List<Instruction> instructions = new ArrayList<Instruction>();
1854 ib.setKey(new InstructionKey(0));
1855 instructions.add(ib.build());
1856 isb.setInstruction(instructions);
1860 private static InstructionsBuilder createAppyActionInstruction29() {
1862 List<Action> actionList = new ArrayList<Action>();
1863 ActionBuilder ab = new ActionBuilder();
1865 SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
1866 setNwTtlActionBuilder.setNwTtl((short) 1);
1867 ab.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
1868 ab.setKey(new ActionKey(0));
1869 actionList.add(ab.build());
1871 // Create an Apply Action
1872 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1873 aab.setAction(actionList);
1875 // Wrap our Apply Action in an Instruction
1876 InstructionBuilder ib = new InstructionBuilder();
1877 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1879 // Put our Instruction in a list of Instructions
1880 InstructionsBuilder isb = new InstructionsBuilder();
1881 List<Instruction> instructions = new ArrayList<Instruction>();
1882 ib.setKey(new InstructionKey(0));
1883 instructions.add(ib.build());
1884 isb.setInstruction(instructions);
1888 private static InstructionsBuilder createAppyActionInstruction30() {
1890 List<Action> actionList = new ArrayList<Action>();
1891 ActionBuilder ab = new ActionBuilder();
1893 SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
1894 setQueueActionBuilder.setQueueId(1L);
1895 ab.setAction(new SetQueueActionCaseBuilder().setSetQueueAction(setQueueActionBuilder.build()).build());
1896 ab.setKey(new ActionKey(0));
1897 actionList.add(ab.build());
1898 // Create an Apply Action
1899 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1900 aab.setAction(actionList);
1902 // Wrap our Apply Action in an Instruction
1903 InstructionBuilder ib = new InstructionBuilder();
1904 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1906 // Put our Instruction in a list of Instructions
1907 InstructionsBuilder isb = new InstructionsBuilder();
1908 List<Instruction> instructions = new ArrayList<Instruction>();
1909 ib.setKey(new InstructionKey(0));
1910 instructions.add(ib.build());
1911 isb.setInstruction(instructions);
1915 private static InstructionsBuilder createAppyActionInstruction31() {
1917 List<Action> actionList = new ArrayList<Action>();
1918 ActionBuilder ab = new ActionBuilder();
1920 SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
1921 setTpDstActionBuilder.setPort(new PortNumber(109));
1923 ab.setAction(new SetTpDstActionCaseBuilder().setSetTpDstAction(setTpDstActionBuilder.build()).build());
1924 ab.setKey(new ActionKey(0));
1925 actionList.add(ab.build());
1926 // Create an Apply Action
1927 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1928 aab.setAction(actionList);
1930 // Wrap our Apply Action in an Instruction
1931 InstructionBuilder ib = new InstructionBuilder();
1932 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1934 // Put our Instruction in a list of Instructions
1935 InstructionsBuilder isb = new InstructionsBuilder();
1936 List<Instruction> instructions = new ArrayList<Instruction>();
1937 ib.setKey(new InstructionKey(0));
1938 instructions.add(ib.build());
1939 isb.setInstruction(instructions);
1943 private static InstructionsBuilder createAppyActionInstruction32() {
1945 List<Action> actionList = new ArrayList<Action>();
1946 ActionBuilder ab = new ActionBuilder();
1948 SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
1949 setTpSrcActionBuilder.setPort(new PortNumber(109));
1950 ab.setAction(new SetTpSrcActionCaseBuilder().setSetTpSrcAction(setTpSrcActionBuilder.build()).build());
1951 ab.setKey(new ActionKey(0));
1952 actionList.add(ab.build());
1954 // Create an Apply Action
1955 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1956 aab.setAction(actionList);
1958 // Wrap our Apply Action in an Instruction
1959 InstructionBuilder ib = new InstructionBuilder();
1960 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1962 // Put our Instruction in a list of Instructions
1963 InstructionsBuilder isb = new InstructionsBuilder();
1964 List<Instruction> instructions = new ArrayList<Instruction>();
1965 ib.setKey(new InstructionKey(0));
1966 instructions.add(ib.build());
1967 isb.setInstruction(instructions);
1971 private static InstructionsBuilder createAppyActionInstruction33() {
1973 List<Action> actionList = new ArrayList<Action>();
1974 ActionBuilder ab = new ActionBuilder();
1976 SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
1977 setVlanCfiActionBuilder.setVlanCfi(new VlanCfi(2));
1978 ab.setAction(new SetVlanCfiActionCaseBuilder().setSetVlanCfiAction(setVlanCfiActionBuilder.build()).build());
1979 ab.setKey(new ActionKey(0));
1980 actionList.add(ab.build());
1982 // Create an Apply Action
1983 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1984 aab.setAction(actionList);
1986 // Wrap our Apply Action in an Instruction
1987 InstructionBuilder ib = new InstructionBuilder();
1988 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1990 // Put our Instruction in a list of Instructions
1991 InstructionsBuilder isb = new InstructionsBuilder();
1992 List<Instruction> instructions = new ArrayList<Instruction>();
1993 ib.setKey(new InstructionKey(0));
1994 instructions.add(ib.build());
1995 isb.setInstruction(instructions);
1999 private static InstructionsBuilder createAppyActionInstruction34() {
2001 List<Action> actionList = new ArrayList<Action>();
2002 ActionBuilder ab = new ActionBuilder();
2004 SwPathActionBuilder swPathAction = new SwPathActionBuilder();
2005 ab.setAction(new SwPathActionCaseBuilder().setSwPathAction(swPathAction.build()).build());
2006 ab.setKey(new ActionKey(0));
2007 actionList.add(ab.build());
2009 // Create an Apply Action
2010 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2011 aab.setAction(actionList);
2013 // Wrap our Apply Action in an Instruction
2014 InstructionBuilder ib = new InstructionBuilder();
2015 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2017 // Put our Instruction in a list of Instructions
2018 InstructionsBuilder isb = new InstructionsBuilder();
2019 List<Instruction> instructions = new ArrayList<Instruction>();
2020 ib.setKey(new InstructionKey(0));
2021 instructions.add(ib.build());
2022 isb.setInstruction(instructions);
2026 private static InstructionsBuilder createAppyActionInstruction35() {
2028 List<Action> actionList = new ArrayList<Action>();
2029 ActionBuilder ab = new ActionBuilder();
2030 ActionBuilder ab1 = new ActionBuilder();
2031 ActionBuilder ab2 = new ActionBuilder();
2033 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2034 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2035 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2038 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
2039 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
2040 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
2041 EthernetMatchBuilder ethernetMatch1 = new EthernetMatchBuilder();
2042 EthernetDestinationBuilder ethDestBuilder = new EthernetDestinationBuilder();
2043 ethDestBuilder.setAddress(new MacAddress("00:00:00:00:00:02"));
2044 EthernetMatchBuilder ethernetMatch2 = new EthernetMatchBuilder();
2045 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2046 ethTypeBuilder.setType(new EtherType(0x86ddL));
2048 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
2049 ethernetMatch1.setEthernetDestination(ethDestBuilder.build());
2050 ethernetMatch2.setEthernetType(ethTypeBuilder.build());
2051 setFieldBuilder.setEthernetMatch(ethernetMatch.build());
2052 setFieldBuilder1.setEthernetMatch(ethernetMatch1.build());
2053 setFieldBuilder2.setEthernetMatch(ethernetMatch2.build());
2054 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2055 ab.setKey(new ActionKey(0));
2056 actionList.add(ab.build());
2058 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2059 ab1.setKey(new ActionKey(1));
2060 actionList.add(ab1.build());
2062 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2063 ab2.setKey(new ActionKey(2));
2064 actionList.add(ab2.build());
2066 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2067 aab.setAction(actionList);
2069 InstructionBuilder ib = new InstructionBuilder();
2070 ib.setKey(new InstructionKey(0));
2071 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2073 // Put our Instruction in a list of Instructions
2074 InstructionsBuilder isb = new InstructionsBuilder();
2075 List<Instruction> instructions = new ArrayList<Instruction>();
2076 ib.setKey(new InstructionKey(0));
2077 instructions.add(ib.build());
2078 isb.setInstruction(instructions);
2082 private static InstructionsBuilder createAppyActionInstruction36() {
2084 List<Action> actionList = new ArrayList<Action>();
2085 ActionBuilder ab = new ActionBuilder();
2086 ActionBuilder ab1 = new ActionBuilder();
2088 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2089 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2092 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
2093 VlanMatchBuilder vlanBuilder1 = new VlanMatchBuilder();
2094 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
2095 VlanId vlanId = new VlanId(10);
2096 VlanPcp vpcp = new VlanPcp((short) 3);
2097 vlanBuilder.setVlanPcp(vpcp);
2098 vlanBuilder1.setVlanId(vlanIdBuilder.setVlanId(vlanId).setVlanIdPresent(true).build());
2099 setFieldBuilder.setVlanMatch(vlanBuilder.build());
2100 setFieldBuilder1.setVlanMatch(vlanBuilder1.build());
2101 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2102 ab.setKey(new ActionKey(0));
2103 actionList.add(ab.build());
2104 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2105 ab1.setKey(new ActionKey(1));
2106 actionList.add(ab1.build());
2108 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2109 aab.setAction(actionList);
2111 InstructionBuilder ib = new InstructionBuilder();
2112 ib.setKey(new InstructionKey(0));
2113 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2115 // Put our Instruction in a list of Instructions
2116 InstructionsBuilder isb = new InstructionsBuilder();
2117 List<Instruction> instructions = new ArrayList<Instruction>();
2118 instructions.add(ib.build());
2119 isb.setInstruction(instructions);
2123 private static InstructionsBuilder createAppyActionInstruction37() {
2125 List<Action> actionList = new ArrayList<Action>();
2126 ActionBuilder ab = new ActionBuilder();
2127 ActionBuilder ab1 = new ActionBuilder();
2128 ActionBuilder ab2 = new ActionBuilder();
2130 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2131 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2132 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2134 IpMatchBuilder ipmatch = new IpMatchBuilder();
2135 IpMatchBuilder ipmatch1 = new IpMatchBuilder();
2136 IpMatchBuilder ipmatch2 = new IpMatchBuilder();
2137 Dscp dscp = new Dscp((short) 3);
2138 ipmatch.setIpDscp(dscp);
2139 ipmatch1.setIpEcn((short) 2);
2140 ipmatch2.setIpProtocol((short) 120);
2141 setFieldBuilder.setIpMatch(ipmatch.build());
2142 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2143 ab.setKey(new ActionKey(0));
2144 actionList.add(ab.build());
2146 setFieldBuilder1.setIpMatch(ipmatch1.build());
2147 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2148 ab1.setKey(new ActionKey(1));
2149 actionList.add(ab1.build());
2151 setFieldBuilder2.setIpMatch(ipmatch2.build());
2152 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2153 ab2.setKey(new ActionKey(2));
2154 actionList.add(ab2.build());
2156 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2157 aab.setAction(actionList);
2159 InstructionBuilder ib = new InstructionBuilder();
2160 ib.setKey(new InstructionKey(0));
2161 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2163 // Put our Instruction in a list of Instructions
2164 InstructionsBuilder isb = new InstructionsBuilder();
2165 List<Instruction> instructions = new ArrayList<Instruction>();
2166 instructions.add(ib.build());
2167 isb.setInstruction(instructions);
2171 private static InstructionsBuilder createAppyActionInstruction38() {
2173 List<Action> actionList = new ArrayList<Action>();
2174 ActionBuilder ab = new ActionBuilder();
2175 ActionBuilder ab1 = new ActionBuilder();
2177 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2178 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2180 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2181 Ipv4MatchBuilder ipv4Match1 = new Ipv4MatchBuilder();
2182 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.5210");
2183 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1");
2184 ipv4Match1.setIpv4Destination(dstip);
2185 ipv4Match.setIpv4Source(srcip);
2186 setFieldBuilder.setLayer3Match(ipv4Match.build());
2187 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2188 ab.setKey(new ActionKey(0));
2189 actionList.add(ab.build());
2191 setFieldBuilder1.setLayer3Match(ipv4Match1.build());
2192 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2193 ab1.setKey(new ActionKey(1));
2194 actionList.add(ab1.build());
2196 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2197 aab.setAction(actionList);
2199 InstructionBuilder ib = new InstructionBuilder();
2200 ib.setKey(new InstructionKey(0));
2201 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2203 // Put our Instruction in a list of Instructions
2204 InstructionsBuilder isb = new InstructionsBuilder();
2205 List<Instruction> instructions = new ArrayList<Instruction>();
2206 instructions.add(ib.build());
2207 isb.setInstruction(instructions);
2211 private static InstructionsBuilder createAppyActionInstruction39() {
2213 List<Action> actionList = new ArrayList<Action>();
2214 ActionBuilder ab = new ActionBuilder();
2215 ActionBuilder ab1 = new ActionBuilder();
2217 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2218 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2221 PortNumber tcpsrcport = new PortNumber(1213);
2222 PortNumber tcpdstport = new PortNumber(646);
2223 TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
2224 TcpMatchBuilder tcpmatch1 = new TcpMatchBuilder();
2225 tcpmatch.setTcpSourcePort(tcpsrcport);
2226 tcpmatch1.setTcpDestinationPort(tcpdstport);
2227 setFieldBuilder.setLayer4Match(tcpmatch.build());
2228 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2229 ab.setKey(new ActionKey(0));
2230 actionList.add(ab.build());
2232 setFieldBuilder1.setLayer4Match(tcpmatch1.build());
2233 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2234 ab1.setKey(new ActionKey(1));
2235 actionList.add(ab.build());
2237 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2238 aab.setAction(actionList);
2240 InstructionBuilder ib = new InstructionBuilder();
2241 ib.setKey(new InstructionKey(0));
2242 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2244 // Put our Instruction in a list of Instructions
2245 InstructionsBuilder isb = new InstructionsBuilder();
2246 List<Instruction> instructions = new ArrayList<Instruction>();
2247 instructions.add(ib.build());
2248 isb.setInstruction(instructions);
2252 private static InstructionsBuilder createAppyActionInstruction40() {
2254 List<Action> actionList = new ArrayList<Action>();
2255 ActionBuilder ab = new ActionBuilder();
2256 ActionBuilder ab1 = new ActionBuilder();
2258 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2259 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2262 PortNumber udpsrcport = new PortNumber(1325);
2263 PortNumber udpdstport = new PortNumber(42);
2264 UdpMatchBuilder udpmatch = new UdpMatchBuilder();
2265 UdpMatchBuilder udpmatch1 = new UdpMatchBuilder();
2266 udpmatch.setUdpDestinationPort(udpdstport);
2267 udpmatch1.setUdpSourcePort(udpsrcport);
2268 setFieldBuilder.setLayer4Match(udpmatch.build());
2269 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2270 ab.setKey(new ActionKey(0));
2271 actionList.add(ab.build());
2273 setFieldBuilder1.setLayer4Match(udpmatch1.build());
2274 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2275 ab1.setKey(new ActionKey(1));
2276 actionList.add(ab1.build());
2278 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2279 aab.setAction(actionList);
2281 InstructionBuilder ib = new InstructionBuilder();
2282 ib.setKey(new InstructionKey(0));
2283 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2285 // Put our Instruction in a list of Instructions
2286 InstructionsBuilder isb = new InstructionsBuilder();
2287 List<Instruction> instructions = new ArrayList<Instruction>();
2288 instructions.add(ib.build());
2289 isb.setInstruction(instructions);
2293 private static InstructionsBuilder createAppyActionInstruction41() {
2295 List<Action> actionList = new ArrayList<Action>();
2296 ActionBuilder ab = new ActionBuilder();
2297 ActionBuilder ab1 = new ActionBuilder();
2299 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2300 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2303 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
2304 SctpMatchBuilder sctpmatch1 = new SctpMatchBuilder();
2305 PortNumber srcport = new PortNumber(1435);
2306 PortNumber dstport = new PortNumber(22);
2307 sctpmatch.setSctpSourcePort(srcport);
2308 sctpmatch1.setSctpDestinationPort(dstport);
2309 setFieldBuilder.setLayer4Match(sctpmatch.build());
2310 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2311 ab.setKey(new ActionKey(0));
2312 actionList.add(ab.build());
2314 setFieldBuilder1.setLayer4Match(sctpmatch1.build());
2315 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2316 ab1.setKey(new ActionKey(1));
2317 actionList.add(ab1.build());
2319 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2320 aab.setAction(actionList);
2322 InstructionBuilder ib = new InstructionBuilder();
2323 ib.setKey(new InstructionKey(0));
2324 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2326 // Put our Instruction in a list of Instructions
2327 InstructionsBuilder isb = new InstructionsBuilder();
2328 List<Instruction> instructions = new ArrayList<Instruction>();
2329 instructions.add(ib.build());
2330 isb.setInstruction(instructions);
2334 private static InstructionsBuilder createAppyActionInstruction42() {
2336 List<Action> actionList = new ArrayList<Action>();
2337 ActionBuilder ab = new ActionBuilder();
2338 ActionBuilder ab1 = new ActionBuilder();
2339 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2340 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2343 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
2344 Icmpv4MatchBuilder icmpv4match1 = new Icmpv4MatchBuilder();
2345 icmpv4match.setIcmpv4Type((short) 8);
2346 icmpv4match1.setIcmpv4Code((short) 0);
2347 setFieldBuilder.setIcmpv4Match(icmpv4match.build());
2348 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2349 ab.setKey(new ActionKey(0));
2350 actionList.add(ab.build());
2352 setFieldBuilder1.setIcmpv4Match(icmpv4match1.build());
2353 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2354 ab1.setKey(new ActionKey(1));
2355 actionList.add(ab1.build());
2357 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2358 aab.setAction(actionList);
2360 InstructionBuilder ib = new InstructionBuilder();
2361 ib.setKey(new InstructionKey(0));
2362 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2364 // Put our Instruction in a list of Instructions
2365 InstructionsBuilder isb = new InstructionsBuilder();
2366 List<Instruction> instructions = new ArrayList<Instruction>();
2367 instructions.add(ib.build());
2368 isb.setInstruction(instructions);
2372 private static InstructionsBuilder createAppyActionInstruction43() {
2374 List<Action> actionList = new ArrayList<Action>();
2375 ActionBuilder ab = new ActionBuilder();
2376 ActionBuilder ab1 = new ActionBuilder();
2377 ActionBuilder ab2 = new ActionBuilder();
2378 ActionBuilder ab3 = new ActionBuilder();
2379 ActionBuilder ab4 = new ActionBuilder();
2381 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2382 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2383 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2384 SetFieldBuilder setFieldBuilder3 = new SetFieldBuilder();
2385 SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder();
2387 // setting the values of ARP
2388 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2389 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2390 Ipv4Prefix dstiparp = new Ipv4Prefix("200.71.9.52");
2391 Ipv4Prefix srciparp = new Ipv4Prefix("100.1.1.1");
2392 // create ARP match action
2393 ArpMatchBuilder arpmatch = new ArpMatchBuilder();
2394 ArpMatchBuilder arpmatch1 = new ArpMatchBuilder();
2395 ArpMatchBuilder arpmatch2 = new ArpMatchBuilder();
2396 ArpMatchBuilder arpmatch3 = new ArpMatchBuilder();
2397 ArpMatchBuilder arpmatch4 = new ArpMatchBuilder();
2398 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2399 arpsrc.setAddress(macsrc);
2400 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2401 arpdst.setAddress(macdest);
2402 arpmatch.setArpOp(2);
2403 arpmatch1.setArpSourceHardwareAddress(arpsrc.build());
2404 arpmatch2.setArpTargetHardwareAddress(arpdst.build());
2405 arpmatch3.setArpSourceTransportAddress(srciparp);
2406 arpmatch4.setArpTargetTransportAddress(dstiparp);
2407 setFieldBuilder.setLayer3Match(arpmatch.build());
2408 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2409 ab.setKey(new ActionKey(0));
2410 actionList.add(ab.build());
2412 setFieldBuilder1.setLayer3Match(arpmatch1.build());
2413 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2414 ab1.setKey(new ActionKey(1));
2415 actionList.add(ab1.build());
2417 setFieldBuilder2.setLayer3Match(arpmatch2.build());
2418 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2419 ab2.setKey(new ActionKey(2));
2420 actionList.add(ab2.build());
2422 setFieldBuilder3.setLayer3Match(arpmatch3.build());
2423 ab3.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2424 ab3.setKey(new ActionKey(3));
2425 actionList.add(ab3.build());
2427 setFieldBuilder4.setLayer3Match(arpmatch4.build());
2428 ab4.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2429 ab4.setKey(new ActionKey(4));
2430 actionList.add(ab4.build());
2432 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2433 aab.setAction(actionList);
2435 InstructionBuilder ib = new InstructionBuilder();
2436 ib.setKey(new InstructionKey(0));
2437 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2439 // Put our Instruction in a list of Instructions
2440 InstructionsBuilder isb = new InstructionsBuilder();
2441 List<Instruction> instructions = new ArrayList<Instruction>();
2442 instructions.add(ib.build());
2443 isb.setInstruction(instructions);
2447 private static InstructionsBuilder createAppyActionInstruction44() {
2449 List<Action> actionLists = new ArrayList<Action>();
2450 ActionBuilder ab = new ActionBuilder();
2451 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2452 ActionBuilder ab1 = new ActionBuilder();
2453 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2455 * ActionBuilder ab2 = new ActionBuilder(); SetFieldBuilder
2456 * setFieldBuilder2 = new SetFieldBuilder(); ActionBuilder ab3 = new
2457 * ActionBuilder(); SetFieldBuilder setFieldBuilder3 = new
2458 * SetFieldBuilder(); ActionBuilder ab4 = new ActionBuilder();
2459 * SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder();
2461 ActionBuilder ab5 = new ActionBuilder();
2462 SetFieldBuilder setFieldBuilder5 = new SetFieldBuilder();
2463 ActionBuilder ab6 = new ActionBuilder();
2464 SetFieldBuilder setFieldBuilder6 = new SetFieldBuilder();
2467 Ipv6MatchBuilder ipv6Builder = new Ipv6MatchBuilder();
2468 Ipv6MatchBuilder ipv6Builder1 = new Ipv6MatchBuilder();
2469 // Ipv6MatchBuilder ipv6Builder2 = new Ipv6MatchBuilder();
2470 // Ipv6MatchBuilder ipv6Builder3 = new Ipv6MatchBuilder();
2471 // Ipv6MatchBuilder ipv6Builder4 = new Ipv6MatchBuilder();
2472 Ipv6MatchBuilder ipv6Builder5 = new Ipv6MatchBuilder();
2473 Ipv6MatchBuilder ipv6Builder6 = new Ipv6MatchBuilder();
2475 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2");
2476 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1");
2477 // Ipv6Address ndtarget = new
2478 // Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
2479 // MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
2480 // MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
2481 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2482 nextheader.setIpv6Exthdr(58);
2483 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2484 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2485 ipv6label.setIpv6Flabel(label);
2487 ipv6Builder.setIpv6Source(srcip6);
2488 ipv6Builder1.setIpv6Destination(dstip6);
2489 // ipv6Builder2.setIpv6NdTarget(ndtarget);
2490 // ipv6Builder3.setIpv6NdSll(ndsll);
2491 // ipv6Builder4.setIpv6NdTll(ndtll);
2492 ipv6Builder5.setIpv6ExtHeader(nextheader.build());
2493 ipv6Builder6.setIpv6Label(ipv6label.build());
2495 setFieldBuilder.setLayer3Match(ipv6Builder.build());
2496 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2497 ab.setKey(new ActionKey(0));
2498 actionLists.add(ab.build());
2500 setFieldBuilder1.setLayer3Match(ipv6Builder1.build());
2501 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2502 ab1.setKey(new ActionKey(1));
2503 actionLists.add(ab1.build());
2506 * setFieldBuilder2.setLayer3Match(ipv6Builder2.build());
2508 * SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2509 * ab2.setKey(new ActionKey(2)); actionLists.add(ab2.build());
2511 * setFieldBuilder3.setLayer3Match(ipv6Builder3.build());
2513 * SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2514 * ab3.setKey(new ActionKey(3)); actionLists.add(ab3.build());
2516 * setFieldBuilder4.setLayer3Match(ipv6Builder4.build());
2518 * SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2519 * ab4.setKey(new ActionKey(4)); actionLists.add(ab4.build());
2521 setFieldBuilder5.setLayer3Match(ipv6Builder5.build());
2522 ab5.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder5.build()).build());
2523 ab5.setKey(new ActionKey(5));
2524 actionLists.add(ab5.build());
2526 setFieldBuilder6.setLayer3Match(ipv6Builder6.build());
2527 ab6.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder6.build()).build());
2528 ab6.setKey(new ActionKey(6));
2529 actionLists.add(ab6.build());
2531 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2532 aab.setAction(actionLists);
2534 InstructionBuilder ib = new InstructionBuilder();
2535 ib.setKey(new InstructionKey(0));
2536 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2538 // Put our Instruction in a list of Instructions
2539 InstructionsBuilder isb = new InstructionsBuilder();
2540 List<Instruction> instructions = new ArrayList<Instruction>();
2541 instructions.add(ib.build());
2542 isb.setInstruction(instructions);
2546 private static InstructionsBuilder createAppyActionInstruction45() {
2548 List<Action> actionList = new ArrayList<Action>();
2549 ActionBuilder ab = new ActionBuilder();
2550 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2551 ActionBuilder ab1 = new ActionBuilder();
2552 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2555 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
2556 Icmpv6MatchBuilder icmpv6match1 = new Icmpv6MatchBuilder();
2557 icmpv6match.setIcmpv6Type((short) 135);
2558 icmpv6match1.setIcmpv6Code((short) 0);
2559 setFieldBuilder.setIcmpv6Match(icmpv6match.build());
2560 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2561 ab.setKey(new ActionKey(0));
2562 actionList.add(ab.build());
2564 setFieldBuilder1.setIcmpv6Match(icmpv6match1.build());
2565 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2566 ab1.setKey(new ActionKey(1));
2567 actionList.add(ab1.build());
2569 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2570 aab.setAction(actionList);
2572 InstructionBuilder ib = new InstructionBuilder();
2573 ib.setKey(new InstructionKey(0));
2574 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2576 // Put our Instruction in a list of Instructions
2577 InstructionsBuilder isb = new InstructionsBuilder();
2578 List<Instruction> instructions = new ArrayList<Instruction>();
2579 instructions.add(ib.build());
2580 isb.setInstruction(instructions);
2584 private static InstructionsBuilder createAppyActionInstruction46() {
2586 List<Action> actionList = new ArrayList<Action>();
2587 ActionBuilder ab = new ActionBuilder();
2588 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2589 ActionBuilder ab1 = new ActionBuilder();
2590 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2591 ActionBuilder ab2 = new ActionBuilder();
2592 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2595 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2596 ProtocolMatchFieldsBuilder protomatch1 = new ProtocolMatchFieldsBuilder();
2597 ProtocolMatchFieldsBuilder protomatch2 = new ProtocolMatchFieldsBuilder();
2598 protomatch.setMplsLabel((long) 36008);
2599 protomatch1.setMplsTc((short) 4);
2600 protomatch2.setMplsBos((short) 1);
2601 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2602 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2603 ab.setKey(new ActionKey(0));
2604 actionList.add(ab.build());
2606 setFieldBuilder1.setProtocolMatchFields(protomatch1.build());
2607 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2608 ab1.setKey(new ActionKey(1));
2609 actionList.add(ab1.build());
2611 setFieldBuilder2.setProtocolMatchFields(protomatch2.build());
2612 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2613 ab2.setKey(new ActionKey(2));
2614 actionList.add(ab2.build());
2616 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2617 aab.setAction(actionList);
2619 InstructionBuilder ib = new InstructionBuilder();
2620 ib.setKey(new InstructionKey(0));
2621 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2623 // Put our Instruction in a list of Instructions
2624 InstructionsBuilder isb = new InstructionsBuilder();
2625 List<Instruction> instructions = new ArrayList<Instruction>();
2626 instructions.add(ib.build());
2627 isb.setInstruction(instructions);
2631 private static InstructionsBuilder createAppyActionInstruction47() {
2633 List<Action> actionList = new ArrayList<Action>();
2634 ActionBuilder ab = new ActionBuilder();
2635 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2637 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2638 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask((new BigInteger(new byte[] { 0, 1, 0, 0 }).longValue())).build());
2639 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2640 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2641 actionList.add(ab.build());
2643 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2644 aab.setAction(actionList);
2646 InstructionBuilder ib = new InstructionBuilder();
2647 ib.setKey(new InstructionKey(0));
2648 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2650 // Put our Instruction in a list of Instructions
2651 InstructionsBuilder isb = new InstructionsBuilder();
2652 List<Instruction> instructions = new ArrayList<Instruction>();
2653 instructions.add(ib.build());
2654 isb.setInstruction(instructions);
2658 private static InstructionsBuilder createAppyActionInstruction48() {
2660 List<Action> actionList = new ArrayList<Action>();
2661 ActionBuilder ab = new ActionBuilder();
2662 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2664 TunnelBuilder tunnel = new TunnelBuilder();
2665 tunnel.setTunnelId(BigInteger.valueOf(10668));
2666 setFieldBuilder.setTunnel(tunnel.build());
2667 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2668 ab.setKey(new ActionKey(0));
2669 actionList.add(ab.build());
2671 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2672 aab.setAction(actionList);
2674 InstructionBuilder ib = new InstructionBuilder();
2675 ib.setKey(new InstructionKey(0));
2676 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2678 // Put our Instruction in a list of Instructions
2679 InstructionsBuilder isb = new InstructionsBuilder();
2680 List<Instruction> instructions = new ArrayList<Instruction>();
2681 instructions.add(ib.build());
2682 isb.setInstruction(instructions);
2686 private static InstructionsBuilder createTunnelIpv4DstInstructions() {
2688 List<Action> actionList = new ArrayList<Action>();
2689 ActionBuilder ab = new ActionBuilder();
2690 // Build the tunnel endpoint destination IPv4 address
2691 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2692 Ipv4Prefix dstIp = new Ipv4Prefix("172.16.100.100");
2693 // Add the mew IPv4 object as the tunnel destination
2694 TunnelIpv4MatchBuilder tunnelIpv4DstMatchBuilder = new TunnelIpv4MatchBuilder();
2695 tunnelIpv4DstMatchBuilder.setTunnelIpv4Destination(dstIp);
2696 setFieldBuilder.setLayer3Match(tunnelIpv4DstMatchBuilder.build());
2697 // Add the IPv4 tunnel dst to the set_field value
2698 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2700 ab.setKey(new ActionKey(0));
2701 actionList.add(ab.build());
2702 // Resulting action is a per/flow src TEP (set_field:172.16.100.100->tun_dst)
2703 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2704 aab.setAction(actionList);
2705 // Add the action to the ordered list of Instructions
2706 InstructionBuilder ib = new InstructionBuilder();
2708 ib.setKey(new InstructionKey(0));
2709 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2710 // Add the Instruction in a list of Instructions
2711 InstructionsBuilder isb = new InstructionsBuilder();
2712 List<Instruction> instructions = new ArrayList<Instruction>();
2713 instructions.add(ib.build());
2714 isb.setInstruction(instructions);
2718 private static InstructionsBuilder createTunnelIpv4SrcInstructions() {
2720 List<Action> actionList = new ArrayList<Action>();
2721 ActionBuilder ab = new ActionBuilder();
2722 // Build the tunnel endpoint source IPv4 address
2723 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2724 Ipv4Prefix dstIp = new Ipv4Prefix("172.16.100.200");
2725 // Add the new IPv4 object as the tunnel destination
2726 TunnelIpv4MatchBuilder tunnelIpv4MatchBuilder = new TunnelIpv4MatchBuilder();
2727 tunnelIpv4MatchBuilder.setTunnelIpv4Source(dstIp);
2728 setFieldBuilder.setLayer3Match(tunnelIpv4MatchBuilder.build());
2729 // Add the IPv4 tunnel src to the set_field value
2730 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2732 ab.setKey(new ActionKey(0));
2733 actionList.add(ab.build());
2734 // Resulting action is a per/flow src TEP (set_field:172.16.100.100->tun_src)
2735 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2736 aab.setAction(actionList);
2737 // Add the action to the ordered list of Instructions
2738 InstructionBuilder ib = new InstructionBuilder();
2740 ib.setKey(new InstructionKey(0));
2741 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2742 // Put our Instruction in a list of Instructions
2743 InstructionsBuilder isb = new InstructionsBuilder();
2744 List<Instruction> instructions = new ArrayList<Instruction>();
2745 instructions.add(ib.build());
2746 isb.setInstruction(instructions);
2750 private static MatchBuilder createLLDPMatch() {
2751 MatchBuilder match = new MatchBuilder();
2752 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2753 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2754 ethTypeBuilder.setType(new EtherType(0x88ccL));
2755 eth.setEthernetType(ethTypeBuilder.build());
2756 match.setEthernetMatch(eth.build());
2763 private static MatchBuilder createMatch1() {
2764 MatchBuilder match = new MatchBuilder();
2765 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2766 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2767 ipv4Match.setIpv4Destination(prefix);
2768 Ipv4Match i4m = ipv4Match.build();
2769 match.setLayer3Match(i4m);
2771 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2772 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2773 ethTypeBuilder.setType(new EtherType(0x0800L));
2774 eth.setEthernetType(ethTypeBuilder.build());
2775 match.setEthernetMatch(eth.build());
2782 private static MatchBuilder createIPv4DstMatch() {
2783 MatchBuilder match = new MatchBuilder();
2784 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2785 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2786 ipv4Match.setIpv4Destination(prefix);
2787 Ipv4Match i4m = ipv4Match.build();
2788 match.setLayer3Match(i4m);
2796 private static MatchBuilder createIPv4SrcMatch() {
2797 MatchBuilder match = new MatchBuilder();
2798 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2799 Ipv4Prefix prefix = new Ipv4Prefix("10.20.30.40/24");
2800 ipv4Match.setIpv4Source(prefix);
2801 Ipv4Match i4m = ipv4Match.build();
2802 match.setLayer3Match(i4m);
2804 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2805 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2806 ethTypeBuilder.setType(new EtherType(0x0800L));
2807 eth.setEthernetType(ethTypeBuilder.build());
2808 match.setEthernetMatch(eth.build());
2815 private static MatchBuilder createMatch2() {
2816 MatchBuilder match = new MatchBuilder();
2817 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2818 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1");
2819 ipv4Match.setIpv4Source(prefix);
2820 Ipv4Match i4m = ipv4Match.build();
2821 match.setLayer3Match(i4m);
2823 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2824 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2825 ethTypeBuilder.setType(new EtherType(0x0800L));
2826 eth.setEthernetType(ethTypeBuilder.build());
2827 match.setEthernetMatch(eth.build());
2834 private static MatchBuilder createMatch3() {
2835 MatchBuilder match = new MatchBuilder();
2836 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
2837 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
2838 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
2839 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
2840 match.setEthernetMatch(ethernetMatch.build());
2848 private static MatchBuilder createICMPv6Match1() {
2850 MatchBuilder match = new MatchBuilder();
2851 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2852 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2853 ethTypeBuilder.setType(new EtherType(0x86ddL));
2854 eth.setEthernetType(ethTypeBuilder.build());
2855 match.setEthernetMatch(eth.build());
2857 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2858 ipmatch.setIpProtocol((short) 256);
2859 match.setIpMatch(ipmatch.build());
2861 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2863 icmpv6match.setIcmpv6Type((short) 135);
2864 icmpv6match.setIcmpv6Code((short) 1);
2865 match.setIcmpv6Match(icmpv6match.build());
2870 private static MatchBuilder createMatch33() {
2872 MatchBuilder match = new MatchBuilder();
2873 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2874 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.10");
2875 ipv4Match.setIpv4Source(prefix);
2876 Ipv4Match i4m = ipv4Match.build();
2877 match.setLayer3Match(i4m);
2879 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2880 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2881 ethTypeBuilder.setType(new EtherType(0xfffeL));
2882 eth.setEthernetType(ethTypeBuilder.build());
2883 match.setEthernetMatch(eth.build());
2887 private static MatchBuilder createInphyportMatch(NodeId nodeId) {
2888 MatchBuilder match = new MatchBuilder();
2889 match.setInPort(new NodeConnectorId(nodeId + ":202"));
2890 match.setInPhyPort(new NodeConnectorId(nodeId + ":10122"));
2894 private static MatchBuilder createEthernetMatch() {
2895 MatchBuilder match = new MatchBuilder();
2897 byte[] mask1 = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2898 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2900 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
2902 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2903 EtherType type = new EtherType(0x0800L);
2904 ethmatch.setEthernetType(ethtype.setType(type).build());
2906 EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet
2909 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2910 ethdest.setAddress(macdest);
2911 ethdest.setMask(new MacAddress("ff:ff:ff:00:00:00"));
2913 ethmatch.setEthernetDestination(ethdest.build());
2915 EthernetSourceBuilder ethsrc = new EthernetSourceBuilder();
2916 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2917 ethsrc.setAddress(macsrc);
2918 ethsrc.setMask(new MacAddress("ff:ff:00:00:00:00"));
2920 ethmatch.setEthernetSource(ethsrc.build());
2921 match.setEthernetMatch(ethmatch.build());
2930 private static MatchBuilder createVlanMatch() {
2931 MatchBuilder match = new MatchBuilder();
2932 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder(); // vlan match
2933 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
2934 VlanId vlanId = new VlanId(10);
2935 VlanPcp vpcp = new VlanPcp((short) 3);
2936 vlanBuilder.setVlanPcp(vpcp);
2937 vlanIdBuilder.setVlanId(vlanId);
2938 vlanIdBuilder.setVlanIdPresent(true);
2939 vlanBuilder.setVlanId(vlanIdBuilder.build());
2940 match.setVlanMatch(vlanBuilder.build());
2947 private static MatchBuilder createArpMatch() {
2948 MatchBuilder match = new MatchBuilder();
2950 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2951 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2952 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2954 byte[] mask = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2955 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2957 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2958 EtherType type = new EtherType(0x0806L);
2959 ethmatch.setEthernetType(ethtype.setType(type).build());
2961 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
2962 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2964 ArpMatchBuilder arpmatch = new ArpMatchBuilder(); // arp match
2965 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2966 arpsrc.setAddress(macsrc);
2967 arpsrc.setMask(new MacAddress("ff:ff:ff:00:00:00"));
2968 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2969 arpdst.setAddress(macdest);
2970 arpdst.setMask(new MacAddress("ff:ff:00:00:00:00"));
2971 arpmatch.setArpOp(2);
2972 arpmatch.setArpSourceHardwareAddress(arpsrc.build());
2973 arpmatch.setArpTargetHardwareAddress(arpdst.build());
2974 arpmatch.setArpSourceTransportAddress(srcip);
2975 arpmatch.setArpTargetTransportAddress(dstip);
2977 match.setEthernetMatch(ethmatch.build());
2978 match.setLayer3Match(arpmatch.build());
2986 private static MatchBuilder createIPMatch() {
2987 MatchBuilder match = new MatchBuilder();
2988 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2989 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2990 EtherType type = new EtherType(0x0800L);
2991 ethmatch.setEthernetType(ethtype.setType(type).build());
2992 match.setEthernetMatch(ethmatch.build());
2994 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2995 ipmatch.setIpProtocol((short) 1);
2996 Dscp dscp = new Dscp((short) 3);
2997 ipmatch.setIpDscp(dscp);
2998 ipmatch.setIpEcn((short) 2);
2999 match.setIpMatch(ipmatch.build());
3006 private static MatchBuilder createL3IPv4Match() {
3007 MatchBuilder match = new MatchBuilder();
3009 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3010 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3011 ethTypeBuilder.setType(new EtherType(0x0800L));
3012 eth.setEthernetType(ethTypeBuilder.build());
3013 match.setEthernetMatch(eth.build());
3015 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
3016 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
3017 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
3018 Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
3019 ipv4match.setIpv4Destination(dstip);
3020 ipv4match.setIpv4Source(srcip);
3021 match.setLayer3Match(ipv4match.build());
3030 private static MatchBuilder createL3IPv6Match() {
3031 MatchBuilder match = new MatchBuilder();
3033 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3034 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3035 ethTypeBuilder.setType(new EtherType(0x86ddL));
3036 eth.setEthernetType(ethTypeBuilder.build());
3037 match.setEthernetMatch(eth.build());
3039 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2/64");
3040 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1/56");
3041 Ipv6Address ndtarget = new Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
3042 MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
3043 MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
3044 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
3045 nextheader.setIpv6Exthdr(58);
3046 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
3047 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
3048 ipv6label.setIpv6Flabel(label);
3049 ipv6label.setFlabelMask(new Ipv6FlowLabel(1L));
3051 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
3053 icmpv6match.setIcmpv6Type((short) 135);
3054 icmpv6match.setIcmpv6Code((short) 0);
3055 match.setIcmpv6Match(icmpv6match.build());
3057 Ipv6MatchBuilder ipv6match = new Ipv6MatchBuilder();
3058 // ipv6match.setIpv6Source(srcip6);
3059 // ipv6match.setIpv6Destination(dstip6);
3060 // ipv6match.setIpv6ExtHeader(nextheader.build());
3061 ipv6match.setIpv6NdSll(ndsll);
3062 ipv6match.setIpv6NdTll(ndtll);
3063 // ipv6match.setIpv6NdTarget(ndtarget);
3064 ipv6match.setIpv6Label(ipv6label.build());
3066 match.setLayer3Match(ipv6match.build());
3075 private static MatchBuilder createICMPv4Match() {
3076 MatchBuilder match = new MatchBuilder();
3077 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3078 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3079 ethTypeBuilder.setType(new EtherType(0x0800L));
3080 eth.setEthernetType(ethTypeBuilder.build());
3081 match.setEthernetMatch(eth.build());
3083 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3084 ipmatch.setIpProtocol((short) 1);
3085 match.setIpMatch(ipmatch.build());
3087 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder(); // icmpv4
3089 icmpv4match.setIcmpv4Type((short) 8);
3090 icmpv4match.setIcmpv4Code((short) 0);
3091 match.setIcmpv4Match(icmpv4match.build());
3098 private static MatchBuilder createICMPv6Match() {
3100 MatchBuilder match = new MatchBuilder();
3101 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3102 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3103 ethTypeBuilder.setType(new EtherType(0x86ddL));
3104 eth.setEthernetType(ethTypeBuilder.build());
3105 match.setEthernetMatch(eth.build());
3107 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3108 ipmatch.setIpProtocol((short) 58);
3109 match.setIpMatch(ipmatch.build());
3111 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
3113 icmpv6match.setIcmpv6Type((short) 135);
3114 icmpv6match.setIcmpv6Code((short) 1);
3115 match.setIcmpv6Match(icmpv6match.build());
3123 private static MatchBuilder createToSMatch() {
3124 MatchBuilder match = new MatchBuilder();
3125 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
3126 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
3127 EtherType type = new EtherType(0x0800L);
3128 ethmatch.setEthernetType(ethtype.setType(type).build());
3129 match.setEthernetMatch(ethmatch.build());
3131 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3132 ipmatch.setIpProtocol((short) 6);
3133 Dscp dscp = new Dscp((short) 8);
3134 ipmatch.setIpDscp(dscp);
3135 match.setIpMatch(ipmatch.build());
3143 private static MatchBuilder createL4TCPMatch() {
3144 MatchBuilder match = new MatchBuilder();
3146 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3147 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3148 ethTypeBuilder.setType(new EtherType(0x0800L));
3149 eth.setEthernetType(ethTypeBuilder.build());
3150 match.setEthernetMatch(eth.build());
3152 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3153 ipmatch.setIpProtocol((short) 6);
3154 match.setIpMatch(ipmatch.build());
3156 PortNumber srcport = new PortNumber(1213);
3157 PortNumber dstport = new PortNumber(646);
3158 TcpMatchBuilder tcpmatch = new TcpMatchBuilder(); // tcp match
3159 tcpmatch.setTcpSourcePort(srcport);
3160 tcpmatch.setTcpDestinationPort(dstport);
3161 match.setLayer4Match(tcpmatch.build());
3169 private static MatchBuilder createL4UDPMatch() {
3170 MatchBuilder match = new MatchBuilder();
3172 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3173 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3174 ethTypeBuilder.setType(new EtherType(0x0800L));
3175 eth.setEthernetType(ethTypeBuilder.build());
3176 match.setEthernetMatch(eth.build());
3178 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3179 ipmatch.setIpProtocol((short) 17);
3180 match.setIpMatch(ipmatch.build());
3182 PortNumber srcport = new PortNumber(1325);
3183 PortNumber dstport = new PortNumber(42);
3184 UdpMatchBuilder udpmatch = new UdpMatchBuilder(); // udp match
3185 udpmatch.setUdpDestinationPort(dstport);
3186 udpmatch.setUdpSourcePort(srcport);
3187 match.setLayer4Match(udpmatch.build());
3195 private static MatchBuilder createL4SCTPMatch() {
3196 MatchBuilder match = new MatchBuilder();
3198 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3199 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3200 ethTypeBuilder.setType(new EtherType(0x0800L));
3201 eth.setEthernetType(ethTypeBuilder.build());
3202 match.setEthernetMatch(eth.build());
3204 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3205 ipmatch.setIpProtocol((short) 132);
3206 match.setIpMatch(ipmatch.build());
3208 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
3209 PortNumber srcport = new PortNumber(1435);
3210 PortNumber dstport = new PortNumber(22);
3211 sctpmatch.setSctpSourcePort(srcport);
3212 sctpmatch.setSctpDestinationPort(dstport);
3213 match.setLayer4Match(sctpmatch.build());
3221 private static MatchBuilder createMetadataMatch() {
3222 MatchBuilder match = new MatchBuilder();
3223 byte[] metamask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
3224 MetadataBuilder metadata = new MetadataBuilder(); // metadata match
3225 metadata.setMetadata(BigInteger.valueOf(500L));
3226 metadata.setMetadataMask(new BigInteger(metamask));
3227 match.setMetadata(metadata.build());
3235 private static MatchBuilder createMplsMatch() {
3236 MatchBuilder match = new MatchBuilder();
3238 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3239 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3240 ethTypeBuilder.setType(new EtherType(0x8847L));
3241 eth.setEthernetType(ethTypeBuilder.build());
3242 match.setEthernetMatch(eth.build());
3244 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3246 protomatch.setMplsLabel((long) 36008);
3247 protomatch.setMplsTc((short) 4);
3248 protomatch.setMplsBos((short) 1);
3249 match.setProtocolMatchFields(protomatch.build());
3258 private static MatchBuilder createPbbMatch() {
3259 MatchBuilder match = new MatchBuilder();
3261 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3262 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3263 ethTypeBuilder.setType(new EtherType(0x88E7L));
3264 eth.setEthernetType(ethTypeBuilder.build());
3265 match.setEthernetMatch(eth.build());
3267 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3269 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new BigInteger(new byte[] { 0, 1, 0, 0 }).longValue()).build());
3270 match.setProtocolMatchFields(protomatch.build());
3279 private static MatchBuilder createTunnelIDMatch() {
3280 MatchBuilder match = new MatchBuilder();
3281 TunnelBuilder tunnel = new TunnelBuilder(); // tunnel id match
3282 tunnel.setTunnelId(BigInteger.valueOf(10668));
3283 byte[] mask = new byte[] {(byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
3284 tunnel.setTunnelMask(new BigInteger(1, mask));
3285 match.setTunnel(tunnel.build());
3291 * Test match for TCP_Flags
3292 * @return match containing Ethertype (0x0800), IP Protocol (TCP), TCP_Flag (SYN)
3294 //FIXME: move to extensible support
3295 private static MatchBuilder createTcpFlagMatch() {
3296 MatchBuilder match = new MatchBuilder();
3299 EthernetMatchBuilder ethernetType = new EthernetMatchBuilder();
3300 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3301 ethTypeBuilder.setType(new EtherType(0x0800L));
3302 ethernetType.setEthernetType(ethTypeBuilder.build());
3303 match.setEthernetMatch(ethernetType.build());
3305 // TCP Protocol Match
3306 IpMatchBuilder ipMatch = new IpMatchBuilder(); // ipv4 version
3307 ipMatch.setIpProtocol((short) 6);
3308 match.setIpMatch(ipMatch.build());
3311 PortNumber dstPort = new PortNumber(80);
3312 TcpMatchBuilder tcpMatch = new TcpMatchBuilder();
3313 tcpMatch.setTcpDestinationPort(dstPort);
3314 match.setLayer4Match(tcpMatch.build());
3316 * Defined TCP Flag values in OVS v2.1+
3317 * TCP_FIN 0x001 / TCP_SYN 0x002 / TCP_RST 0x004
3318 * TCP_PSH 0x008 / TCP_ACK 0x010 / TCP_URG 0x020
3319 * TCP_ECE 0x040 / TCP_CWR 0x080 / TCP_NS 0x100
3321 TcpFlagMatchBuilder tcpFlagMatch = new TcpFlagMatchBuilder();
3322 tcpFlagMatch.setTcpFlag(0x002);
3323 match.setTcpFlagMatch(tcpFlagMatch.build());
3328 public void _removeMDFlow(CommandInterpreter ci) {
3329 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
3330 NodeBuilder tn = createTestNode(ci.nextArgument());
3331 String flowtype = ci.nextArgument();
3333 if (flowtype.equals("fTM")) {
3334 tf = createtablemiss(tn, flowtype, ci.nextArgument());
3336 tf = createTestFlow(tn, flowtype, ci.nextArgument());
3338 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class).child(Node.class, tn.getKey())
3339 .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf.getTableId()))
3340 .child(Flow.class, tf.getKey()).build();
3341 modification.removeConfigurationData(path1);
3342 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
3344 RpcResult<TransactionStatus> result = commitFuture.get();
3345 TransactionStatus status = result.getResult();
3346 ci.println("Status of Flow Data Loaded Transaction: " + status);
3348 } catch (InterruptedException e) {
3349 LOG.error(e.getMessage(), e);
3350 } catch (ExecutionException e) {
3351 LOG.error(e.getMessage(), e);
3356 * @param ci arguments: switchId flowType tableNum
3359 * e.g.: addMDFlow openflow:1 f1 42
3362 public void _addMDFlow(CommandInterpreter ci) {
3363 NodeBuilder tn = createTestNode(ci.nextArgument());
3364 String flowtype = ci.nextArgument();
3366 if (flowtype.equals("fTM")) {
3367 tf = createtablemiss(tn, flowtype, ci.nextArgument());
3369 tf = createTestFlow(tn, flowtype, ci.nextArgument());
3371 writeFlow(ci, tf, tn);
3374 private void writeFlow(CommandInterpreter ci, FlowBuilder flow, NodeBuilder nodeBuilder) {
3375 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
3376 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class)
3377 .child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
3378 .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.getKey()).build();
3379 modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
3380 modification.putConfigurationData(path1, flow.build());
3381 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
3383 RpcResult<TransactionStatus> result = commitFuture.get();
3384 TransactionStatus status = result.getResult();
3385 ci.println("Status of Flow Data Loaded Transaction: " + status);
3387 } catch (InterruptedException e) {
3388 LOG.error(e.getMessage(), e);
3389 } catch (ExecutionException e) {
3390 LOG.error(e.getMessage(), e);
3394 public void _modifyMDFlow(CommandInterpreter ci) {
3395 NodeBuilder tn = createTestNode(ci.nextArgument());
3396 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
3397 tf.setFlowName(updatedFlowName);
3398 writeFlow(ci, tf, tn);
3399 tf.setFlowName(originalFlowName);
3400 writeFlow(ci, tf, tn);
3403 private static NodeRef createNodeRef(String string) {
3404 NodeKey key = new NodeKey(new NodeId(string));
3405 InstanceIdentifier<Node> path = InstanceIdentifier.builder(Nodes.class).child(Node.class, key)
3408 return new NodeRef(path);
3412 public String getHelp() {
3417 * usage testSwitchFlows <numberOfSwitches> <numberOfFlows> <warmup iterations> <Number Of Threads>
3418 * ex: _perfFlowTest 10 5 1 2
3420 public void _perfFlowTest(CommandInterpreter ci) {
3422 String numberOfSwtichesStr = ci.nextArgument();
3423 String numberOfFlowsStr = ci.nextArgument();
3424 String warmupIterationsStr = ci.nextArgument();
3425 String threadCountStr = ci.nextArgument();
3426 String warmUpStr = ci.nextArgument();
3428 Collection<String> testResults = null;
3429 if(testResults == null){
3430 testResults = new ArrayList<String>();
3433 int numberOfSwtiches = 0;
3434 int numberOfFlows = 0;
3435 int warmupIterations = 0;
3436 boolean warmUpIterations = false;
3438 int threadCount = 0;
3439 if(numberOfSwtichesStr !=null && !numberOfSwtichesStr.trim().equals("")){
3440 numberOfSwtiches = new Integer(numberOfSwtichesStr).intValue();
3442 numberOfSwtiches = 2;
3445 if(numberOfFlowsStr !=null && !numberOfFlowsStr.trim().equals("")){
3446 numberOfFlows = new Integer(numberOfFlowsStr).intValue();
3451 if(warmupIterationsStr !=null && !warmupIterationsStr.trim().equals("")){
3452 warmupIterations = new Integer(warmupIterationsStr).intValue();
3454 warmupIterations = 2;
3457 if(threadCountStr !=null && !threadCountStr.trim().equals("")){
3458 threadCount = new Integer(threadCountStr).intValue();
3462 if(warmUpStr !=null && !warmUpStr.trim().equals("") && warmUpStr.trim().equals("true")){
3463 warmUpIterations = true;
3465 warmUpIterations = false;
3467 ci.println("* Test Configurations*");
3468 ci.println("* numberOfSwtiches:::"+numberOfSwtiches+"");
3469 ci.println("* numberOfFlows:::"+numberOfFlows+"");
3470 ci.println("* warmupIterations:::"+warmupIterations+"");
3471 ci.println("* Number of Threads :::"+threadCount+"");
3472 ci.println("* Warmup Required? :::"+warmUpIterations+"");
3474 String dataPath="openflow:1";
3475 String flowType = "fTM";
3478 String tableId = "0";
3479 if(warmUpIterations){
3480 ci.println("----Warmup Started-----");
3481 for(int j =1; j<= warmupIterations; j++){
3482 for(int i =1;i<=numberOfSwtiches;i++){
3483 dataPath = "openflow:"+i;
3484 tn = createTestNode(dataPath);
3485 for (int flow=1;flow<numberOfFlows;flow++){
3486 tf = createTestFlow_perfTest(tn, "f1", tableId, flow);
3487 writeFlow(ci, tf, tn);
3492 ci.println("----Warmup Done-----");
3495 ExecutorService executor = Executors.newFixedThreadPool(threadCount);
3498 for ( int t=0;t< threadCount;t++){
3500 Runnable tRunnable = new TestFlowThread(numberOfSwtiches, numberOfFlows, ci, t, tableID);
3501 executor.execute(tRunnable);
3503 executor.shutdown();
3504 executor.awaitTermination(1, TimeUnit.SECONDS);
3505 } catch(Exception e){
3506 ci.println("Exception:"+e.getMessage());
3510 public class TestFlowThread implements Runnable {
3512 int numberOfSwitches;
3515 CommandInterpreter ci;
3518 Collection<String> testResults = null;
3521 TestFlowThread(int numberOfSwtiches, int numberOfFlows, CommandInterpreter ci, int t, int tableID) {
3522 this.numberOfSwitches = numberOfSwtiches;
3523 this.numberOfFlows = numberOfFlows;
3525 this.theadNumber = t;
3526 this.tableID = tableID;
3534 public void executeFlow() {
3536 String dataPath = "openflow:1";
3539 //String tableId = "0";
3541 ci.println("New Thread started with id: ID_"
3542 + this.theadNumber);
3543 int totalNumberOfFlows = 0;
3544 long startTime = System.currentTimeMillis();
3546 for (int i = 1; i <= this.numberOfSwitches; i++) {
3547 dataPath = "openflow:" + i;
3548 tn = createTestNode(dataPath);
3549 for (int flow2 = 1; flow2 <= this.numberOfFlows; flow2++) {
3550 tf = createTestFlow_perfTest(tn, "f1", ""+this.tableID, flow2);
3551 writeFlow(this.ci, tf, tn);
3552 totalNumberOfFlows++;
3555 long endTime = System.currentTimeMillis();
3556 long timeInSeconds = Math.round((endTime - startTime) / 1000);
3557 if (timeInSeconds > 0) {
3558 ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::" + Math.round(totalNumberOfFlows / timeInSeconds));
3560 ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::" + totalNumberOfFlows);
3566 * usage testAllFlows <dp>
3567 * ex: _perfFlowTest 1
3569 public void _testAllFlows(CommandInterpreter ci) {
3570 String dataPathID = ci.nextArgument();
3571 int numberOfFlows = 82;
3572 int threadCount = 0;
3573 if(dataPathID ==null || dataPathID.trim().equals("")){
3576 ci.println("* Test All Flows *");
3577 ci.println("* dataPathID:::"+dataPathID+"");
3578 String dataPath="openflow:"+dataPathID;
3579 String tableId = "0";
3580 NodeBuilder tn = createTestNode(dataPath);
3582 for (int flow=1;flow<numberOfFlows;flow++){
3583 String flowID = "f"+flow;
3585 tf = createTestFlow(tn, flowID, tableId);
3586 writeFlow(ci, tf, tn);
3587 } catch(Exception e){
3588 ci.println("--Test Failed--Issue found while adding flow"+ flow);