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.flow.InstructionsBuilder;
127 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
128 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
129 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCaseBuilder;
130 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCaseBuilder;
131 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCaseBuilder;
132 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
133 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.go.to.table._case.GoToTableBuilder;
134 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.meter._case.MeterBuilder;
135 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.metadata._case.WriteMetadataBuilder;
136 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
137 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
138 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
139 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemoved;
140 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated;
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.NodeRemoved;
144 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated;
145 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
146 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.OpendaylightInventoryListener;
147 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
148 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
149 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
150 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
151 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
152 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
153 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
154 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddressBuilder;
155 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpTargetHardwareAddressBuilder;
156 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
157 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder;
158 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
159 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6ExtHeaderBuilder;
160 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6LabelBuilder;
161 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
162 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder;
163 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder;
164 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
165 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.MetadataBuilder;
166 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder;
167 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TunnelBuilder;
168 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
169 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder;
170 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match;
171 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
172 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
173 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder;
174 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
175 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
176 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.protocol.match.fields.PbbBuilder;
177 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
178 import org.opendaylight.yangtools.concepts.Registration;
179 import org.opendaylight.yangtools.yang.binding.DataObject;
180 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
181 import org.opendaylight.yangtools.yang.common.RpcResult;
182 import org.osgi.framework.BundleContext;
183 import org.slf4j.Logger;
184 import org.slf4j.LoggerFactory;
186 public class OpenflowpluginTestCommandProvider implements CommandProvider {
188 private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
190 private DataBrokerService dataBrokerService;
191 private ProviderContext pc;
192 private final BundleContext ctx;
193 private FlowBuilder testFlow;
194 private NodeBuilder testNode;
195 private final String originalFlowName = "Foo";
196 private final String updatedFlowName = "Bar";
197 private final FlowEventListener flowEventListener = new FlowEventListener();
198 private final PortEventListener portEventListener = new PortEventListener();
199 private static NotificationService notificationService;
200 private Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> listener1Reg;
201 private Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> listener2Reg;
203 public OpenflowpluginTestCommandProvider(BundleContext ctx) {
207 public void onSessionInitiated(ProviderContext session) {
209 notificationService = session.getSALService(NotificationService.class);
211 listener1Reg = notificationService.registerNotificationListener(flowEventListener);
212 listener2Reg = notificationService.registerNotificationListener(portEventListener);
213 dataBrokerService = session.getSALService(DataBrokerService.class);
214 ctx.registerService(CommandProvider.class.getName(), this, null);
215 createTestFlow(createTestNode(null), null, null);
218 private NodeBuilder createTestNode(String nodeId) {
219 if (nodeId == null) {
220 nodeId = OpenflowpluginTestActivator.NODE_ID;
222 NodeRef nodeOne = createNodeRef(nodeId);
223 NodeBuilder builder = new NodeBuilder();
224 builder.setId(new NodeId(nodeId));
225 builder.setKey(new NodeKey(builder.getId()));
230 final class FlowEventListener implements SalFlowListener {
232 List<FlowAdded> addedFlows = new ArrayList<>();
233 List<FlowRemoved> removedFlows = new ArrayList<>();
234 List<FlowUpdated> updatedFlows = new ArrayList<>();
237 public void onFlowAdded(FlowAdded notification) {
238 System.out.println("flow to be added.........................." + notification.toString());
239 System.out.println("added flow Xid........................." + notification.getTransactionId().getValue());
240 System.out.println("-----------------------------------------------------------------------------------");
241 addedFlows.add(notification);
245 public void onFlowRemoved(FlowRemoved notification) {
246 System.out.println("removed flow.........................." + notification.toString());
247 System.out.println("remove flow Xid........................." + notification.getTransactionId().getValue());
248 System.out.println("-----------------------------------------------------------------------------------");
249 removedFlows.add(notification);
253 public void onFlowUpdated(FlowUpdated notification) {
254 System.out.println("updated flow.........................." + notification.toString());
256 .println("updated flow Xid........................." + notification.getTransactionId().getValue());
257 System.out.println("-----------------------------------------------------------------------------------");
258 updatedFlows.add(notification);
262 public void onNodeErrorNotification(NodeErrorNotification notification) {
263 System.out.println("Error notification flow Xid........................."
264 + notification.getTransactionId().getValue());
265 System.out.println("-----------------------------------------------------------------------------------");
269 public void onNodeExperimenterErrorNotification(NodeExperimenterErrorNotification notification) {
270 // TODO Auto-generated method stub
275 public void onSwitchFlowRemoved(SwitchFlowRemoved notification) {
277 .println("Switch flow removed : Cookies..................." + notification.getCookie().toString());
278 System.out.println("-----------------------------------------------------------------------------------");
283 final class PortEventListener implements OpendaylightInventoryListener {
285 List<NodeUpdated> nodeUpdated = new ArrayList<>();
286 List<NodeRemoved> nodeRemoved = new ArrayList<>();
287 List<NodeConnectorUpdated> nodeConnectorUpdated = new ArrayList<>();
288 List<NodeConnectorRemoved> nodeConnectorRemoved = new ArrayList<>();
291 public void onNodeConnectorRemoved(NodeConnectorRemoved notification) {
292 System.out.println("NodeConnectorRemoved Notification ...................");
293 System.out.println(notification.getNodeConnectorRef());
294 System.out.println("----------------------------------------------------------------------");
295 nodeConnectorRemoved.add(notification);
299 public void onNodeConnectorUpdated(NodeConnectorUpdated notification) {
300 System.out.println("NodeConnectorUpdated Notification...................");
301 System.out.println(notification.getNodeConnectorRef());
302 System.out.println("----------------------------------------------------------------------");
303 nodeConnectorUpdated.add(notification);
307 public void onNodeRemoved(NodeRemoved notification) {
308 System.out.println("NodeConnectorUpdated Notification ...................");
309 System.out.println(notification.getNodeRef());
310 System.out.println("----------------------------------------------------------------------");
311 nodeRemoved.add(notification);
315 public void onNodeUpdated(NodeUpdated notification) {
316 System.out.println("NodeConnectorUpdated Notification ...................");
317 System.out.println(notification.getNodeRef());
318 System.out.println("----------------------------------------------------------------------");
319 nodeUpdated.add(notification);
323 private InstanceIdentifier<Node> nodeBuilderToInstanceId(NodeBuilder node) {
324 return InstanceIdentifier.builder(Nodes.class).child(Node.class, node.getKey()).toInstance();
327 private FlowBuilder createTestFlow(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
329 FlowBuilder flow = new FlowBuilder();
332 String flowType = flowTypeArg;
333 if (flowType == null) {
340 flow.setMatch(createMatch1().build());
341 flow.setInstructions(createDecNwTtlInstructions().build());
345 flow.setMatch(createMatch2().build());
346 flow.setInstructions(createDropInstructions().build());
350 flow.setMatch(createMatch3().build());
351 flow.setInstructions(createDropInstructions().build());
355 flow.setMatch(createEthernetMatch().build());
356 flow.setInstructions(createDropInstructions().build());
360 flow.setMatch(createMatch1().build());
361 flow.setInstructions(createAppyActionInstruction().build());
365 flow.setMatch(createMatch1().build());
366 flow.setInstructions(createGotoTableInstructions().build());
370 flow.setMatch(createMatch1().build());
371 flow.setInstructions(createMeterInstructions().build());
375 flow.setMatch(createMatch1().build());
376 flow.setInstructions(createAppyActionInstruction1().build());
380 flow.setMatch(createMatch1().build());
381 flow.setInstructions(createAppyActionInstruction2().build());
385 flow.setMatch(createMatch1().build());
386 flow.setInstructions(createAppyActionInstruction3().build());
390 flow.setMatch(createMatch1().build());
391 flow.setInstructions(createAppyActionInstruction4().build());
395 flow.setMatch(createMatch1().build());
396 flow.setInstructions(createAppyActionInstruction5().build());
400 flow.setMatch(createMatch1().build());
401 flow.setInstructions(createAppyActionInstruction6().build());
405 flow.setMatch(createMatch1().build());
406 flow.setInstructions(createAppyActionInstruction7().build());
410 flow.setMatch(createMatch1().build());
411 flow.setInstructions(createAppyActionInstruction8().build());
415 flow.setMatch(createMatch1().build());
416 flow.setInstructions(createAppyActionInstruction9().build());
420 flow.setMatch(createMatch1().build());
421 flow.setInstructions(createAppyActionInstruction10().build());
425 flow.setMatch(createMatch1().build());
426 flow.setInstructions(createAppyActionInstruction11().build());
430 flow.setMatch(createMatch1().build());
431 flow.setInstructions(createAppyActionInstruction12().build());
435 flow.setMatch(createMatch1().build());
436 flow.setInstructions(createAppyActionInstruction13().build());
440 flow.setMatch(createMatch1().build());
441 flow.setInstructions(createAppyActionInstruction14().build());
445 flow.setMatch(createMatch1().build());
446 flow.setInstructions(createAppyActionInstruction15().build());
450 flow.setMatch(createMatch1().build());
451 flow.setInstructions(createAppyActionInstruction16().build());
455 flow.setMatch(createMatch1().build());
456 flow.setInstructions(createAppyActionInstruction17().build());
460 flow.setMatch(createMatch1().build());
461 flow.setInstructions(createAppyActionInstruction18().build());
465 flow.setMatch(createMatch1().build());
466 flow.setInstructions(createAppyActionInstruction19().build());
470 flow.setMatch(createMatch1().build());
471 flow.setInstructions(createMetadataInstructions().build());
475 flow.setMatch(createMatch1().build());
476 flow.setInstructions(createAppyActionInstruction20().build());
480 flow.setMatch(createMatch1().build());
481 flow.setInstructions(createAppyActionInstruction21().build());
485 flow.setMatch(createMatch1().build());
486 flow.setInstructions(createAppyActionInstruction22().build());
490 flow.setMatch(createMatch1().build());
491 flow.setInstructions(createAppyActionInstruction23().build());
495 flow.setMatch(createMatch1().build());
496 flow.setInstructions(createAppyActionInstruction24().build());
500 flow.setMatch(createMatch1().build());
501 flow.setInstructions(createAppyActionInstruction25().build());
505 flow.setMatch(createMatch1().build());
506 flow.setInstructions(createAppyActionInstruction26().build());
510 flow.setMatch(createMatch1().build());
511 flow.setInstructions(createAppyActionInstruction27().build());
515 flow.setMatch(createMatch1().build());
516 flow.setInstructions(createAppyActionInstruction28().build());
520 flow.setMatch(createMatch1().build());
521 flow.setInstructions(createAppyActionInstruction29().build());
525 flow.setMatch(createMatch1().build());
526 flow.setInstructions(createAppyActionInstruction30().build());
530 flow.setMatch(createMatch1().build());
531 flow.setInstructions(createAppyActionInstruction31().build());
535 flow.setMatch(createMatch1().build());
536 flow.setInstructions(createAppyActionInstruction32().build());
540 flow.setMatch(createMatch1().build());
541 flow.setInstructions(createAppyActionInstruction33().build());
545 flow.setMatch(createMatch1().build());
546 flow.setInstructions(createAppyActionInstruction34().build());
550 flow.setMatch(createICMPv6Match().build());
551 flow.setInstructions(createDecNwTtlInstructions().build());
555 flow.setMatch(createInphyportMatch().build());
556 flow.setInstructions(createDropInstructions().build());
560 flow.setMatch(createMetadataMatch().build());
561 flow.setInstructions(createDropInstructions().build());
565 flow.setMatch(createL3IPv6Match().build());
566 flow.setInstructions(createDecNwTtlInstructions().build());
570 flow.setMatch(createL4SCTPMatch().build());
571 flow.setInstructions(createAppyActionInstruction().build());
575 flow.setMatch(createTunnelIDMatch().build());
576 flow.setInstructions(createGotoTableInstructions().build());
580 flow.setMatch(createVlanMatch().build());
581 flow.setInstructions(createMeterInstructions().build());
585 flow.setMatch(createPbbMatch().build());
586 flow.setInstructions(createMeterInstructions().build());
590 flow.setMatch(createVlanMatch().build());
591 flow.setInstructions(createDropInstructions().build());
595 flow.setMatch(createL4TCPMatch().build());
596 flow.setInstructions(createDropInstructions().build());
601 flow.setMatch(createL4UDPMatch().build());
602 flow.setInstructions(createDropInstructions().build());
606 flow.setMatch(new MatchBuilder().build());
607 flow.setInstructions(createSentToControllerInstructions().build());
611 flow.setMatch(createToSMatch().build());
612 flow.setInstructions(createDropInstructions().build());
616 flow.setMatch(createToSMatch().build());
617 flow.setInstructions(createOutputInstructions("INPORT", 10).build());
621 flow.setMatch(createToSMatch().build());
622 flow.setInstructions(createOutputInstructions("FLOOD", 20).build());
626 flow.setMatch(createToSMatch().build());
627 flow.setInstructions(createOutputInstructions("ALL", 30).build());
631 flow.setMatch(createToSMatch().build());
632 flow.setInstructions(createOutputInstructions("NORMAL", 40).build());
636 flow.setMatch(createToSMatch().build());
637 flow.setInstructions(createOutputInstructions("LOCAL", 50).build());
641 flow.setMatch(createToSMatch().build());
642 flow.setInstructions(createOutputInstructions("TABLE", 60).build());
646 flow.setMatch(createToSMatch().build());
647 flow.setInstructions(createOutputInstructions("NONE", 70).build());
651 flow.setMatch(createToSMatch().build());
652 flow.setInstructions(createStripVlanInstructions().build());
653 flow.setBarrier(Boolean.TRUE);
657 flow.setMatch(createMatch1().build());
658 flow.setInstructions(createAppyActionInstruction35().build());
662 flow.setMatch(createMatch1().build());
663 flow.setInstructions(createAppyActionInstruction36().build());
667 flow.setMatch(createMatch1().build());
668 flow.setInstructions(createAppyActionInstruction37().build());
672 flow.setMatch(createMatch1().build());
673 flow.setInstructions(createAppyActionInstruction38().build());
677 flow.setMatch(createL4TCPMatch().build());
678 flow.setInstructions(createAppyActionInstruction39().build());
682 flow.setMatch(createL4UDPMatch().build());
683 flow.setInstructions(createAppyActionInstruction40().build());
687 flow.setMatch(createL4SCTPMatch().build());
688 flow.setInstructions(createAppyActionInstruction41().build());
692 flow.setMatch(createICMPv4Match().build());
693 flow.setInstructions(createAppyActionInstruction42().build());
697 flow.setMatch(createArpMatch().build());
698 flow.setInstructions(createAppyActionInstruction43().build());
702 flow.setMatch(createL3IPv6Match().build());
703 flow.setInstructions(createAppyActionInstruction44().build());
707 flow.setMatch(createICMPv6Match().build());
708 flow.setInstructions(createAppyActionInstruction45().build());
712 flow.setMatch(createMplsMatch().build());
713 flow.setInstructions(createAppyActionInstruction46().build());
717 flow.setMatch(createPbbMatch().build());
718 flow.setInstructions(createAppyActionInstruction47().build());
722 flow.setMatch(createTunnelIDMatch().build());
723 flow.setInstructions(createAppyActionInstruction48().build());
727 flow.setMatch(createMatch33().build());
728 flow.setInstructions(createDropInstructions().build());
732 flow.setMatch(createICMPv6Match1().build());
733 flow.setInstructions(createDecNwTtlInstructions().build());
737 flow.setMatch(createMatch1().build());
738 flow.setInstructions(createAppyActionInstruction88().build());
741 LOG.warn("flow type not understood: {}", flowType);
744 FlowKey key = new FlowKey(new FlowId(id));
745 if (null == flow.isBarrier()) {
746 flow.setBarrier(Boolean.FALSE);
748 // flow.setBufferId(new Long(12));
749 BigInteger value = new BigInteger("10", 10);
750 BigInteger outputPort = new BigInteger("65535", 10);
751 flow.setCookie(value);
752 flow.setCookieMask(value);
753 flow.setHardTimeout(0);
754 flow.setIdleTimeout(0);
755 flow.setInstallHw(false);
756 flow.setStrict(false);
757 flow.setContainerName(null);
758 flow.setFlags(new FlowModFlags(false, false, false, false, true));
759 flow.setId(new FlowId(new Long(12)));
760 flow.setTableId(getTableId(tableId));
761 flow.setOutGroup(new Long(2));
762 // set outport to OFPP_NONE (65535) to disable remove restriction for
764 flow.setOutPort(outputPort);
768 flow.setFlowName(originalFlowName + "X" + flowType);
773 private short getTableId(String tableId) {
776 table = Short.parseShort(tableId);
777 } catch (Exception ex) {
778 // ignore exception and continue with default value
788 private static InstructionsBuilder createDecNwTtlInstructions() {
789 DecNwTtlBuilder ta = new DecNwTtlBuilder();
790 DecNwTtl decNwTtl = ta.build();
791 ActionBuilder ab = new ActionBuilder();
792 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
794 // Add our drop action to a list
795 List<Action> actionList = new ArrayList<Action>();
796 actionList.add(ab.build());
798 // Create an Apply Action
799 ApplyActionsBuilder aab = new ApplyActionsBuilder();
800 aab.setAction(actionList);
802 // Wrap our Apply Action in an Instruction
803 InstructionBuilder ib = new InstructionBuilder();
804 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
805 ib.setKey(new InstructionKey(0));
808 // Put our Instruction in a list of Instructions
809 InstructionsBuilder isb = new InstructionsBuilder();
810 List<Instruction> instructions = new ArrayList<Instruction>();
811 instructions.add(ib.build());
812 isb.setInstruction(instructions);
819 private static InstructionsBuilder createMeterInstructions() {
821 MeterBuilder aab = new MeterBuilder();
822 aab.setMeterId(new MeterId(new Long(1)));
824 InstructionBuilder ib = new InstructionBuilder();
825 ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
827 // Put our Instruction in a list of Instructions
828 InstructionsBuilder isb = new InstructionsBuilder();
829 List<Instruction> instructions = new ArrayList<Instruction>();
830 instructions.add(ib.build());
831 isb.setInstruction(instructions);
835 private static InstructionsBuilder createMetadataInstructions() {
837 WriteMetadataBuilder aab = new WriteMetadataBuilder();
838 aab.setMetadata(new BigInteger("10", 10));
839 aab.setMetadataMask(new BigInteger("12", 10));
841 InstructionBuilder ib = new InstructionBuilder();
842 ib.setInstruction(new WriteMetadataCaseBuilder().setWriteMetadata(aab.build()).build());
844 // Put our Instruction in a list of Instructions
845 InstructionsBuilder isb = new InstructionsBuilder();
846 List<Instruction> instructions = new ArrayList<Instruction>();
847 instructions.add(ib.build());
848 isb.setInstruction(instructions);
852 private static InstructionsBuilder createGotoTableInstructions() {
854 GoToTableBuilder aab = new GoToTableBuilder();
855 aab.setTableId((short) 2);
857 InstructionBuilder ib = new InstructionBuilder();
858 ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(aab.build()).build());
860 // Put our Instruction in a list of Instructions
861 InstructionsBuilder isb = new InstructionsBuilder();
862 List<Instruction> instructions = new ArrayList<Instruction>();
863 instructions.add(ib.build());
864 isb.setInstruction(instructions);
868 private static InstructionsBuilder createDropInstructions() {
869 DropActionBuilder dab = new DropActionBuilder();
870 DropAction dropAction = dab.build();
871 ActionBuilder ab = new ActionBuilder();
872 ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build());
874 // Add our drop action to a list
875 List<Action> actionList = new ArrayList<Action>();
876 actionList.add(ab.build());
878 // Create an Apply Action
879 ApplyActionsBuilder aab = new ApplyActionsBuilder();
880 aab.setAction(actionList);
882 // Wrap our Apply Action in an Instruction
883 InstructionBuilder ib = new InstructionBuilder();
884 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
886 // Put our Instruction in a list of Instructions
887 InstructionsBuilder isb = new InstructionsBuilder();
888 List<Instruction> instructions = new ArrayList<Instruction>();
889 instructions.add(ib.build());
890 isb.setInstruction(instructions);
894 private static InstructionsBuilder createAppyActionInstruction() {
896 List<Action> actionList = new ArrayList<Action>();
897 ActionBuilder ab = new ActionBuilder();
898 ControllerActionBuilder controller = new ControllerActionBuilder();
899 controller.setMaxLength(5);
900 ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.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 createAppyActionInstruction1() {
920 List<Action> actionList = new ArrayList<Action>();
921 ActionBuilder ab = new ActionBuilder();
923 OutputActionBuilder output = new OutputActionBuilder();
924 output.setMaxLength(56);
925 Uri value = new Uri("PCEP");
926 output.setOutputNodeConnector(value);
927 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
928 actionList.add(ab.build());
929 // Create an Apply Action
930 ApplyActionsBuilder aab = new ApplyActionsBuilder();
931 aab.setAction(actionList);
933 // Wrap our Apply Action in an Instruction
934 InstructionBuilder ib = new InstructionBuilder();
935 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
937 // Put our Instruction in a list of Instructions
938 InstructionsBuilder isb = new InstructionsBuilder();
939 List<Instruction> instructions = new ArrayList<Instruction>();
940 instructions.add(ib.build());
941 isb.setInstruction(instructions);
945 private static InstructionsBuilder createSentToControllerInstructions() {
946 List<Action> actionList = new ArrayList<Action>();
947 ActionBuilder ab = new ActionBuilder();
949 OutputActionBuilder output = new OutputActionBuilder();
950 output.setMaxLength(56);
951 Uri value = new Uri("CONTROLLER");
952 output.setOutputNodeConnector(value);
953 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
955 ab.setKey(new ActionKey(0));
956 actionList.add(ab.build());
957 // Create an Apply Action
958 ApplyActionsBuilder aab = new ApplyActionsBuilder();
959 aab.setAction(actionList);
961 // Wrap our Apply Action in an Instruction
962 InstructionBuilder ib = new InstructionBuilder();
963 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
965 ib.setKey(new InstructionKey(0));
967 // Put our Instruction in a list of Instructions
968 InstructionsBuilder isb = new InstructionsBuilder();
969 List<Instruction> instructions = new ArrayList<Instruction>();
970 instructions.add(ib.build());
971 isb.setInstruction(instructions);
975 private static InstructionsBuilder createOutputInstructions(String outputType, int outputValue) {
976 List<Action> actionList = new ArrayList<Action>();
977 ActionBuilder ab = new ActionBuilder();
979 OutputActionBuilder output = new OutputActionBuilder();
980 output.setMaxLength(outputValue);
981 Uri value = new Uri(outputType);
982 output.setOutputNodeConnector(value);
983 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
985 ab.setKey(new ActionKey(0));
986 actionList.add(ab.build());
987 // Create an Apply Action
988 ApplyActionsBuilder aab = new ApplyActionsBuilder();
989 aab.setAction(actionList);
991 // Wrap our Apply Action in an Instruction
992 InstructionBuilder ib = new InstructionBuilder();
993 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
995 ib.setKey(new InstructionKey(0));
997 // Put our Instruction in a list of Instructions
998 InstructionsBuilder isb = new InstructionsBuilder();
999 List<Instruction> instructions = new ArrayList<Instruction>();
1000 instructions.add(ib.build());
1001 isb.setInstruction(instructions);
1005 private static InstructionsBuilder createStripVlanInstructions() {
1006 List<Action> actionList = new ArrayList<Action>();
1007 ActionBuilder ab = new ActionBuilder();
1009 StripVlanActionBuilder stripActionBuilder = new StripVlanActionBuilder();
1010 ab.setAction(new StripVlanActionCaseBuilder().setStripVlanAction(stripActionBuilder.build()).build());
1012 ab.setKey(new ActionKey(0));
1013 actionList.add(ab.build());
1014 // Create an Apply Action
1015 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1016 aab.setAction(actionList);
1018 // Wrap our Apply Action in an Instruction
1019 InstructionBuilder ib = new InstructionBuilder();
1020 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1022 ib.setKey(new InstructionKey(0));
1024 // Put our Instruction in a list of Instructions
1025 InstructionsBuilder isb = new InstructionsBuilder();
1026 List<Instruction> instructions = new ArrayList<Instruction>();
1027 instructions.add(ib.build());
1028 isb.setInstruction(instructions);
1032 private static InstructionsBuilder createAppyActionInstruction2() {
1034 List<Action> actionList = new ArrayList<Action>();
1035 ActionBuilder ab = new ActionBuilder();
1037 PushMplsActionBuilder push = new PushMplsActionBuilder();
1038 push.setEthernetType(new Integer(0x8847));
1039 ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
1040 actionList.add(ab.build());
1041 // Create an Apply Action
1042 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1043 aab.setAction(actionList);
1045 // Wrap our Apply Action in an Instruction
1046 InstructionBuilder ib = new InstructionBuilder();
1047 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1049 // Put our Instruction in a list of Instructions
1050 InstructionsBuilder isb = new InstructionsBuilder();
1051 List<Instruction> instructions = new ArrayList<Instruction>();
1052 instructions.add(ib.build());
1053 isb.setInstruction(instructions);
1057 private static InstructionsBuilder createAppyActionInstruction3() {
1059 List<Action> actionList = new ArrayList<Action>();
1060 ActionBuilder ab = new ActionBuilder();
1062 PushPbbActionBuilder pbb = new PushPbbActionBuilder();
1063 pbb.setEthernetType(new Integer(0x88E7));
1064 ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
1065 actionList.add(ab.build());
1066 // Create an Apply Action
1067 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1068 aab.setAction(actionList);
1070 // Wrap our Apply Action in an Instruction
1071 InstructionBuilder ib = new InstructionBuilder();
1072 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1074 // Put our Instruction in a list of Instructions
1075 InstructionsBuilder isb = new InstructionsBuilder();
1076 List<Instruction> instructions = new ArrayList<Instruction>();
1077 instructions.add(ib.build());
1078 isb.setInstruction(instructions);
1082 private static InstructionsBuilder createAppyActionInstruction4() {
1084 List<Action> actionList = new ArrayList<Action>();
1085 ActionBuilder ab = new ActionBuilder();
1087 PushVlanActionBuilder vlan = new PushVlanActionBuilder();
1088 vlan.setEthernetType(new Integer(0x8100));
1089 ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
1090 actionList.add(ab.build());
1092 // Create an Apply Action
1093 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1094 aab.setAction(actionList);
1096 // Wrap our Apply Action in an Instruction
1097 InstructionBuilder ib = new InstructionBuilder();
1098 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1100 // Put our Instruction in a list of Instructions
1101 InstructionsBuilder isb = new InstructionsBuilder();
1102 List<Instruction> instructions = new ArrayList<Instruction>();
1103 instructions.add(ib.build());
1104 isb.setInstruction(instructions);
1108 private static InstructionsBuilder createAppyActionInstruction5() {
1110 List<Action> actionList = new ArrayList<Action>();
1111 ActionBuilder ab = new ActionBuilder();
1113 SetDlDstActionBuilder setdl = new SetDlDstActionBuilder();
1114 setdl.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1115 ab.setAction(new SetDlDstActionCaseBuilder().setSetDlDstAction(setdl.build()).build());
1116 actionList.add(ab.build());
1117 // Create an Apply Action
1118 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1119 aab.setAction(actionList);
1121 // Wrap our Apply Action in an Instruction
1122 InstructionBuilder ib = new InstructionBuilder();
1123 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1125 // Put our Instruction in a list of Instructions
1126 InstructionsBuilder isb = new InstructionsBuilder();
1127 List<Instruction> instructions = new ArrayList<Instruction>();
1128 instructions.add(ib.build());
1129 isb.setInstruction(instructions);
1133 private static InstructionsBuilder createAppyActionInstruction6() {
1135 List<Action> actionList = new ArrayList<Action>();
1136 ActionBuilder ab = new ActionBuilder();
1138 SetDlSrcActionBuilder src = new SetDlSrcActionBuilder();
1139 src.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1140 ab.setAction(new SetDlSrcActionCaseBuilder().setSetDlSrcAction(src.build()).build());
1141 actionList.add(ab.build());
1143 // Create an Apply Action
1144 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1145 aab.setAction(actionList);
1147 // Wrap our Apply Action in an Instruction
1148 InstructionBuilder ib = new InstructionBuilder();
1149 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1151 // Put our Instruction in a list of Instructions
1152 InstructionsBuilder isb = new InstructionsBuilder();
1153 List<Instruction> instructions = new ArrayList<Instruction>();
1154 instructions.add(ib.build());
1155 isb.setInstruction(instructions);
1159 private static InstructionsBuilder createAppyActionInstruction7() {
1161 List<Action> actionList = new ArrayList<Action>();
1162 ActionBuilder ab = new ActionBuilder();
1164 SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
1165 VlanId a = new VlanId(4000);
1167 ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
1168 actionList.add(ab.build());
1169 // Create an Apply Action
1170 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1171 aab.setAction(actionList);
1173 // Wrap our Apply Action in an Instruction
1174 InstructionBuilder ib = new InstructionBuilder();
1175 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1177 // Put our Instruction in a list of Instructions
1178 InstructionsBuilder isb = new InstructionsBuilder();
1179 List<Instruction> instructions = new ArrayList<Instruction>();
1180 instructions.add(ib.build());
1181 isb.setInstruction(instructions);
1185 private static InstructionsBuilder createAppyActionInstruction8() {
1187 List<Action> actionList = new ArrayList<Action>();
1188 ActionBuilder ab = new ActionBuilder();
1190 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1191 VlanPcp pcp1 = new VlanPcp((short) 2);
1192 pcp.setVlanPcp(pcp1);
1193 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1194 actionList.add(ab.build());
1195 // Create an Apply Action
1196 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1197 aab.setAction(actionList);
1199 // Wrap our Apply Action in an Instruction
1200 InstructionBuilder ib = new InstructionBuilder();
1201 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1203 // Put our Instruction in a list of Instructions
1204 InstructionsBuilder isb = new InstructionsBuilder();
1205 List<Instruction> instructions = new ArrayList<Instruction>();
1206 instructions.add(ib.build());
1207 isb.setInstruction(instructions);
1211 private static InstructionsBuilder createAppyActionInstruction88() {
1213 List<Action> actionList = new ArrayList<Action>();
1214 ActionBuilder ab = new ActionBuilder();
1216 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1217 VlanPcp pcp1 = new VlanPcp((short) 9);
1218 pcp.setVlanPcp(pcp1);
1219 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1220 actionList.add(ab.build());
1221 // Create an Apply Action
1222 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1223 aab.setAction(actionList);
1225 // Wrap our Apply Action in an Instruction
1226 InstructionBuilder ib = new InstructionBuilder();
1227 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1229 // Put our Instruction in a list of Instructions
1230 InstructionsBuilder isb = new InstructionsBuilder();
1231 List<Instruction> instructions = new ArrayList<Instruction>();
1232 instructions.add(ib.build());
1233 isb.setInstruction(instructions);
1238 private static InstructionsBuilder createAppyActionInstruction9() {
1240 List<Action> actionList = new ArrayList<Action>();
1241 ActionBuilder ab = new ActionBuilder();
1243 CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
1244 ab.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
1245 actionList.add(ab.build());
1246 // Create an Apply Action
1247 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1248 aab.setAction(actionList);
1250 // Wrap our Apply Action in an Instruction
1251 InstructionBuilder ib = new InstructionBuilder();
1252 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1254 // Put our Instruction in a list of Instructions
1255 InstructionsBuilder isb = new InstructionsBuilder();
1256 List<Instruction> instructions = new ArrayList<Instruction>();
1257 instructions.add(ib.build());
1258 isb.setInstruction(instructions);
1262 private static InstructionsBuilder createAppyActionInstruction10() {
1264 List<Action> actionList = new ArrayList<Action>();
1265 ActionBuilder ab = new ActionBuilder();
1267 CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
1268 ab.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
1269 actionList.add(ab.build());
1270 // Create an Apply Action
1271 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1272 aab.setAction(actionList);
1274 // Wrap our Apply Action in an Instruction
1275 InstructionBuilder ib = new InstructionBuilder();
1276 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1278 // Put our Instruction in a list of Instructions
1279 InstructionsBuilder isb = new InstructionsBuilder();
1280 List<Instruction> instructions = new ArrayList<Instruction>();
1281 instructions.add(ib.build());
1282 isb.setInstruction(instructions);
1286 private static InstructionsBuilder createAppyActionInstruction11() {
1288 List<Action> actionList = new ArrayList<Action>();
1289 ActionBuilder ab = new ActionBuilder();
1291 DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
1292 ab.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
1293 actionList.add(ab.build());
1294 // Create an Apply Action
1295 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1296 aab.setAction(actionList);
1298 // Wrap our Apply Action in an Instruction
1299 InstructionBuilder ib = new InstructionBuilder();
1300 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1301 ib.setKey(new InstructionKey(0));
1304 // Put our Instruction in a list of Instruction
1305 InstructionsBuilder isb = new InstructionsBuilder();
1306 List<Instruction> instructions = new ArrayList<Instruction>();
1307 instructions.add(ib.build());
1308 isb.setInstruction(instructions);
1312 private static InstructionsBuilder createAppyActionInstruction12() {
1314 List<Action> actionList = new ArrayList<Action>();
1315 ActionBuilder ab = new ActionBuilder();
1317 DecNwTtlBuilder nwttl = new DecNwTtlBuilder();
1318 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(nwttl.build()).build());
1319 actionList.add(ab.build());
1321 // Create an Apply Action
1322 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1323 aab.setAction(actionList);
1325 // Wrap our Apply Action in an Instruction
1326 InstructionBuilder ib = new InstructionBuilder();
1327 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1329 // Put our Instruction in a list of Instructions
1330 InstructionsBuilder isb = new InstructionsBuilder();
1331 List<Instruction> instructions = new ArrayList<Instruction>();
1332 instructions.add(ib.build());
1333 isb.setInstruction(instructions);
1337 private static InstructionsBuilder createAppyActionInstruction13() {
1339 List<Action> actionList = new ArrayList<Action>();
1340 ActionBuilder ab = new ActionBuilder();
1342 DropActionBuilder drop = new DropActionBuilder();
1343 ab.setAction(new DropActionCaseBuilder().setDropAction(drop.build()).build());
1344 actionList.add(ab.build());
1346 // Create an Apply Action
1347 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1348 aab.setAction(actionList);
1350 // Wrap our Apply Action in an Instruction
1351 InstructionBuilder ib = new InstructionBuilder();
1352 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1354 // Put our Instruction in a list of Instructions
1355 InstructionsBuilder isb = new InstructionsBuilder();
1356 List<Instruction> instructions = new ArrayList<Instruction>();
1357 instructions.add(ib.build());
1358 isb.setInstruction(instructions);
1362 private static InstructionsBuilder createAppyActionInstruction14() {
1364 List<Action> actionList = new ArrayList<Action>();
1365 ActionBuilder ab = new ActionBuilder();
1367 FloodActionBuilder fld = new FloodActionBuilder();
1368 ab.setAction(new FloodActionCaseBuilder().setFloodAction(fld.build()).build());
1369 actionList.add(ab.build());
1370 // Create an Apply Action
1371 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1372 aab.setAction(actionList);
1374 // Wrap our Apply Action in an Instruction
1375 InstructionBuilder ib = new InstructionBuilder();
1376 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1378 // Put our Instruction in a list of Instructions
1379 InstructionsBuilder isb = new InstructionsBuilder();
1380 List<Instruction> instructions = new ArrayList<Instruction>();
1381 instructions.add(ib.build());
1382 isb.setInstruction(instructions);
1386 private static InstructionsBuilder createAppyActionInstruction15() {
1388 List<Action> actionList = new ArrayList<Action>();
1389 ActionBuilder ab = new ActionBuilder();
1391 FloodAllActionBuilder fldall = new FloodAllActionBuilder();
1392 ab.setAction(new FloodAllActionCaseBuilder().setFloodAllAction(fldall.build()).build());
1393 actionList.add(ab.build());
1394 // Create an Apply Action
1395 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1396 aab.setAction(actionList);
1398 // Wrap our Apply Action in an Instruction
1399 InstructionBuilder ib = new InstructionBuilder();
1400 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1402 // Put our Instruction in a list of Instructions
1403 InstructionsBuilder isb = new InstructionsBuilder();
1404 List<Instruction> instructions = new ArrayList<Instruction>();
1405 instructions.add(ib.build());
1406 isb.setInstruction(instructions);
1410 private static InstructionsBuilder createAppyActionInstruction16() {
1412 List<Action> actionList = new ArrayList<Action>();
1413 ActionBuilder ab = new ActionBuilder();
1415 GroupActionBuilder groupActionB = new GroupActionBuilder();
1416 groupActionB.setGroupId(1L);
1417 groupActionB.setGroup("0");
1418 ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
1419 actionList.add(ab.build());
1421 // Create an Apply Action
1422 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1423 aab.setAction(actionList);
1425 // Wrap our Apply Action in an Instruction
1426 InstructionBuilder ib = new InstructionBuilder();
1427 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1429 // Put our Instruction in a list of Instructions
1430 InstructionsBuilder isb = new InstructionsBuilder();
1431 List<Instruction> instructions = new ArrayList<Instruction>();
1432 instructions.add(ib.build());
1433 isb.setInstruction(instructions);
1437 private static InstructionsBuilder createAppyActionInstruction17() {
1439 List<Action> actionList = new ArrayList<Action>();
1440 ActionBuilder ab = new ActionBuilder();
1442 HwPathActionBuilder hwPathB = new HwPathActionBuilder();
1443 ab.setAction(new HwPathActionCaseBuilder().setHwPathAction(hwPathB.build()).build());
1444 actionList.add(ab.build());
1445 // Create an Apply Action
1446 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1447 aab.setAction(actionList);
1449 // Wrap our Apply Action in an Instruction
1450 InstructionBuilder ib = new InstructionBuilder();
1451 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1453 // Put our Instruction in a list of Instructions
1454 InstructionsBuilder isb = new InstructionsBuilder();
1455 List<Instruction> instructions = new ArrayList<Instruction>();
1456 instructions.add(ib.build());
1457 isb.setInstruction(instructions);
1461 private static InstructionsBuilder createAppyActionInstruction18() {
1463 List<Action> actionList = new ArrayList<Action>();
1464 ActionBuilder ab = new ActionBuilder();
1466 LoopbackActionBuilder loopbackActionBuilder = new LoopbackActionBuilder();
1467 ab.setAction(new LoopbackActionCaseBuilder().setLoopbackAction(loopbackActionBuilder.build()).build());
1468 actionList.add(ab.build());
1470 // Create an Apply Action
1471 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1472 aab.setAction(actionList);
1474 // Wrap our Apply Action in an Instruction
1475 InstructionBuilder ib = new InstructionBuilder();
1476 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1478 // Put our Instruction in a list of Instructions
1479 InstructionsBuilder isb = new InstructionsBuilder();
1480 List<Instruction> instructions = new ArrayList<Instruction>();
1481 instructions.add(ib.build());
1482 isb.setInstruction(instructions);
1486 private static InstructionsBuilder createAppyActionInstruction19() {
1488 List<Action> actionList = new ArrayList<Action>();
1489 ActionBuilder ab = new ActionBuilder();
1491 PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
1492 popMplsActionBuilder.setEthernetType(0XB);
1493 ab.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
1494 actionList.add(ab.build());
1495 // Create an Apply Action
1496 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1497 aab.setAction(actionList);
1499 // Wrap our Apply Action in an Instruction
1500 InstructionBuilder ib = new InstructionBuilder();
1501 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1503 // Put our Instruction in a list of Instructions
1504 InstructionsBuilder isb = new InstructionsBuilder();
1505 List<Instruction> instructions = new ArrayList<Instruction>();
1506 instructions.add(ib.build());
1507 isb.setInstruction(instructions);
1511 private static InstructionsBuilder createAppyActionInstruction20() {
1513 List<Action> actionList = new ArrayList<Action>();
1514 ActionBuilder ab = new ActionBuilder();
1516 PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
1517 ab.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
1518 actionList.add(ab.build());
1519 // Create an Apply Action
1520 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1521 aab.setAction(actionList);
1523 // Wrap our Apply Action in an Instruction
1524 InstructionBuilder ib = new InstructionBuilder();
1525 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1527 // Put our Instruction in a list of Instructions
1528 InstructionsBuilder isb = new InstructionsBuilder();
1529 List<Instruction> instructions = new ArrayList<Instruction>();
1530 instructions.add(ib.build());
1531 isb.setInstruction(instructions);
1535 private static InstructionsBuilder createAppyActionInstruction21() {
1537 List<Action> actionList = new ArrayList<Action>();
1538 ActionBuilder ab = new ActionBuilder();
1540 PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder();
1541 ab.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(popVlanActionBuilder.build()).build());
1542 actionList.add(ab.build());
1544 // Create an Apply Action
1545 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1546 aab.setAction(actionList);
1548 // Wrap our Apply Action in an Instruction
1549 InstructionBuilder ib = new InstructionBuilder();
1550 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1552 // Put our Instruction in a list of Instructions
1553 InstructionsBuilder isb = new InstructionsBuilder();
1554 List<Instruction> instructions = new ArrayList<Instruction>();
1555 instructions.add(ib.build());
1556 isb.setInstruction(instructions);
1560 private static InstructionsBuilder createAppyActionInstruction22() {
1562 List<Action> actionList = new ArrayList<Action>();
1563 ActionBuilder ab = new ActionBuilder();
1565 SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
1566 setDlTypeActionBuilder.setDlType(new EtherType(8L));
1567 ab.setAction(new SetDlTypeActionCaseBuilder().setSetDlTypeAction(setDlTypeActionBuilder.build()).build());
1568 actionList.add(ab.build());
1570 // Create an Apply Action
1571 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1572 aab.setAction(actionList);
1574 // Wrap our Apply Action in an Instruction
1575 InstructionBuilder ib = new InstructionBuilder();
1576 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1578 // Put our Instruction in a list of Instructions
1579 InstructionsBuilder isb = new InstructionsBuilder();
1580 List<Instruction> instructions = new ArrayList<Instruction>();
1581 instructions.add(ib.build());
1582 isb.setInstruction(instructions);
1586 private static InstructionsBuilder createAppyActionInstruction23() {
1588 List<Action> actionList = new ArrayList<Action>();
1589 ActionBuilder ab = new ActionBuilder();
1591 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1592 setFieldBuilder.setInPort(new Long(2));
1593 actionList.add(ab.build());
1595 // Create an Apply Action
1596 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1597 aab.setAction(actionList);
1599 // Wrap our Apply Action in an Instruction
1600 InstructionBuilder ib = new InstructionBuilder();
1601 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1603 // Put our Instruction in a list of Instructions
1604 InstructionsBuilder isb = new InstructionsBuilder();
1605 List<Instruction> instructions = new ArrayList<Instruction>();
1606 instructions.add(ib.build());
1607 isb.setInstruction(instructions);
1611 private static InstructionsBuilder createAppyActionInstruction24() {
1613 List<Action> actionList = new ArrayList<Action>();
1614 ActionBuilder ab = new ActionBuilder();
1616 SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
1617 setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
1618 ab.setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(setMplsTtlActionBuilder.build()).build());
1619 actionList.add(ab.build());
1621 // Create an Apply Action
1622 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1623 aab.setAction(actionList);
1625 // Wrap our Apply Action in an Instruction
1626 InstructionBuilder ib = new InstructionBuilder();
1627 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1629 // Put our Instruction in a list of Instructions
1630 InstructionsBuilder isb = new InstructionsBuilder();
1631 List<Instruction> instructions = new ArrayList<Instruction>();
1632 instructions.add(ib.build());
1633 isb.setInstruction(instructions);
1637 private static InstructionsBuilder createAppyActionInstruction25() {
1639 List<Action> actionList = new ArrayList<Action>();
1640 ActionBuilder ab = new ActionBuilder();
1642 SetNextHopActionBuilder setNextHopActionBuilder = new SetNextHopActionBuilder();
1643 Ipv4Builder ipnext = new Ipv4Builder();
1644 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
1645 ipnext.setIpv4Address(prefix);
1646 setNextHopActionBuilder.setAddress(ipnext.build());
1647 ab.setAction(new SetNextHopActionCaseBuilder().setSetNextHopAction(setNextHopActionBuilder.build()).build());
1648 actionList.add(ab.build());
1650 // Create an Apply Action
1651 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1652 aab.setAction(actionList);
1654 // Wrap our Apply Action in an Instruction
1655 InstructionBuilder ib = new InstructionBuilder();
1656 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1658 // Put our Instruction in a list of Instructions
1659 InstructionsBuilder isb = new InstructionsBuilder();
1660 List<Instruction> instructions = new ArrayList<Instruction>();
1661 instructions.add(ib.build());
1662 isb.setInstruction(instructions);
1666 private static InstructionsBuilder createAppyActionInstruction26() {
1668 List<Action> actionList = new ArrayList<Action>();
1669 ActionBuilder ab = new ActionBuilder();
1671 SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
1672 Ipv4Builder ipdst = new Ipv4Builder();
1673 Ipv4Prefix prefixdst = new Ipv4Prefix("10.0.0.21/24");
1674 ipdst.setIpv4Address(prefixdst);
1675 setNwDstActionBuilder.setAddress(ipdst.build());
1676 ab.setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build());
1677 actionList.add(ab.build());
1679 // Create an Apply Action
1680 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1681 aab.setAction(actionList);
1683 // Wrap our Apply Action in an Instruction
1684 InstructionBuilder ib = new InstructionBuilder();
1685 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1687 // Put our Instruction in a list of Instructions
1688 InstructionsBuilder isb = new InstructionsBuilder();
1689 List<Instruction> instructions = new ArrayList<Instruction>();
1690 instructions.add(ib.build());
1691 isb.setInstruction(instructions);
1695 private static InstructionsBuilder createAppyActionInstruction27() {
1697 List<Action> actionList = new ArrayList<Action>();
1698 ActionBuilder ab = new ActionBuilder();
1700 SetNwSrcActionBuilder setNwsrcActionBuilder = new SetNwSrcActionBuilder();
1701 Ipv4Builder ipsrc = new Ipv4Builder();
1702 Ipv4Prefix prefixsrc = new Ipv4Prefix("10.0.23.21/24");
1703 ipsrc.setIpv4Address(prefixsrc);
1704 setNwsrcActionBuilder.setAddress(ipsrc.build());
1705 ab.setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwsrcActionBuilder.build()).build());
1706 actionList.add(ab.build());
1708 // Create an Apply Action
1709 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1710 aab.setAction(actionList);
1712 // Wrap our Apply Action in an Instruction
1713 InstructionBuilder ib = new InstructionBuilder();
1714 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1716 // Put our Instruction in a list of Instructions
1717 InstructionsBuilder isb = new InstructionsBuilder();
1718 List<Instruction> instructions = new ArrayList<Instruction>();
1719 instructions.add(ib.build());
1720 isb.setInstruction(instructions);
1724 private static InstructionsBuilder createAppyActionInstruction28() {
1726 List<Action> actionList = new ArrayList<Action>();
1727 ActionBuilder ab = new ActionBuilder();
1729 SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
1730 setNwTosActionBuilder.setTos(8);
1731 ab.setAction(new SetNwTosActionCaseBuilder().setSetNwTosAction(setNwTosActionBuilder.build()).build());
1732 actionList.add(ab.build());
1733 // Create an Apply Action
1734 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1735 aab.setAction(actionList);
1737 // Wrap our Apply Action in an Instruction
1738 InstructionBuilder ib = new InstructionBuilder();
1739 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1741 // Put our Instruction in a list of Instructions
1742 InstructionsBuilder isb = new InstructionsBuilder();
1743 List<Instruction> instructions = new ArrayList<Instruction>();
1744 instructions.add(ib.build());
1745 isb.setInstruction(instructions);
1749 private static InstructionsBuilder createAppyActionInstruction29() {
1751 List<Action> actionList = new ArrayList<Action>();
1752 ActionBuilder ab = new ActionBuilder();
1754 SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
1755 setNwTtlActionBuilder.setNwTtl((short) 1);
1756 ab.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
1757 actionList.add(ab.build());
1759 // Create an Apply Action
1760 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1761 aab.setAction(actionList);
1763 // Wrap our Apply Action in an Instruction
1764 InstructionBuilder ib = new InstructionBuilder();
1765 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1767 // Put our Instruction in a list of Instructions
1768 InstructionsBuilder isb = new InstructionsBuilder();
1769 List<Instruction> instructions = new ArrayList<Instruction>();
1770 instructions.add(ib.build());
1771 isb.setInstruction(instructions);
1775 private static InstructionsBuilder createAppyActionInstruction30() {
1777 List<Action> actionList = new ArrayList<Action>();
1778 ActionBuilder ab = new ActionBuilder();
1780 SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
1781 setQueueActionBuilder.setQueueId(1L);
1782 ab.setAction(new SetQueueActionCaseBuilder().setSetQueueAction(setQueueActionBuilder.build()).build());
1783 actionList.add(ab.build());
1784 // Create an Apply Action
1785 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1786 aab.setAction(actionList);
1788 // Wrap our Apply Action in an Instruction
1789 InstructionBuilder ib = new InstructionBuilder();
1790 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1792 // Put our Instruction in a list of Instructions
1793 InstructionsBuilder isb = new InstructionsBuilder();
1794 List<Instruction> instructions = new ArrayList<Instruction>();
1795 instructions.add(ib.build());
1796 isb.setInstruction(instructions);
1800 private static InstructionsBuilder createAppyActionInstruction31() {
1802 List<Action> actionList = new ArrayList<Action>();
1803 ActionBuilder ab = new ActionBuilder();
1805 SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
1806 setTpDstActionBuilder.setPort(new PortNumber(109));
1808 ab.setAction(new SetTpDstActionCaseBuilder().setSetTpDstAction(setTpDstActionBuilder.build()).build());
1809 actionList.add(ab.build());
1810 // Create an Apply Action
1811 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1812 aab.setAction(actionList);
1814 // Wrap our Apply Action in an Instruction
1815 InstructionBuilder ib = new InstructionBuilder();
1816 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1818 // Put our Instruction in a list of Instructions
1819 InstructionsBuilder isb = new InstructionsBuilder();
1820 List<Instruction> instructions = new ArrayList<Instruction>();
1821 instructions.add(ib.build());
1822 isb.setInstruction(instructions);
1826 private static InstructionsBuilder createAppyActionInstruction32() {
1828 List<Action> actionList = new ArrayList<Action>();
1829 ActionBuilder ab = new ActionBuilder();
1831 SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
1832 setTpSrcActionBuilder.setPort(new PortNumber(109));
1833 ab.setAction(new SetTpSrcActionCaseBuilder().setSetTpSrcAction(setTpSrcActionBuilder.build()).build());
1834 actionList.add(ab.build());
1836 // Create an Apply Action
1837 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1838 aab.setAction(actionList);
1840 // Wrap our Apply Action in an Instruction
1841 InstructionBuilder ib = new InstructionBuilder();
1842 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1844 // Put our Instruction in a list of Instructions
1845 InstructionsBuilder isb = new InstructionsBuilder();
1846 List<Instruction> instructions = new ArrayList<Instruction>();
1847 instructions.add(ib.build());
1848 isb.setInstruction(instructions);
1852 private static InstructionsBuilder createAppyActionInstruction33() {
1854 List<Action> actionList = new ArrayList<Action>();
1855 ActionBuilder ab = new ActionBuilder();
1857 SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
1858 setVlanCfiActionBuilder.setVlanCfi(new VlanCfi(2));
1859 ab.setAction(new SetVlanCfiActionCaseBuilder().setSetVlanCfiAction(setVlanCfiActionBuilder.build()).build());
1860 actionList.add(ab.build());
1862 // Create an Apply Action
1863 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1864 aab.setAction(actionList);
1866 // Wrap our Apply Action in an Instruction
1867 InstructionBuilder ib = new InstructionBuilder();
1868 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1870 // Put our Instruction in a list of Instructions
1871 InstructionsBuilder isb = new InstructionsBuilder();
1872 List<Instruction> instructions = new ArrayList<Instruction>();
1873 instructions.add(ib.build());
1874 isb.setInstruction(instructions);
1878 private static InstructionsBuilder createAppyActionInstruction34() {
1880 List<Action> actionList = new ArrayList<Action>();
1881 ActionBuilder ab = new ActionBuilder();
1883 SwPathActionBuilder swPathAction = new SwPathActionBuilder();
1884 ab.setAction(new SwPathActionCaseBuilder().setSwPathAction(swPathAction.build()).build());
1885 actionList.add(ab.build());
1887 // Create an Apply Action
1888 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1889 aab.setAction(actionList);
1891 // Wrap our Apply Action in an Instruction
1892 InstructionBuilder ib = new InstructionBuilder();
1893 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1895 // Put our Instruction in a list of Instructions
1896 InstructionsBuilder isb = new InstructionsBuilder();
1897 List<Instruction> instructions = new ArrayList<Instruction>();
1898 instructions.add(ib.build());
1899 isb.setInstruction(instructions);
1903 private static InstructionsBuilder createAppyActionInstruction35() {
1905 List<Action> actionList = new ArrayList<Action>();
1906 ActionBuilder ab = new ActionBuilder();
1907 ActionBuilder ab1 = new ActionBuilder();
1908 ActionBuilder ab2 = new ActionBuilder();
1910 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1911 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
1912 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
1915 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
1916 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
1917 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
1918 EthernetMatchBuilder ethernetMatch1 = new EthernetMatchBuilder();
1919 EthernetDestinationBuilder ethDestBuilder = new EthernetDestinationBuilder();
1920 ethDestBuilder.setAddress(new MacAddress("00:00:00:00:00:02"));
1921 EthernetMatchBuilder ethernetMatch2 = new EthernetMatchBuilder();
1922 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
1923 ethTypeBuilder.setType(new EtherType(0x86ddL));
1925 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
1926 ethernetMatch1.setEthernetDestination(ethDestBuilder.build());
1927 ethernetMatch2.setEthernetType(ethTypeBuilder.build());
1928 setFieldBuilder.setEthernetMatch(ethernetMatch.build());
1929 setFieldBuilder1.setEthernetMatch(ethernetMatch1.build());
1930 setFieldBuilder2.setEthernetMatch(ethernetMatch2.build());
1931 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
1932 ab.setKey(new ActionKey(0));
1933 actionList.add(ab.build());
1935 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
1936 ab1.setKey(new ActionKey(1));
1937 actionList.add(ab1.build());
1939 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
1940 ab2.setKey(new ActionKey(2));
1941 actionList.add(ab2.build());
1943 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1944 aab.setAction(actionList);
1946 InstructionBuilder ib = new InstructionBuilder();
1947 ib.setKey(new InstructionKey(0));
1948 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1950 // Put our Instruction in a list of Instructions
1951 InstructionsBuilder isb = new InstructionsBuilder();
1952 List<Instruction> instructions = new ArrayList<Instruction>();
1953 instructions.add(ib.build());
1954 isb.setInstruction(instructions);
1958 private static InstructionsBuilder createAppyActionInstruction36() {
1960 List<Action> actionList = new ArrayList<Action>();
1961 ActionBuilder ab = new ActionBuilder();
1962 ActionBuilder ab1 = new ActionBuilder();
1964 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1965 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
1968 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
1969 VlanMatchBuilder vlanBuilder1 = new VlanMatchBuilder();
1970 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
1971 VlanId vlanId = new VlanId(10);
1972 VlanPcp vpcp = new VlanPcp((short) 3);
1973 vlanBuilder.setVlanPcp(vpcp);
1974 vlanBuilder1.setVlanId(vlanIdBuilder.setVlanId(vlanId).setVlanIdPresent(true).build());
1975 setFieldBuilder.setVlanMatch(vlanBuilder.build());
1976 setFieldBuilder1.setVlanMatch(vlanBuilder1.build());
1977 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
1978 ab.setKey(new ActionKey(0));
1979 actionList.add(ab.build());
1980 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
1981 ab1.setKey(new ActionKey(1));
1982 actionList.add(ab1.build());
1984 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1985 aab.setAction(actionList);
1987 InstructionBuilder ib = new InstructionBuilder();
1988 ib.setKey(new InstructionKey(0));
1989 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1991 // Put our Instruction in a list of Instructions
1992 InstructionsBuilder isb = new InstructionsBuilder();
1993 List<Instruction> instructions = new ArrayList<Instruction>();
1994 instructions.add(ib.build());
1995 isb.setInstruction(instructions);
1999 private static InstructionsBuilder createAppyActionInstruction37() {
2001 List<Action> actionList = new ArrayList<Action>();
2002 ActionBuilder ab = new ActionBuilder();
2003 ActionBuilder ab1 = new ActionBuilder();
2004 ActionBuilder ab2 = new ActionBuilder();
2006 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2007 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2008 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2010 IpMatchBuilder ipmatch = new IpMatchBuilder();
2011 IpMatchBuilder ipmatch1 = new IpMatchBuilder();
2012 IpMatchBuilder ipmatch2 = new IpMatchBuilder();
2013 Dscp dscp = new Dscp((short) 3);
2014 ipmatch.setIpDscp(dscp);
2015 ipmatch1.setIpEcn((short) 2);
2016 ipmatch2.setIpProtocol((short) 120);
2017 setFieldBuilder.setIpMatch(ipmatch.build());
2018 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2019 ab.setKey(new ActionKey(0));
2020 actionList.add(ab.build());
2022 setFieldBuilder1.setIpMatch(ipmatch1.build());
2023 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2024 ab1.setKey(new ActionKey(1));
2025 actionList.add(ab1.build());
2027 setFieldBuilder2.setIpMatch(ipmatch2.build());
2028 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2029 ab2.setKey(new ActionKey(2));
2030 actionList.add(ab2.build());
2032 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2033 aab.setAction(actionList);
2035 InstructionBuilder ib = new InstructionBuilder();
2036 ib.setKey(new InstructionKey(0));
2037 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2039 // Put our Instruction in a list of Instructions
2040 InstructionsBuilder isb = new InstructionsBuilder();
2041 List<Instruction> instructions = new ArrayList<Instruction>();
2042 instructions.add(ib.build());
2043 isb.setInstruction(instructions);
2047 private static InstructionsBuilder createAppyActionInstruction38() {
2049 List<Action> actionList = new ArrayList<Action>();
2050 ActionBuilder ab = new ActionBuilder();
2051 ActionBuilder ab1 = new ActionBuilder();
2053 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2054 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2056 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2057 Ipv4MatchBuilder ipv4Match1 = new Ipv4MatchBuilder();
2058 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.5210");
2059 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1");
2060 ipv4Match1.setIpv4Destination(dstip);
2061 ipv4Match.setIpv4Source(srcip);
2062 setFieldBuilder.setLayer3Match(ipv4Match.build());
2063 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2064 ab.setKey(new ActionKey(0));
2065 actionList.add(ab.build());
2067 setFieldBuilder1.setLayer3Match(ipv4Match1.build());
2068 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2069 ab1.setKey(new ActionKey(1));
2070 actionList.add(ab1.build());
2072 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2073 aab.setAction(actionList);
2075 InstructionBuilder ib = new InstructionBuilder();
2076 ib.setKey(new InstructionKey(0));
2077 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2079 // Put our Instruction in a list of Instructions
2080 InstructionsBuilder isb = new InstructionsBuilder();
2081 List<Instruction> instructions = new ArrayList<Instruction>();
2082 instructions.add(ib.build());
2083 isb.setInstruction(instructions);
2087 private static InstructionsBuilder createAppyActionInstruction39() {
2089 List<Action> actionList = new ArrayList<Action>();
2090 ActionBuilder ab = new ActionBuilder();
2091 ActionBuilder ab1 = new ActionBuilder();
2093 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2094 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2097 PortNumber tcpsrcport = new PortNumber(1213);
2098 PortNumber tcpdstport = new PortNumber(646);
2099 TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
2100 TcpMatchBuilder tcpmatch1 = new TcpMatchBuilder();
2101 tcpmatch.setTcpSourcePort(tcpsrcport);
2102 tcpmatch1.setTcpDestinationPort(tcpdstport);
2103 setFieldBuilder.setLayer4Match(tcpmatch.build());
2104 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2105 ab.setKey(new ActionKey(0));
2106 actionList.add(ab.build());
2108 setFieldBuilder1.setLayer4Match(tcpmatch1.build());
2109 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2110 ab1.setKey(new ActionKey(1));
2111 actionList.add(ab.build());
2113 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2114 aab.setAction(actionList);
2116 InstructionBuilder ib = new InstructionBuilder();
2117 ib.setKey(new InstructionKey(0));
2118 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2120 // Put our Instruction in a list of Instructions
2121 InstructionsBuilder isb = new InstructionsBuilder();
2122 List<Instruction> instructions = new ArrayList<Instruction>();
2123 instructions.add(ib.build());
2124 isb.setInstruction(instructions);
2128 private static InstructionsBuilder createAppyActionInstruction40() {
2130 List<Action> actionList = new ArrayList<Action>();
2131 ActionBuilder ab = new ActionBuilder();
2132 ActionBuilder ab1 = new ActionBuilder();
2134 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2135 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2138 PortNumber udpsrcport = new PortNumber(1325);
2139 PortNumber udpdstport = new PortNumber(42);
2140 UdpMatchBuilder udpmatch = new UdpMatchBuilder();
2141 UdpMatchBuilder udpmatch1 = new UdpMatchBuilder();
2142 udpmatch.setUdpDestinationPort(udpdstport);
2143 udpmatch1.setUdpSourcePort(udpsrcport);
2144 setFieldBuilder.setLayer4Match(udpmatch.build());
2145 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2146 ab.setKey(new ActionKey(0));
2147 actionList.add(ab.build());
2149 setFieldBuilder1.setLayer4Match(udpmatch1.build());
2150 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2151 ab1.setKey(new ActionKey(1));
2152 actionList.add(ab1.build());
2154 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2155 aab.setAction(actionList);
2157 InstructionBuilder ib = new InstructionBuilder();
2158 ib.setKey(new InstructionKey(0));
2159 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2161 // Put our Instruction in a list of Instructions
2162 InstructionsBuilder isb = new InstructionsBuilder();
2163 List<Instruction> instructions = new ArrayList<Instruction>();
2164 instructions.add(ib.build());
2165 isb.setInstruction(instructions);
2169 private static InstructionsBuilder createAppyActionInstruction41() {
2171 List<Action> actionList = new ArrayList<Action>();
2172 ActionBuilder ab = new ActionBuilder();
2173 ActionBuilder ab1 = new ActionBuilder();
2175 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2176 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2179 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
2180 SctpMatchBuilder sctpmatch1 = new SctpMatchBuilder();
2181 PortNumber srcport = new PortNumber(1435);
2182 PortNumber dstport = new PortNumber(22);
2183 sctpmatch.setSctpSourcePort(srcport);
2184 sctpmatch1.setSctpDestinationPort(dstport);
2185 setFieldBuilder.setLayer4Match(sctpmatch.build());
2186 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2187 ab.setKey(new ActionKey(0));
2188 actionList.add(ab.build());
2190 setFieldBuilder1.setLayer4Match(sctpmatch1.build());
2191 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2192 ab1.setKey(new ActionKey(1));
2193 actionList.add(ab1.build());
2195 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2196 aab.setAction(actionList);
2198 InstructionBuilder ib = new InstructionBuilder();
2199 ib.setKey(new InstructionKey(0));
2200 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2202 // Put our Instruction in a list of Instructions
2203 InstructionsBuilder isb = new InstructionsBuilder();
2204 List<Instruction> instructions = new ArrayList<Instruction>();
2205 instructions.add(ib.build());
2206 isb.setInstruction(instructions);
2210 private static InstructionsBuilder createAppyActionInstruction42() {
2212 List<Action> actionList = new ArrayList<Action>();
2213 ActionBuilder ab = new ActionBuilder();
2214 ActionBuilder ab1 = new ActionBuilder();
2215 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2216 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2219 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
2220 Icmpv4MatchBuilder icmpv4match1 = new Icmpv4MatchBuilder();
2221 icmpv4match.setIcmpv4Type((short) 8);
2222 icmpv4match1.setIcmpv4Code((short) 0);
2223 setFieldBuilder.setIcmpv4Match(icmpv4match.build());
2224 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2225 ab.setKey(new ActionKey(0));
2226 actionList.add(ab.build());
2228 setFieldBuilder1.setIcmpv4Match(icmpv4match1.build());
2229 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2230 ab1.setKey(new ActionKey(1));
2231 actionList.add(ab1.build());
2233 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2234 aab.setAction(actionList);
2236 InstructionBuilder ib = new InstructionBuilder();
2237 ib.setKey(new InstructionKey(0));
2238 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2240 // Put our Instruction in a list of Instructions
2241 InstructionsBuilder isb = new InstructionsBuilder();
2242 List<Instruction> instructions = new ArrayList<Instruction>();
2243 instructions.add(ib.build());
2244 isb.setInstruction(instructions);
2248 private static InstructionsBuilder createAppyActionInstruction43() {
2250 List<Action> actionList = new ArrayList<Action>();
2251 ActionBuilder ab = new ActionBuilder();
2252 ActionBuilder ab1 = new ActionBuilder();
2253 ActionBuilder ab2 = new ActionBuilder();
2254 ActionBuilder ab3 = new ActionBuilder();
2255 ActionBuilder ab4 = new ActionBuilder();
2257 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2258 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2259 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2260 SetFieldBuilder setFieldBuilder3 = new SetFieldBuilder();
2261 SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder();
2263 // setting the values of ARP
2264 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2265 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2266 Ipv4Prefix dstiparp = new Ipv4Prefix("200.71.9.52");
2267 Ipv4Prefix srciparp = new Ipv4Prefix("100.1.1.1");
2268 // create ARP match action
2269 ArpMatchBuilder arpmatch = new ArpMatchBuilder();
2270 ArpMatchBuilder arpmatch1 = new ArpMatchBuilder();
2271 ArpMatchBuilder arpmatch2 = new ArpMatchBuilder();
2272 ArpMatchBuilder arpmatch3 = new ArpMatchBuilder();
2273 ArpMatchBuilder arpmatch4 = new ArpMatchBuilder();
2274 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2275 arpsrc.setAddress(macsrc);
2276 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2277 arpdst.setAddress(macdest);
2278 arpmatch.setArpOp(2);
2279 arpmatch1.setArpSourceHardwareAddress(arpsrc.build());
2280 arpmatch2.setArpTargetHardwareAddress(arpdst.build());
2281 arpmatch3.setArpSourceTransportAddress(srciparp);
2282 arpmatch4.setArpTargetTransportAddress(dstiparp);
2283 setFieldBuilder.setLayer3Match(arpmatch.build());
2284 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2285 ab.setKey(new ActionKey(0));
2286 actionList.add(ab.build());
2288 setFieldBuilder1.setLayer3Match(arpmatch1.build());
2289 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2290 ab1.setKey(new ActionKey(1));
2291 actionList.add(ab1.build());
2293 setFieldBuilder2.setLayer3Match(arpmatch2.build());
2294 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2295 ab2.setKey(new ActionKey(2));
2296 actionList.add(ab2.build());
2298 setFieldBuilder3.setLayer3Match(arpmatch3.build());
2299 ab3.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2300 ab3.setKey(new ActionKey(3));
2301 actionList.add(ab3.build());
2303 setFieldBuilder4.setLayer3Match(arpmatch4.build());
2304 ab4.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2305 ab4.setKey(new ActionKey(4));
2306 actionList.add(ab4.build());
2308 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2309 aab.setAction(actionList);
2311 InstructionBuilder ib = new InstructionBuilder();
2312 ib.setKey(new InstructionKey(0));
2313 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2315 // Put our Instruction in a list of Instructions
2316 InstructionsBuilder isb = new InstructionsBuilder();
2317 List<Instruction> instructions = new ArrayList<Instruction>();
2318 instructions.add(ib.build());
2319 isb.setInstruction(instructions);
2323 private static InstructionsBuilder createAppyActionInstruction44() {
2325 List<Action> actionLists = new ArrayList<Action>();
2326 ActionBuilder ab = new ActionBuilder();
2327 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2328 ActionBuilder ab1 = new ActionBuilder();
2329 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2330 /* ActionBuilder ab2 = new ActionBuilder();
2331 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2332 ActionBuilder ab3 = new ActionBuilder();
2333 SetFieldBuilder setFieldBuilder3 = new SetFieldBuilder();
2334 ActionBuilder ab4 = new ActionBuilder();
2335 SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder(); */
2336 ActionBuilder ab5 = new ActionBuilder();
2337 SetFieldBuilder setFieldBuilder5 = new SetFieldBuilder();
2338 ActionBuilder ab6 = new ActionBuilder();
2339 SetFieldBuilder setFieldBuilder6 = new SetFieldBuilder();
2342 Ipv6MatchBuilder ipv6Builder = new Ipv6MatchBuilder();
2343 Ipv6MatchBuilder ipv6Builder1 = new Ipv6MatchBuilder();
2344 // Ipv6MatchBuilder ipv6Builder2 = new Ipv6MatchBuilder();
2345 // Ipv6MatchBuilder ipv6Builder3 = new Ipv6MatchBuilder();
2346 // Ipv6MatchBuilder ipv6Builder4 = new Ipv6MatchBuilder();
2347 Ipv6MatchBuilder ipv6Builder5 = new Ipv6MatchBuilder();
2348 Ipv6MatchBuilder ipv6Builder6 = new Ipv6MatchBuilder();
2350 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2");
2351 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1");
2352 // Ipv6Address ndtarget = new Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
2353 // MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
2354 // MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
2355 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2356 nextheader.setIpv6Exthdr(58);
2357 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2358 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2359 ipv6label.setIpv6Flabel(label);
2361 ipv6Builder.setIpv6Source(srcip6);
2362 ipv6Builder1.setIpv6Destination(dstip6);
2363 // ipv6Builder2.setIpv6NdTarget(ndtarget);
2364 // ipv6Builder3.setIpv6NdSll(ndsll);
2365 // ipv6Builder4.setIpv6NdTll(ndtll);
2366 ipv6Builder5.setIpv6ExtHeader(nextheader.build());
2367 ipv6Builder6.setIpv6Label(ipv6label.build());
2369 setFieldBuilder.setLayer3Match(ipv6Builder.build());
2370 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2371 ab.setKey(new ActionKey(0));
2372 actionLists.add(ab.build());
2374 setFieldBuilder1.setLayer3Match(ipv6Builder1.build());
2375 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2376 ab1.setKey(new ActionKey(1));
2377 actionLists.add(ab1.build());
2379 /* setFieldBuilder2.setLayer3Match(ipv6Builder2.build());
2380 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2381 ab2.setKey(new ActionKey(2));
2382 actionLists.add(ab2.build());
2384 setFieldBuilder3.setLayer3Match(ipv6Builder3.build());
2385 ab3.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2386 ab3.setKey(new ActionKey(3));
2387 actionLists.add(ab3.build());
2389 setFieldBuilder4.setLayer3Match(ipv6Builder4.build());
2390 ab4.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2391 ab4.setKey(new ActionKey(4));
2392 actionLists.add(ab4.build());
2394 setFieldBuilder5.setLayer3Match(ipv6Builder5.build());
2395 ab5.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder5.build()).build());
2396 ab5.setKey(new ActionKey(5));
2397 actionLists.add(ab5.build());
2399 setFieldBuilder6.setLayer3Match(ipv6Builder6.build());
2400 ab6.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder6.build()).build());
2401 ab6.setKey(new ActionKey(6));
2402 actionLists.add(ab6.build());
2404 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2405 aab.setAction(actionLists);
2407 InstructionBuilder ib = new InstructionBuilder();
2408 ib.setKey(new InstructionKey(0));
2409 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2411 // Put our Instruction in a list of Instructions
2412 InstructionsBuilder isb = new InstructionsBuilder();
2413 List<Instruction> instructions = new ArrayList<Instruction>();
2414 instructions.add(ib.build());
2415 isb.setInstruction(instructions);
2420 private static InstructionsBuilder createAppyActionInstruction45() {
2422 List<Action> actionList = new ArrayList<Action>();
2423 ActionBuilder ab = new ActionBuilder();
2424 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2425 ActionBuilder ab1 = new ActionBuilder();
2426 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2429 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
2430 Icmpv6MatchBuilder icmpv6match1 = new Icmpv6MatchBuilder();
2431 icmpv6match.setIcmpv6Type((short) 135);
2432 icmpv6match1.setIcmpv6Code((short) 0);
2433 setFieldBuilder.setIcmpv6Match(icmpv6match.build());
2434 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2435 ab.setKey(new ActionKey(0));
2436 actionList.add(ab.build());
2438 setFieldBuilder1.setIcmpv6Match(icmpv6match1.build());
2439 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2440 ab1.setKey(new ActionKey(1));
2441 actionList.add(ab1.build());
2443 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2444 aab.setAction(actionList);
2446 InstructionBuilder ib = new InstructionBuilder();
2447 ib.setKey(new InstructionKey(0));
2448 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2450 // Put our Instruction in a list of Instructions
2451 InstructionsBuilder isb = new InstructionsBuilder();
2452 List<Instruction> instructions = new ArrayList<Instruction>();
2453 instructions.add(ib.build());
2454 isb.setInstruction(instructions);
2458 private static InstructionsBuilder createAppyActionInstruction46() {
2460 List<Action> actionList = new ArrayList<Action>();
2461 ActionBuilder ab = new ActionBuilder();
2462 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2463 ActionBuilder ab1 = new ActionBuilder();
2464 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2465 ActionBuilder ab2 = new ActionBuilder();
2466 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2469 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2470 ProtocolMatchFieldsBuilder protomatch1 = new ProtocolMatchFieldsBuilder();
2471 ProtocolMatchFieldsBuilder protomatch2 = new ProtocolMatchFieldsBuilder();
2472 protomatch.setMplsLabel((long) 36008);
2473 protomatch1.setMplsTc((short) 4);
2474 protomatch2.setMplsBos((short) 1);
2475 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2476 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2477 ab.setKey(new ActionKey(0));
2478 actionList.add(ab.build());
2480 setFieldBuilder1.setProtocolMatchFields(protomatch1.build());
2481 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2482 ab1.setKey(new ActionKey(1));
2483 actionList.add(ab1.build());
2485 setFieldBuilder2.setProtocolMatchFields(protomatch2.build());
2486 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2487 ab2.setKey(new ActionKey(2));
2488 actionList.add(ab2.build());
2490 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2491 aab.setAction(actionList);
2493 InstructionBuilder ib = new InstructionBuilder();
2494 ib.setKey(new InstructionKey(0));
2495 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2497 // Put our Instruction in a list of Instructions
2498 InstructionsBuilder isb = new InstructionsBuilder();
2499 List<Instruction> instructions = new ArrayList<Instruction>();
2500 instructions.add(ib.build());
2501 isb.setInstruction(instructions);
2505 private static InstructionsBuilder createAppyActionInstruction47() {
2507 List<Action> actionList = new ArrayList<Action>();
2508 ActionBuilder ab = new ActionBuilder();
2509 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2511 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2512 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new byte[] { 0, 1, 0, 0 }).build());
2513 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2514 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2515 actionList.add(ab.build());
2517 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2518 aab.setAction(actionList);
2520 InstructionBuilder ib = new InstructionBuilder();
2521 ib.setKey(new InstructionKey(0));
2522 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2524 // Put our Instruction in a list of Instructions
2525 InstructionsBuilder isb = new InstructionsBuilder();
2526 List<Instruction> instructions = new ArrayList<Instruction>();
2527 instructions.add(ib.build());
2528 isb.setInstruction(instructions);
2532 private static InstructionsBuilder createAppyActionInstruction48() {
2534 List<Action> actionList = new ArrayList<Action>();
2535 ActionBuilder ab = new ActionBuilder();
2536 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2538 TunnelBuilder tunnel = new TunnelBuilder();
2539 tunnel.setTunnelId(BigInteger.valueOf(10668));
2540 setFieldBuilder.setTunnel(tunnel.build());
2541 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2542 actionList.add(ab.build());
2544 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2545 aab.setAction(actionList);
2547 InstructionBuilder ib = new InstructionBuilder();
2548 ib.setKey(new InstructionKey(0));
2549 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2551 // Put our Instruction in a list of Instructions
2552 InstructionsBuilder isb = new InstructionsBuilder();
2553 List<Instruction> instructions = new ArrayList<Instruction>();
2554 instructions.add(ib.build());
2555 isb.setInstruction(instructions);
2562 private static MatchBuilder createMatch1() {
2563 MatchBuilder match = new MatchBuilder();
2564 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2565 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2566 ipv4Match.setIpv4Destination(prefix);
2567 Ipv4Match i4m = ipv4Match.build();
2568 match.setLayer3Match(i4m);
2570 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2571 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2572 ethTypeBuilder.setType(new EtherType(0x0800L));
2573 eth.setEthernetType(ethTypeBuilder.build());
2574 match.setEthernetMatch(eth.build());
2581 private static MatchBuilder createIPv4DstMatch() {
2582 MatchBuilder match = new MatchBuilder();
2583 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2584 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2585 ipv4Match.setIpv4Destination(prefix);
2586 Ipv4Match i4m = ipv4Match.build();
2587 match.setLayer3Match(i4m);
2595 private static MatchBuilder createIPv4SrcMatch() {
2596 MatchBuilder match = new MatchBuilder();
2597 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2598 Ipv4Prefix prefix = new Ipv4Prefix("10.20.30.40/24");
2599 ipv4Match.setIpv4Source(prefix);
2600 Ipv4Match i4m = ipv4Match.build();
2601 match.setLayer3Match(i4m);
2603 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2604 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2605 ethTypeBuilder.setType(new EtherType(0x0800L));
2606 eth.setEthernetType(ethTypeBuilder.build());
2607 match.setEthernetMatch(eth.build());
2614 private static MatchBuilder createMatch2() {
2615 MatchBuilder match = new MatchBuilder();
2616 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2617 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1");
2618 ipv4Match.setIpv4Source(prefix);
2619 Ipv4Match i4m = ipv4Match.build();
2620 match.setLayer3Match(i4m);
2622 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2623 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2624 ethTypeBuilder.setType(new EtherType(0x0800L));
2625 eth.setEthernetType(ethTypeBuilder.build());
2626 match.setEthernetMatch(eth.build());
2633 private static MatchBuilder createMatch3() {
2634 MatchBuilder match = new MatchBuilder();
2635 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
2636 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
2637 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
2638 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
2639 match.setEthernetMatch(ethernetMatch.build());
2647 private static MatchBuilder createICMPv6Match1() {
2649 MatchBuilder match = new MatchBuilder();
2650 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2651 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2652 ethTypeBuilder.setType(new EtherType(0x86ddL));
2653 eth.setEthernetType(ethTypeBuilder.build());
2654 match.setEthernetMatch(eth.build());
2656 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2657 ipmatch.setIpProtocol((short) 256);
2658 match.setIpMatch(ipmatch.build());
2660 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2662 icmpv6match.setIcmpv6Type((short) 135);
2663 icmpv6match.setIcmpv6Code((short) 1);
2664 match.setIcmpv6Match(icmpv6match.build());
2669 private static MatchBuilder createMatch33() {
2671 MatchBuilder match = new MatchBuilder();
2672 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2673 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.10");
2674 ipv4Match.setIpv4Source(prefix);
2675 Ipv4Match i4m = ipv4Match.build();
2676 match.setLayer3Match(i4m);
2678 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2679 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2680 ethTypeBuilder.setType(new EtherType(0xfffeL));
2681 eth.setEthernetType(ethTypeBuilder.build());
2682 match.setEthernetMatch(eth.build());
2686 private static MatchBuilder createInphyportMatch() {
2687 MatchBuilder match = new MatchBuilder();
2688 match.setInPort(202L);
2689 match.setInPhyPort(10122L);
2693 private static MatchBuilder createEthernetMatch() {
2694 MatchBuilder match = new MatchBuilder();
2696 byte[] mask1 = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2697 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2699 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
2701 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2702 EtherType type = new EtherType(0x0800L);
2703 ethmatch.setEthernetType(ethtype.setType(type).build());
2705 EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet
2708 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2709 ethdest.setAddress(macdest);
2710 ethdest.setMask(mask1);
2712 ethmatch.setEthernetDestination(ethdest.build());
2714 EthernetSourceBuilder ethsrc = new EthernetSourceBuilder();
2715 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2716 ethsrc.setAddress(macsrc);
2717 ethsrc.setMask(mask2);
2719 ethmatch.setEthernetSource(ethsrc.build());
2720 match.setEthernetMatch(ethmatch.build());
2729 private static MatchBuilder createVlanMatch() {
2730 MatchBuilder match = new MatchBuilder();
2731 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder(); // vlan match
2732 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
2733 VlanId vlanId = new VlanId(10);
2734 VlanPcp vpcp = new VlanPcp((short) 3);
2735 vlanBuilder.setVlanPcp(vpcp);
2736 vlanIdBuilder.setVlanId(vlanId);
2737 vlanIdBuilder.setVlanIdPresent(true);
2738 vlanBuilder.setVlanId(vlanIdBuilder.build());
2739 match.setVlanMatch(vlanBuilder.build());
2746 private static MatchBuilder createArpMatch() {
2747 MatchBuilder match = new MatchBuilder();
2749 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2750 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2751 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2753 byte[] mask = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2754 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2756 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2757 EtherType type = new EtherType(0x0806L);
2758 ethmatch.setEthernetType(ethtype.setType(type).build());
2760 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
2761 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2763 ArpMatchBuilder arpmatch = new ArpMatchBuilder(); // arp match
2764 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2765 arpsrc.setAddress(macsrc);
2766 arpsrc.setMask(mask);
2767 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2768 arpdst.setAddress(macdest);
2769 arpdst.setMask(mask2);
2770 arpmatch.setArpOp(2);
2771 arpmatch.setArpSourceHardwareAddress(arpsrc.build());
2772 arpmatch.setArpTargetHardwareAddress(arpdst.build());
2773 arpmatch.setArpSourceTransportAddress(srcip);
2774 arpmatch.setArpTargetTransportAddress(dstip);
2776 match.setEthernetMatch(ethmatch.build());
2777 match.setLayer3Match(arpmatch.build());
2785 private static MatchBuilder createIPMatch() {
2786 MatchBuilder match = new MatchBuilder();
2787 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2788 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2789 EtherType type = new EtherType(0x0800L);
2790 ethmatch.setEthernetType(ethtype.setType(type).build());
2791 match.setEthernetMatch(ethmatch.build());
2793 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2794 ipmatch.setIpProtocol((short) 1);
2795 Dscp dscp = new Dscp((short) 3);
2796 ipmatch.setIpDscp(dscp);
2797 ipmatch.setIpEcn((short) 2);
2798 match.setIpMatch(ipmatch.build());
2805 private static MatchBuilder createL3IPv4Match() {
2806 MatchBuilder match = new MatchBuilder();
2808 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2809 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2810 ethTypeBuilder.setType(new EtherType(0x0800L));
2811 eth.setEthernetType(ethTypeBuilder.build());
2812 match.setEthernetMatch(eth.build());
2814 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2815 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
2816 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2817 Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
2818 ipv4match.setIpv4Destination(dstip);
2819 ipv4match.setIpv4Source(srcip);
2820 match.setLayer3Match(ipv4match.build());
2829 private static MatchBuilder createL3IPv6Match() {
2830 MatchBuilder match = new MatchBuilder();
2832 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2833 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2834 ethTypeBuilder.setType(new EtherType(0x86ddL));
2835 eth.setEthernetType(ethTypeBuilder.build());
2836 match.setEthernetMatch(eth.build());
2838 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2/64");
2839 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1/56");
2840 Ipv6Address ndtarget = new Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
2841 MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
2842 MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
2843 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2844 nextheader.setIpv6Exthdr(58);
2845 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2846 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2847 ipv6label.setIpv6Flabel(label);
2848 ipv6label.setFlabelMask(new byte[] { 0, 1, -1, -1 });
2850 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2852 icmpv6match.setIcmpv6Type((short) 135);
2853 icmpv6match.setIcmpv6Code((short) 0);
2854 match.setIcmpv6Match(icmpv6match.build());
2856 Ipv6MatchBuilder ipv6match = new Ipv6MatchBuilder();
2857 // ipv6match.setIpv6Source(srcip6);
2858 // ipv6match.setIpv6Destination(dstip6);
2859 // ipv6match.setIpv6ExtHeader(nextheader.build());
2860 ipv6match.setIpv6NdSll(ndsll);
2861 ipv6match.setIpv6NdTll(ndtll);
2862 // ipv6match.setIpv6NdTarget(ndtarget);
2863 ipv6match.setIpv6Label(ipv6label.build());
2865 match.setLayer3Match(ipv6match.build());
2874 private static MatchBuilder createICMPv4Match() {
2875 MatchBuilder match = new MatchBuilder();
2876 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2877 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2878 ethTypeBuilder.setType(new EtherType(0x0800L));
2879 eth.setEthernetType(ethTypeBuilder.build());
2880 match.setEthernetMatch(eth.build());
2882 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2883 ipmatch.setIpProtocol((short) 1);
2884 match.setIpMatch(ipmatch.build());
2886 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder(); // icmpv4
2888 icmpv4match.setIcmpv4Type((short) 8);
2889 icmpv4match.setIcmpv4Code((short) 0);
2890 match.setIcmpv4Match(icmpv4match.build());
2897 private static MatchBuilder createICMPv6Match() {
2899 MatchBuilder match = new MatchBuilder();
2900 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2901 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2902 ethTypeBuilder.setType(new EtherType(0x86ddL));
2903 eth.setEthernetType(ethTypeBuilder.build());
2904 match.setEthernetMatch(eth.build());
2906 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2907 ipmatch.setIpProtocol((short) 58);
2908 match.setIpMatch(ipmatch.build());
2910 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2912 icmpv6match.setIcmpv6Type((short) 135);
2913 icmpv6match.setIcmpv6Code((short) 1);
2914 match.setIcmpv6Match(icmpv6match.build());
2922 private static MatchBuilder createToSMatch() {
2923 MatchBuilder match = new MatchBuilder();
2924 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2925 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2926 EtherType type = new EtherType(0x0800L);
2927 ethmatch.setEthernetType(ethtype.setType(type).build());
2928 match.setEthernetMatch(ethmatch.build());
2930 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2931 ipmatch.setIpProtocol((short) 6);
2932 Dscp dscp = new Dscp((short) 8);
2933 ipmatch.setIpDscp(dscp);
2934 match.setIpMatch(ipmatch.build());
2942 private static MatchBuilder createL4TCPMatch() {
2943 MatchBuilder match = new MatchBuilder();
2945 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2946 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2947 ethTypeBuilder.setType(new EtherType(0x0800L));
2948 eth.setEthernetType(ethTypeBuilder.build());
2949 match.setEthernetMatch(eth.build());
2951 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2952 ipmatch.setIpProtocol((short) 6);
2953 match.setIpMatch(ipmatch.build());
2955 PortNumber srcport = new PortNumber(1213);
2956 PortNumber dstport = new PortNumber(646);
2957 TcpMatchBuilder tcpmatch = new TcpMatchBuilder(); // tcp match
2958 tcpmatch.setTcpSourcePort(srcport);
2959 tcpmatch.setTcpDestinationPort(dstport);
2960 match.setLayer4Match(tcpmatch.build());
2968 private static MatchBuilder createL4UDPMatch() {
2969 MatchBuilder match = new MatchBuilder();
2971 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2972 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2973 ethTypeBuilder.setType(new EtherType(0x0800L));
2974 eth.setEthernetType(ethTypeBuilder.build());
2975 match.setEthernetMatch(eth.build());
2977 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2978 ipmatch.setIpProtocol((short) 17);
2979 match.setIpMatch(ipmatch.build());
2981 PortNumber srcport = new PortNumber(1325);
2982 PortNumber dstport = new PortNumber(42);
2983 UdpMatchBuilder udpmatch = new UdpMatchBuilder(); // udp match
2984 udpmatch.setUdpDestinationPort(dstport);
2985 udpmatch.setUdpSourcePort(srcport);
2986 match.setLayer4Match(udpmatch.build());
2994 private static MatchBuilder createL4SCTPMatch() {
2995 MatchBuilder match = new MatchBuilder();
2997 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2998 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2999 ethTypeBuilder.setType(new EtherType(0x0800L));
3000 eth.setEthernetType(ethTypeBuilder.build());
3001 match.setEthernetMatch(eth.build());
3003 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3004 ipmatch.setIpProtocol((short) 132);
3005 match.setIpMatch(ipmatch.build());
3007 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
3008 PortNumber srcport = new PortNumber(1435);
3009 PortNumber dstport = new PortNumber(22);
3010 sctpmatch.setSctpSourcePort(srcport);
3011 sctpmatch.setSctpDestinationPort(dstport);
3012 match.setLayer4Match(sctpmatch.build());
3020 private static MatchBuilder createMetadataMatch() {
3021 MatchBuilder match = new MatchBuilder();
3022 byte[] metamask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
3023 MetadataBuilder metadata = new MetadataBuilder(); // metadata match
3024 metadata.setMetadata(BigInteger.valueOf(500L));
3025 metadata.setMetadataMask(metamask);
3026 match.setMetadata(metadata.build());
3034 private static MatchBuilder createMplsMatch() {
3035 MatchBuilder match = new MatchBuilder();
3037 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3038 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3039 ethTypeBuilder.setType(new EtherType(0x8847L));
3040 eth.setEthernetType(ethTypeBuilder.build());
3041 match.setEthernetMatch(eth.build());
3043 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3045 protomatch.setMplsLabel((long) 36008);
3046 protomatch.setMplsTc((short) 4);
3047 protomatch.setMplsBos((short) 1);
3048 match.setProtocolMatchFields(protomatch.build());
3057 private static MatchBuilder createPbbMatch() {
3058 MatchBuilder match = new MatchBuilder();
3060 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3061 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3062 ethTypeBuilder.setType(new EtherType(0x88E7L));
3063 eth.setEthernetType(ethTypeBuilder.build());
3064 match.setEthernetMatch(eth.build());
3066 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3068 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new byte[] { 0, 1, 0, 0 }).build());
3069 match.setProtocolMatchFields(protomatch.build());
3078 private static MatchBuilder createTunnelIDMatch() {
3079 MatchBuilder match = new MatchBuilder();
3080 TunnelBuilder tunnel = new TunnelBuilder(); // tunnel id match
3081 tunnel.setTunnelId(BigInteger.valueOf(10668));
3082 byte[] mask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
3083 tunnel.setTunnelMask(mask);
3084 match.setTunnel(tunnel.build());
3089 public void _removeMDFlow(CommandInterpreter ci) {
3090 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
3091 NodeBuilder tn = createTestNode(ci.nextArgument());
3092 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
3093 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class).child(Node.class, tn.getKey())
3094 .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf.getTableId()))
3095 .child(Flow.class, tf.getKey()).build();
3096 modification.removeOperationalData(nodeBuilderToInstanceId(tn));
3097 modification.removeOperationalData(path1);
3098 modification.removeConfigurationData(nodeBuilderToInstanceId(tn));
3099 modification.removeConfigurationData(path1);
3100 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
3102 RpcResult<TransactionStatus> result = commitFuture.get();
3103 TransactionStatus status = result.getResult();
3104 ci.println("Status of Flow Data Loaded Transaction: " + status);
3106 } catch (InterruptedException e) {
3107 LOG.error(e.getMessage(), e);
3108 } catch (ExecutionException e) {
3109 LOG.error(e.getMessage(), e);
3113 public void _addMDFlow(CommandInterpreter ci) {
3114 NodeBuilder tn = createTestNode(ci.nextArgument());
3115 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
3116 writeFlow(ci, tf, tn);
3119 private void writeFlow(CommandInterpreter ci, FlowBuilder flow, NodeBuilder nodeBuilder) {
3120 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
3121 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class)
3122 .child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
3123 .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.getKey()).build();
3124 modification.putOperationalData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
3125 modification.putOperationalData(path1, flow.build());
3126 modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
3127 modification.putConfigurationData(path1, flow.build());
3128 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
3130 RpcResult<TransactionStatus> result = commitFuture.get();
3131 TransactionStatus status = result.getResult();
3132 ci.println("Status of Flow Data Loaded Transaction: " + status);
3134 } catch (InterruptedException e) {
3135 LOG.error(e.getMessage(), e);
3136 } catch (ExecutionException e) {
3137 LOG.error(e.getMessage(), e);
3141 public void _modifyMDFlow(CommandInterpreter ci) {
3142 NodeBuilder tn = createTestNode(ci.nextArgument());
3143 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
3144 tf.setFlowName(updatedFlowName);
3145 writeFlow(ci, tf, tn);
3146 tf.setFlowName(originalFlowName);
3147 writeFlow(ci, tf, tn);
3150 private static NodeRef createNodeRef(String string) {
3151 NodeKey key = new NodeKey(new NodeId(string));
3152 InstanceIdentifier<Node> path = InstanceIdentifier.builder().node(Nodes.class).node(Node.class, key)
3155 return new NodeRef(path);
3159 public String getHelp() {