2 * Copyright (c) 2013 Ericsson , Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.openflowplugin.test;
11 import java.math.BigInteger;
12 import java.util.ArrayList;
13 import java.util.List;
14 import java.util.concurrent.ExecutionException;
15 import java.util.concurrent.Future;
17 import org.eclipse.osgi.framework.console.CommandInterpreter;
18 import org.eclipse.osgi.framework.console.CommandProvider;
19 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
20 import org.opendaylight.controller.md.sal.common.api.data.DataModification;
21 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
22 import org.opendaylight.controller.sal.binding.api.NotificationListener;
23 import org.opendaylight.controller.sal.binding.api.NotificationService;
24 import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
25 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
26 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
27 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
28 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6FlowLabel;
29 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Prefix;
30 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
31 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
32 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionCaseBuilder;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCaseBuilder;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCaseBuilder;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCaseBuilder;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCaseBuilder;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodActionCaseBuilder;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAllActionCaseBuilder;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCaseBuilder;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.HwPathActionCaseBuilder;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.LoopbackActionCaseBuilder;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCaseBuilder;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopPbbActionCaseBuilder;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCaseBuilder;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCaseBuilder;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCaseBuilder;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCaseBuilder;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCaseBuilder;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCaseBuilder;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlTypeActionCaseBuilder;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCaseBuilder;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNextHopActionCaseBuilder;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCaseBuilder;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionCaseBuilder;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCaseBuilder;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCaseBuilder;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCaseBuilder;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCaseBuilder;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanCfiActionCaseBuilder;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCaseBuilder;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.StripVlanActionCaseBuilder;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SwPathActionCaseBuilder;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.controller.action._case.ControllerActionBuilder;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.in._case.CopyTtlInBuilder;
72 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.out._case.CopyTtlOutBuilder;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.mpls.ttl._case.DecMplsTtlBuilder;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtl;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropAction;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.action._case.FloodActionBuilder;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.all.action._case.FloodAllActionBuilder;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder;
81 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.hw.path.action._case.HwPathActionBuilder;
82 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.loopback.action._case.LoopbackActionBuilder;
83 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder;
84 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
85 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbActionBuilder;
86 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder;
87 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder;
88 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder;
89 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder;
90 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstActionBuilder;
91 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder;
92 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.type.action._case.SetDlTypeActionBuilder;
93 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;
94 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlActionBuilder;
95 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.next.hop.action._case.SetNextHopActionBuilder;
96 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder;
97 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder;
98 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.tos.action._case.SetNwTosActionBuilder;
99 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder;
100 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.queue.action._case.SetQueueActionBuilder;
101 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstActionBuilder;
102 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder;
103 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.cfi.action._case.SetVlanCfiActionBuilder;
104 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder;
105 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.pcp.action._case.SetVlanPcpActionBuilder;
106 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.strip.vlan.action._case.StripVlanActionBuilder;
107 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.sw.path.action._case.SwPathActionBuilder;
108 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
109 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
110 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
111 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
112 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.Flows;
113 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
114 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
115 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
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.service.rev130819.FlowAdded;
119 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved;
120 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowUpdated;
121 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeErrorNotification;
122 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeExperimenterErrorNotification;
123 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowListener;
124 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SwitchFlowRemoved;
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.NodeId;
141 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
142 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
143 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
144 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
145 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
146 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
147 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
148 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
149 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
150 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.ExperimenterBuilder;
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.TunnelBuilder;
165 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
166 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder;
167 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match;
168 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
169 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
170 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder;
171 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
172 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
173 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.protocol.match.fields.PbbBuilder;
174 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
175 import org.opendaylight.yangtools.concepts.Registration;
176 import org.opendaylight.yangtools.yang.binding.DataObject;
177 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
178 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
179 import org.opendaylight.yangtools.yang.common.RpcResult;
180 import org.osgi.framework.BundleContext;
181 import org.slf4j.Logger;
182 import org.slf4j.LoggerFactory;
183 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
184 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
186 public class OpenflowpluginTestCommandProvider implements CommandProvider {
188 private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
190 private DataBrokerService dataBrokerService;
191 private ProviderContext pc;
192 private final BundleContext ctx;
193 private FlowBuilder testFlow;
194 private NodeBuilder testNode;
195 private final String originalFlowName = "Foo";
196 private final String updatedFlowName = "Bar";
197 private FlowEventListener flowEventListener = new FlowEventListener();
198 private static NotificationService notificationService;
199 private Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> listener1Reg;
201 public OpenflowpluginTestCommandProvider(BundleContext ctx) {
205 public void onSessionInitiated(ProviderContext session) {
207 notificationService = session.getSALService(NotificationService.class);
209 listener1Reg = notificationService.registerNotificationListener(flowEventListener);
210 dataBrokerService = session.getSALService(DataBrokerService.class);
211 ctx.registerService(CommandProvider.class.getName(), this, null);
212 createTestFlow(createTestNode(null), null, null);
215 private NodeBuilder createTestNode(String nodeId) {
216 if (nodeId == null) {
217 nodeId = OpenflowpluginTestActivator.NODE_ID;
219 NodeRef nodeOne = createNodeRef(nodeId);
220 NodeBuilder builder = new NodeBuilder();
221 builder.setId(new NodeId(nodeId));
222 builder.setKey(new NodeKey(builder.getId()));
227 final class FlowEventListener implements SalFlowListener {
229 List<FlowAdded> addedFlows = new ArrayList<>();
230 List<FlowRemoved> removedFlows = new ArrayList<>();
231 List<FlowUpdated> updatedFlows = new ArrayList<>();
234 public void onFlowAdded(FlowAdded notification) {
235 System.out.println("flow to be added.........................."+notification.toString());
236 System.out.println("added flow Xid........................."+notification.getTransactionId().getValue());
237 System.out.println("-----------------------------------------------------------------------------------");
238 addedFlows.add(notification);
242 public void onFlowRemoved(FlowRemoved notification) {
243 System.out.println("removed flow.........................." + notification.toString());
244 System.out.println("remove flow Xid........................." + notification.getTransactionId().getValue());
245 System.out.println("-----------------------------------------------------------------------------------");
246 removedFlows.add(notification);
250 public void onFlowUpdated(FlowUpdated notification) {
251 System.out.println("updated flow.........................." + notification.toString());
252 System.out.println("updated flow Xid........................." + notification.getTransactionId().getValue());
253 System.out.println("-----------------------------------------------------------------------------------");
254 updatedFlows.add(notification);
258 public void onNodeErrorNotification(NodeErrorNotification notification) {
259 System.out.println("Error notification flow Xid........................." + notification.getTransactionId().getValue());
260 System.out.println("-----------------------------------------------------------------------------------");
264 public void onNodeExperimenterErrorNotification(NodeExperimenterErrorNotification notification) {
265 // TODO Auto-generated method stub
270 public void onSwitchFlowRemoved(SwitchFlowRemoved notification) {
271 System.out.println("Switch flow removed flow..........................");
272 // TODO Auto-generated method stub
278 private InstanceIdentifier<Node> nodeBuilderToInstanceId(NodeBuilder node) {
279 return InstanceIdentifier.builder(Nodes.class).child(Node.class, node.getKey()).toInstance();
282 private FlowBuilder createTestFlow(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
284 FlowBuilder flow = new FlowBuilder();
287 String flowType = flowTypeArg;
288 if (flowType == null) {
295 flow.setMatch(createMatch1().build());
296 flow.setInstructions(createDecNwTtlInstructions().build());
300 flow.setMatch(createMatch2().build());
301 flow.setInstructions(createDropInstructions().build());
305 flow.setMatch(createMatch3().build());
306 flow.setInstructions(createDropInstructions().build());
310 flow.setMatch(createEthernetMatch().build());
311 flow.setInstructions(createDropInstructions().build());
315 flow.setMatch(createMatch1().build());
316 flow.setInstructions(createAppyActionInstruction().build());
320 flow.setMatch(createMatch1().build());
321 flow.setInstructions(createGotoTableInstructions().build());
325 flow.setMatch(createMatch1().build());
326 flow.setInstructions(createMeterInstructions().build());
330 flow.setMatch(createMatch1().build());
331 flow.setInstructions(createAppyActionInstruction1().build());
335 flow.setMatch(createMatch1().build());
336 flow.setInstructions(createAppyActionInstruction2().build());
340 flow.setMatch(createMatch1().build());
341 flow.setInstructions(createAppyActionInstruction3().build());
345 flow.setMatch(createMatch1().build());
346 flow.setInstructions(createAppyActionInstruction4().build());
350 flow.setMatch(createMatch1().build());
351 flow.setInstructions(createAppyActionInstruction5().build());
355 flow.setMatch(createMatch1().build());
356 flow.setInstructions(createAppyActionInstruction6().build());
360 flow.setMatch(createMatch1().build());
361 flow.setInstructions(createAppyActionInstruction7().build());
365 flow.setMatch(createMatch1().build());
366 flow.setInstructions(createAppyActionInstruction8().build());
370 flow.setMatch(createMatch1().build());
371 flow.setInstructions(createAppyActionInstruction9().build());
375 flow.setMatch(createMatch1().build());
376 flow.setInstructions(createAppyActionInstruction10().build());
380 flow.setMatch(createMatch1().build());
381 flow.setInstructions(createAppyActionInstruction11().build());
385 flow.setMatch(createMatch1().build());
386 flow.setInstructions(createAppyActionInstruction12().build());
390 flow.setMatch(createMatch1().build());
391 flow.setInstructions(createAppyActionInstruction13().build());
395 flow.setMatch(createMatch1().build());
396 flow.setInstructions(createAppyActionInstruction14().build());
400 flow.setMatch(createMatch1().build());
401 flow.setInstructions(createAppyActionInstruction15().build());
405 flow.setMatch(createMatch1().build());
406 flow.setInstructions(createAppyActionInstruction16().build());
410 flow.setMatch(createMatch1().build());
411 flow.setInstructions(createAppyActionInstruction17().build());
415 flow.setMatch(createMatch1().build());
416 flow.setInstructions(createAppyActionInstruction18().build());
420 flow.setMatch(createMatch1().build());
421 flow.setInstructions(createAppyActionInstruction19().build());
425 flow.setMatch(createMatch1().build());
426 flow.setInstructions(createMetadataInstructions().build());
430 flow.setMatch(createMatch1().build());
431 flow.setInstructions(createAppyActionInstruction20().build());
435 flow.setMatch(createMatch1().build());
436 flow.setInstructions(createAppyActionInstruction21().build());
440 flow.setMatch(createMatch1().build());
441 flow.setInstructions(createAppyActionInstruction22().build());
445 flow.setMatch(createMatch1().build());
446 flow.setInstructions(createAppyActionInstruction23().build());
450 flow.setMatch(createMatch1().build());
451 flow.setInstructions(createAppyActionInstruction24().build());
455 flow.setMatch(createMatch1().build());
456 flow.setInstructions(createAppyActionInstruction25().build());
460 flow.setMatch(createMatch1().build());
461 flow.setInstructions(createAppyActionInstruction26().build());
465 flow.setMatch(createMatch1().build());
466 flow.setInstructions(createAppyActionInstruction27().build());
470 flow.setMatch(createMatch1().build());
471 flow.setInstructions(createAppyActionInstruction28().build());
475 flow.setMatch(createMatch1().build());
476 flow.setInstructions(createAppyActionInstruction29().build());
480 flow.setMatch(createMatch1().build());
481 flow.setInstructions(createAppyActionInstruction30().build());
485 flow.setMatch(createMatch1().build());
486 flow.setInstructions(createAppyActionInstruction31().build());
490 flow.setMatch(createMatch1().build());
491 flow.setInstructions(createAppyActionInstruction32().build());
495 flow.setMatch(createMatch1().build());
496 flow.setInstructions(createAppyActionInstruction33().build());
500 flow.setMatch(createMatch1().build());
501 flow.setInstructions(createAppyActionInstruction34().build());
505 flow.setMatch(createICMPv6Match().build());
506 flow.setInstructions(createDecNwTtlInstructions().build());
510 flow.setMatch(createInphyportMatch().build());
511 flow.setInstructions(createDropInstructions().build());
515 flow.setMatch(createMetadataMatch().build());
516 flow.setInstructions(createDropInstructions().build());
520 flow.setMatch(createL3IPv6Match().build());
521 flow.setInstructions(createDecNwTtlInstructions().build());
525 flow.setMatch(createL4SCTPMatch().build());
526 flow.setInstructions(createAppyActionInstruction().build());
530 flow.setMatch(createTunnelIDMatch().build());
531 flow.setInstructions(createGotoTableInstructions().build());
535 flow.setMatch(createVlanMatch().build());
536 flow.setInstructions(createMeterInstructions().build());
540 flow.setMatch(createPbbMatch().build());
541 flow.setInstructions(createMeterInstructions().build());
545 flow.setMatch(createVlanMatch().build());
546 flow.setInstructions(createDropInstructions().build());
550 flow.setMatch(createL4TCPMatch().build());
551 flow.setInstructions(createDropInstructions().build());
556 flow.setMatch(createL4UDPMatch().build());
557 flow.setInstructions(createDropInstructions().build());
561 flow.setMatch(new MatchBuilder().build());
562 flow.setInstructions(createSentToControllerInstructions().build());
566 flow.setMatch(createToSMatch().build());
567 flow.setInstructions(createDropInstructions().build());
571 flow.setMatch(createToSMatch().build());
572 flow.setInstructions(createOutputInstructions("INPORT", 10).build());
576 flow.setMatch(createToSMatch().build());
577 flow.setInstructions(createOutputInstructions("FLOOD", 20).build());
581 flow.setMatch(createToSMatch().build());
582 flow.setInstructions(createOutputInstructions("ALL", 30).build());
586 flow.setMatch(createToSMatch().build());
587 flow.setInstructions(createOutputInstructions("NORMAL", 40).build());
591 flow.setMatch(createToSMatch().build());
592 flow.setInstructions(createOutputInstructions("LOCAL", 50).build());
596 flow.setMatch(createToSMatch().build());
597 flow.setInstructions(createOutputInstructions("TABLE", 60).build());
601 flow.setMatch(createToSMatch().build());
602 flow.setInstructions(createOutputInstructions("NONE", 70).build());
606 flow.setMatch(createToSMatch().build());
607 flow.setInstructions(createStripVlanInstructions().build());
608 flow.setBarrier(Boolean.TRUE);
612 flow.setMatch(createMatch1().build());
613 flow.setInstructions(createAppyActionInstruction35().build());
617 flow.setMatch(createMatch1().build());
618 flow.setInstructions(createAppyActionInstruction36().build());
622 flow.setMatch(createMatch1().build());
623 flow.setInstructions(createAppyActionInstruction37().build());
627 flow.setMatch(createMatch1().build());
628 flow.setInstructions(createAppyActionInstruction38().build());
632 flow.setMatch(createL4TCPMatch().build());
633 flow.setInstructions(createAppyActionInstruction39().build());
637 flow.setMatch(createL4UDPMatch().build());
638 flow.setInstructions(createAppyActionInstruction40().build());
642 flow.setMatch(createL4SCTPMatch().build());
643 flow.setInstructions(createAppyActionInstruction41().build());
647 flow.setMatch(createICMPv4Match().build());
648 flow.setInstructions(createAppyActionInstruction42().build());
652 flow.setMatch(createArpMatch().build());
653 flow.setInstructions(createAppyActionInstruction43().build());
657 flow.setMatch(createL3IPv6Match().build());
658 flow.setInstructions(createAppyActionInstruction44().build());
662 flow.setMatch(createICMPv6Match().build());
663 flow.setInstructions(createAppyActionInstruction45().build());
667 flow.setMatch(createMplsMatch().build());
668 flow.setInstructions(createAppyActionInstruction46().build());
672 flow.setMatch(createPbbMatch().build());
673 flow.setInstructions(createAppyActionInstruction47().build());
677 flow.setMatch(createTunnelIDMatch().build());
678 flow.setInstructions(createAppyActionInstruction48().build());
681 LOG.warn("flow type not understood: {}", flowType);
684 FlowKey key = new FlowKey(new FlowId(id));
685 if (null == flow.isBarrier()) {
686 flow.setBarrier(Boolean.FALSE);
688 // flow.setBufferId(new Long(12));
689 BigInteger value = new BigInteger("10", 10);
690 BigInteger outputPort = new BigInteger("65535", 10);
691 flow.setCookie(value);
692 flow.setCookieMask(value);
693 flow.setHardTimeout(0);
694 flow.setIdleTimeout(0);
695 flow.setInstallHw(false);
696 flow.setStrict(false);
697 flow.setContainerName(null);
698 flow.setFlags(new FlowModFlags(false, false, false, false, false));
699 flow.setId(new FlowId(new Long(12)));
700 flow.setTableId(getTableId(tableId));
701 flow.setOutGroup(new Long(2));
702 // set outport to OFPP_NONE (65535) to disable remove restriction for
704 flow.setOutPort(outputPort);
708 flow.setFlowName(originalFlowName + "X" + flowType);
713 private short getTableId(String tableId) {
716 table = Short.parseShort(tableId);
717 } catch (Exception ex) {
718 // ignore exception and continue with default value
728 private static InstructionsBuilder createDecNwTtlInstructions() {
729 DecNwTtlBuilder ta = new DecNwTtlBuilder();
730 DecNwTtl decNwTtl = ta.build();
731 ActionBuilder ab = new ActionBuilder();
732 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
734 // Add our drop action to a list
735 List<Action> actionList = new ArrayList<Action>();
736 actionList.add(ab.build());
738 // Create an Apply Action
739 ApplyActionsBuilder aab = new ApplyActionsBuilder();
740 aab.setAction(actionList);
742 // Wrap our Apply Action in an Instruction
743 InstructionBuilder ib = new InstructionBuilder();
744 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
745 ib.setKey(new InstructionKey(0));
748 // Put our Instruction in a list of Instructions
749 InstructionsBuilder isb = new InstructionsBuilder();
750 List<Instruction> instructions = new ArrayList<Instruction>();
751 instructions.add(ib.build());
752 isb.setInstruction(instructions);
759 private static InstructionsBuilder createMeterInstructions() {
761 MeterBuilder aab = new MeterBuilder();
762 aab.setMeterId(new MeterId(new Long(1)));
764 InstructionBuilder ib = new InstructionBuilder();
765 ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
767 // Put our Instruction in a list of Instructions
768 InstructionsBuilder isb = new InstructionsBuilder();
769 List<Instruction> instructions = new ArrayList<Instruction>();
770 instructions.add(ib.build());
771 isb.setInstruction(instructions);
775 private static InstructionsBuilder createMetadataInstructions() {
777 WriteMetadataBuilder aab = new WriteMetadataBuilder();
778 aab.setMetadata(new BigInteger("10", 10));
779 aab.setMetadataMask(new BigInteger("12", 10));
781 InstructionBuilder ib = new InstructionBuilder();
782 ib.setInstruction(new WriteMetadataCaseBuilder().setWriteMetadata(aab.build()).build());
784 // Put our Instruction in a list of Instructions
785 InstructionsBuilder isb = new InstructionsBuilder();
786 List<Instruction> instructions = new ArrayList<Instruction>();
787 instructions.add(ib.build());
788 isb.setInstruction(instructions);
792 private static InstructionsBuilder createGotoTableInstructions() {
794 GoToTableBuilder aab = new GoToTableBuilder();
795 aab.setTableId((short) 2);
797 InstructionBuilder ib = new InstructionBuilder();
798 ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(aab.build()).build());
800 // Put our Instruction in a list of Instructions
801 InstructionsBuilder isb = new InstructionsBuilder();
802 List<Instruction> instructions = new ArrayList<Instruction>();
803 instructions.add(ib.build());
804 isb.setInstruction(instructions);
808 private static InstructionsBuilder createDropInstructions() {
809 DropActionBuilder dab = new DropActionBuilder();
810 DropAction dropAction = dab.build();
811 ActionBuilder ab = new ActionBuilder();
812 ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build());
814 // Add our drop action to a list
815 List<Action> actionList = new ArrayList<Action>();
816 actionList.add(ab.build());
818 // Create an Apply Action
819 ApplyActionsBuilder aab = new ApplyActionsBuilder();
820 aab.setAction(actionList);
822 // Wrap our Apply Action in an Instruction
823 InstructionBuilder ib = new InstructionBuilder();
824 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(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 instructions.add(ib.build());
830 isb.setInstruction(instructions);
834 private static InstructionsBuilder createAppyActionInstruction() {
836 List<Action> actionList = new ArrayList<Action>();
837 ActionBuilder ab = new ActionBuilder();
838 ControllerActionBuilder controller = new ControllerActionBuilder();
839 controller.setMaxLength(5);
840 ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.build()).build());
841 actionList.add(ab.build());
842 // Create an Apply Action
843 ApplyActionsBuilder aab = new ApplyActionsBuilder();
844 aab.setAction(actionList);
846 // Wrap our Apply Action in an Instruction
847 InstructionBuilder ib = new InstructionBuilder();
848 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
850 // Put our Instruction in a list of Instructions
851 InstructionsBuilder isb = new InstructionsBuilder();
852 List<Instruction> instructions = new ArrayList<Instruction>();
853 instructions.add(ib.build());
854 isb.setInstruction(instructions);
858 private static InstructionsBuilder createAppyActionInstruction1() {
860 List<Action> actionList = new ArrayList<Action>();
861 ActionBuilder ab = new ActionBuilder();
863 OutputActionBuilder output = new OutputActionBuilder();
864 output.setMaxLength(56);
865 Uri value = new Uri("PCEP");
866 output.setOutputNodeConnector(value);
867 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
868 actionList.add(ab.build());
869 // Create an Apply Action
870 ApplyActionsBuilder aab = new ApplyActionsBuilder();
871 aab.setAction(actionList);
873 // Wrap our Apply Action in an Instruction
874 InstructionBuilder ib = new InstructionBuilder();
875 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
877 // Put our Instruction in a list of Instructions
878 InstructionsBuilder isb = new InstructionsBuilder();
879 List<Instruction> instructions = new ArrayList<Instruction>();
880 instructions.add(ib.build());
881 isb.setInstruction(instructions);
885 private static InstructionsBuilder createSentToControllerInstructions() {
886 List<Action> actionList = new ArrayList<Action>();
887 ActionBuilder ab = new ActionBuilder();
889 OutputActionBuilder output = new OutputActionBuilder();
890 output.setMaxLength(56);
891 Uri value = new Uri("CONTROLLER");
892 output.setOutputNodeConnector(value);
893 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
895 ab.setKey(new ActionKey(0));
896 actionList.add(ab.build());
897 // Create an Apply Action
898 ApplyActionsBuilder aab = new ApplyActionsBuilder();
899 aab.setAction(actionList);
901 // Wrap our Apply Action in an Instruction
902 InstructionBuilder ib = new InstructionBuilder();
903 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
905 ib.setKey(new InstructionKey(0));
907 // Put our Instruction in a list of Instructions
908 InstructionsBuilder isb = new InstructionsBuilder();
909 List<Instruction> instructions = new ArrayList<Instruction>();
910 instructions.add(ib.build());
911 isb.setInstruction(instructions);
915 private static InstructionsBuilder createOutputInstructions(String outputType, int outputValue) {
916 List<Action> actionList = new ArrayList<Action>();
917 ActionBuilder ab = new ActionBuilder();
919 OutputActionBuilder output = new OutputActionBuilder();
920 output.setMaxLength(outputValue);
921 Uri value = new Uri(outputType);
922 output.setOutputNodeConnector(value);
923 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
925 ab.setKey(new ActionKey(0));
926 actionList.add(ab.build());
927 // Create an Apply Action
928 ApplyActionsBuilder aab = new ApplyActionsBuilder();
929 aab.setAction(actionList);
931 // Wrap our Apply Action in an Instruction
932 InstructionBuilder ib = new InstructionBuilder();
933 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
935 ib.setKey(new InstructionKey(0));
937 // Put our Instruction in a list of Instructions
938 InstructionsBuilder isb = new InstructionsBuilder();
939 List<Instruction> instructions = new ArrayList<Instruction>();
940 instructions.add(ib.build());
941 isb.setInstruction(instructions);
945 private static InstructionsBuilder createStripVlanInstructions() {
946 List<Action> actionList = new ArrayList<Action>();
947 ActionBuilder ab = new ActionBuilder();
949 StripVlanActionBuilder stripActionBuilder = new StripVlanActionBuilder();
950 ab.setAction(new StripVlanActionCaseBuilder().setStripVlanAction(stripActionBuilder.build()).build());
952 ab.setKey(new ActionKey(0));
953 actionList.add(ab.build());
954 // Create an Apply Action
955 ApplyActionsBuilder aab = new ApplyActionsBuilder();
956 aab.setAction(actionList);
958 // Wrap our Apply Action in an Instruction
959 InstructionBuilder ib = new InstructionBuilder();
960 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
962 ib.setKey(new InstructionKey(0));
964 // Put our Instruction in a list of Instructions
965 InstructionsBuilder isb = new InstructionsBuilder();
966 List<Instruction> instructions = new ArrayList<Instruction>();
967 instructions.add(ib.build());
968 isb.setInstruction(instructions);
972 private static InstructionsBuilder createAppyActionInstruction2() {
974 List<Action> actionList = new ArrayList<Action>();
975 ActionBuilder ab = new ActionBuilder();
977 PushMplsActionBuilder push = new PushMplsActionBuilder();
978 push.setEthernetType(new Integer(0x8847));
979 ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
980 actionList.add(ab.build());
981 // Create an Apply Action
982 ApplyActionsBuilder aab = new ApplyActionsBuilder();
983 aab.setAction(actionList);
985 // Wrap our Apply Action in an Instruction
986 InstructionBuilder ib = new InstructionBuilder();
987 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
989 // Put our Instruction in a list of Instructions
990 InstructionsBuilder isb = new InstructionsBuilder();
991 List<Instruction> instructions = new ArrayList<Instruction>();
992 instructions.add(ib.build());
993 isb.setInstruction(instructions);
997 private static InstructionsBuilder createAppyActionInstruction3() {
999 List<Action> actionList = new ArrayList<Action>();
1000 ActionBuilder ab = new ActionBuilder();
1002 PushPbbActionBuilder pbb = new PushPbbActionBuilder();
1003 pbb.setEthernetType(new Integer(0x88E7));
1004 ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
1005 actionList.add(ab.build());
1006 // Create an Apply Action
1007 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1008 aab.setAction(actionList);
1010 // Wrap our Apply Action in an Instruction
1011 InstructionBuilder ib = new InstructionBuilder();
1012 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1014 // Put our Instruction in a list of Instructions
1015 InstructionsBuilder isb = new InstructionsBuilder();
1016 List<Instruction> instructions = new ArrayList<Instruction>();
1017 instructions.add(ib.build());
1018 isb.setInstruction(instructions);
1022 private static InstructionsBuilder createAppyActionInstruction4() {
1024 List<Action> actionList = new ArrayList<Action>();
1025 ActionBuilder ab = new ActionBuilder();
1027 PushVlanActionBuilder vlan = new PushVlanActionBuilder();
1028 vlan.setEthernetType(new Integer(0x8100));
1029 ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
1030 actionList.add(ab.build());
1032 // Create an Apply Action
1033 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1034 aab.setAction(actionList);
1036 // Wrap our Apply Action in an Instruction
1037 InstructionBuilder ib = new InstructionBuilder();
1038 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1040 // Put our Instruction in a list of Instructions
1041 InstructionsBuilder isb = new InstructionsBuilder();
1042 List<Instruction> instructions = new ArrayList<Instruction>();
1043 instructions.add(ib.build());
1044 isb.setInstruction(instructions);
1048 private static InstructionsBuilder createAppyActionInstruction5() {
1050 List<Action> actionList = new ArrayList<Action>();
1051 ActionBuilder ab = new ActionBuilder();
1053 SetDlDstActionBuilder setdl = new SetDlDstActionBuilder();
1054 setdl.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1055 ab.setAction(new SetDlDstActionCaseBuilder().setSetDlDstAction(setdl.build()).build());
1056 actionList.add(ab.build());
1057 // Create an Apply Action
1058 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1059 aab.setAction(actionList);
1061 // Wrap our Apply Action in an Instruction
1062 InstructionBuilder ib = new InstructionBuilder();
1063 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1065 // Put our Instruction in a list of Instructions
1066 InstructionsBuilder isb = new InstructionsBuilder();
1067 List<Instruction> instructions = new ArrayList<Instruction>();
1068 instructions.add(ib.build());
1069 isb.setInstruction(instructions);
1073 private static InstructionsBuilder createAppyActionInstruction6() {
1075 List<Action> actionList = new ArrayList<Action>();
1076 ActionBuilder ab = new ActionBuilder();
1078 SetDlSrcActionBuilder src = new SetDlSrcActionBuilder();
1079 src.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1080 ab.setAction(new SetDlSrcActionCaseBuilder().setSetDlSrcAction(src.build()).build());
1081 actionList.add(ab.build());
1083 // Create an Apply Action
1084 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1085 aab.setAction(actionList);
1087 // Wrap our Apply Action in an Instruction
1088 InstructionBuilder ib = new InstructionBuilder();
1089 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1091 // Put our Instruction in a list of Instructions
1092 InstructionsBuilder isb = new InstructionsBuilder();
1093 List<Instruction> instructions = new ArrayList<Instruction>();
1094 instructions.add(ib.build());
1095 isb.setInstruction(instructions);
1099 private static InstructionsBuilder createAppyActionInstruction7() {
1101 List<Action> actionList = new ArrayList<Action>();
1102 ActionBuilder ab = new ActionBuilder();
1104 SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
1105 VlanId a = new VlanId(4000);
1107 ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
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 instructions.add(ib.build());
1121 isb.setInstruction(instructions);
1125 private static InstructionsBuilder createAppyActionInstruction8() {
1127 List<Action> actionList = new ArrayList<Action>();
1128 ActionBuilder ab = new ActionBuilder();
1130 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1131 VlanPcp pcp1 = new VlanPcp((short) 2);
1132 pcp.setVlanPcp(pcp1);
1133 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1134 actionList.add(ab.build());
1135 // Create an Apply Action
1136 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1137 aab.setAction(actionList);
1139 // Wrap our Apply Action in an Instruction
1140 InstructionBuilder ib = new InstructionBuilder();
1141 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1143 // Put our Instruction in a list of Instructions
1144 InstructionsBuilder isb = new InstructionsBuilder();
1145 List<Instruction> instructions = new ArrayList<Instruction>();
1146 instructions.add(ib.build());
1147 isb.setInstruction(instructions);
1151 private static InstructionsBuilder createAppyActionInstruction9() {
1153 List<Action> actionList = new ArrayList<Action>();
1154 ActionBuilder ab = new ActionBuilder();
1156 CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
1157 ab.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
1158 actionList.add(ab.build());
1159 // Create an Apply Action
1160 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1161 aab.setAction(actionList);
1163 // Wrap our Apply Action in an Instruction
1164 InstructionBuilder ib = new InstructionBuilder();
1165 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1167 // Put our Instruction in a list of Instructions
1168 InstructionsBuilder isb = new InstructionsBuilder();
1169 List<Instruction> instructions = new ArrayList<Instruction>();
1170 instructions.add(ib.build());
1171 isb.setInstruction(instructions);
1175 private static InstructionsBuilder createAppyActionInstruction10() {
1177 List<Action> actionList = new ArrayList<Action>();
1178 ActionBuilder ab = new ActionBuilder();
1180 CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
1181 ab.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
1182 actionList.add(ab.build());
1183 // Create an Apply Action
1184 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1185 aab.setAction(actionList);
1187 // Wrap our Apply Action in an Instruction
1188 InstructionBuilder ib = new InstructionBuilder();
1189 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1191 // Put our Instruction in a list of Instructions
1192 InstructionsBuilder isb = new InstructionsBuilder();
1193 List<Instruction> instructions = new ArrayList<Instruction>();
1194 instructions.add(ib.build());
1195 isb.setInstruction(instructions);
1199 private static InstructionsBuilder createAppyActionInstruction11() {
1201 List<Action> actionList = new ArrayList<Action>();
1202 ActionBuilder ab = new ActionBuilder();
1204 DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
1205 ab.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
1206 actionList.add(ab.build());
1207 // Create an Apply Action
1208 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1209 aab.setAction(actionList);
1211 // Wrap our Apply Action in an Instruction
1212 InstructionBuilder ib = new InstructionBuilder();
1213 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1215 // Put our Instruction in a list of Instructions
1216 InstructionsBuilder isb = new InstructionsBuilder();
1217 List<Instruction> instructions = new ArrayList<Instruction>();
1218 instructions.add(ib.build());
1219 isb.setInstruction(instructions);
1223 private static InstructionsBuilder createAppyActionInstruction12() {
1225 List<Action> actionList = new ArrayList<Action>();
1226 ActionBuilder ab = new ActionBuilder();
1228 DecNwTtlBuilder nwttl = new DecNwTtlBuilder();
1229 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(nwttl.build()).build());
1230 actionList.add(ab.build());
1232 // Create an Apply Action
1233 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1234 aab.setAction(actionList);
1236 // Wrap our Apply Action in an Instruction
1237 InstructionBuilder ib = new InstructionBuilder();
1238 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1240 // Put our Instruction in a list of Instructions
1241 InstructionsBuilder isb = new InstructionsBuilder();
1242 List<Instruction> instructions = new ArrayList<Instruction>();
1243 instructions.add(ib.build());
1244 isb.setInstruction(instructions);
1248 private static InstructionsBuilder createAppyActionInstruction13() {
1250 List<Action> actionList = new ArrayList<Action>();
1251 ActionBuilder ab = new ActionBuilder();
1253 DropActionBuilder drop = new DropActionBuilder();
1254 ab.setAction(new DropActionCaseBuilder().setDropAction(drop.build()).build());
1255 actionList.add(ab.build());
1257 // Create an Apply Action
1258 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1259 aab.setAction(actionList);
1261 // Wrap our Apply Action in an Instruction
1262 InstructionBuilder ib = new InstructionBuilder();
1263 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1265 // Put our Instruction in a list of Instructions
1266 InstructionsBuilder isb = new InstructionsBuilder();
1267 List<Instruction> instructions = new ArrayList<Instruction>();
1268 instructions.add(ib.build());
1269 isb.setInstruction(instructions);
1273 private static InstructionsBuilder createAppyActionInstruction14() {
1275 List<Action> actionList = new ArrayList<Action>();
1276 ActionBuilder ab = new ActionBuilder();
1278 FloodActionBuilder fld = new FloodActionBuilder();
1279 ab.setAction(new FloodActionCaseBuilder().setFloodAction(fld.build()).build());
1280 actionList.add(ab.build());
1281 // Create an Apply Action
1282 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1283 aab.setAction(actionList);
1285 // Wrap our Apply Action in an Instruction
1286 InstructionBuilder ib = new InstructionBuilder();
1287 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1289 // Put our Instruction in a list of Instructions
1290 InstructionsBuilder isb = new InstructionsBuilder();
1291 List<Instruction> instructions = new ArrayList<Instruction>();
1292 instructions.add(ib.build());
1293 isb.setInstruction(instructions);
1297 private static InstructionsBuilder createAppyActionInstruction15() {
1299 List<Action> actionList = new ArrayList<Action>();
1300 ActionBuilder ab = new ActionBuilder();
1302 FloodAllActionBuilder fldall = new FloodAllActionBuilder();
1303 ab.setAction(new FloodAllActionCaseBuilder().setFloodAllAction(fldall.build()).build());
1304 actionList.add(ab.build());
1305 // Create an Apply Action
1306 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1307 aab.setAction(actionList);
1309 // Wrap our Apply Action in an Instruction
1310 InstructionBuilder ib = new InstructionBuilder();
1311 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1313 // Put our Instruction in a list of Instructions
1314 InstructionsBuilder isb = new InstructionsBuilder();
1315 List<Instruction> instructions = new ArrayList<Instruction>();
1316 instructions.add(ib.build());
1317 isb.setInstruction(instructions);
1321 private static InstructionsBuilder createAppyActionInstruction16() {
1323 List<Action> actionList = new ArrayList<Action>();
1324 ActionBuilder ab = new ActionBuilder();
1326 GroupActionBuilder groupActionB = new GroupActionBuilder();
1327 groupActionB.setGroupId(1L);
1328 groupActionB.setGroup("0");
1329 ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
1330 actionList.add(ab.build());
1332 // Create an Apply Action
1333 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1334 aab.setAction(actionList);
1336 // Wrap our Apply Action in an Instruction
1337 InstructionBuilder ib = new InstructionBuilder();
1338 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1340 // Put our Instruction in a list of Instructions
1341 InstructionsBuilder isb = new InstructionsBuilder();
1342 List<Instruction> instructions = new ArrayList<Instruction>();
1343 instructions.add(ib.build());
1344 isb.setInstruction(instructions);
1348 private static InstructionsBuilder createAppyActionInstruction17() {
1350 List<Action> actionList = new ArrayList<Action>();
1351 ActionBuilder ab = new ActionBuilder();
1353 HwPathActionBuilder hwPathB = new HwPathActionBuilder();
1354 ab.setAction(new HwPathActionCaseBuilder().setHwPathAction(hwPathB.build()).build());
1355 actionList.add(ab.build());
1356 // Create an Apply Action
1357 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1358 aab.setAction(actionList);
1360 // Wrap our Apply Action in an Instruction
1361 InstructionBuilder ib = new InstructionBuilder();
1362 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1364 // Put our Instruction in a list of Instructions
1365 InstructionsBuilder isb = new InstructionsBuilder();
1366 List<Instruction> instructions = new ArrayList<Instruction>();
1367 instructions.add(ib.build());
1368 isb.setInstruction(instructions);
1372 private static InstructionsBuilder createAppyActionInstruction18() {
1374 List<Action> actionList = new ArrayList<Action>();
1375 ActionBuilder ab = new ActionBuilder();
1377 LoopbackActionBuilder loopbackActionBuilder = new LoopbackActionBuilder();
1378 ab.setAction(new LoopbackActionCaseBuilder().setLoopbackAction(loopbackActionBuilder.build()).build());
1379 actionList.add(ab.build());
1381 // Create an Apply Action
1382 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1383 aab.setAction(actionList);
1385 // Wrap our Apply Action in an Instruction
1386 InstructionBuilder ib = new InstructionBuilder();
1387 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1389 // Put our Instruction in a list of Instructions
1390 InstructionsBuilder isb = new InstructionsBuilder();
1391 List<Instruction> instructions = new ArrayList<Instruction>();
1392 instructions.add(ib.build());
1393 isb.setInstruction(instructions);
1397 private static InstructionsBuilder createAppyActionInstruction19() {
1399 List<Action> actionList = new ArrayList<Action>();
1400 ActionBuilder ab = new ActionBuilder();
1402 PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
1403 popMplsActionBuilder.setEthernetType(0XB);
1404 ab.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
1405 actionList.add(ab.build());
1406 // Create an Apply Action
1407 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1408 aab.setAction(actionList);
1410 // Wrap our Apply Action in an Instruction
1411 InstructionBuilder ib = new InstructionBuilder();
1412 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1414 // Put our Instruction in a list of Instructions
1415 InstructionsBuilder isb = new InstructionsBuilder();
1416 List<Instruction> instructions = new ArrayList<Instruction>();
1417 instructions.add(ib.build());
1418 isb.setInstruction(instructions);
1422 private static InstructionsBuilder createAppyActionInstruction20() {
1424 List<Action> actionList = new ArrayList<Action>();
1425 ActionBuilder ab = new ActionBuilder();
1427 PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
1428 ab.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
1429 actionList.add(ab.build());
1430 // Create an Apply Action
1431 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1432 aab.setAction(actionList);
1434 // Wrap our Apply Action in an Instruction
1435 InstructionBuilder ib = new InstructionBuilder();
1436 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1438 // Put our Instruction in a list of Instructions
1439 InstructionsBuilder isb = new InstructionsBuilder();
1440 List<Instruction> instructions = new ArrayList<Instruction>();
1441 instructions.add(ib.build());
1442 isb.setInstruction(instructions);
1446 private static InstructionsBuilder createAppyActionInstruction21() {
1448 List<Action> actionList = new ArrayList<Action>();
1449 ActionBuilder ab = new ActionBuilder();
1451 PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder();
1452 ab.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(popVlanActionBuilder.build()).build());
1453 actionList.add(ab.build());
1455 // Create an Apply Action
1456 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1457 aab.setAction(actionList);
1459 // Wrap our Apply Action in an Instruction
1460 InstructionBuilder ib = new InstructionBuilder();
1461 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1463 // Put our Instruction in a list of Instructions
1464 InstructionsBuilder isb = new InstructionsBuilder();
1465 List<Instruction> instructions = new ArrayList<Instruction>();
1466 instructions.add(ib.build());
1467 isb.setInstruction(instructions);
1471 private static InstructionsBuilder createAppyActionInstruction22() {
1473 List<Action> actionList = new ArrayList<Action>();
1474 ActionBuilder ab = new ActionBuilder();
1476 SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
1477 setDlTypeActionBuilder.setDlType(new EtherType(8L));
1478 ab.setAction(new SetDlTypeActionCaseBuilder().setSetDlTypeAction(setDlTypeActionBuilder.build()).build());
1479 actionList.add(ab.build());
1481 // Create an Apply Action
1482 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1483 aab.setAction(actionList);
1485 // Wrap our Apply Action in an Instruction
1486 InstructionBuilder ib = new InstructionBuilder();
1487 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1489 // Put our Instruction in a list of Instructions
1490 InstructionsBuilder isb = new InstructionsBuilder();
1491 List<Instruction> instructions = new ArrayList<Instruction>();
1492 instructions.add(ib.build());
1493 isb.setInstruction(instructions);
1497 private static InstructionsBuilder createAppyActionInstruction23() {
1499 List<Action> actionList = new ArrayList<Action>();
1500 ActionBuilder ab = new ActionBuilder();
1502 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1503 setFieldBuilder.setInPort(new Long(2));
1504 actionList.add(ab.build());
1506 // Create an Apply Action
1507 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1508 aab.setAction(actionList);
1510 // Wrap our Apply Action in an Instruction
1511 InstructionBuilder ib = new InstructionBuilder();
1512 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1514 // Put our Instruction in a list of Instructions
1515 InstructionsBuilder isb = new InstructionsBuilder();
1516 List<Instruction> instructions = new ArrayList<Instruction>();
1517 instructions.add(ib.build());
1518 isb.setInstruction(instructions);
1522 private static InstructionsBuilder createAppyActionInstruction24() {
1524 List<Action> actionList = new ArrayList<Action>();
1525 ActionBuilder ab = new ActionBuilder();
1527 SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
1528 setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
1529 ab.setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(setMplsTtlActionBuilder.build()).build());
1530 actionList.add(ab.build());
1532 // Create an Apply Action
1533 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1534 aab.setAction(actionList);
1536 // Wrap our Apply Action in an Instruction
1537 InstructionBuilder ib = new InstructionBuilder();
1538 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1540 // Put our Instruction in a list of Instructions
1541 InstructionsBuilder isb = new InstructionsBuilder();
1542 List<Instruction> instructions = new ArrayList<Instruction>();
1543 instructions.add(ib.build());
1544 isb.setInstruction(instructions);
1548 private static InstructionsBuilder createAppyActionInstruction25() {
1550 List<Action> actionList = new ArrayList<Action>();
1551 ActionBuilder ab = new ActionBuilder();
1553 SetNextHopActionBuilder setNextHopActionBuilder = new SetNextHopActionBuilder();
1554 Ipv4Builder ipnext = new Ipv4Builder();
1555 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
1556 ipnext.setIpv4Address(prefix);
1557 setNextHopActionBuilder.setAddress(ipnext.build());
1558 ab.setAction(new SetNextHopActionCaseBuilder().setSetNextHopAction(setNextHopActionBuilder.build()).build());
1559 actionList.add(ab.build());
1561 // Create an Apply Action
1562 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1563 aab.setAction(actionList);
1565 // Wrap our Apply Action in an Instruction
1566 InstructionBuilder ib = new InstructionBuilder();
1567 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1569 // Put our Instruction in a list of Instructions
1570 InstructionsBuilder isb = new InstructionsBuilder();
1571 List<Instruction> instructions = new ArrayList<Instruction>();
1572 instructions.add(ib.build());
1573 isb.setInstruction(instructions);
1577 private static InstructionsBuilder createAppyActionInstruction26() {
1579 List<Action> actionList = new ArrayList<Action>();
1580 ActionBuilder ab = new ActionBuilder();
1582 SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
1583 Ipv4Builder ipdst = new Ipv4Builder();
1584 Ipv4Prefix prefixdst = new Ipv4Prefix("10.0.0.21/24");
1585 ipdst.setIpv4Address(prefixdst);
1586 setNwDstActionBuilder.setAddress(ipdst.build());
1587 ab.setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build());
1588 actionList.add(ab.build());
1590 // Create an Apply Action
1591 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1592 aab.setAction(actionList);
1594 // Wrap our Apply Action in an Instruction
1595 InstructionBuilder ib = new InstructionBuilder();
1596 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1598 // Put our Instruction in a list of Instructions
1599 InstructionsBuilder isb = new InstructionsBuilder();
1600 List<Instruction> instructions = new ArrayList<Instruction>();
1601 instructions.add(ib.build());
1602 isb.setInstruction(instructions);
1606 private static InstructionsBuilder createAppyActionInstruction27() {
1608 List<Action> actionList = new ArrayList<Action>();
1609 ActionBuilder ab = new ActionBuilder();
1611 SetNwSrcActionBuilder setNwsrcActionBuilder = new SetNwSrcActionBuilder();
1612 Ipv4Builder ipsrc = new Ipv4Builder();
1613 Ipv4Prefix prefixsrc = new Ipv4Prefix("10.0.23.21/24");
1614 ipsrc.setIpv4Address(prefixsrc);
1615 setNwsrcActionBuilder.setAddress(ipsrc.build());
1616 ab.setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwsrcActionBuilder.build()).build());
1617 actionList.add(ab.build());
1619 // Create an Apply Action
1620 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1621 aab.setAction(actionList);
1623 // Wrap our Apply Action in an Instruction
1624 InstructionBuilder ib = new InstructionBuilder();
1625 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1627 // Put our Instruction in a list of Instructions
1628 InstructionsBuilder isb = new InstructionsBuilder();
1629 List<Instruction> instructions = new ArrayList<Instruction>();
1630 instructions.add(ib.build());
1631 isb.setInstruction(instructions);
1635 private static InstructionsBuilder createAppyActionInstruction28() {
1637 List<Action> actionList = new ArrayList<Action>();
1638 ActionBuilder ab = new ActionBuilder();
1640 SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
1641 setNwTosActionBuilder.setTos(8);
1642 ab.setAction(new SetNwTosActionCaseBuilder().setSetNwTosAction(setNwTosActionBuilder.build()).build());
1643 actionList.add(ab.build());
1644 // Create an Apply Action
1645 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1646 aab.setAction(actionList);
1648 // Wrap our Apply Action in an Instruction
1649 InstructionBuilder ib = new InstructionBuilder();
1650 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1652 // Put our Instruction in a list of Instructions
1653 InstructionsBuilder isb = new InstructionsBuilder();
1654 List<Instruction> instructions = new ArrayList<Instruction>();
1655 instructions.add(ib.build());
1656 isb.setInstruction(instructions);
1660 private static InstructionsBuilder createAppyActionInstruction29() {
1662 List<Action> actionList = new ArrayList<Action>();
1663 ActionBuilder ab = new ActionBuilder();
1665 SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
1666 setNwTtlActionBuilder.setNwTtl((short) 1);
1667 ab.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
1668 actionList.add(ab.build());
1670 // Create an Apply Action
1671 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1672 aab.setAction(actionList);
1674 // Wrap our Apply Action in an Instruction
1675 InstructionBuilder ib = new InstructionBuilder();
1676 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1678 // Put our Instruction in a list of Instructions
1679 InstructionsBuilder isb = new InstructionsBuilder();
1680 List<Instruction> instructions = new ArrayList<Instruction>();
1681 instructions.add(ib.build());
1682 isb.setInstruction(instructions);
1686 private static InstructionsBuilder createAppyActionInstruction30() {
1688 List<Action> actionList = new ArrayList<Action>();
1689 ActionBuilder ab = new ActionBuilder();
1691 SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
1692 setQueueActionBuilder.setQueueId(1L);
1693 ab.setAction(new SetQueueActionCaseBuilder().setSetQueueAction(setQueueActionBuilder.build()).build());
1694 actionList.add(ab.build());
1695 // Create an Apply Action
1696 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1697 aab.setAction(actionList);
1699 // Wrap our Apply Action in an Instruction
1700 InstructionBuilder ib = new InstructionBuilder();
1701 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1703 // Put our Instruction in a list of Instructions
1704 InstructionsBuilder isb = new InstructionsBuilder();
1705 List<Instruction> instructions = new ArrayList<Instruction>();
1706 instructions.add(ib.build());
1707 isb.setInstruction(instructions);
1711 private static InstructionsBuilder createAppyActionInstruction31() {
1713 List<Action> actionList = new ArrayList<Action>();
1714 ActionBuilder ab = new ActionBuilder();
1716 SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
1717 setTpDstActionBuilder.setPort(new PortNumber(109));
1719 ab.setAction(new SetTpDstActionCaseBuilder().setSetTpDstAction(setTpDstActionBuilder.build()).build());
1720 actionList.add(ab.build());
1721 // Create an Apply Action
1722 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1723 aab.setAction(actionList);
1725 // Wrap our Apply Action in an Instruction
1726 InstructionBuilder ib = new InstructionBuilder();
1727 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1729 // Put our Instruction in a list of Instructions
1730 InstructionsBuilder isb = new InstructionsBuilder();
1731 List<Instruction> instructions = new ArrayList<Instruction>();
1732 instructions.add(ib.build());
1733 isb.setInstruction(instructions);
1737 private static InstructionsBuilder createAppyActionInstruction32() {
1739 List<Action> actionList = new ArrayList<Action>();
1740 ActionBuilder ab = new ActionBuilder();
1742 SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
1743 setTpSrcActionBuilder.setPort(new PortNumber(109));
1744 ab.setAction(new SetTpSrcActionCaseBuilder().setSetTpSrcAction(setTpSrcActionBuilder.build()).build());
1745 actionList.add(ab.build());
1747 // Create an Apply Action
1748 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1749 aab.setAction(actionList);
1751 // Wrap our Apply Action in an Instruction
1752 InstructionBuilder ib = new InstructionBuilder();
1753 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1755 // Put our Instruction in a list of Instructions
1756 InstructionsBuilder isb = new InstructionsBuilder();
1757 List<Instruction> instructions = new ArrayList<Instruction>();
1758 instructions.add(ib.build());
1759 isb.setInstruction(instructions);
1763 private static InstructionsBuilder createAppyActionInstruction33() {
1765 List<Action> actionList = new ArrayList<Action>();
1766 ActionBuilder ab = new ActionBuilder();
1768 SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
1769 setVlanCfiActionBuilder.setVlanCfi(new VlanCfi(2));
1770 ab.setAction(new SetVlanCfiActionCaseBuilder().setSetVlanCfiAction(setVlanCfiActionBuilder.build()).build());
1771 actionList.add(ab.build());
1773 // Create an Apply Action
1774 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1775 aab.setAction(actionList);
1777 // Wrap our Apply Action in an Instruction
1778 InstructionBuilder ib = new InstructionBuilder();
1779 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1781 // Put our Instruction in a list of Instructions
1782 InstructionsBuilder isb = new InstructionsBuilder();
1783 List<Instruction> instructions = new ArrayList<Instruction>();
1784 instructions.add(ib.build());
1785 isb.setInstruction(instructions);
1789 private static InstructionsBuilder createAppyActionInstruction34() {
1791 List<Action> actionList = new ArrayList<Action>();
1792 ActionBuilder ab = new ActionBuilder();
1794 SwPathActionBuilder swPathAction = new SwPathActionBuilder();
1795 ab.setAction(new SwPathActionCaseBuilder().setSwPathAction(swPathAction.build()).build());
1796 actionList.add(ab.build());
1798 // Create an Apply Action
1799 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1800 aab.setAction(actionList);
1802 // Wrap our Apply Action in an Instruction
1803 InstructionBuilder ib = new InstructionBuilder();
1804 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1806 // Put our Instruction in a list of Instructions
1807 InstructionsBuilder isb = new InstructionsBuilder();
1808 List<Instruction> instructions = new ArrayList<Instruction>();
1809 instructions.add(ib.build());
1810 isb.setInstruction(instructions);
1814 private static InstructionsBuilder createAppyActionInstruction35() {
1816 List<Action> actionList = new ArrayList<Action>();
1817 ActionBuilder ab = new ActionBuilder();
1818 ActionBuilder ab1 = new ActionBuilder();
1819 ActionBuilder ab2 = new ActionBuilder();
1821 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1822 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
1823 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
1826 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
1827 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
1828 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
1829 EthernetMatchBuilder ethernetMatch1 = new EthernetMatchBuilder();
1830 EthernetDestinationBuilder ethDestBuilder = new EthernetDestinationBuilder();
1831 ethDestBuilder.setAddress(new MacAddress("00:00:00:00:00:02"));
1832 EthernetMatchBuilder ethernetMatch2 = new EthernetMatchBuilder();
1833 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
1834 ethTypeBuilder.setType(new EtherType(0x86ddL));
1836 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
1837 ethernetMatch1.setEthernetDestination(ethDestBuilder.build());
1838 ethernetMatch2.setEthernetType(ethTypeBuilder.build());
1839 setFieldBuilder.setEthernetMatch(ethernetMatch.build());
1840 setFieldBuilder1.setEthernetMatch(ethernetMatch1.build());
1841 setFieldBuilder2.setEthernetMatch(ethernetMatch2.build());
1842 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
1843 ab.setKey(new ActionKey(0));
1844 actionList.add(ab.build());
1846 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
1847 ab1.setKey(new ActionKey(1));
1848 actionList.add(ab1.build());
1850 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
1851 ab2.setKey(new ActionKey(2));
1852 actionList.add(ab2.build());
1854 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1855 aab.setAction(actionList);
1857 InstructionBuilder ib = new InstructionBuilder();
1858 ib.setKey(new InstructionKey(0));
1859 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1861 // Put our Instruction in a list of Instructions
1862 InstructionsBuilder isb = new InstructionsBuilder();
1863 List<Instruction> instructions = new ArrayList<Instruction>();
1864 instructions.add(ib.build());
1865 isb.setInstruction(instructions);
1869 private static InstructionsBuilder createAppyActionInstruction36() {
1871 List<Action> actionList = new ArrayList<Action>();
1872 ActionBuilder ab = new ActionBuilder();
1873 ActionBuilder ab1 = new ActionBuilder();
1875 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1876 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
1879 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
1880 VlanMatchBuilder vlanBuilder1 = new VlanMatchBuilder();
1881 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
1882 VlanId vlanId = new VlanId(10);
1883 VlanPcp vpcp = new VlanPcp((short) 3);
1884 vlanBuilder.setVlanPcp(vpcp);
1885 vlanBuilder1.setVlanId(vlanIdBuilder.setVlanId(vlanId).setVlanIdPresent(true).build());
1886 setFieldBuilder.setVlanMatch(vlanBuilder.build());
1887 setFieldBuilder1.setVlanMatch(vlanBuilder1.build());
1888 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
1889 ab.setKey(new ActionKey(0));
1890 actionList.add(ab.build());
1891 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
1892 ab1.setKey(new ActionKey(1));
1893 actionList.add(ab1.build());
1895 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1896 aab.setAction(actionList);
1898 InstructionBuilder ib = new InstructionBuilder();
1899 ib.setKey(new InstructionKey(0));
1900 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1902 // Put our Instruction in a list of Instructions
1903 InstructionsBuilder isb = new InstructionsBuilder();
1904 List<Instruction> instructions = new ArrayList<Instruction>();
1905 instructions.add(ib.build());
1906 isb.setInstruction(instructions);
1910 private static InstructionsBuilder createAppyActionInstruction37() {
1912 List<Action> actionList = new ArrayList<Action>();
1913 ActionBuilder ab = new ActionBuilder();
1914 ActionBuilder ab1 = new ActionBuilder();
1915 ActionBuilder ab2 = new ActionBuilder();
1917 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1918 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
1919 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
1921 IpMatchBuilder ipmatch = new IpMatchBuilder();
1922 IpMatchBuilder ipmatch1 = new IpMatchBuilder();
1923 IpMatchBuilder ipmatch2 = new IpMatchBuilder();
1924 Dscp dscp = new Dscp((short) 3);
1925 ipmatch.setIpDscp(dscp);
1926 ipmatch1.setIpEcn((short) 2);
1927 ipmatch2.setIpProtocol((short) 120);
1928 setFieldBuilder.setIpMatch(ipmatch.build());
1929 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
1930 ab.setKey(new ActionKey(0));
1931 actionList.add(ab.build());
1933 setFieldBuilder1.setIpMatch(ipmatch1.build());
1934 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
1935 ab1.setKey(new ActionKey(1));
1936 actionList.add(ab1.build());
1938 setFieldBuilder2.setIpMatch(ipmatch2.build());
1939 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
1940 ab2.setKey(new ActionKey(2));
1941 actionList.add(ab2.build());
1943 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1944 aab.setAction(actionList);
1946 InstructionBuilder ib = new InstructionBuilder();
1947 ib.setKey(new InstructionKey(0));
1948 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1950 // Put our Instruction in a list of Instructions
1951 InstructionsBuilder isb = new InstructionsBuilder();
1952 List<Instruction> instructions = new ArrayList<Instruction>();
1953 instructions.add(ib.build());
1954 isb.setInstruction(instructions);
1958 private static InstructionsBuilder createAppyActionInstruction38() {
1960 List<Action> actionList = new ArrayList<Action>();
1961 ActionBuilder ab = new ActionBuilder();
1962 ActionBuilder ab1 = new ActionBuilder();
1964 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1965 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
1967 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
1968 Ipv4MatchBuilder ipv4Match1 = new Ipv4MatchBuilder();
1969 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.5210");
1970 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1");
1971 ipv4Match1.setIpv4Destination(dstip);
1972 ipv4Match.setIpv4Source(srcip);
1973 setFieldBuilder.setLayer3Match(ipv4Match.build());
1974 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
1975 ab.setKey(new ActionKey(0));
1976 actionList.add(ab.build());
1978 setFieldBuilder1.setLayer3Match(ipv4Match1.build());
1979 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
1980 ab1.setKey(new ActionKey(1));
1981 actionList.add(ab1.build());
1983 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1984 aab.setAction(actionList);
1986 InstructionBuilder ib = new InstructionBuilder();
1987 ib.setKey(new InstructionKey(0));
1988 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1990 // Put our Instruction in a list of Instructions
1991 InstructionsBuilder isb = new InstructionsBuilder();
1992 List<Instruction> instructions = new ArrayList<Instruction>();
1993 instructions.add(ib.build());
1994 isb.setInstruction(instructions);
1998 private static InstructionsBuilder createAppyActionInstruction39() {
2000 List<Action> actionList = new ArrayList<Action>();
2001 ActionBuilder ab = new ActionBuilder();
2002 ActionBuilder ab1 = new ActionBuilder();
2004 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2005 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2008 PortNumber tcpsrcport = new PortNumber(1213);
2009 PortNumber tcpdstport = new PortNumber(646);
2010 TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
2011 TcpMatchBuilder tcpmatch1 = new TcpMatchBuilder();
2012 tcpmatch.setTcpSourcePort(tcpsrcport);
2013 tcpmatch1.setTcpDestinationPort(tcpdstport);
2014 setFieldBuilder.setLayer4Match(tcpmatch.build());
2015 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2016 ab.setKey(new ActionKey(0));
2017 actionList.add(ab.build());
2019 setFieldBuilder1.setLayer4Match(tcpmatch1.build());
2020 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2021 ab1.setKey(new ActionKey(1));
2022 actionList.add(ab.build());
2024 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2025 aab.setAction(actionList);
2027 InstructionBuilder ib = new InstructionBuilder();
2028 ib.setKey(new InstructionKey(0));
2029 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2031 // Put our Instruction in a list of Instructions
2032 InstructionsBuilder isb = new InstructionsBuilder();
2033 List<Instruction> instructions = new ArrayList<Instruction>();
2034 instructions.add(ib.build());
2035 isb.setInstruction(instructions);
2039 private static InstructionsBuilder createAppyActionInstruction40() {
2041 List<Action> actionList = new ArrayList<Action>();
2042 ActionBuilder ab = new ActionBuilder();
2043 ActionBuilder ab1 = new ActionBuilder();
2045 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2046 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2049 PortNumber udpsrcport = new PortNumber(1325);
2050 PortNumber udpdstport = new PortNumber(42);
2051 UdpMatchBuilder udpmatch = new UdpMatchBuilder();
2052 UdpMatchBuilder udpmatch1 = new UdpMatchBuilder();
2053 udpmatch.setUdpDestinationPort(udpdstport);
2054 udpmatch1.setUdpSourcePort(udpsrcport);
2055 setFieldBuilder.setLayer4Match(udpmatch.build());
2056 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2057 ab.setKey(new ActionKey(0));
2058 actionList.add(ab.build());
2060 setFieldBuilder1.setLayer4Match(udpmatch1.build());
2061 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2062 ab1.setKey(new ActionKey(1));
2063 actionList.add(ab1.build());
2065 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2066 aab.setAction(actionList);
2068 InstructionBuilder ib = new InstructionBuilder();
2069 ib.setKey(new InstructionKey(0));
2070 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2072 // Put our Instruction in a list of Instructions
2073 InstructionsBuilder isb = new InstructionsBuilder();
2074 List<Instruction> instructions = new ArrayList<Instruction>();
2075 instructions.add(ib.build());
2076 isb.setInstruction(instructions);
2080 private static InstructionsBuilder createAppyActionInstruction41() {
2082 List<Action> actionList = new ArrayList<Action>();
2083 ActionBuilder ab = new ActionBuilder();
2084 ActionBuilder ab1 = new ActionBuilder();
2086 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2087 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2090 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
2091 SctpMatchBuilder sctpmatch1 = new SctpMatchBuilder();
2092 PortNumber srcport = new PortNumber(1435);
2093 PortNumber dstport = new PortNumber(22);
2094 sctpmatch.setSctpSourcePort(srcport);
2095 sctpmatch1.setSctpDestinationPort(dstport);
2096 setFieldBuilder.setLayer4Match(sctpmatch.build());
2097 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2098 ab.setKey(new ActionKey(0));
2099 actionList.add(ab.build());
2101 setFieldBuilder1.setLayer4Match(sctpmatch1.build());
2102 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2103 ab1.setKey(new ActionKey(1));
2104 actionList.add(ab1.build());
2106 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2107 aab.setAction(actionList);
2109 InstructionBuilder ib = new InstructionBuilder();
2110 ib.setKey(new InstructionKey(0));
2111 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2113 // Put our Instruction in a list of Instructions
2114 InstructionsBuilder isb = new InstructionsBuilder();
2115 List<Instruction> instructions = new ArrayList<Instruction>();
2116 instructions.add(ib.build());
2117 isb.setInstruction(instructions);
2121 private static InstructionsBuilder createAppyActionInstruction42() {
2123 List<Action> actionList = new ArrayList<Action>();
2124 ActionBuilder ab = new ActionBuilder();
2125 ActionBuilder ab1 = new ActionBuilder();
2126 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2127 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2130 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
2131 Icmpv4MatchBuilder icmpv4match1 = new Icmpv4MatchBuilder();
2132 icmpv4match.setIcmpv4Type((short) 8);
2133 icmpv4match1.setIcmpv4Code((short) 0);
2134 setFieldBuilder.setIcmpv4Match(icmpv4match.build());
2135 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2136 ab.setKey(new ActionKey(0));
2137 actionList.add(ab.build());
2139 setFieldBuilder1.setIcmpv4Match(icmpv4match1.build());
2140 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2141 ab1.setKey(new ActionKey(1));
2142 actionList.add(ab1.build());
2144 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2145 aab.setAction(actionList);
2147 InstructionBuilder ib = new InstructionBuilder();
2148 ib.setKey(new InstructionKey(0));
2149 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2151 // Put our Instruction in a list of Instructions
2152 InstructionsBuilder isb = new InstructionsBuilder();
2153 List<Instruction> instructions = new ArrayList<Instruction>();
2154 instructions.add(ib.build());
2155 isb.setInstruction(instructions);
2159 private static InstructionsBuilder createAppyActionInstruction43() {
2161 List<Action> actionList = new ArrayList<Action>();
2162 ActionBuilder ab = new ActionBuilder();
2163 ActionBuilder ab1 = new ActionBuilder();
2164 ActionBuilder ab2 = new ActionBuilder();
2165 ActionBuilder ab3 = new ActionBuilder();
2166 ActionBuilder ab4 = new ActionBuilder();
2168 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2169 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2170 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2171 SetFieldBuilder setFieldBuilder3 = new SetFieldBuilder();
2172 SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder();
2174 // setting the values of ARP
2175 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2176 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2177 Ipv4Prefix dstiparp = new Ipv4Prefix("200.71.9.52/10");
2178 Ipv4Prefix srciparp = new Ipv4Prefix("100.1.1.1/8");
2179 // create ARP match action
2180 ArpMatchBuilder arpmatch = new ArpMatchBuilder();
2181 ArpMatchBuilder arpmatch1 = new ArpMatchBuilder();
2182 ArpMatchBuilder arpmatch2 = new ArpMatchBuilder();
2183 ArpMatchBuilder arpmatch3 = new ArpMatchBuilder();
2184 ArpMatchBuilder arpmatch4 = new ArpMatchBuilder();
2185 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2186 arpsrc.setAddress(macsrc);
2187 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2188 arpdst.setAddress(macdest);
2189 arpmatch.setArpOp(2);
2190 arpmatch1.setArpSourceHardwareAddress(arpsrc.build());
2191 arpmatch2.setArpTargetHardwareAddress(arpdst.build());
2192 arpmatch3.setArpSourceTransportAddress(srciparp);
2193 arpmatch4.setArpTargetTransportAddress(dstiparp);
2194 setFieldBuilder.setLayer3Match(arpmatch.build());
2195 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2196 ab.setKey(new ActionKey(0));
2197 actionList.add(ab.build());
2199 setFieldBuilder1.setLayer3Match(arpmatch1.build());
2200 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2201 ab1.setKey(new ActionKey(1));
2202 actionList.add(ab1.build());
2204 setFieldBuilder2.setLayer3Match(arpmatch2.build());
2205 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2206 ab2.setKey(new ActionKey(2));
2207 actionList.add(ab2.build());
2209 setFieldBuilder3.setLayer3Match(arpmatch3.build());
2210 ab3.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2211 ab3.setKey(new ActionKey(3));
2212 actionList.add(ab3.build());
2214 setFieldBuilder4.setLayer3Match(arpmatch4.build());
2215 ab4.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2216 ab4.setKey(new ActionKey(4));
2217 actionList.add(ab4.build());
2219 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2220 aab.setAction(actionList);
2222 InstructionBuilder ib = new InstructionBuilder();
2223 ib.setKey(new InstructionKey(0));
2224 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2226 // Put our Instruction in a list of Instructions
2227 InstructionsBuilder isb = new InstructionsBuilder();
2228 List<Instruction> instructions = new ArrayList<Instruction>();
2229 instructions.add(ib.build());
2230 isb.setInstruction(instructions);
2234 private static InstructionsBuilder createAppyActionInstruction44() {
2236 List<Action> actionList = new ArrayList<Action>();
2237 ActionBuilder ab = new ActionBuilder();
2238 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2239 ActionBuilder ab1 = new ActionBuilder();
2240 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2243 Ipv6MatchBuilder ipv6Builder = new Ipv6MatchBuilder();
2244 Ipv6MatchBuilder ipv6Builder1 = new Ipv6MatchBuilder();
2245 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2");
2246 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1");
2247 ipv6Builder1.setIpv6Destination(dstip6);
2248 ipv6Builder.setIpv6Source(srcip6);
2249 setFieldBuilder.setLayer3Match(ipv6Builder.build());
2250 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2251 ab.setKey(new ActionKey(0));
2252 actionList.add(ab.build());
2254 setFieldBuilder1.setLayer3Match(ipv6Builder1.build());
2255 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2256 ab1.setKey(new ActionKey(1));
2257 actionList.add(ab1.build());
2259 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2260 aab.setAction(actionList);
2262 InstructionBuilder ib = new InstructionBuilder();
2263 ib.setKey(new InstructionKey(0));
2264 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2266 // Put our Instruction in a list of Instructions
2267 InstructionsBuilder isb = new InstructionsBuilder();
2268 List<Instruction> instructions = new ArrayList<Instruction>();
2269 instructions.add(ib.build());
2270 isb.setInstruction(instructions);
2274 private static InstructionsBuilder createAppyActionInstruction45() {
2276 List<Action> actionList = new ArrayList<Action>();
2277 ActionBuilder ab = new ActionBuilder();
2278 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2279 ActionBuilder ab1 = new ActionBuilder();
2280 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2283 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
2284 Icmpv6MatchBuilder icmpv6match1 = new Icmpv6MatchBuilder();
2285 icmpv6match.setIcmpv6Type((short) 135);
2286 icmpv6match1.setIcmpv6Code((short) 0);
2287 setFieldBuilder.setIcmpv6Match(icmpv6match.build());
2288 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2289 ab.setKey(new ActionKey(0));
2290 actionList.add(ab.build());
2292 setFieldBuilder1.setIcmpv6Match(icmpv6match1.build());
2293 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2294 ab1.setKey(new ActionKey(1));
2295 actionList.add(ab1.build());
2297 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2298 aab.setAction(actionList);
2300 InstructionBuilder ib = new InstructionBuilder();
2301 ib.setKey(new InstructionKey(0));
2302 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2304 // Put our Instruction in a list of Instructions
2305 InstructionsBuilder isb = new InstructionsBuilder();
2306 List<Instruction> instructions = new ArrayList<Instruction>();
2307 instructions.add(ib.build());
2308 isb.setInstruction(instructions);
2312 private static InstructionsBuilder createAppyActionInstruction46() {
2314 List<Action> actionList = new ArrayList<Action>();
2315 ActionBuilder ab = new ActionBuilder();
2316 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2317 ActionBuilder ab1 = new ActionBuilder();
2318 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2319 ActionBuilder ab2 = new ActionBuilder();
2320 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2323 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2324 ProtocolMatchFieldsBuilder protomatch1 = new ProtocolMatchFieldsBuilder();
2325 ProtocolMatchFieldsBuilder protomatch2 = new ProtocolMatchFieldsBuilder();
2326 protomatch.setMplsLabel((long) 36008);
2327 protomatch1.setMplsTc((short) 4);
2328 protomatch2.setMplsBos((short) 1);
2329 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2330 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2331 ab.setKey(new ActionKey(0));
2332 actionList.add(ab.build());
2334 setFieldBuilder1.setProtocolMatchFields(protomatch1.build());
2335 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2336 ab1.setKey(new ActionKey(1));
2337 actionList.add(ab1.build());
2339 setFieldBuilder2.setProtocolMatchFields(protomatch2.build());
2340 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2341 ab2.setKey(new ActionKey(2));
2342 actionList.add(ab2.build());
2344 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2345 aab.setAction(actionList);
2347 InstructionBuilder ib = new InstructionBuilder();
2348 ib.setKey(new InstructionKey(0));
2349 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2351 // Put our Instruction in a list of Instructions
2352 InstructionsBuilder isb = new InstructionsBuilder();
2353 List<Instruction> instructions = new ArrayList<Instruction>();
2354 instructions.add(ib.build());
2355 isb.setInstruction(instructions);
2359 private static InstructionsBuilder createAppyActionInstruction47() {
2361 List<Action> actionList = new ArrayList<Action>();
2362 ActionBuilder ab = new ActionBuilder();
2363 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2365 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2366 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new byte[] { 0, 1, 0, 0 }).build());
2367 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2368 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2369 actionList.add(ab.build());
2371 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2372 aab.setAction(actionList);
2374 InstructionBuilder ib = new InstructionBuilder();
2375 ib.setKey(new InstructionKey(0));
2376 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2378 // Put our Instruction in a list of Instructions
2379 InstructionsBuilder isb = new InstructionsBuilder();
2380 List<Instruction> instructions = new ArrayList<Instruction>();
2381 instructions.add(ib.build());
2382 isb.setInstruction(instructions);
2386 private static InstructionsBuilder createAppyActionInstruction48() {
2388 List<Action> actionList = new ArrayList<Action>();
2389 ActionBuilder ab = new ActionBuilder();
2390 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2392 TunnelBuilder tunnel = new TunnelBuilder();
2393 tunnel.setTunnelId(BigInteger.valueOf(10668));
2394 setFieldBuilder.setTunnel(tunnel.build());
2395 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2396 actionList.add(ab.build());
2398 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2399 aab.setAction(actionList);
2401 InstructionBuilder ib = new InstructionBuilder();
2402 ib.setKey(new InstructionKey(0));
2403 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2405 // Put our Instruction in a list of Instructions
2406 InstructionsBuilder isb = new InstructionsBuilder();
2407 List<Instruction> instructions = new ArrayList<Instruction>();
2408 instructions.add(ib.build());
2409 isb.setInstruction(instructions);
2416 private static MatchBuilder createMatch1() {
2417 MatchBuilder match = new MatchBuilder();
2418 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2419 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2420 ipv4Match.setIpv4Destination(prefix);
2421 Ipv4Match i4m = ipv4Match.build();
2422 match.setLayer3Match(i4m);
2424 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2425 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2426 ethTypeBuilder.setType(new EtherType(0x0800L));
2427 eth.setEthernetType(ethTypeBuilder.build());
2428 match.setEthernetMatch(eth.build());
2435 private static MatchBuilder createIPv4DstMatch() {
2436 MatchBuilder match = new MatchBuilder();
2437 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2438 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2439 ipv4Match.setIpv4Destination(prefix);
2440 Ipv4Match i4m = ipv4Match.build();
2441 match.setLayer3Match(i4m);
2449 private static MatchBuilder createIPv4SrcMatch() {
2450 MatchBuilder match = new MatchBuilder();
2451 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2452 Ipv4Prefix prefix = new Ipv4Prefix("10.20.30.40/24");
2453 ipv4Match.setIpv4Source(prefix);
2454 Ipv4Match i4m = ipv4Match.build();
2455 match.setLayer3Match(i4m);
2457 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2458 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2459 ethTypeBuilder.setType(new EtherType(0x0800L));
2460 eth.setEthernetType(ethTypeBuilder.build());
2461 match.setEthernetMatch(eth.build());
2468 private static MatchBuilder createMatch2() {
2469 MatchBuilder match = new MatchBuilder();
2470 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2471 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1");
2472 ipv4Match.setIpv4Source(prefix);
2473 Ipv4Match i4m = ipv4Match.build();
2474 match.setLayer3Match(i4m);
2476 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2477 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2478 ethTypeBuilder.setType(new EtherType(0x0800L));
2479 eth.setEthernetType(ethTypeBuilder.build());
2480 match.setEthernetMatch(eth.build());
2487 private static MatchBuilder createMatch3() {
2488 MatchBuilder match = new MatchBuilder();
2489 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
2490 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
2491 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
2492 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
2493 match.setEthernetMatch(ethernetMatch.build());
2498 private static MatchBuilder createInphyportMatch() {
2499 MatchBuilder match = new MatchBuilder();
2500 match.setInPort(202L);
2501 match.setInPhyPort(10122L);
2505 private static MatchBuilder createEthernetMatch() {
2506 MatchBuilder match = new MatchBuilder();
2508 byte[] mask1 = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2509 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2511 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
2513 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2514 EtherType type = new EtherType(0x0800L);
2515 ethmatch.setEthernetType(ethtype.setType(type).build());
2517 EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet
2520 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2521 ethdest.setAddress(macdest);
2522 ethdest.setMask(mask1);
2524 ethmatch.setEthernetDestination(ethdest.build());
2526 EthernetSourceBuilder ethsrc = new EthernetSourceBuilder();
2527 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2528 ethsrc.setAddress(macsrc);
2529 ethsrc.setMask(mask2);
2531 ethmatch.setEthernetSource(ethsrc.build());
2532 match.setEthernetMatch(ethmatch.build());
2541 private static MatchBuilder createVlanMatch() {
2542 MatchBuilder match = new MatchBuilder();
2543 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder(); // vlan match
2544 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
2545 VlanId vlanId = new VlanId(10);
2546 VlanPcp vpcp = new VlanPcp((short) 3);
2547 vlanBuilder.setVlanPcp(vpcp);
2548 vlanIdBuilder.setVlanId(vlanId);
2549 vlanIdBuilder.setVlanIdPresent(true);
2550 vlanBuilder.setVlanId(vlanIdBuilder.build());
2551 match.setVlanMatch(vlanBuilder.build());
2558 private static MatchBuilder createArpMatch() {
2559 MatchBuilder match = new MatchBuilder();
2561 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2562 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2563 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2565 byte[] mask = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2566 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2568 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2569 EtherType type = new EtherType(0x0806L);
2570 ethmatch.setEthernetType(ethtype.setType(type).build());
2572 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
2573 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2575 ArpMatchBuilder arpmatch = new ArpMatchBuilder(); // arp match
2576 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2577 arpsrc.setAddress(macsrc);
2578 arpsrc.setMask(mask);
2579 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2580 arpdst.setAddress(macdest);
2581 arpdst.setMask(mask2);
2582 arpmatch.setArpOp(2);
2583 arpmatch.setArpSourceHardwareAddress(arpsrc.build());
2584 arpmatch.setArpTargetHardwareAddress(arpdst.build());
2585 arpmatch.setArpSourceTransportAddress(srcip);
2586 arpmatch.setArpTargetTransportAddress(dstip);
2588 match.setEthernetMatch(ethmatch.build());
2589 match.setLayer3Match(arpmatch.build());
2597 private static MatchBuilder createIPMatch() {
2598 MatchBuilder match = new MatchBuilder();
2599 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2600 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2601 EtherType type = new EtherType(0x0800L);
2602 ethmatch.setEthernetType(ethtype.setType(type).build());
2603 match.setEthernetMatch(ethmatch.build());
2605 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2606 ipmatch.setIpProtocol((short) 1);
2607 Dscp dscp = new Dscp((short) 3);
2608 ipmatch.setIpDscp(dscp);
2609 ipmatch.setIpEcn((short) 2);
2610 match.setIpMatch(ipmatch.build());
2617 private static MatchBuilder createL3IPv4Match() {
2618 MatchBuilder match = new MatchBuilder();
2620 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2621 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2622 ethTypeBuilder.setType(new EtherType(0x0800L));
2623 eth.setEthernetType(ethTypeBuilder.build());
2624 match.setEthernetMatch(eth.build());
2626 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2627 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
2628 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2629 Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
2630 ipv4match.setIpv4Destination(dstip);
2631 ipv4match.setIpv4Source(srcip);
2632 match.setLayer3Match(ipv4match.build());
2641 private static MatchBuilder createL3IPv6Match() {
2642 MatchBuilder match = new MatchBuilder();
2644 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2645 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2646 ethTypeBuilder.setType(new EtherType(0x86ddL));
2647 eth.setEthernetType(ethTypeBuilder.build());
2648 match.setEthernetMatch(eth.build());
2650 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2/64");
2651 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1/56");
2652 Ipv6Address ndtarget = new Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
2653 MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
2654 MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
2655 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2656 nextheader.setIpv6Exthdr(58);
2657 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2658 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2659 ipv6label.setIpv6Flabel(label);
2660 ipv6label.setFlabelMask(new byte[] { 0, 1, -1, -1 });
2662 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2664 icmpv6match.setIcmpv6Type((short) 135);
2665 icmpv6match.setIcmpv6Code((short) 0);
2666 match.setIcmpv6Match(icmpv6match.build());
2668 Ipv6MatchBuilder ipv6match = new Ipv6MatchBuilder();
2669 // ipv6match.setIpv6Source(srcip6);
2670 // ipv6match.setIpv6Destination(dstip6);
2671 // ipv6match.setIpv6ExtHeader(nextheader.build());
2672 ipv6match.setIpv6NdSll(ndsll);
2673 ipv6match.setIpv6NdTll(ndtll);
2674 // ipv6match.setIpv6NdTarget(ndtarget);
2675 ipv6match.setIpv6Label(ipv6label.build());
2677 match.setLayer3Match(ipv6match.build());
2686 private static MatchBuilder createICMPv4Match() {
2687 MatchBuilder match = new MatchBuilder();
2688 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2689 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2690 ethTypeBuilder.setType(new EtherType(0x0800L));
2691 eth.setEthernetType(ethTypeBuilder.build());
2692 match.setEthernetMatch(eth.build());
2694 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2695 ipmatch.setIpProtocol((short) 1);
2696 match.setIpMatch(ipmatch.build());
2698 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder(); // icmpv4
2700 icmpv4match.setIcmpv4Type((short) 8);
2701 icmpv4match.setIcmpv4Code((short) 0);
2702 match.setIcmpv4Match(icmpv4match.build());
2709 private static MatchBuilder createICMPv6Match() {
2711 MatchBuilder match = new MatchBuilder();
2712 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2713 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2714 ethTypeBuilder.setType(new EtherType(0x86ddL));
2715 eth.setEthernetType(ethTypeBuilder.build());
2716 match.setEthernetMatch(eth.build());
2718 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2719 ipmatch.setIpProtocol((short) 58);
2720 match.setIpMatch(ipmatch.build());
2722 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2724 icmpv6match.setIcmpv6Type((short) 135);
2725 icmpv6match.setIcmpv6Code((short) 1);
2726 match.setIcmpv6Match(icmpv6match.build());
2734 private static MatchBuilder createToSMatch() {
2735 MatchBuilder match = new MatchBuilder();
2736 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2737 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2738 EtherType type = new EtherType(0x0800L);
2739 ethmatch.setEthernetType(ethtype.setType(type).build());
2740 match.setEthernetMatch(ethmatch.build());
2742 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2743 ipmatch.setIpProtocol((short) 6);
2744 Dscp dscp = new Dscp((short) 8);
2745 ipmatch.setIpDscp(dscp);
2746 match.setIpMatch(ipmatch.build());
2754 private static MatchBuilder createL4TCPMatch() {
2755 MatchBuilder match = new MatchBuilder();
2757 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2758 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2759 ethTypeBuilder.setType(new EtherType(0x0800L));
2760 eth.setEthernetType(ethTypeBuilder.build());
2761 match.setEthernetMatch(eth.build());
2763 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2764 ipmatch.setIpProtocol((short) 6);
2765 match.setIpMatch(ipmatch.build());
2767 PortNumber srcport = new PortNumber(1213);
2768 PortNumber dstport = new PortNumber(646);
2769 TcpMatchBuilder tcpmatch = new TcpMatchBuilder(); // tcp match
2770 tcpmatch.setTcpSourcePort(srcport);
2771 tcpmatch.setTcpDestinationPort(dstport);
2772 match.setLayer4Match(tcpmatch.build());
2780 private static MatchBuilder createL4UDPMatch() {
2781 MatchBuilder match = new MatchBuilder();
2783 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2784 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2785 ethTypeBuilder.setType(new EtherType(0x0800L));
2786 eth.setEthernetType(ethTypeBuilder.build());
2787 match.setEthernetMatch(eth.build());
2789 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2790 ipmatch.setIpProtocol((short) 17);
2791 match.setIpMatch(ipmatch.build());
2793 PortNumber srcport = new PortNumber(1325);
2794 PortNumber dstport = new PortNumber(42);
2795 UdpMatchBuilder udpmatch = new UdpMatchBuilder(); // udp match
2796 udpmatch.setUdpDestinationPort(dstport);
2797 udpmatch.setUdpSourcePort(srcport);
2798 match.setLayer4Match(udpmatch.build());
2806 private static MatchBuilder createL4SCTPMatch() {
2807 MatchBuilder match = new MatchBuilder();
2809 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2810 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2811 ethTypeBuilder.setType(new EtherType(0x0800L));
2812 eth.setEthernetType(ethTypeBuilder.build());
2813 match.setEthernetMatch(eth.build());
2815 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2816 ipmatch.setIpProtocol((short) 132);
2817 match.setIpMatch(ipmatch.build());
2819 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
2820 PortNumber srcport = new PortNumber(1435);
2821 PortNumber dstport = new PortNumber(22);
2822 sctpmatch.setSctpSourcePort(srcport);
2823 sctpmatch.setSctpDestinationPort(dstport);
2824 match.setLayer4Match(sctpmatch.build());
2832 private static MatchBuilder createMetadataMatch() {
2833 MatchBuilder match = new MatchBuilder();
2834 byte[] metamask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
2835 MetadataBuilder metadata = new MetadataBuilder(); // metadata match
2836 metadata.setMetadata(BigInteger.valueOf(500L));
2837 metadata.setMetadataMask(metamask);
2838 match.setMetadata(metadata.build());
2846 private static MatchBuilder createMplsMatch() {
2847 MatchBuilder match = new MatchBuilder();
2849 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2850 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2851 ethTypeBuilder.setType(new EtherType(0x8847L));
2852 eth.setEthernetType(ethTypeBuilder.build());
2853 match.setEthernetMatch(eth.build());
2855 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
2857 protomatch.setMplsLabel((long) 36008);
2858 protomatch.setMplsTc((short) 4);
2859 protomatch.setMplsBos((short) 1);
2860 match.setProtocolMatchFields(protomatch.build());
2869 private static MatchBuilder createPbbMatch() {
2870 MatchBuilder match = new MatchBuilder();
2872 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2873 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2874 ethTypeBuilder.setType(new EtherType(0x88E7L));
2875 eth.setEthernetType(ethTypeBuilder.build());
2876 match.setEthernetMatch(eth.build());
2878 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
2880 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new byte[] { 0, 1, 0, 0 }).build());
2881 match.setProtocolMatchFields(protomatch.build());
2890 private static MatchBuilder createTunnelIDMatch() {
2891 MatchBuilder match = new MatchBuilder();
2892 TunnelBuilder tunnel = new TunnelBuilder(); // tunnel id match
2893 tunnel.setTunnelId(BigInteger.valueOf(10668));
2894 byte[] mask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
2895 tunnel.setTunnelMask(mask);
2896 match.setTunnel(tunnel.build());
2901 public void _removeMDFlow(CommandInterpreter ci) {
2902 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
2903 NodeBuilder tn = createTestNode(ci.nextArgument());
2904 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
2905 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class).child(Node.class, tn.getKey())
2906 .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf.getTableId()))
2907 .child(Flow.class, tf.getKey()).build();
2908 modification.removeOperationalData(nodeBuilderToInstanceId(tn));
2909 modification.removeOperationalData(path1);
2910 modification.removeConfigurationData(nodeBuilderToInstanceId(tn));
2911 modification.removeConfigurationData(path1);
2912 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
2914 RpcResult<TransactionStatus> result = commitFuture.get();
2915 TransactionStatus status = result.getResult();
2916 ci.println("Status of Flow Data Loaded Transaction: " + status);
2918 } catch (InterruptedException e) {
2919 LOG.error(e.getMessage(), e);
2920 } catch (ExecutionException e) {
2921 LOG.error(e.getMessage(), e);
2925 public void _addMDFlow(CommandInterpreter ci) {
2926 NodeBuilder tn = createTestNode(ci.nextArgument());
2927 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
2928 writeFlow(ci, tf, tn);
2931 private void writeFlow(CommandInterpreter ci, FlowBuilder flow, NodeBuilder nodeBuilder) {
2932 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
2933 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class)
2934 .child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
2935 .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.getKey()).build();
2936 modification.putOperationalData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
2937 modification.putOperationalData(path1, flow.build());
2938 modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
2939 modification.putConfigurationData(path1, flow.build());
2940 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
2942 RpcResult<TransactionStatus> result = commitFuture.get();
2943 TransactionStatus status = result.getResult();
2944 ci.println("Status of Flow Data Loaded Transaction: " + status);
2946 } catch (InterruptedException e) {
2947 LOG.error(e.getMessage(), e);
2948 } catch (ExecutionException e) {
2949 LOG.error(e.getMessage(), e);
2953 public void _modifyMDFlow(CommandInterpreter ci) {
2954 NodeBuilder tn = createTestNode(ci.nextArgument());
2955 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
2956 tf.setFlowName(updatedFlowName);
2957 writeFlow(ci, tf, tn);
2958 tf.setFlowName(originalFlowName);
2959 writeFlow(ci, tf, tn);
2962 private static NodeRef createNodeRef(String string) {
2963 NodeKey key = new NodeKey(new NodeId(string));
2964 InstanceIdentifier<Node> path = InstanceIdentifier.builder().node(Nodes.class).node(Node.class, key)
2967 return new NodeRef(path);
2971 public String getHelp() {