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.NotificationService;
23 import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
24 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
25 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
26 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
27 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6FlowLabel;
28 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Prefix;
29 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
30 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
31 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionCaseBuilder;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCaseBuilder;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCaseBuilder;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCaseBuilder;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCaseBuilder;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodActionCaseBuilder;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAllActionCaseBuilder;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCaseBuilder;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.HwPathActionCaseBuilder;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.LoopbackActionCaseBuilder;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCaseBuilder;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopPbbActionCaseBuilder;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCaseBuilder;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCaseBuilder;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCaseBuilder;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCaseBuilder;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCaseBuilder;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCaseBuilder;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlTypeActionCaseBuilder;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder;
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.SetVlanPcpActionCaseBuilder;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.StripVlanActionCaseBuilder;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SwPathActionCaseBuilder;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.controller.action._case.ControllerActionBuilder;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.in._case.CopyTtlInBuilder;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.out._case.CopyTtlOutBuilder;
72 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.mpls.ttl._case.DecMplsTtlBuilder;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtl;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropAction;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.action._case.FloodActionBuilder;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.all.action._case.FloodAllActionBuilder;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.hw.path.action._case.HwPathActionBuilder;
81 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.loopback.action._case.LoopbackActionBuilder;
82 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder;
83 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
84 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbActionBuilder;
85 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder;
86 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder;
87 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder;
88 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder;
89 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstActionBuilder;
90 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder;
91 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.type.action._case.SetDlTypeActionBuilder;
92 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;
93 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlActionBuilder;
94 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.next.hop.action._case.SetNextHopActionBuilder;
95 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder;
96 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder;
97 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.tos.action._case.SetNwTosActionBuilder;
98 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder;
99 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.queue.action._case.SetQueueActionBuilder;
100 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstActionBuilder;
101 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder;
102 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.cfi.action._case.SetVlanCfiActionBuilder;
103 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder;
104 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.pcp.action._case.SetVlanPcpActionBuilder;
105 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.strip.vlan.action._case.StripVlanActionBuilder;
106 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.sw.path.action._case.SwPathActionBuilder;
107 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
108 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
109 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
110 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
111 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
112 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
113 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
114 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
115 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
116 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
117 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
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.NodeConnectorId;
141 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
142 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
143 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
144 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
145 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
146 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
147 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
148 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
149 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
150 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
151 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddressBuilder;
152 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpTargetHardwareAddressBuilder;
153 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
154 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder;
155 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
156 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6ExtHeaderBuilder;
157 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6LabelBuilder;
158 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
159 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder;
160 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder;
161 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
162 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.MetadataBuilder;
163 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder;
164 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.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.common.RpcResult;
179 import org.osgi.framework.BundleContext;
180 import org.slf4j.Logger;
181 import org.slf4j.LoggerFactory;
183 public class OpenflowpluginTestCommandProvider implements CommandProvider {
185 private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
187 private DataBrokerService dataBrokerService;
188 private ProviderContext pc;
189 private final BundleContext ctx;
190 private FlowBuilder testFlow;
191 private NodeBuilder testNode;
192 private final String originalFlowName = "Foo";
193 private final String updatedFlowName = "Bar";
194 private final FlowEventListener flowEventListener = new FlowEventListener();
195 private static NotificationService notificationService;
196 private Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> listener1Reg;
198 public OpenflowpluginTestCommandProvider(BundleContext ctx) {
202 public void onSessionInitiated(ProviderContext session) {
204 notificationService = session.getSALService(NotificationService.class);
206 listener1Reg = notificationService.registerNotificationListener(flowEventListener);
207 dataBrokerService = session.getSALService(DataBrokerService.class);
208 ctx.registerService(CommandProvider.class.getName(), this, null);
209 createTestFlow(createTestNode(null), null, null);
212 private NodeBuilder createTestNode(String nodeId) {
213 if (nodeId == null) {
214 nodeId = OpenflowpluginTestActivator.NODE_ID;
216 NodeRef nodeOne = createNodeRef(nodeId);
217 NodeBuilder builder = new NodeBuilder();
218 builder.setId(new NodeId(nodeId));
219 builder.setKey(new NodeKey(builder.getId()));
224 final class FlowEventListener implements SalFlowListener {
227 public void onFlowAdded(FlowAdded notification) {
228 LOG.info("flow to be added.........................." + notification.toString());
229 LOG.info("added flow Xid........................." + notification.getTransactionId().getValue());
230 LOG.info("-----------------------------------------------------------------------------------");
234 public void onFlowRemoved(FlowRemoved notification) {
235 LOG.debug("removed flow.........................." + notification.toString());
236 LOG.debug("remove flow Xid........................." + notification.getTransactionId().getValue());
237 LOG.debug("-----------------------------------------------------------------------------------");
241 public void onFlowUpdated(FlowUpdated notification) {
242 LOG.debug("updated flow.........................." + notification.toString());
243 LOG.debug("updated flow Xid........................." + notification.getTransactionId().getValue());
244 LOG.debug("-----------------------------------------------------------------------------------");
248 public void onNodeErrorNotification(NodeErrorNotification notification) {
249 LOG.error("Error notification flow Xid........................."
250 + notification.getTransactionId().getValue());
251 LOG.debug("-----------------------------------------------------------------------------------");
255 public void onNodeExperimenterErrorNotification(NodeExperimenterErrorNotification notification) {
256 // TODO Auto-generated method stub
261 public void onSwitchFlowRemoved(SwitchFlowRemoved notification) {
262 LOG.debug("Switch flow removed : Cookies..................." + notification.getCookie().toString());
263 LOG.debug("-----------------------------------------------------------------------------------");
267 private InstanceIdentifier<Node> nodeBuilderToInstanceId(NodeBuilder node) {
268 return InstanceIdentifier.builder(Nodes.class).child(Node.class, node.getKey()).toInstance();
271 private FlowBuilder createTestFlow(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
273 FlowBuilder flow = new FlowBuilder();
276 String flowType = flowTypeArg;
277 if (flowType == null) {
286 flow.setMatch(createMatch1().build());
287 flow.setInstructions(createDecNwTtlInstructions().build());
291 flow.setMatch(createMatch2().build());
292 flow.setInstructions(createDropInstructions().build());
296 flow.setMatch(createMatch3().build());
297 flow.setInstructions(createDropInstructions().build());
301 flow.setMatch(createEthernetMatch().build());
302 flow.setInstructions(createDropInstructions().build());
306 flow.setMatch(createMatch1().build());
307 flow.setInstructions(createAppyActionInstruction().build());
311 flow.setMatch(createMatch1().build());
312 flow.setInstructions(createGotoTableInstructions().build());
316 flow.setMatch(createMatch1().build());
317 flow.setInstructions(createMeterInstructions().build());
321 flow.setMatch(createMatch1().build());
322 flow.setInstructions(createAppyActionInstruction1().build());
326 flow.setMatch(createMatch1().build());
327 flow.setInstructions(createAppyActionInstruction2().build());
331 flow.setMatch(createMatch1().build());
332 flow.setInstructions(createAppyActionInstruction3().build());
336 flow.setMatch(createMatch1().build());
337 flow.setInstructions(createAppyActionInstruction4().build());
341 flow.setMatch(createMatch1().build());
342 flow.setInstructions(createAppyActionInstruction5().build());
346 flow.setMatch(createMatch1().build());
347 flow.setInstructions(createAppyActionInstruction6().build());
351 flow.setMatch(createMatch1().build());
352 flow.setInstructions(createAppyActionInstruction7().build());
356 flow.setMatch(createMatch1().build());
357 flow.setInstructions(createAppyActionInstruction8().build());
361 flow.setMatch(createMatch1().build());
362 flow.setInstructions(createAppyActionInstruction9().build());
366 flow.setMatch(createMatch1().build());
367 flow.setInstructions(createAppyActionInstruction10().build());
371 flow.setMatch(createMatch1().build());
372 flow.setInstructions(createAppyActionInstruction11().build());
376 flow.setMatch(createMatch1().build());
377 flow.setInstructions(createAppyActionInstruction12().build());
381 flow.setMatch(createMatch1().build());
382 flow.setInstructions(createAppyActionInstruction13().build());
386 flow.setMatch(createMatch1().build());
387 flow.setInstructions(createAppyActionInstruction14().build());
391 flow.setMatch(createMatch1().build());
392 flow.setInstructions(createAppyActionInstruction15().build());
396 // f23 can be used as test-case for generating error notification
397 // if the particular group is not configured - tested
398 flow.setMatch(createMatch1().build());
399 flow.setInstructions(createAppyActionInstruction16().build());
403 flow.setMatch(createMatch1().build());
404 flow.setInstructions(createAppyActionInstruction17().build());
408 flow.setMatch(createMatch1().build());
409 flow.setInstructions(createAppyActionInstruction18().build());
413 flow.setMatch(createMatch1().build());
414 flow.setInstructions(createAppyActionInstruction19().build());
418 flow.setMatch(createMatch1().build());
419 flow.setInstructions(createMetadataInstructions().build());
423 flow.setMatch(createMatch1().build());
424 flow.setInstructions(createAppyActionInstruction20().build());
428 flow.setMatch(createMatch1().build());
429 flow.setInstructions(createAppyActionInstruction21().build());
433 flow.setMatch(createMatch1().build());
434 flow.setInstructions(createAppyActionInstruction22().build());
438 flow.setMatch(createMatch1().build());
439 flow.setInstructions(createAppyActionInstruction23(nodeBuilder.getId()).build());
443 flow.setMatch(createMatch1().build());
444 flow.setInstructions(createAppyActionInstruction24().build());
448 flow.setMatch(createMatch1().build());
449 flow.setInstructions(createAppyActionInstruction25().build());
453 flow.setMatch(createMatch1().build());
454 flow.setInstructions(createAppyActionInstruction26().build());
458 flow.setMatch(createMatch1().build());
459 flow.setInstructions(createAppyActionInstruction27().build());
463 flow.setMatch(createMatch1().build());
464 flow.setInstructions(createAppyActionInstruction28().build());
468 flow.setMatch(createMatch1().build());
469 flow.setInstructions(createAppyActionInstruction29().build());
473 flow.setMatch(createMatch1().build());
474 flow.setInstructions(createAppyActionInstruction30().build());
478 flow.setMatch(createMatch1().build());
479 flow.setInstructions(createAppyActionInstruction31().build());
483 flow.setMatch(createMatch1().build());
484 flow.setInstructions(createAppyActionInstruction32().build());
488 flow.setMatch(createMatch1().build());
489 flow.setInstructions(createAppyActionInstruction33().build());
493 flow.setMatch(createMatch1().build());
494 flow.setInstructions(createAppyActionInstruction34().build());
498 flow.setMatch(createICMPv6Match().build());
499 flow.setInstructions(createDecNwTtlInstructions().build());
503 flow.setMatch(createInphyportMatch(nodeBuilder.getId()).build());
504 flow.setInstructions(createDropInstructions().build());
508 flow.setMatch(createMetadataMatch().build());
509 flow.setInstructions(createDropInstructions().build());
513 flow.setMatch(createL3IPv6Match().build());
514 flow.setInstructions(createDecNwTtlInstructions().build());
518 flow.setMatch(createL4SCTPMatch().build());
519 flow.setInstructions(createAppyActionInstruction().build());
523 flow.setMatch(createTunnelIDMatch().build());
524 flow.setInstructions(createGotoTableInstructions().build());
528 flow.setMatch(createVlanMatch().build());
529 flow.setInstructions(createMeterInstructions().build());
533 flow.setMatch(createPbbMatch().build());
534 flow.setInstructions(createMeterInstructions().build());
538 flow.setMatch(createVlanMatch().build());
539 flow.setInstructions(createDropInstructions().build());
543 flow.setMatch(createL4TCPMatch().build());
544 flow.setInstructions(createDropInstructions().build());
549 flow.setMatch(createL4UDPMatch().build());
550 flow.setInstructions(createDropInstructions().build());
554 flow.setMatch(new MatchBuilder().build());
555 flow.setInstructions(createSentToControllerInstructions().build());
560 flow.setMatch(createToSMatch().build());
561 flow.setInstructions(createDropInstructions().build());
565 flow.setMatch(createToSMatch().build());
566 flow.setInstructions(createOutputInstructions("INPORT", 10).build());
570 flow.setMatch(createToSMatch().build());
571 flow.setInstructions(createOutputInstructions("FLOOD", 20).build());
575 flow.setMatch(createToSMatch().build());
576 flow.setInstructions(createOutputInstructions("ALL", 30).build());
580 flow.setMatch(createToSMatch().build());
581 flow.setInstructions(createOutputInstructions("NORMAL", 40).build());
585 flow.setMatch(createToSMatch().build());
586 flow.setInstructions(createOutputInstructions("LOCAL", 50).build());
590 flow.setMatch(createToSMatch().build());
591 flow.setInstructions(createOutputInstructions("TABLE", 60).build());
595 flow.setMatch(createToSMatch().build());
596 flow.setInstructions(createOutputInstructions("NONE", 70).build());
600 flow.setMatch(createToSMatch().build());
601 flow.setInstructions(createStripVlanInstructions().build());
602 flow.setBarrier(Boolean.TRUE);
606 flow.setMatch(createMatch1().build());
607 flow.setInstructions(createAppyActionInstruction35().build());
611 flow.setMatch(createMatch1().build());
612 flow.setInstructions(createAppyActionInstruction36().build());
616 flow.setMatch(createMatch1().build());
617 flow.setInstructions(createAppyActionInstruction37().build());
621 flow.setMatch(createMatch1().build());
622 flow.setInstructions(createAppyActionInstruction38().build());
626 flow.setMatch(createL4TCPMatch().build());
627 flow.setInstructions(createAppyActionInstruction39().build());
631 flow.setMatch(createL4UDPMatch().build());
632 flow.setInstructions(createAppyActionInstruction40().build());
636 flow.setMatch(createL4SCTPMatch().build());
637 flow.setInstructions(createAppyActionInstruction41().build());
641 flow.setMatch(createICMPv4Match().build());
642 flow.setInstructions(createAppyActionInstruction42().build());
646 flow.setMatch(createArpMatch().build());
647 flow.setInstructions(createAppyActionInstruction43().build());
651 flow.setMatch(createL3IPv6Match().build());
652 flow.setInstructions(createAppyActionInstruction44().build());
656 flow.setMatch(createICMPv6Match().build());
657 flow.setInstructions(createAppyActionInstruction45().build());
661 flow.setMatch(createMplsMatch().build());
662 flow.setInstructions(createAppyActionInstruction46().build());
666 flow.setMatch(createPbbMatch().build());
667 flow.setInstructions(createAppyActionInstruction47().build());
671 flow.setMatch(createTunnelIDMatch().build());
672 flow.setInstructions(createAppyActionInstruction48().build());
676 flow.setMatch(createMatch33().build());
677 flow.setInstructions(createDropInstructions().build());
681 flow.setMatch(createICMPv6Match1().build());
682 flow.setInstructions(createDecNwTtlInstructions().build());
686 flow.setMatch(createMatch1().build());
687 flow.setInstructions(createAppyActionInstruction88().build());
691 flow.setMatch(createLLDPMatch().build());
692 flow.setInstructions(createSentToControllerInstructions().build());
696 flow.setMatch(createToSMatch().build());
697 flow.setInstructions(createOutputInstructions().build());
700 LOG.warn("flow type not understood: {}", flowType);
703 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
704 if (null == flow.isBarrier()) {
705 flow.setBarrier(Boolean.FALSE);
707 // flow.setBufferId(new Long(12));
708 BigInteger value = new BigInteger("10", 10);
709 // BigInteger outputPort = new BigInteger("65535", 10);
710 flow.setCookie(value);
711 flow.setCookieMask(value);
712 flow.setHardTimeout(0);
713 flow.setIdleTimeout(0);
714 flow.setInstallHw(false);
715 flow.setStrict(false);
716 flow.setContainerName(null);
717 flow.setFlags(new FlowModFlags(false, false, false, false, true));
718 flow.setId(new FlowId("12"));
719 flow.setTableId(getTableId(tableId));
720 // commenting setOutGroup and setOutPort, as by default
722 // enable setOutGroup and setOutPort to enable output filtering
723 // flow.setOutGroup(new Long(2));
724 // set outport to OFPP_NONE (65535) to disable remove restriction for
726 // flow.setOutPort(outputPort);
729 flow.setFlowName(originalFlowName + "X" + flowType);
734 private FlowBuilder createtablemiss(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
735 FlowBuilder flow = new FlowBuilder();
737 MatchBuilder matchBuilder = new MatchBuilder();
738 flow.setMatch(matchBuilder.build());
739 flow.setInstructions(createSentToControllerInstructions().build());
741 flow.setTableId((short) 0);
742 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
748 private short getTableId(String tableId) {
751 table = Short.parseShort(tableId);
752 } catch (Exception ex) {
753 // ignore exception and continue with default value
763 private static InstructionsBuilder createDecNwTtlInstructions() {
764 DecNwTtlBuilder ta = new DecNwTtlBuilder();
765 DecNwTtl decNwTtl = ta.build();
766 ActionBuilder ab = new ActionBuilder();
767 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
769 // Add our drop action to a list
770 List<Action> actionList = new ArrayList<Action>();
771 actionList.add(ab.build());
773 // Create an Apply Action
774 ApplyActionsBuilder aab = new ApplyActionsBuilder();
775 aab.setAction(actionList);
777 // Wrap our Apply Action in an Instruction
778 InstructionBuilder ib = new InstructionBuilder();
779 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
780 ib.setKey(new InstructionKey(0));
783 // Put our Instruction in a list of Instructions
784 InstructionsBuilder isb = new InstructionsBuilder();
785 List<Instruction> instructions = new ArrayList<Instruction>();
786 instructions.add(ib.build());
787 isb.setInstruction(instructions);
794 private static InstructionsBuilder createMeterInstructions() {
796 MeterBuilder aab = new MeterBuilder();
797 aab.setMeterId(new MeterId(new Long(1)));
799 InstructionBuilder ib = new InstructionBuilder();
800 ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
802 // Put our Instruction in a list of Instructions
803 InstructionsBuilder isb = new InstructionsBuilder();
804 List<Instruction> instructions = new ArrayList<Instruction>();
805 instructions.add(ib.build());
806 isb.setInstruction(instructions);
810 private static InstructionsBuilder createMetadataInstructions() {
812 WriteMetadataBuilder aab = new WriteMetadataBuilder();
813 aab.setMetadata(new BigInteger("10", 10));
814 aab.setMetadataMask(new BigInteger("12", 10));
816 InstructionBuilder ib = new InstructionBuilder();
817 ib.setInstruction(new WriteMetadataCaseBuilder().setWriteMetadata(aab.build()).build());
819 // Put our Instruction in a list of Instructions
820 InstructionsBuilder isb = new InstructionsBuilder();
821 List<Instruction> instructions = new ArrayList<Instruction>();
822 instructions.add(ib.build());
823 isb.setInstruction(instructions);
827 private static InstructionsBuilder createGotoTableInstructions() {
829 GoToTableBuilder aab = new GoToTableBuilder();
830 aab.setTableId((short) 2);
832 InstructionBuilder ib = new InstructionBuilder();
833 ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(aab.build()).build());
835 // Put our Instruction in a list of Instructions
836 InstructionsBuilder isb = new InstructionsBuilder();
837 List<Instruction> instructions = new ArrayList<Instruction>();
838 instructions.add(ib.build());
839 isb.setInstruction(instructions);
843 private static InstructionsBuilder createDropInstructions() {
844 DropActionBuilder dab = new DropActionBuilder();
845 DropAction dropAction = dab.build();
846 ActionBuilder ab = new ActionBuilder();
847 ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build());
849 // Add our drop action to a list
850 List<Action> actionList = new ArrayList<Action>();
851 actionList.add(ab.build());
853 // Create an Apply Action
854 ApplyActionsBuilder aab = new ApplyActionsBuilder();
855 aab.setAction(actionList);
857 // Wrap our Apply Action in an Instruction
858 InstructionBuilder ib = new InstructionBuilder();
859 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
861 // Put our Instruction in a list of Instructions
862 InstructionsBuilder isb = new InstructionsBuilder();
863 List<Instruction> instructions = new ArrayList<Instruction>();
864 instructions.add(ib.build());
865 isb.setInstruction(instructions);
869 private static InstructionsBuilder createAppyActionInstruction() {
871 List<Action> actionList = new ArrayList<Action>();
872 ActionBuilder ab = new ActionBuilder();
873 ControllerActionBuilder controller = new ControllerActionBuilder();
874 controller.setMaxLength(5);
875 ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.build()).build());
876 actionList.add(ab.build());
877 // Create an Apply Action
878 ApplyActionsBuilder aab = new ApplyActionsBuilder();
879 aab.setAction(actionList);
881 // Wrap our Apply Action in an Instruction
882 InstructionBuilder ib = new InstructionBuilder();
883 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
885 // Put our Instruction in a list of Instructions
886 InstructionsBuilder isb = new InstructionsBuilder();
887 List<Instruction> instructions = new ArrayList<Instruction>();
888 instructions.add(ib.build());
889 isb.setInstruction(instructions);
893 private static InstructionsBuilder createAppyActionInstruction1() {
895 List<Action> actionList = new ArrayList<Action>();
896 ActionBuilder ab = new ActionBuilder();
898 OutputActionBuilder output = new OutputActionBuilder();
899 output.setMaxLength(56);
900 Uri value = new Uri("PCEP");
901 output.setOutputNodeConnector(value);
902 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
903 actionList.add(ab.build());
904 // Create an Apply Action
905 ApplyActionsBuilder aab = new ApplyActionsBuilder();
906 aab.setAction(actionList);
908 // Wrap our Apply Action in an Instruction
909 InstructionBuilder ib = new InstructionBuilder();
910 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
912 // Put our Instruction in a list of Instructions
913 InstructionsBuilder isb = new InstructionsBuilder();
914 List<Instruction> instructions = new ArrayList<Instruction>();
915 instructions.add(ib.build());
916 isb.setInstruction(instructions);
920 private static InstructionsBuilder createOutputInstructions() {
922 // test case for Output Port works if the particular port exists
923 // this particular test-case is for Port : 1
924 // tested as (addMDFlow openflow:<dpid> f82)
925 List<Action> actionList = new ArrayList<Action>();
926 ActionBuilder ab = new ActionBuilder();
927 OutputActionBuilder output = new OutputActionBuilder();
929 Uri value = new Uri("1");
930 output.setOutputNodeConnector(value);
931 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
933 ab.setKey(new ActionKey(0));
934 actionList.add(ab.build());
935 // Create an Apply Action
936 ApplyActionsBuilder aab = new ApplyActionsBuilder();
937 aab.setAction(actionList);
939 // Wrap our Apply Action in an Instruction
940 InstructionBuilder ib = new InstructionBuilder();
941 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
943 ib.setKey(new InstructionKey(0));
945 // Put our Instruction in a list of Instructions
946 InstructionsBuilder isb = new InstructionsBuilder();
947 List<Instruction> instructions = new ArrayList<Instruction>();
948 instructions.add(ib.build());
949 isb.setInstruction(instructions);
953 private static InstructionsBuilder createSentToControllerInstructions() {
954 List<Action> actionList = new ArrayList<Action>();
955 ActionBuilder ab = new ActionBuilder();
957 OutputActionBuilder output = new OutputActionBuilder();
958 output.setMaxLength(new Integer(0xffff));
959 Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
960 output.setOutputNodeConnector(value);
961 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
963 ab.setKey(new ActionKey(0));
964 actionList.add(ab.build());
965 // Create an Apply Action
966 ApplyActionsBuilder aab = new ApplyActionsBuilder();
967 aab.setAction(actionList);
969 // Wrap our Apply Action in an Instruction
970 InstructionBuilder ib = new InstructionBuilder();
971 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
973 ib.setKey(new InstructionKey(0));
975 // Put our Instruction in a list of Instructions
976 InstructionsBuilder isb = new InstructionsBuilder();
977 List<Instruction> instructions = new ArrayList<Instruction>();
978 instructions.add(ib.build());
979 isb.setInstruction(instructions);
983 private static InstructionsBuilder createOutputInstructions(String outputType, int outputValue) {
984 List<Action> actionList = new ArrayList<Action>();
985 ActionBuilder ab = new ActionBuilder();
987 OutputActionBuilder output = new OutputActionBuilder();
988 output.setMaxLength(outputValue);
989 Uri value = new Uri(outputType);
990 output.setOutputNodeConnector(value);
991 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
993 ab.setKey(new ActionKey(0));
994 actionList.add(ab.build());
995 // Create an Apply Action
996 ApplyActionsBuilder aab = new ApplyActionsBuilder();
997 aab.setAction(actionList);
999 // Wrap our Apply Action in an Instruction
1000 InstructionBuilder ib = new InstructionBuilder();
1001 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1003 ib.setKey(new InstructionKey(0));
1005 // Put our Instruction in a list of Instructions
1006 InstructionsBuilder isb = new InstructionsBuilder();
1007 List<Instruction> instructions = new ArrayList<Instruction>();
1008 instructions.add(ib.build());
1009 isb.setInstruction(instructions);
1013 private static InstructionsBuilder createStripVlanInstructions() {
1014 List<Action> actionList = new ArrayList<Action>();
1015 ActionBuilder ab = new ActionBuilder();
1017 StripVlanActionBuilder stripActionBuilder = new StripVlanActionBuilder();
1018 ab.setAction(new StripVlanActionCaseBuilder().setStripVlanAction(stripActionBuilder.build()).build());
1020 ab.setKey(new ActionKey(0));
1021 actionList.add(ab.build());
1022 // Create an Apply Action
1023 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1024 aab.setAction(actionList);
1026 // Wrap our Apply Action in an Instruction
1027 InstructionBuilder ib = new InstructionBuilder();
1028 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1030 ib.setKey(new InstructionKey(0));
1032 // Put our Instruction in a list of Instructions
1033 InstructionsBuilder isb = new InstructionsBuilder();
1034 List<Instruction> instructions = new ArrayList<Instruction>();
1035 instructions.add(ib.build());
1036 isb.setInstruction(instructions);
1040 private static InstructionsBuilder createAppyActionInstruction2() {
1042 List<Action> actionList = new ArrayList<Action>();
1043 ActionBuilder ab = new ActionBuilder();
1045 PushMplsActionBuilder push = new PushMplsActionBuilder();
1046 push.setEthernetType(new Integer(0x8847));
1047 ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
1048 actionList.add(ab.build());
1049 // Create an Apply Action
1050 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1051 aab.setAction(actionList);
1053 // Wrap our Apply Action in an Instruction
1054 InstructionBuilder ib = new InstructionBuilder();
1055 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1057 // Put our Instruction in a list of Instructions
1058 InstructionsBuilder isb = new InstructionsBuilder();
1059 List<Instruction> instructions = new ArrayList<Instruction>();
1060 instructions.add(ib.build());
1061 isb.setInstruction(instructions);
1065 private static InstructionsBuilder createAppyActionInstruction3() {
1067 List<Action> actionList = new ArrayList<Action>();
1068 ActionBuilder ab = new ActionBuilder();
1070 PushPbbActionBuilder pbb = new PushPbbActionBuilder();
1071 pbb.setEthernetType(new Integer(0x88E7));
1072 ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
1073 actionList.add(ab.build());
1074 // Create an Apply Action
1075 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1076 aab.setAction(actionList);
1078 // Wrap our Apply Action in an Instruction
1079 InstructionBuilder ib = new InstructionBuilder();
1080 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1082 // Put our Instruction in a list of Instructions
1083 InstructionsBuilder isb = new InstructionsBuilder();
1084 List<Instruction> instructions = new ArrayList<Instruction>();
1085 instructions.add(ib.build());
1086 isb.setInstruction(instructions);
1090 private static InstructionsBuilder createAppyActionInstruction4() {
1092 List<Action> actionList = new ArrayList<Action>();
1093 ActionBuilder ab = new ActionBuilder();
1095 PushVlanActionBuilder vlan = new PushVlanActionBuilder();
1096 vlan.setEthernetType(new Integer(0x8100));
1097 ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
1098 actionList.add(ab.build());
1100 // Create an Apply Action
1101 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1102 aab.setAction(actionList);
1104 // Wrap our Apply Action in an Instruction
1105 InstructionBuilder ib = new InstructionBuilder();
1106 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1108 // Put our Instruction in a list of Instructions
1109 InstructionsBuilder isb = new InstructionsBuilder();
1110 List<Instruction> instructions = new ArrayList<Instruction>();
1111 instructions.add(ib.build());
1112 isb.setInstruction(instructions);
1116 private static InstructionsBuilder createAppyActionInstruction5() {
1118 List<Action> actionList = new ArrayList<Action>();
1119 ActionBuilder ab = new ActionBuilder();
1121 SetDlDstActionBuilder setdl = new SetDlDstActionBuilder();
1122 setdl.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1123 ab.setAction(new SetDlDstActionCaseBuilder().setSetDlDstAction(setdl.build()).build());
1124 actionList.add(ab.build());
1125 // Create an Apply Action
1126 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1127 aab.setAction(actionList);
1129 // Wrap our Apply Action in an Instruction
1130 InstructionBuilder ib = new InstructionBuilder();
1131 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1133 // Put our Instruction in a list of Instructions
1134 InstructionsBuilder isb = new InstructionsBuilder();
1135 List<Instruction> instructions = new ArrayList<Instruction>();
1136 instructions.add(ib.build());
1137 isb.setInstruction(instructions);
1141 private static InstructionsBuilder createAppyActionInstruction6() {
1143 List<Action> actionList = new ArrayList<Action>();
1144 ActionBuilder ab = new ActionBuilder();
1146 SetDlSrcActionBuilder src = new SetDlSrcActionBuilder();
1147 src.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1148 ab.setAction(new SetDlSrcActionCaseBuilder().setSetDlSrcAction(src.build()).build());
1149 actionList.add(ab.build());
1151 // Create an Apply Action
1152 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1153 aab.setAction(actionList);
1155 // Wrap our Apply Action in an Instruction
1156 InstructionBuilder ib = new InstructionBuilder();
1157 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1159 // Put our Instruction in a list of Instructions
1160 InstructionsBuilder isb = new InstructionsBuilder();
1161 List<Instruction> instructions = new ArrayList<Instruction>();
1162 instructions.add(ib.build());
1163 isb.setInstruction(instructions);
1167 private static InstructionsBuilder createAppyActionInstruction7() {
1169 List<Action> actionList = new ArrayList<Action>();
1170 ActionBuilder ab = new ActionBuilder();
1172 SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
1173 VlanId a = new VlanId(4000);
1175 ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
1176 actionList.add(ab.build());
1177 // Create an Apply Action
1178 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1179 aab.setAction(actionList);
1181 // Wrap our Apply Action in an Instruction
1182 InstructionBuilder ib = new InstructionBuilder();
1183 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1185 // Put our Instruction in a list of Instructions
1186 InstructionsBuilder isb = new InstructionsBuilder();
1187 List<Instruction> instructions = new ArrayList<Instruction>();
1188 instructions.add(ib.build());
1189 isb.setInstruction(instructions);
1193 private static InstructionsBuilder createAppyActionInstruction8() {
1195 List<Action> actionList = new ArrayList<Action>();
1196 ActionBuilder ab = new ActionBuilder();
1198 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1199 VlanPcp pcp1 = new VlanPcp((short) 2);
1200 pcp.setVlanPcp(pcp1);
1201 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1202 actionList.add(ab.build());
1203 // Create an Apply Action
1204 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1205 aab.setAction(actionList);
1207 // Wrap our Apply Action in an Instruction
1208 InstructionBuilder ib = new InstructionBuilder();
1209 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1211 // Put our Instruction in a list of Instructions
1212 InstructionsBuilder isb = new InstructionsBuilder();
1213 List<Instruction> instructions = new ArrayList<Instruction>();
1214 instructions.add(ib.build());
1215 isb.setInstruction(instructions);
1219 private static InstructionsBuilder createAppyActionInstruction88() {
1221 List<Action> actionList = new ArrayList<Action>();
1222 ActionBuilder ab = new ActionBuilder();
1224 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1225 VlanPcp pcp1 = new VlanPcp((short) 9);
1226 pcp.setVlanPcp(pcp1);
1227 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1228 actionList.add(ab.build());
1229 // Create an Apply Action
1230 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1231 aab.setAction(actionList);
1233 // Wrap our Apply Action in an Instruction
1234 InstructionBuilder ib = new InstructionBuilder();
1235 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1237 // Put our Instruction in a list of Instructions
1238 InstructionsBuilder isb = new InstructionsBuilder();
1239 List<Instruction> instructions = new ArrayList<Instruction>();
1240 instructions.add(ib.build());
1241 isb.setInstruction(instructions);
1245 private static InstructionsBuilder createAppyActionInstruction9() {
1247 List<Action> actionList = new ArrayList<Action>();
1248 ActionBuilder ab = new ActionBuilder();
1250 CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
1251 ab.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
1252 actionList.add(ab.build());
1253 // Create an Apply Action
1254 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1255 aab.setAction(actionList);
1257 // Wrap our Apply Action in an Instruction
1258 InstructionBuilder ib = new InstructionBuilder();
1259 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1261 // Put our Instruction in a list of Instructions
1262 InstructionsBuilder isb = new InstructionsBuilder();
1263 List<Instruction> instructions = new ArrayList<Instruction>();
1264 instructions.add(ib.build());
1265 isb.setInstruction(instructions);
1269 private static InstructionsBuilder createAppyActionInstruction10() {
1271 List<Action> actionList = new ArrayList<Action>();
1272 ActionBuilder ab = new ActionBuilder();
1274 CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
1275 ab.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
1276 actionList.add(ab.build());
1277 // Create an Apply Action
1278 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1279 aab.setAction(actionList);
1281 // Wrap our Apply Action in an Instruction
1282 InstructionBuilder ib = new InstructionBuilder();
1283 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1285 // Put our Instruction in a list of Instructions
1286 InstructionsBuilder isb = new InstructionsBuilder();
1287 List<Instruction> instructions = new ArrayList<Instruction>();
1288 instructions.add(ib.build());
1289 isb.setInstruction(instructions);
1293 private static InstructionsBuilder createAppyActionInstruction11() {
1295 List<Action> actionList = new ArrayList<Action>();
1296 ActionBuilder ab = new ActionBuilder();
1298 DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
1299 ab.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
1300 actionList.add(ab.build());
1301 // Create an Apply Action
1302 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1303 aab.setAction(actionList);
1305 // Wrap our Apply Action in an Instruction
1306 InstructionBuilder ib = new InstructionBuilder();
1307 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1308 ib.setKey(new InstructionKey(0));
1311 // Put our Instruction in a list of Instruction
1312 InstructionsBuilder isb = new InstructionsBuilder();
1313 List<Instruction> instructions = new ArrayList<Instruction>();
1314 instructions.add(ib.build());
1315 isb.setInstruction(instructions);
1319 private static InstructionsBuilder createAppyActionInstruction12() {
1321 List<Action> actionList = new ArrayList<Action>();
1322 ActionBuilder ab = new ActionBuilder();
1324 DecNwTtlBuilder nwttl = new DecNwTtlBuilder();
1325 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(nwttl.build()).build());
1326 actionList.add(ab.build());
1328 // Create an Apply Action
1329 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1330 aab.setAction(actionList);
1332 // Wrap our Apply Action in an Instruction
1333 InstructionBuilder ib = new InstructionBuilder();
1334 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1336 // Put our Instruction in a list of Instructions
1337 InstructionsBuilder isb = new InstructionsBuilder();
1338 List<Instruction> instructions = new ArrayList<Instruction>();
1339 instructions.add(ib.build());
1340 isb.setInstruction(instructions);
1344 private static InstructionsBuilder createAppyActionInstruction13() {
1346 List<Action> actionList = new ArrayList<Action>();
1347 ActionBuilder ab = new ActionBuilder();
1349 DropActionBuilder drop = new DropActionBuilder();
1350 ab.setAction(new DropActionCaseBuilder().setDropAction(drop.build()).build());
1351 actionList.add(ab.build());
1353 // Create an Apply Action
1354 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1355 aab.setAction(actionList);
1357 // Wrap our Apply Action in an Instruction
1358 InstructionBuilder ib = new InstructionBuilder();
1359 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1361 // Put our Instruction in a list of Instructions
1362 InstructionsBuilder isb = new InstructionsBuilder();
1363 List<Instruction> instructions = new ArrayList<Instruction>();
1364 instructions.add(ib.build());
1365 isb.setInstruction(instructions);
1369 private static InstructionsBuilder createAppyActionInstruction14() {
1371 List<Action> actionList = new ArrayList<Action>();
1372 ActionBuilder ab = new ActionBuilder();
1374 FloodActionBuilder fld = new FloodActionBuilder();
1375 ab.setAction(new FloodActionCaseBuilder().setFloodAction(fld.build()).build());
1376 actionList.add(ab.build());
1377 // Create an Apply Action
1378 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1379 aab.setAction(actionList);
1381 // Wrap our Apply Action in an Instruction
1382 InstructionBuilder ib = new InstructionBuilder();
1383 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1385 // Put our Instruction in a list of Instructions
1386 InstructionsBuilder isb = new InstructionsBuilder();
1387 List<Instruction> instructions = new ArrayList<Instruction>();
1388 instructions.add(ib.build());
1389 isb.setInstruction(instructions);
1393 private static InstructionsBuilder createAppyActionInstruction15() {
1395 List<Action> actionList = new ArrayList<Action>();
1396 ActionBuilder ab = new ActionBuilder();
1398 FloodAllActionBuilder fldall = new FloodAllActionBuilder();
1399 ab.setAction(new FloodAllActionCaseBuilder().setFloodAllAction(fldall.build()).build());
1400 actionList.add(ab.build());
1401 // Create an Apply Action
1402 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1403 aab.setAction(actionList);
1405 // Wrap our Apply Action in an Instruction
1406 InstructionBuilder ib = new InstructionBuilder();
1407 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1409 // Put our Instruction in a list of Instructions
1410 InstructionsBuilder isb = new InstructionsBuilder();
1411 List<Instruction> instructions = new ArrayList<Instruction>();
1412 instructions.add(ib.build());
1413 isb.setInstruction(instructions);
1417 private static InstructionsBuilder createAppyActionInstruction16() {
1419 List<Action> actionList = new ArrayList<Action>();
1420 ActionBuilder ab = new ActionBuilder();
1422 GroupActionBuilder groupActionB = new GroupActionBuilder();
1423 groupActionB.setGroupId(1L);
1424 groupActionB.setGroup("0");
1425 ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
1426 actionList.add(ab.build());
1428 // Create an Apply Action
1429 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1430 aab.setAction(actionList);
1432 // Wrap our Apply Action in an Instruction
1433 InstructionBuilder ib = new InstructionBuilder();
1434 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1436 // Put our Instruction in a list of Instructions
1437 InstructionsBuilder isb = new InstructionsBuilder();
1438 List<Instruction> instructions = new ArrayList<Instruction>();
1439 instructions.add(ib.build());
1440 isb.setInstruction(instructions);
1444 private static InstructionsBuilder createAppyActionInstruction17() {
1446 List<Action> actionList = new ArrayList<Action>();
1447 ActionBuilder ab = new ActionBuilder();
1449 HwPathActionBuilder hwPathB = new HwPathActionBuilder();
1450 ab.setAction(new HwPathActionCaseBuilder().setHwPathAction(hwPathB.build()).build());
1451 actionList.add(ab.build());
1452 // Create an Apply Action
1453 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1454 aab.setAction(actionList);
1456 // Wrap our Apply Action in an Instruction
1457 InstructionBuilder ib = new InstructionBuilder();
1458 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1460 // Put our Instruction in a list of Instructions
1461 InstructionsBuilder isb = new InstructionsBuilder();
1462 List<Instruction> instructions = new ArrayList<Instruction>();
1463 instructions.add(ib.build());
1464 isb.setInstruction(instructions);
1468 private static InstructionsBuilder createAppyActionInstruction18() {
1470 List<Action> actionList = new ArrayList<Action>();
1471 ActionBuilder ab = new ActionBuilder();
1473 LoopbackActionBuilder loopbackActionBuilder = new LoopbackActionBuilder();
1474 ab.setAction(new LoopbackActionCaseBuilder().setLoopbackAction(loopbackActionBuilder.build()).build());
1475 actionList.add(ab.build());
1477 // Create an Apply Action
1478 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1479 aab.setAction(actionList);
1481 // Wrap our Apply Action in an Instruction
1482 InstructionBuilder ib = new InstructionBuilder();
1483 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1485 // Put our Instruction in a list of Instructions
1486 InstructionsBuilder isb = new InstructionsBuilder();
1487 List<Instruction> instructions = new ArrayList<Instruction>();
1488 instructions.add(ib.build());
1489 isb.setInstruction(instructions);
1493 private static InstructionsBuilder createAppyActionInstruction19() {
1495 List<Action> actionList = new ArrayList<Action>();
1496 ActionBuilder ab = new ActionBuilder();
1498 PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
1499 popMplsActionBuilder.setEthernetType(0XB);
1500 ab.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
1501 actionList.add(ab.build());
1502 // Create an Apply Action
1503 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1504 aab.setAction(actionList);
1506 // Wrap our Apply Action in an Instruction
1507 InstructionBuilder ib = new InstructionBuilder();
1508 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1510 // Put our Instruction in a list of Instructions
1511 InstructionsBuilder isb = new InstructionsBuilder();
1512 List<Instruction> instructions = new ArrayList<Instruction>();
1513 instructions.add(ib.build());
1514 isb.setInstruction(instructions);
1518 private static InstructionsBuilder createAppyActionInstruction20() {
1520 List<Action> actionList = new ArrayList<Action>();
1521 ActionBuilder ab = new ActionBuilder();
1523 PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
1524 ab.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
1525 actionList.add(ab.build());
1526 // Create an Apply Action
1527 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1528 aab.setAction(actionList);
1530 // Wrap our Apply Action in an Instruction
1531 InstructionBuilder ib = new InstructionBuilder();
1532 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1534 // Put our Instruction in a list of Instructions
1535 InstructionsBuilder isb = new InstructionsBuilder();
1536 List<Instruction> instructions = new ArrayList<Instruction>();
1537 instructions.add(ib.build());
1538 isb.setInstruction(instructions);
1542 private static InstructionsBuilder createAppyActionInstruction21() {
1544 List<Action> actionList = new ArrayList<Action>();
1545 ActionBuilder ab = new ActionBuilder();
1547 PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder();
1548 ab.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(popVlanActionBuilder.build()).build());
1549 actionList.add(ab.build());
1551 // Create an Apply Action
1552 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1553 aab.setAction(actionList);
1555 // Wrap our Apply Action in an Instruction
1556 InstructionBuilder ib = new InstructionBuilder();
1557 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1559 // Put our Instruction in a list of Instructions
1560 InstructionsBuilder isb = new InstructionsBuilder();
1561 List<Instruction> instructions = new ArrayList<Instruction>();
1562 instructions.add(ib.build());
1563 isb.setInstruction(instructions);
1567 private static InstructionsBuilder createAppyActionInstruction22() {
1569 List<Action> actionList = new ArrayList<Action>();
1570 ActionBuilder ab = new ActionBuilder();
1572 SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
1573 setDlTypeActionBuilder.setDlType(new EtherType(8L));
1574 ab.setAction(new SetDlTypeActionCaseBuilder().setSetDlTypeAction(setDlTypeActionBuilder.build()).build());
1575 actionList.add(ab.build());
1577 // Create an Apply Action
1578 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1579 aab.setAction(actionList);
1581 // Wrap our Apply Action in an Instruction
1582 InstructionBuilder ib = new InstructionBuilder();
1583 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1585 // Put our Instruction in a list of Instructions
1586 InstructionsBuilder isb = new InstructionsBuilder();
1587 List<Instruction> instructions = new ArrayList<Instruction>();
1588 instructions.add(ib.build());
1589 isb.setInstruction(instructions);
1593 private static InstructionsBuilder createAppyActionInstruction23(NodeId nodeId) {
1595 List<Action> actionList = new ArrayList<Action>();
1596 ActionBuilder ab = new ActionBuilder();
1598 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1599 setFieldBuilder.setInPort(new NodeConnectorId(nodeId + ":2"));
1600 actionList.add(ab.build());
1602 // Create an Apply Action
1603 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1604 aab.setAction(actionList);
1606 // Wrap our Apply Action in an Instruction
1607 InstructionBuilder ib = new InstructionBuilder();
1608 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1610 // Put our Instruction in a list of Instructions
1611 InstructionsBuilder isb = new InstructionsBuilder();
1612 List<Instruction> instructions = new ArrayList<Instruction>();
1613 instructions.add(ib.build());
1614 isb.setInstruction(instructions);
1618 private static InstructionsBuilder createAppyActionInstruction24() {
1620 List<Action> actionList = new ArrayList<Action>();
1621 ActionBuilder ab = new ActionBuilder();
1623 SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
1624 setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
1625 ab.setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(setMplsTtlActionBuilder.build()).build());
1626 actionList.add(ab.build());
1628 // Create an Apply Action
1629 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1630 aab.setAction(actionList);
1632 // Wrap our Apply Action in an Instruction
1633 InstructionBuilder ib = new InstructionBuilder();
1634 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1636 // Put our Instruction in a list of Instructions
1637 InstructionsBuilder isb = new InstructionsBuilder();
1638 List<Instruction> instructions = new ArrayList<Instruction>();
1639 instructions.add(ib.build());
1640 isb.setInstruction(instructions);
1644 private static InstructionsBuilder createAppyActionInstruction25() {
1646 List<Action> actionList = new ArrayList<Action>();
1647 ActionBuilder ab = new ActionBuilder();
1649 SetNextHopActionBuilder setNextHopActionBuilder = new SetNextHopActionBuilder();
1650 Ipv4Builder ipnext = new Ipv4Builder();
1651 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
1652 ipnext.setIpv4Address(prefix);
1653 setNextHopActionBuilder.setAddress(ipnext.build());
1654 ab.setAction(new SetNextHopActionCaseBuilder().setSetNextHopAction(setNextHopActionBuilder.build()).build());
1655 actionList.add(ab.build());
1657 // Create an Apply Action
1658 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1659 aab.setAction(actionList);
1661 // Wrap our Apply Action in an Instruction
1662 InstructionBuilder ib = new InstructionBuilder();
1663 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1665 // Put our Instruction in a list of Instructions
1666 InstructionsBuilder isb = new InstructionsBuilder();
1667 List<Instruction> instructions = new ArrayList<Instruction>();
1668 instructions.add(ib.build());
1669 isb.setInstruction(instructions);
1673 private static InstructionsBuilder createAppyActionInstruction26() {
1675 List<Action> actionList = new ArrayList<Action>();
1676 ActionBuilder ab = new ActionBuilder();
1678 SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
1679 Ipv4Builder ipdst = new Ipv4Builder();
1680 Ipv4Prefix prefixdst = new Ipv4Prefix("10.0.0.21/24");
1681 ipdst.setIpv4Address(prefixdst);
1682 setNwDstActionBuilder.setAddress(ipdst.build());
1683 ab.setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build());
1684 actionList.add(ab.build());
1686 // Create an Apply Action
1687 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1688 aab.setAction(actionList);
1690 // Wrap our Apply Action in an Instruction
1691 InstructionBuilder ib = new InstructionBuilder();
1692 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1694 // Put our Instruction in a list of Instructions
1695 InstructionsBuilder isb = new InstructionsBuilder();
1696 List<Instruction> instructions = new ArrayList<Instruction>();
1697 instructions.add(ib.build());
1698 isb.setInstruction(instructions);
1702 private static InstructionsBuilder createAppyActionInstruction27() {
1704 List<Action> actionList = new ArrayList<Action>();
1705 ActionBuilder ab = new ActionBuilder();
1707 SetNwSrcActionBuilder setNwsrcActionBuilder = new SetNwSrcActionBuilder();
1708 Ipv4Builder ipsrc = new Ipv4Builder();
1709 Ipv4Prefix prefixsrc = new Ipv4Prefix("10.0.23.21/24");
1710 ipsrc.setIpv4Address(prefixsrc);
1711 setNwsrcActionBuilder.setAddress(ipsrc.build());
1712 ab.setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwsrcActionBuilder.build()).build());
1713 actionList.add(ab.build());
1715 // Create an Apply Action
1716 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1717 aab.setAction(actionList);
1719 // Wrap our Apply Action in an Instruction
1720 InstructionBuilder ib = new InstructionBuilder();
1721 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1723 // Put our Instruction in a list of Instructions
1724 InstructionsBuilder isb = new InstructionsBuilder();
1725 List<Instruction> instructions = new ArrayList<Instruction>();
1726 instructions.add(ib.build());
1727 isb.setInstruction(instructions);
1731 private static InstructionsBuilder createAppyActionInstruction28() {
1733 List<Action> actionList = new ArrayList<Action>();
1734 ActionBuilder ab = new ActionBuilder();
1736 SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
1737 setNwTosActionBuilder.setTos(8);
1738 ab.setAction(new SetNwTosActionCaseBuilder().setSetNwTosAction(setNwTosActionBuilder.build()).build());
1739 actionList.add(ab.build());
1740 // Create an Apply Action
1741 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1742 aab.setAction(actionList);
1744 // Wrap our Apply Action in an Instruction
1745 InstructionBuilder ib = new InstructionBuilder();
1746 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1748 // Put our Instruction in a list of Instructions
1749 InstructionsBuilder isb = new InstructionsBuilder();
1750 List<Instruction> instructions = new ArrayList<Instruction>();
1751 instructions.add(ib.build());
1752 isb.setInstruction(instructions);
1756 private static InstructionsBuilder createAppyActionInstruction29() {
1758 List<Action> actionList = new ArrayList<Action>();
1759 ActionBuilder ab = new ActionBuilder();
1761 SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
1762 setNwTtlActionBuilder.setNwTtl((short) 1);
1763 ab.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
1764 actionList.add(ab.build());
1766 // Create an Apply Action
1767 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1768 aab.setAction(actionList);
1770 // Wrap our Apply Action in an Instruction
1771 InstructionBuilder ib = new InstructionBuilder();
1772 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1774 // Put our Instruction in a list of Instructions
1775 InstructionsBuilder isb = new InstructionsBuilder();
1776 List<Instruction> instructions = new ArrayList<Instruction>();
1777 instructions.add(ib.build());
1778 isb.setInstruction(instructions);
1782 private static InstructionsBuilder createAppyActionInstruction30() {
1784 List<Action> actionList = new ArrayList<Action>();
1785 ActionBuilder ab = new ActionBuilder();
1787 SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
1788 setQueueActionBuilder.setQueueId(1L);
1789 ab.setAction(new SetQueueActionCaseBuilder().setSetQueueAction(setQueueActionBuilder.build()).build());
1790 actionList.add(ab.build());
1791 // Create an Apply Action
1792 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1793 aab.setAction(actionList);
1795 // Wrap our Apply Action in an Instruction
1796 InstructionBuilder ib = new InstructionBuilder();
1797 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1799 // Put our Instruction in a list of Instructions
1800 InstructionsBuilder isb = new InstructionsBuilder();
1801 List<Instruction> instructions = new ArrayList<Instruction>();
1802 instructions.add(ib.build());
1803 isb.setInstruction(instructions);
1807 private static InstructionsBuilder createAppyActionInstruction31() {
1809 List<Action> actionList = new ArrayList<Action>();
1810 ActionBuilder ab = new ActionBuilder();
1812 SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
1813 setTpDstActionBuilder.setPort(new PortNumber(109));
1815 ab.setAction(new SetTpDstActionCaseBuilder().setSetTpDstAction(setTpDstActionBuilder.build()).build());
1816 actionList.add(ab.build());
1817 // Create an Apply Action
1818 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1819 aab.setAction(actionList);
1821 // Wrap our Apply Action in an Instruction
1822 InstructionBuilder ib = new InstructionBuilder();
1823 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1825 // Put our Instruction in a list of Instructions
1826 InstructionsBuilder isb = new InstructionsBuilder();
1827 List<Instruction> instructions = new ArrayList<Instruction>();
1828 instructions.add(ib.build());
1829 isb.setInstruction(instructions);
1833 private static InstructionsBuilder createAppyActionInstruction32() {
1835 List<Action> actionList = new ArrayList<Action>();
1836 ActionBuilder ab = new ActionBuilder();
1838 SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
1839 setTpSrcActionBuilder.setPort(new PortNumber(109));
1840 ab.setAction(new SetTpSrcActionCaseBuilder().setSetTpSrcAction(setTpSrcActionBuilder.build()).build());
1841 actionList.add(ab.build());
1843 // Create an Apply Action
1844 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1845 aab.setAction(actionList);
1847 // Wrap our Apply Action in an Instruction
1848 InstructionBuilder ib = new InstructionBuilder();
1849 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1851 // Put our Instruction in a list of Instructions
1852 InstructionsBuilder isb = new InstructionsBuilder();
1853 List<Instruction> instructions = new ArrayList<Instruction>();
1854 instructions.add(ib.build());
1855 isb.setInstruction(instructions);
1859 private static InstructionsBuilder createAppyActionInstruction33() {
1861 List<Action> actionList = new ArrayList<Action>();
1862 ActionBuilder ab = new ActionBuilder();
1864 SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
1865 setVlanCfiActionBuilder.setVlanCfi(new VlanCfi(2));
1866 ab.setAction(new SetVlanCfiActionCaseBuilder().setSetVlanCfiAction(setVlanCfiActionBuilder.build()).build());
1867 actionList.add(ab.build());
1869 // Create an Apply Action
1870 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1871 aab.setAction(actionList);
1873 // Wrap our Apply Action in an Instruction
1874 InstructionBuilder ib = new InstructionBuilder();
1875 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1877 // Put our Instruction in a list of Instructions
1878 InstructionsBuilder isb = new InstructionsBuilder();
1879 List<Instruction> instructions = new ArrayList<Instruction>();
1880 instructions.add(ib.build());
1881 isb.setInstruction(instructions);
1885 private static InstructionsBuilder createAppyActionInstruction34() {
1887 List<Action> actionList = new ArrayList<Action>();
1888 ActionBuilder ab = new ActionBuilder();
1890 SwPathActionBuilder swPathAction = new SwPathActionBuilder();
1891 ab.setAction(new SwPathActionCaseBuilder().setSwPathAction(swPathAction.build()).build());
1892 actionList.add(ab.build());
1894 // Create an Apply Action
1895 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1896 aab.setAction(actionList);
1898 // Wrap our Apply Action in an Instruction
1899 InstructionBuilder ib = new InstructionBuilder();
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 createAppyActionInstruction35() {
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();
1922 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
1923 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
1924 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
1925 EthernetMatchBuilder ethernetMatch1 = new EthernetMatchBuilder();
1926 EthernetDestinationBuilder ethDestBuilder = new EthernetDestinationBuilder();
1927 ethDestBuilder.setAddress(new MacAddress("00:00:00:00:00:02"));
1928 EthernetMatchBuilder ethernetMatch2 = new EthernetMatchBuilder();
1929 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
1930 ethTypeBuilder.setType(new EtherType(0x86ddL));
1932 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
1933 ethernetMatch1.setEthernetDestination(ethDestBuilder.build());
1934 ethernetMatch2.setEthernetType(ethTypeBuilder.build());
1935 setFieldBuilder.setEthernetMatch(ethernetMatch.build());
1936 setFieldBuilder1.setEthernetMatch(ethernetMatch1.build());
1937 setFieldBuilder2.setEthernetMatch(ethernetMatch2.build());
1938 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
1939 ab.setKey(new ActionKey(0));
1940 actionList.add(ab.build());
1942 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
1943 ab1.setKey(new ActionKey(1));
1944 actionList.add(ab1.build());
1946 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
1947 ab2.setKey(new ActionKey(2));
1948 actionList.add(ab2.build());
1950 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1951 aab.setAction(actionList);
1953 InstructionBuilder ib = new InstructionBuilder();
1954 ib.setKey(new InstructionKey(0));
1955 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1957 // Put our Instruction in a list of Instructions
1958 InstructionsBuilder isb = new InstructionsBuilder();
1959 List<Instruction> instructions = new ArrayList<Instruction>();
1960 instructions.add(ib.build());
1961 isb.setInstruction(instructions);
1965 private static InstructionsBuilder createAppyActionInstruction36() {
1967 List<Action> actionList = new ArrayList<Action>();
1968 ActionBuilder ab = new ActionBuilder();
1969 ActionBuilder ab1 = new ActionBuilder();
1971 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1972 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
1975 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
1976 VlanMatchBuilder vlanBuilder1 = new VlanMatchBuilder();
1977 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
1978 VlanId vlanId = new VlanId(10);
1979 VlanPcp vpcp = new VlanPcp((short) 3);
1980 vlanBuilder.setVlanPcp(vpcp);
1981 vlanBuilder1.setVlanId(vlanIdBuilder.setVlanId(vlanId).setVlanIdPresent(true).build());
1982 setFieldBuilder.setVlanMatch(vlanBuilder.build());
1983 setFieldBuilder1.setVlanMatch(vlanBuilder1.build());
1984 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
1985 ab.setKey(new ActionKey(0));
1986 actionList.add(ab.build());
1987 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
1988 ab1.setKey(new ActionKey(1));
1989 actionList.add(ab1.build());
1991 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1992 aab.setAction(actionList);
1994 InstructionBuilder ib = new InstructionBuilder();
1995 ib.setKey(new InstructionKey(0));
1996 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1998 // Put our Instruction in a list of Instructions
1999 InstructionsBuilder isb = new InstructionsBuilder();
2000 List<Instruction> instructions = new ArrayList<Instruction>();
2001 instructions.add(ib.build());
2002 isb.setInstruction(instructions);
2006 private static InstructionsBuilder createAppyActionInstruction37() {
2008 List<Action> actionList = new ArrayList<Action>();
2009 ActionBuilder ab = new ActionBuilder();
2010 ActionBuilder ab1 = new ActionBuilder();
2011 ActionBuilder ab2 = new ActionBuilder();
2013 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2014 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2015 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2017 IpMatchBuilder ipmatch = new IpMatchBuilder();
2018 IpMatchBuilder ipmatch1 = new IpMatchBuilder();
2019 IpMatchBuilder ipmatch2 = new IpMatchBuilder();
2020 Dscp dscp = new Dscp((short) 3);
2021 ipmatch.setIpDscp(dscp);
2022 ipmatch1.setIpEcn((short) 2);
2023 ipmatch2.setIpProtocol((short) 120);
2024 setFieldBuilder.setIpMatch(ipmatch.build());
2025 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2026 ab.setKey(new ActionKey(0));
2027 actionList.add(ab.build());
2029 setFieldBuilder1.setIpMatch(ipmatch1.build());
2030 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2031 ab1.setKey(new ActionKey(1));
2032 actionList.add(ab1.build());
2034 setFieldBuilder2.setIpMatch(ipmatch2.build());
2035 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2036 ab2.setKey(new ActionKey(2));
2037 actionList.add(ab2.build());
2039 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2040 aab.setAction(actionList);
2042 InstructionBuilder ib = new InstructionBuilder();
2043 ib.setKey(new InstructionKey(0));
2044 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2046 // Put our Instruction in a list of Instructions
2047 InstructionsBuilder isb = new InstructionsBuilder();
2048 List<Instruction> instructions = new ArrayList<Instruction>();
2049 instructions.add(ib.build());
2050 isb.setInstruction(instructions);
2054 private static InstructionsBuilder createAppyActionInstruction38() {
2056 List<Action> actionList = new ArrayList<Action>();
2057 ActionBuilder ab = new ActionBuilder();
2058 ActionBuilder ab1 = new ActionBuilder();
2060 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2061 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2063 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2064 Ipv4MatchBuilder ipv4Match1 = new Ipv4MatchBuilder();
2065 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.5210");
2066 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1");
2067 ipv4Match1.setIpv4Destination(dstip);
2068 ipv4Match.setIpv4Source(srcip);
2069 setFieldBuilder.setLayer3Match(ipv4Match.build());
2070 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2071 ab.setKey(new ActionKey(0));
2072 actionList.add(ab.build());
2074 setFieldBuilder1.setLayer3Match(ipv4Match1.build());
2075 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2076 ab1.setKey(new ActionKey(1));
2077 actionList.add(ab1.build());
2079 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2080 aab.setAction(actionList);
2082 InstructionBuilder ib = new InstructionBuilder();
2083 ib.setKey(new InstructionKey(0));
2084 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2086 // Put our Instruction in a list of Instructions
2087 InstructionsBuilder isb = new InstructionsBuilder();
2088 List<Instruction> instructions = new ArrayList<Instruction>();
2089 instructions.add(ib.build());
2090 isb.setInstruction(instructions);
2094 private static InstructionsBuilder createAppyActionInstruction39() {
2096 List<Action> actionList = new ArrayList<Action>();
2097 ActionBuilder ab = new ActionBuilder();
2098 ActionBuilder ab1 = new ActionBuilder();
2100 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2101 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2104 PortNumber tcpsrcport = new PortNumber(1213);
2105 PortNumber tcpdstport = new PortNumber(646);
2106 TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
2107 TcpMatchBuilder tcpmatch1 = new TcpMatchBuilder();
2108 tcpmatch.setTcpSourcePort(tcpsrcport);
2109 tcpmatch1.setTcpDestinationPort(tcpdstport);
2110 setFieldBuilder.setLayer4Match(tcpmatch.build());
2111 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2112 ab.setKey(new ActionKey(0));
2113 actionList.add(ab.build());
2115 setFieldBuilder1.setLayer4Match(tcpmatch1.build());
2116 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2117 ab1.setKey(new ActionKey(1));
2118 actionList.add(ab.build());
2120 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2121 aab.setAction(actionList);
2123 InstructionBuilder ib = new InstructionBuilder();
2124 ib.setKey(new InstructionKey(0));
2125 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2127 // Put our Instruction in a list of Instructions
2128 InstructionsBuilder isb = new InstructionsBuilder();
2129 List<Instruction> instructions = new ArrayList<Instruction>();
2130 instructions.add(ib.build());
2131 isb.setInstruction(instructions);
2135 private static InstructionsBuilder createAppyActionInstruction40() {
2137 List<Action> actionList = new ArrayList<Action>();
2138 ActionBuilder ab = new ActionBuilder();
2139 ActionBuilder ab1 = new ActionBuilder();
2141 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2142 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2145 PortNumber udpsrcport = new PortNumber(1325);
2146 PortNumber udpdstport = new PortNumber(42);
2147 UdpMatchBuilder udpmatch = new UdpMatchBuilder();
2148 UdpMatchBuilder udpmatch1 = new UdpMatchBuilder();
2149 udpmatch.setUdpDestinationPort(udpdstport);
2150 udpmatch1.setUdpSourcePort(udpsrcport);
2151 setFieldBuilder.setLayer4Match(udpmatch.build());
2152 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2153 ab.setKey(new ActionKey(0));
2154 actionList.add(ab.build());
2156 setFieldBuilder1.setLayer4Match(udpmatch1.build());
2157 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2158 ab1.setKey(new ActionKey(1));
2159 actionList.add(ab1.build());
2161 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2162 aab.setAction(actionList);
2164 InstructionBuilder ib = new InstructionBuilder();
2165 ib.setKey(new InstructionKey(0));
2166 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2168 // Put our Instruction in a list of Instructions
2169 InstructionsBuilder isb = new InstructionsBuilder();
2170 List<Instruction> instructions = new ArrayList<Instruction>();
2171 instructions.add(ib.build());
2172 isb.setInstruction(instructions);
2176 private static InstructionsBuilder createAppyActionInstruction41() {
2178 List<Action> actionList = new ArrayList<Action>();
2179 ActionBuilder ab = new ActionBuilder();
2180 ActionBuilder ab1 = new ActionBuilder();
2182 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2183 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2186 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
2187 SctpMatchBuilder sctpmatch1 = new SctpMatchBuilder();
2188 PortNumber srcport = new PortNumber(1435);
2189 PortNumber dstport = new PortNumber(22);
2190 sctpmatch.setSctpSourcePort(srcport);
2191 sctpmatch1.setSctpDestinationPort(dstport);
2192 setFieldBuilder.setLayer4Match(sctpmatch.build());
2193 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2194 ab.setKey(new ActionKey(0));
2195 actionList.add(ab.build());
2197 setFieldBuilder1.setLayer4Match(sctpmatch1.build());
2198 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2199 ab1.setKey(new ActionKey(1));
2200 actionList.add(ab1.build());
2202 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2203 aab.setAction(actionList);
2205 InstructionBuilder ib = new InstructionBuilder();
2206 ib.setKey(new InstructionKey(0));
2207 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2209 // Put our Instruction in a list of Instructions
2210 InstructionsBuilder isb = new InstructionsBuilder();
2211 List<Instruction> instructions = new ArrayList<Instruction>();
2212 instructions.add(ib.build());
2213 isb.setInstruction(instructions);
2217 private static InstructionsBuilder createAppyActionInstruction42() {
2219 List<Action> actionList = new ArrayList<Action>();
2220 ActionBuilder ab = new ActionBuilder();
2221 ActionBuilder ab1 = new ActionBuilder();
2222 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2223 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2226 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
2227 Icmpv4MatchBuilder icmpv4match1 = new Icmpv4MatchBuilder();
2228 icmpv4match.setIcmpv4Type((short) 8);
2229 icmpv4match1.setIcmpv4Code((short) 0);
2230 setFieldBuilder.setIcmpv4Match(icmpv4match.build());
2231 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2232 ab.setKey(new ActionKey(0));
2233 actionList.add(ab.build());
2235 setFieldBuilder1.setIcmpv4Match(icmpv4match1.build());
2236 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2237 ab1.setKey(new ActionKey(1));
2238 actionList.add(ab1.build());
2240 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2241 aab.setAction(actionList);
2243 InstructionBuilder ib = new InstructionBuilder();
2244 ib.setKey(new InstructionKey(0));
2245 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2247 // Put our Instruction in a list of Instructions
2248 InstructionsBuilder isb = new InstructionsBuilder();
2249 List<Instruction> instructions = new ArrayList<Instruction>();
2250 instructions.add(ib.build());
2251 isb.setInstruction(instructions);
2255 private static InstructionsBuilder createAppyActionInstruction43() {
2257 List<Action> actionList = new ArrayList<Action>();
2258 ActionBuilder ab = new ActionBuilder();
2259 ActionBuilder ab1 = new ActionBuilder();
2260 ActionBuilder ab2 = new ActionBuilder();
2261 ActionBuilder ab3 = new ActionBuilder();
2262 ActionBuilder ab4 = new ActionBuilder();
2264 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2265 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2266 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2267 SetFieldBuilder setFieldBuilder3 = new SetFieldBuilder();
2268 SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder();
2270 // setting the values of ARP
2271 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2272 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2273 Ipv4Prefix dstiparp = new Ipv4Prefix("200.71.9.52");
2274 Ipv4Prefix srciparp = new Ipv4Prefix("100.1.1.1");
2275 // create ARP match action
2276 ArpMatchBuilder arpmatch = new ArpMatchBuilder();
2277 ArpMatchBuilder arpmatch1 = new ArpMatchBuilder();
2278 ArpMatchBuilder arpmatch2 = new ArpMatchBuilder();
2279 ArpMatchBuilder arpmatch3 = new ArpMatchBuilder();
2280 ArpMatchBuilder arpmatch4 = new ArpMatchBuilder();
2281 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2282 arpsrc.setAddress(macsrc);
2283 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2284 arpdst.setAddress(macdest);
2285 arpmatch.setArpOp(2);
2286 arpmatch1.setArpSourceHardwareAddress(arpsrc.build());
2287 arpmatch2.setArpTargetHardwareAddress(arpdst.build());
2288 arpmatch3.setArpSourceTransportAddress(srciparp);
2289 arpmatch4.setArpTargetTransportAddress(dstiparp);
2290 setFieldBuilder.setLayer3Match(arpmatch.build());
2291 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2292 ab.setKey(new ActionKey(0));
2293 actionList.add(ab.build());
2295 setFieldBuilder1.setLayer3Match(arpmatch1.build());
2296 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2297 ab1.setKey(new ActionKey(1));
2298 actionList.add(ab1.build());
2300 setFieldBuilder2.setLayer3Match(arpmatch2.build());
2301 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2302 ab2.setKey(new ActionKey(2));
2303 actionList.add(ab2.build());
2305 setFieldBuilder3.setLayer3Match(arpmatch3.build());
2306 ab3.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2307 ab3.setKey(new ActionKey(3));
2308 actionList.add(ab3.build());
2310 setFieldBuilder4.setLayer3Match(arpmatch4.build());
2311 ab4.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2312 ab4.setKey(new ActionKey(4));
2313 actionList.add(ab4.build());
2315 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2316 aab.setAction(actionList);
2318 InstructionBuilder ib = new InstructionBuilder();
2319 ib.setKey(new InstructionKey(0));
2320 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2322 // Put our Instruction in a list of Instructions
2323 InstructionsBuilder isb = new InstructionsBuilder();
2324 List<Instruction> instructions = new ArrayList<Instruction>();
2325 instructions.add(ib.build());
2326 isb.setInstruction(instructions);
2330 private static InstructionsBuilder createAppyActionInstruction44() {
2332 List<Action> actionLists = new ArrayList<Action>();
2333 ActionBuilder ab = new ActionBuilder();
2334 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2335 ActionBuilder ab1 = new ActionBuilder();
2336 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2338 * ActionBuilder ab2 = new ActionBuilder(); SetFieldBuilder
2339 * setFieldBuilder2 = new SetFieldBuilder(); ActionBuilder ab3 = new
2340 * ActionBuilder(); SetFieldBuilder setFieldBuilder3 = new
2341 * SetFieldBuilder(); ActionBuilder ab4 = new ActionBuilder();
2342 * SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder();
2344 ActionBuilder ab5 = new ActionBuilder();
2345 SetFieldBuilder setFieldBuilder5 = new SetFieldBuilder();
2346 ActionBuilder ab6 = new ActionBuilder();
2347 SetFieldBuilder setFieldBuilder6 = new SetFieldBuilder();
2350 Ipv6MatchBuilder ipv6Builder = new Ipv6MatchBuilder();
2351 Ipv6MatchBuilder ipv6Builder1 = new Ipv6MatchBuilder();
2352 // Ipv6MatchBuilder ipv6Builder2 = new Ipv6MatchBuilder();
2353 // Ipv6MatchBuilder ipv6Builder3 = new Ipv6MatchBuilder();
2354 // Ipv6MatchBuilder ipv6Builder4 = new Ipv6MatchBuilder();
2355 Ipv6MatchBuilder ipv6Builder5 = new Ipv6MatchBuilder();
2356 Ipv6MatchBuilder ipv6Builder6 = new Ipv6MatchBuilder();
2358 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2");
2359 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1");
2360 // Ipv6Address ndtarget = new
2361 // Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
2362 // MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
2363 // MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
2364 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2365 nextheader.setIpv6Exthdr(58);
2366 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2367 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2368 ipv6label.setIpv6Flabel(label);
2370 ipv6Builder.setIpv6Source(srcip6);
2371 ipv6Builder1.setIpv6Destination(dstip6);
2372 // ipv6Builder2.setIpv6NdTarget(ndtarget);
2373 // ipv6Builder3.setIpv6NdSll(ndsll);
2374 // ipv6Builder4.setIpv6NdTll(ndtll);
2375 ipv6Builder5.setIpv6ExtHeader(nextheader.build());
2376 ipv6Builder6.setIpv6Label(ipv6label.build());
2378 setFieldBuilder.setLayer3Match(ipv6Builder.build());
2379 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2380 ab.setKey(new ActionKey(0));
2381 actionLists.add(ab.build());
2383 setFieldBuilder1.setLayer3Match(ipv6Builder1.build());
2384 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2385 ab1.setKey(new ActionKey(1));
2386 actionLists.add(ab1.build());
2389 * setFieldBuilder2.setLayer3Match(ipv6Builder2.build());
2391 * SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2392 * ab2.setKey(new ActionKey(2)); actionLists.add(ab2.build());
2394 * setFieldBuilder3.setLayer3Match(ipv6Builder3.build());
2396 * SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2397 * ab3.setKey(new ActionKey(3)); actionLists.add(ab3.build());
2399 * setFieldBuilder4.setLayer3Match(ipv6Builder4.build());
2401 * SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2402 * ab4.setKey(new ActionKey(4)); actionLists.add(ab4.build());
2404 setFieldBuilder5.setLayer3Match(ipv6Builder5.build());
2405 ab5.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder5.build()).build());
2406 ab5.setKey(new ActionKey(5));
2407 actionLists.add(ab5.build());
2409 setFieldBuilder6.setLayer3Match(ipv6Builder6.build());
2410 ab6.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder6.build()).build());
2411 ab6.setKey(new ActionKey(6));
2412 actionLists.add(ab6.build());
2414 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2415 aab.setAction(actionLists);
2417 InstructionBuilder ib = new InstructionBuilder();
2418 ib.setKey(new InstructionKey(0));
2419 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2421 // Put our Instruction in a list of Instructions
2422 InstructionsBuilder isb = new InstructionsBuilder();
2423 List<Instruction> instructions = new ArrayList<Instruction>();
2424 instructions.add(ib.build());
2425 isb.setInstruction(instructions);
2429 private static InstructionsBuilder createAppyActionInstruction45() {
2431 List<Action> actionList = new ArrayList<Action>();
2432 ActionBuilder ab = new ActionBuilder();
2433 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2434 ActionBuilder ab1 = new ActionBuilder();
2435 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2438 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
2439 Icmpv6MatchBuilder icmpv6match1 = new Icmpv6MatchBuilder();
2440 icmpv6match.setIcmpv6Type((short) 135);
2441 icmpv6match1.setIcmpv6Code((short) 0);
2442 setFieldBuilder.setIcmpv6Match(icmpv6match.build());
2443 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2444 ab.setKey(new ActionKey(0));
2445 actionList.add(ab.build());
2447 setFieldBuilder1.setIcmpv6Match(icmpv6match1.build());
2448 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2449 ab1.setKey(new ActionKey(1));
2450 actionList.add(ab1.build());
2452 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2453 aab.setAction(actionList);
2455 InstructionBuilder ib = new InstructionBuilder();
2456 ib.setKey(new InstructionKey(0));
2457 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2459 // Put our Instruction in a list of Instructions
2460 InstructionsBuilder isb = new InstructionsBuilder();
2461 List<Instruction> instructions = new ArrayList<Instruction>();
2462 instructions.add(ib.build());
2463 isb.setInstruction(instructions);
2467 private static InstructionsBuilder createAppyActionInstruction46() {
2469 List<Action> actionList = new ArrayList<Action>();
2470 ActionBuilder ab = new ActionBuilder();
2471 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2472 ActionBuilder ab1 = new ActionBuilder();
2473 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2474 ActionBuilder ab2 = new ActionBuilder();
2475 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2478 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2479 ProtocolMatchFieldsBuilder protomatch1 = new ProtocolMatchFieldsBuilder();
2480 ProtocolMatchFieldsBuilder protomatch2 = new ProtocolMatchFieldsBuilder();
2481 protomatch.setMplsLabel((long) 36008);
2482 protomatch1.setMplsTc((short) 4);
2483 protomatch2.setMplsBos((short) 1);
2484 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2485 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2486 ab.setKey(new ActionKey(0));
2487 actionList.add(ab.build());
2489 setFieldBuilder1.setProtocolMatchFields(protomatch1.build());
2490 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2491 ab1.setKey(new ActionKey(1));
2492 actionList.add(ab1.build());
2494 setFieldBuilder2.setProtocolMatchFields(protomatch2.build());
2495 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2496 ab2.setKey(new ActionKey(2));
2497 actionList.add(ab2.build());
2499 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2500 aab.setAction(actionList);
2502 InstructionBuilder ib = new InstructionBuilder();
2503 ib.setKey(new InstructionKey(0));
2504 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2506 // Put our Instruction in a list of Instructions
2507 InstructionsBuilder isb = new InstructionsBuilder();
2508 List<Instruction> instructions = new ArrayList<Instruction>();
2509 instructions.add(ib.build());
2510 isb.setInstruction(instructions);
2514 private static InstructionsBuilder createAppyActionInstruction47() {
2516 List<Action> actionList = new ArrayList<Action>();
2517 ActionBuilder ab = new ActionBuilder();
2518 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2520 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2521 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask((new BigInteger(new byte[] { 0, 1, 0, 0 }).longValue())).build());
2522 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2523 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2524 actionList.add(ab.build());
2526 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2527 aab.setAction(actionList);
2529 InstructionBuilder ib = new InstructionBuilder();
2530 ib.setKey(new InstructionKey(0));
2531 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2533 // Put our Instruction in a list of Instructions
2534 InstructionsBuilder isb = new InstructionsBuilder();
2535 List<Instruction> instructions = new ArrayList<Instruction>();
2536 instructions.add(ib.build());
2537 isb.setInstruction(instructions);
2541 private static InstructionsBuilder createAppyActionInstruction48() {
2543 List<Action> actionList = new ArrayList<Action>();
2544 ActionBuilder ab = new ActionBuilder();
2545 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2547 TunnelBuilder tunnel = new TunnelBuilder();
2548 tunnel.setTunnelId(BigInteger.valueOf(10668));
2549 setFieldBuilder.setTunnel(tunnel.build());
2550 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2551 actionList.add(ab.build());
2553 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2554 aab.setAction(actionList);
2556 InstructionBuilder ib = new InstructionBuilder();
2557 ib.setKey(new InstructionKey(0));
2558 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2560 // Put our Instruction in a list of Instructions
2561 InstructionsBuilder isb = new InstructionsBuilder();
2562 List<Instruction> instructions = new ArrayList<Instruction>();
2563 instructions.add(ib.build());
2564 isb.setInstruction(instructions);
2568 private static MatchBuilder createLLDPMatch() {
2569 MatchBuilder match = new MatchBuilder();
2570 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2571 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2572 ethTypeBuilder.setType(new EtherType(0x88ccL));
2573 eth.setEthernetType(ethTypeBuilder.build());
2574 match.setEthernetMatch(eth.build());
2581 private static MatchBuilder createMatch1() {
2582 MatchBuilder match = new MatchBuilder();
2583 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2584 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2585 ipv4Match.setIpv4Destination(prefix);
2586 Ipv4Match i4m = ipv4Match.build();
2587 match.setLayer3Match(i4m);
2589 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2590 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2591 ethTypeBuilder.setType(new EtherType(0x0800L));
2592 eth.setEthernetType(ethTypeBuilder.build());
2593 match.setEthernetMatch(eth.build());
2600 private static MatchBuilder createIPv4DstMatch() {
2601 MatchBuilder match = new MatchBuilder();
2602 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2603 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2604 ipv4Match.setIpv4Destination(prefix);
2605 Ipv4Match i4m = ipv4Match.build();
2606 match.setLayer3Match(i4m);
2614 private static MatchBuilder createIPv4SrcMatch() {
2615 MatchBuilder match = new MatchBuilder();
2616 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2617 Ipv4Prefix prefix = new Ipv4Prefix("10.20.30.40/24");
2618 ipv4Match.setIpv4Source(prefix);
2619 Ipv4Match i4m = ipv4Match.build();
2620 match.setLayer3Match(i4m);
2622 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2623 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2624 ethTypeBuilder.setType(new EtherType(0x0800L));
2625 eth.setEthernetType(ethTypeBuilder.build());
2626 match.setEthernetMatch(eth.build());
2633 private static MatchBuilder createMatch2() {
2634 MatchBuilder match = new MatchBuilder();
2635 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2636 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1");
2637 ipv4Match.setIpv4Source(prefix);
2638 Ipv4Match i4m = ipv4Match.build();
2639 match.setLayer3Match(i4m);
2641 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2642 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2643 ethTypeBuilder.setType(new EtherType(0x0800L));
2644 eth.setEthernetType(ethTypeBuilder.build());
2645 match.setEthernetMatch(eth.build());
2652 private static MatchBuilder createMatch3() {
2653 MatchBuilder match = new MatchBuilder();
2654 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
2655 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
2656 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
2657 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
2658 match.setEthernetMatch(ethernetMatch.build());
2666 private static MatchBuilder createICMPv6Match1() {
2668 MatchBuilder match = new MatchBuilder();
2669 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2670 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2671 ethTypeBuilder.setType(new EtherType(0x86ddL));
2672 eth.setEthernetType(ethTypeBuilder.build());
2673 match.setEthernetMatch(eth.build());
2675 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2676 ipmatch.setIpProtocol((short) 256);
2677 match.setIpMatch(ipmatch.build());
2679 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2681 icmpv6match.setIcmpv6Type((short) 135);
2682 icmpv6match.setIcmpv6Code((short) 1);
2683 match.setIcmpv6Match(icmpv6match.build());
2688 private static MatchBuilder createMatch33() {
2690 MatchBuilder match = new MatchBuilder();
2691 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2692 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.10");
2693 ipv4Match.setIpv4Source(prefix);
2694 Ipv4Match i4m = ipv4Match.build();
2695 match.setLayer3Match(i4m);
2697 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2698 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2699 ethTypeBuilder.setType(new EtherType(0xfffeL));
2700 eth.setEthernetType(ethTypeBuilder.build());
2701 match.setEthernetMatch(eth.build());
2705 private static MatchBuilder createInphyportMatch(NodeId nodeId) {
2706 MatchBuilder match = new MatchBuilder();
2707 match.setInPort(new NodeConnectorId(nodeId + ":202"));
2708 match.setInPhyPort(new NodeConnectorId(nodeId + ":10122"));
2712 private static MatchBuilder createEthernetMatch() {
2713 MatchBuilder match = new MatchBuilder();
2715 byte[] mask1 = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2716 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2718 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
2720 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2721 EtherType type = new EtherType(0x0800L);
2722 ethmatch.setEthernetType(ethtype.setType(type).build());
2724 EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet
2727 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2728 ethdest.setAddress(macdest);
2729 ethdest.setMask(new MacAddress("ff:ff:ff:00:00:00"));
2731 ethmatch.setEthernetDestination(ethdest.build());
2733 EthernetSourceBuilder ethsrc = new EthernetSourceBuilder();
2734 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2735 ethsrc.setAddress(macsrc);
2736 ethsrc.setMask(new MacAddress("ff:ff:00:00:00:00"));
2738 ethmatch.setEthernetSource(ethsrc.build());
2739 match.setEthernetMatch(ethmatch.build());
2748 private static MatchBuilder createVlanMatch() {
2749 MatchBuilder match = new MatchBuilder();
2750 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder(); // vlan match
2751 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
2752 VlanId vlanId = new VlanId(10);
2753 VlanPcp vpcp = new VlanPcp((short) 3);
2754 vlanBuilder.setVlanPcp(vpcp);
2755 vlanIdBuilder.setVlanId(vlanId);
2756 vlanIdBuilder.setVlanIdPresent(true);
2757 vlanBuilder.setVlanId(vlanIdBuilder.build());
2758 match.setVlanMatch(vlanBuilder.build());
2765 private static MatchBuilder createArpMatch() {
2766 MatchBuilder match = new MatchBuilder();
2768 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2769 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2770 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2772 byte[] mask = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2773 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2775 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2776 EtherType type = new EtherType(0x0806L);
2777 ethmatch.setEthernetType(ethtype.setType(type).build());
2779 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
2780 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2782 ArpMatchBuilder arpmatch = new ArpMatchBuilder(); // arp match
2783 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2784 arpsrc.setAddress(macsrc);
2785 arpsrc.setMask(new MacAddress("ff:ff:ff:00:00:00"));
2786 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2787 arpdst.setAddress(macdest);
2788 arpdst.setMask(new MacAddress("ff:ff:00:00:00:00"));
2789 arpmatch.setArpOp(2);
2790 arpmatch.setArpSourceHardwareAddress(arpsrc.build());
2791 arpmatch.setArpTargetHardwareAddress(arpdst.build());
2792 arpmatch.setArpSourceTransportAddress(srcip);
2793 arpmatch.setArpTargetTransportAddress(dstip);
2795 match.setEthernetMatch(ethmatch.build());
2796 match.setLayer3Match(arpmatch.build());
2804 private static MatchBuilder createIPMatch() {
2805 MatchBuilder match = new MatchBuilder();
2806 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2807 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2808 EtherType type = new EtherType(0x0800L);
2809 ethmatch.setEthernetType(ethtype.setType(type).build());
2810 match.setEthernetMatch(ethmatch.build());
2812 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2813 ipmatch.setIpProtocol((short) 1);
2814 Dscp dscp = new Dscp((short) 3);
2815 ipmatch.setIpDscp(dscp);
2816 ipmatch.setIpEcn((short) 2);
2817 match.setIpMatch(ipmatch.build());
2824 private static MatchBuilder createL3IPv4Match() {
2825 MatchBuilder match = new MatchBuilder();
2827 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2828 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2829 ethTypeBuilder.setType(new EtherType(0x0800L));
2830 eth.setEthernetType(ethTypeBuilder.build());
2831 match.setEthernetMatch(eth.build());
2833 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2834 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
2835 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2836 Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
2837 ipv4match.setIpv4Destination(dstip);
2838 ipv4match.setIpv4Source(srcip);
2839 match.setLayer3Match(ipv4match.build());
2848 private static MatchBuilder createL3IPv6Match() {
2849 MatchBuilder match = new MatchBuilder();
2851 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2852 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2853 ethTypeBuilder.setType(new EtherType(0x86ddL));
2854 eth.setEthernetType(ethTypeBuilder.build());
2855 match.setEthernetMatch(eth.build());
2857 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2/64");
2858 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1/56");
2859 Ipv6Address ndtarget = new Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
2860 MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
2861 MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
2862 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2863 nextheader.setIpv6Exthdr(58);
2864 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2865 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2866 ipv6label.setIpv6Flabel(label);
2867 ipv6label.setFlabelMask(new Ipv6FlowLabel(1L));
2869 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2871 icmpv6match.setIcmpv6Type((short) 135);
2872 icmpv6match.setIcmpv6Code((short) 0);
2873 match.setIcmpv6Match(icmpv6match.build());
2875 Ipv6MatchBuilder ipv6match = new Ipv6MatchBuilder();
2876 // ipv6match.setIpv6Source(srcip6);
2877 // ipv6match.setIpv6Destination(dstip6);
2878 // ipv6match.setIpv6ExtHeader(nextheader.build());
2879 ipv6match.setIpv6NdSll(ndsll);
2880 ipv6match.setIpv6NdTll(ndtll);
2881 // ipv6match.setIpv6NdTarget(ndtarget);
2882 ipv6match.setIpv6Label(ipv6label.build());
2884 match.setLayer3Match(ipv6match.build());
2893 private static MatchBuilder createICMPv4Match() {
2894 MatchBuilder match = new MatchBuilder();
2895 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2896 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2897 ethTypeBuilder.setType(new EtherType(0x0800L));
2898 eth.setEthernetType(ethTypeBuilder.build());
2899 match.setEthernetMatch(eth.build());
2901 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2902 ipmatch.setIpProtocol((short) 1);
2903 match.setIpMatch(ipmatch.build());
2905 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder(); // icmpv4
2907 icmpv4match.setIcmpv4Type((short) 8);
2908 icmpv4match.setIcmpv4Code((short) 0);
2909 match.setIcmpv4Match(icmpv4match.build());
2916 private static MatchBuilder createICMPv6Match() {
2918 MatchBuilder match = new MatchBuilder();
2919 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2920 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2921 ethTypeBuilder.setType(new EtherType(0x86ddL));
2922 eth.setEthernetType(ethTypeBuilder.build());
2923 match.setEthernetMatch(eth.build());
2925 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2926 ipmatch.setIpProtocol((short) 58);
2927 match.setIpMatch(ipmatch.build());
2929 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2931 icmpv6match.setIcmpv6Type((short) 135);
2932 icmpv6match.setIcmpv6Code((short) 1);
2933 match.setIcmpv6Match(icmpv6match.build());
2941 private static MatchBuilder createToSMatch() {
2942 MatchBuilder match = new MatchBuilder();
2943 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2944 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2945 EtherType type = new EtherType(0x0800L);
2946 ethmatch.setEthernetType(ethtype.setType(type).build());
2947 match.setEthernetMatch(ethmatch.build());
2949 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2950 ipmatch.setIpProtocol((short) 6);
2951 Dscp dscp = new Dscp((short) 8);
2952 ipmatch.setIpDscp(dscp);
2953 match.setIpMatch(ipmatch.build());
2961 private static MatchBuilder createL4TCPMatch() {
2962 MatchBuilder match = new MatchBuilder();
2964 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2965 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2966 ethTypeBuilder.setType(new EtherType(0x0800L));
2967 eth.setEthernetType(ethTypeBuilder.build());
2968 match.setEthernetMatch(eth.build());
2970 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2971 ipmatch.setIpProtocol((short) 6);
2972 match.setIpMatch(ipmatch.build());
2974 PortNumber srcport = new PortNumber(1213);
2975 PortNumber dstport = new PortNumber(646);
2976 TcpMatchBuilder tcpmatch = new TcpMatchBuilder(); // tcp match
2977 tcpmatch.setTcpSourcePort(srcport);
2978 tcpmatch.setTcpDestinationPort(dstport);
2979 match.setLayer4Match(tcpmatch.build());
2987 private static MatchBuilder createL4UDPMatch() {
2988 MatchBuilder match = new MatchBuilder();
2990 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2991 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2992 ethTypeBuilder.setType(new EtherType(0x0800L));
2993 eth.setEthernetType(ethTypeBuilder.build());
2994 match.setEthernetMatch(eth.build());
2996 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2997 ipmatch.setIpProtocol((short) 17);
2998 match.setIpMatch(ipmatch.build());
3000 PortNumber srcport = new PortNumber(1325);
3001 PortNumber dstport = new PortNumber(42);
3002 UdpMatchBuilder udpmatch = new UdpMatchBuilder(); // udp match
3003 udpmatch.setUdpDestinationPort(dstport);
3004 udpmatch.setUdpSourcePort(srcport);
3005 match.setLayer4Match(udpmatch.build());
3013 private static MatchBuilder createL4SCTPMatch() {
3014 MatchBuilder match = new MatchBuilder();
3016 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3017 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3018 ethTypeBuilder.setType(new EtherType(0x0800L));
3019 eth.setEthernetType(ethTypeBuilder.build());
3020 match.setEthernetMatch(eth.build());
3022 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3023 ipmatch.setIpProtocol((short) 132);
3024 match.setIpMatch(ipmatch.build());
3026 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
3027 PortNumber srcport = new PortNumber(1435);
3028 PortNumber dstport = new PortNumber(22);
3029 sctpmatch.setSctpSourcePort(srcport);
3030 sctpmatch.setSctpDestinationPort(dstport);
3031 match.setLayer4Match(sctpmatch.build());
3039 private static MatchBuilder createMetadataMatch() {
3040 MatchBuilder match = new MatchBuilder();
3041 byte[] metamask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
3042 MetadataBuilder metadata = new MetadataBuilder(); // metadata match
3043 metadata.setMetadata(BigInteger.valueOf(500L));
3044 metadata.setMetadataMask(new BigInteger(metamask));
3045 match.setMetadata(metadata.build());
3053 private static MatchBuilder createMplsMatch() {
3054 MatchBuilder match = new MatchBuilder();
3056 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3057 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3058 ethTypeBuilder.setType(new EtherType(0x8847L));
3059 eth.setEthernetType(ethTypeBuilder.build());
3060 match.setEthernetMatch(eth.build());
3062 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3064 protomatch.setMplsLabel((long) 36008);
3065 protomatch.setMplsTc((short) 4);
3066 protomatch.setMplsBos((short) 1);
3067 match.setProtocolMatchFields(protomatch.build());
3076 private static MatchBuilder createPbbMatch() {
3077 MatchBuilder match = new MatchBuilder();
3079 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3080 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3081 ethTypeBuilder.setType(new EtherType(0x88E7L));
3082 eth.setEthernetType(ethTypeBuilder.build());
3083 match.setEthernetMatch(eth.build());
3085 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3087 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new BigInteger(new byte[] { 0, 1, 0, 0 }).longValue()).build());
3088 match.setProtocolMatchFields(protomatch.build());
3097 private static MatchBuilder createTunnelIDMatch() {
3098 MatchBuilder match = new MatchBuilder();
3099 TunnelBuilder tunnel = new TunnelBuilder(); // tunnel id match
3100 tunnel.setTunnelId(BigInteger.valueOf(10668));
3101 byte[] mask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
3102 tunnel.setTunnelMask(new BigInteger(mask));
3103 match.setTunnel(tunnel.build());
3108 public void _removeMDFlow(CommandInterpreter ci) {
3109 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
3110 NodeBuilder tn = createTestNode(ci.nextArgument());
3111 String flowtype = ci.nextArgument();
3113 if (flowtype.equals("fTM")) {
3114 tf = createtablemiss(tn, flowtype, ci.nextArgument());
3116 tf = createTestFlow(tn, flowtype, ci.nextArgument());
3118 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class).child(Node.class, tn.getKey())
3119 .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf.getTableId()))
3120 .child(Flow.class, tf.getKey()).build();
3121 modification.removeConfigurationData(path1);
3122 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
3124 RpcResult<TransactionStatus> result = commitFuture.get();
3125 TransactionStatus status = result.getResult();
3126 ci.println("Status of Flow Data Loaded Transaction: " + status);
3128 } catch (InterruptedException e) {
3129 LOG.error(e.getMessage(), e);
3130 } catch (ExecutionException e) {
3131 LOG.error(e.getMessage(), e);
3136 * @param ci arguments: switchId flowType tableNum
3139 * e.g.: addMDFlow openflow:1 f1 42
3142 public void _addMDFlow(CommandInterpreter ci) {
3143 NodeBuilder tn = createTestNode(ci.nextArgument());
3144 String flowtype = ci.nextArgument();
3146 if (flowtype.equals("fTM")) {
3147 tf = createtablemiss(tn, flowtype, ci.nextArgument());
3149 tf = createTestFlow(tn, flowtype, ci.nextArgument());
3151 writeFlow(ci, tf, tn);
3154 private void writeFlow(CommandInterpreter ci, FlowBuilder flow, NodeBuilder nodeBuilder) {
3155 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
3156 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class)
3157 .child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
3158 .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.getKey()).build();
3159 modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
3160 modification.putConfigurationData(path1, flow.build());
3161 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
3163 RpcResult<TransactionStatus> result = commitFuture.get();
3164 TransactionStatus status = result.getResult();
3165 ci.println("Status of Flow Data Loaded Transaction: " + status);
3167 } catch (InterruptedException e) {
3168 LOG.error(e.getMessage(), e);
3169 } catch (ExecutionException e) {
3170 LOG.error(e.getMessage(), e);
3174 public void _modifyMDFlow(CommandInterpreter ci) {
3175 NodeBuilder tn = createTestNode(ci.nextArgument());
3176 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
3177 tf.setFlowName(updatedFlowName);
3178 writeFlow(ci, tf, tn);
3179 tf.setFlowName(originalFlowName);
3180 writeFlow(ci, tf, tn);
3183 private static NodeRef createNodeRef(String string) {
3184 NodeKey key = new NodeKey(new NodeId(string));
3185 InstanceIdentifier<Node> path = InstanceIdentifier.builder().node(Nodes.class).node(Node.class, key)
3188 return new NodeRef(path);
3192 public String getHelp() {