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 com.google.common.util.concurrent.CheckedFuture;
12 import com.google.common.util.concurrent.FutureCallback;
13 import com.google.common.util.concurrent.Futures;
14 import java.math.BigInteger;
15 import java.util.ArrayList;
16 import java.util.Collection;
17 import java.util.List;
18 import java.util.concurrent.ExecutorService;
19 import java.util.concurrent.Executors;
20 import java.util.concurrent.TimeUnit;
21 import org.eclipse.osgi.framework.console.CommandInterpreter;
22 import org.eclipse.osgi.framework.console.CommandProvider;
23 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
24 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
25 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
26 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
27 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
28 import org.opendaylight.controller.sal.binding.api.NotificationService;
29 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
30 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
31 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
32 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6FlowLabel;
33 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Prefix;
34 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
35 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
36 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionCaseBuilder;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCaseBuilder;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCaseBuilder;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCaseBuilder;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCaseBuilder;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodActionCaseBuilder;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAllActionCaseBuilder;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCaseBuilder;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.HwPathActionCaseBuilder;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.LoopbackActionCaseBuilder;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCaseBuilder;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopPbbActionCaseBuilder;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCaseBuilder;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCaseBuilder;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCaseBuilder;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCaseBuilder;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCaseBuilder;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCaseBuilder;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlTypeActionCaseBuilder;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCaseBuilder;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNextHopActionCaseBuilder;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCaseBuilder;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionCaseBuilder;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCaseBuilder;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCaseBuilder;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCaseBuilder;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCaseBuilder;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanCfiActionCaseBuilder;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCaseBuilder;
72 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.StripVlanActionCaseBuilder;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SwPathActionCaseBuilder;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.controller.action._case.ControllerActionBuilder;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.in._case.CopyTtlInBuilder;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.out._case.CopyTtlOutBuilder;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.mpls.ttl._case.DecMplsTtlBuilder;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtl;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropAction;
81 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder;
82 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.action._case.FloodActionBuilder;
83 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.all.action._case.FloodAllActionBuilder;
84 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder;
85 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.hw.path.action._case.HwPathActionBuilder;
86 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.loopback.action._case.LoopbackActionBuilder;
87 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder;
88 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
89 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbActionBuilder;
90 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder;
91 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder;
92 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder;
93 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder;
94 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstActionBuilder;
95 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder;
96 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.type.action._case.SetDlTypeActionBuilder;
97 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;
98 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlActionBuilder;
99 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.next.hop.action._case.SetNextHopActionBuilder;
100 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder;
101 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder;
102 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.tos.action._case.SetNwTosActionBuilder;
103 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder;
104 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.queue.action._case.SetQueueActionBuilder;
105 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstActionBuilder;
106 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder;
107 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.cfi.action._case.SetVlanCfiActionBuilder;
108 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder;
109 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.pcp.action._case.SetVlanPcpActionBuilder;
110 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.strip.vlan.action._case.StripVlanActionBuilder;
111 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.sw.path.action._case.SwPathActionBuilder;
112 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
113 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
114 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
115 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
116 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
117 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
118 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
119 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
120 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
121 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
122 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
123 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowListener;
124 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
125 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
126 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.OutputPortValues;
127 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
128 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
129 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
130 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCaseBuilder;
131 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCaseBuilder;
132 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCaseBuilder;
133 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
134 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.go.to.table._case.GoToTableBuilder;
135 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.meter._case.MeterBuilder;
136 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.metadata._case.WriteMetadataBuilder;
137 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
138 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
139 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
140 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
141 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
142 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
143 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
144 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
145 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
146 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
147 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
148 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
149 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
150 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
151 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddressBuilder;
152 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpTargetHardwareAddressBuilder;
153 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
154 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder;
155 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
156 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6ExtHeaderBuilder;
157 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6LabelBuilder;
158 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
159 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder;
160 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder;
161 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
162 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.MetadataBuilder;
163 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder;
164 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagMatchBuilder;
165 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TunnelBuilder;
166 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
167 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder;
168 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match;
169 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
170 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
171 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder;
172 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder;
173 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
174 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
175 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.protocol.match.fields.PbbBuilder;
176 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
177 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.NodeErrorListener;
178 import org.opendaylight.yangtools.concepts.Registration;
179 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
180 import org.osgi.framework.BundleContext;
181 import org.slf4j.Logger;
182 import org.slf4j.LoggerFactory;
184 public class OpenflowpluginTestCommandProvider implements CommandProvider {
186 private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
188 private DataBroker dataBroker;
189 private final BundleContext ctx;
190 private FlowBuilder testFlow;
191 private static final String ORIGINAL_FLOW_NAME = "Foo";
192 private static final String UPDATED_FLOW_NAME = "Bar";
193 private static final String IPV4_PREFIX = "10.0.0.1/24";
194 private static final String DEST_MAC_ADDRESS = "ff:ff:ff:ff:ff:ff";
195 private static final String SRC_MAC_ADDRESS = "00:00:00:00:23:ae";
196 private final SalFlowListener flowEventListener = new FlowEventListenerLoggingImpl();
197 private final NodeErrorListener nodeErrorListener = new NodeErrorListenerLoggingImpl();
198 private static NotificationService notificationService;
200 public OpenflowpluginTestCommandProvider(BundleContext ctx) {
204 public void onSessionInitiated(ProviderContext session) {
205 notificationService = session.getSALService(NotificationService.class);
207 notificationService.registerNotificationListener(flowEventListener);
208 notificationService.registerNotificationListener(nodeErrorListener);
209 dataBroker = session.getSALService(DataBroker.class);
210 ctx.registerService(CommandProvider.class.getName(), this, null);
211 createTestFlow(createTestNode(null), null, null);
214 private NodeBuilder createTestNode(String nodeId) {
217 if (nodeId == null) {
218 localNodeId = OpenflowpluginTestActivator.NODE_ID;
220 localNodeId = nodeId;
223 NodeBuilder builder = new NodeBuilder();
224 builder.setId(new NodeId(localNodeId));
225 builder.setKey(new NodeKey(builder.getId()));
229 private InstanceIdentifier<Node> nodeBuilderToInstanceId(NodeBuilder node) {
230 return InstanceIdentifier.create(Nodes.class).child(Node.class, node.getKey());
233 private FlowBuilder createTestFlow(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
234 final long TEST_ID = 123;
236 FlowBuilder flow = new FlowBuilder();
239 String flowType = flowTypeArg;
240 if (flowType == null) {
249 flow.setMatch(createMatch1().build());
250 flow.setInstructions(createDecNwTtlInstructions().build());
254 flow.setMatch(createMatch2().build());
255 flow.setInstructions(createDropInstructions().build());
259 flow.setMatch(createMatch3().build());
260 flow.setInstructions(createDropInstructions().build());
264 flow.setMatch(createEthernetMatch().build());
265 flow.setInstructions(createDropInstructions().build());
269 flow.setMatch(createMatch1().build());
270 flow.setInstructions(createAppyActionInstruction().build());
274 flow.setMatch(createMatch1().build());
275 flow.setInstructions(createGotoTableInstructions().build());
279 flow.setMatch(createMatch1().build());
280 flow.setInstructions(createMeterInstructions().build());
284 flow.setMatch(createMatch1().build());
285 flow.setInstructions(createAppyActionInstruction1().build());
289 flow.setMatch(createMatch1().build());
290 flow.setInstructions(createAppyActionInstruction2().build());
294 flow.setMatch(createMatch1().build());
295 flow.setInstructions(createAppyActionInstruction3().build());
299 flow.setMatch(createMatch1().build());
300 flow.setInstructions(createAppyActionInstruction4().build());
304 flow.setMatch(createMatch1().build());
305 flow.setInstructions(createAppyActionInstruction5().build());
309 flow.setMatch(createMatch1().build());
310 flow.setInstructions(createAppyActionInstruction6().build());
314 flow.setMatch(createMatch1().build());
315 flow.setInstructions(createAppyActionInstruction7().build());
319 flow.setMatch(createMatch1().build());
320 flow.setInstructions(createAppyActionInstruction8().build());
324 flow.setMatch(createMatch1().build());
325 flow.setInstructions(createAppyActionInstruction9().build());
329 flow.setMatch(createMatch1().build());
330 flow.setInstructions(createAppyActionInstruction10().build());
334 flow.setMatch(createMatch1().build());
335 flow.setInstructions(createAppyActionInstruction11().build());
339 flow.setMatch(createMatch1().build());
340 flow.setInstructions(createAppyActionInstruction12().build());
344 flow.setMatch(createMatch1().build());
345 flow.setInstructions(createAppyActionInstruction13().build());
349 flow.setMatch(createMatch1().build());
350 flow.setInstructions(createAppyActionInstruction14().build());
354 flow.setMatch(createMatch1().build());
355 flow.setInstructions(createAppyActionInstruction15().build());
359 // f23 can be used as test-case for generating error notification
360 // if the particular group is not configured - tested
361 flow.setMatch(createMatch1().build());
362 flow.setInstructions(createAppyActionInstruction16().build());
366 flow.setMatch(createMatch1().build());
367 flow.setInstructions(createAppyActionInstruction17().build());
371 flow.setMatch(createMatch1().build());
372 flow.setInstructions(createAppyActionInstruction18().build());
376 flow.setMatch(createMatch1().build());
377 flow.setInstructions(createAppyActionInstruction19().build());
381 flow.setMatch(createMatch1().build());
382 flow.setInstructions(createMetadataInstructions().build());
386 flow.setMatch(createMatch1().build());
387 flow.setInstructions(createAppyActionInstruction20().build());
391 flow.setMatch(createMatch1().build());
392 flow.setInstructions(createAppyActionInstruction21().build());
396 flow.setMatch(createMatch1().build());
397 flow.setInstructions(createAppyActionInstruction22().build());
401 flow.setMatch(createMatch1().build());
402 flow.setInstructions(createAppyActionInstruction23(nodeBuilder.getId()).build());
406 flow.setMatch(createMatch1().build());
407 flow.setInstructions(createAppyActionInstruction24().build());
411 flow.setMatch(createMatch1().build());
412 flow.setInstructions(createAppyActionInstruction25().build());
416 flow.setMatch(createMatch1().build());
417 flow.setInstructions(createAppyActionInstruction26().build());
421 flow.setMatch(createMatch1().build());
422 flow.setInstructions(createAppyActionInstruction27().build());
426 flow.setMatch(createMatch1().build());
427 flow.setInstructions(createAppyActionInstruction28().build());
431 flow.setMatch(createMatch1().build());
432 flow.setInstructions(createAppyActionInstruction29().build());
436 flow.setMatch(createMatch1().build());
437 flow.setInstructions(createAppyActionInstruction30().build());
441 flow.setMatch(createMatch1().build());
442 flow.setInstructions(createAppyActionInstruction31().build());
446 flow.setMatch(createMatch1().build());
447 flow.setInstructions(createAppyActionInstruction32().build());
451 flow.setMatch(createMatch1().build());
452 flow.setInstructions(createAppyActionInstruction33().build());
456 flow.setMatch(createMatch1().build());
457 flow.setInstructions(createAppyActionInstruction34().build());
461 flow.setMatch(createICMPv6Match().build());
462 flow.setInstructions(createDecNwTtlInstructions().build());
466 flow.setMatch(createInphyportMatch(nodeBuilder.getId()).build());
467 flow.setInstructions(createDropInstructions().build());
471 flow.setMatch(createMetadataMatch().build());
472 flow.setInstructions(createDropInstructions().build());
476 flow.setMatch(createL3IPv6Match().build());
477 flow.setInstructions(createDecNwTtlInstructions().build());
481 flow.setMatch(createL4SCTPMatch().build());
482 flow.setInstructions(createAppyActionInstruction().build());
486 flow.setMatch(createTunnelIDMatch().build());
487 flow.setInstructions(createGotoTableInstructions().build());
491 flow.setMatch(createVlanMatch().build());
492 flow.setInstructions(createMeterInstructions().build());
496 flow.setMatch(createPbbMatch().build());
497 flow.setInstructions(createMeterInstructions().build());
501 flow.setMatch(createVlanMatch().build());
502 flow.setInstructions(createDropInstructions().build());
506 flow.setMatch(createL4TCPMatch().build());
507 flow.setInstructions(createDropInstructions().build());
512 flow.setMatch(createL4UDPMatch().build());
513 flow.setInstructions(createDropInstructions().build());
517 flow.setMatch(new MatchBuilder().build());
518 flow.setInstructions(createSentToControllerInstructions().build());
523 flow.setMatch(createToSMatch().build());
524 flow.setInstructions(createDropInstructions().build());
528 flow.setMatch(createToSMatch().build());
529 flow.setInstructions(createOutputInstructions("INPORT", 10).build());
533 flow.setMatch(createToSMatch().build());
534 flow.setInstructions(createOutputInstructions("FLOOD", 20).build());
538 flow.setMatch(createToSMatch().build());
539 flow.setInstructions(createOutputInstructions("ALL", 30).build());
543 flow.setMatch(createToSMatch().build());
544 flow.setInstructions(createOutputInstructions("NORMAL", 40).build());
548 flow.setMatch(createToSMatch().build());
549 flow.setInstructions(createOutputInstructions("LOCAL", 50).build());
553 flow.setMatch(createToSMatch().build());
554 flow.setInstructions(createOutputInstructions("TABLE", 60).build());
558 flow.setMatch(createToSMatch().build());
559 flow.setInstructions(createOutputInstructions("NONE", 70).build());
563 flow.setMatch(createToSMatch().build());
564 flow.setInstructions(createStripVlanInstructions().build());
565 flow.setBarrier(Boolean.TRUE);
569 flow.setMatch(createMatch1().build());
570 flow.setInstructions(createAppyActionInstruction35().build());
574 flow.setMatch(createMatch1().build());
575 flow.setInstructions(createAppyActionInstruction36().build());
579 flow.setMatch(createMatch1().build());
580 flow.setInstructions(createAppyActionInstruction37().build());
584 flow.setMatch(createMatch1().build());
585 flow.setInstructions(createAppyActionInstruction38().build());
589 flow.setMatch(createL4TCPMatch().build());
590 flow.setInstructions(createAppyActionInstruction39().build());
594 flow.setMatch(createL4UDPMatch().build());
595 flow.setInstructions(createAppyActionInstruction40().build());
599 flow.setMatch(createL4SCTPMatch().build());
600 flow.setInstructions(createAppyActionInstruction41().build());
604 flow.setMatch(createICMPv4Match().build());
605 flow.setInstructions(createAppyActionInstruction42().build());
609 flow.setMatch(createArpMatch().build());
610 flow.setInstructions(createAppyActionInstruction43().build());
614 flow.setMatch(createL3IPv6Match().build());
615 flow.setInstructions(createAppyActionInstruction44().build());
619 flow.setMatch(createICMPv6Match().build());
620 flow.setInstructions(createAppyActionInstruction45().build());
624 flow.setMatch(createMplsMatch().build());
625 flow.setInstructions(createAppyActionInstruction46().build());
629 flow.setMatch(createPbbMatch().build());
630 flow.setInstructions(createAppyActionInstruction47().build());
634 flow.setMatch(createTunnelIDMatch().build());
635 flow.setInstructions(createAppyActionInstruction48().build());
639 flow.setMatch(createMatch33().build());
640 flow.setInstructions(createDropInstructions().build());
644 flow.setMatch(createICMPv6Match1().build());
645 flow.setInstructions(createDecNwTtlInstructions().build());
649 flow.setMatch(createVlanMatch().build());
650 flow.setInstructions(createAppyActionInstruction88().build());
654 flow.setMatch(createLLDPMatch().build());
655 flow.setInstructions(createSentToControllerInstructions().build());
659 flow.setMatch(createToSMatch().build());
660 flow.setInstructions(createOutputInstructions().build());
663 // Test TCP_Flag Match
665 flow.setMatch(createTcpFlagMatch().build());
666 flow.setInstructions(createDropInstructions().build());
670 // match vlan=10,dl_vlan_pcp=3
671 flow.setMatch(createVlanMatch().build());
673 flow.setInstructions(createAppyActionInstruction88().build());
676 // Test Tunnel IPv4 Src (e.g. set_field:172.16.100.200->tun_src)
678 flow.setMatch(createMatch3().build());
679 flow.setInstructions(createTunnelIpv4SrcInstructions().build());
682 // Test Tunnel IPv4 Dst (e.g. set_field:172.16.100.100->tun_dst)
684 flow.setMatch(createMatch1().build());
685 flow.setInstructions(createTunnelIpv4DstInstructions().build());
688 LOG.warn("flow type not understood: {}", flowType);
691 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
692 if (null == flow.isBarrier()) {
693 flow.setBarrier(Boolean.FALSE);
695 BigInteger value = BigInteger.valueOf(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));
708 flow.setFlowName(ORIGINAL_FLOW_NAME + "X" + flowType);
714 private FlowBuilder createTestFlowPerfTest(String flowTypeArg, String tableId, int id) {
715 FlowBuilder flow = new FlowBuilder();
716 String flowType = flowTypeArg;
719 if (flowType == null) {
723 flow.setPriority(flowId);
728 flow.setMatch(createMatch1().build());
729 flow.setInstructions(createDecNwTtlInstructions().build());
732 LOG.warn("flow type not understood: {}", flowType);
735 FlowKey key = new FlowKey(new FlowId(Long.toString(flowId)));
736 if (null == flow.isBarrier()) {
737 flow.setBarrier(Boolean.FALSE);
739 BigInteger value = BigInteger.valueOf(10);
740 flow.setCookie(new FlowCookie(value));
741 flow.setCookieMask(new FlowCookie(value));
742 flow.setHardTimeout(0);
743 flow.setIdleTimeout(0);
744 flow.setInstallHw(false);
745 flow.setStrict(false);
746 flow.setContainerName(null);
747 flow.setFlags(new FlowModFlags(false, false, false, false, true));
748 flow.setId(new FlowId("12"));
749 flow.setTableId(getTableId(tableId));
752 flow.setFlowName(ORIGINAL_FLOW_NAME + "X" + flowType);
757 private FlowBuilder createtablemiss() {
758 FlowBuilder flow = new FlowBuilder();
760 MatchBuilder matchBuilder = new MatchBuilder();
761 flow.setMatch(matchBuilder.build());
762 flow.setInstructions(createSentToControllerInstructions().build());
764 flow.setTableId((short) 0);
765 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
771 private short getTableId(String tableId) {
772 final short TABLE_ID = 2;
773 short table = TABLE_ID;
775 table = Short.parseShort(tableId);
776 } catch (Exception ex) {
777 LOG.info("Parsing String tableId {} failed. Continuing with default tableId {}.",
786 private static InstructionsBuilder createDecNwTtlInstructions() {
787 DecNwTtlBuilder ta = new DecNwTtlBuilder();
788 DecNwTtl decNwTtl = ta.build();
789 ActionBuilder ab = new ActionBuilder();
790 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
791 ab.setKey(new ActionKey(0));
792 // Add our drop action to a list
793 List<Action> actionList = new ArrayList<Action>();
794 actionList.add(ab.build());
796 // Create an Apply Action
797 ApplyActionsBuilder aab = new ApplyActionsBuilder();
798 aab.setAction(actionList);
800 // Wrap our Apply Action in an Instruction
801 InstructionBuilder ib = new InstructionBuilder();
802 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
803 ib.setKey(new InstructionKey(0));
806 // Put our Instruction in a list of Instructions
807 InstructionsBuilder isb = new InstructionsBuilder();
808 List<Instruction> instructions = new ArrayList<Instruction>();
809 instructions.add(ib.build());
810 ib.setKey(new InstructionKey(0));
811 isb.setInstruction(instructions);
818 private static InstructionsBuilder createMeterInstructions() {
820 MeterBuilder aab = new MeterBuilder();
821 aab.setMeterId(new MeterId(1L));
823 InstructionBuilder ib = new InstructionBuilder();
824 ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
826 // Put our Instruction in a list of Instructions
827 InstructionsBuilder isb = new InstructionsBuilder();
828 List<Instruction> instructions = new ArrayList<Instruction>();
829 ib.setKey(new InstructionKey(0));
830 instructions.add(ib.build());
831 isb.setInstruction(instructions);
835 private static InstructionsBuilder createMetadataInstructions() {
837 WriteMetadataBuilder aab = new WriteMetadataBuilder();
838 aab.setMetadata(BigInteger.valueOf(10));
839 aab.setMetadataMask(BigInteger.valueOf(10));
841 InstructionBuilder ib = new InstructionBuilder();
842 ib.setInstruction(new WriteMetadataCaseBuilder().setWriteMetadata(aab.build()).build());
844 // Put our Instruction in a list of Instructions
845 InstructionsBuilder isb = new InstructionsBuilder();
846 List<Instruction> instructions = new ArrayList<Instruction>();
847 ib.setKey(new InstructionKey(0));
848 instructions.add(ib.build());
849 isb.setInstruction(instructions);
853 private static InstructionsBuilder createGotoTableInstructions() {
855 GoToTableBuilder aab = new GoToTableBuilder();
856 aab.setTableId((short) 5);
858 InstructionBuilder ib = new InstructionBuilder();
859 ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(aab.build()).build());
861 // Put our Instruction in a list of Instructions
862 InstructionsBuilder isb = new InstructionsBuilder();
863 List<Instruction> instructions = new ArrayList<Instruction>();
864 ib.setKey(new InstructionKey(0));
865 instructions.add(ib.build());
866 isb.setInstruction(instructions);
870 private static InstructionsBuilder createDropInstructions() {
871 DropActionBuilder dab = new DropActionBuilder();
872 DropAction dropAction = dab.build();
873 ActionBuilder ab = new ActionBuilder();
874 ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build());
875 ab.setKey(new ActionKey(0));
876 // Add our drop action to a list
877 List<Action> actionList = new ArrayList<Action>();
878 actionList.add(ab.build());
879 ab.setKey(new ActionKey(0));
880 // Create an Apply Action
881 ApplyActionsBuilder aab = new ApplyActionsBuilder();
882 aab.setAction(actionList);
884 // Wrap our Apply Action in an Instruction
885 InstructionBuilder ib = new InstructionBuilder();
886 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
888 // Put our Instruction in a list of Instructions
889 InstructionsBuilder isb = new InstructionsBuilder();
890 List<Instruction> instructions = new ArrayList<Instruction>();
891 ib.setKey(new InstructionKey(0));
892 instructions.add(ib.build());
893 isb.setInstruction(instructions);
897 private static InstructionsBuilder createAppyActionInstruction() {
899 List<Action> actionList = new ArrayList<Action>();
900 ActionBuilder ab = new ActionBuilder();
901 ControllerActionBuilder controller = new ControllerActionBuilder();
902 controller.setMaxLength(5);
903 ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.build()).build());
904 ab.setKey(new ActionKey(0));
905 actionList.add(ab.build());
906 // Create an Apply Action
907 ApplyActionsBuilder aab = new ApplyActionsBuilder();
908 aab.setAction(actionList);
910 // Wrap our Apply Action in an Instruction
911 InstructionBuilder ib = new InstructionBuilder();
912 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
914 // Put our Instruction in a list of Instructions
915 InstructionsBuilder isb = new InstructionsBuilder();
916 List<Instruction> instructions = new ArrayList<Instruction>();
917 ib.setKey(new InstructionKey(0));
918 instructions.add(ib.build());
919 isb.setInstruction(instructions);
923 private static InstructionsBuilder createAppyActionInstruction1() {
925 List<Action> actionList = new ArrayList<Action>();
926 ActionBuilder ab = new ActionBuilder();
928 OutputActionBuilder output = new OutputActionBuilder();
929 output.setMaxLength(56);
930 Uri value = new Uri("PCEP");
931 output.setOutputNodeConnector(value);
932 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
933 ab.setKey(new ActionKey(0));
934 actionList.add(ab.build());
935 // Create an Apply Action
936 ApplyActionsBuilder aab = new ApplyActionsBuilder();
937 aab.setAction(actionList);
939 // Wrap our Apply Action in an Instruction
940 InstructionBuilder ib = new InstructionBuilder();
941 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
943 // Put our Instruction in a list of Instructions
944 InstructionsBuilder isb = new InstructionsBuilder();
945 List<Instruction> instructions = new ArrayList<Instruction>();
946 ib.setKey(new InstructionKey(0));
947 instructions.add(ib.build());
948 isb.setInstruction(instructions);
952 private static InstructionsBuilder createOutputInstructions() {
954 // test case for Output Port works if the particular port exists
955 // this particular test-case is for Port : 1
956 // tested as (addMDFlow openflow:<dpid> f82)
957 List<Action> actionList = new ArrayList<Action>();
958 ActionBuilder ab = new ActionBuilder();
959 OutputActionBuilder output = new OutputActionBuilder();
961 Uri value = new Uri("1");
962 output.setOutputNodeConnector(value);
963 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
965 ab.setKey(new ActionKey(0));
966 actionList.add(ab.build());
967 // Create an Apply Action
968 ApplyActionsBuilder aab = new ApplyActionsBuilder();
969 aab.setAction(actionList);
971 // Wrap our Apply Action in an Instruction
972 InstructionBuilder ib = new InstructionBuilder();
973 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
975 ib.setKey(new InstructionKey(0));
977 // Put our Instruction in a list of Instructions
978 InstructionsBuilder isb = new InstructionsBuilder();
979 List<Instruction> instructions = new ArrayList<Instruction>();
980 instructions.add(ib.build());
981 isb.setInstruction(instructions);
985 private static InstructionsBuilder createSentToControllerInstructions() {
986 List<Action> actionList = new ArrayList<Action>();
987 ActionBuilder ab = new ActionBuilder();
989 OutputActionBuilder output = new OutputActionBuilder();
990 output.setMaxLength(Integer.valueOf(0xffff));
991 Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
992 output.setOutputNodeConnector(value);
993 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
995 ab.setKey(new ActionKey(0));
996 actionList.add(ab.build());
997 // Create an Apply Action
998 ApplyActionsBuilder aab = new ApplyActionsBuilder();
999 aab.setAction(actionList);
1001 // Wrap our Apply Action in an Instruction
1002 InstructionBuilder ib = new InstructionBuilder();
1003 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1005 ib.setKey(new InstructionKey(0));
1007 // Put our Instruction in a list of Instructions
1008 InstructionsBuilder isb = new InstructionsBuilder();
1009 List<Instruction> instructions = new ArrayList<Instruction>();
1010 instructions.add(ib.build());
1011 isb.setInstruction(instructions);
1015 private static InstructionsBuilder createOutputInstructions(String outputType, int outputValue) {
1016 List<Action> actionList = new ArrayList<Action>();
1017 ActionBuilder ab = new ActionBuilder();
1019 OutputActionBuilder output = new OutputActionBuilder();
1020 output.setMaxLength(outputValue);
1021 Uri value = new Uri(outputType);
1022 output.setOutputNodeConnector(value);
1023 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
1025 ab.setKey(new ActionKey(0));
1026 actionList.add(ab.build());
1027 // Create an Apply Action
1028 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1029 aab.setAction(actionList);
1031 // Wrap our Apply Action in an Instruction
1032 InstructionBuilder ib = new InstructionBuilder();
1033 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1035 ib.setKey(new InstructionKey(0));
1037 // Put our Instruction in a list of Instructions
1038 InstructionsBuilder isb = new InstructionsBuilder();
1039 List<Instruction> instructions = new ArrayList<Instruction>();
1040 instructions.add(ib.build());
1041 isb.setInstruction(instructions);
1045 private static InstructionsBuilder createStripVlanInstructions() {
1046 List<Action> actionList = new ArrayList<Action>();
1047 ActionBuilder ab = new ActionBuilder();
1049 StripVlanActionBuilder stripActionBuilder = new StripVlanActionBuilder();
1050 ab.setAction(new StripVlanActionCaseBuilder().setStripVlanAction(stripActionBuilder.build()).build());
1052 ab.setKey(new ActionKey(0));
1053 actionList.add(ab.build());
1054 // Create an Apply Action
1055 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1056 aab.setAction(actionList);
1058 // Wrap our Apply Action in an Instruction
1059 InstructionBuilder ib = new InstructionBuilder();
1060 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1062 ib.setKey(new InstructionKey(0));
1064 // Put our Instruction in a list of Instructions
1065 InstructionsBuilder isb = new InstructionsBuilder();
1066 List<Instruction> instructions = new ArrayList<Instruction>();
1067 instructions.add(ib.build());
1068 isb.setInstruction(instructions);
1072 private static InstructionsBuilder createAppyActionInstruction2() {
1074 List<Action> actionList = new ArrayList<Action>();
1075 ActionBuilder ab = new ActionBuilder();
1077 PushMplsActionBuilder push = new PushMplsActionBuilder();
1078 push.setEthernetType(Integer.valueOf(0x8847));
1079 ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
1080 ab.setKey(new ActionKey(0));
1081 actionList.add(ab.build());
1082 // Create an Apply Action
1083 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1084 aab.setAction(actionList);
1086 // Wrap our Apply Action in an Instruction
1087 InstructionBuilder ib = new InstructionBuilder();
1088 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1090 // Put our Instruction in a list of Instructions
1091 InstructionsBuilder isb = new InstructionsBuilder();
1092 List<Instruction> instructions = new ArrayList<Instruction>();
1093 ib.setKey(new InstructionKey(0));
1094 instructions.add(ib.build());
1095 isb.setInstruction(instructions);
1099 private static InstructionsBuilder createAppyActionInstruction3() {
1101 List<Action> actionList = new ArrayList<Action>();
1102 ActionBuilder ab = new ActionBuilder();
1104 PushPbbActionBuilder pbb = new PushPbbActionBuilder();
1105 pbb.setEthernetType(Integer.valueOf(0x88E7));
1106 ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
1107 ab.setKey(new ActionKey(0));
1108 actionList.add(ab.build());
1109 // Create an Apply Action
1110 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1111 aab.setAction(actionList);
1113 // Wrap our Apply Action in an Instruction
1114 InstructionBuilder ib = new InstructionBuilder();
1115 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1117 // Put our Instruction in a list of Instructions
1118 InstructionsBuilder isb = new InstructionsBuilder();
1119 List<Instruction> instructions = new ArrayList<Instruction>();
1120 ib.setKey(new InstructionKey(0));
1121 instructions.add(ib.build());
1122 isb.setInstruction(instructions);
1126 private static InstructionsBuilder createAppyActionInstruction4() {
1128 List<Action> actionList = new ArrayList<Action>();
1129 ActionBuilder ab = new ActionBuilder();
1131 PushVlanActionBuilder vlan = new PushVlanActionBuilder();
1132 vlan.setEthernetType(Integer.valueOf(0x8100));
1133 ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
1134 ab.setKey(new ActionKey(0));
1135 actionList.add(ab.build());
1137 // Create an Apply Action
1138 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1139 aab.setAction(actionList);
1141 // Wrap our Apply Action in an Instruction
1142 InstructionBuilder ib = new InstructionBuilder();
1143 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1145 // Put our Instruction in a list of Instructions
1146 InstructionsBuilder isb = new InstructionsBuilder();
1147 List<Instruction> instructions = new ArrayList<Instruction>();
1148 ib.setKey(new InstructionKey(0));
1149 instructions.add(ib.build());
1150 isb.setInstruction(instructions);
1154 private static InstructionsBuilder createAppyActionInstruction5() {
1156 List<Action> actionList = new ArrayList<Action>();
1157 ActionBuilder ab = new ActionBuilder();
1159 SetDlDstActionBuilder setdl = new SetDlDstActionBuilder();
1160 setdl.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1161 ab.setAction(new SetDlDstActionCaseBuilder().setSetDlDstAction(setdl.build()).build());
1162 ab.setKey(new ActionKey(0));
1163 actionList.add(ab.build());
1164 // Create an Apply Action
1165 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1166 aab.setAction(actionList);
1168 // Wrap our Apply Action in an Instruction
1169 InstructionBuilder ib = new InstructionBuilder();
1170 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1172 // Put our Instruction in a list of Instructions
1173 InstructionsBuilder isb = new InstructionsBuilder();
1174 List<Instruction> instructions = new ArrayList<Instruction>();
1175 ib.setKey(new InstructionKey(0));
1176 instructions.add(ib.build());
1177 isb.setInstruction(instructions);
1181 private static InstructionsBuilder createAppyActionInstruction6() {
1183 List<Action> actionList = new ArrayList<Action>();
1184 ActionBuilder ab = new ActionBuilder();
1186 SetDlSrcActionBuilder src = new SetDlSrcActionBuilder();
1187 src.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1188 ab.setAction(new SetDlSrcActionCaseBuilder().setSetDlSrcAction(src.build()).build());
1189 ab.setKey(new ActionKey(0));
1190 actionList.add(ab.build());
1192 // Create an Apply Action
1193 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1194 aab.setAction(actionList);
1196 // Wrap our Apply Action in an Instruction
1197 InstructionBuilder ib = new InstructionBuilder();
1198 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1200 // Put our Instruction in a list of Instructions
1201 InstructionsBuilder isb = new InstructionsBuilder();
1202 List<Instruction> instructions = new ArrayList<Instruction>();
1203 ib.setKey(new InstructionKey(0));
1204 instructions.add(ib.build());
1205 isb.setInstruction(instructions);
1209 private static InstructionsBuilder createAppyActionInstruction7() {
1211 List<Action> actionList = new ArrayList<Action>();
1212 ActionBuilder ab = new ActionBuilder();
1214 SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
1215 VlanId a = new VlanId(4000);
1217 ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
1218 ab.setKey(new ActionKey(0));
1219 actionList.add(ab.build());
1220 // Create an Apply Action
1221 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1222 aab.setAction(actionList);
1224 // Wrap our Apply Action in an Instruction
1225 InstructionBuilder ib = new InstructionBuilder();
1226 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1228 // Put our Instruction in a list of Instructions
1229 InstructionsBuilder isb = new InstructionsBuilder();
1230 List<Instruction> instructions = new ArrayList<Instruction>();
1231 ib.setKey(new InstructionKey(0));
1232 instructions.add(ib.build());
1233 isb.setInstruction(instructions);
1237 private static InstructionsBuilder createAppyActionInstruction8() {
1239 List<Action> actionList = new ArrayList<Action>();
1240 ActionBuilder ab = new ActionBuilder();
1242 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1243 VlanPcp pcp1 = new VlanPcp((short) 2);
1244 pcp.setVlanPcp(pcp1);
1245 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1246 ab.setKey(new ActionKey(0));
1247 actionList.add(ab.build());
1248 // Create an Apply Action
1249 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1250 aab.setAction(actionList);
1252 // Wrap our Apply Action in an Instruction
1253 InstructionBuilder ib = new InstructionBuilder();
1254 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1256 // Put our Instruction in a list of Instructions
1257 InstructionsBuilder isb = new InstructionsBuilder();
1258 List<Instruction> instructions = new ArrayList<Instruction>();
1259 ib.setKey(new InstructionKey(0));
1260 instructions.add(ib.build());
1261 isb.setInstruction(instructions);
1265 private static InstructionsBuilder createAppyActionInstruction88() {
1267 List<Action> actionList = new ArrayList<Action>();
1268 ActionBuilder ab = new ActionBuilder();
1270 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1271 // the code point is a 3-bit(0-7) field representing the frame priority level
1272 VlanPcp pcp1 = new VlanPcp((short) 4);
1273 pcp.setVlanPcp(pcp1);
1274 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1275 ab.setKey(new ActionKey(0));
1276 actionList.add(ab.build());
1277 // Create an Apply Action
1278 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1279 aab.setAction(actionList);
1281 // Wrap our Apply Action in an Instruction
1282 InstructionBuilder ib = new InstructionBuilder();
1283 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1285 // Put our Instruction in a list of Instructions
1286 InstructionsBuilder isb = new InstructionsBuilder();
1287 List<Instruction> instructions = new ArrayList<Instruction>();
1288 ib.setKey(new InstructionKey(0));
1289 instructions.add(ib.build());
1290 isb.setInstruction(instructions);
1294 private static InstructionsBuilder createAppyActionInstruction9() {
1296 List<Action> actionList = new ArrayList<Action>();
1297 ActionBuilder ab = new ActionBuilder();
1299 CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
1300 ab.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
1301 ab.setKey(new ActionKey(0));
1302 actionList.add(ab.build());
1303 // Create an Apply Action
1304 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1305 aab.setAction(actionList);
1307 // Wrap our Apply Action in an Instruction
1308 InstructionBuilder ib = new InstructionBuilder();
1309 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1311 // Put our Instruction in a list of Instructions
1312 InstructionsBuilder isb = new InstructionsBuilder();
1313 List<Instruction> instructions = new ArrayList<Instruction>();
1314 ib.setKey(new InstructionKey(0));
1315 instructions.add(ib.build());
1316 isb.setInstruction(instructions);
1320 private static InstructionsBuilder createAppyActionInstruction10() {
1322 List<Action> actionList = new ArrayList<Action>();
1323 ActionBuilder ab = new ActionBuilder();
1325 CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
1326 ab.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
1327 ab.setKey(new ActionKey(0));
1328 actionList.add(ab.build());
1329 // Create an Apply Action
1330 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1331 aab.setAction(actionList);
1333 // Wrap our Apply Action in an Instruction
1334 InstructionBuilder ib = new InstructionBuilder();
1335 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1337 // Put our Instruction in a list of Instructions
1338 InstructionsBuilder isb = new InstructionsBuilder();
1339 List<Instruction> instructions = new ArrayList<Instruction>();
1340 ib.setKey(new InstructionKey(0));
1341 instructions.add(ib.build());
1342 isb.setInstruction(instructions);
1346 private static InstructionsBuilder createAppyActionInstruction11() {
1348 List<Action> actionList = new ArrayList<Action>();
1349 ActionBuilder ab = new ActionBuilder();
1351 DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
1352 ab.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
1353 ab.setKey(new ActionKey(0));
1354 actionList.add(ab.build());
1355 // Create an Apply Action
1356 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1357 aab.setAction(actionList);
1359 // Wrap our Apply Action in an Instruction
1360 InstructionBuilder ib = new InstructionBuilder();
1361 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1362 ib.setKey(new InstructionKey(0));
1365 // Put our Instruction in a list of Instruction
1366 InstructionsBuilder isb = new InstructionsBuilder();
1367 List<Instruction> instructions = new ArrayList<Instruction>();
1368 instructions.add(ib.build());
1369 isb.setInstruction(instructions);
1373 private static InstructionsBuilder createAppyActionInstruction12() {
1375 List<Action> actionList = new ArrayList<Action>();
1376 ActionBuilder ab = new ActionBuilder();
1378 DecNwTtlBuilder nwttl = new DecNwTtlBuilder();
1379 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(nwttl.build()).build());
1380 ab.setKey(new ActionKey(0));
1381 actionList.add(ab.build());
1383 // Create an Apply Action
1384 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1385 aab.setAction(actionList);
1387 // Wrap our Apply Action in an Instruction
1388 InstructionBuilder ib = new InstructionBuilder();
1389 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1391 // Put our Instruction in a list of Instructions
1392 InstructionsBuilder isb = new InstructionsBuilder();
1393 List<Instruction> instructions = new ArrayList<Instruction>();
1394 ib.setKey(new InstructionKey(0));
1395 instructions.add(ib.build());
1396 isb.setInstruction(instructions);
1400 private static InstructionsBuilder createAppyActionInstruction13() {
1402 List<Action> actionList = new ArrayList<Action>();
1403 ActionBuilder ab = new ActionBuilder();
1405 DropActionBuilder drop = new DropActionBuilder();
1406 ab.setAction(new DropActionCaseBuilder().setDropAction(drop.build()).build());
1407 ab.setKey(new ActionKey(0));
1408 actionList.add(ab.build());
1410 // Create an Apply Action
1411 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1412 aab.setAction(actionList);
1414 // Wrap our Apply Action in an Instruction
1415 InstructionBuilder ib = new InstructionBuilder();
1416 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1418 // Put our Instruction in a list of Instructions
1419 InstructionsBuilder isb = new InstructionsBuilder();
1420 List<Instruction> instructions = new ArrayList<Instruction>();
1421 ib.setKey(new InstructionKey(0));
1422 instructions.add(ib.build());
1423 isb.setInstruction(instructions);
1427 private static InstructionsBuilder createAppyActionInstruction14() {
1429 List<Action> actionList = new ArrayList<Action>();
1430 ActionBuilder ab = new ActionBuilder();
1432 FloodActionBuilder fld = new FloodActionBuilder();
1433 ab.setAction(new FloodActionCaseBuilder().setFloodAction(fld.build()).build());
1434 ab.setKey(new ActionKey(0));
1435 actionList.add(ab.build());
1436 // Create an Apply Action
1437 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1438 aab.setAction(actionList);
1440 // Wrap our Apply Action in an Instruction
1441 InstructionBuilder ib = new InstructionBuilder();
1442 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1444 // Put our Instruction in a list of Instructions
1445 InstructionsBuilder isb = new InstructionsBuilder();
1446 List<Instruction> instructions = new ArrayList<Instruction>();
1447 ib.setKey(new InstructionKey(0));
1448 instructions.add(ib.build());
1449 isb.setInstruction(instructions);
1453 private static InstructionsBuilder createAppyActionInstruction15() {
1455 List<Action> actionList = new ArrayList<Action>();
1456 ActionBuilder ab = new ActionBuilder();
1458 FloodAllActionBuilder fldall = new FloodAllActionBuilder();
1459 ab.setAction(new FloodAllActionCaseBuilder().setFloodAllAction(fldall.build()).build());
1460 ab.setKey(new ActionKey(0));
1461 actionList.add(ab.build());
1462 // Create an Apply Action
1463 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1464 aab.setAction(actionList);
1466 // Wrap our Apply Action in an Instruction
1467 InstructionBuilder ib = new InstructionBuilder();
1468 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1470 // Put our Instruction in a list of Instructions
1471 InstructionsBuilder isb = new InstructionsBuilder();
1472 List<Instruction> instructions = new ArrayList<Instruction>();
1473 ib.setKey(new InstructionKey(0));
1474 instructions.add(ib.build());
1475 isb.setInstruction(instructions);
1479 private static InstructionsBuilder createAppyActionInstruction16() {
1481 List<Action> actionList = new ArrayList<Action>();
1482 ActionBuilder ab = new ActionBuilder();
1484 GroupActionBuilder groupActionB = new GroupActionBuilder();
1485 groupActionB.setGroupId(1L);
1486 groupActionB.setGroup("0");
1487 ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
1488 ab.setKey(new ActionKey(0));
1489 actionList.add(ab.build());
1491 // Create an Apply Action
1492 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1493 aab.setAction(actionList);
1495 // Wrap our Apply Action in an Instruction
1496 InstructionBuilder ib = new InstructionBuilder();
1497 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1499 // Put our Instruction in a list of Instructions
1500 InstructionsBuilder isb = new InstructionsBuilder();
1501 List<Instruction> instructions = new ArrayList<Instruction>();
1502 ib.setKey(new InstructionKey(0));
1503 instructions.add(ib.build());
1504 isb.setInstruction(instructions);
1508 private static InstructionsBuilder createAppyActionInstruction17() {
1510 List<Action> actionList = new ArrayList<Action>();
1511 ActionBuilder ab = new ActionBuilder();
1513 HwPathActionBuilder hwPathB = new HwPathActionBuilder();
1514 ab.setAction(new HwPathActionCaseBuilder().setHwPathAction(hwPathB.build()).build());
1515 ab.setKey(new ActionKey(0));
1516 actionList.add(ab.build());
1517 // Create an Apply Action
1518 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1519 aab.setAction(actionList);
1521 // Wrap our Apply Action in an Instruction
1522 InstructionBuilder ib = new InstructionBuilder();
1523 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1525 // Put our Instruction in a list of Instructions
1526 InstructionsBuilder isb = new InstructionsBuilder();
1527 List<Instruction> instructions = new ArrayList<Instruction>();
1528 ib.setKey(new InstructionKey(0));
1529 instructions.add(ib.build());
1530 isb.setInstruction(instructions);
1534 private static InstructionsBuilder createAppyActionInstruction18() {
1536 List<Action> actionList = new ArrayList<Action>();
1537 ActionBuilder ab = new ActionBuilder();
1539 LoopbackActionBuilder loopbackActionBuilder = new LoopbackActionBuilder();
1540 ab.setAction(new LoopbackActionCaseBuilder().setLoopbackAction(loopbackActionBuilder.build()).build());
1541 ab.setKey(new ActionKey(0));
1542 actionList.add(ab.build());
1544 // Create an Apply Action
1545 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1546 aab.setAction(actionList);
1548 // Wrap our Apply Action in an Instruction
1549 InstructionBuilder ib = new InstructionBuilder();
1550 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1552 // Put our Instruction in a list of Instructions
1553 InstructionsBuilder isb = new InstructionsBuilder();
1554 List<Instruction> instructions = new ArrayList<Instruction>();
1555 ib.setKey(new InstructionKey(0));
1556 instructions.add(ib.build());
1557 isb.setInstruction(instructions);
1561 private static InstructionsBuilder createAppyActionInstruction19() {
1563 List<Action> actionList = new ArrayList<Action>();
1564 ActionBuilder ab = new ActionBuilder();
1566 PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
1567 popMplsActionBuilder.setEthernetType(0XB);
1568 ab.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
1569 ab.setKey(new ActionKey(0));
1570 actionList.add(ab.build());
1571 // Create an Apply Action
1572 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1573 aab.setAction(actionList);
1575 // Wrap our Apply Action in an Instruction
1576 InstructionBuilder ib = new InstructionBuilder();
1577 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1579 // Put our Instruction in a list of Instructions
1580 InstructionsBuilder isb = new InstructionsBuilder();
1581 List<Instruction> instructions = new ArrayList<Instruction>();
1582 ib.setKey(new InstructionKey(0));
1583 instructions.add(ib.build());
1584 isb.setInstruction(instructions);
1588 private static InstructionsBuilder createAppyActionInstruction20() {
1590 List<Action> actionList = new ArrayList<Action>();
1591 ActionBuilder ab = new ActionBuilder();
1593 PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
1594 ab.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
1595 ab.setKey(new ActionKey(0));
1596 actionList.add(ab.build());
1597 // Create an Apply Action
1598 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1599 aab.setAction(actionList);
1601 // Wrap our Apply Action in an Instruction
1602 InstructionBuilder ib = new InstructionBuilder();
1603 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1605 // Put our Instruction in a list of Instructions
1606 InstructionsBuilder isb = new InstructionsBuilder();
1607 List<Instruction> instructions = new ArrayList<Instruction>();
1608 ib.setKey(new InstructionKey(0));
1609 instructions.add(ib.build());
1610 isb.setInstruction(instructions);
1614 private static InstructionsBuilder createAppyActionInstruction21() {
1616 List<Action> actionList = new ArrayList<Action>();
1617 ActionBuilder ab = new ActionBuilder();
1619 PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder();
1620 ab.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(popVlanActionBuilder.build()).build());
1621 ab.setKey(new ActionKey(0));
1622 actionList.add(ab.build());
1624 // Create an Apply Action
1625 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1626 aab.setAction(actionList);
1628 // Wrap our Apply Action in an Instruction
1629 InstructionBuilder ib = new InstructionBuilder();
1630 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1632 // Put our Instruction in a list of Instructions
1633 InstructionsBuilder isb = new InstructionsBuilder();
1634 List<Instruction> instructions = new ArrayList<Instruction>();
1635 ib.setKey(new InstructionKey(0));
1636 instructions.add(ib.build());
1637 isb.setInstruction(instructions);
1641 private static InstructionsBuilder createAppyActionInstruction22() {
1643 List<Action> actionList = new ArrayList<Action>();
1644 ActionBuilder ab = new ActionBuilder();
1646 SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
1647 setDlTypeActionBuilder.setDlType(new EtherType(8L));
1648 ab.setAction(new SetDlTypeActionCaseBuilder().setSetDlTypeAction(setDlTypeActionBuilder.build()).build());
1649 ab.setKey(new ActionKey(0));
1650 actionList.add(ab.build());
1652 // Create an Apply Action
1653 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1654 aab.setAction(actionList);
1656 // Wrap our Apply Action in an Instruction
1657 InstructionBuilder ib = new InstructionBuilder();
1658 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1660 // Put our Instruction in a list of Instructions
1661 InstructionsBuilder isb = new InstructionsBuilder();
1662 List<Instruction> instructions = new ArrayList<Instruction>();
1663 ib.setKey(new InstructionKey(0));
1664 instructions.add(ib.build());
1665 isb.setInstruction(instructions);
1669 private static InstructionsBuilder createAppyActionInstruction23(NodeId nodeId) {
1671 List<Action> actionList = new ArrayList<Action>();
1672 ActionBuilder ab = new ActionBuilder();
1674 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1675 setFieldBuilder.setInPort(new NodeConnectorId(nodeId + ":2"));
1676 ab.setKey(new ActionKey(0));
1677 actionList.add(ab.build());
1679 // Create an Apply Action
1680 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1681 aab.setAction(actionList);
1683 // Wrap our Apply Action in an Instruction
1684 InstructionBuilder ib = new InstructionBuilder();
1685 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1687 // Put our Instruction in a list of Instructions
1688 InstructionsBuilder isb = new InstructionsBuilder();
1689 List<Instruction> instructions = new ArrayList<Instruction>();
1690 ib.setKey(new InstructionKey(0));
1691 instructions.add(ib.build());
1692 isb.setInstruction(instructions);
1696 private static InstructionsBuilder createAppyActionInstruction24() {
1698 List<Action> actionList = new ArrayList<Action>();
1699 ActionBuilder ab = new ActionBuilder();
1701 SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
1702 setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
1703 ab.setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(setMplsTtlActionBuilder.build()).build());
1704 ab.setKey(new ActionKey(0));
1705 actionList.add(ab.build());
1707 // Create an Apply Action
1708 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1709 aab.setAction(actionList);
1711 // Wrap our Apply Action in an Instruction
1712 InstructionBuilder ib = new InstructionBuilder();
1713 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1715 // Put our Instruction in a list of Instructions
1716 InstructionsBuilder isb = new InstructionsBuilder();
1717 List<Instruction> instructions = new ArrayList<Instruction>();
1718 ib.setKey(new InstructionKey(0));
1719 instructions.add(ib.build());
1720 isb.setInstruction(instructions);
1724 private static InstructionsBuilder createAppyActionInstruction25() {
1726 List<Action> actionList = new ArrayList<Action>();
1727 ActionBuilder ab = new ActionBuilder();
1729 SetNextHopActionBuilder setNextHopActionBuilder = new SetNextHopActionBuilder();
1730 Ipv4Builder ipnext = new Ipv4Builder();
1731 Ipv4Prefix prefix = new Ipv4Prefix(IPV4_PREFIX);
1732 ipnext.setIpv4Address(prefix);
1733 setNextHopActionBuilder.setAddress(ipnext.build());
1734 ab.setAction(new SetNextHopActionCaseBuilder().setSetNextHopAction(setNextHopActionBuilder.build()).build());
1735 ab.setKey(new ActionKey(0));
1736 actionList.add(ab.build());
1738 // Create an Apply Action
1739 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1740 aab.setAction(actionList);
1742 // Wrap our Apply Action in an Instruction
1743 InstructionBuilder ib = new InstructionBuilder();
1744 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1746 // Put our Instruction in a list of Instructions
1747 InstructionsBuilder isb = new InstructionsBuilder();
1748 List<Instruction> instructions = new ArrayList<Instruction>();
1749 ib.setKey(new InstructionKey(0));
1750 instructions.add(ib.build());
1751 isb.setInstruction(instructions);
1755 private static InstructionsBuilder createAppyActionInstruction26() {
1757 List<Action> actionList = new ArrayList<Action>();
1758 ActionBuilder ab = new ActionBuilder();
1760 SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
1761 Ipv4Builder ipdst = new Ipv4Builder();
1762 Ipv4Prefix prefixdst = new Ipv4Prefix("10.0.0.21/24");
1763 ipdst.setIpv4Address(prefixdst);
1764 setNwDstActionBuilder.setAddress(ipdst.build());
1765 ab.setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build());
1766 ab.setKey(new ActionKey(0));
1767 actionList.add(ab.build());
1769 // Create an Apply Action
1770 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1771 aab.setAction(actionList);
1773 // Wrap our Apply Action in an Instruction
1774 InstructionBuilder ib = new InstructionBuilder();
1775 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1777 // Put our Instruction in a list of Instructions
1778 InstructionsBuilder isb = new InstructionsBuilder();
1779 List<Instruction> instructions = new ArrayList<Instruction>();
1780 ib.setKey(new InstructionKey(0));
1781 instructions.add(ib.build());
1782 isb.setInstruction(instructions);
1786 private static InstructionsBuilder createAppyActionInstruction27() {
1788 List<Action> actionList = new ArrayList<Action>();
1789 ActionBuilder ab = new ActionBuilder();
1791 SetNwSrcActionBuilder setNwsrcActionBuilder = new SetNwSrcActionBuilder();
1792 Ipv4Builder ipsrc = new Ipv4Builder();
1793 Ipv4Prefix prefixsrc = new Ipv4Prefix("10.0.23.21/24");
1794 ipsrc.setIpv4Address(prefixsrc);
1795 setNwsrcActionBuilder.setAddress(ipsrc.build());
1796 ab.setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwsrcActionBuilder.build()).build());
1797 ab.setKey(new ActionKey(0));
1798 actionList.add(ab.build());
1800 // Create an Apply Action
1801 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1802 aab.setAction(actionList);
1804 // Wrap our Apply Action in an Instruction
1805 InstructionBuilder ib = new InstructionBuilder();
1806 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1808 // Put our Instruction in a list of Instructions
1809 InstructionsBuilder isb = new InstructionsBuilder();
1810 List<Instruction> instructions = new ArrayList<Instruction>();
1811 ib.setKey(new InstructionKey(0));
1812 instructions.add(ib.build());
1813 isb.setInstruction(instructions);
1817 private static InstructionsBuilder createAppyActionInstruction28() {
1819 List<Action> actionList = new ArrayList<Action>();
1820 ActionBuilder ab = new ActionBuilder();
1822 SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
1823 setNwTosActionBuilder.setTos(8);
1824 ab.setAction(new SetNwTosActionCaseBuilder().setSetNwTosAction(setNwTosActionBuilder.build()).build());
1825 ab.setKey(new ActionKey(0));
1826 actionList.add(ab.build());
1827 // Create an Apply Action
1828 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1829 aab.setAction(actionList);
1831 // Wrap our Apply Action in an Instruction
1832 InstructionBuilder ib = new InstructionBuilder();
1833 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1835 // Put our Instruction in a list of Instructions
1836 InstructionsBuilder isb = new InstructionsBuilder();
1837 List<Instruction> instructions = new ArrayList<Instruction>();
1838 ib.setKey(new InstructionKey(0));
1839 instructions.add(ib.build());
1840 isb.setInstruction(instructions);
1844 private static InstructionsBuilder createAppyActionInstruction29() {
1846 List<Action> actionList = new ArrayList<Action>();
1847 ActionBuilder ab = new ActionBuilder();
1849 SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
1850 setNwTtlActionBuilder.setNwTtl((short) 1);
1851 ab.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
1852 ab.setKey(new ActionKey(0));
1853 actionList.add(ab.build());
1855 // Create an Apply Action
1856 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1857 aab.setAction(actionList);
1859 // Wrap our Apply Action in an Instruction
1860 InstructionBuilder ib = new InstructionBuilder();
1861 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1863 // Put our Instruction in a list of Instructions
1864 InstructionsBuilder isb = new InstructionsBuilder();
1865 List<Instruction> instructions = new ArrayList<Instruction>();
1866 ib.setKey(new InstructionKey(0));
1867 instructions.add(ib.build());
1868 isb.setInstruction(instructions);
1872 private static InstructionsBuilder createAppyActionInstruction30() {
1874 List<Action> actionList = new ArrayList<Action>();
1875 ActionBuilder ab = new ActionBuilder();
1877 SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
1878 setQueueActionBuilder.setQueueId(1L);
1879 ab.setAction(new SetQueueActionCaseBuilder().setSetQueueAction(setQueueActionBuilder.build()).build());
1880 ab.setKey(new ActionKey(0));
1881 actionList.add(ab.build());
1882 // Create an Apply Action
1883 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1884 aab.setAction(actionList);
1886 // Wrap our Apply Action in an Instruction
1887 InstructionBuilder ib = new InstructionBuilder();
1888 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1890 // Put our Instruction in a list of Instructions
1891 InstructionsBuilder isb = new InstructionsBuilder();
1892 List<Instruction> instructions = new ArrayList<Instruction>();
1893 ib.setKey(new InstructionKey(0));
1894 instructions.add(ib.build());
1895 isb.setInstruction(instructions);
1899 private static InstructionsBuilder createAppyActionInstruction31() {
1901 List<Action> actionList = new ArrayList<Action>();
1902 ActionBuilder ab = new ActionBuilder();
1904 SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
1905 setTpDstActionBuilder.setPort(new PortNumber(109));
1907 ab.setAction(new SetTpDstActionCaseBuilder().setSetTpDstAction(setTpDstActionBuilder.build()).build());
1908 ab.setKey(new ActionKey(0));
1909 actionList.add(ab.build());
1910 // Create an Apply Action
1911 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1912 aab.setAction(actionList);
1914 // Wrap our Apply Action in an Instruction
1915 InstructionBuilder ib = new InstructionBuilder();
1916 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1918 // Put our Instruction in a list of Instructions
1919 InstructionsBuilder isb = new InstructionsBuilder();
1920 List<Instruction> instructions = new ArrayList<Instruction>();
1921 ib.setKey(new InstructionKey(0));
1922 instructions.add(ib.build());
1923 isb.setInstruction(instructions);
1927 private static InstructionsBuilder createAppyActionInstruction32() {
1929 List<Action> actionList = new ArrayList<Action>();
1930 ActionBuilder ab = new ActionBuilder();
1932 SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
1933 setTpSrcActionBuilder.setPort(new PortNumber(109));
1934 ab.setAction(new SetTpSrcActionCaseBuilder().setSetTpSrcAction(setTpSrcActionBuilder.build()).build());
1935 ab.setKey(new ActionKey(0));
1936 actionList.add(ab.build());
1938 // Create an Apply Action
1939 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1940 aab.setAction(actionList);
1942 // Wrap our Apply Action in an Instruction
1943 InstructionBuilder ib = new InstructionBuilder();
1944 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1946 // Put our Instruction in a list of Instructions
1947 InstructionsBuilder isb = new InstructionsBuilder();
1948 List<Instruction> instructions = new ArrayList<Instruction>();
1949 ib.setKey(new InstructionKey(0));
1950 instructions.add(ib.build());
1951 isb.setInstruction(instructions);
1955 private static InstructionsBuilder createAppyActionInstruction33() {
1957 List<Action> actionList = new ArrayList<Action>();
1958 ActionBuilder ab = new ActionBuilder();
1960 SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
1961 setVlanCfiActionBuilder.setVlanCfi(new VlanCfi(2));
1962 ab.setAction(new SetVlanCfiActionCaseBuilder().setSetVlanCfiAction(setVlanCfiActionBuilder.build()).build());
1963 ab.setKey(new ActionKey(0));
1964 actionList.add(ab.build());
1966 // Create an Apply Action
1967 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1968 aab.setAction(actionList);
1970 // Wrap our Apply Action in an Instruction
1971 InstructionBuilder ib = new InstructionBuilder();
1972 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1974 // Put our Instruction in a list of Instructions
1975 InstructionsBuilder isb = new InstructionsBuilder();
1976 List<Instruction> instructions = new ArrayList<Instruction>();
1977 ib.setKey(new InstructionKey(0));
1978 instructions.add(ib.build());
1979 isb.setInstruction(instructions);
1983 private static InstructionsBuilder createAppyActionInstruction34() {
1985 List<Action> actionList = new ArrayList<Action>();
1986 ActionBuilder ab = new ActionBuilder();
1988 SwPathActionBuilder swPathAction = new SwPathActionBuilder();
1989 ab.setAction(new SwPathActionCaseBuilder().setSwPathAction(swPathAction.build()).build());
1990 ab.setKey(new ActionKey(0));
1991 actionList.add(ab.build());
1993 // Create an Apply Action
1994 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1995 aab.setAction(actionList);
1997 // Wrap our Apply Action in an Instruction
1998 InstructionBuilder ib = new InstructionBuilder();
1999 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2001 // Put our Instruction in a list of Instructions
2002 InstructionsBuilder isb = new InstructionsBuilder();
2003 List<Instruction> instructions = new ArrayList<Instruction>();
2004 ib.setKey(new InstructionKey(0));
2005 instructions.add(ib.build());
2006 isb.setInstruction(instructions);
2010 private static InstructionsBuilder createAppyActionInstruction35() {
2012 List<Action> actionList = new ArrayList<Action>();
2013 ActionBuilder ab = new ActionBuilder();
2014 ActionBuilder ab1 = new ActionBuilder();
2015 ActionBuilder ab2 = new ActionBuilder();
2017 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2018 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2019 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2022 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
2023 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
2024 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
2025 EthernetMatchBuilder ethernetMatch1 = new EthernetMatchBuilder();
2026 EthernetDestinationBuilder ethDestBuilder = new EthernetDestinationBuilder();
2027 ethDestBuilder.setAddress(new MacAddress("00:00:00:00:00:02"));
2028 EthernetMatchBuilder ethernetMatch2 = new EthernetMatchBuilder();
2029 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2030 ethTypeBuilder.setType(new EtherType(0x86ddL));
2032 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
2033 ethernetMatch1.setEthernetDestination(ethDestBuilder.build());
2034 ethernetMatch2.setEthernetType(ethTypeBuilder.build());
2035 setFieldBuilder.setEthernetMatch(ethernetMatch.build());
2036 setFieldBuilder1.setEthernetMatch(ethernetMatch1.build());
2037 setFieldBuilder2.setEthernetMatch(ethernetMatch2.build());
2038 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2039 ab.setKey(new ActionKey(0));
2040 actionList.add(ab.build());
2042 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2043 ab1.setKey(new ActionKey(1));
2044 actionList.add(ab1.build());
2046 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2047 ab2.setKey(new ActionKey(2));
2048 actionList.add(ab2.build());
2050 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2051 aab.setAction(actionList);
2053 InstructionBuilder ib = new InstructionBuilder();
2054 ib.setKey(new InstructionKey(0));
2055 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2057 // Put our Instruction in a list of Instructions
2058 InstructionsBuilder isb = new InstructionsBuilder();
2059 List<Instruction> instructions = new ArrayList<Instruction>();
2060 ib.setKey(new InstructionKey(0));
2061 instructions.add(ib.build());
2062 isb.setInstruction(instructions);
2066 private static InstructionsBuilder createAppyActionInstruction36() {
2068 List<Action> actionList = new ArrayList<Action>();
2069 ActionBuilder ab = new ActionBuilder();
2070 ActionBuilder ab1 = new ActionBuilder();
2072 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2073 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2076 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
2077 VlanMatchBuilder vlanBuilder1 = new VlanMatchBuilder();
2078 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
2079 VlanId vlanId = new VlanId(10);
2080 VlanPcp vpcp = new VlanPcp((short) 3);
2081 vlanBuilder.setVlanPcp(vpcp);
2082 vlanBuilder1.setVlanId(vlanIdBuilder.setVlanId(vlanId).setVlanIdPresent(true).build());
2083 setFieldBuilder.setVlanMatch(vlanBuilder.build());
2084 setFieldBuilder1.setVlanMatch(vlanBuilder1.build());
2085 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2086 ab.setKey(new ActionKey(0));
2087 actionList.add(ab.build());
2088 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2089 ab1.setKey(new ActionKey(1));
2090 actionList.add(ab1.build());
2092 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2093 aab.setAction(actionList);
2095 InstructionBuilder ib = new InstructionBuilder();
2096 ib.setKey(new InstructionKey(0));
2097 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2099 // Put our Instruction in a list of Instructions
2100 InstructionsBuilder isb = new InstructionsBuilder();
2101 List<Instruction> instructions = new ArrayList<Instruction>();
2102 instructions.add(ib.build());
2103 isb.setInstruction(instructions);
2107 private static InstructionsBuilder createAppyActionInstruction37() {
2109 List<Action> actionList = new ArrayList<Action>();
2110 ActionBuilder ab = new ActionBuilder();
2111 ActionBuilder ab1 = new ActionBuilder();
2112 ActionBuilder ab2 = new ActionBuilder();
2114 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2115 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2116 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2118 IpMatchBuilder ipmatch = new IpMatchBuilder();
2119 IpMatchBuilder ipmatch1 = new IpMatchBuilder();
2120 IpMatchBuilder ipmatch2 = new IpMatchBuilder();
2121 Dscp dscp = new Dscp((short) 3);
2122 ipmatch.setIpDscp(dscp);
2123 ipmatch1.setIpEcn((short) 2);
2124 ipmatch2.setIpProtocol((short) 120);
2125 setFieldBuilder.setIpMatch(ipmatch.build());
2126 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2127 ab.setKey(new ActionKey(0));
2128 actionList.add(ab.build());
2130 setFieldBuilder1.setIpMatch(ipmatch1.build());
2131 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2132 ab1.setKey(new ActionKey(1));
2133 actionList.add(ab1.build());
2135 setFieldBuilder2.setIpMatch(ipmatch2.build());
2136 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2137 ab2.setKey(new ActionKey(2));
2138 actionList.add(ab2.build());
2140 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2141 aab.setAction(actionList);
2143 InstructionBuilder ib = new InstructionBuilder();
2144 ib.setKey(new InstructionKey(0));
2145 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2147 // Put our Instruction in a list of Instructions
2148 InstructionsBuilder isb = new InstructionsBuilder();
2149 List<Instruction> instructions = new ArrayList<Instruction>();
2150 instructions.add(ib.build());
2151 isb.setInstruction(instructions);
2155 private static InstructionsBuilder createAppyActionInstruction38() {
2157 List<Action> actionList = new ArrayList<Action>();
2158 ActionBuilder ab = new ActionBuilder();
2159 ActionBuilder ab1 = new ActionBuilder();
2161 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2162 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2164 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2165 Ipv4MatchBuilder ipv4Match1 = new Ipv4MatchBuilder();
2166 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.5210");
2167 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1");
2168 ipv4Match1.setIpv4Destination(dstip);
2169 ipv4Match.setIpv4Source(srcip);
2170 setFieldBuilder.setLayer3Match(ipv4Match.build());
2171 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2172 ab.setKey(new ActionKey(0));
2173 actionList.add(ab.build());
2175 setFieldBuilder1.setLayer3Match(ipv4Match1.build());
2176 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2177 ab1.setKey(new ActionKey(1));
2178 actionList.add(ab1.build());
2180 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2181 aab.setAction(actionList);
2183 InstructionBuilder ib = new InstructionBuilder();
2184 ib.setKey(new InstructionKey(0));
2185 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2187 // Put our Instruction in a list of Instructions
2188 InstructionsBuilder isb = new InstructionsBuilder();
2189 List<Instruction> instructions = new ArrayList<Instruction>();
2190 instructions.add(ib.build());
2191 isb.setInstruction(instructions);
2195 private static InstructionsBuilder createAppyActionInstruction39() {
2197 List<Action> actionList = new ArrayList<Action>();
2198 ActionBuilder ab = new ActionBuilder();
2199 ActionBuilder ab1 = new ActionBuilder();
2201 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2202 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2205 PortNumber tcpsrcport = new PortNumber(1213);
2206 PortNumber tcpdstport = new PortNumber(646);
2207 TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
2208 TcpMatchBuilder tcpmatch1 = new TcpMatchBuilder();
2209 tcpmatch.setTcpSourcePort(tcpsrcport);
2210 tcpmatch1.setTcpDestinationPort(tcpdstport);
2211 setFieldBuilder.setLayer4Match(tcpmatch.build());
2212 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2213 ab.setKey(new ActionKey(0));
2214 actionList.add(ab.build());
2216 setFieldBuilder1.setLayer4Match(tcpmatch1.build());
2217 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2218 ab1.setKey(new ActionKey(1));
2219 actionList.add(ab.build());
2221 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2222 aab.setAction(actionList);
2224 InstructionBuilder ib = new InstructionBuilder();
2225 ib.setKey(new InstructionKey(0));
2226 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2228 // Put our Instruction in a list of Instructions
2229 InstructionsBuilder isb = new InstructionsBuilder();
2230 List<Instruction> instructions = new ArrayList<Instruction>();
2231 instructions.add(ib.build());
2232 isb.setInstruction(instructions);
2236 private static InstructionsBuilder createAppyActionInstruction40() {
2238 List<Action> actionList = new ArrayList<Action>();
2239 ActionBuilder ab = new ActionBuilder();
2240 ActionBuilder ab1 = new ActionBuilder();
2242 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2243 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2246 PortNumber udpsrcport = new PortNumber(1325);
2247 PortNumber udpdstport = new PortNumber(42);
2248 UdpMatchBuilder udpmatch = new UdpMatchBuilder();
2249 UdpMatchBuilder udpmatch1 = new UdpMatchBuilder();
2250 udpmatch.setUdpDestinationPort(udpdstport);
2251 udpmatch1.setUdpSourcePort(udpsrcport);
2252 setFieldBuilder.setLayer4Match(udpmatch.build());
2253 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2254 ab.setKey(new ActionKey(0));
2255 actionList.add(ab.build());
2257 setFieldBuilder1.setLayer4Match(udpmatch1.build());
2258 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2259 ab1.setKey(new ActionKey(1));
2260 actionList.add(ab1.build());
2262 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2263 aab.setAction(actionList);
2265 InstructionBuilder ib = new InstructionBuilder();
2266 ib.setKey(new InstructionKey(0));
2267 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2269 // Put our Instruction in a list of Instructions
2270 InstructionsBuilder isb = new InstructionsBuilder();
2271 List<Instruction> instructions = new ArrayList<Instruction>();
2272 instructions.add(ib.build());
2273 isb.setInstruction(instructions);
2277 private static InstructionsBuilder createAppyActionInstruction41() {
2279 List<Action> actionList = new ArrayList<Action>();
2280 ActionBuilder ab = new ActionBuilder();
2281 ActionBuilder ab1 = new ActionBuilder();
2283 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2284 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2287 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
2288 SctpMatchBuilder sctpmatch1 = new SctpMatchBuilder();
2289 PortNumber srcport = new PortNumber(1435);
2290 PortNumber dstport = new PortNumber(22);
2291 sctpmatch.setSctpSourcePort(srcport);
2292 sctpmatch1.setSctpDestinationPort(dstport);
2293 setFieldBuilder.setLayer4Match(sctpmatch.build());
2294 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2295 ab.setKey(new ActionKey(0));
2296 actionList.add(ab.build());
2298 setFieldBuilder1.setLayer4Match(sctpmatch1.build());
2299 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2300 ab1.setKey(new ActionKey(1));
2301 actionList.add(ab1.build());
2303 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2304 aab.setAction(actionList);
2306 InstructionBuilder ib = new InstructionBuilder();
2307 ib.setKey(new InstructionKey(0));
2308 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2310 // Put our Instruction in a list of Instructions
2311 InstructionsBuilder isb = new InstructionsBuilder();
2312 List<Instruction> instructions = new ArrayList<Instruction>();
2313 instructions.add(ib.build());
2314 isb.setInstruction(instructions);
2318 private static InstructionsBuilder createAppyActionInstruction42() {
2320 List<Action> actionList = new ArrayList<Action>();
2321 ActionBuilder ab = new ActionBuilder();
2322 ActionBuilder ab1 = new ActionBuilder();
2323 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2324 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2327 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
2328 Icmpv4MatchBuilder icmpv4match1 = new Icmpv4MatchBuilder();
2329 icmpv4match.setIcmpv4Type((short) 8);
2330 icmpv4match1.setIcmpv4Code((short) 0);
2331 setFieldBuilder.setIcmpv4Match(icmpv4match.build());
2332 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2333 ab.setKey(new ActionKey(0));
2334 actionList.add(ab.build());
2336 setFieldBuilder1.setIcmpv4Match(icmpv4match1.build());
2337 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2338 ab1.setKey(new ActionKey(1));
2339 actionList.add(ab1.build());
2341 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2342 aab.setAction(actionList);
2344 InstructionBuilder ib = new InstructionBuilder();
2345 ib.setKey(new InstructionKey(0));
2346 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2348 // Put our Instruction in a list of Instructions
2349 InstructionsBuilder isb = new InstructionsBuilder();
2350 List<Instruction> instructions = new ArrayList<Instruction>();
2351 instructions.add(ib.build());
2352 isb.setInstruction(instructions);
2356 private static InstructionsBuilder createAppyActionInstruction43() {
2358 List<Action> actionList = new ArrayList<Action>();
2359 ActionBuilder ab = new ActionBuilder();
2360 ActionBuilder ab1 = new ActionBuilder();
2361 ActionBuilder ab2 = new ActionBuilder();
2362 ActionBuilder ab3 = new ActionBuilder();
2363 ActionBuilder ab4 = new ActionBuilder();
2365 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2366 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2367 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2368 SetFieldBuilder setFieldBuilder3 = new SetFieldBuilder();
2369 SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder();
2371 // setting the values of ARP
2372 MacAddress macdest = new MacAddress(DEST_MAC_ADDRESS);
2373 MacAddress macsrc = new MacAddress(SRC_MAC_ADDRESS);
2374 Ipv4Prefix dstiparp = new Ipv4Prefix("200.71.9.52");
2375 Ipv4Prefix srciparp = new Ipv4Prefix("100.1.1.1");
2376 // create ARP match action
2377 ArpMatchBuilder arpmatch = new ArpMatchBuilder();
2378 ArpMatchBuilder arpmatch1 = new ArpMatchBuilder();
2379 ArpMatchBuilder arpmatch2 = new ArpMatchBuilder();
2380 ArpMatchBuilder arpmatch3 = new ArpMatchBuilder();
2381 ArpMatchBuilder arpmatch4 = new ArpMatchBuilder();
2382 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2383 arpsrc.setAddress(macsrc);
2384 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2385 arpdst.setAddress(macdest);
2386 arpmatch.setArpOp(2);
2387 arpmatch1.setArpSourceHardwareAddress(arpsrc.build());
2388 arpmatch2.setArpTargetHardwareAddress(arpdst.build());
2389 arpmatch3.setArpSourceTransportAddress(srciparp);
2390 arpmatch4.setArpTargetTransportAddress(dstiparp);
2391 setFieldBuilder.setLayer3Match(arpmatch.build());
2392 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2393 ab.setKey(new ActionKey(0));
2394 actionList.add(ab.build());
2396 setFieldBuilder1.setLayer3Match(arpmatch1.build());
2397 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2398 ab1.setKey(new ActionKey(1));
2399 actionList.add(ab1.build());
2401 setFieldBuilder2.setLayer3Match(arpmatch2.build());
2402 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2403 ab2.setKey(new ActionKey(2));
2404 actionList.add(ab2.build());
2406 setFieldBuilder3.setLayer3Match(arpmatch3.build());
2407 ab3.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2408 ab3.setKey(new ActionKey(3));
2409 actionList.add(ab3.build());
2411 setFieldBuilder4.setLayer3Match(arpmatch4.build());
2412 ab4.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2413 ab4.setKey(new ActionKey(4));
2414 actionList.add(ab4.build());
2416 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2417 aab.setAction(actionList);
2419 InstructionBuilder ib = new InstructionBuilder();
2420 ib.setKey(new InstructionKey(0));
2421 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2423 // Put our Instruction in a list of Instructions
2424 InstructionsBuilder isb = new InstructionsBuilder();
2425 List<Instruction> instructions = new ArrayList<Instruction>();
2426 instructions.add(ib.build());
2427 isb.setInstruction(instructions);
2431 private static InstructionsBuilder createAppyActionInstruction44() {
2433 List<Action> actionLists = new ArrayList<Action>();
2434 ActionBuilder ab = new ActionBuilder();
2435 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2436 ActionBuilder ab1 = new ActionBuilder();
2437 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2438 ActionBuilder ab5 = new ActionBuilder();
2439 SetFieldBuilder setFieldBuilder5 = new SetFieldBuilder();
2440 ActionBuilder ab6 = new ActionBuilder();
2441 SetFieldBuilder setFieldBuilder6 = new SetFieldBuilder();
2444 Ipv6MatchBuilder ipv6Builder = new Ipv6MatchBuilder();
2445 Ipv6MatchBuilder ipv6Builder1 = new Ipv6MatchBuilder();
2446 Ipv6MatchBuilder ipv6Builder5 = new Ipv6MatchBuilder();
2447 Ipv6MatchBuilder ipv6Builder6 = new Ipv6MatchBuilder();
2449 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2");
2450 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1");
2451 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2452 nextheader.setIpv6Exthdr(58);
2453 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2454 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2455 ipv6label.setIpv6Flabel(label);
2457 ipv6Builder.setIpv6Source(srcip6);
2458 ipv6Builder1.setIpv6Destination(dstip6);
2459 ipv6Builder5.setIpv6ExtHeader(nextheader.build());
2460 ipv6Builder6.setIpv6Label(ipv6label.build());
2462 setFieldBuilder.setLayer3Match(ipv6Builder.build());
2463 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2464 ab.setKey(new ActionKey(0));
2465 actionLists.add(ab.build());
2467 setFieldBuilder1.setLayer3Match(ipv6Builder1.build());
2468 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2469 ab1.setKey(new ActionKey(1));
2470 actionLists.add(ab1.build());
2472 setFieldBuilder5.setLayer3Match(ipv6Builder5.build());
2473 ab5.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder5.build()).build());
2474 ab5.setKey(new ActionKey(5));
2475 actionLists.add(ab5.build());
2477 setFieldBuilder6.setLayer3Match(ipv6Builder6.build());
2478 ab6.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder6.build()).build());
2479 ab6.setKey(new ActionKey(6));
2480 actionLists.add(ab6.build());
2482 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2483 aab.setAction(actionLists);
2485 InstructionBuilder ib = new InstructionBuilder();
2486 ib.setKey(new InstructionKey(0));
2487 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2489 // Put our Instruction in a list of Instructions
2490 InstructionsBuilder isb = new InstructionsBuilder();
2491 List<Instruction> instructions = new ArrayList<Instruction>();
2492 instructions.add(ib.build());
2493 isb.setInstruction(instructions);
2497 private static InstructionsBuilder createAppyActionInstruction45() {
2499 List<Action> actionList = new ArrayList<Action>();
2500 ActionBuilder ab = new ActionBuilder();
2501 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2502 ActionBuilder ab1 = new ActionBuilder();
2503 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2506 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
2507 Icmpv6MatchBuilder icmpv6match1 = new Icmpv6MatchBuilder();
2508 icmpv6match.setIcmpv6Type((short) 135);
2509 icmpv6match1.setIcmpv6Code((short) 0);
2510 setFieldBuilder.setIcmpv6Match(icmpv6match.build());
2511 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2512 ab.setKey(new ActionKey(0));
2513 actionList.add(ab.build());
2515 setFieldBuilder1.setIcmpv6Match(icmpv6match1.build());
2516 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2517 ab1.setKey(new ActionKey(1));
2518 actionList.add(ab1.build());
2520 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2521 aab.setAction(actionList);
2523 InstructionBuilder ib = new InstructionBuilder();
2524 ib.setKey(new InstructionKey(0));
2525 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2527 // Put our Instruction in a list of Instructions
2528 InstructionsBuilder isb = new InstructionsBuilder();
2529 List<Instruction> instructions = new ArrayList<Instruction>();
2530 instructions.add(ib.build());
2531 isb.setInstruction(instructions);
2535 private static InstructionsBuilder createAppyActionInstruction46() {
2537 List<Action> actionList = new ArrayList<Action>();
2538 ActionBuilder ab = new ActionBuilder();
2539 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2540 ActionBuilder ab1 = new ActionBuilder();
2541 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2542 ActionBuilder ab2 = new ActionBuilder();
2543 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2546 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2547 ProtocolMatchFieldsBuilder protomatch1 = new ProtocolMatchFieldsBuilder();
2548 ProtocolMatchFieldsBuilder protomatch2 = new ProtocolMatchFieldsBuilder();
2549 protomatch.setMplsLabel((long) 36008);
2550 protomatch1.setMplsTc((short) 4);
2551 protomatch2.setMplsBos((short) 1);
2552 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2553 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2554 ab.setKey(new ActionKey(0));
2555 actionList.add(ab.build());
2557 setFieldBuilder1.setProtocolMatchFields(protomatch1.build());
2558 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2559 ab1.setKey(new ActionKey(1));
2560 actionList.add(ab1.build());
2562 setFieldBuilder2.setProtocolMatchFields(protomatch2.build());
2563 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2564 ab2.setKey(new ActionKey(2));
2565 actionList.add(ab2.build());
2567 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2568 aab.setAction(actionList);
2570 InstructionBuilder ib = new InstructionBuilder();
2571 ib.setKey(new InstructionKey(0));
2572 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2574 // Put our Instruction in a list of Instructions
2575 InstructionsBuilder isb = new InstructionsBuilder();
2576 List<Instruction> instructions = new ArrayList<Instruction>();
2577 instructions.add(ib.build());
2578 isb.setInstruction(instructions);
2582 private static InstructionsBuilder createAppyActionInstruction47() {
2584 List<Action> actionList = new ArrayList<Action>();
2585 ActionBuilder ab = new ActionBuilder();
2586 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2588 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2589 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask((new BigInteger(new byte[]{0, 1, 0, 0}).longValue())).build());
2590 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2591 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2592 actionList.add(ab.build());
2594 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2595 aab.setAction(actionList);
2597 InstructionBuilder ib = new InstructionBuilder();
2598 ib.setKey(new InstructionKey(0));
2599 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2601 // Put our Instruction in a list of Instructions
2602 InstructionsBuilder isb = new InstructionsBuilder();
2603 List<Instruction> instructions = new ArrayList<Instruction>();
2604 instructions.add(ib.build());
2605 isb.setInstruction(instructions);
2609 private static InstructionsBuilder createAppyActionInstruction48() {
2611 List<Action> actionList = new ArrayList<Action>();
2612 ActionBuilder ab = new ActionBuilder();
2613 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2615 TunnelBuilder tunnel = new TunnelBuilder();
2616 tunnel.setTunnelId(BigInteger.valueOf(10668));
2617 setFieldBuilder.setTunnel(tunnel.build());
2618 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2619 ab.setKey(new ActionKey(0));
2620 actionList.add(ab.build());
2622 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2623 aab.setAction(actionList);
2625 InstructionBuilder ib = new InstructionBuilder();
2626 ib.setKey(new InstructionKey(0));
2627 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2629 // Put our Instruction in a list of Instructions
2630 InstructionsBuilder isb = new InstructionsBuilder();
2631 List<Instruction> instructions = new ArrayList<Instruction>();
2632 instructions.add(ib.build());
2633 isb.setInstruction(instructions);
2637 private static InstructionsBuilder createTunnelIpv4DstInstructions() {
2639 List<Action> actionList = new ArrayList<Action>();
2640 ActionBuilder ab = new ActionBuilder();
2641 // Build the tunnel endpoint destination IPv4 address
2642 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2643 Ipv4Prefix dstIp = new Ipv4Prefix("172.16.100.100");
2644 // Add the mew IPv4 object as the tunnel destination
2645 TunnelIpv4MatchBuilder tunnelIpv4DstMatchBuilder = new TunnelIpv4MatchBuilder();
2646 tunnelIpv4DstMatchBuilder.setTunnelIpv4Destination(dstIp);
2647 setFieldBuilder.setLayer3Match(tunnelIpv4DstMatchBuilder.build());
2648 // Add the IPv4 tunnel dst to the set_field value
2649 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2651 ab.setKey(new ActionKey(0));
2652 actionList.add(ab.build());
2653 // Resulting action is a per/flow src TEP (set_field:172.16.100.100->tun_dst)
2654 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2655 aab.setAction(actionList);
2656 // Add the action to the ordered list of Instructions
2657 InstructionBuilder ib = new InstructionBuilder();
2659 ib.setKey(new InstructionKey(0));
2660 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2661 // Add the Instruction in a list of Instructions
2662 InstructionsBuilder isb = new InstructionsBuilder();
2663 List<Instruction> instructions = new ArrayList<Instruction>();
2664 instructions.add(ib.build());
2665 isb.setInstruction(instructions);
2669 private static InstructionsBuilder createTunnelIpv4SrcInstructions() {
2671 List<Action> actionList = new ArrayList<Action>();
2672 ActionBuilder ab = new ActionBuilder();
2673 // Build the tunnel endpoint source IPv4 address
2674 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2675 Ipv4Prefix dstIp = new Ipv4Prefix("172.16.100.200");
2676 // Add the new IPv4 object as the tunnel destination
2677 TunnelIpv4MatchBuilder tunnelIpv4MatchBuilder = new TunnelIpv4MatchBuilder();
2678 tunnelIpv4MatchBuilder.setTunnelIpv4Source(dstIp);
2679 setFieldBuilder.setLayer3Match(tunnelIpv4MatchBuilder.build());
2680 // Add the IPv4 tunnel src to the set_field value
2681 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2683 ab.setKey(new ActionKey(0));
2684 actionList.add(ab.build());
2685 // Resulting action is a per/flow src TEP (set_field:172.16.100.100->tun_src)
2686 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2687 aab.setAction(actionList);
2688 // Add the action to the ordered list of Instructions
2689 InstructionBuilder ib = new InstructionBuilder();
2691 ib.setKey(new InstructionKey(0));
2692 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2693 // Put our Instruction in a list of Instructions
2694 InstructionsBuilder isb = new InstructionsBuilder();
2695 List<Instruction> instructions = new ArrayList<Instruction>();
2696 instructions.add(ib.build());
2697 isb.setInstruction(instructions);
2701 private static MatchBuilder createLLDPMatch() {
2702 MatchBuilder match = new MatchBuilder();
2703 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2704 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2705 ethTypeBuilder.setType(new EtherType(0x88ccL));
2706 eth.setEthernetType(ethTypeBuilder.build());
2707 match.setEthernetMatch(eth.build());
2714 private static MatchBuilder createMatch1() {
2715 MatchBuilder match = new MatchBuilder();
2716 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2717 Ipv4Prefix prefix = new Ipv4Prefix(IPV4_PREFIX);;
2718 ipv4Match.setIpv4Destination(prefix);
2719 Ipv4Match i4m = ipv4Match.build();
2720 match.setLayer3Match(i4m);
2722 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2723 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2724 ethTypeBuilder.setType(new EtherType(0x0800L));
2725 eth.setEthernetType(ethTypeBuilder.build());
2726 match.setEthernetMatch(eth.build());
2734 private static MatchBuilder createMatch2() {
2735 MatchBuilder match = new MatchBuilder();
2736 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2737 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1");
2738 ipv4Match.setIpv4Source(prefix);
2739 Ipv4Match i4m = ipv4Match.build();
2740 match.setLayer3Match(i4m);
2742 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2743 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2744 ethTypeBuilder.setType(new EtherType(0x0800L));
2745 eth.setEthernetType(ethTypeBuilder.build());
2746 match.setEthernetMatch(eth.build());
2753 private static MatchBuilder createMatch3() {
2754 MatchBuilder match = new MatchBuilder();
2755 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
2756 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
2757 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
2758 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
2759 match.setEthernetMatch(ethernetMatch.build());
2767 private static MatchBuilder createICMPv6Match1() {
2769 MatchBuilder match = new MatchBuilder();
2770 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2771 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2772 ethTypeBuilder.setType(new EtherType(0x86ddL));
2773 eth.setEthernetType(ethTypeBuilder.build());
2774 match.setEthernetMatch(eth.build());
2777 IpMatchBuilder ipmatch = new IpMatchBuilder();
2778 ipmatch.setIpProtocol((short) 256);
2779 match.setIpMatch(ipmatch.build());
2782 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
2785 icmpv6match.setIcmpv6Type((short) 135);
2786 icmpv6match.setIcmpv6Code((short) 1);
2787 match.setIcmpv6Match(icmpv6match.build());
2792 private static MatchBuilder createMatch33() {
2794 MatchBuilder match = new MatchBuilder();
2795 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2796 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.10");
2797 ipv4Match.setIpv4Source(prefix);
2798 Ipv4Match i4m = ipv4Match.build();
2799 match.setLayer3Match(i4m);
2801 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2802 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2803 ethTypeBuilder.setType(new EtherType(0xfffeL));
2804 eth.setEthernetType(ethTypeBuilder.build());
2805 match.setEthernetMatch(eth.build());
2809 private static MatchBuilder createInphyportMatch(NodeId nodeId) {
2810 MatchBuilder match = new MatchBuilder();
2811 match.setInPort(new NodeConnectorId(nodeId + ":202"));
2812 match.setInPhyPort(new NodeConnectorId(nodeId + ":10122"));
2816 private static MatchBuilder createEthernetMatch() {
2817 MatchBuilder match = new MatchBuilder();
2818 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
2820 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2821 EtherType type = new EtherType(0x0800L);
2822 ethmatch.setEthernetType(ethtype.setType(type).build());
2824 EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet
2827 MacAddress macdest = new MacAddress(DEST_MAC_ADDRESS);
2828 ethdest.setAddress(macdest);
2829 ethdest.setMask(new MacAddress("ff:ff:ff:00:00:00"));
2831 ethmatch.setEthernetDestination(ethdest.build());
2833 EthernetSourceBuilder ethsrc = new EthernetSourceBuilder();
2834 MacAddress macsrc = new MacAddress(SRC_MAC_ADDRESS);
2835 ethsrc.setAddress(macsrc);
2836 ethsrc.setMask(new MacAddress("ff:ff:00:00:00:00"));
2838 ethmatch.setEthernetSource(ethsrc.build());
2839 match.setEthernetMatch(ethmatch.build());
2848 private static MatchBuilder createVlanMatch() {
2849 MatchBuilder match = new MatchBuilder();
2851 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
2852 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
2853 VlanId vlanId = new VlanId(10);
2854 VlanPcp vpcp = new VlanPcp((short) 3);
2855 vlanBuilder.setVlanPcp(vpcp);
2856 vlanIdBuilder.setVlanId(vlanId);
2857 vlanIdBuilder.setVlanIdPresent(true);
2858 vlanBuilder.setVlanId(vlanIdBuilder.build());
2859 match.setVlanMatch(vlanBuilder.build());
2866 private static MatchBuilder createArpMatch() {
2867 MatchBuilder match = new MatchBuilder();
2869 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2870 MacAddress macdest = new MacAddress(DEST_MAC_ADDRESS);
2871 MacAddress macsrc = new MacAddress(SRC_MAC_ADDRESS);
2873 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2874 EtherType type = new EtherType(0x0806L);
2875 ethmatch.setEthernetType(ethtype.setType(type).build());
2878 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10");
2879 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2882 ArpMatchBuilder arpmatch = new ArpMatchBuilder();
2883 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2884 arpsrc.setAddress(macsrc);
2885 arpsrc.setMask(new MacAddress("ff:ff:ff:00:00:00"));
2886 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2887 arpdst.setAddress(macdest);
2888 arpdst.setMask(new MacAddress("ff:ff:00:00:00:00"));
2889 arpmatch.setArpOp(2);
2890 arpmatch.setArpSourceHardwareAddress(arpsrc.build());
2891 arpmatch.setArpTargetHardwareAddress(arpdst.build());
2892 arpmatch.setArpSourceTransportAddress(srcip);
2893 arpmatch.setArpTargetTransportAddress(dstip);
2895 match.setEthernetMatch(ethmatch.build());
2896 match.setLayer3Match(arpmatch.build());
2905 private static MatchBuilder createL3IPv4Match() {
2906 MatchBuilder match = new MatchBuilder();
2908 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2909 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2910 ethTypeBuilder.setType(new EtherType(0x0800L));
2911 eth.setEthernetType(ethTypeBuilder.build());
2912 match.setEthernetMatch(eth.build());
2914 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2916 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10");
2917 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2918 Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
2919 ipv4match.setIpv4Destination(dstip);
2920 ipv4match.setIpv4Source(srcip);
2921 match.setLayer3Match(ipv4match.build());
2930 private static MatchBuilder createL3IPv6Match() {
2931 MatchBuilder match = new MatchBuilder();
2933 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2934 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2935 ethTypeBuilder.setType(new EtherType(0x86ddL));
2936 eth.setEthernetType(ethTypeBuilder.build());
2937 match.setEthernetMatch(eth.build());
2939 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2/64");
2940 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1/56");
2941 Ipv6Address ndtarget = new Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
2942 MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
2943 MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
2944 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2945 nextheader.setIpv6Exthdr(58);
2946 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2947 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2948 ipv6label.setIpv6Flabel(label);
2949 ipv6label.setFlabelMask(new Ipv6FlowLabel(1L));
2951 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2953 icmpv6match.setIcmpv6Type((short) 135);
2954 icmpv6match.setIcmpv6Code((short) 0);
2955 match.setIcmpv6Match(icmpv6match.build());
2957 Ipv6MatchBuilder ipv6match = new Ipv6MatchBuilder();
2958 // ipv6match.setIpv6Source(srcip6);
2959 // ipv6match.setIpv6Destination(dstip6);
2960 // ipv6match.setIpv6ExtHeader(nextheader.build());
2961 ipv6match.setIpv6NdSll(ndsll);
2962 ipv6match.setIpv6NdTll(ndtll);
2963 // ipv6match.setIpv6NdTarget(ndtarget);
2964 ipv6match.setIpv6Label(ipv6label.build());
2966 match.setLayer3Match(ipv6match.build());
2975 private static MatchBuilder createICMPv4Match() {
2976 MatchBuilder match = new MatchBuilder();
2977 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2978 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2979 ethTypeBuilder.setType(new EtherType(0x0800L));
2980 eth.setEthernetType(ethTypeBuilder.build());
2981 match.setEthernetMatch(eth.build());
2983 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2984 ipmatch.setIpProtocol((short) 1);
2985 match.setIpMatch(ipmatch.build());
2987 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder(); // icmpv4
2989 icmpv4match.setIcmpv4Type((short) 8);
2990 icmpv4match.setIcmpv4Code((short) 0);
2991 match.setIcmpv4Match(icmpv4match.build());
2998 private static MatchBuilder createICMPv6Match() {
3000 MatchBuilder match = new MatchBuilder();
3001 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3002 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3003 ethTypeBuilder.setType(new EtherType(0x86ddL));
3004 eth.setEthernetType(ethTypeBuilder.build());
3005 match.setEthernetMatch(eth.build());
3007 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3008 ipmatch.setIpProtocol((short) 58);
3009 match.setIpMatch(ipmatch.build());
3011 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
3013 icmpv6match.setIcmpv6Type((short) 135);
3014 icmpv6match.setIcmpv6Code((short) 1);
3015 match.setIcmpv6Match(icmpv6match.build());
3023 private static MatchBuilder createToSMatch() {
3024 MatchBuilder match = new MatchBuilder();
3025 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
3026 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
3027 EtherType type = new EtherType(0x0800L);
3028 ethmatch.setEthernetType(ethtype.setType(type).build());
3029 match.setEthernetMatch(ethmatch.build());
3031 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3032 ipmatch.setIpProtocol((short) 6);
3033 Dscp dscp = new Dscp((short) 8);
3034 ipmatch.setIpDscp(dscp);
3035 match.setIpMatch(ipmatch.build());
3043 private static MatchBuilder createL4TCPMatch() {
3044 MatchBuilder match = new MatchBuilder();
3046 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3047 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3048 ethTypeBuilder.setType(new EtherType(0x0800L));
3049 eth.setEthernetType(ethTypeBuilder.build());
3050 match.setEthernetMatch(eth.build());
3052 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3053 ipmatch.setIpProtocol((short) 6);
3054 match.setIpMatch(ipmatch.build());
3056 PortNumber srcport = new PortNumber(1213);
3057 PortNumber dstport = new PortNumber(646);
3058 TcpMatchBuilder tcpmatch = new TcpMatchBuilder(); // tcp match
3059 tcpmatch.setTcpSourcePort(srcport);
3060 tcpmatch.setTcpDestinationPort(dstport);
3061 match.setLayer4Match(tcpmatch.build());
3069 private static MatchBuilder createL4UDPMatch() {
3070 MatchBuilder match = new MatchBuilder();
3072 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3073 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3074 ethTypeBuilder.setType(new EtherType(0x0800L));
3075 eth.setEthernetType(ethTypeBuilder.build());
3076 match.setEthernetMatch(eth.build());
3078 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3079 ipmatch.setIpProtocol((short) 17);
3080 match.setIpMatch(ipmatch.build());
3082 PortNumber srcport = new PortNumber(1325);
3083 PortNumber dstport = new PortNumber(42);
3084 UdpMatchBuilder udpmatch = new UdpMatchBuilder(); // udp match
3085 udpmatch.setUdpDestinationPort(dstport);
3086 udpmatch.setUdpSourcePort(srcport);
3087 match.setLayer4Match(udpmatch.build());
3095 private static MatchBuilder createL4SCTPMatch() {
3096 MatchBuilder match = new MatchBuilder();
3098 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3099 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3100 ethTypeBuilder.setType(new EtherType(0x0800L));
3101 eth.setEthernetType(ethTypeBuilder.build());
3102 match.setEthernetMatch(eth.build());
3104 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3105 ipmatch.setIpProtocol((short) 132);
3106 match.setIpMatch(ipmatch.build());
3108 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
3109 PortNumber srcport = new PortNumber(1435);
3110 PortNumber dstport = new PortNumber(22);
3111 sctpmatch.setSctpSourcePort(srcport);
3112 sctpmatch.setSctpDestinationPort(dstport);
3113 match.setLayer4Match(sctpmatch.build());
3121 private static MatchBuilder createMetadataMatch() {
3122 MatchBuilder match = new MatchBuilder();
3123 byte[] metamask = new byte[]{(byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1};
3124 MetadataBuilder metadata = new MetadataBuilder(); // metadata match
3125 metadata.setMetadata(BigInteger.valueOf(500L));
3126 metadata.setMetadataMask(new BigInteger(1, metamask));
3127 match.setMetadata(metadata.build());
3135 private static MatchBuilder createMplsMatch() {
3136 MatchBuilder match = new MatchBuilder();
3138 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3139 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3140 ethTypeBuilder.setType(new EtherType(0x8847L));
3141 eth.setEthernetType(ethTypeBuilder.build());
3142 match.setEthernetMatch(eth.build());
3144 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3146 protomatch.setMplsLabel((long) 36008);
3147 protomatch.setMplsTc((short) 4);
3148 protomatch.setMplsBos((short) 1);
3149 match.setProtocolMatchFields(protomatch.build());
3158 private static MatchBuilder createPbbMatch() {
3159 MatchBuilder match = new MatchBuilder();
3161 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3162 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3163 ethTypeBuilder.setType(new EtherType(0x88E7L));
3164 eth.setEthernetType(ethTypeBuilder.build());
3165 match.setEthernetMatch(eth.build());
3167 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3169 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new BigInteger(new byte[]{0, 1, 0, 0}).longValue()).build());
3170 match.setProtocolMatchFields(protomatch.build());
3179 private static MatchBuilder createTunnelIDMatch() {
3180 MatchBuilder match = new MatchBuilder();
3181 TunnelBuilder tunnel = new TunnelBuilder(); // tunnel id match
3182 tunnel.setTunnelId(BigInteger.valueOf(10668));
3183 byte[] mask = new byte[]{(byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1};
3184 tunnel.setTunnelMask(new BigInteger(1, mask));
3185 match.setTunnel(tunnel.build());
3191 * Test match for TCP_Flags
3193 * @return match containing Ethertype (0x0800), IP Protocol (TCP), TCP_Flag (SYN)
3195 //FIXME: move to extensible support
3196 private static MatchBuilder createTcpFlagMatch() {
3197 MatchBuilder match = new MatchBuilder();
3200 EthernetMatchBuilder ethernetType = new EthernetMatchBuilder();
3201 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3202 ethTypeBuilder.setType(new EtherType(0x0800L));
3203 ethernetType.setEthernetType(ethTypeBuilder.build());
3204 match.setEthernetMatch(ethernetType.build());
3206 // TCP Protocol Match
3207 IpMatchBuilder ipMatch = new IpMatchBuilder(); // ipv4 version
3208 ipMatch.setIpProtocol((short) 6);
3209 match.setIpMatch(ipMatch.build());
3212 PortNumber dstPort = new PortNumber(80);
3213 TcpMatchBuilder tcpMatch = new TcpMatchBuilder();
3214 tcpMatch.setTcpDestinationPort(dstPort);
3215 match.setLayer4Match(tcpMatch.build());
3217 * Defined TCP Flag values in OVS v2.1+
3218 * TCP_FIN 0x001 / TCP_SYN 0x002 / TCP_RST 0x004
3219 * TCP_PSH 0x008 / TCP_ACK 0x010 / TCP_URG 0x020
3220 * TCP_ECE 0x040 / TCP_CWR 0x080 / TCP_NS 0x100
3222 TcpFlagMatchBuilder tcpFlagMatch = new TcpFlagMatchBuilder();
3223 tcpFlagMatch.setTcpFlag(0x002);
3224 match.setTcpFlagMatch(tcpFlagMatch.build());
3229 public void _removeMDFlow(final CommandInterpreter ci) {
3230 ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
3231 NodeBuilder tn = createTestNode(ci.nextArgument());
3232 String flowtype = ci.nextArgument();
3234 if (flowtype.equals("fTM")) {
3235 tf = createtablemiss();
3237 tf = createTestFlow(tn, flowtype, ci.nextArgument());
3239 InstanceIdentifier<Flow> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, tn.getKey())
3240 .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf.getTableId()))
3241 .child(Flow.class, tf.getKey());
3242 modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
3243 CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
3244 Futures.addCallback(commitFuture, new FutureCallback<Void>() {
3246 public void onSuccess(Void aVoid) {
3247 ci.println("Status of Group Data Loaded Transaction: success.");
3251 public void onFailure(Throwable throwable) {
3252 LOG.error(throwable.getMessage(), throwable);
3253 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
3259 * @param ci arguments: switchId flowType tableNum
3262 * e.g.: addMDFlow openflow:1 f1 42
3265 public void _addMDFlow(CommandInterpreter ci) {
3266 NodeBuilder tn = createTestNode(ci.nextArgument());
3267 String flowtype = ci.nextArgument();
3269 if (flowtype.equals("fTM")) {
3270 tf = createtablemiss();
3272 tf = createTestFlow(tn, flowtype, ci.nextArgument());
3274 writeFlow(ci, tf, tn);
3277 private void writeFlow(final CommandInterpreter ci, FlowBuilder flow, NodeBuilder nodeBuilder) {
3278 ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
3279 InstanceIdentifier<Flow> path1 = InstanceIdentifier.create(Nodes.class)
3280 .child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
3281 .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.getKey());
3282 modification.merge(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build(), true);
3283 modification.merge(LogicalDatastoreType.CONFIGURATION, path1, flow.build(), true);
3284 CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
3285 Futures.addCallback(commitFuture, new FutureCallback<Void>() {
3287 public void onSuccess(Void aVoid) {
3288 ci.println("Status of Group Data Loaded Transaction: success.");
3292 public void onFailure(Throwable throwable) {
3293 LOG.error(throwable.getMessage(), throwable);
3294 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
3299 public void _modifyMDFlow(CommandInterpreter ci) {
3300 NodeBuilder tn = createTestNode(ci.nextArgument());
3301 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
3302 tf.setFlowName(UPDATED_FLOW_NAME);
3303 writeFlow(ci, tf, tn);
3304 tf.setFlowName(ORIGINAL_FLOW_NAME);
3305 writeFlow(ci, tf, tn);
3308 private static NodeRef createNodeRef(String string) {
3309 NodeKey key = new NodeKey(new NodeId(string));
3310 InstanceIdentifier<Node> path = InstanceIdentifier.create(Nodes.class).child(Node.class, key);
3312 return new NodeRef(path);
3316 public String getHelp() {
3321 * usage testSwitchFlows <numberOfSwitches> <numberOfFlows> <warmup iterations> <Number Of Threads>
3322 * ex: _perfFlowTest 10 5 1 2
3324 public void _perfFlowTest(CommandInterpreter ci) {
3326 String numberOfSwtichesStr = ci.nextArgument();
3327 String numberOfFlowsStr = ci.nextArgument();
3328 String warmupIterationsStr = ci.nextArgument();
3329 String threadCountStr = ci.nextArgument();
3330 String warmUpStr = ci.nextArgument();
3332 Collection<String> testResults = null;
3333 if (testResults == null) {
3334 testResults = new ArrayList<String>();
3337 int numberOfSwtiches = 0;
3338 int numberOfFlows = 0;
3339 int warmupIterations = 0;
3340 boolean warmUpIterations = false;
3342 int threadCount = 0;
3343 if (numberOfSwtichesStr != null && !numberOfSwtichesStr.trim().equals("")) {
3344 numberOfSwtiches = Integer.parseInt(numberOfSwtichesStr);
3346 numberOfSwtiches = 2;
3349 if (numberOfFlowsStr != null && !numberOfFlowsStr.trim().equals("")) {
3350 numberOfFlows = Integer.parseInt(numberOfFlowsStr);
3355 if (warmupIterationsStr != null && !warmupIterationsStr.trim().equals("")) {
3356 warmupIterations = Integer.parseInt(warmupIterationsStr);
3358 warmupIterations = 2;
3361 if (threadCountStr != null && !threadCountStr.trim().equals("")) {
3362 threadCount = Integer.parseInt(threadCountStr);
3366 if (warmUpStr != null && !warmUpStr.trim().equals("") && warmUpStr.trim().equals("true")) {
3367 warmUpIterations = true;
3369 warmUpIterations = false;
3371 ci.println("* Test Configurations*");
3372 ci.println("* numberOfSwtiches:::" + numberOfSwtiches + "");
3373 ci.println("* numberOfFlows:::" + numberOfFlows + "");
3374 ci.println("* warmupIterations:::" + warmupIterations + "");
3375 ci.println("* Number of Threads :::" + threadCount + "");
3376 ci.println("* Warmup Required? :::" + warmUpIterations + "");
3378 String dataPath = "openflow:1";
3381 String tableId = "0";
3382 if (warmUpIterations) {
3383 ci.println("----Warmup Started-----");
3384 for (int j = 1; j <= warmupIterations; j++) {
3385 for (int i = 1; i <= numberOfSwtiches; i++) {
3386 dataPath = "openflow:" + i;
3387 tn = createTestNode(dataPath);
3388 for (int flow = 1; flow < numberOfFlows; flow++) {
3389 tf = createTestFlowPerfTest("f1", tableId, flow);
3390 writeFlow(ci, tf, tn);
3395 ci.println("----Warmup Done-----");
3398 ExecutorService executor = Executors.newFixedThreadPool(threadCount);
3400 for (int t = 0; t < threadCount; t++) {
3402 Runnable tRunnable = new TestFlowThread(numberOfSwtiches, numberOfFlows, ci, t, tableID);
3403 executor.execute(tRunnable);
3405 executor.shutdown();
3406 executor.awaitTermination(1, TimeUnit.SECONDS);
3407 } catch (Exception e) {
3408 ci.println("Exception:" + e.getMessage());
3412 public class TestFlowThread implements Runnable {
3414 int numberOfSwitches;
3417 CommandInterpreter ci;
3420 Collection<String> testResults = null;
3423 TestFlowThread(int numberOfSwtiches, int numberOfFlows, CommandInterpreter ci, int t, int tableID) {
3424 this.numberOfSwitches = numberOfSwtiches;
3425 this.numberOfFlows = numberOfFlows;
3427 this.theadNumber = t;
3428 this.tableID = tableID;
3436 public void executeFlow() {
3438 String dataPath = "openflow:1";
3441 //String tableId = "0";
3443 ci.println("New Thread started with id: ID_"
3444 + this.theadNumber);
3445 int totalNumberOfFlows = 0;
3446 long startTime = System.currentTimeMillis();
3448 for (int i = 1; i <= this.numberOfSwitches; i++) {
3449 dataPath = "openflow:" + i;
3450 tn = createTestNode(dataPath);
3451 for (int flow2 = 1; flow2 <= this.numberOfFlows; flow2++) {
3452 tf = createTestFlowPerfTest("f1", "" + this.tableID, flow2);
3453 writeFlow(this.ci, tf, tn);
3454 totalNumberOfFlows++;
3457 long endTime = System.currentTimeMillis();
3458 long timeInSeconds = Math.round((endTime - startTime) / 1000);
3459 if (timeInSeconds > 0) {
3460 ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::" + Math.round(totalNumberOfFlows / timeInSeconds));
3462 ci.println("Total flows added in Thread:" + this.theadNumber + ": Flows/Sec::" + totalNumberOfFlows);
3469 * usage testAllFlows <dp>
3470 * ex: _perfFlowTest 1
3472 public void _testAllFlows(CommandInterpreter ci) {
3473 String dataPathID = ci.nextArgument();
3474 int numberOfFlows = 82;
3475 if (dataPathID == null || dataPathID.trim().equals("")) {
3478 ci.println("* Test All Flows *");
3479 ci.println("* dataPathID:::" + dataPathID + "");
3480 String dataPath = "openflow:" + dataPathID;
3481 String tableId = "0";
3482 NodeBuilder tn = createTestNode(dataPath);
3484 for (int flow = 1; flow < numberOfFlows; flow++) {
3485 String flowID = "f" + flow;
3487 tf = createTestFlow(tn, flowID, tableId);
3488 writeFlow(ci, tf, tn);
3489 } catch (Exception e) {
3490 ci.println("--Test Failed--Issue found while adding flow" + flow);