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) {
284 flow.setMatch(createMatch1().build());
285 flow.setInstructions(createDecNwTtlInstructions().build());
289 flow.setMatch(createMatch2().build());
290 flow.setInstructions(createDropInstructions().build());
294 flow.setMatch(createMatch3().build());
295 flow.setInstructions(createDropInstructions().build());
299 flow.setMatch(createEthernetMatch().build());
300 flow.setInstructions(createDropInstructions().build());
304 flow.setMatch(createMatch1().build());
305 flow.setInstructions(createAppyActionInstruction().build());
309 flow.setMatch(createMatch1().build());
310 flow.setInstructions(createGotoTableInstructions().build());
314 flow.setMatch(createMatch1().build());
315 flow.setInstructions(createMeterInstructions().build());
319 flow.setMatch(createMatch1().build());
320 flow.setInstructions(createAppyActionInstruction1().build());
324 flow.setMatch(createMatch1().build());
325 flow.setInstructions(createAppyActionInstruction2().build());
329 flow.setMatch(createMatch1().build());
330 flow.setInstructions(createAppyActionInstruction3().build());
334 flow.setMatch(createMatch1().build());
335 flow.setInstructions(createAppyActionInstruction4().build());
339 flow.setMatch(createMatch1().build());
340 flow.setInstructions(createAppyActionInstruction5().build());
344 flow.setMatch(createMatch1().build());
345 flow.setInstructions(createAppyActionInstruction6().build());
349 flow.setMatch(createMatch1().build());
350 flow.setInstructions(createAppyActionInstruction7().build());
354 flow.setMatch(createMatch1().build());
355 flow.setInstructions(createAppyActionInstruction8().build());
359 flow.setMatch(createMatch1().build());
360 flow.setInstructions(createAppyActionInstruction9().build());
364 flow.setMatch(createMatch1().build());
365 flow.setInstructions(createAppyActionInstruction10().build());
369 flow.setMatch(createMatch1().build());
370 flow.setInstructions(createAppyActionInstruction11().build());
374 flow.setMatch(createMatch1().build());
375 flow.setInstructions(createAppyActionInstruction12().build());
379 flow.setMatch(createMatch1().build());
380 flow.setInstructions(createAppyActionInstruction13().build());
384 flow.setMatch(createMatch1().build());
385 flow.setInstructions(createAppyActionInstruction14().build());
389 flow.setMatch(createMatch1().build());
390 flow.setInstructions(createAppyActionInstruction15().build());
394 // f23 can be used as test-case for generating error notification
395 // if the particular group is not configured - tested
396 flow.setMatch(createMatch1().build());
397 flow.setInstructions(createAppyActionInstruction16().build());
401 flow.setMatch(createMatch1().build());
402 flow.setInstructions(createAppyActionInstruction17().build());
406 flow.setMatch(createMatch1().build());
407 flow.setInstructions(createAppyActionInstruction18().build());
411 flow.setMatch(createMatch1().build());
412 flow.setInstructions(createAppyActionInstruction19().build());
416 flow.setMatch(createMatch1().build());
417 flow.setInstructions(createMetadataInstructions().build());
421 flow.setMatch(createMatch1().build());
422 flow.setInstructions(createAppyActionInstruction20().build());
426 flow.setMatch(createMatch1().build());
427 flow.setInstructions(createAppyActionInstruction21().build());
431 flow.setMatch(createMatch1().build());
432 flow.setInstructions(createAppyActionInstruction22().build());
436 flow.setMatch(createMatch1().build());
437 flow.setInstructions(createAppyActionInstruction23(nodeBuilder.getId()).build());
441 flow.setMatch(createMatch1().build());
442 flow.setInstructions(createAppyActionInstruction24().build());
446 flow.setMatch(createMatch1().build());
447 flow.setInstructions(createAppyActionInstruction25().build());
451 flow.setMatch(createMatch1().build());
452 flow.setInstructions(createAppyActionInstruction26().build());
456 flow.setMatch(createMatch1().build());
457 flow.setInstructions(createAppyActionInstruction27().build());
461 flow.setMatch(createMatch1().build());
462 flow.setInstructions(createAppyActionInstruction28().build());
466 flow.setMatch(createMatch1().build());
467 flow.setInstructions(createAppyActionInstruction29().build());
471 flow.setMatch(createMatch1().build());
472 flow.setInstructions(createAppyActionInstruction30().build());
476 flow.setMatch(createMatch1().build());
477 flow.setInstructions(createAppyActionInstruction31().build());
481 flow.setMatch(createMatch1().build());
482 flow.setInstructions(createAppyActionInstruction32().build());
486 flow.setMatch(createMatch1().build());
487 flow.setInstructions(createAppyActionInstruction33().build());
491 flow.setMatch(createMatch1().build());
492 flow.setInstructions(createAppyActionInstruction34().build());
496 flow.setMatch(createICMPv6Match().build());
497 flow.setInstructions(createDecNwTtlInstructions().build());
501 flow.setMatch(createInphyportMatch(nodeBuilder.getId()).build());
502 flow.setInstructions(createDropInstructions().build());
506 flow.setMatch(createMetadataMatch().build());
507 flow.setInstructions(createDropInstructions().build());
511 flow.setMatch(createL3IPv6Match().build());
512 flow.setInstructions(createDecNwTtlInstructions().build());
516 flow.setMatch(createL4SCTPMatch().build());
517 flow.setInstructions(createAppyActionInstruction().build());
521 flow.setMatch(createTunnelIDMatch().build());
522 flow.setInstructions(createGotoTableInstructions().build());
526 flow.setMatch(createVlanMatch().build());
527 flow.setInstructions(createMeterInstructions().build());
531 flow.setMatch(createPbbMatch().build());
532 flow.setInstructions(createMeterInstructions().build());
536 flow.setMatch(createVlanMatch().build());
537 flow.setInstructions(createDropInstructions().build());
541 flow.setMatch(createL4TCPMatch().build());
542 flow.setInstructions(createDropInstructions().build());
547 flow.setMatch(createL4UDPMatch().build());
548 flow.setInstructions(createDropInstructions().build());
552 flow.setMatch(new MatchBuilder().build());
553 flow.setInstructions(createSentToControllerInstructions().build());
557 flow.setMatch(createToSMatch().build());
558 flow.setInstructions(createDropInstructions().build());
562 flow.setMatch(createToSMatch().build());
563 flow.setInstructions(createOutputInstructions("INPORT", 10).build());
567 flow.setMatch(createToSMatch().build());
568 flow.setInstructions(createOutputInstructions("FLOOD", 20).build());
572 flow.setMatch(createToSMatch().build());
573 flow.setInstructions(createOutputInstructions("ALL", 30).build());
577 flow.setMatch(createToSMatch().build());
578 flow.setInstructions(createOutputInstructions("NORMAL", 40).build());
582 flow.setMatch(createToSMatch().build());
583 flow.setInstructions(createOutputInstructions("LOCAL", 50).build());
587 flow.setMatch(createToSMatch().build());
588 flow.setInstructions(createOutputInstructions("TABLE", 60).build());
592 flow.setMatch(createToSMatch().build());
593 flow.setInstructions(createOutputInstructions("NONE", 70).build());
597 flow.setMatch(createToSMatch().build());
598 flow.setInstructions(createStripVlanInstructions().build());
599 flow.setBarrier(Boolean.TRUE);
603 flow.setMatch(createMatch1().build());
604 flow.setInstructions(createAppyActionInstruction35().build());
608 flow.setMatch(createMatch1().build());
609 flow.setInstructions(createAppyActionInstruction36().build());
613 flow.setMatch(createMatch1().build());
614 flow.setInstructions(createAppyActionInstruction37().build());
618 flow.setMatch(createMatch1().build());
619 flow.setInstructions(createAppyActionInstruction38().build());
623 flow.setMatch(createL4TCPMatch().build());
624 flow.setInstructions(createAppyActionInstruction39().build());
628 flow.setMatch(createL4UDPMatch().build());
629 flow.setInstructions(createAppyActionInstruction40().build());
633 flow.setMatch(createL4SCTPMatch().build());
634 flow.setInstructions(createAppyActionInstruction41().build());
638 flow.setMatch(createICMPv4Match().build());
639 flow.setInstructions(createAppyActionInstruction42().build());
643 flow.setMatch(createArpMatch().build());
644 flow.setInstructions(createAppyActionInstruction43().build());
648 flow.setMatch(createL3IPv6Match().build());
649 flow.setInstructions(createAppyActionInstruction44().build());
653 flow.setMatch(createICMPv6Match().build());
654 flow.setInstructions(createAppyActionInstruction45().build());
658 flow.setMatch(createMplsMatch().build());
659 flow.setInstructions(createAppyActionInstruction46().build());
663 flow.setMatch(createPbbMatch().build());
664 flow.setInstructions(createAppyActionInstruction47().build());
668 flow.setMatch(createTunnelIDMatch().build());
669 flow.setInstructions(createAppyActionInstruction48().build());
673 flow.setMatch(createMatch33().build());
674 flow.setInstructions(createDropInstructions().build());
678 flow.setMatch(createICMPv6Match1().build());
679 flow.setInstructions(createDecNwTtlInstructions().build());
683 flow.setMatch(createMatch1().build());
684 flow.setInstructions(createAppyActionInstruction88().build());
688 flow.setMatch(createLLDPMatch().build());
689 flow.setInstructions(createSentToControllerInstructions().build());
693 flow.setMatch(createToSMatch().build());
694 flow.setInstructions(createOutputInstructions().build());
697 LOG.warn("flow type not understood: {}", flowType);
700 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
701 if (null == flow.isBarrier()) {
702 flow.setBarrier(Boolean.FALSE);
704 // flow.setBufferId(new Long(12));
705 BigInteger value = new BigInteger("10", 10);
706 // BigInteger outputPort = new BigInteger("65535", 10);
707 flow.setCookie(value);
708 flow.setCookieMask(value);
709 flow.setHardTimeout(0);
710 flow.setIdleTimeout(0);
711 flow.setInstallHw(false);
712 flow.setStrict(false);
713 flow.setContainerName(null);
714 flow.setFlags(new FlowModFlags(false, false, false, false, true));
715 flow.setId(new FlowId("12"));
716 flow.setTableId(getTableId(tableId));
717 // commenting setOutGroup and setOutPort, as by default
719 // enable setOutGroup and setOutPort to enable output filtering
720 // flow.setOutGroup(new Long(2));
721 // set outport to OFPP_NONE (65535) to disable remove restriction for
723 // flow.setOutPort(outputPort);
727 flow.setFlowName(originalFlowName + "X" + flowType);
732 private FlowBuilder createtablemiss(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
733 FlowBuilder flow = new FlowBuilder();
735 MatchBuilder matchBuilder = new MatchBuilder();
736 flow.setMatch(matchBuilder.build());
737 flow.setInstructions(createSentToControllerInstructions().build());
739 flow.setTableId((short) 0);
740 FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
746 private short getTableId(String tableId) {
749 table = Short.parseShort(tableId);
750 } catch (Exception ex) {
751 // ignore exception and continue with default value
761 private static InstructionsBuilder createDecNwTtlInstructions() {
762 DecNwTtlBuilder ta = new DecNwTtlBuilder();
763 DecNwTtl decNwTtl = ta.build();
764 ActionBuilder ab = new ActionBuilder();
765 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
767 // Add our drop action to a list
768 List<Action> actionList = new ArrayList<Action>();
769 actionList.add(ab.build());
771 // Create an Apply Action
772 ApplyActionsBuilder aab = new ApplyActionsBuilder();
773 aab.setAction(actionList);
775 // Wrap our Apply Action in an Instruction
776 InstructionBuilder ib = new InstructionBuilder();
777 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
778 ib.setKey(new InstructionKey(0));
781 // Put our Instruction in a list of Instructions
782 InstructionsBuilder isb = new InstructionsBuilder();
783 List<Instruction> instructions = new ArrayList<Instruction>();
784 instructions.add(ib.build());
785 isb.setInstruction(instructions);
792 private static InstructionsBuilder createMeterInstructions() {
794 MeterBuilder aab = new MeterBuilder();
795 aab.setMeterId(new MeterId(new Long(1)));
797 InstructionBuilder ib = new InstructionBuilder();
798 ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
800 // Put our Instruction in a list of Instructions
801 InstructionsBuilder isb = new InstructionsBuilder();
802 List<Instruction> instructions = new ArrayList<Instruction>();
803 instructions.add(ib.build());
804 isb.setInstruction(instructions);
808 private static InstructionsBuilder createMetadataInstructions() {
810 WriteMetadataBuilder aab = new WriteMetadataBuilder();
811 aab.setMetadata(new BigInteger("10", 10));
812 aab.setMetadataMask(new BigInteger("12", 10));
814 InstructionBuilder ib = new InstructionBuilder();
815 ib.setInstruction(new WriteMetadataCaseBuilder().setWriteMetadata(aab.build()).build());
817 // Put our Instruction in a list of Instructions
818 InstructionsBuilder isb = new InstructionsBuilder();
819 List<Instruction> instructions = new ArrayList<Instruction>();
820 instructions.add(ib.build());
821 isb.setInstruction(instructions);
825 private static InstructionsBuilder createGotoTableInstructions() {
827 GoToTableBuilder aab = new GoToTableBuilder();
828 aab.setTableId((short) 2);
830 InstructionBuilder ib = new InstructionBuilder();
831 ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(aab.build()).build());
833 // Put our Instruction in a list of Instructions
834 InstructionsBuilder isb = new InstructionsBuilder();
835 List<Instruction> instructions = new ArrayList<Instruction>();
836 instructions.add(ib.build());
837 isb.setInstruction(instructions);
841 private static InstructionsBuilder createDropInstructions() {
842 DropActionBuilder dab = new DropActionBuilder();
843 DropAction dropAction = dab.build();
844 ActionBuilder ab = new ActionBuilder();
845 ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build());
847 // Add our drop action to a list
848 List<Action> actionList = new ArrayList<Action>();
849 actionList.add(ab.build());
851 // Create an Apply Action
852 ApplyActionsBuilder aab = new ApplyActionsBuilder();
853 aab.setAction(actionList);
855 // Wrap our Apply Action in an Instruction
856 InstructionBuilder ib = new InstructionBuilder();
857 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
859 // Put our Instruction in a list of Instructions
860 InstructionsBuilder isb = new InstructionsBuilder();
861 List<Instruction> instructions = new ArrayList<Instruction>();
862 instructions.add(ib.build());
863 isb.setInstruction(instructions);
867 private static InstructionsBuilder createAppyActionInstruction() {
869 List<Action> actionList = new ArrayList<Action>();
870 ActionBuilder ab = new ActionBuilder();
871 ControllerActionBuilder controller = new ControllerActionBuilder();
872 controller.setMaxLength(5);
873 ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.build()).build());
874 actionList.add(ab.build());
875 // Create an Apply Action
876 ApplyActionsBuilder aab = new ApplyActionsBuilder();
877 aab.setAction(actionList);
879 // Wrap our Apply Action in an Instruction
880 InstructionBuilder ib = new InstructionBuilder();
881 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
883 // Put our Instruction in a list of Instructions
884 InstructionsBuilder isb = new InstructionsBuilder();
885 List<Instruction> instructions = new ArrayList<Instruction>();
886 instructions.add(ib.build());
887 isb.setInstruction(instructions);
891 private static InstructionsBuilder createAppyActionInstruction1() {
893 List<Action> actionList = new ArrayList<Action>();
894 ActionBuilder ab = new ActionBuilder();
896 OutputActionBuilder output = new OutputActionBuilder();
897 output.setMaxLength(56);
898 Uri value = new Uri("PCEP");
899 output.setOutputNodeConnector(value);
900 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
901 actionList.add(ab.build());
902 // Create an Apply Action
903 ApplyActionsBuilder aab = new ApplyActionsBuilder();
904 aab.setAction(actionList);
906 // Wrap our Apply Action in an Instruction
907 InstructionBuilder ib = new InstructionBuilder();
908 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
910 // Put our Instruction in a list of Instructions
911 InstructionsBuilder isb = new InstructionsBuilder();
912 List<Instruction> instructions = new ArrayList<Instruction>();
913 instructions.add(ib.build());
914 isb.setInstruction(instructions);
918 private static InstructionsBuilder createOutputInstructions() {
920 // test case for Output Port works if the particular port exists
921 // this particular test-case is for Port : 1
922 // tested as (addMDFlow openflow:<dpid> f82)
923 List<Action> actionList = new ArrayList<Action>();
924 ActionBuilder ab = new ActionBuilder();
925 OutputActionBuilder output = new OutputActionBuilder();
927 Uri value = new Uri("1");
928 output.setOutputNodeConnector(value);
929 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
931 ab.setKey(new ActionKey(0));
932 actionList.add(ab.build());
933 // Create an Apply Action
934 ApplyActionsBuilder aab = new ApplyActionsBuilder();
935 aab.setAction(actionList);
937 // Wrap our Apply Action in an Instruction
938 InstructionBuilder ib = new InstructionBuilder();
939 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
941 ib.setKey(new InstructionKey(0));
943 // Put our Instruction in a list of Instructions
944 InstructionsBuilder isb = new InstructionsBuilder();
945 List<Instruction> instructions = new ArrayList<Instruction>();
946 instructions.add(ib.build());
947 isb.setInstruction(instructions);
951 private static InstructionsBuilder createSentToControllerInstructions() {
952 List<Action> actionList = new ArrayList<Action>();
953 ActionBuilder ab = new ActionBuilder();
955 OutputActionBuilder output = new OutputActionBuilder();
956 output.setMaxLength(new Integer(0xffff));
957 Uri value = new Uri(OutputPortValues.CONTROLLER.toString());
958 output.setOutputNodeConnector(value);
959 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
961 ab.setKey(new ActionKey(0));
962 actionList.add(ab.build());
963 // Create an Apply Action
964 ApplyActionsBuilder aab = new ApplyActionsBuilder();
965 aab.setAction(actionList);
967 // Wrap our Apply Action in an Instruction
968 InstructionBuilder ib = new InstructionBuilder();
969 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
971 ib.setKey(new InstructionKey(0));
973 // Put our Instruction in a list of Instructions
974 InstructionsBuilder isb = new InstructionsBuilder();
975 List<Instruction> instructions = new ArrayList<Instruction>();
976 instructions.add(ib.build());
977 isb.setInstruction(instructions);
981 private static InstructionsBuilder createOutputInstructions(String outputType, int outputValue) {
982 List<Action> actionList = new ArrayList<Action>();
983 ActionBuilder ab = new ActionBuilder();
985 OutputActionBuilder output = new OutputActionBuilder();
986 output.setMaxLength(outputValue);
987 Uri value = new Uri(outputType);
988 output.setOutputNodeConnector(value);
989 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
991 ab.setKey(new ActionKey(0));
992 actionList.add(ab.build());
993 // Create an Apply Action
994 ApplyActionsBuilder aab = new ApplyActionsBuilder();
995 aab.setAction(actionList);
997 // Wrap our Apply Action in an Instruction
998 InstructionBuilder ib = new InstructionBuilder();
999 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1001 ib.setKey(new InstructionKey(0));
1003 // Put our Instruction in a list of Instructions
1004 InstructionsBuilder isb = new InstructionsBuilder();
1005 List<Instruction> instructions = new ArrayList<Instruction>();
1006 instructions.add(ib.build());
1007 isb.setInstruction(instructions);
1011 private static InstructionsBuilder createStripVlanInstructions() {
1012 List<Action> actionList = new ArrayList<Action>();
1013 ActionBuilder ab = new ActionBuilder();
1015 StripVlanActionBuilder stripActionBuilder = new StripVlanActionBuilder();
1016 ab.setAction(new StripVlanActionCaseBuilder().setStripVlanAction(stripActionBuilder.build()).build());
1018 ab.setKey(new ActionKey(0));
1019 actionList.add(ab.build());
1020 // Create an Apply Action
1021 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1022 aab.setAction(actionList);
1024 // Wrap our Apply Action in an Instruction
1025 InstructionBuilder ib = new InstructionBuilder();
1026 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1028 ib.setKey(new InstructionKey(0));
1030 // Put our Instruction in a list of Instructions
1031 InstructionsBuilder isb = new InstructionsBuilder();
1032 List<Instruction> instructions = new ArrayList<Instruction>();
1033 instructions.add(ib.build());
1034 isb.setInstruction(instructions);
1038 private static InstructionsBuilder createAppyActionInstruction2() {
1040 List<Action> actionList = new ArrayList<Action>();
1041 ActionBuilder ab = new ActionBuilder();
1043 PushMplsActionBuilder push = new PushMplsActionBuilder();
1044 push.setEthernetType(new Integer(0x8847));
1045 ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
1046 actionList.add(ab.build());
1047 // Create an Apply Action
1048 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1049 aab.setAction(actionList);
1051 // Wrap our Apply Action in an Instruction
1052 InstructionBuilder ib = new InstructionBuilder();
1053 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1055 // Put our Instruction in a list of Instructions
1056 InstructionsBuilder isb = new InstructionsBuilder();
1057 List<Instruction> instructions = new ArrayList<Instruction>();
1058 instructions.add(ib.build());
1059 isb.setInstruction(instructions);
1063 private static InstructionsBuilder createAppyActionInstruction3() {
1065 List<Action> actionList = new ArrayList<Action>();
1066 ActionBuilder ab = new ActionBuilder();
1068 PushPbbActionBuilder pbb = new PushPbbActionBuilder();
1069 pbb.setEthernetType(new Integer(0x88E7));
1070 ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
1071 actionList.add(ab.build());
1072 // Create an Apply Action
1073 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1074 aab.setAction(actionList);
1076 // Wrap our Apply Action in an Instruction
1077 InstructionBuilder ib = new InstructionBuilder();
1078 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1080 // Put our Instruction in a list of Instructions
1081 InstructionsBuilder isb = new InstructionsBuilder();
1082 List<Instruction> instructions = new ArrayList<Instruction>();
1083 instructions.add(ib.build());
1084 isb.setInstruction(instructions);
1088 private static InstructionsBuilder createAppyActionInstruction4() {
1090 List<Action> actionList = new ArrayList<Action>();
1091 ActionBuilder ab = new ActionBuilder();
1093 PushVlanActionBuilder vlan = new PushVlanActionBuilder();
1094 vlan.setEthernetType(new Integer(0x8100));
1095 ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
1096 actionList.add(ab.build());
1098 // Create an Apply Action
1099 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1100 aab.setAction(actionList);
1102 // Wrap our Apply Action in an Instruction
1103 InstructionBuilder ib = new InstructionBuilder();
1104 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1106 // Put our Instruction in a list of Instructions
1107 InstructionsBuilder isb = new InstructionsBuilder();
1108 List<Instruction> instructions = new ArrayList<Instruction>();
1109 instructions.add(ib.build());
1110 isb.setInstruction(instructions);
1114 private static InstructionsBuilder createAppyActionInstruction5() {
1116 List<Action> actionList = new ArrayList<Action>();
1117 ActionBuilder ab = new ActionBuilder();
1119 SetDlDstActionBuilder setdl = new SetDlDstActionBuilder();
1120 setdl.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1121 ab.setAction(new SetDlDstActionCaseBuilder().setSetDlDstAction(setdl.build()).build());
1122 actionList.add(ab.build());
1123 // Create an Apply Action
1124 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1125 aab.setAction(actionList);
1127 // Wrap our Apply Action in an Instruction
1128 InstructionBuilder ib = new InstructionBuilder();
1129 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1131 // Put our Instruction in a list of Instructions
1132 InstructionsBuilder isb = new InstructionsBuilder();
1133 List<Instruction> instructions = new ArrayList<Instruction>();
1134 instructions.add(ib.build());
1135 isb.setInstruction(instructions);
1139 private static InstructionsBuilder createAppyActionInstruction6() {
1141 List<Action> actionList = new ArrayList<Action>();
1142 ActionBuilder ab = new ActionBuilder();
1144 SetDlSrcActionBuilder src = new SetDlSrcActionBuilder();
1145 src.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1146 ab.setAction(new SetDlSrcActionCaseBuilder().setSetDlSrcAction(src.build()).build());
1147 actionList.add(ab.build());
1149 // Create an Apply Action
1150 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1151 aab.setAction(actionList);
1153 // Wrap our Apply Action in an Instruction
1154 InstructionBuilder ib = new InstructionBuilder();
1155 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1157 // Put our Instruction in a list of Instructions
1158 InstructionsBuilder isb = new InstructionsBuilder();
1159 List<Instruction> instructions = new ArrayList<Instruction>();
1160 instructions.add(ib.build());
1161 isb.setInstruction(instructions);
1165 private static InstructionsBuilder createAppyActionInstruction7() {
1167 List<Action> actionList = new ArrayList<Action>();
1168 ActionBuilder ab = new ActionBuilder();
1170 SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
1171 VlanId a = new VlanId(4000);
1173 ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
1174 actionList.add(ab.build());
1175 // Create an Apply Action
1176 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1177 aab.setAction(actionList);
1179 // Wrap our Apply Action in an Instruction
1180 InstructionBuilder ib = new InstructionBuilder();
1181 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1183 // Put our Instruction in a list of Instructions
1184 InstructionsBuilder isb = new InstructionsBuilder();
1185 List<Instruction> instructions = new ArrayList<Instruction>();
1186 instructions.add(ib.build());
1187 isb.setInstruction(instructions);
1191 private static InstructionsBuilder createAppyActionInstruction8() {
1193 List<Action> actionList = new ArrayList<Action>();
1194 ActionBuilder ab = new ActionBuilder();
1196 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1197 VlanPcp pcp1 = new VlanPcp((short) 2);
1198 pcp.setVlanPcp(pcp1);
1199 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1200 actionList.add(ab.build());
1201 // Create an Apply Action
1202 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1203 aab.setAction(actionList);
1205 // Wrap our Apply Action in an Instruction
1206 InstructionBuilder ib = new InstructionBuilder();
1207 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1209 // Put our Instruction in a list of Instructions
1210 InstructionsBuilder isb = new InstructionsBuilder();
1211 List<Instruction> instructions = new ArrayList<Instruction>();
1212 instructions.add(ib.build());
1213 isb.setInstruction(instructions);
1217 private static InstructionsBuilder createAppyActionInstruction88() {
1219 List<Action> actionList = new ArrayList<Action>();
1220 ActionBuilder ab = new ActionBuilder();
1222 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1223 VlanPcp pcp1 = new VlanPcp((short) 9);
1224 pcp.setVlanPcp(pcp1);
1225 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1226 actionList.add(ab.build());
1227 // Create an Apply Action
1228 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1229 aab.setAction(actionList);
1231 // Wrap our Apply Action in an Instruction
1232 InstructionBuilder ib = new InstructionBuilder();
1233 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1235 // Put our Instruction in a list of Instructions
1236 InstructionsBuilder isb = new InstructionsBuilder();
1237 List<Instruction> instructions = new ArrayList<Instruction>();
1238 instructions.add(ib.build());
1239 isb.setInstruction(instructions);
1243 private static InstructionsBuilder createAppyActionInstruction9() {
1245 List<Action> actionList = new ArrayList<Action>();
1246 ActionBuilder ab = new ActionBuilder();
1248 CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
1249 ab.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
1250 actionList.add(ab.build());
1251 // Create an Apply Action
1252 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1253 aab.setAction(actionList);
1255 // Wrap our Apply Action in an Instruction
1256 InstructionBuilder ib = new InstructionBuilder();
1257 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1259 // Put our Instruction in a list of Instructions
1260 InstructionsBuilder isb = new InstructionsBuilder();
1261 List<Instruction> instructions = new ArrayList<Instruction>();
1262 instructions.add(ib.build());
1263 isb.setInstruction(instructions);
1267 private static InstructionsBuilder createAppyActionInstruction10() {
1269 List<Action> actionList = new ArrayList<Action>();
1270 ActionBuilder ab = new ActionBuilder();
1272 CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
1273 ab.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
1274 actionList.add(ab.build());
1275 // Create an Apply Action
1276 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1277 aab.setAction(actionList);
1279 // Wrap our Apply Action in an Instruction
1280 InstructionBuilder ib = new InstructionBuilder();
1281 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1283 // Put our Instruction in a list of Instructions
1284 InstructionsBuilder isb = new InstructionsBuilder();
1285 List<Instruction> instructions = new ArrayList<Instruction>();
1286 instructions.add(ib.build());
1287 isb.setInstruction(instructions);
1291 private static InstructionsBuilder createAppyActionInstruction11() {
1293 List<Action> actionList = new ArrayList<Action>();
1294 ActionBuilder ab = new ActionBuilder();
1296 DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
1297 ab.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
1298 actionList.add(ab.build());
1299 // Create an Apply Action
1300 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1301 aab.setAction(actionList);
1303 // Wrap our Apply Action in an Instruction
1304 InstructionBuilder ib = new InstructionBuilder();
1305 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1306 ib.setKey(new InstructionKey(0));
1309 // Put our Instruction in a list of Instruction
1310 InstructionsBuilder isb = new InstructionsBuilder();
1311 List<Instruction> instructions = new ArrayList<Instruction>();
1312 instructions.add(ib.build());
1313 isb.setInstruction(instructions);
1317 private static InstructionsBuilder createAppyActionInstruction12() {
1319 List<Action> actionList = new ArrayList<Action>();
1320 ActionBuilder ab = new ActionBuilder();
1322 DecNwTtlBuilder nwttl = new DecNwTtlBuilder();
1323 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(nwttl.build()).build());
1324 actionList.add(ab.build());
1326 // Create an Apply Action
1327 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1328 aab.setAction(actionList);
1330 // Wrap our Apply Action in an Instruction
1331 InstructionBuilder ib = new InstructionBuilder();
1332 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1334 // Put our Instruction in a list of Instructions
1335 InstructionsBuilder isb = new InstructionsBuilder();
1336 List<Instruction> instructions = new ArrayList<Instruction>();
1337 instructions.add(ib.build());
1338 isb.setInstruction(instructions);
1342 private static InstructionsBuilder createAppyActionInstruction13() {
1344 List<Action> actionList = new ArrayList<Action>();
1345 ActionBuilder ab = new ActionBuilder();
1347 DropActionBuilder drop = new DropActionBuilder();
1348 ab.setAction(new DropActionCaseBuilder().setDropAction(drop.build()).build());
1349 actionList.add(ab.build());
1351 // Create an Apply Action
1352 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1353 aab.setAction(actionList);
1355 // Wrap our Apply Action in an Instruction
1356 InstructionBuilder ib = new InstructionBuilder();
1357 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1359 // Put our Instruction in a list of Instructions
1360 InstructionsBuilder isb = new InstructionsBuilder();
1361 List<Instruction> instructions = new ArrayList<Instruction>();
1362 instructions.add(ib.build());
1363 isb.setInstruction(instructions);
1367 private static InstructionsBuilder createAppyActionInstruction14() {
1369 List<Action> actionList = new ArrayList<Action>();
1370 ActionBuilder ab = new ActionBuilder();
1372 FloodActionBuilder fld = new FloodActionBuilder();
1373 ab.setAction(new FloodActionCaseBuilder().setFloodAction(fld.build()).build());
1374 actionList.add(ab.build());
1375 // Create an Apply Action
1376 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1377 aab.setAction(actionList);
1379 // Wrap our Apply Action in an Instruction
1380 InstructionBuilder ib = new InstructionBuilder();
1381 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1383 // Put our Instruction in a list of Instructions
1384 InstructionsBuilder isb = new InstructionsBuilder();
1385 List<Instruction> instructions = new ArrayList<Instruction>();
1386 instructions.add(ib.build());
1387 isb.setInstruction(instructions);
1391 private static InstructionsBuilder createAppyActionInstruction15() {
1393 List<Action> actionList = new ArrayList<Action>();
1394 ActionBuilder ab = new ActionBuilder();
1396 FloodAllActionBuilder fldall = new FloodAllActionBuilder();
1397 ab.setAction(new FloodAllActionCaseBuilder().setFloodAllAction(fldall.build()).build());
1398 actionList.add(ab.build());
1399 // Create an Apply Action
1400 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1401 aab.setAction(actionList);
1403 // Wrap our Apply Action in an Instruction
1404 InstructionBuilder ib = new InstructionBuilder();
1405 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1407 // Put our Instruction in a list of Instructions
1408 InstructionsBuilder isb = new InstructionsBuilder();
1409 List<Instruction> instructions = new ArrayList<Instruction>();
1410 instructions.add(ib.build());
1411 isb.setInstruction(instructions);
1415 private static InstructionsBuilder createAppyActionInstruction16() {
1417 List<Action> actionList = new ArrayList<Action>();
1418 ActionBuilder ab = new ActionBuilder();
1420 GroupActionBuilder groupActionB = new GroupActionBuilder();
1421 groupActionB.setGroupId(1L);
1422 groupActionB.setGroup("0");
1423 ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
1424 actionList.add(ab.build());
1426 // Create an Apply Action
1427 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1428 aab.setAction(actionList);
1430 // Wrap our Apply Action in an Instruction
1431 InstructionBuilder ib = new InstructionBuilder();
1432 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1434 // Put our Instruction in a list of Instructions
1435 InstructionsBuilder isb = new InstructionsBuilder();
1436 List<Instruction> instructions = new ArrayList<Instruction>();
1437 instructions.add(ib.build());
1438 isb.setInstruction(instructions);
1442 private static InstructionsBuilder createAppyActionInstruction17() {
1444 List<Action> actionList = new ArrayList<Action>();
1445 ActionBuilder ab = new ActionBuilder();
1447 HwPathActionBuilder hwPathB = new HwPathActionBuilder();
1448 ab.setAction(new HwPathActionCaseBuilder().setHwPathAction(hwPathB.build()).build());
1449 actionList.add(ab.build());
1450 // Create an Apply Action
1451 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1452 aab.setAction(actionList);
1454 // Wrap our Apply Action in an Instruction
1455 InstructionBuilder ib = new InstructionBuilder();
1456 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1458 // Put our Instruction in a list of Instructions
1459 InstructionsBuilder isb = new InstructionsBuilder();
1460 List<Instruction> instructions = new ArrayList<Instruction>();
1461 instructions.add(ib.build());
1462 isb.setInstruction(instructions);
1466 private static InstructionsBuilder createAppyActionInstruction18() {
1468 List<Action> actionList = new ArrayList<Action>();
1469 ActionBuilder ab = new ActionBuilder();
1471 LoopbackActionBuilder loopbackActionBuilder = new LoopbackActionBuilder();
1472 ab.setAction(new LoopbackActionCaseBuilder().setLoopbackAction(loopbackActionBuilder.build()).build());
1473 actionList.add(ab.build());
1475 // Create an Apply Action
1476 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1477 aab.setAction(actionList);
1479 // Wrap our Apply Action in an Instruction
1480 InstructionBuilder ib = new InstructionBuilder();
1481 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1483 // Put our Instruction in a list of Instructions
1484 InstructionsBuilder isb = new InstructionsBuilder();
1485 List<Instruction> instructions = new ArrayList<Instruction>();
1486 instructions.add(ib.build());
1487 isb.setInstruction(instructions);
1491 private static InstructionsBuilder createAppyActionInstruction19() {
1493 List<Action> actionList = new ArrayList<Action>();
1494 ActionBuilder ab = new ActionBuilder();
1496 PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
1497 popMplsActionBuilder.setEthernetType(0XB);
1498 ab.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
1499 actionList.add(ab.build());
1500 // Create an Apply Action
1501 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1502 aab.setAction(actionList);
1504 // Wrap our Apply Action in an Instruction
1505 InstructionBuilder ib = new InstructionBuilder();
1506 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1508 // Put our Instruction in a list of Instructions
1509 InstructionsBuilder isb = new InstructionsBuilder();
1510 List<Instruction> instructions = new ArrayList<Instruction>();
1511 instructions.add(ib.build());
1512 isb.setInstruction(instructions);
1516 private static InstructionsBuilder createAppyActionInstruction20() {
1518 List<Action> actionList = new ArrayList<Action>();
1519 ActionBuilder ab = new ActionBuilder();
1521 PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
1522 ab.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
1523 actionList.add(ab.build());
1524 // Create an Apply Action
1525 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1526 aab.setAction(actionList);
1528 // Wrap our Apply Action in an Instruction
1529 InstructionBuilder ib = new InstructionBuilder();
1530 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1532 // Put our Instruction in a list of Instructions
1533 InstructionsBuilder isb = new InstructionsBuilder();
1534 List<Instruction> instructions = new ArrayList<Instruction>();
1535 instructions.add(ib.build());
1536 isb.setInstruction(instructions);
1540 private static InstructionsBuilder createAppyActionInstruction21() {
1542 List<Action> actionList = new ArrayList<Action>();
1543 ActionBuilder ab = new ActionBuilder();
1545 PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder();
1546 ab.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(popVlanActionBuilder.build()).build());
1547 actionList.add(ab.build());
1549 // Create an Apply Action
1550 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1551 aab.setAction(actionList);
1553 // Wrap our Apply Action in an Instruction
1554 InstructionBuilder ib = new InstructionBuilder();
1555 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1557 // Put our Instruction in a list of Instructions
1558 InstructionsBuilder isb = new InstructionsBuilder();
1559 List<Instruction> instructions = new ArrayList<Instruction>();
1560 instructions.add(ib.build());
1561 isb.setInstruction(instructions);
1565 private static InstructionsBuilder createAppyActionInstruction22() {
1567 List<Action> actionList = new ArrayList<Action>();
1568 ActionBuilder ab = new ActionBuilder();
1570 SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
1571 setDlTypeActionBuilder.setDlType(new EtherType(8L));
1572 ab.setAction(new SetDlTypeActionCaseBuilder().setSetDlTypeAction(setDlTypeActionBuilder.build()).build());
1573 actionList.add(ab.build());
1575 // Create an Apply Action
1576 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1577 aab.setAction(actionList);
1579 // Wrap our Apply Action in an Instruction
1580 InstructionBuilder ib = new InstructionBuilder();
1581 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1583 // Put our Instruction in a list of Instructions
1584 InstructionsBuilder isb = new InstructionsBuilder();
1585 List<Instruction> instructions = new ArrayList<Instruction>();
1586 instructions.add(ib.build());
1587 isb.setInstruction(instructions);
1591 private static InstructionsBuilder createAppyActionInstruction23(NodeId nodeId) {
1593 List<Action> actionList = new ArrayList<Action>();
1594 ActionBuilder ab = new ActionBuilder();
1596 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1597 setFieldBuilder.setInPort(new NodeConnectorId(nodeId + ":2"));
1598 actionList.add(ab.build());
1600 // Create an Apply Action
1601 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1602 aab.setAction(actionList);
1604 // Wrap our Apply Action in an Instruction
1605 InstructionBuilder ib = new InstructionBuilder();
1606 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1608 // Put our Instruction in a list of Instructions
1609 InstructionsBuilder isb = new InstructionsBuilder();
1610 List<Instruction> instructions = new ArrayList<Instruction>();
1611 instructions.add(ib.build());
1612 isb.setInstruction(instructions);
1616 private static InstructionsBuilder createAppyActionInstruction24() {
1618 List<Action> actionList = new ArrayList<Action>();
1619 ActionBuilder ab = new ActionBuilder();
1621 SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
1622 setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
1623 ab.setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(setMplsTtlActionBuilder.build()).build());
1624 actionList.add(ab.build());
1626 // Create an Apply Action
1627 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1628 aab.setAction(actionList);
1630 // Wrap our Apply Action in an Instruction
1631 InstructionBuilder ib = new InstructionBuilder();
1632 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1634 // Put our Instruction in a list of Instructions
1635 InstructionsBuilder isb = new InstructionsBuilder();
1636 List<Instruction> instructions = new ArrayList<Instruction>();
1637 instructions.add(ib.build());
1638 isb.setInstruction(instructions);
1642 private static InstructionsBuilder createAppyActionInstruction25() {
1644 List<Action> actionList = new ArrayList<Action>();
1645 ActionBuilder ab = new ActionBuilder();
1647 SetNextHopActionBuilder setNextHopActionBuilder = new SetNextHopActionBuilder();
1648 Ipv4Builder ipnext = new Ipv4Builder();
1649 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
1650 ipnext.setIpv4Address(prefix);
1651 setNextHopActionBuilder.setAddress(ipnext.build());
1652 ab.setAction(new SetNextHopActionCaseBuilder().setSetNextHopAction(setNextHopActionBuilder.build()).build());
1653 actionList.add(ab.build());
1655 // Create an Apply Action
1656 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1657 aab.setAction(actionList);
1659 // Wrap our Apply Action in an Instruction
1660 InstructionBuilder ib = new InstructionBuilder();
1661 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1663 // Put our Instruction in a list of Instructions
1664 InstructionsBuilder isb = new InstructionsBuilder();
1665 List<Instruction> instructions = new ArrayList<Instruction>();
1666 instructions.add(ib.build());
1667 isb.setInstruction(instructions);
1671 private static InstructionsBuilder createAppyActionInstruction26() {
1673 List<Action> actionList = new ArrayList<Action>();
1674 ActionBuilder ab = new ActionBuilder();
1676 SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
1677 Ipv4Builder ipdst = new Ipv4Builder();
1678 Ipv4Prefix prefixdst = new Ipv4Prefix("10.0.0.21/24");
1679 ipdst.setIpv4Address(prefixdst);
1680 setNwDstActionBuilder.setAddress(ipdst.build());
1681 ab.setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build());
1682 actionList.add(ab.build());
1684 // Create an Apply Action
1685 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1686 aab.setAction(actionList);
1688 // Wrap our Apply Action in an Instruction
1689 InstructionBuilder ib = new InstructionBuilder();
1690 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1692 // Put our Instruction in a list of Instructions
1693 InstructionsBuilder isb = new InstructionsBuilder();
1694 List<Instruction> instructions = new ArrayList<Instruction>();
1695 instructions.add(ib.build());
1696 isb.setInstruction(instructions);
1700 private static InstructionsBuilder createAppyActionInstruction27() {
1702 List<Action> actionList = new ArrayList<Action>();
1703 ActionBuilder ab = new ActionBuilder();
1705 SetNwSrcActionBuilder setNwsrcActionBuilder = new SetNwSrcActionBuilder();
1706 Ipv4Builder ipsrc = new Ipv4Builder();
1707 Ipv4Prefix prefixsrc = new Ipv4Prefix("10.0.23.21/24");
1708 ipsrc.setIpv4Address(prefixsrc);
1709 setNwsrcActionBuilder.setAddress(ipsrc.build());
1710 ab.setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwsrcActionBuilder.build()).build());
1711 actionList.add(ab.build());
1713 // Create an Apply Action
1714 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1715 aab.setAction(actionList);
1717 // Wrap our Apply Action in an Instruction
1718 InstructionBuilder ib = new InstructionBuilder();
1719 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1721 // Put our Instruction in a list of Instructions
1722 InstructionsBuilder isb = new InstructionsBuilder();
1723 List<Instruction> instructions = new ArrayList<Instruction>();
1724 instructions.add(ib.build());
1725 isb.setInstruction(instructions);
1729 private static InstructionsBuilder createAppyActionInstruction28() {
1731 List<Action> actionList = new ArrayList<Action>();
1732 ActionBuilder ab = new ActionBuilder();
1734 SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
1735 setNwTosActionBuilder.setTos(8);
1736 ab.setAction(new SetNwTosActionCaseBuilder().setSetNwTosAction(setNwTosActionBuilder.build()).build());
1737 actionList.add(ab.build());
1738 // Create an Apply Action
1739 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1740 aab.setAction(actionList);
1742 // Wrap our Apply Action in an Instruction
1743 InstructionBuilder ib = new InstructionBuilder();
1744 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1746 // Put our Instruction in a list of Instructions
1747 InstructionsBuilder isb = new InstructionsBuilder();
1748 List<Instruction> instructions = new ArrayList<Instruction>();
1749 instructions.add(ib.build());
1750 isb.setInstruction(instructions);
1754 private static InstructionsBuilder createAppyActionInstruction29() {
1756 List<Action> actionList = new ArrayList<Action>();
1757 ActionBuilder ab = new ActionBuilder();
1759 SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
1760 setNwTtlActionBuilder.setNwTtl((short) 1);
1761 ab.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
1762 actionList.add(ab.build());
1764 // Create an Apply Action
1765 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1766 aab.setAction(actionList);
1768 // Wrap our Apply Action in an Instruction
1769 InstructionBuilder ib = new InstructionBuilder();
1770 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1772 // Put our Instruction in a list of Instructions
1773 InstructionsBuilder isb = new InstructionsBuilder();
1774 List<Instruction> instructions = new ArrayList<Instruction>();
1775 instructions.add(ib.build());
1776 isb.setInstruction(instructions);
1780 private static InstructionsBuilder createAppyActionInstruction30() {
1782 List<Action> actionList = new ArrayList<Action>();
1783 ActionBuilder ab = new ActionBuilder();
1785 SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
1786 setQueueActionBuilder.setQueueId(1L);
1787 ab.setAction(new SetQueueActionCaseBuilder().setSetQueueAction(setQueueActionBuilder.build()).build());
1788 actionList.add(ab.build());
1789 // Create an Apply Action
1790 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1791 aab.setAction(actionList);
1793 // Wrap our Apply Action in an Instruction
1794 InstructionBuilder ib = new InstructionBuilder();
1795 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1797 // Put our Instruction in a list of Instructions
1798 InstructionsBuilder isb = new InstructionsBuilder();
1799 List<Instruction> instructions = new ArrayList<Instruction>();
1800 instructions.add(ib.build());
1801 isb.setInstruction(instructions);
1805 private static InstructionsBuilder createAppyActionInstruction31() {
1807 List<Action> actionList = new ArrayList<Action>();
1808 ActionBuilder ab = new ActionBuilder();
1810 SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
1811 setTpDstActionBuilder.setPort(new PortNumber(109));
1813 ab.setAction(new SetTpDstActionCaseBuilder().setSetTpDstAction(setTpDstActionBuilder.build()).build());
1814 actionList.add(ab.build());
1815 // Create an Apply Action
1816 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1817 aab.setAction(actionList);
1819 // Wrap our Apply Action in an Instruction
1820 InstructionBuilder ib = new InstructionBuilder();
1821 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1823 // Put our Instruction in a list of Instructions
1824 InstructionsBuilder isb = new InstructionsBuilder();
1825 List<Instruction> instructions = new ArrayList<Instruction>();
1826 instructions.add(ib.build());
1827 isb.setInstruction(instructions);
1831 private static InstructionsBuilder createAppyActionInstruction32() {
1833 List<Action> actionList = new ArrayList<Action>();
1834 ActionBuilder ab = new ActionBuilder();
1836 SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
1837 setTpSrcActionBuilder.setPort(new PortNumber(109));
1838 ab.setAction(new SetTpSrcActionCaseBuilder().setSetTpSrcAction(setTpSrcActionBuilder.build()).build());
1839 actionList.add(ab.build());
1841 // Create an Apply Action
1842 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1843 aab.setAction(actionList);
1845 // Wrap our Apply Action in an Instruction
1846 InstructionBuilder ib = new InstructionBuilder();
1847 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1849 // Put our Instruction in a list of Instructions
1850 InstructionsBuilder isb = new InstructionsBuilder();
1851 List<Instruction> instructions = new ArrayList<Instruction>();
1852 instructions.add(ib.build());
1853 isb.setInstruction(instructions);
1857 private static InstructionsBuilder createAppyActionInstruction33() {
1859 List<Action> actionList = new ArrayList<Action>();
1860 ActionBuilder ab = new ActionBuilder();
1862 SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
1863 setVlanCfiActionBuilder.setVlanCfi(new VlanCfi(2));
1864 ab.setAction(new SetVlanCfiActionCaseBuilder().setSetVlanCfiAction(setVlanCfiActionBuilder.build()).build());
1865 actionList.add(ab.build());
1867 // Create an Apply Action
1868 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1869 aab.setAction(actionList);
1871 // Wrap our Apply Action in an Instruction
1872 InstructionBuilder ib = new InstructionBuilder();
1873 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1875 // Put our Instruction in a list of Instructions
1876 InstructionsBuilder isb = new InstructionsBuilder();
1877 List<Instruction> instructions = new ArrayList<Instruction>();
1878 instructions.add(ib.build());
1879 isb.setInstruction(instructions);
1883 private static InstructionsBuilder createAppyActionInstruction34() {
1885 List<Action> actionList = new ArrayList<Action>();
1886 ActionBuilder ab = new ActionBuilder();
1888 SwPathActionBuilder swPathAction = new SwPathActionBuilder();
1889 ab.setAction(new SwPathActionCaseBuilder().setSwPathAction(swPathAction.build()).build());
1890 actionList.add(ab.build());
1892 // Create an Apply Action
1893 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1894 aab.setAction(actionList);
1896 // Wrap our Apply Action in an Instruction
1897 InstructionBuilder ib = new InstructionBuilder();
1898 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1900 // Put our Instruction in a list of Instructions
1901 InstructionsBuilder isb = new InstructionsBuilder();
1902 List<Instruction> instructions = new ArrayList<Instruction>();
1903 instructions.add(ib.build());
1904 isb.setInstruction(instructions);
1908 private static InstructionsBuilder createAppyActionInstruction35() {
1910 List<Action> actionList = new ArrayList<Action>();
1911 ActionBuilder ab = new ActionBuilder();
1912 ActionBuilder ab1 = new ActionBuilder();
1913 ActionBuilder ab2 = new ActionBuilder();
1915 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1916 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
1917 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
1920 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
1921 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
1922 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
1923 EthernetMatchBuilder ethernetMatch1 = new EthernetMatchBuilder();
1924 EthernetDestinationBuilder ethDestBuilder = new EthernetDestinationBuilder();
1925 ethDestBuilder.setAddress(new MacAddress("00:00:00:00:00:02"));
1926 EthernetMatchBuilder ethernetMatch2 = new EthernetMatchBuilder();
1927 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
1928 ethTypeBuilder.setType(new EtherType(0x86ddL));
1930 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
1931 ethernetMatch1.setEthernetDestination(ethDestBuilder.build());
1932 ethernetMatch2.setEthernetType(ethTypeBuilder.build());
1933 setFieldBuilder.setEthernetMatch(ethernetMatch.build());
1934 setFieldBuilder1.setEthernetMatch(ethernetMatch1.build());
1935 setFieldBuilder2.setEthernetMatch(ethernetMatch2.build());
1936 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
1937 ab.setKey(new ActionKey(0));
1938 actionList.add(ab.build());
1940 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
1941 ab1.setKey(new ActionKey(1));
1942 actionList.add(ab1.build());
1944 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
1945 ab2.setKey(new ActionKey(2));
1946 actionList.add(ab2.build());
1948 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1949 aab.setAction(actionList);
1951 InstructionBuilder ib = new InstructionBuilder();
1952 ib.setKey(new InstructionKey(0));
1953 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1955 // Put our Instruction in a list of Instructions
1956 InstructionsBuilder isb = new InstructionsBuilder();
1957 List<Instruction> instructions = new ArrayList<Instruction>();
1958 instructions.add(ib.build());
1959 isb.setInstruction(instructions);
1963 private static InstructionsBuilder createAppyActionInstruction36() {
1965 List<Action> actionList = new ArrayList<Action>();
1966 ActionBuilder ab = new ActionBuilder();
1967 ActionBuilder ab1 = new ActionBuilder();
1969 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1970 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
1973 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
1974 VlanMatchBuilder vlanBuilder1 = new VlanMatchBuilder();
1975 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
1976 VlanId vlanId = new VlanId(10);
1977 VlanPcp vpcp = new VlanPcp((short) 3);
1978 vlanBuilder.setVlanPcp(vpcp);
1979 vlanBuilder1.setVlanId(vlanIdBuilder.setVlanId(vlanId).setVlanIdPresent(true).build());
1980 setFieldBuilder.setVlanMatch(vlanBuilder.build());
1981 setFieldBuilder1.setVlanMatch(vlanBuilder1.build());
1982 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
1983 ab.setKey(new ActionKey(0));
1984 actionList.add(ab.build());
1985 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
1986 ab1.setKey(new ActionKey(1));
1987 actionList.add(ab1.build());
1989 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1990 aab.setAction(actionList);
1992 InstructionBuilder ib = new InstructionBuilder();
1993 ib.setKey(new InstructionKey(0));
1994 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1996 // Put our Instruction in a list of Instructions
1997 InstructionsBuilder isb = new InstructionsBuilder();
1998 List<Instruction> instructions = new ArrayList<Instruction>();
1999 instructions.add(ib.build());
2000 isb.setInstruction(instructions);
2004 private static InstructionsBuilder createAppyActionInstruction37() {
2006 List<Action> actionList = new ArrayList<Action>();
2007 ActionBuilder ab = new ActionBuilder();
2008 ActionBuilder ab1 = new ActionBuilder();
2009 ActionBuilder ab2 = new ActionBuilder();
2011 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2012 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2013 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2015 IpMatchBuilder ipmatch = new IpMatchBuilder();
2016 IpMatchBuilder ipmatch1 = new IpMatchBuilder();
2017 IpMatchBuilder ipmatch2 = new IpMatchBuilder();
2018 Dscp dscp = new Dscp((short) 3);
2019 ipmatch.setIpDscp(dscp);
2020 ipmatch1.setIpEcn((short) 2);
2021 ipmatch2.setIpProtocol((short) 120);
2022 setFieldBuilder.setIpMatch(ipmatch.build());
2023 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2024 ab.setKey(new ActionKey(0));
2025 actionList.add(ab.build());
2027 setFieldBuilder1.setIpMatch(ipmatch1.build());
2028 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2029 ab1.setKey(new ActionKey(1));
2030 actionList.add(ab1.build());
2032 setFieldBuilder2.setIpMatch(ipmatch2.build());
2033 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2034 ab2.setKey(new ActionKey(2));
2035 actionList.add(ab2.build());
2037 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2038 aab.setAction(actionList);
2040 InstructionBuilder ib = new InstructionBuilder();
2041 ib.setKey(new InstructionKey(0));
2042 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2044 // Put our Instruction in a list of Instructions
2045 InstructionsBuilder isb = new InstructionsBuilder();
2046 List<Instruction> instructions = new ArrayList<Instruction>();
2047 instructions.add(ib.build());
2048 isb.setInstruction(instructions);
2052 private static InstructionsBuilder createAppyActionInstruction38() {
2054 List<Action> actionList = new ArrayList<Action>();
2055 ActionBuilder ab = new ActionBuilder();
2056 ActionBuilder ab1 = new ActionBuilder();
2058 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2059 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2061 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2062 Ipv4MatchBuilder ipv4Match1 = new Ipv4MatchBuilder();
2063 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.5210");
2064 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1");
2065 ipv4Match1.setIpv4Destination(dstip);
2066 ipv4Match.setIpv4Source(srcip);
2067 setFieldBuilder.setLayer3Match(ipv4Match.build());
2068 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2069 ab.setKey(new ActionKey(0));
2070 actionList.add(ab.build());
2072 setFieldBuilder1.setLayer3Match(ipv4Match1.build());
2073 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2074 ab1.setKey(new ActionKey(1));
2075 actionList.add(ab1.build());
2077 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2078 aab.setAction(actionList);
2080 InstructionBuilder ib = new InstructionBuilder();
2081 ib.setKey(new InstructionKey(0));
2082 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2084 // Put our Instruction in a list of Instructions
2085 InstructionsBuilder isb = new InstructionsBuilder();
2086 List<Instruction> instructions = new ArrayList<Instruction>();
2087 instructions.add(ib.build());
2088 isb.setInstruction(instructions);
2092 private static InstructionsBuilder createAppyActionInstruction39() {
2094 List<Action> actionList = new ArrayList<Action>();
2095 ActionBuilder ab = new ActionBuilder();
2096 ActionBuilder ab1 = new ActionBuilder();
2098 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2099 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2102 PortNumber tcpsrcport = new PortNumber(1213);
2103 PortNumber tcpdstport = new PortNumber(646);
2104 TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
2105 TcpMatchBuilder tcpmatch1 = new TcpMatchBuilder();
2106 tcpmatch.setTcpSourcePort(tcpsrcport);
2107 tcpmatch1.setTcpDestinationPort(tcpdstport);
2108 setFieldBuilder.setLayer4Match(tcpmatch.build());
2109 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2110 ab.setKey(new ActionKey(0));
2111 actionList.add(ab.build());
2113 setFieldBuilder1.setLayer4Match(tcpmatch1.build());
2114 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2115 ab1.setKey(new ActionKey(1));
2116 actionList.add(ab.build());
2118 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2119 aab.setAction(actionList);
2121 InstructionBuilder ib = new InstructionBuilder();
2122 ib.setKey(new InstructionKey(0));
2123 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2125 // Put our Instruction in a list of Instructions
2126 InstructionsBuilder isb = new InstructionsBuilder();
2127 List<Instruction> instructions = new ArrayList<Instruction>();
2128 instructions.add(ib.build());
2129 isb.setInstruction(instructions);
2133 private static InstructionsBuilder createAppyActionInstruction40() {
2135 List<Action> actionList = new ArrayList<Action>();
2136 ActionBuilder ab = new ActionBuilder();
2137 ActionBuilder ab1 = new ActionBuilder();
2139 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2140 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2143 PortNumber udpsrcport = new PortNumber(1325);
2144 PortNumber udpdstport = new PortNumber(42);
2145 UdpMatchBuilder udpmatch = new UdpMatchBuilder();
2146 UdpMatchBuilder udpmatch1 = new UdpMatchBuilder();
2147 udpmatch.setUdpDestinationPort(udpdstport);
2148 udpmatch1.setUdpSourcePort(udpsrcport);
2149 setFieldBuilder.setLayer4Match(udpmatch.build());
2150 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2151 ab.setKey(new ActionKey(0));
2152 actionList.add(ab.build());
2154 setFieldBuilder1.setLayer4Match(udpmatch1.build());
2155 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2156 ab1.setKey(new ActionKey(1));
2157 actionList.add(ab1.build());
2159 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2160 aab.setAction(actionList);
2162 InstructionBuilder ib = new InstructionBuilder();
2163 ib.setKey(new InstructionKey(0));
2164 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2166 // Put our Instruction in a list of Instructions
2167 InstructionsBuilder isb = new InstructionsBuilder();
2168 List<Instruction> instructions = new ArrayList<Instruction>();
2169 instructions.add(ib.build());
2170 isb.setInstruction(instructions);
2174 private static InstructionsBuilder createAppyActionInstruction41() {
2176 List<Action> actionList = new ArrayList<Action>();
2177 ActionBuilder ab = new ActionBuilder();
2178 ActionBuilder ab1 = new ActionBuilder();
2180 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2181 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2184 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
2185 SctpMatchBuilder sctpmatch1 = new SctpMatchBuilder();
2186 PortNumber srcport = new PortNumber(1435);
2187 PortNumber dstport = new PortNumber(22);
2188 sctpmatch.setSctpSourcePort(srcport);
2189 sctpmatch1.setSctpDestinationPort(dstport);
2190 setFieldBuilder.setLayer4Match(sctpmatch.build());
2191 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2192 ab.setKey(new ActionKey(0));
2193 actionList.add(ab.build());
2195 setFieldBuilder1.setLayer4Match(sctpmatch1.build());
2196 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2197 ab1.setKey(new ActionKey(1));
2198 actionList.add(ab1.build());
2200 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2201 aab.setAction(actionList);
2203 InstructionBuilder ib = new InstructionBuilder();
2204 ib.setKey(new InstructionKey(0));
2205 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2207 // Put our Instruction in a list of Instructions
2208 InstructionsBuilder isb = new InstructionsBuilder();
2209 List<Instruction> instructions = new ArrayList<Instruction>();
2210 instructions.add(ib.build());
2211 isb.setInstruction(instructions);
2215 private static InstructionsBuilder createAppyActionInstruction42() {
2217 List<Action> actionList = new ArrayList<Action>();
2218 ActionBuilder ab = new ActionBuilder();
2219 ActionBuilder ab1 = new ActionBuilder();
2220 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2221 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2224 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
2225 Icmpv4MatchBuilder icmpv4match1 = new Icmpv4MatchBuilder();
2226 icmpv4match.setIcmpv4Type((short) 8);
2227 icmpv4match1.setIcmpv4Code((short) 0);
2228 setFieldBuilder.setIcmpv4Match(icmpv4match.build());
2229 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2230 ab.setKey(new ActionKey(0));
2231 actionList.add(ab.build());
2233 setFieldBuilder1.setIcmpv4Match(icmpv4match1.build());
2234 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2235 ab1.setKey(new ActionKey(1));
2236 actionList.add(ab1.build());
2238 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2239 aab.setAction(actionList);
2241 InstructionBuilder ib = new InstructionBuilder();
2242 ib.setKey(new InstructionKey(0));
2243 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2245 // Put our Instruction in a list of Instructions
2246 InstructionsBuilder isb = new InstructionsBuilder();
2247 List<Instruction> instructions = new ArrayList<Instruction>();
2248 instructions.add(ib.build());
2249 isb.setInstruction(instructions);
2253 private static InstructionsBuilder createAppyActionInstruction43() {
2255 List<Action> actionList = new ArrayList<Action>();
2256 ActionBuilder ab = new ActionBuilder();
2257 ActionBuilder ab1 = new ActionBuilder();
2258 ActionBuilder ab2 = new ActionBuilder();
2259 ActionBuilder ab3 = new ActionBuilder();
2260 ActionBuilder ab4 = new ActionBuilder();
2262 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2263 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2264 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2265 SetFieldBuilder setFieldBuilder3 = new SetFieldBuilder();
2266 SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder();
2268 // setting the values of ARP
2269 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2270 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2271 Ipv4Prefix dstiparp = new Ipv4Prefix("200.71.9.52");
2272 Ipv4Prefix srciparp = new Ipv4Prefix("100.1.1.1");
2273 // create ARP match action
2274 ArpMatchBuilder arpmatch = new ArpMatchBuilder();
2275 ArpMatchBuilder arpmatch1 = new ArpMatchBuilder();
2276 ArpMatchBuilder arpmatch2 = new ArpMatchBuilder();
2277 ArpMatchBuilder arpmatch3 = new ArpMatchBuilder();
2278 ArpMatchBuilder arpmatch4 = new ArpMatchBuilder();
2279 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2280 arpsrc.setAddress(macsrc);
2281 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2282 arpdst.setAddress(macdest);
2283 arpmatch.setArpOp(2);
2284 arpmatch1.setArpSourceHardwareAddress(arpsrc.build());
2285 arpmatch2.setArpTargetHardwareAddress(arpdst.build());
2286 arpmatch3.setArpSourceTransportAddress(srciparp);
2287 arpmatch4.setArpTargetTransportAddress(dstiparp);
2288 setFieldBuilder.setLayer3Match(arpmatch.build());
2289 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2290 ab.setKey(new ActionKey(0));
2291 actionList.add(ab.build());
2293 setFieldBuilder1.setLayer3Match(arpmatch1.build());
2294 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2295 ab1.setKey(new ActionKey(1));
2296 actionList.add(ab1.build());
2298 setFieldBuilder2.setLayer3Match(arpmatch2.build());
2299 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2300 ab2.setKey(new ActionKey(2));
2301 actionList.add(ab2.build());
2303 setFieldBuilder3.setLayer3Match(arpmatch3.build());
2304 ab3.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2305 ab3.setKey(new ActionKey(3));
2306 actionList.add(ab3.build());
2308 setFieldBuilder4.setLayer3Match(arpmatch4.build());
2309 ab4.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2310 ab4.setKey(new ActionKey(4));
2311 actionList.add(ab4.build());
2313 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2314 aab.setAction(actionList);
2316 InstructionBuilder ib = new InstructionBuilder();
2317 ib.setKey(new InstructionKey(0));
2318 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2320 // Put our Instruction in a list of Instructions
2321 InstructionsBuilder isb = new InstructionsBuilder();
2322 List<Instruction> instructions = new ArrayList<Instruction>();
2323 instructions.add(ib.build());
2324 isb.setInstruction(instructions);
2328 private static InstructionsBuilder createAppyActionInstruction44() {
2330 List<Action> actionLists = new ArrayList<Action>();
2331 ActionBuilder ab = new ActionBuilder();
2332 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2333 ActionBuilder ab1 = new ActionBuilder();
2334 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2336 * ActionBuilder ab2 = new ActionBuilder(); SetFieldBuilder
2337 * setFieldBuilder2 = new SetFieldBuilder(); ActionBuilder ab3 = new
2338 * ActionBuilder(); SetFieldBuilder setFieldBuilder3 = new
2339 * SetFieldBuilder(); ActionBuilder ab4 = new ActionBuilder();
2340 * SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder();
2342 ActionBuilder ab5 = new ActionBuilder();
2343 SetFieldBuilder setFieldBuilder5 = new SetFieldBuilder();
2344 ActionBuilder ab6 = new ActionBuilder();
2345 SetFieldBuilder setFieldBuilder6 = new SetFieldBuilder();
2348 Ipv6MatchBuilder ipv6Builder = new Ipv6MatchBuilder();
2349 Ipv6MatchBuilder ipv6Builder1 = new Ipv6MatchBuilder();
2350 // Ipv6MatchBuilder ipv6Builder2 = new Ipv6MatchBuilder();
2351 // Ipv6MatchBuilder ipv6Builder3 = new Ipv6MatchBuilder();
2352 // Ipv6MatchBuilder ipv6Builder4 = new Ipv6MatchBuilder();
2353 Ipv6MatchBuilder ipv6Builder5 = new Ipv6MatchBuilder();
2354 Ipv6MatchBuilder ipv6Builder6 = new Ipv6MatchBuilder();
2356 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2");
2357 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1");
2358 // Ipv6Address ndtarget = new
2359 // Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
2360 // MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
2361 // MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
2362 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2363 nextheader.setIpv6Exthdr(58);
2364 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2365 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2366 ipv6label.setIpv6Flabel(label);
2368 ipv6Builder.setIpv6Source(srcip6);
2369 ipv6Builder1.setIpv6Destination(dstip6);
2370 // ipv6Builder2.setIpv6NdTarget(ndtarget);
2371 // ipv6Builder3.setIpv6NdSll(ndsll);
2372 // ipv6Builder4.setIpv6NdTll(ndtll);
2373 ipv6Builder5.setIpv6ExtHeader(nextheader.build());
2374 ipv6Builder6.setIpv6Label(ipv6label.build());
2376 setFieldBuilder.setLayer3Match(ipv6Builder.build());
2377 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2378 ab.setKey(new ActionKey(0));
2379 actionLists.add(ab.build());
2381 setFieldBuilder1.setLayer3Match(ipv6Builder1.build());
2382 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2383 ab1.setKey(new ActionKey(1));
2384 actionLists.add(ab1.build());
2387 * setFieldBuilder2.setLayer3Match(ipv6Builder2.build());
2389 * SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2390 * ab2.setKey(new ActionKey(2)); actionLists.add(ab2.build());
2392 * setFieldBuilder3.setLayer3Match(ipv6Builder3.build());
2394 * SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2395 * ab3.setKey(new ActionKey(3)); actionLists.add(ab3.build());
2397 * setFieldBuilder4.setLayer3Match(ipv6Builder4.build());
2399 * SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2400 * ab4.setKey(new ActionKey(4)); actionLists.add(ab4.build());
2402 setFieldBuilder5.setLayer3Match(ipv6Builder5.build());
2403 ab5.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder5.build()).build());
2404 ab5.setKey(new ActionKey(5));
2405 actionLists.add(ab5.build());
2407 setFieldBuilder6.setLayer3Match(ipv6Builder6.build());
2408 ab6.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder6.build()).build());
2409 ab6.setKey(new ActionKey(6));
2410 actionLists.add(ab6.build());
2412 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2413 aab.setAction(actionLists);
2415 InstructionBuilder ib = new InstructionBuilder();
2416 ib.setKey(new InstructionKey(0));
2417 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2419 // Put our Instruction in a list of Instructions
2420 InstructionsBuilder isb = new InstructionsBuilder();
2421 List<Instruction> instructions = new ArrayList<Instruction>();
2422 instructions.add(ib.build());
2423 isb.setInstruction(instructions);
2427 private static InstructionsBuilder createAppyActionInstruction45() {
2429 List<Action> actionList = new ArrayList<Action>();
2430 ActionBuilder ab = new ActionBuilder();
2431 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2432 ActionBuilder ab1 = new ActionBuilder();
2433 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2436 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
2437 Icmpv6MatchBuilder icmpv6match1 = new Icmpv6MatchBuilder();
2438 icmpv6match.setIcmpv6Type((short) 135);
2439 icmpv6match1.setIcmpv6Code((short) 0);
2440 setFieldBuilder.setIcmpv6Match(icmpv6match.build());
2441 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2442 ab.setKey(new ActionKey(0));
2443 actionList.add(ab.build());
2445 setFieldBuilder1.setIcmpv6Match(icmpv6match1.build());
2446 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2447 ab1.setKey(new ActionKey(1));
2448 actionList.add(ab1.build());
2450 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2451 aab.setAction(actionList);
2453 InstructionBuilder ib = new InstructionBuilder();
2454 ib.setKey(new InstructionKey(0));
2455 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2457 // Put our Instruction in a list of Instructions
2458 InstructionsBuilder isb = new InstructionsBuilder();
2459 List<Instruction> instructions = new ArrayList<Instruction>();
2460 instructions.add(ib.build());
2461 isb.setInstruction(instructions);
2465 private static InstructionsBuilder createAppyActionInstruction46() {
2467 List<Action> actionList = new ArrayList<Action>();
2468 ActionBuilder ab = new ActionBuilder();
2469 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2470 ActionBuilder ab1 = new ActionBuilder();
2471 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2472 ActionBuilder ab2 = new ActionBuilder();
2473 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2476 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2477 ProtocolMatchFieldsBuilder protomatch1 = new ProtocolMatchFieldsBuilder();
2478 ProtocolMatchFieldsBuilder protomatch2 = new ProtocolMatchFieldsBuilder();
2479 protomatch.setMplsLabel((long) 36008);
2480 protomatch1.setMplsTc((short) 4);
2481 protomatch2.setMplsBos((short) 1);
2482 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2483 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2484 ab.setKey(new ActionKey(0));
2485 actionList.add(ab.build());
2487 setFieldBuilder1.setProtocolMatchFields(protomatch1.build());
2488 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2489 ab1.setKey(new ActionKey(1));
2490 actionList.add(ab1.build());
2492 setFieldBuilder2.setProtocolMatchFields(protomatch2.build());
2493 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2494 ab2.setKey(new ActionKey(2));
2495 actionList.add(ab2.build());
2497 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2498 aab.setAction(actionList);
2500 InstructionBuilder ib = new InstructionBuilder();
2501 ib.setKey(new InstructionKey(0));
2502 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2504 // Put our Instruction in a list of Instructions
2505 InstructionsBuilder isb = new InstructionsBuilder();
2506 List<Instruction> instructions = new ArrayList<Instruction>();
2507 instructions.add(ib.build());
2508 isb.setInstruction(instructions);
2512 private static InstructionsBuilder createAppyActionInstruction47() {
2514 List<Action> actionList = new ArrayList<Action>();
2515 ActionBuilder ab = new ActionBuilder();
2516 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2518 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2519 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask((new BigInteger(new byte[] { 0, 1, 0, 0 }).longValue())).build());
2520 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2521 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2522 actionList.add(ab.build());
2524 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2525 aab.setAction(actionList);
2527 InstructionBuilder ib = new InstructionBuilder();
2528 ib.setKey(new InstructionKey(0));
2529 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2531 // Put our Instruction in a list of Instructions
2532 InstructionsBuilder isb = new InstructionsBuilder();
2533 List<Instruction> instructions = new ArrayList<Instruction>();
2534 instructions.add(ib.build());
2535 isb.setInstruction(instructions);
2539 private static InstructionsBuilder createAppyActionInstruction48() {
2541 List<Action> actionList = new ArrayList<Action>();
2542 ActionBuilder ab = new ActionBuilder();
2543 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2545 TunnelBuilder tunnel = new TunnelBuilder();
2546 tunnel.setTunnelId(BigInteger.valueOf(10668));
2547 setFieldBuilder.setTunnel(tunnel.build());
2548 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2549 actionList.add(ab.build());
2551 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2552 aab.setAction(actionList);
2554 InstructionBuilder ib = new InstructionBuilder();
2555 ib.setKey(new InstructionKey(0));
2556 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2558 // Put our Instruction in a list of Instructions
2559 InstructionsBuilder isb = new InstructionsBuilder();
2560 List<Instruction> instructions = new ArrayList<Instruction>();
2561 instructions.add(ib.build());
2562 isb.setInstruction(instructions);
2566 private static MatchBuilder createLLDPMatch() {
2567 MatchBuilder match = new MatchBuilder();
2568 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2569 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2570 ethTypeBuilder.setType(new EtherType(0x88ccL));
2571 eth.setEthernetType(ethTypeBuilder.build());
2572 match.setEthernetMatch(eth.build());
2579 private static MatchBuilder createMatch1() {
2580 MatchBuilder match = new MatchBuilder();
2581 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2582 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2583 ipv4Match.setIpv4Destination(prefix);
2584 Ipv4Match i4m = ipv4Match.build();
2585 match.setLayer3Match(i4m);
2587 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2588 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2589 ethTypeBuilder.setType(new EtherType(0x0800L));
2590 eth.setEthernetType(ethTypeBuilder.build());
2591 match.setEthernetMatch(eth.build());
2598 private static MatchBuilder createIPv4DstMatch() {
2599 MatchBuilder match = new MatchBuilder();
2600 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2601 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2602 ipv4Match.setIpv4Destination(prefix);
2603 Ipv4Match i4m = ipv4Match.build();
2604 match.setLayer3Match(i4m);
2612 private static MatchBuilder createIPv4SrcMatch() {
2613 MatchBuilder match = new MatchBuilder();
2614 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2615 Ipv4Prefix prefix = new Ipv4Prefix("10.20.30.40/24");
2616 ipv4Match.setIpv4Source(prefix);
2617 Ipv4Match i4m = ipv4Match.build();
2618 match.setLayer3Match(i4m);
2620 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2621 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2622 ethTypeBuilder.setType(new EtherType(0x0800L));
2623 eth.setEthernetType(ethTypeBuilder.build());
2624 match.setEthernetMatch(eth.build());
2631 private static MatchBuilder createMatch2() {
2632 MatchBuilder match = new MatchBuilder();
2633 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2634 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1");
2635 ipv4Match.setIpv4Source(prefix);
2636 Ipv4Match i4m = ipv4Match.build();
2637 match.setLayer3Match(i4m);
2639 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2640 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2641 ethTypeBuilder.setType(new EtherType(0x0800L));
2642 eth.setEthernetType(ethTypeBuilder.build());
2643 match.setEthernetMatch(eth.build());
2650 private static MatchBuilder createMatch3() {
2651 MatchBuilder match = new MatchBuilder();
2652 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
2653 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
2654 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
2655 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
2656 match.setEthernetMatch(ethernetMatch.build());
2664 private static MatchBuilder createICMPv6Match1() {
2666 MatchBuilder match = new MatchBuilder();
2667 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2668 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2669 ethTypeBuilder.setType(new EtherType(0x86ddL));
2670 eth.setEthernetType(ethTypeBuilder.build());
2671 match.setEthernetMatch(eth.build());
2673 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2674 ipmatch.setIpProtocol((short) 256);
2675 match.setIpMatch(ipmatch.build());
2677 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2679 icmpv6match.setIcmpv6Type((short) 135);
2680 icmpv6match.setIcmpv6Code((short) 1);
2681 match.setIcmpv6Match(icmpv6match.build());
2686 private static MatchBuilder createMatch33() {
2688 MatchBuilder match = new MatchBuilder();
2689 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2690 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.10");
2691 ipv4Match.setIpv4Source(prefix);
2692 Ipv4Match i4m = ipv4Match.build();
2693 match.setLayer3Match(i4m);
2695 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2696 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2697 ethTypeBuilder.setType(new EtherType(0xfffeL));
2698 eth.setEthernetType(ethTypeBuilder.build());
2699 match.setEthernetMatch(eth.build());
2703 private static MatchBuilder createInphyportMatch(NodeId nodeId) {
2704 MatchBuilder match = new MatchBuilder();
2705 match.setInPort(new NodeConnectorId(nodeId + ":202"));
2706 match.setInPhyPort(new NodeConnectorId(nodeId + ":10122"));
2710 private static MatchBuilder createEthernetMatch() {
2711 MatchBuilder match = new MatchBuilder();
2713 byte[] mask1 = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2714 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2716 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
2718 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2719 EtherType type = new EtherType(0x0800L);
2720 ethmatch.setEthernetType(ethtype.setType(type).build());
2722 EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet
2725 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2726 ethdest.setAddress(macdest);
2727 ethdest.setMask(new MacAddress("ff:ff:ff:00:00:00"));
2729 ethmatch.setEthernetDestination(ethdest.build());
2731 EthernetSourceBuilder ethsrc = new EthernetSourceBuilder();
2732 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2733 ethsrc.setAddress(macsrc);
2734 ethsrc.setMask(new MacAddress("ff:ff:00:00:00:00"));
2736 ethmatch.setEthernetSource(ethsrc.build());
2737 match.setEthernetMatch(ethmatch.build());
2746 private static MatchBuilder createVlanMatch() {
2747 MatchBuilder match = new MatchBuilder();
2748 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder(); // vlan match
2749 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
2750 VlanId vlanId = new VlanId(10);
2751 VlanPcp vpcp = new VlanPcp((short) 3);
2752 vlanBuilder.setVlanPcp(vpcp);
2753 vlanIdBuilder.setVlanId(vlanId);
2754 vlanIdBuilder.setVlanIdPresent(true);
2755 vlanBuilder.setVlanId(vlanIdBuilder.build());
2756 match.setVlanMatch(vlanBuilder.build());
2763 private static MatchBuilder createArpMatch() {
2764 MatchBuilder match = new MatchBuilder();
2766 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2767 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2768 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2770 byte[] mask = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2771 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2773 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2774 EtherType type = new EtherType(0x0806L);
2775 ethmatch.setEthernetType(ethtype.setType(type).build());
2777 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
2778 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2780 ArpMatchBuilder arpmatch = new ArpMatchBuilder(); // arp match
2781 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2782 arpsrc.setAddress(macsrc);
2783 arpsrc.setMask(new MacAddress("ff:ff:ff:00:00:00"));
2784 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2785 arpdst.setAddress(macdest);
2786 arpdst.setMask(new MacAddress("ff:ff:00:00:00:00"));
2787 arpmatch.setArpOp(2);
2788 arpmatch.setArpSourceHardwareAddress(arpsrc.build());
2789 arpmatch.setArpTargetHardwareAddress(arpdst.build());
2790 arpmatch.setArpSourceTransportAddress(srcip);
2791 arpmatch.setArpTargetTransportAddress(dstip);
2793 match.setEthernetMatch(ethmatch.build());
2794 match.setLayer3Match(arpmatch.build());
2802 private static MatchBuilder createIPMatch() {
2803 MatchBuilder match = new MatchBuilder();
2804 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2805 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2806 EtherType type = new EtherType(0x0800L);
2807 ethmatch.setEthernetType(ethtype.setType(type).build());
2808 match.setEthernetMatch(ethmatch.build());
2810 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2811 ipmatch.setIpProtocol((short) 1);
2812 Dscp dscp = new Dscp((short) 3);
2813 ipmatch.setIpDscp(dscp);
2814 ipmatch.setIpEcn((short) 2);
2815 match.setIpMatch(ipmatch.build());
2822 private static MatchBuilder createL3IPv4Match() {
2823 MatchBuilder match = new MatchBuilder();
2825 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2826 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2827 ethTypeBuilder.setType(new EtherType(0x0800L));
2828 eth.setEthernetType(ethTypeBuilder.build());
2829 match.setEthernetMatch(eth.build());
2831 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2832 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
2833 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2834 Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
2835 ipv4match.setIpv4Destination(dstip);
2836 ipv4match.setIpv4Source(srcip);
2837 match.setLayer3Match(ipv4match.build());
2846 private static MatchBuilder createL3IPv6Match() {
2847 MatchBuilder match = new MatchBuilder();
2849 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2850 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2851 ethTypeBuilder.setType(new EtherType(0x86ddL));
2852 eth.setEthernetType(ethTypeBuilder.build());
2853 match.setEthernetMatch(eth.build());
2855 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2/64");
2856 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1/56");
2857 Ipv6Address ndtarget = new Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
2858 MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
2859 MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
2860 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2861 nextheader.setIpv6Exthdr(58);
2862 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2863 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2864 ipv6label.setIpv6Flabel(label);
2865 ipv6label.setFlabelMask(new Ipv6FlowLabel(1L));
2867 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2869 icmpv6match.setIcmpv6Type((short) 135);
2870 icmpv6match.setIcmpv6Code((short) 0);
2871 match.setIcmpv6Match(icmpv6match.build());
2873 Ipv6MatchBuilder ipv6match = new Ipv6MatchBuilder();
2874 // ipv6match.setIpv6Source(srcip6);
2875 // ipv6match.setIpv6Destination(dstip6);
2876 // ipv6match.setIpv6ExtHeader(nextheader.build());
2877 ipv6match.setIpv6NdSll(ndsll);
2878 ipv6match.setIpv6NdTll(ndtll);
2879 // ipv6match.setIpv6NdTarget(ndtarget);
2880 ipv6match.setIpv6Label(ipv6label.build());
2882 match.setLayer3Match(ipv6match.build());
2891 private static MatchBuilder createICMPv4Match() {
2892 MatchBuilder match = new MatchBuilder();
2893 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2894 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2895 ethTypeBuilder.setType(new EtherType(0x0800L));
2896 eth.setEthernetType(ethTypeBuilder.build());
2897 match.setEthernetMatch(eth.build());
2899 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2900 ipmatch.setIpProtocol((short) 1);
2901 match.setIpMatch(ipmatch.build());
2903 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder(); // icmpv4
2905 icmpv4match.setIcmpv4Type((short) 8);
2906 icmpv4match.setIcmpv4Code((short) 0);
2907 match.setIcmpv4Match(icmpv4match.build());
2914 private static MatchBuilder createICMPv6Match() {
2916 MatchBuilder match = new MatchBuilder();
2917 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2918 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2919 ethTypeBuilder.setType(new EtherType(0x86ddL));
2920 eth.setEthernetType(ethTypeBuilder.build());
2921 match.setEthernetMatch(eth.build());
2923 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2924 ipmatch.setIpProtocol((short) 58);
2925 match.setIpMatch(ipmatch.build());
2927 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2929 icmpv6match.setIcmpv6Type((short) 135);
2930 icmpv6match.setIcmpv6Code((short) 1);
2931 match.setIcmpv6Match(icmpv6match.build());
2939 private static MatchBuilder createToSMatch() {
2940 MatchBuilder match = new MatchBuilder();
2941 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2942 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2943 EtherType type = new EtherType(0x0800L);
2944 ethmatch.setEthernetType(ethtype.setType(type).build());
2945 match.setEthernetMatch(ethmatch.build());
2947 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2948 ipmatch.setIpProtocol((short) 6);
2949 Dscp dscp = new Dscp((short) 8);
2950 ipmatch.setIpDscp(dscp);
2951 match.setIpMatch(ipmatch.build());
2959 private static MatchBuilder createL4TCPMatch() {
2960 MatchBuilder match = new MatchBuilder();
2962 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2963 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2964 ethTypeBuilder.setType(new EtherType(0x0800L));
2965 eth.setEthernetType(ethTypeBuilder.build());
2966 match.setEthernetMatch(eth.build());
2968 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2969 ipmatch.setIpProtocol((short) 6);
2970 match.setIpMatch(ipmatch.build());
2972 PortNumber srcport = new PortNumber(1213);
2973 PortNumber dstport = new PortNumber(646);
2974 TcpMatchBuilder tcpmatch = new TcpMatchBuilder(); // tcp match
2975 tcpmatch.setTcpSourcePort(srcport);
2976 tcpmatch.setTcpDestinationPort(dstport);
2977 match.setLayer4Match(tcpmatch.build());
2985 private static MatchBuilder createL4UDPMatch() {
2986 MatchBuilder match = new MatchBuilder();
2988 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2989 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2990 ethTypeBuilder.setType(new EtherType(0x0800L));
2991 eth.setEthernetType(ethTypeBuilder.build());
2992 match.setEthernetMatch(eth.build());
2994 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2995 ipmatch.setIpProtocol((short) 17);
2996 match.setIpMatch(ipmatch.build());
2998 PortNumber srcport = new PortNumber(1325);
2999 PortNumber dstport = new PortNumber(42);
3000 UdpMatchBuilder udpmatch = new UdpMatchBuilder(); // udp match
3001 udpmatch.setUdpDestinationPort(dstport);
3002 udpmatch.setUdpSourcePort(srcport);
3003 match.setLayer4Match(udpmatch.build());
3011 private static MatchBuilder createL4SCTPMatch() {
3012 MatchBuilder match = new MatchBuilder();
3014 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3015 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3016 ethTypeBuilder.setType(new EtherType(0x0800L));
3017 eth.setEthernetType(ethTypeBuilder.build());
3018 match.setEthernetMatch(eth.build());
3020 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3021 ipmatch.setIpProtocol((short) 132);
3022 match.setIpMatch(ipmatch.build());
3024 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
3025 PortNumber srcport = new PortNumber(1435);
3026 PortNumber dstport = new PortNumber(22);
3027 sctpmatch.setSctpSourcePort(srcport);
3028 sctpmatch.setSctpDestinationPort(dstport);
3029 match.setLayer4Match(sctpmatch.build());
3037 private static MatchBuilder createMetadataMatch() {
3038 MatchBuilder match = new MatchBuilder();
3039 byte[] metamask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
3040 MetadataBuilder metadata = new MetadataBuilder(); // metadata match
3041 metadata.setMetadata(BigInteger.valueOf(500L));
3042 metadata.setMetadataMask(new BigInteger(metamask));
3043 match.setMetadata(metadata.build());
3051 private static MatchBuilder createMplsMatch() {
3052 MatchBuilder match = new MatchBuilder();
3054 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3055 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3056 ethTypeBuilder.setType(new EtherType(0x8847L));
3057 eth.setEthernetType(ethTypeBuilder.build());
3058 match.setEthernetMatch(eth.build());
3060 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3062 protomatch.setMplsLabel((long) 36008);
3063 protomatch.setMplsTc((short) 4);
3064 protomatch.setMplsBos((short) 1);
3065 match.setProtocolMatchFields(protomatch.build());
3074 private static MatchBuilder createPbbMatch() {
3075 MatchBuilder match = new MatchBuilder();
3077 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3078 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3079 ethTypeBuilder.setType(new EtherType(0x88E7L));
3080 eth.setEthernetType(ethTypeBuilder.build());
3081 match.setEthernetMatch(eth.build());
3083 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3085 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new BigInteger(new byte[] { 0, 1, 0, 0 }).longValue()).build());
3086 match.setProtocolMatchFields(protomatch.build());
3095 private static MatchBuilder createTunnelIDMatch() {
3096 MatchBuilder match = new MatchBuilder();
3097 TunnelBuilder tunnel = new TunnelBuilder(); // tunnel id match
3098 tunnel.setTunnelId(BigInteger.valueOf(10668));
3099 byte[] mask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
3100 tunnel.setTunnelMask(new BigInteger(mask));
3101 match.setTunnel(tunnel.build());
3106 public void _removeMDFlow(CommandInterpreter ci) {
3107 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
3108 NodeBuilder tn = createTestNode(ci.nextArgument());
3109 String flowtype = ci.nextArgument();
3111 if (flowtype.equals("fTM")) {
3112 tf = createtablemiss(tn, flowtype, ci.nextArgument());
3114 tf = createTestFlow(tn, flowtype, ci.nextArgument());
3116 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class).child(Node.class, tn.getKey())
3117 .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf.getTableId()))
3118 .child(Flow.class, tf.getKey()).build();
3119 modification.removeConfigurationData(path1);
3120 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
3122 RpcResult<TransactionStatus> result = commitFuture.get();
3123 TransactionStatus status = result.getResult();
3124 ci.println("Status of Flow Data Loaded Transaction: " + status);
3126 } catch (InterruptedException e) {
3127 LOG.error(e.getMessage(), e);
3128 } catch (ExecutionException e) {
3129 LOG.error(e.getMessage(), e);
3134 * @param ci arguments: switchId flowType tableNum
3137 * e.g.: addMDFlow openflow:1 f1 42
3140 public void _addMDFlow(CommandInterpreter ci) {
3141 NodeBuilder tn = createTestNode(ci.nextArgument());
3142 String flowtype = ci.nextArgument();
3144 if (flowtype.equals("fTM")) {
3145 tf = createtablemiss(tn, flowtype, ci.nextArgument());
3147 tf = createTestFlow(tn, flowtype, ci.nextArgument());
3149 writeFlow(ci, tf, tn);
3152 private void writeFlow(CommandInterpreter ci, FlowBuilder flow, NodeBuilder nodeBuilder) {
3153 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
3154 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class)
3155 .child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
3156 .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.getKey()).build();
3157 modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
3158 modification.putConfigurationData(path1, flow.build());
3159 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
3161 RpcResult<TransactionStatus> result = commitFuture.get();
3162 TransactionStatus status = result.getResult();
3163 ci.println("Status of Flow Data Loaded Transaction: " + status);
3165 } catch (InterruptedException e) {
3166 LOG.error(e.getMessage(), e);
3167 } catch (ExecutionException e) {
3168 LOG.error(e.getMessage(), e);
3172 public void _modifyMDFlow(CommandInterpreter ci) {
3173 NodeBuilder tn = createTestNode(ci.nextArgument());
3174 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
3175 tf.setFlowName(updatedFlowName);
3176 writeFlow(ci, tf, tn);
3177 tf.setFlowName(originalFlowName);
3178 writeFlow(ci, tf, tn);
3181 private static NodeRef createNodeRef(String string) {
3182 NodeKey key = new NodeKey(new NodeId(string));
3183 InstanceIdentifier<Node> path = InstanceIdentifier.builder().node(Nodes.class).node(Node.class, key)
3186 return new NodeRef(path);
3190 public String getHelp() {