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.NodeConnectorId;
140 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemoved;
141 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated;
142 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
143 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
144 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRemoved;
145 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated;
146 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
147 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.OpendaylightInventoryListener;
148 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
149 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
150 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
151 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
152 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
153 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
154 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
155 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddressBuilder;
156 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpTargetHardwareAddressBuilder;
157 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
158 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder;
159 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
160 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6ExtHeaderBuilder;
161 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6LabelBuilder;
162 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
163 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder;
164 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder;
165 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
166 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.MetadataBuilder;
167 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder;
168 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TunnelBuilder;
169 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
170 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder;
171 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match;
172 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
173 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
174 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder;
175 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
176 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
177 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.protocol.match.fields.PbbBuilder;
178 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
179 import org.opendaylight.yangtools.concepts.Registration;
180 import org.opendaylight.yangtools.yang.binding.DataObject;
181 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
182 import org.opendaylight.yangtools.yang.common.RpcResult;
183 import org.osgi.framework.BundleContext;
184 import org.slf4j.Logger;
185 import org.slf4j.LoggerFactory;
187 public class OpenflowpluginTestCommandProvider implements CommandProvider {
189 private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
191 private DataBrokerService dataBrokerService;
192 private ProviderContext pc;
193 private final BundleContext ctx;
194 private FlowBuilder testFlow;
195 private NodeBuilder testNode;
196 private final String originalFlowName = "Foo";
197 private final String updatedFlowName = "Bar";
198 private final FlowEventListener flowEventListener = new FlowEventListener();
199 private final PortEventListener portEventListener = new PortEventListener();
200 private static NotificationService notificationService;
201 private Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> listener1Reg;
202 private Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> listener2Reg;
204 public OpenflowpluginTestCommandProvider(BundleContext ctx) {
208 public void onSessionInitiated(ProviderContext session) {
210 notificationService = session.getSALService(NotificationService.class);
212 listener1Reg = notificationService.registerNotificationListener(flowEventListener);
213 listener2Reg = notificationService.registerNotificationListener(portEventListener);
214 dataBrokerService = session.getSALService(DataBrokerService.class);
215 ctx.registerService(CommandProvider.class.getName(), this, null);
216 createTestFlow(createTestNode(null), null, null);
219 private NodeBuilder createTestNode(String nodeId) {
220 if (nodeId == null) {
221 nodeId = OpenflowpluginTestActivator.NODE_ID;
223 NodeRef nodeOne = createNodeRef(nodeId);
224 NodeBuilder builder = new NodeBuilder();
225 builder.setId(new NodeId(nodeId));
226 builder.setKey(new NodeKey(builder.getId()));
231 final class FlowEventListener implements SalFlowListener {
233 List<FlowAdded> addedFlows = new ArrayList<>();
234 List<FlowRemoved> removedFlows = new ArrayList<>();
235 List<FlowUpdated> updatedFlows = new ArrayList<>();
238 public void onFlowAdded(FlowAdded notification) {
239 System.out.println("flow to be added.........................." + notification.toString());
240 System.out.println("added flow Xid........................." + notification.getTransactionId().getValue());
241 System.out.println("-----------------------------------------------------------------------------------");
242 addedFlows.add(notification);
246 public void onFlowRemoved(FlowRemoved notification) {
247 System.out.println("removed flow.........................." + notification.toString());
248 System.out.println("remove flow Xid........................." + notification.getTransactionId().getValue());
249 System.out.println("-----------------------------------------------------------------------------------");
250 removedFlows.add(notification);
254 public void onFlowUpdated(FlowUpdated notification) {
255 System.out.println("updated flow.........................." + notification.toString());
257 .println("updated flow Xid........................." + notification.getTransactionId().getValue());
258 System.out.println("-----------------------------------------------------------------------------------");
259 updatedFlows.add(notification);
263 public void onNodeErrorNotification(NodeErrorNotification notification) {
264 System.out.println("Error notification flow Xid........................."
265 + notification.getTransactionId().getValue());
266 System.out.println("-----------------------------------------------------------------------------------");
270 public void onNodeExperimenterErrorNotification(NodeExperimenterErrorNotification notification) {
271 // TODO Auto-generated method stub
276 public void onSwitchFlowRemoved(SwitchFlowRemoved notification) {
278 .println("Switch flow removed : Cookies..................." + notification.getCookie().toString());
279 System.out.println("-----------------------------------------------------------------------------------");
284 final class PortEventListener implements OpendaylightInventoryListener {
286 List<NodeUpdated> nodeUpdated = new ArrayList<>();
287 List<NodeRemoved> nodeRemoved = new ArrayList<>();
288 List<NodeConnectorUpdated> nodeConnectorUpdated = new ArrayList<>();
289 List<NodeConnectorRemoved> nodeConnectorRemoved = new ArrayList<>();
292 public void onNodeConnectorRemoved(NodeConnectorRemoved notification) {
293 System.out.println("NodeConnectorRemoved Notification ...................");
294 System.out.println(notification.getNodeConnectorRef());
295 System.out.println("----------------------------------------------------------------------");
296 nodeConnectorRemoved.add(notification);
300 public void onNodeConnectorUpdated(NodeConnectorUpdated notification) {
301 System.out.println("NodeConnectorUpdated Notification...................");
302 System.out.println(notification.getNodeConnectorRef());
303 System.out.println("----------------------------------------------------------------------");
304 nodeConnectorUpdated.add(notification);
308 public void onNodeRemoved(NodeRemoved notification) {
309 System.out.println("NodeConnectorUpdated Notification ...................");
310 System.out.println(notification.getNodeRef());
311 System.out.println("----------------------------------------------------------------------");
312 nodeRemoved.add(notification);
316 public void onNodeUpdated(NodeUpdated notification) {
317 System.out.println("NodeConnectorUpdated Notification ...................");
318 System.out.println(notification.getNodeRef());
319 System.out.println("----------------------------------------------------------------------");
320 nodeUpdated.add(notification);
324 private InstanceIdentifier<Node> nodeBuilderToInstanceId(NodeBuilder node) {
325 return InstanceIdentifier.builder(Nodes.class).child(Node.class, node.getKey()).toInstance();
328 private FlowBuilder createTestFlow(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
330 FlowBuilder flow = new FlowBuilder();
333 String flowType = flowTypeArg;
334 if (flowType == null) {
341 flow.setMatch(createMatch1().build());
342 flow.setInstructions(createDecNwTtlInstructions().build());
346 flow.setMatch(createMatch2().build());
347 flow.setInstructions(createDropInstructions().build());
351 flow.setMatch(createMatch3().build());
352 flow.setInstructions(createDropInstructions().build());
356 flow.setMatch(createEthernetMatch().build());
357 flow.setInstructions(createDropInstructions().build());
361 flow.setMatch(createMatch1().build());
362 flow.setInstructions(createAppyActionInstruction().build());
366 flow.setMatch(createMatch1().build());
367 flow.setInstructions(createGotoTableInstructions().build());
371 flow.setMatch(createMatch1().build());
372 flow.setInstructions(createMeterInstructions().build());
376 flow.setMatch(createMatch1().build());
377 flow.setInstructions(createAppyActionInstruction1().build());
381 flow.setMatch(createMatch1().build());
382 flow.setInstructions(createAppyActionInstruction2().build());
386 flow.setMatch(createMatch1().build());
387 flow.setInstructions(createAppyActionInstruction3().build());
391 flow.setMatch(createMatch1().build());
392 flow.setInstructions(createAppyActionInstruction4().build());
396 flow.setMatch(createMatch1().build());
397 flow.setInstructions(createAppyActionInstruction5().build());
401 flow.setMatch(createMatch1().build());
402 flow.setInstructions(createAppyActionInstruction6().build());
406 flow.setMatch(createMatch1().build());
407 flow.setInstructions(createAppyActionInstruction7().build());
411 flow.setMatch(createMatch1().build());
412 flow.setInstructions(createAppyActionInstruction8().build());
416 flow.setMatch(createMatch1().build());
417 flow.setInstructions(createAppyActionInstruction9().build());
421 flow.setMatch(createMatch1().build());
422 flow.setInstructions(createAppyActionInstruction10().build());
426 flow.setMatch(createMatch1().build());
427 flow.setInstructions(createAppyActionInstruction11().build());
431 flow.setMatch(createMatch1().build());
432 flow.setInstructions(createAppyActionInstruction12().build());
436 flow.setMatch(createMatch1().build());
437 flow.setInstructions(createAppyActionInstruction13().build());
441 flow.setMatch(createMatch1().build());
442 flow.setInstructions(createAppyActionInstruction14().build());
446 flow.setMatch(createMatch1().build());
447 flow.setInstructions(createAppyActionInstruction15().build());
451 flow.setMatch(createMatch1().build());
452 flow.setInstructions(createAppyActionInstruction16().build());
456 flow.setMatch(createMatch1().build());
457 flow.setInstructions(createAppyActionInstruction17().build());
461 flow.setMatch(createMatch1().build());
462 flow.setInstructions(createAppyActionInstruction18().build());
466 flow.setMatch(createMatch1().build());
467 flow.setInstructions(createAppyActionInstruction19().build());
471 flow.setMatch(createMatch1().build());
472 flow.setInstructions(createMetadataInstructions().build());
476 flow.setMatch(createMatch1().build());
477 flow.setInstructions(createAppyActionInstruction20().build());
481 flow.setMatch(createMatch1().build());
482 flow.setInstructions(createAppyActionInstruction21().build());
486 flow.setMatch(createMatch1().build());
487 flow.setInstructions(createAppyActionInstruction22().build());
491 flow.setMatch(createMatch1().build());
492 flow.setInstructions(createAppyActionInstruction23(nodeBuilder.getId()).build());
496 flow.setMatch(createMatch1().build());
497 flow.setInstructions(createAppyActionInstruction24().build());
501 flow.setMatch(createMatch1().build());
502 flow.setInstructions(createAppyActionInstruction25().build());
506 flow.setMatch(createMatch1().build());
507 flow.setInstructions(createAppyActionInstruction26().build());
511 flow.setMatch(createMatch1().build());
512 flow.setInstructions(createAppyActionInstruction27().build());
516 flow.setMatch(createMatch1().build());
517 flow.setInstructions(createAppyActionInstruction28().build());
521 flow.setMatch(createMatch1().build());
522 flow.setInstructions(createAppyActionInstruction29().build());
526 flow.setMatch(createMatch1().build());
527 flow.setInstructions(createAppyActionInstruction30().build());
531 flow.setMatch(createMatch1().build());
532 flow.setInstructions(createAppyActionInstruction31().build());
536 flow.setMatch(createMatch1().build());
537 flow.setInstructions(createAppyActionInstruction32().build());
541 flow.setMatch(createMatch1().build());
542 flow.setInstructions(createAppyActionInstruction33().build());
546 flow.setMatch(createMatch1().build());
547 flow.setInstructions(createAppyActionInstruction34().build());
551 flow.setMatch(createICMPv6Match().build());
552 flow.setInstructions(createDecNwTtlInstructions().build());
556 flow.setMatch(createInphyportMatch(nodeBuilder.getId()).build());
557 flow.setInstructions(createDropInstructions().build());
561 flow.setMatch(createMetadataMatch().build());
562 flow.setInstructions(createDropInstructions().build());
566 flow.setMatch(createL3IPv6Match().build());
567 flow.setInstructions(createDecNwTtlInstructions().build());
571 flow.setMatch(createL4SCTPMatch().build());
572 flow.setInstructions(createAppyActionInstruction().build());
576 flow.setMatch(createTunnelIDMatch().build());
577 flow.setInstructions(createGotoTableInstructions().build());
581 flow.setMatch(createVlanMatch().build());
582 flow.setInstructions(createMeterInstructions().build());
586 flow.setMatch(createPbbMatch().build());
587 flow.setInstructions(createMeterInstructions().build());
591 flow.setMatch(createVlanMatch().build());
592 flow.setInstructions(createDropInstructions().build());
596 flow.setMatch(createL4TCPMatch().build());
597 flow.setInstructions(createDropInstructions().build());
602 flow.setMatch(createL4UDPMatch().build());
603 flow.setInstructions(createDropInstructions().build());
607 flow.setMatch(new MatchBuilder().build());
608 flow.setInstructions(createSentToControllerInstructions().build());
612 flow.setMatch(createToSMatch().build());
613 flow.setInstructions(createDropInstructions().build());
617 flow.setMatch(createToSMatch().build());
618 flow.setInstructions(createOutputInstructions("INPORT", 10).build());
622 flow.setMatch(createToSMatch().build());
623 flow.setInstructions(createOutputInstructions("FLOOD", 20).build());
627 flow.setMatch(createToSMatch().build());
628 flow.setInstructions(createOutputInstructions("ALL", 30).build());
632 flow.setMatch(createToSMatch().build());
633 flow.setInstructions(createOutputInstructions("NORMAL", 40).build());
637 flow.setMatch(createToSMatch().build());
638 flow.setInstructions(createOutputInstructions("LOCAL", 50).build());
642 flow.setMatch(createToSMatch().build());
643 flow.setInstructions(createOutputInstructions("TABLE", 60).build());
647 flow.setMatch(createToSMatch().build());
648 flow.setInstructions(createOutputInstructions("NONE", 70).build());
652 flow.setMatch(createToSMatch().build());
653 flow.setInstructions(createStripVlanInstructions().build());
654 flow.setBarrier(Boolean.TRUE);
658 flow.setMatch(createMatch1().build());
659 flow.setInstructions(createAppyActionInstruction35().build());
663 flow.setMatch(createMatch1().build());
664 flow.setInstructions(createAppyActionInstruction36().build());
668 flow.setMatch(createMatch1().build());
669 flow.setInstructions(createAppyActionInstruction37().build());
673 flow.setMatch(createMatch1().build());
674 flow.setInstructions(createAppyActionInstruction38().build());
678 flow.setMatch(createL4TCPMatch().build());
679 flow.setInstructions(createAppyActionInstruction39().build());
683 flow.setMatch(createL4UDPMatch().build());
684 flow.setInstructions(createAppyActionInstruction40().build());
688 flow.setMatch(createL4SCTPMatch().build());
689 flow.setInstructions(createAppyActionInstruction41().build());
693 flow.setMatch(createICMPv4Match().build());
694 flow.setInstructions(createAppyActionInstruction42().build());
698 flow.setMatch(createArpMatch().build());
699 flow.setInstructions(createAppyActionInstruction43().build());
703 flow.setMatch(createL3IPv6Match().build());
704 flow.setInstructions(createAppyActionInstruction44().build());
708 flow.setMatch(createICMPv6Match().build());
709 flow.setInstructions(createAppyActionInstruction45().build());
713 flow.setMatch(createMplsMatch().build());
714 flow.setInstructions(createAppyActionInstruction46().build());
718 flow.setMatch(createPbbMatch().build());
719 flow.setInstructions(createAppyActionInstruction47().build());
723 flow.setMatch(createTunnelIDMatch().build());
724 flow.setInstructions(createAppyActionInstruction48().build());
728 flow.setMatch(createMatch33().build());
729 flow.setInstructions(createDropInstructions().build());
733 flow.setMatch(createICMPv6Match1().build());
734 flow.setInstructions(createDecNwTtlInstructions().build());
738 flow.setMatch(createMatch1().build());
739 flow.setInstructions(createAppyActionInstruction88().build());
742 LOG.warn("flow type not understood: {}", flowType);
745 FlowKey key = new FlowKey(new FlowId(id));
746 if (null == flow.isBarrier()) {
747 flow.setBarrier(Boolean.FALSE);
749 // flow.setBufferId(new Long(12));
750 BigInteger value = new BigInteger("10", 10);
751 BigInteger outputPort = new BigInteger("65535", 10);
752 flow.setCookie(value);
753 flow.setCookieMask(value);
754 flow.setHardTimeout(0);
755 flow.setIdleTimeout(0);
756 flow.setInstallHw(false);
757 flow.setStrict(false);
758 flow.setContainerName(null);
759 flow.setFlags(new FlowModFlags(false, false, false, false, true));
760 flow.setId(new FlowId(new Long(12)));
761 flow.setTableId(getTableId(tableId));
762 flow.setOutGroup(new Long(2));
763 // set outport to OFPP_NONE (65535) to disable remove restriction for
765 flow.setOutPort(outputPort);
769 flow.setFlowName(originalFlowName + "X" + flowType);
774 private short getTableId(String tableId) {
777 table = Short.parseShort(tableId);
778 } catch (Exception ex) {
779 // ignore exception and continue with default value
789 private static InstructionsBuilder createDecNwTtlInstructions() {
790 DecNwTtlBuilder ta = new DecNwTtlBuilder();
791 DecNwTtl decNwTtl = ta.build();
792 ActionBuilder ab = new ActionBuilder();
793 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
795 // Add our drop action to a list
796 List<Action> actionList = new ArrayList<Action>();
797 actionList.add(ab.build());
799 // Create an Apply Action
800 ApplyActionsBuilder aab = new ApplyActionsBuilder();
801 aab.setAction(actionList);
803 // Wrap our Apply Action in an Instruction
804 InstructionBuilder ib = new InstructionBuilder();
805 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
806 ib.setKey(new InstructionKey(0));
809 // Put our Instruction in a list of Instructions
810 InstructionsBuilder isb = new InstructionsBuilder();
811 List<Instruction> instructions = new ArrayList<Instruction>();
812 instructions.add(ib.build());
813 isb.setInstruction(instructions);
820 private static InstructionsBuilder createMeterInstructions() {
822 MeterBuilder aab = new MeterBuilder();
823 aab.setMeterId(new MeterId(new Long(1)));
825 InstructionBuilder ib = new InstructionBuilder();
826 ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
828 // Put our Instruction in a list of Instructions
829 InstructionsBuilder isb = new InstructionsBuilder();
830 List<Instruction> instructions = new ArrayList<Instruction>();
831 instructions.add(ib.build());
832 isb.setInstruction(instructions);
836 private static InstructionsBuilder createMetadataInstructions() {
838 WriteMetadataBuilder aab = new WriteMetadataBuilder();
839 aab.setMetadata(new BigInteger("10", 10));
840 aab.setMetadataMask(new BigInteger("12", 10));
842 InstructionBuilder ib = new InstructionBuilder();
843 ib.setInstruction(new WriteMetadataCaseBuilder().setWriteMetadata(aab.build()).build());
845 // Put our Instruction in a list of Instructions
846 InstructionsBuilder isb = new InstructionsBuilder();
847 List<Instruction> instructions = new ArrayList<Instruction>();
848 instructions.add(ib.build());
849 isb.setInstruction(instructions);
853 private static InstructionsBuilder createGotoTableInstructions() {
855 GoToTableBuilder aab = new GoToTableBuilder();
856 aab.setTableId((short) 2);
858 InstructionBuilder ib = new InstructionBuilder();
859 ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(aab.build()).build());
861 // Put our Instruction in a list of Instructions
862 InstructionsBuilder isb = new InstructionsBuilder();
863 List<Instruction> instructions = new ArrayList<Instruction>();
864 instructions.add(ib.build());
865 isb.setInstruction(instructions);
869 private static InstructionsBuilder createDropInstructions() {
870 DropActionBuilder dab = new DropActionBuilder();
871 DropAction dropAction = dab.build();
872 ActionBuilder ab = new ActionBuilder();
873 ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build());
875 // Add our drop action to a list
876 List<Action> actionList = new ArrayList<Action>();
877 actionList.add(ab.build());
879 // Create an Apply Action
880 ApplyActionsBuilder aab = new ApplyActionsBuilder();
881 aab.setAction(actionList);
883 // Wrap our Apply Action in an Instruction
884 InstructionBuilder ib = new InstructionBuilder();
885 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
887 // Put our Instruction in a list of Instructions
888 InstructionsBuilder isb = new InstructionsBuilder();
889 List<Instruction> instructions = new ArrayList<Instruction>();
890 instructions.add(ib.build());
891 isb.setInstruction(instructions);
895 private static InstructionsBuilder createAppyActionInstruction() {
897 List<Action> actionList = new ArrayList<Action>();
898 ActionBuilder ab = new ActionBuilder();
899 ControllerActionBuilder controller = new ControllerActionBuilder();
900 controller.setMaxLength(5);
901 ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.build()).build());
902 actionList.add(ab.build());
903 // Create an Apply Action
904 ApplyActionsBuilder aab = new ApplyActionsBuilder();
905 aab.setAction(actionList);
907 // Wrap our Apply Action in an Instruction
908 InstructionBuilder ib = new InstructionBuilder();
909 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
911 // Put our Instruction in a list of Instructions
912 InstructionsBuilder isb = new InstructionsBuilder();
913 List<Instruction> instructions = new ArrayList<Instruction>();
914 instructions.add(ib.build());
915 isb.setInstruction(instructions);
919 private static InstructionsBuilder createAppyActionInstruction1() {
921 List<Action> actionList = new ArrayList<Action>();
922 ActionBuilder ab = new ActionBuilder();
924 OutputActionBuilder output = new OutputActionBuilder();
925 output.setMaxLength(56);
926 Uri value = new Uri("PCEP");
927 output.setOutputNodeConnector(value);
928 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
929 actionList.add(ab.build());
930 // Create an Apply Action
931 ApplyActionsBuilder aab = new ApplyActionsBuilder();
932 aab.setAction(actionList);
934 // Wrap our Apply Action in an Instruction
935 InstructionBuilder ib = new InstructionBuilder();
936 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
938 // Put our Instruction in a list of Instructions
939 InstructionsBuilder isb = new InstructionsBuilder();
940 List<Instruction> instructions = new ArrayList<Instruction>();
941 instructions.add(ib.build());
942 isb.setInstruction(instructions);
946 private static InstructionsBuilder createSentToControllerInstructions() {
947 List<Action> actionList = new ArrayList<Action>();
948 ActionBuilder ab = new ActionBuilder();
950 OutputActionBuilder output = new OutputActionBuilder();
951 output.setMaxLength(56);
952 Uri value = new Uri("CONTROLLER");
953 output.setOutputNodeConnector(value);
954 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
956 ab.setKey(new ActionKey(0));
957 actionList.add(ab.build());
958 // Create an Apply Action
959 ApplyActionsBuilder aab = new ApplyActionsBuilder();
960 aab.setAction(actionList);
962 // Wrap our Apply Action in an Instruction
963 InstructionBuilder ib = new InstructionBuilder();
964 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
966 ib.setKey(new InstructionKey(0));
968 // Put our Instruction in a list of Instructions
969 InstructionsBuilder isb = new InstructionsBuilder();
970 List<Instruction> instructions = new ArrayList<Instruction>();
971 instructions.add(ib.build());
972 isb.setInstruction(instructions);
976 private static InstructionsBuilder createOutputInstructions(String outputType, int outputValue) {
977 List<Action> actionList = new ArrayList<Action>();
978 ActionBuilder ab = new ActionBuilder();
980 OutputActionBuilder output = new OutputActionBuilder();
981 output.setMaxLength(outputValue);
982 Uri value = new Uri(outputType);
983 output.setOutputNodeConnector(value);
984 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
986 ab.setKey(new ActionKey(0));
987 actionList.add(ab.build());
988 // Create an Apply Action
989 ApplyActionsBuilder aab = new ApplyActionsBuilder();
990 aab.setAction(actionList);
992 // Wrap our Apply Action in an Instruction
993 InstructionBuilder ib = new InstructionBuilder();
994 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
996 ib.setKey(new InstructionKey(0));
998 // Put our Instruction in a list of Instructions
999 InstructionsBuilder isb = new InstructionsBuilder();
1000 List<Instruction> instructions = new ArrayList<Instruction>();
1001 instructions.add(ib.build());
1002 isb.setInstruction(instructions);
1006 private static InstructionsBuilder createStripVlanInstructions() {
1007 List<Action> actionList = new ArrayList<Action>();
1008 ActionBuilder ab = new ActionBuilder();
1010 StripVlanActionBuilder stripActionBuilder = new StripVlanActionBuilder();
1011 ab.setAction(new StripVlanActionCaseBuilder().setStripVlanAction(stripActionBuilder.build()).build());
1013 ab.setKey(new ActionKey(0));
1014 actionList.add(ab.build());
1015 // Create an Apply Action
1016 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1017 aab.setAction(actionList);
1019 // Wrap our Apply Action in an Instruction
1020 InstructionBuilder ib = new InstructionBuilder();
1021 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1023 ib.setKey(new InstructionKey(0));
1025 // Put our Instruction in a list of Instructions
1026 InstructionsBuilder isb = new InstructionsBuilder();
1027 List<Instruction> instructions = new ArrayList<Instruction>();
1028 instructions.add(ib.build());
1029 isb.setInstruction(instructions);
1033 private static InstructionsBuilder createAppyActionInstruction2() {
1035 List<Action> actionList = new ArrayList<Action>();
1036 ActionBuilder ab = new ActionBuilder();
1038 PushMplsActionBuilder push = new PushMplsActionBuilder();
1039 push.setEthernetType(new Integer(0x8847));
1040 ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
1041 actionList.add(ab.build());
1042 // Create an Apply Action
1043 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1044 aab.setAction(actionList);
1046 // Wrap our Apply Action in an Instruction
1047 InstructionBuilder ib = new InstructionBuilder();
1048 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1050 // Put our Instruction in a list of Instructions
1051 InstructionsBuilder isb = new InstructionsBuilder();
1052 List<Instruction> instructions = new ArrayList<Instruction>();
1053 instructions.add(ib.build());
1054 isb.setInstruction(instructions);
1058 private static InstructionsBuilder createAppyActionInstruction3() {
1060 List<Action> actionList = new ArrayList<Action>();
1061 ActionBuilder ab = new ActionBuilder();
1063 PushPbbActionBuilder pbb = new PushPbbActionBuilder();
1064 pbb.setEthernetType(new Integer(0x88E7));
1065 ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
1066 actionList.add(ab.build());
1067 // Create an Apply Action
1068 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1069 aab.setAction(actionList);
1071 // Wrap our Apply Action in an Instruction
1072 InstructionBuilder ib = new InstructionBuilder();
1073 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1075 // Put our Instruction in a list of Instructions
1076 InstructionsBuilder isb = new InstructionsBuilder();
1077 List<Instruction> instructions = new ArrayList<Instruction>();
1078 instructions.add(ib.build());
1079 isb.setInstruction(instructions);
1083 private static InstructionsBuilder createAppyActionInstruction4() {
1085 List<Action> actionList = new ArrayList<Action>();
1086 ActionBuilder ab = new ActionBuilder();
1088 PushVlanActionBuilder vlan = new PushVlanActionBuilder();
1089 vlan.setEthernetType(new Integer(0x8100));
1090 ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
1091 actionList.add(ab.build());
1093 // Create an Apply Action
1094 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1095 aab.setAction(actionList);
1097 // Wrap our Apply Action in an Instruction
1098 InstructionBuilder ib = new InstructionBuilder();
1099 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1101 // Put our Instruction in a list of Instructions
1102 InstructionsBuilder isb = new InstructionsBuilder();
1103 List<Instruction> instructions = new ArrayList<Instruction>();
1104 instructions.add(ib.build());
1105 isb.setInstruction(instructions);
1109 private static InstructionsBuilder createAppyActionInstruction5() {
1111 List<Action> actionList = new ArrayList<Action>();
1112 ActionBuilder ab = new ActionBuilder();
1114 SetDlDstActionBuilder setdl = new SetDlDstActionBuilder();
1115 setdl.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1116 ab.setAction(new SetDlDstActionCaseBuilder().setSetDlDstAction(setdl.build()).build());
1117 actionList.add(ab.build());
1118 // Create an Apply Action
1119 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1120 aab.setAction(actionList);
1122 // Wrap our Apply Action in an Instruction
1123 InstructionBuilder ib = new InstructionBuilder();
1124 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1126 // Put our Instruction in a list of Instructions
1127 InstructionsBuilder isb = new InstructionsBuilder();
1128 List<Instruction> instructions = new ArrayList<Instruction>();
1129 instructions.add(ib.build());
1130 isb.setInstruction(instructions);
1134 private static InstructionsBuilder createAppyActionInstruction6() {
1136 List<Action> actionList = new ArrayList<Action>();
1137 ActionBuilder ab = new ActionBuilder();
1139 SetDlSrcActionBuilder src = new SetDlSrcActionBuilder();
1140 src.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
1141 ab.setAction(new SetDlSrcActionCaseBuilder().setSetDlSrcAction(src.build()).build());
1142 actionList.add(ab.build());
1144 // Create an Apply Action
1145 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1146 aab.setAction(actionList);
1148 // Wrap our Apply Action in an Instruction
1149 InstructionBuilder ib = new InstructionBuilder();
1150 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1152 // Put our Instruction in a list of Instructions
1153 InstructionsBuilder isb = new InstructionsBuilder();
1154 List<Instruction> instructions = new ArrayList<Instruction>();
1155 instructions.add(ib.build());
1156 isb.setInstruction(instructions);
1160 private static InstructionsBuilder createAppyActionInstruction7() {
1162 List<Action> actionList = new ArrayList<Action>();
1163 ActionBuilder ab = new ActionBuilder();
1165 SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
1166 VlanId a = new VlanId(4000);
1168 ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
1169 actionList.add(ab.build());
1170 // Create an Apply Action
1171 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1172 aab.setAction(actionList);
1174 // Wrap our Apply Action in an Instruction
1175 InstructionBuilder ib = new InstructionBuilder();
1176 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1178 // Put our Instruction in a list of Instructions
1179 InstructionsBuilder isb = new InstructionsBuilder();
1180 List<Instruction> instructions = new ArrayList<Instruction>();
1181 instructions.add(ib.build());
1182 isb.setInstruction(instructions);
1186 private static InstructionsBuilder createAppyActionInstruction8() {
1188 List<Action> actionList = new ArrayList<Action>();
1189 ActionBuilder ab = new ActionBuilder();
1191 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1192 VlanPcp pcp1 = new VlanPcp((short) 2);
1193 pcp.setVlanPcp(pcp1);
1194 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1195 actionList.add(ab.build());
1196 // Create an Apply Action
1197 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1198 aab.setAction(actionList);
1200 // Wrap our Apply Action in an Instruction
1201 InstructionBuilder ib = new InstructionBuilder();
1202 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1204 // Put our Instruction in a list of Instructions
1205 InstructionsBuilder isb = new InstructionsBuilder();
1206 List<Instruction> instructions = new ArrayList<Instruction>();
1207 instructions.add(ib.build());
1208 isb.setInstruction(instructions);
1212 private static InstructionsBuilder createAppyActionInstruction88() {
1214 List<Action> actionList = new ArrayList<Action>();
1215 ActionBuilder ab = new ActionBuilder();
1217 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1218 VlanPcp pcp1 = new VlanPcp((short) 9);
1219 pcp.setVlanPcp(pcp1);
1220 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1221 actionList.add(ab.build());
1222 // Create an Apply Action
1223 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1224 aab.setAction(actionList);
1226 // Wrap our Apply Action in an Instruction
1227 InstructionBuilder ib = new InstructionBuilder();
1228 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1230 // Put our Instruction in a list of Instructions
1231 InstructionsBuilder isb = new InstructionsBuilder();
1232 List<Instruction> instructions = new ArrayList<Instruction>();
1233 instructions.add(ib.build());
1234 isb.setInstruction(instructions);
1239 private static InstructionsBuilder createAppyActionInstruction9() {
1241 List<Action> actionList = new ArrayList<Action>();
1242 ActionBuilder ab = new ActionBuilder();
1244 CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
1245 ab.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
1246 actionList.add(ab.build());
1247 // Create an Apply Action
1248 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1249 aab.setAction(actionList);
1251 // Wrap our Apply Action in an Instruction
1252 InstructionBuilder ib = new InstructionBuilder();
1253 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1255 // Put our Instruction in a list of Instructions
1256 InstructionsBuilder isb = new InstructionsBuilder();
1257 List<Instruction> instructions = new ArrayList<Instruction>();
1258 instructions.add(ib.build());
1259 isb.setInstruction(instructions);
1263 private static InstructionsBuilder createAppyActionInstruction10() {
1265 List<Action> actionList = new ArrayList<Action>();
1266 ActionBuilder ab = new ActionBuilder();
1268 CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
1269 ab.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
1270 actionList.add(ab.build());
1271 // Create an Apply Action
1272 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1273 aab.setAction(actionList);
1275 // Wrap our Apply Action in an Instruction
1276 InstructionBuilder ib = new InstructionBuilder();
1277 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1279 // Put our Instruction in a list of Instructions
1280 InstructionsBuilder isb = new InstructionsBuilder();
1281 List<Instruction> instructions = new ArrayList<Instruction>();
1282 instructions.add(ib.build());
1283 isb.setInstruction(instructions);
1287 private static InstructionsBuilder createAppyActionInstruction11() {
1289 List<Action> actionList = new ArrayList<Action>();
1290 ActionBuilder ab = new ActionBuilder();
1292 DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
1293 ab.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
1294 actionList.add(ab.build());
1295 // Create an Apply Action
1296 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1297 aab.setAction(actionList);
1299 // Wrap our Apply Action in an Instruction
1300 InstructionBuilder ib = new InstructionBuilder();
1301 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1302 ib.setKey(new InstructionKey(0));
1305 // Put our Instruction in a list of Instruction
1306 InstructionsBuilder isb = new InstructionsBuilder();
1307 List<Instruction> instructions = new ArrayList<Instruction>();
1308 instructions.add(ib.build());
1309 isb.setInstruction(instructions);
1313 private static InstructionsBuilder createAppyActionInstruction12() {
1315 List<Action> actionList = new ArrayList<Action>();
1316 ActionBuilder ab = new ActionBuilder();
1318 DecNwTtlBuilder nwttl = new DecNwTtlBuilder();
1319 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(nwttl.build()).build());
1320 actionList.add(ab.build());
1322 // Create an Apply Action
1323 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1324 aab.setAction(actionList);
1326 // Wrap our Apply Action in an Instruction
1327 InstructionBuilder ib = new InstructionBuilder();
1328 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1330 // Put our Instruction in a list of Instructions
1331 InstructionsBuilder isb = new InstructionsBuilder();
1332 List<Instruction> instructions = new ArrayList<Instruction>();
1333 instructions.add(ib.build());
1334 isb.setInstruction(instructions);
1338 private static InstructionsBuilder createAppyActionInstruction13() {
1340 List<Action> actionList = new ArrayList<Action>();
1341 ActionBuilder ab = new ActionBuilder();
1343 DropActionBuilder drop = new DropActionBuilder();
1344 ab.setAction(new DropActionCaseBuilder().setDropAction(drop.build()).build());
1345 actionList.add(ab.build());
1347 // Create an Apply Action
1348 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1349 aab.setAction(actionList);
1351 // Wrap our Apply Action in an Instruction
1352 InstructionBuilder ib = new InstructionBuilder();
1353 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1355 // Put our Instruction in a list of Instructions
1356 InstructionsBuilder isb = new InstructionsBuilder();
1357 List<Instruction> instructions = new ArrayList<Instruction>();
1358 instructions.add(ib.build());
1359 isb.setInstruction(instructions);
1363 private static InstructionsBuilder createAppyActionInstruction14() {
1365 List<Action> actionList = new ArrayList<Action>();
1366 ActionBuilder ab = new ActionBuilder();
1368 FloodActionBuilder fld = new FloodActionBuilder();
1369 ab.setAction(new FloodActionCaseBuilder().setFloodAction(fld.build()).build());
1370 actionList.add(ab.build());
1371 // Create an Apply Action
1372 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1373 aab.setAction(actionList);
1375 // Wrap our Apply Action in an Instruction
1376 InstructionBuilder ib = new InstructionBuilder();
1377 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1379 // Put our Instruction in a list of Instructions
1380 InstructionsBuilder isb = new InstructionsBuilder();
1381 List<Instruction> instructions = new ArrayList<Instruction>();
1382 instructions.add(ib.build());
1383 isb.setInstruction(instructions);
1387 private static InstructionsBuilder createAppyActionInstruction15() {
1389 List<Action> actionList = new ArrayList<Action>();
1390 ActionBuilder ab = new ActionBuilder();
1392 FloodAllActionBuilder fldall = new FloodAllActionBuilder();
1393 ab.setAction(new FloodAllActionCaseBuilder().setFloodAllAction(fldall.build()).build());
1394 actionList.add(ab.build());
1395 // Create an Apply Action
1396 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1397 aab.setAction(actionList);
1399 // Wrap our Apply Action in an Instruction
1400 InstructionBuilder ib = new InstructionBuilder();
1401 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1403 // Put our Instruction in a list of Instructions
1404 InstructionsBuilder isb = new InstructionsBuilder();
1405 List<Instruction> instructions = new ArrayList<Instruction>();
1406 instructions.add(ib.build());
1407 isb.setInstruction(instructions);
1411 private static InstructionsBuilder createAppyActionInstruction16() {
1413 List<Action> actionList = new ArrayList<Action>();
1414 ActionBuilder ab = new ActionBuilder();
1416 GroupActionBuilder groupActionB = new GroupActionBuilder();
1417 groupActionB.setGroupId(1L);
1418 groupActionB.setGroup("0");
1419 ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
1420 actionList.add(ab.build());
1422 // Create an Apply Action
1423 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1424 aab.setAction(actionList);
1426 // Wrap our Apply Action in an Instruction
1427 InstructionBuilder ib = new InstructionBuilder();
1428 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1430 // Put our Instruction in a list of Instructions
1431 InstructionsBuilder isb = new InstructionsBuilder();
1432 List<Instruction> instructions = new ArrayList<Instruction>();
1433 instructions.add(ib.build());
1434 isb.setInstruction(instructions);
1438 private static InstructionsBuilder createAppyActionInstruction17() {
1440 List<Action> actionList = new ArrayList<Action>();
1441 ActionBuilder ab = new ActionBuilder();
1443 HwPathActionBuilder hwPathB = new HwPathActionBuilder();
1444 ab.setAction(new HwPathActionCaseBuilder().setHwPathAction(hwPathB.build()).build());
1445 actionList.add(ab.build());
1446 // Create an Apply Action
1447 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1448 aab.setAction(actionList);
1450 // Wrap our Apply Action in an Instruction
1451 InstructionBuilder ib = new InstructionBuilder();
1452 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1454 // Put our Instruction in a list of Instructions
1455 InstructionsBuilder isb = new InstructionsBuilder();
1456 List<Instruction> instructions = new ArrayList<Instruction>();
1457 instructions.add(ib.build());
1458 isb.setInstruction(instructions);
1462 private static InstructionsBuilder createAppyActionInstruction18() {
1464 List<Action> actionList = new ArrayList<Action>();
1465 ActionBuilder ab = new ActionBuilder();
1467 LoopbackActionBuilder loopbackActionBuilder = new LoopbackActionBuilder();
1468 ab.setAction(new LoopbackActionCaseBuilder().setLoopbackAction(loopbackActionBuilder.build()).build());
1469 actionList.add(ab.build());
1471 // Create an Apply Action
1472 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1473 aab.setAction(actionList);
1475 // Wrap our Apply Action in an Instruction
1476 InstructionBuilder ib = new InstructionBuilder();
1477 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1479 // Put our Instruction in a list of Instructions
1480 InstructionsBuilder isb = new InstructionsBuilder();
1481 List<Instruction> instructions = new ArrayList<Instruction>();
1482 instructions.add(ib.build());
1483 isb.setInstruction(instructions);
1487 private static InstructionsBuilder createAppyActionInstruction19() {
1489 List<Action> actionList = new ArrayList<Action>();
1490 ActionBuilder ab = new ActionBuilder();
1492 PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
1493 popMplsActionBuilder.setEthernetType(0XB);
1494 ab.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
1495 actionList.add(ab.build());
1496 // Create an Apply Action
1497 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1498 aab.setAction(actionList);
1500 // Wrap our Apply Action in an Instruction
1501 InstructionBuilder ib = new InstructionBuilder();
1502 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1504 // Put our Instruction in a list of Instructions
1505 InstructionsBuilder isb = new InstructionsBuilder();
1506 List<Instruction> instructions = new ArrayList<Instruction>();
1507 instructions.add(ib.build());
1508 isb.setInstruction(instructions);
1512 private static InstructionsBuilder createAppyActionInstruction20() {
1514 List<Action> actionList = new ArrayList<Action>();
1515 ActionBuilder ab = new ActionBuilder();
1517 PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
1518 ab.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
1519 actionList.add(ab.build());
1520 // Create an Apply Action
1521 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1522 aab.setAction(actionList);
1524 // Wrap our Apply Action in an Instruction
1525 InstructionBuilder ib = new InstructionBuilder();
1526 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1528 // Put our Instruction in a list of Instructions
1529 InstructionsBuilder isb = new InstructionsBuilder();
1530 List<Instruction> instructions = new ArrayList<Instruction>();
1531 instructions.add(ib.build());
1532 isb.setInstruction(instructions);
1536 private static InstructionsBuilder createAppyActionInstruction21() {
1538 List<Action> actionList = new ArrayList<Action>();
1539 ActionBuilder ab = new ActionBuilder();
1541 PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder();
1542 ab.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(popVlanActionBuilder.build()).build());
1543 actionList.add(ab.build());
1545 // Create an Apply Action
1546 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1547 aab.setAction(actionList);
1549 // Wrap our Apply Action in an Instruction
1550 InstructionBuilder ib = new InstructionBuilder();
1551 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1553 // Put our Instruction in a list of Instructions
1554 InstructionsBuilder isb = new InstructionsBuilder();
1555 List<Instruction> instructions = new ArrayList<Instruction>();
1556 instructions.add(ib.build());
1557 isb.setInstruction(instructions);
1561 private static InstructionsBuilder createAppyActionInstruction22() {
1563 List<Action> actionList = new ArrayList<Action>();
1564 ActionBuilder ab = new ActionBuilder();
1566 SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
1567 setDlTypeActionBuilder.setDlType(new EtherType(8L));
1568 ab.setAction(new SetDlTypeActionCaseBuilder().setSetDlTypeAction(setDlTypeActionBuilder.build()).build());
1569 actionList.add(ab.build());
1571 // Create an Apply Action
1572 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1573 aab.setAction(actionList);
1575 // Wrap our Apply Action in an Instruction
1576 InstructionBuilder ib = new InstructionBuilder();
1577 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1579 // Put our Instruction in a list of Instructions
1580 InstructionsBuilder isb = new InstructionsBuilder();
1581 List<Instruction> instructions = new ArrayList<Instruction>();
1582 instructions.add(ib.build());
1583 isb.setInstruction(instructions);
1587 private static InstructionsBuilder createAppyActionInstruction23(NodeId nodeId) {
1589 List<Action> actionList = new ArrayList<Action>();
1590 ActionBuilder ab = new ActionBuilder();
1592 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1593 setFieldBuilder.setInPort(new NodeConnectorId(nodeId + ":2"));
1594 actionList.add(ab.build());
1596 // Create an Apply Action
1597 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1598 aab.setAction(actionList);
1600 // Wrap our Apply Action in an Instruction
1601 InstructionBuilder ib = new InstructionBuilder();
1602 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1604 // Put our Instruction in a list of Instructions
1605 InstructionsBuilder isb = new InstructionsBuilder();
1606 List<Instruction> instructions = new ArrayList<Instruction>();
1607 instructions.add(ib.build());
1608 isb.setInstruction(instructions);
1612 private static InstructionsBuilder createAppyActionInstruction24() {
1614 List<Action> actionList = new ArrayList<Action>();
1615 ActionBuilder ab = new ActionBuilder();
1617 SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
1618 setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
1619 ab.setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(setMplsTtlActionBuilder.build()).build());
1620 actionList.add(ab.build());
1622 // Create an Apply Action
1623 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1624 aab.setAction(actionList);
1626 // Wrap our Apply Action in an Instruction
1627 InstructionBuilder ib = new InstructionBuilder();
1628 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1630 // Put our Instruction in a list of Instructions
1631 InstructionsBuilder isb = new InstructionsBuilder();
1632 List<Instruction> instructions = new ArrayList<Instruction>();
1633 instructions.add(ib.build());
1634 isb.setInstruction(instructions);
1638 private static InstructionsBuilder createAppyActionInstruction25() {
1640 List<Action> actionList = new ArrayList<Action>();
1641 ActionBuilder ab = new ActionBuilder();
1643 SetNextHopActionBuilder setNextHopActionBuilder = new SetNextHopActionBuilder();
1644 Ipv4Builder ipnext = new Ipv4Builder();
1645 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
1646 ipnext.setIpv4Address(prefix);
1647 setNextHopActionBuilder.setAddress(ipnext.build());
1648 ab.setAction(new SetNextHopActionCaseBuilder().setSetNextHopAction(setNextHopActionBuilder.build()).build());
1649 actionList.add(ab.build());
1651 // Create an Apply Action
1652 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1653 aab.setAction(actionList);
1655 // Wrap our Apply Action in an Instruction
1656 InstructionBuilder ib = new InstructionBuilder();
1657 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1659 // Put our Instruction in a list of Instructions
1660 InstructionsBuilder isb = new InstructionsBuilder();
1661 List<Instruction> instructions = new ArrayList<Instruction>();
1662 instructions.add(ib.build());
1663 isb.setInstruction(instructions);
1667 private static InstructionsBuilder createAppyActionInstruction26() {
1669 List<Action> actionList = new ArrayList<Action>();
1670 ActionBuilder ab = new ActionBuilder();
1672 SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
1673 Ipv4Builder ipdst = new Ipv4Builder();
1674 Ipv4Prefix prefixdst = new Ipv4Prefix("10.0.0.21/24");
1675 ipdst.setIpv4Address(prefixdst);
1676 setNwDstActionBuilder.setAddress(ipdst.build());
1677 ab.setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build());
1678 actionList.add(ab.build());
1680 // Create an Apply Action
1681 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1682 aab.setAction(actionList);
1684 // Wrap our Apply Action in an Instruction
1685 InstructionBuilder ib = new InstructionBuilder();
1686 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1688 // Put our Instruction in a list of Instructions
1689 InstructionsBuilder isb = new InstructionsBuilder();
1690 List<Instruction> instructions = new ArrayList<Instruction>();
1691 instructions.add(ib.build());
1692 isb.setInstruction(instructions);
1696 private static InstructionsBuilder createAppyActionInstruction27() {
1698 List<Action> actionList = new ArrayList<Action>();
1699 ActionBuilder ab = new ActionBuilder();
1701 SetNwSrcActionBuilder setNwsrcActionBuilder = new SetNwSrcActionBuilder();
1702 Ipv4Builder ipsrc = new Ipv4Builder();
1703 Ipv4Prefix prefixsrc = new Ipv4Prefix("10.0.23.21/24");
1704 ipsrc.setIpv4Address(prefixsrc);
1705 setNwsrcActionBuilder.setAddress(ipsrc.build());
1706 ab.setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwsrcActionBuilder.build()).build());
1707 actionList.add(ab.build());
1709 // Create an Apply Action
1710 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1711 aab.setAction(actionList);
1713 // Wrap our Apply Action in an Instruction
1714 InstructionBuilder ib = new InstructionBuilder();
1715 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1717 // Put our Instruction in a list of Instructions
1718 InstructionsBuilder isb = new InstructionsBuilder();
1719 List<Instruction> instructions = new ArrayList<Instruction>();
1720 instructions.add(ib.build());
1721 isb.setInstruction(instructions);
1725 private static InstructionsBuilder createAppyActionInstruction28() {
1727 List<Action> actionList = new ArrayList<Action>();
1728 ActionBuilder ab = new ActionBuilder();
1730 SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
1731 setNwTosActionBuilder.setTos(8);
1732 ab.setAction(new SetNwTosActionCaseBuilder().setSetNwTosAction(setNwTosActionBuilder.build()).build());
1733 actionList.add(ab.build());
1734 // Create an Apply Action
1735 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1736 aab.setAction(actionList);
1738 // Wrap our Apply Action in an Instruction
1739 InstructionBuilder ib = new InstructionBuilder();
1740 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1742 // Put our Instruction in a list of Instructions
1743 InstructionsBuilder isb = new InstructionsBuilder();
1744 List<Instruction> instructions = new ArrayList<Instruction>();
1745 instructions.add(ib.build());
1746 isb.setInstruction(instructions);
1750 private static InstructionsBuilder createAppyActionInstruction29() {
1752 List<Action> actionList = new ArrayList<Action>();
1753 ActionBuilder ab = new ActionBuilder();
1755 SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
1756 setNwTtlActionBuilder.setNwTtl((short) 1);
1757 ab.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
1758 actionList.add(ab.build());
1760 // Create an Apply Action
1761 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1762 aab.setAction(actionList);
1764 // Wrap our Apply Action in an Instruction
1765 InstructionBuilder ib = new InstructionBuilder();
1766 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1768 // Put our Instruction in a list of Instructions
1769 InstructionsBuilder isb = new InstructionsBuilder();
1770 List<Instruction> instructions = new ArrayList<Instruction>();
1771 instructions.add(ib.build());
1772 isb.setInstruction(instructions);
1776 private static InstructionsBuilder createAppyActionInstruction30() {
1778 List<Action> actionList = new ArrayList<Action>();
1779 ActionBuilder ab = new ActionBuilder();
1781 SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
1782 setQueueActionBuilder.setQueueId(1L);
1783 ab.setAction(new SetQueueActionCaseBuilder().setSetQueueAction(setQueueActionBuilder.build()).build());
1784 actionList.add(ab.build());
1785 // Create an Apply Action
1786 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1787 aab.setAction(actionList);
1789 // Wrap our Apply Action in an Instruction
1790 InstructionBuilder ib = new InstructionBuilder();
1791 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1793 // Put our Instruction in a list of Instructions
1794 InstructionsBuilder isb = new InstructionsBuilder();
1795 List<Instruction> instructions = new ArrayList<Instruction>();
1796 instructions.add(ib.build());
1797 isb.setInstruction(instructions);
1801 private static InstructionsBuilder createAppyActionInstruction31() {
1803 List<Action> actionList = new ArrayList<Action>();
1804 ActionBuilder ab = new ActionBuilder();
1806 SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
1807 setTpDstActionBuilder.setPort(new PortNumber(109));
1809 ab.setAction(new SetTpDstActionCaseBuilder().setSetTpDstAction(setTpDstActionBuilder.build()).build());
1810 actionList.add(ab.build());
1811 // Create an Apply Action
1812 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1813 aab.setAction(actionList);
1815 // Wrap our Apply Action in an Instruction
1816 InstructionBuilder ib = new InstructionBuilder();
1817 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1819 // Put our Instruction in a list of Instructions
1820 InstructionsBuilder isb = new InstructionsBuilder();
1821 List<Instruction> instructions = new ArrayList<Instruction>();
1822 instructions.add(ib.build());
1823 isb.setInstruction(instructions);
1827 private static InstructionsBuilder createAppyActionInstruction32() {
1829 List<Action> actionList = new ArrayList<Action>();
1830 ActionBuilder ab = new ActionBuilder();
1832 SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
1833 setTpSrcActionBuilder.setPort(new PortNumber(109));
1834 ab.setAction(new SetTpSrcActionCaseBuilder().setSetTpSrcAction(setTpSrcActionBuilder.build()).build());
1835 actionList.add(ab.build());
1837 // Create an Apply Action
1838 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1839 aab.setAction(actionList);
1841 // Wrap our Apply Action in an Instruction
1842 InstructionBuilder ib = new InstructionBuilder();
1843 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1845 // Put our Instruction in a list of Instructions
1846 InstructionsBuilder isb = new InstructionsBuilder();
1847 List<Instruction> instructions = new ArrayList<Instruction>();
1848 instructions.add(ib.build());
1849 isb.setInstruction(instructions);
1853 private static InstructionsBuilder createAppyActionInstruction33() {
1855 List<Action> actionList = new ArrayList<Action>();
1856 ActionBuilder ab = new ActionBuilder();
1858 SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
1859 setVlanCfiActionBuilder.setVlanCfi(new VlanCfi(2));
1860 ab.setAction(new SetVlanCfiActionCaseBuilder().setSetVlanCfiAction(setVlanCfiActionBuilder.build()).build());
1861 actionList.add(ab.build());
1863 // Create an Apply Action
1864 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1865 aab.setAction(actionList);
1867 // Wrap our Apply Action in an Instruction
1868 InstructionBuilder ib = new InstructionBuilder();
1869 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1871 // Put our Instruction in a list of Instructions
1872 InstructionsBuilder isb = new InstructionsBuilder();
1873 List<Instruction> instructions = new ArrayList<Instruction>();
1874 instructions.add(ib.build());
1875 isb.setInstruction(instructions);
1879 private static InstructionsBuilder createAppyActionInstruction34() {
1881 List<Action> actionList = new ArrayList<Action>();
1882 ActionBuilder ab = new ActionBuilder();
1884 SwPathActionBuilder swPathAction = new SwPathActionBuilder();
1885 ab.setAction(new SwPathActionCaseBuilder().setSwPathAction(swPathAction.build()).build());
1886 actionList.add(ab.build());
1888 // Create an Apply Action
1889 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1890 aab.setAction(actionList);
1892 // Wrap our Apply Action in an Instruction
1893 InstructionBuilder ib = new InstructionBuilder();
1894 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1896 // Put our Instruction in a list of Instructions
1897 InstructionsBuilder isb = new InstructionsBuilder();
1898 List<Instruction> instructions = new ArrayList<Instruction>();
1899 instructions.add(ib.build());
1900 isb.setInstruction(instructions);
1904 private static InstructionsBuilder createAppyActionInstruction35() {
1906 List<Action> actionList = new ArrayList<Action>();
1907 ActionBuilder ab = new ActionBuilder();
1908 ActionBuilder ab1 = new ActionBuilder();
1909 ActionBuilder ab2 = new ActionBuilder();
1911 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1912 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
1913 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
1916 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
1917 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
1918 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
1919 EthernetMatchBuilder ethernetMatch1 = new EthernetMatchBuilder();
1920 EthernetDestinationBuilder ethDestBuilder = new EthernetDestinationBuilder();
1921 ethDestBuilder.setAddress(new MacAddress("00:00:00:00:00:02"));
1922 EthernetMatchBuilder ethernetMatch2 = new EthernetMatchBuilder();
1923 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
1924 ethTypeBuilder.setType(new EtherType(0x86ddL));
1926 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
1927 ethernetMatch1.setEthernetDestination(ethDestBuilder.build());
1928 ethernetMatch2.setEthernetType(ethTypeBuilder.build());
1929 setFieldBuilder.setEthernetMatch(ethernetMatch.build());
1930 setFieldBuilder1.setEthernetMatch(ethernetMatch1.build());
1931 setFieldBuilder2.setEthernetMatch(ethernetMatch2.build());
1932 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
1933 ab.setKey(new ActionKey(0));
1934 actionList.add(ab.build());
1936 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
1937 ab1.setKey(new ActionKey(1));
1938 actionList.add(ab1.build());
1940 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
1941 ab2.setKey(new ActionKey(2));
1942 actionList.add(ab2.build());
1944 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1945 aab.setAction(actionList);
1947 InstructionBuilder ib = new InstructionBuilder();
1948 ib.setKey(new InstructionKey(0));
1949 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1951 // Put our Instruction in a list of Instructions
1952 InstructionsBuilder isb = new InstructionsBuilder();
1953 List<Instruction> instructions = new ArrayList<Instruction>();
1954 instructions.add(ib.build());
1955 isb.setInstruction(instructions);
1959 private static InstructionsBuilder createAppyActionInstruction36() {
1961 List<Action> actionList = new ArrayList<Action>();
1962 ActionBuilder ab = new ActionBuilder();
1963 ActionBuilder ab1 = new ActionBuilder();
1965 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1966 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
1969 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
1970 VlanMatchBuilder vlanBuilder1 = new VlanMatchBuilder();
1971 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
1972 VlanId vlanId = new VlanId(10);
1973 VlanPcp vpcp = new VlanPcp((short) 3);
1974 vlanBuilder.setVlanPcp(vpcp);
1975 vlanBuilder1.setVlanId(vlanIdBuilder.setVlanId(vlanId).setVlanIdPresent(true).build());
1976 setFieldBuilder.setVlanMatch(vlanBuilder.build());
1977 setFieldBuilder1.setVlanMatch(vlanBuilder1.build());
1978 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
1979 ab.setKey(new ActionKey(0));
1980 actionList.add(ab.build());
1981 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
1982 ab1.setKey(new ActionKey(1));
1983 actionList.add(ab1.build());
1985 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1986 aab.setAction(actionList);
1988 InstructionBuilder ib = new InstructionBuilder();
1989 ib.setKey(new InstructionKey(0));
1990 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1992 // Put our Instruction in a list of Instructions
1993 InstructionsBuilder isb = new InstructionsBuilder();
1994 List<Instruction> instructions = new ArrayList<Instruction>();
1995 instructions.add(ib.build());
1996 isb.setInstruction(instructions);
2000 private static InstructionsBuilder createAppyActionInstruction37() {
2002 List<Action> actionList = new ArrayList<Action>();
2003 ActionBuilder ab = new ActionBuilder();
2004 ActionBuilder ab1 = new ActionBuilder();
2005 ActionBuilder ab2 = new ActionBuilder();
2007 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2008 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2009 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2011 IpMatchBuilder ipmatch = new IpMatchBuilder();
2012 IpMatchBuilder ipmatch1 = new IpMatchBuilder();
2013 IpMatchBuilder ipmatch2 = new IpMatchBuilder();
2014 Dscp dscp = new Dscp((short) 3);
2015 ipmatch.setIpDscp(dscp);
2016 ipmatch1.setIpEcn((short) 2);
2017 ipmatch2.setIpProtocol((short) 120);
2018 setFieldBuilder.setIpMatch(ipmatch.build());
2019 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2020 ab.setKey(new ActionKey(0));
2021 actionList.add(ab.build());
2023 setFieldBuilder1.setIpMatch(ipmatch1.build());
2024 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2025 ab1.setKey(new ActionKey(1));
2026 actionList.add(ab1.build());
2028 setFieldBuilder2.setIpMatch(ipmatch2.build());
2029 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2030 ab2.setKey(new ActionKey(2));
2031 actionList.add(ab2.build());
2033 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2034 aab.setAction(actionList);
2036 InstructionBuilder ib = new InstructionBuilder();
2037 ib.setKey(new InstructionKey(0));
2038 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2040 // Put our Instruction in a list of Instructions
2041 InstructionsBuilder isb = new InstructionsBuilder();
2042 List<Instruction> instructions = new ArrayList<Instruction>();
2043 instructions.add(ib.build());
2044 isb.setInstruction(instructions);
2048 private static InstructionsBuilder createAppyActionInstruction38() {
2050 List<Action> actionList = new ArrayList<Action>();
2051 ActionBuilder ab = new ActionBuilder();
2052 ActionBuilder ab1 = new ActionBuilder();
2054 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2055 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2057 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2058 Ipv4MatchBuilder ipv4Match1 = new Ipv4MatchBuilder();
2059 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.5210");
2060 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1");
2061 ipv4Match1.setIpv4Destination(dstip);
2062 ipv4Match.setIpv4Source(srcip);
2063 setFieldBuilder.setLayer3Match(ipv4Match.build());
2064 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2065 ab.setKey(new ActionKey(0));
2066 actionList.add(ab.build());
2068 setFieldBuilder1.setLayer3Match(ipv4Match1.build());
2069 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2070 ab1.setKey(new ActionKey(1));
2071 actionList.add(ab1.build());
2073 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2074 aab.setAction(actionList);
2076 InstructionBuilder ib = new InstructionBuilder();
2077 ib.setKey(new InstructionKey(0));
2078 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2080 // Put our Instruction in a list of Instructions
2081 InstructionsBuilder isb = new InstructionsBuilder();
2082 List<Instruction> instructions = new ArrayList<Instruction>();
2083 instructions.add(ib.build());
2084 isb.setInstruction(instructions);
2088 private static InstructionsBuilder createAppyActionInstruction39() {
2090 List<Action> actionList = new ArrayList<Action>();
2091 ActionBuilder ab = new ActionBuilder();
2092 ActionBuilder ab1 = new ActionBuilder();
2094 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2095 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2098 PortNumber tcpsrcport = new PortNumber(1213);
2099 PortNumber tcpdstport = new PortNumber(646);
2100 TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
2101 TcpMatchBuilder tcpmatch1 = new TcpMatchBuilder();
2102 tcpmatch.setTcpSourcePort(tcpsrcport);
2103 tcpmatch1.setTcpDestinationPort(tcpdstport);
2104 setFieldBuilder.setLayer4Match(tcpmatch.build());
2105 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2106 ab.setKey(new ActionKey(0));
2107 actionList.add(ab.build());
2109 setFieldBuilder1.setLayer4Match(tcpmatch1.build());
2110 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2111 ab1.setKey(new ActionKey(1));
2112 actionList.add(ab.build());
2114 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2115 aab.setAction(actionList);
2117 InstructionBuilder ib = new InstructionBuilder();
2118 ib.setKey(new InstructionKey(0));
2119 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2121 // Put our Instruction in a list of Instructions
2122 InstructionsBuilder isb = new InstructionsBuilder();
2123 List<Instruction> instructions = new ArrayList<Instruction>();
2124 instructions.add(ib.build());
2125 isb.setInstruction(instructions);
2129 private static InstructionsBuilder createAppyActionInstruction40() {
2131 List<Action> actionList = new ArrayList<Action>();
2132 ActionBuilder ab = new ActionBuilder();
2133 ActionBuilder ab1 = new ActionBuilder();
2135 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2136 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2139 PortNumber udpsrcport = new PortNumber(1325);
2140 PortNumber udpdstport = new PortNumber(42);
2141 UdpMatchBuilder udpmatch = new UdpMatchBuilder();
2142 UdpMatchBuilder udpmatch1 = new UdpMatchBuilder();
2143 udpmatch.setUdpDestinationPort(udpdstport);
2144 udpmatch1.setUdpSourcePort(udpsrcport);
2145 setFieldBuilder.setLayer4Match(udpmatch.build());
2146 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2147 ab.setKey(new ActionKey(0));
2148 actionList.add(ab.build());
2150 setFieldBuilder1.setLayer4Match(udpmatch1.build());
2151 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2152 ab1.setKey(new ActionKey(1));
2153 actionList.add(ab1.build());
2155 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2156 aab.setAction(actionList);
2158 InstructionBuilder ib = new InstructionBuilder();
2159 ib.setKey(new InstructionKey(0));
2160 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2162 // Put our Instruction in a list of Instructions
2163 InstructionsBuilder isb = new InstructionsBuilder();
2164 List<Instruction> instructions = new ArrayList<Instruction>();
2165 instructions.add(ib.build());
2166 isb.setInstruction(instructions);
2170 private static InstructionsBuilder createAppyActionInstruction41() {
2172 List<Action> actionList = new ArrayList<Action>();
2173 ActionBuilder ab = new ActionBuilder();
2174 ActionBuilder ab1 = new ActionBuilder();
2176 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2177 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2180 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
2181 SctpMatchBuilder sctpmatch1 = new SctpMatchBuilder();
2182 PortNumber srcport = new PortNumber(1435);
2183 PortNumber dstport = new PortNumber(22);
2184 sctpmatch.setSctpSourcePort(srcport);
2185 sctpmatch1.setSctpDestinationPort(dstport);
2186 setFieldBuilder.setLayer4Match(sctpmatch.build());
2187 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2188 ab.setKey(new ActionKey(0));
2189 actionList.add(ab.build());
2191 setFieldBuilder1.setLayer4Match(sctpmatch1.build());
2192 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2193 ab1.setKey(new ActionKey(1));
2194 actionList.add(ab1.build());
2196 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2197 aab.setAction(actionList);
2199 InstructionBuilder ib = new InstructionBuilder();
2200 ib.setKey(new InstructionKey(0));
2201 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2203 // Put our Instruction in a list of Instructions
2204 InstructionsBuilder isb = new InstructionsBuilder();
2205 List<Instruction> instructions = new ArrayList<Instruction>();
2206 instructions.add(ib.build());
2207 isb.setInstruction(instructions);
2211 private static InstructionsBuilder createAppyActionInstruction42() {
2213 List<Action> actionList = new ArrayList<Action>();
2214 ActionBuilder ab = new ActionBuilder();
2215 ActionBuilder ab1 = new ActionBuilder();
2216 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2217 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2220 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
2221 Icmpv4MatchBuilder icmpv4match1 = new Icmpv4MatchBuilder();
2222 icmpv4match.setIcmpv4Type((short) 8);
2223 icmpv4match1.setIcmpv4Code((short) 0);
2224 setFieldBuilder.setIcmpv4Match(icmpv4match.build());
2225 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2226 ab.setKey(new ActionKey(0));
2227 actionList.add(ab.build());
2229 setFieldBuilder1.setIcmpv4Match(icmpv4match1.build());
2230 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2231 ab1.setKey(new ActionKey(1));
2232 actionList.add(ab1.build());
2234 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2235 aab.setAction(actionList);
2237 InstructionBuilder ib = new InstructionBuilder();
2238 ib.setKey(new InstructionKey(0));
2239 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2241 // Put our Instruction in a list of Instructions
2242 InstructionsBuilder isb = new InstructionsBuilder();
2243 List<Instruction> instructions = new ArrayList<Instruction>();
2244 instructions.add(ib.build());
2245 isb.setInstruction(instructions);
2249 private static InstructionsBuilder createAppyActionInstruction43() {
2251 List<Action> actionList = new ArrayList<Action>();
2252 ActionBuilder ab = new ActionBuilder();
2253 ActionBuilder ab1 = new ActionBuilder();
2254 ActionBuilder ab2 = new ActionBuilder();
2255 ActionBuilder ab3 = new ActionBuilder();
2256 ActionBuilder ab4 = new ActionBuilder();
2258 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2259 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2260 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2261 SetFieldBuilder setFieldBuilder3 = new SetFieldBuilder();
2262 SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder();
2264 // setting the values of ARP
2265 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2266 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2267 Ipv4Prefix dstiparp = new Ipv4Prefix("200.71.9.52");
2268 Ipv4Prefix srciparp = new Ipv4Prefix("100.1.1.1");
2269 // create ARP match action
2270 ArpMatchBuilder arpmatch = new ArpMatchBuilder();
2271 ArpMatchBuilder arpmatch1 = new ArpMatchBuilder();
2272 ArpMatchBuilder arpmatch2 = new ArpMatchBuilder();
2273 ArpMatchBuilder arpmatch3 = new ArpMatchBuilder();
2274 ArpMatchBuilder arpmatch4 = new ArpMatchBuilder();
2275 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2276 arpsrc.setAddress(macsrc);
2277 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2278 arpdst.setAddress(macdest);
2279 arpmatch.setArpOp(2);
2280 arpmatch1.setArpSourceHardwareAddress(arpsrc.build());
2281 arpmatch2.setArpTargetHardwareAddress(arpdst.build());
2282 arpmatch3.setArpSourceTransportAddress(srciparp);
2283 arpmatch4.setArpTargetTransportAddress(dstiparp);
2284 setFieldBuilder.setLayer3Match(arpmatch.build());
2285 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2286 ab.setKey(new ActionKey(0));
2287 actionList.add(ab.build());
2289 setFieldBuilder1.setLayer3Match(arpmatch1.build());
2290 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2291 ab1.setKey(new ActionKey(1));
2292 actionList.add(ab1.build());
2294 setFieldBuilder2.setLayer3Match(arpmatch2.build());
2295 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2296 ab2.setKey(new ActionKey(2));
2297 actionList.add(ab2.build());
2299 setFieldBuilder3.setLayer3Match(arpmatch3.build());
2300 ab3.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2301 ab3.setKey(new ActionKey(3));
2302 actionList.add(ab3.build());
2304 setFieldBuilder4.setLayer3Match(arpmatch4.build());
2305 ab4.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2306 ab4.setKey(new ActionKey(4));
2307 actionList.add(ab4.build());
2309 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2310 aab.setAction(actionList);
2312 InstructionBuilder ib = new InstructionBuilder();
2313 ib.setKey(new InstructionKey(0));
2314 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2316 // Put our Instruction in a list of Instructions
2317 InstructionsBuilder isb = new InstructionsBuilder();
2318 List<Instruction> instructions = new ArrayList<Instruction>();
2319 instructions.add(ib.build());
2320 isb.setInstruction(instructions);
2324 private static InstructionsBuilder createAppyActionInstruction44() {
2326 List<Action> actionLists = new ArrayList<Action>();
2327 ActionBuilder ab = new ActionBuilder();
2328 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2329 ActionBuilder ab1 = new ActionBuilder();
2330 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2331 /* ActionBuilder ab2 = new ActionBuilder();
2332 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2333 ActionBuilder ab3 = new ActionBuilder();
2334 SetFieldBuilder setFieldBuilder3 = new SetFieldBuilder();
2335 ActionBuilder ab4 = new ActionBuilder();
2336 SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder(); */
2337 ActionBuilder ab5 = new ActionBuilder();
2338 SetFieldBuilder setFieldBuilder5 = new SetFieldBuilder();
2339 ActionBuilder ab6 = new ActionBuilder();
2340 SetFieldBuilder setFieldBuilder6 = new SetFieldBuilder();
2343 Ipv6MatchBuilder ipv6Builder = new Ipv6MatchBuilder();
2344 Ipv6MatchBuilder ipv6Builder1 = new Ipv6MatchBuilder();
2345 // Ipv6MatchBuilder ipv6Builder2 = new Ipv6MatchBuilder();
2346 // Ipv6MatchBuilder ipv6Builder3 = new Ipv6MatchBuilder();
2347 // Ipv6MatchBuilder ipv6Builder4 = new Ipv6MatchBuilder();
2348 Ipv6MatchBuilder ipv6Builder5 = new Ipv6MatchBuilder();
2349 Ipv6MatchBuilder ipv6Builder6 = new Ipv6MatchBuilder();
2351 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2");
2352 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1");
2353 // Ipv6Address ndtarget = new Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
2354 // MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
2355 // MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
2356 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2357 nextheader.setIpv6Exthdr(58);
2358 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2359 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2360 ipv6label.setIpv6Flabel(label);
2362 ipv6Builder.setIpv6Source(srcip6);
2363 ipv6Builder1.setIpv6Destination(dstip6);
2364 // ipv6Builder2.setIpv6NdTarget(ndtarget);
2365 // ipv6Builder3.setIpv6NdSll(ndsll);
2366 // ipv6Builder4.setIpv6NdTll(ndtll);
2367 ipv6Builder5.setIpv6ExtHeader(nextheader.build());
2368 ipv6Builder6.setIpv6Label(ipv6label.build());
2370 setFieldBuilder.setLayer3Match(ipv6Builder.build());
2371 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2372 ab.setKey(new ActionKey(0));
2373 actionLists.add(ab.build());
2375 setFieldBuilder1.setLayer3Match(ipv6Builder1.build());
2376 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2377 ab1.setKey(new ActionKey(1));
2378 actionLists.add(ab1.build());
2380 /* setFieldBuilder2.setLayer3Match(ipv6Builder2.build());
2381 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2382 ab2.setKey(new ActionKey(2));
2383 actionLists.add(ab2.build());
2385 setFieldBuilder3.setLayer3Match(ipv6Builder3.build());
2386 ab3.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
2387 ab3.setKey(new ActionKey(3));
2388 actionLists.add(ab3.build());
2390 setFieldBuilder4.setLayer3Match(ipv6Builder4.build());
2391 ab4.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
2392 ab4.setKey(new ActionKey(4));
2393 actionLists.add(ab4.build());
2395 setFieldBuilder5.setLayer3Match(ipv6Builder5.build());
2396 ab5.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder5.build()).build());
2397 ab5.setKey(new ActionKey(5));
2398 actionLists.add(ab5.build());
2400 setFieldBuilder6.setLayer3Match(ipv6Builder6.build());
2401 ab6.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder6.build()).build());
2402 ab6.setKey(new ActionKey(6));
2403 actionLists.add(ab6.build());
2405 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2406 aab.setAction(actionLists);
2408 InstructionBuilder ib = new InstructionBuilder();
2409 ib.setKey(new InstructionKey(0));
2410 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2412 // Put our Instruction in a list of Instructions
2413 InstructionsBuilder isb = new InstructionsBuilder();
2414 List<Instruction> instructions = new ArrayList<Instruction>();
2415 instructions.add(ib.build());
2416 isb.setInstruction(instructions);
2421 private static InstructionsBuilder createAppyActionInstruction45() {
2423 List<Action> actionList = new ArrayList<Action>();
2424 ActionBuilder ab = new ActionBuilder();
2425 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2426 ActionBuilder ab1 = new ActionBuilder();
2427 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2430 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
2431 Icmpv6MatchBuilder icmpv6match1 = new Icmpv6MatchBuilder();
2432 icmpv6match.setIcmpv6Type((short) 135);
2433 icmpv6match1.setIcmpv6Code((short) 0);
2434 setFieldBuilder.setIcmpv6Match(icmpv6match.build());
2435 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2436 ab.setKey(new ActionKey(0));
2437 actionList.add(ab.build());
2439 setFieldBuilder1.setIcmpv6Match(icmpv6match1.build());
2440 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2441 ab1.setKey(new ActionKey(1));
2442 actionList.add(ab1.build());
2444 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2445 aab.setAction(actionList);
2447 InstructionBuilder ib = new InstructionBuilder();
2448 ib.setKey(new InstructionKey(0));
2449 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2451 // Put our Instruction in a list of Instructions
2452 InstructionsBuilder isb = new InstructionsBuilder();
2453 List<Instruction> instructions = new ArrayList<Instruction>();
2454 instructions.add(ib.build());
2455 isb.setInstruction(instructions);
2459 private static InstructionsBuilder createAppyActionInstruction46() {
2461 List<Action> actionList = new ArrayList<Action>();
2462 ActionBuilder ab = new ActionBuilder();
2463 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2464 ActionBuilder ab1 = new ActionBuilder();
2465 SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
2466 ActionBuilder ab2 = new ActionBuilder();
2467 SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
2470 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2471 ProtocolMatchFieldsBuilder protomatch1 = new ProtocolMatchFieldsBuilder();
2472 ProtocolMatchFieldsBuilder protomatch2 = new ProtocolMatchFieldsBuilder();
2473 protomatch.setMplsLabel((long) 36008);
2474 protomatch1.setMplsTc((short) 4);
2475 protomatch2.setMplsBos((short) 1);
2476 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2477 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2478 ab.setKey(new ActionKey(0));
2479 actionList.add(ab.build());
2481 setFieldBuilder1.setProtocolMatchFields(protomatch1.build());
2482 ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
2483 ab1.setKey(new ActionKey(1));
2484 actionList.add(ab1.build());
2486 setFieldBuilder2.setProtocolMatchFields(protomatch2.build());
2487 ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
2488 ab2.setKey(new ActionKey(2));
2489 actionList.add(ab2.build());
2491 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2492 aab.setAction(actionList);
2494 InstructionBuilder ib = new InstructionBuilder();
2495 ib.setKey(new InstructionKey(0));
2496 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2498 // Put our Instruction in a list of Instructions
2499 InstructionsBuilder isb = new InstructionsBuilder();
2500 List<Instruction> instructions = new ArrayList<Instruction>();
2501 instructions.add(ib.build());
2502 isb.setInstruction(instructions);
2506 private static InstructionsBuilder createAppyActionInstruction47() {
2508 List<Action> actionList = new ArrayList<Action>();
2509 ActionBuilder ab = new ActionBuilder();
2510 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2512 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder();
2513 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new byte[] { 0, 1, 0, 0 }).build());
2514 setFieldBuilder.setProtocolMatchFields(protomatch.build());
2515 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2516 actionList.add(ab.build());
2518 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2519 aab.setAction(actionList);
2521 InstructionBuilder ib = new InstructionBuilder();
2522 ib.setKey(new InstructionKey(0));
2523 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2525 // Put our Instruction in a list of Instructions
2526 InstructionsBuilder isb = new InstructionsBuilder();
2527 List<Instruction> instructions = new ArrayList<Instruction>();
2528 instructions.add(ib.build());
2529 isb.setInstruction(instructions);
2533 private static InstructionsBuilder createAppyActionInstruction48() {
2535 List<Action> actionList = new ArrayList<Action>();
2536 ActionBuilder ab = new ActionBuilder();
2537 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
2539 TunnelBuilder tunnel = new TunnelBuilder();
2540 tunnel.setTunnelId(BigInteger.valueOf(10668));
2541 setFieldBuilder.setTunnel(tunnel.build());
2542 ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
2543 actionList.add(ab.build());
2545 ApplyActionsBuilder aab = new ApplyActionsBuilder();
2546 aab.setAction(actionList);
2548 InstructionBuilder ib = new InstructionBuilder();
2549 ib.setKey(new InstructionKey(0));
2550 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
2552 // Put our Instruction in a list of Instructions
2553 InstructionsBuilder isb = new InstructionsBuilder();
2554 List<Instruction> instructions = new ArrayList<Instruction>();
2555 instructions.add(ib.build());
2556 isb.setInstruction(instructions);
2563 private static MatchBuilder createMatch1() {
2564 MatchBuilder match = new MatchBuilder();
2565 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2566 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2567 ipv4Match.setIpv4Destination(prefix);
2568 Ipv4Match i4m = ipv4Match.build();
2569 match.setLayer3Match(i4m);
2571 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2572 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2573 ethTypeBuilder.setType(new EtherType(0x0800L));
2574 eth.setEthernetType(ethTypeBuilder.build());
2575 match.setEthernetMatch(eth.build());
2582 private static MatchBuilder createIPv4DstMatch() {
2583 MatchBuilder match = new MatchBuilder();
2584 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2585 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
2586 ipv4Match.setIpv4Destination(prefix);
2587 Ipv4Match i4m = ipv4Match.build();
2588 match.setLayer3Match(i4m);
2596 private static MatchBuilder createIPv4SrcMatch() {
2597 MatchBuilder match = new MatchBuilder();
2598 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2599 Ipv4Prefix prefix = new Ipv4Prefix("10.20.30.40/24");
2600 ipv4Match.setIpv4Source(prefix);
2601 Ipv4Match i4m = ipv4Match.build();
2602 match.setLayer3Match(i4m);
2604 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2605 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2606 ethTypeBuilder.setType(new EtherType(0x0800L));
2607 eth.setEthernetType(ethTypeBuilder.build());
2608 match.setEthernetMatch(eth.build());
2615 private static MatchBuilder createMatch2() {
2616 MatchBuilder match = new MatchBuilder();
2617 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2618 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1");
2619 ipv4Match.setIpv4Source(prefix);
2620 Ipv4Match i4m = ipv4Match.build();
2621 match.setLayer3Match(i4m);
2623 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2624 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2625 ethTypeBuilder.setType(new EtherType(0x0800L));
2626 eth.setEthernetType(ethTypeBuilder.build());
2627 match.setEthernetMatch(eth.build());
2634 private static MatchBuilder createMatch3() {
2635 MatchBuilder match = new MatchBuilder();
2636 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
2637 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
2638 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
2639 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
2640 match.setEthernetMatch(ethernetMatch.build());
2648 private static MatchBuilder createICMPv6Match1() {
2650 MatchBuilder match = new MatchBuilder();
2651 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2652 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2653 ethTypeBuilder.setType(new EtherType(0x86ddL));
2654 eth.setEthernetType(ethTypeBuilder.build());
2655 match.setEthernetMatch(eth.build());
2657 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2658 ipmatch.setIpProtocol((short) 256);
2659 match.setIpMatch(ipmatch.build());
2661 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2663 icmpv6match.setIcmpv6Type((short) 135);
2664 icmpv6match.setIcmpv6Code((short) 1);
2665 match.setIcmpv6Match(icmpv6match.build());
2670 private static MatchBuilder createMatch33() {
2672 MatchBuilder match = new MatchBuilder();
2673 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2674 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.10");
2675 ipv4Match.setIpv4Source(prefix);
2676 Ipv4Match i4m = ipv4Match.build();
2677 match.setLayer3Match(i4m);
2679 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2680 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2681 ethTypeBuilder.setType(new EtherType(0xfffeL));
2682 eth.setEthernetType(ethTypeBuilder.build());
2683 match.setEthernetMatch(eth.build());
2687 private static MatchBuilder createInphyportMatch(NodeId nodeId) {
2688 MatchBuilder match = new MatchBuilder();
2689 match.setInPort(new NodeConnectorId(nodeId+":202"));
2690 match.setInPhyPort(new NodeConnectorId(nodeId+":10122"));
2694 private static MatchBuilder createEthernetMatch() {
2695 MatchBuilder match = new MatchBuilder();
2697 byte[] mask1 = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2698 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2700 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
2702 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2703 EtherType type = new EtherType(0x0800L);
2704 ethmatch.setEthernetType(ethtype.setType(type).build());
2706 EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet
2709 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2710 ethdest.setAddress(macdest);
2711 ethdest.setMask(mask1);
2713 ethmatch.setEthernetDestination(ethdest.build());
2715 EthernetSourceBuilder ethsrc = new EthernetSourceBuilder();
2716 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2717 ethsrc.setAddress(macsrc);
2718 ethsrc.setMask(mask2);
2720 ethmatch.setEthernetSource(ethsrc.build());
2721 match.setEthernetMatch(ethmatch.build());
2730 private static MatchBuilder createVlanMatch() {
2731 MatchBuilder match = new MatchBuilder();
2732 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder(); // vlan match
2733 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
2734 VlanId vlanId = new VlanId(10);
2735 VlanPcp vpcp = new VlanPcp((short) 3);
2736 vlanBuilder.setVlanPcp(vpcp);
2737 vlanIdBuilder.setVlanId(vlanId);
2738 vlanIdBuilder.setVlanIdPresent(true);
2739 vlanBuilder.setVlanId(vlanIdBuilder.build());
2740 match.setVlanMatch(vlanBuilder.build());
2747 private static MatchBuilder createArpMatch() {
2748 MatchBuilder match = new MatchBuilder();
2750 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2751 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
2752 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
2754 byte[] mask = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
2755 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
2757 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2758 EtherType type = new EtherType(0x0806L);
2759 ethmatch.setEthernetType(ethtype.setType(type).build());
2761 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
2762 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2764 ArpMatchBuilder arpmatch = new ArpMatchBuilder(); // arp match
2765 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
2766 arpsrc.setAddress(macsrc);
2767 arpsrc.setMask(mask);
2768 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
2769 arpdst.setAddress(macdest);
2770 arpdst.setMask(mask2);
2771 arpmatch.setArpOp(2);
2772 arpmatch.setArpSourceHardwareAddress(arpsrc.build());
2773 arpmatch.setArpTargetHardwareAddress(arpdst.build());
2774 arpmatch.setArpSourceTransportAddress(srcip);
2775 arpmatch.setArpTargetTransportAddress(dstip);
2777 match.setEthernetMatch(ethmatch.build());
2778 match.setLayer3Match(arpmatch.build());
2786 private static MatchBuilder createIPMatch() {
2787 MatchBuilder match = new MatchBuilder();
2788 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2789 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2790 EtherType type = new EtherType(0x0800L);
2791 ethmatch.setEthernetType(ethtype.setType(type).build());
2792 match.setEthernetMatch(ethmatch.build());
2794 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2795 ipmatch.setIpProtocol((short) 1);
2796 Dscp dscp = new Dscp((short) 3);
2797 ipmatch.setIpDscp(dscp);
2798 ipmatch.setIpEcn((short) 2);
2799 match.setIpMatch(ipmatch.build());
2806 private static MatchBuilder createL3IPv4Match() {
2807 MatchBuilder match = new MatchBuilder();
2809 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2810 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2811 ethTypeBuilder.setType(new EtherType(0x0800L));
2812 eth.setEthernetType(ethTypeBuilder.build());
2813 match.setEthernetMatch(eth.build());
2815 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
2816 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
2817 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
2818 Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
2819 ipv4match.setIpv4Destination(dstip);
2820 ipv4match.setIpv4Source(srcip);
2821 match.setLayer3Match(ipv4match.build());
2830 private static MatchBuilder createL3IPv6Match() {
2831 MatchBuilder match = new MatchBuilder();
2833 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2834 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2835 ethTypeBuilder.setType(new EtherType(0x86ddL));
2836 eth.setEthernetType(ethTypeBuilder.build());
2837 match.setEthernetMatch(eth.build());
2839 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2/64");
2840 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1/56");
2841 Ipv6Address ndtarget = new Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
2842 MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
2843 MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
2844 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
2845 nextheader.setIpv6Exthdr(58);
2846 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
2847 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
2848 ipv6label.setIpv6Flabel(label);
2849 ipv6label.setFlabelMask(new byte[] { 0, 1, -1, -1 });
2851 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2853 icmpv6match.setIcmpv6Type((short) 135);
2854 icmpv6match.setIcmpv6Code((short) 0);
2855 match.setIcmpv6Match(icmpv6match.build());
2857 Ipv6MatchBuilder ipv6match = new Ipv6MatchBuilder();
2858 // ipv6match.setIpv6Source(srcip6);
2859 // ipv6match.setIpv6Destination(dstip6);
2860 // ipv6match.setIpv6ExtHeader(nextheader.build());
2861 ipv6match.setIpv6NdSll(ndsll);
2862 ipv6match.setIpv6NdTll(ndtll);
2863 // ipv6match.setIpv6NdTarget(ndtarget);
2864 ipv6match.setIpv6Label(ipv6label.build());
2866 match.setLayer3Match(ipv6match.build());
2875 private static MatchBuilder createICMPv4Match() {
2876 MatchBuilder match = new MatchBuilder();
2877 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2878 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2879 ethTypeBuilder.setType(new EtherType(0x0800L));
2880 eth.setEthernetType(ethTypeBuilder.build());
2881 match.setEthernetMatch(eth.build());
2883 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2884 ipmatch.setIpProtocol((short) 1);
2885 match.setIpMatch(ipmatch.build());
2887 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder(); // icmpv4
2889 icmpv4match.setIcmpv4Type((short) 8);
2890 icmpv4match.setIcmpv4Code((short) 0);
2891 match.setIcmpv4Match(icmpv4match.build());
2898 private static MatchBuilder createICMPv6Match() {
2900 MatchBuilder match = new MatchBuilder();
2901 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2902 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2903 ethTypeBuilder.setType(new EtherType(0x86ddL));
2904 eth.setEthernetType(ethTypeBuilder.build());
2905 match.setEthernetMatch(eth.build());
2907 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2908 ipmatch.setIpProtocol((short) 58);
2909 match.setIpMatch(ipmatch.build());
2911 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
2913 icmpv6match.setIcmpv6Type((short) 135);
2914 icmpv6match.setIcmpv6Code((short) 1);
2915 match.setIcmpv6Match(icmpv6match.build());
2923 private static MatchBuilder createToSMatch() {
2924 MatchBuilder match = new MatchBuilder();
2925 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2926 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2927 EtherType type = new EtherType(0x0800L);
2928 ethmatch.setEthernetType(ethtype.setType(type).build());
2929 match.setEthernetMatch(ethmatch.build());
2931 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2932 ipmatch.setIpProtocol((short) 6);
2933 Dscp dscp = new Dscp((short) 8);
2934 ipmatch.setIpDscp(dscp);
2935 match.setIpMatch(ipmatch.build());
2943 private static MatchBuilder createL4TCPMatch() {
2944 MatchBuilder match = new MatchBuilder();
2946 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2947 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2948 ethTypeBuilder.setType(new EtherType(0x0800L));
2949 eth.setEthernetType(ethTypeBuilder.build());
2950 match.setEthernetMatch(eth.build());
2952 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2953 ipmatch.setIpProtocol((short) 6);
2954 match.setIpMatch(ipmatch.build());
2956 PortNumber srcport = new PortNumber(1213);
2957 PortNumber dstport = new PortNumber(646);
2958 TcpMatchBuilder tcpmatch = new TcpMatchBuilder(); // tcp match
2959 tcpmatch.setTcpSourcePort(srcport);
2960 tcpmatch.setTcpDestinationPort(dstport);
2961 match.setLayer4Match(tcpmatch.build());
2969 private static MatchBuilder createL4UDPMatch() {
2970 MatchBuilder match = new MatchBuilder();
2972 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2973 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2974 ethTypeBuilder.setType(new EtherType(0x0800L));
2975 eth.setEthernetType(ethTypeBuilder.build());
2976 match.setEthernetMatch(eth.build());
2978 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2979 ipmatch.setIpProtocol((short) 17);
2980 match.setIpMatch(ipmatch.build());
2982 PortNumber srcport = new PortNumber(1325);
2983 PortNumber dstport = new PortNumber(42);
2984 UdpMatchBuilder udpmatch = new UdpMatchBuilder(); // udp match
2985 udpmatch.setUdpDestinationPort(dstport);
2986 udpmatch.setUdpSourcePort(srcport);
2987 match.setLayer4Match(udpmatch.build());
2995 private static MatchBuilder createL4SCTPMatch() {
2996 MatchBuilder match = new MatchBuilder();
2998 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2999 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3000 ethTypeBuilder.setType(new EtherType(0x0800L));
3001 eth.setEthernetType(ethTypeBuilder.build());
3002 match.setEthernetMatch(eth.build());
3004 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
3005 ipmatch.setIpProtocol((short) 132);
3006 match.setIpMatch(ipmatch.build());
3008 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
3009 PortNumber srcport = new PortNumber(1435);
3010 PortNumber dstport = new PortNumber(22);
3011 sctpmatch.setSctpSourcePort(srcport);
3012 sctpmatch.setSctpDestinationPort(dstport);
3013 match.setLayer4Match(sctpmatch.build());
3021 private static MatchBuilder createMetadataMatch() {
3022 MatchBuilder match = new MatchBuilder();
3023 byte[] metamask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
3024 MetadataBuilder metadata = new MetadataBuilder(); // metadata match
3025 metadata.setMetadata(BigInteger.valueOf(500L));
3026 metadata.setMetadataMask(metamask);
3027 match.setMetadata(metadata.build());
3035 private static MatchBuilder createMplsMatch() {
3036 MatchBuilder match = new MatchBuilder();
3038 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3039 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3040 ethTypeBuilder.setType(new EtherType(0x8847L));
3041 eth.setEthernetType(ethTypeBuilder.build());
3042 match.setEthernetMatch(eth.build());
3044 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3046 protomatch.setMplsLabel((long) 36008);
3047 protomatch.setMplsTc((short) 4);
3048 protomatch.setMplsBos((short) 1);
3049 match.setProtocolMatchFields(protomatch.build());
3058 private static MatchBuilder createPbbMatch() {
3059 MatchBuilder match = new MatchBuilder();
3061 EthernetMatchBuilder eth = new EthernetMatchBuilder();
3062 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
3063 ethTypeBuilder.setType(new EtherType(0x88E7L));
3064 eth.setEthernetType(ethTypeBuilder.build());
3065 match.setEthernetMatch(eth.build());
3067 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
3069 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new byte[] { 0, 1, 0, 0 }).build());
3070 match.setProtocolMatchFields(protomatch.build());
3079 private static MatchBuilder createTunnelIDMatch() {
3080 MatchBuilder match = new MatchBuilder();
3081 TunnelBuilder tunnel = new TunnelBuilder(); // tunnel id match
3082 tunnel.setTunnelId(BigInteger.valueOf(10668));
3083 byte[] mask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
3084 tunnel.setTunnelMask(mask);
3085 match.setTunnel(tunnel.build());
3090 public void _removeMDFlow(CommandInterpreter ci) {
3091 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
3092 NodeBuilder tn = createTestNode(ci.nextArgument());
3093 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
3094 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class).child(Node.class, tn.getKey())
3095 .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf.getTableId()))
3096 .child(Flow.class, tf.getKey()).build();
3097 modification.removeOperationalData(nodeBuilderToInstanceId(tn));
3098 modification.removeOperationalData(path1);
3099 modification.removeConfigurationData(nodeBuilderToInstanceId(tn));
3100 modification.removeConfigurationData(path1);
3101 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
3103 RpcResult<TransactionStatus> result = commitFuture.get();
3104 TransactionStatus status = result.getResult();
3105 ci.println("Status of Flow Data Loaded Transaction: " + status);
3107 } catch (InterruptedException e) {
3108 LOG.error(e.getMessage(), e);
3109 } catch (ExecutionException e) {
3110 LOG.error(e.getMessage(), e);
3114 public void _addMDFlow(CommandInterpreter ci) {
3115 NodeBuilder tn = createTestNode(ci.nextArgument());
3116 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
3117 writeFlow(ci, tf, tn);
3120 private void writeFlow(CommandInterpreter ci, FlowBuilder flow, NodeBuilder nodeBuilder) {
3121 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
3122 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class)
3123 .child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
3124 .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.getKey()).build();
3125 modification.putOperationalData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
3126 modification.putOperationalData(path1, flow.build());
3127 modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
3128 modification.putConfigurationData(path1, flow.build());
3129 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
3131 RpcResult<TransactionStatus> result = commitFuture.get();
3132 TransactionStatus status = result.getResult();
3133 ci.println("Status of Flow Data Loaded Transaction: " + status);
3135 } catch (InterruptedException e) {
3136 LOG.error(e.getMessage(), e);
3137 } catch (ExecutionException e) {
3138 LOG.error(e.getMessage(), e);
3142 public void _modifyMDFlow(CommandInterpreter ci) {
3143 NodeBuilder tn = createTestNode(ci.nextArgument());
3144 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
3145 tf.setFlowName(updatedFlowName);
3146 writeFlow(ci, tf, tn);
3147 tf.setFlowName(originalFlowName);
3148 writeFlow(ci, tf, tn);
3151 private static NodeRef createNodeRef(String string) {
3152 NodeKey key = new NodeKey(new NodeId(string));
3153 InstanceIdentifier<Node> path = InstanceIdentifier.builder().node(Nodes.class).node(Node.class, key)
3156 return new NodeRef(path);
3160 public String getHelp() {