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.data.DataBrokerService;
23 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
24 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
25 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
26 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6FlowLabel;
27 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Prefix;
28 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
29 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
30 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionCaseBuilder;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCaseBuilder;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCaseBuilder;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCaseBuilder;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCaseBuilder;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodActionCaseBuilder;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAllActionCaseBuilder;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCaseBuilder;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.HwPathActionCaseBuilder;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.LoopbackActionCaseBuilder;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCaseBuilder;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopPbbActionCaseBuilder;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCaseBuilder;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCaseBuilder;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCaseBuilder;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCaseBuilder;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCaseBuilder;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCaseBuilder;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlTypeActionCaseBuilder;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCaseBuilder;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNextHopActionCaseBuilder;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCaseBuilder;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionCaseBuilder;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCaseBuilder;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCaseBuilder;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCaseBuilder;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCaseBuilder;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanCfiActionCaseBuilder;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCaseBuilder;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.StripVlanActionCaseBuilder;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SwPathActionCaseBuilder;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.controller.action._case.ControllerActionBuilder;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.in._case.CopyTtlInBuilder;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.out._case.CopyTtlOutBuilder;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.mpls.ttl._case.DecMplsTtlBuilder;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtl;
72 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropAction;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.action._case.FloodActionBuilder;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.all.action._case.FloodAllActionBuilder;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.hw.path.action._case.HwPathActionBuilder;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.loopback.action._case.LoopbackActionBuilder;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder;
81 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
82 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbActionBuilder;
83 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder;
84 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder;
85 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder;
86 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder;
87 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstActionBuilder;
88 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder;
89 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.type.action._case.SetDlTypeActionBuilder;
90 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;
91 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlActionBuilder;
92 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.next.hop.action._case.SetNextHopActionBuilder;
93 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder;
94 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder;
95 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.tos.action._case.SetNwTosActionBuilder;
96 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder;
97 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.queue.action._case.SetQueueActionBuilder;
98 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstActionBuilder;
99 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder;
100 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.cfi.action._case.SetVlanCfiActionBuilder;
101 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder;
102 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.pcp.action._case.SetVlanPcpActionBuilder;
103 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.strip.vlan.action._case.StripVlanActionBuilder;
104 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.sw.path.action._case.SwPathActionBuilder;
105 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
106 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
107 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
108 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
109 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.Flows;
110 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
111 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
112 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
113 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
114 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
115 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
116 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.OutputPortValues;
117 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
118 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
119 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
120 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCaseBuilder;
121 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCaseBuilder;
122 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCaseBuilder;
123 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
124 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.go.to.table._case.GoToTableBuilder;
125 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.meter._case.MeterBuilder;
126 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.metadata._case.WriteMetadataBuilder;
127 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
128 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
129 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
130 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
131 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
132 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
133 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
134 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
135 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
136 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
137 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
138 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
139 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
140 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.ExperimenterBuilder;
141 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddressBuilder;
142 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpTargetHardwareAddressBuilder;
143 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
144 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder;
145 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
146 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6ExtHeaderBuilder;
147 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6LabelBuilder;
148 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
149 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder;
150 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder;
151 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
152 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.MetadataBuilder;
153 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder;
154 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TunnelBuilder;
155 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
156 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder;
157 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match;
158 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
159 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
160 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder;
161 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
162 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
163 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.protocol.match.fields.PbbBuilder;
164 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
165 import org.opendaylight.yangtools.yang.binding.DataObject;
166 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
167 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
168 import org.opendaylight.yangtools.yang.common.RpcResult;
169 import org.osgi.framework.BundleContext;
170 import org.slf4j.Logger;
171 import org.slf4j.LoggerFactory;
172 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
173 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
175 public class OpenflowpluginTestCommandProvider implements CommandProvider {
177 private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
179 private DataBrokerService dataBrokerService;
180 private ProviderContext pc;
181 private final BundleContext ctx;
182 private FlowBuilder testFlow;
183 private NodeBuilder testNode;
184 private final String originalFlowName = "Foo";
185 private final String updatedFlowName = "Bar";
187 public OpenflowpluginTestCommandProvider(BundleContext ctx) {
191 public void onSessionInitiated(ProviderContext session) {
193 dataBrokerService = session.getSALService(DataBrokerService.class);
194 ctx.registerService(CommandProvider.class.getName(), this, null);
195 createTestFlow(createTestNode(null), null, null);
198 private NodeBuilder createTestNode(String nodeId) {
199 if (nodeId == null) {
200 nodeId = OpenflowpluginTestActivator.NODE_ID;
202 NodeRef nodeOne = createNodeRef(nodeId);
203 NodeBuilder builder = new NodeBuilder();
204 builder.setId(new NodeId(nodeId));
205 builder.setKey(new NodeKey(builder.getId()));
210 private InstanceIdentifier<Node> nodeBuilderToInstanceId(NodeBuilder node) {
211 return InstanceIdentifier.builder(Nodes.class).child(Node.class, node.getKey()).toInstance();
214 private FlowBuilder createTestFlow(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
216 FlowBuilder flow = new FlowBuilder();
219 String flowType = flowTypeArg;
220 if (flowType == null) {
227 flow.setMatch(createMatch1().build());
228 flow.setInstructions(createDecNwTtlInstructions().build());
232 flow.setMatch(createMatch2().build());
233 flow.setInstructions(createDropInstructions().build());
237 flow.setMatch(createMatch3().build());
238 flow.setInstructions(createDropInstructions().build());
242 flow.setMatch(createEthernetMatch().build());
243 flow.setInstructions(createDropInstructions().build());
247 flow.setMatch(createMatch1().build());
248 flow.setInstructions(createAppyActionInstruction().build());
252 flow.setMatch(createMatch1().build());
253 flow.setInstructions(createGotoTableInstructions().build());
257 flow.setMatch(createMatch1().build());
258 flow.setInstructions(createMeterInstructions().build());
262 flow.setMatch(createMatch1().build());
263 flow.setInstructions(createAppyActionInstruction1().build());
267 flow.setMatch(createMatch1().build());
268 flow.setInstructions(createAppyActionInstruction2().build());
272 flow.setMatch(createMatch1().build());
273 flow.setInstructions(createAppyActionInstruction3().build());
277 flow.setMatch(createMatch1().build());
278 flow.setInstructions(createAppyActionInstruction4().build());
282 flow.setMatch(createMatch1().build());
283 flow.setInstructions(createAppyActionInstruction5().build());
287 flow.setMatch(createMatch1().build());
288 flow.setInstructions(createAppyActionInstruction6().build());
292 flow.setMatch(createMatch1().build());
293 flow.setInstructions(createAppyActionInstruction7().build());
297 flow.setMatch(createMatch1().build());
298 flow.setInstructions(createAppyActionInstruction8().build());
302 flow.setMatch(createMatch1().build());
303 flow.setInstructions(createAppyActionInstruction9().build());
307 flow.setMatch(createMatch1().build());
308 flow.setInstructions(createAppyActionInstruction10().build());
312 flow.setMatch(createMatch1().build());
313 flow.setInstructions(createAppyActionInstruction11().build());
317 flow.setMatch(createMatch1().build());
318 flow.setInstructions(createAppyActionInstruction12().build());
322 flow.setMatch(createMatch1().build());
323 flow.setInstructions(createAppyActionInstruction13().build());
327 flow.setMatch(createMatch1().build());
328 flow.setInstructions(createAppyActionInstruction14().build());
332 flow.setMatch(createMatch1().build());
333 flow.setInstructions(createAppyActionInstruction15().build());
337 flow.setMatch(createMatch1().build());
338 flow.setInstructions(createAppyActionInstruction16().build());
342 flow.setMatch(createMatch1().build());
343 flow.setInstructions(createAppyActionInstruction17().build());
347 flow.setMatch(createMatch1().build());
348 flow.setInstructions(createAppyActionInstruction18().build());
352 flow.setMatch(createMatch1().build());
353 flow.setInstructions(createAppyActionInstruction19().build());
357 flow.setMatch(createMatch1().build());
358 flow.setInstructions(createMetadataInstructions().build());
362 flow.setMatch(createMatch1().build());
363 flow.setInstructions(createAppyActionInstruction20().build());
367 flow.setMatch(createMatch1().build());
368 flow.setInstructions(createAppyActionInstruction21().build());
372 flow.setMatch(createMatch1().build());
373 flow.setInstructions(createAppyActionInstruction22().build());
377 flow.setMatch(createMatch1().build());
378 flow.setInstructions(createAppyActionInstruction23().build());
382 flow.setMatch(createMatch1().build());
383 flow.setInstructions(createAppyActionInstruction24().build());
387 flow.setMatch(createMatch1().build());
388 flow.setInstructions(createAppyActionInstruction25().build());
392 flow.setMatch(createMatch1().build());
393 flow.setInstructions(createAppyActionInstruction26().build());
397 flow.setMatch(createMatch1().build());
398 flow.setInstructions(createAppyActionInstruction27().build());
402 flow.setMatch(createMatch1().build());
403 flow.setInstructions(createAppyActionInstruction28().build());
407 flow.setMatch(createMatch1().build());
408 flow.setInstructions(createAppyActionInstruction29().build());
412 flow.setMatch(createMatch1().build());
413 flow.setInstructions(createAppyActionInstruction30().build());
417 flow.setMatch(createMatch1().build());
418 flow.setInstructions(createAppyActionInstruction31().build());
422 flow.setMatch(createMatch1().build());
423 flow.setInstructions(createAppyActionInstruction32().build());
427 flow.setMatch(createMatch1().build());
428 flow.setInstructions(createAppyActionInstruction33().build());
432 flow.setMatch(createMatch1().build());
433 flow.setInstructions(createAppyActionInstruction34().build());
437 flow.setMatch(createICMPv6Match().build());
438 flow.setInstructions(createDecNwTtlInstructions().build());
442 flow.setMatch(createInphyportMatch().build());
443 flow.setInstructions(createDropInstructions().build());
447 flow.setMatch(createMetadataMatch().build());
448 flow.setInstructions(createDropInstructions().build());
452 flow.setMatch(createL3IPv6Match().build());
453 flow.setInstructions(createDecNwTtlInstructions().build());
457 flow.setMatch(createL4SCTPMatch().build());
458 flow.setInstructions(createAppyActionInstruction().build());
462 flow.setMatch(createTunnelIDMatch().build());
463 flow.setInstructions(createGotoTableInstructions().build());
467 flow.setMatch(createVlanMatch().build());
468 flow.setInstructions(createMeterInstructions().build());
472 flow.setMatch(createPbbMatch().build());
473 flow.setInstructions(createMeterInstructions().build());
477 flow.setMatch(createVlanMatch().build());
478 flow.setInstructions(createDropInstructions().build());
482 flow.setMatch(createL4TCPMatch().build());
483 flow.setInstructions(createDropInstructions().build());
488 flow.setMatch(createL4UDPMatch().build());
489 flow.setInstructions(createDropInstructions().build());
493 flow.setMatch(new MatchBuilder().build());
494 flow.setInstructions(createSentToControllerInstructions().build());
498 flow.setMatch(createToSMatch().build());
499 flow.setInstructions(createDropInstructions().build());
503 flow.setMatch(createToSMatch().build());
504 flow.setInstructions(createOutputInstructions("INPORT", 10).build());
508 flow.setMatch(createToSMatch().build());
509 flow.setInstructions(createOutputInstructions("FLOOD", 20).build());
513 flow.setMatch(createToSMatch().build());
514 flow.setInstructions(createOutputInstructions("ALL", 30).build());
518 flow.setMatch(createToSMatch().build());
519 flow.setInstructions(createOutputInstructions("NORMAL" , 40).build());
523 flow.setMatch(createToSMatch().build());
524 flow.setInstructions(createOutputInstructions("LOCAL" , 50).build());
528 flow.setMatch(createToSMatch().build());
529 flow.setInstructions(createOutputInstructions("TABLE", 60).build());
533 flow.setMatch(createToSMatch().build());
534 flow.setInstructions(createOutputInstructions("NONE" , 70).build());
538 flow.setMatch(createToSMatch().build());
539 flow.setInstructions(createStripVlanInstructions().build());
540 flow.setBarrier(Boolean.TRUE);
543 LOG.warn("flow type not understood: {}", flowType);
546 FlowKey key = new FlowKey(new FlowId(id));
547 if(null == flow.isBarrier())
549 flow.setBarrier(Boolean.FALSE);
551 // flow.setBufferId(new Long(12));
552 BigInteger value = new BigInteger("10", 10);
553 BigInteger outputPort = new BigInteger("65535", 10);
554 flow.setCookie(value);
555 flow.setCookieMask(value);
556 flow.setHardTimeout(0);
557 flow.setIdleTimeout(0);
558 flow.setInstallHw(false);
559 flow.setStrict(false);
560 flow.setContainerName(null);
561 flow.setFlags(new FlowModFlags(false, false, false, false, false));
562 flow.setId(new FlowId(new Long(12)));
563 flow.setTableId(getTableId(tableId));
564 flow.setOutGroup(new Long(2));
565 // set outport to OFPP_NONE (65535) to disable remove restriction for flow
566 flow.setOutPort(outputPort);
570 flow.setFlowName(originalFlowName + "X" + flowType);
576 private short getTableId(String tableId)
581 table = Short.parseShort(tableId);
585 // ignore exception and continue with default value
595 private static InstructionsBuilder createDecNwTtlInstructions() {
596 DecNwTtlBuilder ta = new DecNwTtlBuilder();
597 DecNwTtl decNwTtl = ta.build();
598 ActionBuilder ab = new ActionBuilder();
599 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
601 // Add our drop action to a list
602 List<Action> actionList = new ArrayList<Action>();
603 actionList.add(ab.build());
605 // Create an Apply Action
606 ApplyActionsBuilder aab = new ApplyActionsBuilder();
607 aab.setAction(actionList);
609 // Wrap our Apply Action in an Instruction
610 InstructionBuilder ib = new InstructionBuilder();
611 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
612 ib.setKey(new InstructionKey(0));
615 // Put our Instruction in a list of Instructions
616 InstructionsBuilder isb = new InstructionsBuilder();
617 List<Instruction> instructions = new ArrayList<Instruction>();
618 instructions.add(ib.build());
619 isb.setInstruction(instructions);
626 private static InstructionsBuilder createMeterInstructions() {
628 MeterBuilder aab = new MeterBuilder();
629 aab.setMeterId(new MeterId(new Long(1)));
631 InstructionBuilder ib = new InstructionBuilder();
632 ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
634 // Put our Instruction in a list of Instructions
635 InstructionsBuilder isb = new InstructionsBuilder();
636 List<Instruction> instructions = new ArrayList<Instruction>();
637 instructions.add(ib.build());
638 isb.setInstruction(instructions);
642 private static InstructionsBuilder createMetadataInstructions() {
644 WriteMetadataBuilder aab = new WriteMetadataBuilder();
645 aab.setMetadata(new BigInteger("10", 10));
646 aab.setMetadataMask(new BigInteger("12", 10));
648 InstructionBuilder ib = new InstructionBuilder();
649 ib.setInstruction(new WriteMetadataCaseBuilder().setWriteMetadata(aab.build()).build());
651 // Put our Instruction in a list of Instructions
652 InstructionsBuilder isb = new InstructionsBuilder();
653 List<Instruction> instructions = new ArrayList<Instruction>();
654 instructions.add(ib.build());
655 isb.setInstruction(instructions);
659 private static InstructionsBuilder createGotoTableInstructions() {
661 GoToTableBuilder aab = new GoToTableBuilder();
662 aab.setTableId((short) 2);
664 InstructionBuilder ib = new InstructionBuilder();
665 ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(aab.build()).build());
667 // Put our Instruction in a list of Instructions
668 InstructionsBuilder isb = new InstructionsBuilder();
669 List<Instruction> instructions = new ArrayList<Instruction>();
670 instructions.add(ib.build());
671 isb.setInstruction(instructions);
675 private static InstructionsBuilder createDropInstructions() {
676 DropActionBuilder dab = new DropActionBuilder();
677 DropAction dropAction = dab.build();
678 ActionBuilder ab = new ActionBuilder();
679 ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build());
681 // Add our drop action to a list
682 List<Action> actionList = new ArrayList<Action>();
683 actionList.add(ab.build());
685 // Create an Apply Action
686 ApplyActionsBuilder aab = new ApplyActionsBuilder();
687 aab.setAction(actionList);
689 // Wrap our Apply Action in an Instruction
690 InstructionBuilder ib = new InstructionBuilder();
691 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
693 // Put our Instruction in a list of Instructions
694 InstructionsBuilder isb = new InstructionsBuilder();
695 List<Instruction> instructions = new ArrayList<Instruction>();
696 instructions.add(ib.build());
697 isb.setInstruction(instructions);
701 private static InstructionsBuilder createAppyActionInstruction() {
703 List<Action> actionList = new ArrayList<Action>();
704 ActionBuilder ab = new ActionBuilder();
705 ControllerActionBuilder controller = new ControllerActionBuilder();
706 controller.setMaxLength(5);
707 ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.build()).build());
708 actionList.add(ab.build());
709 // Create an Apply Action
710 ApplyActionsBuilder aab = new ApplyActionsBuilder();
711 aab.setAction(actionList);
713 // Wrap our Apply Action in an Instruction
714 InstructionBuilder ib = new InstructionBuilder();
715 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
717 // Put our Instruction in a list of Instructions
718 InstructionsBuilder isb = new InstructionsBuilder();
719 List<Instruction> instructions = new ArrayList<Instruction>();
720 instructions.add(ib.build());
721 isb.setInstruction(instructions);
725 private static InstructionsBuilder createAppyActionInstruction1() {
727 List<Action> actionList = new ArrayList<Action>();
728 ActionBuilder ab = new ActionBuilder();
730 OutputActionBuilder output = new OutputActionBuilder();
731 output.setMaxLength(56);
732 Uri value = new Uri("PCEP");
733 output.setOutputNodeConnector(value);
734 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
735 actionList.add(ab.build());
736 // Create an Apply Action
737 ApplyActionsBuilder aab = new ApplyActionsBuilder();
738 aab.setAction(actionList);
740 // Wrap our Apply Action in an Instruction
741 InstructionBuilder ib = new InstructionBuilder();
742 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
744 // Put our Instruction in a list of Instructions
745 InstructionsBuilder isb = new InstructionsBuilder();
746 List<Instruction> instructions = new ArrayList<Instruction>();
747 instructions.add(ib.build());
748 isb.setInstruction(instructions);
752 private static InstructionsBuilder createSentToControllerInstructions() {
753 List<Action> actionList = new ArrayList<Action>();
754 ActionBuilder ab = new ActionBuilder();
756 OutputActionBuilder output = new OutputActionBuilder();
757 output.setMaxLength(56);
758 Uri value = new Uri("CONTROLLER");
759 output.setOutputNodeConnector(value);
760 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
762 ab.setKey(new ActionKey(0));
763 actionList.add(ab.build());
764 // Create an Apply Action
765 ApplyActionsBuilder aab = new ApplyActionsBuilder();
766 aab.setAction(actionList);
768 // Wrap our Apply Action in an Instruction
769 InstructionBuilder ib = new InstructionBuilder();
770 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
772 ib.setKey(new InstructionKey(0));
774 // Put our Instruction in a list of Instructions
775 InstructionsBuilder isb = new InstructionsBuilder();
776 List<Instruction> instructions = new ArrayList<Instruction>();
777 instructions.add(ib.build());
778 isb.setInstruction(instructions);
783 private static InstructionsBuilder createOutputInstructions(String outputType, int outputValue) {
784 List<Action> actionList = new ArrayList<Action>();
785 ActionBuilder ab = new ActionBuilder();
787 OutputActionBuilder output = new OutputActionBuilder();
788 output.setMaxLength(outputValue);
789 Uri value = new Uri(outputType);
790 output.setOutputNodeConnector(value);
791 ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
793 ab.setKey(new ActionKey(0));
794 actionList.add(ab.build());
795 // Create an Apply Action
796 ApplyActionsBuilder aab = new ApplyActionsBuilder();
797 aab.setAction(actionList);
799 // Wrap our Apply Action in an Instruction
800 InstructionBuilder ib = new InstructionBuilder();
801 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
803 ib.setKey(new InstructionKey(0));
805 // Put our Instruction in a list of Instructions
806 InstructionsBuilder isb = new InstructionsBuilder();
807 List<Instruction> instructions = new ArrayList<Instruction>();
808 instructions.add(ib.build());
809 isb.setInstruction(instructions);
813 private static InstructionsBuilder createStripVlanInstructions() {
814 List<Action> actionList = new ArrayList<Action>();
815 ActionBuilder ab = new ActionBuilder();
817 StripVlanActionBuilder stripActionBuilder = new StripVlanActionBuilder();
818 ab.setAction(new StripVlanActionCaseBuilder().setStripVlanAction(stripActionBuilder.build()).build());
820 ab.setKey(new ActionKey(0));
821 actionList.add(ab.build());
822 // Create an Apply Action
823 ApplyActionsBuilder aab = new ApplyActionsBuilder();
824 aab.setAction(actionList);
826 // Wrap our Apply Action in an Instruction
827 InstructionBuilder ib = new InstructionBuilder();
828 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
830 ib.setKey(new InstructionKey(0));
832 // Put our Instruction in a list of Instructions
833 InstructionsBuilder isb = new InstructionsBuilder();
834 List<Instruction> instructions = new ArrayList<Instruction>();
835 instructions.add(ib.build());
836 isb.setInstruction(instructions);
841 private static InstructionsBuilder createAppyActionInstruction2() {
843 List<Action> actionList = new ArrayList<Action>();
844 ActionBuilder ab = new ActionBuilder();
846 PushMplsActionBuilder push = new PushMplsActionBuilder();
847 push.setEthernetType(new Integer(0x8847));
848 ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
849 actionList.add(ab.build());
850 // Create an Apply Action
851 ApplyActionsBuilder aab = new ApplyActionsBuilder();
852 aab.setAction(actionList);
854 // Wrap our Apply Action in an Instruction
855 InstructionBuilder ib = new InstructionBuilder();
856 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
858 // Put our Instruction in a list of Instructions
859 InstructionsBuilder isb = new InstructionsBuilder();
860 List<Instruction> instructions = new ArrayList<Instruction>();
861 instructions.add(ib.build());
862 isb.setInstruction(instructions);
866 private static InstructionsBuilder createAppyActionInstruction3() {
868 List<Action> actionList = new ArrayList<Action>();
869 ActionBuilder ab = new ActionBuilder();
871 PushPbbActionBuilder pbb = new PushPbbActionBuilder();
872 pbb.setEthernetType(new Integer(0x88E7));
873 ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
874 actionList.add(ab.build());
875 // Create an Apply Action
876 ApplyActionsBuilder aab = new ApplyActionsBuilder();
877 aab.setAction(actionList);
879 // Wrap our Apply Action in an Instruction
880 InstructionBuilder ib = new InstructionBuilder();
881 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
883 // Put our Instruction in a list of Instructions
884 InstructionsBuilder isb = new InstructionsBuilder();
885 List<Instruction> instructions = new ArrayList<Instruction>();
886 instructions.add(ib.build());
887 isb.setInstruction(instructions);
891 private static InstructionsBuilder createAppyActionInstruction4() {
893 List<Action> actionList = new ArrayList<Action>();
894 ActionBuilder ab = new ActionBuilder();
896 PushVlanActionBuilder vlan = new PushVlanActionBuilder();
897 vlan.setEthernetType(new Integer(0x8100));
898 ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
899 actionList.add(ab.build());
901 // Create an Apply Action
902 ApplyActionsBuilder aab = new ApplyActionsBuilder();
903 aab.setAction(actionList);
905 // Wrap our Apply Action in an Instruction
906 InstructionBuilder ib = new InstructionBuilder();
907 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
909 // Put our Instruction in a list of Instructions
910 InstructionsBuilder isb = new InstructionsBuilder();
911 List<Instruction> instructions = new ArrayList<Instruction>();
912 instructions.add(ib.build());
913 isb.setInstruction(instructions);
917 private static InstructionsBuilder createAppyActionInstruction5() {
919 List<Action> actionList = new ArrayList<Action>();
920 ActionBuilder ab = new ActionBuilder();
922 SetDlDstActionBuilder setdl = new SetDlDstActionBuilder();
923 setdl.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
924 ab.setAction(new SetDlDstActionCaseBuilder().setSetDlDstAction(setdl.build()).build());
925 actionList.add(ab.build());
926 // Create an Apply Action
927 ApplyActionsBuilder aab = new ApplyActionsBuilder();
928 aab.setAction(actionList);
930 // Wrap our Apply Action in an Instruction
931 InstructionBuilder ib = new InstructionBuilder();
932 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
934 // Put our Instruction in a list of Instructions
935 InstructionsBuilder isb = new InstructionsBuilder();
936 List<Instruction> instructions = new ArrayList<Instruction>();
937 instructions.add(ib.build());
938 isb.setInstruction(instructions);
942 private static InstructionsBuilder createAppyActionInstruction6() {
944 List<Action> actionList = new ArrayList<Action>();
945 ActionBuilder ab = new ActionBuilder();
947 SetDlSrcActionBuilder src = new SetDlSrcActionBuilder();
948 src.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
949 ab.setAction(new SetDlSrcActionCaseBuilder().setSetDlSrcAction(src.build()).build());
950 actionList.add(ab.build());
952 // Create an Apply Action
953 ApplyActionsBuilder aab = new ApplyActionsBuilder();
954 aab.setAction(actionList);
956 // Wrap our Apply Action in an Instruction
957 InstructionBuilder ib = new InstructionBuilder();
958 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
960 // Put our Instruction in a list of Instructions
961 InstructionsBuilder isb = new InstructionsBuilder();
962 List<Instruction> instructions = new ArrayList<Instruction>();
963 instructions.add(ib.build());
964 isb.setInstruction(instructions);
968 private static InstructionsBuilder createAppyActionInstruction7() {
970 List<Action> actionList = new ArrayList<Action>();
971 ActionBuilder ab = new ActionBuilder();
973 SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
974 VlanId a = new VlanId(4000);
976 ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
977 actionList.add(ab.build());
978 // Create an Apply Action
979 ApplyActionsBuilder aab = new ApplyActionsBuilder();
980 aab.setAction(actionList);
982 // Wrap our Apply Action in an Instruction
983 InstructionBuilder ib = new InstructionBuilder();
984 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
986 // Put our Instruction in a list of Instructions
987 InstructionsBuilder isb = new InstructionsBuilder();
988 List<Instruction> instructions = new ArrayList<Instruction>();
989 instructions.add(ib.build());
990 isb.setInstruction(instructions);
994 private static InstructionsBuilder createAppyActionInstruction8() {
996 List<Action> actionList = new ArrayList<Action>();
997 ActionBuilder ab = new ActionBuilder();
999 SetVlanPcpActionBuilder pcp = new SetVlanPcpActionBuilder();
1000 VlanPcp pcp1 = new VlanPcp((short) 2);
1001 pcp.setVlanPcp(pcp1);
1002 ab.setAction(new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(pcp.build()).build());
1003 actionList.add(ab.build());
1004 // Create an Apply Action
1005 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1006 aab.setAction(actionList);
1008 // Wrap our Apply Action in an Instruction
1009 InstructionBuilder ib = new InstructionBuilder();
1010 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1012 // Put our Instruction in a list of Instructions
1013 InstructionsBuilder isb = new InstructionsBuilder();
1014 List<Instruction> instructions = new ArrayList<Instruction>();
1015 instructions.add(ib.build());
1016 isb.setInstruction(instructions);
1020 private static InstructionsBuilder createAppyActionInstruction9() {
1022 List<Action> actionList = new ArrayList<Action>();
1023 ActionBuilder ab = new ActionBuilder();
1025 CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
1026 ab.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
1027 actionList.add(ab.build());
1028 // Create an Apply Action
1029 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1030 aab.setAction(actionList);
1032 // Wrap our Apply Action in an Instruction
1033 InstructionBuilder ib = new InstructionBuilder();
1034 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1036 // Put our Instruction in a list of Instructions
1037 InstructionsBuilder isb = new InstructionsBuilder();
1038 List<Instruction> instructions = new ArrayList<Instruction>();
1039 instructions.add(ib.build());
1040 isb.setInstruction(instructions);
1044 private static InstructionsBuilder createAppyActionInstruction10() {
1046 List<Action> actionList = new ArrayList<Action>();
1047 ActionBuilder ab = new ActionBuilder();
1049 CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
1050 ab.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
1051 actionList.add(ab.build());
1052 // Create an Apply Action
1053 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1054 aab.setAction(actionList);
1056 // Wrap our Apply Action in an Instruction
1057 InstructionBuilder ib = new InstructionBuilder();
1058 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1060 // Put our Instruction in a list of Instructions
1061 InstructionsBuilder isb = new InstructionsBuilder();
1062 List<Instruction> instructions = new ArrayList<Instruction>();
1063 instructions.add(ib.build());
1064 isb.setInstruction(instructions);
1068 private static InstructionsBuilder createAppyActionInstruction11() {
1070 List<Action> actionList = new ArrayList<Action>();
1071 ActionBuilder ab = new ActionBuilder();
1073 DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
1074 ab.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
1075 actionList.add(ab.build());
1076 // Create an Apply Action
1077 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1078 aab.setAction(actionList);
1080 // Wrap our Apply Action in an Instruction
1081 InstructionBuilder ib = new InstructionBuilder();
1082 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1084 // Put our Instruction in a list of Instructions
1085 InstructionsBuilder isb = new InstructionsBuilder();
1086 List<Instruction> instructions = new ArrayList<Instruction>();
1087 instructions.add(ib.build());
1088 isb.setInstruction(instructions);
1092 private static InstructionsBuilder createAppyActionInstruction12() {
1094 List<Action> actionList = new ArrayList<Action>();
1095 ActionBuilder ab = new ActionBuilder();
1097 DecNwTtlBuilder nwttl = new DecNwTtlBuilder();
1098 ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(nwttl.build()).build());
1099 actionList.add(ab.build());
1101 // Create an Apply Action
1102 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1103 aab.setAction(actionList);
1105 // Wrap our Apply Action in an Instruction
1106 InstructionBuilder ib = new InstructionBuilder();
1107 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1109 // Put our Instruction in a list of Instructions
1110 InstructionsBuilder isb = new InstructionsBuilder();
1111 List<Instruction> instructions = new ArrayList<Instruction>();
1112 instructions.add(ib.build());
1113 isb.setInstruction(instructions);
1117 private static InstructionsBuilder createAppyActionInstruction13() {
1119 List<Action> actionList = new ArrayList<Action>();
1120 ActionBuilder ab = new ActionBuilder();
1122 DropActionBuilder drop = new DropActionBuilder();
1123 ab.setAction(new DropActionCaseBuilder().setDropAction(drop.build()).build());
1124 actionList.add(ab.build());
1126 // Create an Apply Action
1127 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1128 aab.setAction(actionList);
1130 // Wrap our Apply Action in an Instruction
1131 InstructionBuilder ib = new InstructionBuilder();
1132 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1134 // Put our Instruction in a list of Instructions
1135 InstructionsBuilder isb = new InstructionsBuilder();
1136 List<Instruction> instructions = new ArrayList<Instruction>();
1137 instructions.add(ib.build());
1138 isb.setInstruction(instructions);
1142 private static InstructionsBuilder createAppyActionInstruction14() {
1144 List<Action> actionList = new ArrayList<Action>();
1145 ActionBuilder ab = new ActionBuilder();
1147 FloodActionBuilder fld = new FloodActionBuilder();
1148 ab.setAction(new FloodActionCaseBuilder().setFloodAction(fld.build()).build());
1149 actionList.add(ab.build());
1150 // Create an Apply Action
1151 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1152 aab.setAction(actionList);
1154 // Wrap our Apply Action in an Instruction
1155 InstructionBuilder ib = new InstructionBuilder();
1156 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1158 // Put our Instruction in a list of Instructions
1159 InstructionsBuilder isb = new InstructionsBuilder();
1160 List<Instruction> instructions = new ArrayList<Instruction>();
1161 instructions.add(ib.build());
1162 isb.setInstruction(instructions);
1166 private static InstructionsBuilder createAppyActionInstruction15() {
1168 List<Action> actionList = new ArrayList<Action>();
1169 ActionBuilder ab = new ActionBuilder();
1171 FloodAllActionBuilder fldall = new FloodAllActionBuilder();
1172 ab.setAction(new FloodAllActionCaseBuilder().setFloodAllAction(fldall.build()).build());
1173 actionList.add(ab.build());
1174 // Create an Apply Action
1175 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1176 aab.setAction(actionList);
1178 // Wrap our Apply Action in an Instruction
1179 InstructionBuilder ib = new InstructionBuilder();
1180 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1182 // Put our Instruction in a list of Instructions
1183 InstructionsBuilder isb = new InstructionsBuilder();
1184 List<Instruction> instructions = new ArrayList<Instruction>();
1185 instructions.add(ib.build());
1186 isb.setInstruction(instructions);
1190 private static InstructionsBuilder createAppyActionInstruction16() {
1192 List<Action> actionList = new ArrayList<Action>();
1193 ActionBuilder ab = new ActionBuilder();
1195 GroupActionBuilder groupActionB = new GroupActionBuilder();
1196 groupActionB.setGroupId(1L);
1197 groupActionB.setGroup("0");
1198 ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
1199 actionList.add(ab.build());
1201 // Create an Apply Action
1202 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1203 aab.setAction(actionList);
1205 // Wrap our Apply Action in an Instruction
1206 InstructionBuilder ib = new InstructionBuilder();
1207 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1209 // Put our Instruction in a list of Instructions
1210 InstructionsBuilder isb = new InstructionsBuilder();
1211 List<Instruction> instructions = new ArrayList<Instruction>();
1212 instructions.add(ib.build());
1213 isb.setInstruction(instructions);
1217 private static InstructionsBuilder createAppyActionInstruction17() {
1219 List<Action> actionList = new ArrayList<Action>();
1220 ActionBuilder ab = new ActionBuilder();
1222 HwPathActionBuilder hwPathB = new HwPathActionBuilder();
1223 ab.setAction(new HwPathActionCaseBuilder().setHwPathAction(hwPathB.build()).build());
1224 actionList.add(ab.build());
1225 // Create an Apply Action
1226 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1227 aab.setAction(actionList);
1229 // Wrap our Apply Action in an Instruction
1230 InstructionBuilder ib = new InstructionBuilder();
1231 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1233 // Put our Instruction in a list of Instructions
1234 InstructionsBuilder isb = new InstructionsBuilder();
1235 List<Instruction> instructions = new ArrayList<Instruction>();
1236 instructions.add(ib.build());
1237 isb.setInstruction(instructions);
1241 private static InstructionsBuilder createAppyActionInstruction18() {
1243 List<Action> actionList = new ArrayList<Action>();
1244 ActionBuilder ab = new ActionBuilder();
1246 LoopbackActionBuilder loopbackActionBuilder = new LoopbackActionBuilder();
1247 ab.setAction(new LoopbackActionCaseBuilder().setLoopbackAction(loopbackActionBuilder.build()).build());
1248 actionList.add(ab.build());
1250 // Create an Apply Action
1251 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1252 aab.setAction(actionList);
1254 // Wrap our Apply Action in an Instruction
1255 InstructionBuilder ib = new InstructionBuilder();
1256 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1258 // Put our Instruction in a list of Instructions
1259 InstructionsBuilder isb = new InstructionsBuilder();
1260 List<Instruction> instructions = new ArrayList<Instruction>();
1261 instructions.add(ib.build());
1262 isb.setInstruction(instructions);
1266 private static InstructionsBuilder createAppyActionInstruction19() {
1268 List<Action> actionList = new ArrayList<Action>();
1269 ActionBuilder ab = new ActionBuilder();
1271 PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
1272 popMplsActionBuilder.setEthernetType(0XB);
1273 ab.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
1274 actionList.add(ab.build());
1275 // Create an Apply Action
1276 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1277 aab.setAction(actionList);
1279 // Wrap our Apply Action in an Instruction
1280 InstructionBuilder ib = new InstructionBuilder();
1281 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1283 // Put our Instruction in a list of Instructions
1284 InstructionsBuilder isb = new InstructionsBuilder();
1285 List<Instruction> instructions = new ArrayList<Instruction>();
1286 instructions.add(ib.build());
1287 isb.setInstruction(instructions);
1291 private static InstructionsBuilder createAppyActionInstruction20() {
1293 List<Action> actionList = new ArrayList<Action>();
1294 ActionBuilder ab = new ActionBuilder();
1296 PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
1297 ab.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
1298 actionList.add(ab.build());
1299 // Create an Apply Action
1300 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1301 aab.setAction(actionList);
1303 // Wrap our Apply Action in an Instruction
1304 InstructionBuilder ib = new InstructionBuilder();
1305 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1307 // Put our Instruction in a list of Instructions
1308 InstructionsBuilder isb = new InstructionsBuilder();
1309 List<Instruction> instructions = new ArrayList<Instruction>();
1310 instructions.add(ib.build());
1311 isb.setInstruction(instructions);
1315 private static InstructionsBuilder createAppyActionInstruction21() {
1317 List<Action> actionList = new ArrayList<Action>();
1318 ActionBuilder ab = new ActionBuilder();
1320 PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder();
1321 ab.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(popVlanActionBuilder.build()).build());
1322 actionList.add(ab.build());
1324 // Create an Apply Action
1325 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1326 aab.setAction(actionList);
1328 // Wrap our Apply Action in an Instruction
1329 InstructionBuilder ib = new InstructionBuilder();
1330 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1332 // Put our Instruction in a list of Instructions
1333 InstructionsBuilder isb = new InstructionsBuilder();
1334 List<Instruction> instructions = new ArrayList<Instruction>();
1335 instructions.add(ib.build());
1336 isb.setInstruction(instructions);
1340 private static InstructionsBuilder createAppyActionInstruction22() {
1342 List<Action> actionList = new ArrayList<Action>();
1343 ActionBuilder ab = new ActionBuilder();
1345 SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
1346 setDlTypeActionBuilder.setDlType(new EtherType(8L));
1347 ab.setAction(new SetDlTypeActionCaseBuilder().setSetDlTypeAction(setDlTypeActionBuilder.build()).build());
1348 actionList.add(ab.build());
1350 // Create an Apply Action
1351 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1352 aab.setAction(actionList);
1354 // Wrap our Apply Action in an Instruction
1355 InstructionBuilder ib = new InstructionBuilder();
1356 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1358 // Put our Instruction in a list of Instructions
1359 InstructionsBuilder isb = new InstructionsBuilder();
1360 List<Instruction> instructions = new ArrayList<Instruction>();
1361 instructions.add(ib.build());
1362 isb.setInstruction(instructions);
1366 private static InstructionsBuilder createAppyActionInstruction23() {
1368 List<Action> actionList = new ArrayList<Action>();
1369 ActionBuilder ab = new ActionBuilder();
1371 SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
1372 setFieldBuilder.setInPort(new Long(2));
1373 actionList.add(ab.build());
1375 // Create an Apply Action
1376 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1377 aab.setAction(actionList);
1379 // Wrap our Apply Action in an Instruction
1380 InstructionBuilder ib = new InstructionBuilder();
1381 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1383 // Put our Instruction in a list of Instructions
1384 InstructionsBuilder isb = new InstructionsBuilder();
1385 List<Instruction> instructions = new ArrayList<Instruction>();
1386 instructions.add(ib.build());
1387 isb.setInstruction(instructions);
1391 private static InstructionsBuilder createAppyActionInstruction24() {
1393 List<Action> actionList = new ArrayList<Action>();
1394 ActionBuilder ab = new ActionBuilder();
1396 SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
1397 setMplsTtlActionBuilder.setMplsTtl((short) 0X1);
1398 ab.setAction(new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(setMplsTtlActionBuilder.build()).build());
1399 actionList.add(ab.build());
1401 // Create an Apply Action
1402 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1403 aab.setAction(actionList);
1405 // Wrap our Apply Action in an Instruction
1406 InstructionBuilder ib = new InstructionBuilder();
1407 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1409 // Put our Instruction in a list of Instructions
1410 InstructionsBuilder isb = new InstructionsBuilder();
1411 List<Instruction> instructions = new ArrayList<Instruction>();
1412 instructions.add(ib.build());
1413 isb.setInstruction(instructions);
1417 private static InstructionsBuilder createAppyActionInstruction25() {
1419 List<Action> actionList = new ArrayList<Action>();
1420 ActionBuilder ab = new ActionBuilder();
1422 SetNextHopActionBuilder setNextHopActionBuilder = new SetNextHopActionBuilder();
1423 Ipv4Builder ipnext = new Ipv4Builder();
1424 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
1425 ipnext.setIpv4Address(prefix);
1426 setNextHopActionBuilder.setAddress(ipnext.build());
1427 ab.setAction(new SetNextHopActionCaseBuilder().setSetNextHopAction(setNextHopActionBuilder.build()).build());
1428 actionList.add(ab.build());
1430 // Create an Apply Action
1431 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1432 aab.setAction(actionList);
1434 // Wrap our Apply Action in an Instruction
1435 InstructionBuilder ib = new InstructionBuilder();
1436 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1438 // Put our Instruction in a list of Instructions
1439 InstructionsBuilder isb = new InstructionsBuilder();
1440 List<Instruction> instructions = new ArrayList<Instruction>();
1441 instructions.add(ib.build());
1442 isb.setInstruction(instructions);
1446 private static InstructionsBuilder createAppyActionInstruction26() {
1448 List<Action> actionList = new ArrayList<Action>();
1449 ActionBuilder ab = new ActionBuilder();
1451 SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
1452 Ipv4Builder ipdst = new Ipv4Builder();
1453 Ipv4Prefix prefixdst = new Ipv4Prefix("10.0.0.21/24");
1454 ipdst.setIpv4Address(prefixdst);
1455 setNwDstActionBuilder.setAddress(ipdst.build());
1456 ab.setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build());
1457 actionList.add(ab.build());
1459 // Create an Apply Action
1460 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1461 aab.setAction(actionList);
1463 // Wrap our Apply Action in an Instruction
1464 InstructionBuilder ib = new InstructionBuilder();
1465 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1467 // Put our Instruction in a list of Instructions
1468 InstructionsBuilder isb = new InstructionsBuilder();
1469 List<Instruction> instructions = new ArrayList<Instruction>();
1470 instructions.add(ib.build());
1471 isb.setInstruction(instructions);
1475 private static InstructionsBuilder createAppyActionInstruction27() {
1477 List<Action> actionList = new ArrayList<Action>();
1478 ActionBuilder ab = new ActionBuilder();
1480 SetNwSrcActionBuilder setNwsrcActionBuilder = new SetNwSrcActionBuilder();
1481 Ipv4Builder ipsrc = new Ipv4Builder();
1482 Ipv4Prefix prefixsrc = new Ipv4Prefix("10.0.23.21/24");
1483 ipsrc.setIpv4Address(prefixsrc);
1484 setNwsrcActionBuilder.setAddress(ipsrc.build());
1485 ab.setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwsrcActionBuilder.build()).build());
1486 actionList.add(ab.build());
1488 // Create an Apply Action
1489 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1490 aab.setAction(actionList);
1492 // Wrap our Apply Action in an Instruction
1493 InstructionBuilder ib = new InstructionBuilder();
1494 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1496 // Put our Instruction in a list of Instructions
1497 InstructionsBuilder isb = new InstructionsBuilder();
1498 List<Instruction> instructions = new ArrayList<Instruction>();
1499 instructions.add(ib.build());
1500 isb.setInstruction(instructions);
1504 private static InstructionsBuilder createAppyActionInstruction28() {
1506 List<Action> actionList = new ArrayList<Action>();
1507 ActionBuilder ab = new ActionBuilder();
1509 SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
1510 setNwTosActionBuilder.setTos(8);
1511 ab.setAction(new SetNwTosActionCaseBuilder().setSetNwTosAction(setNwTosActionBuilder.build()).build());
1512 actionList.add(ab.build());
1513 // Create an Apply Action
1514 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1515 aab.setAction(actionList);
1517 // Wrap our Apply Action in an Instruction
1518 InstructionBuilder ib = new InstructionBuilder();
1519 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1521 // Put our Instruction in a list of Instructions
1522 InstructionsBuilder isb = new InstructionsBuilder();
1523 List<Instruction> instructions = new ArrayList<Instruction>();
1524 instructions.add(ib.build());
1525 isb.setInstruction(instructions);
1529 private static InstructionsBuilder createAppyActionInstruction29() {
1531 List<Action> actionList = new ArrayList<Action>();
1532 ActionBuilder ab = new ActionBuilder();
1534 SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
1535 setNwTtlActionBuilder.setNwTtl((short) 1);
1536 ab.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
1537 actionList.add(ab.build());
1539 // Create an Apply Action
1540 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1541 aab.setAction(actionList);
1543 // Wrap our Apply Action in an Instruction
1544 InstructionBuilder ib = new InstructionBuilder();
1545 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1547 // Put our Instruction in a list of Instructions
1548 InstructionsBuilder isb = new InstructionsBuilder();
1549 List<Instruction> instructions = new ArrayList<Instruction>();
1550 instructions.add(ib.build());
1551 isb.setInstruction(instructions);
1555 private static InstructionsBuilder createAppyActionInstruction30() {
1557 List<Action> actionList = new ArrayList<Action>();
1558 ActionBuilder ab = new ActionBuilder();
1560 SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
1561 setQueueActionBuilder.setQueueId(1L);
1562 ab.setAction(new SetQueueActionCaseBuilder().setSetQueueAction(setQueueActionBuilder.build()).build());
1563 actionList.add(ab.build());
1564 // Create an Apply Action
1565 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1566 aab.setAction(actionList);
1568 // Wrap our Apply Action in an Instruction
1569 InstructionBuilder ib = new InstructionBuilder();
1570 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1572 // Put our Instruction in a list of Instructions
1573 InstructionsBuilder isb = new InstructionsBuilder();
1574 List<Instruction> instructions = new ArrayList<Instruction>();
1575 instructions.add(ib.build());
1576 isb.setInstruction(instructions);
1580 private static InstructionsBuilder createAppyActionInstruction31() {
1582 List<Action> actionList = new ArrayList<Action>();
1583 ActionBuilder ab = new ActionBuilder();
1585 SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
1586 setTpDstActionBuilder.setPort(new PortNumber(109));
1588 ab.setAction(new SetTpDstActionCaseBuilder().setSetTpDstAction(setTpDstActionBuilder.build()).build());
1589 actionList.add(ab.build());
1590 // Create an Apply Action
1591 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1592 aab.setAction(actionList);
1594 // Wrap our Apply Action in an Instruction
1595 InstructionBuilder ib = new InstructionBuilder();
1596 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1598 // Put our Instruction in a list of Instructions
1599 InstructionsBuilder isb = new InstructionsBuilder();
1600 List<Instruction> instructions = new ArrayList<Instruction>();
1601 instructions.add(ib.build());
1602 isb.setInstruction(instructions);
1606 private static InstructionsBuilder createAppyActionInstruction32() {
1608 List<Action> actionList = new ArrayList<Action>();
1609 ActionBuilder ab = new ActionBuilder();
1611 SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
1612 setTpSrcActionBuilder.setPort(new PortNumber(109));
1613 ab.setAction(new SetTpSrcActionCaseBuilder().setSetTpSrcAction(setTpSrcActionBuilder.build()).build());
1614 actionList.add(ab.build());
1616 // Create an Apply Action
1617 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1618 aab.setAction(actionList);
1620 // Wrap our Apply Action in an Instruction
1621 InstructionBuilder ib = new InstructionBuilder();
1622 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1624 // Put our Instruction in a list of Instructions
1625 InstructionsBuilder isb = new InstructionsBuilder();
1626 List<Instruction> instructions = new ArrayList<Instruction>();
1627 instructions.add(ib.build());
1628 isb.setInstruction(instructions);
1632 private static InstructionsBuilder createAppyActionInstruction33() {
1634 List<Action> actionList = new ArrayList<Action>();
1635 ActionBuilder ab = new ActionBuilder();
1637 SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
1638 setVlanCfiActionBuilder.setVlanCfi(new VlanCfi(2));
1639 ab.setAction(new SetVlanCfiActionCaseBuilder().setSetVlanCfiAction(setVlanCfiActionBuilder.build()).build());
1640 actionList.add(ab.build());
1642 // Create an Apply Action
1643 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1644 aab.setAction(actionList);
1646 // Wrap our Apply Action in an Instruction
1647 InstructionBuilder ib = new InstructionBuilder();
1648 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1650 // Put our Instruction in a list of Instructions
1651 InstructionsBuilder isb = new InstructionsBuilder();
1652 List<Instruction> instructions = new ArrayList<Instruction>();
1653 instructions.add(ib.build());
1654 isb.setInstruction(instructions);
1658 private static InstructionsBuilder createAppyActionInstruction34() {
1660 List<Action> actionList = new ArrayList<Action>();
1661 ActionBuilder ab = new ActionBuilder();
1663 SwPathActionBuilder swPathAction = new SwPathActionBuilder();
1664 ab.setAction(new SwPathActionCaseBuilder().setSwPathAction(swPathAction.build()).build());
1665 actionList.add(ab.build());
1667 // Create an Apply Action
1668 ApplyActionsBuilder aab = new ApplyActionsBuilder();
1669 aab.setAction(actionList);
1671 // Wrap our Apply Action in an Instruction
1672 InstructionBuilder ib = new InstructionBuilder();
1673 ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
1675 // Put our Instruction in a list of Instructions
1676 InstructionsBuilder isb = new InstructionsBuilder();
1677 List<Instruction> instructions = new ArrayList<Instruction>();
1678 instructions.add(ib.build());
1679 isb.setInstruction(instructions);
1686 private static MatchBuilder createMatch1() {
1687 MatchBuilder match = new MatchBuilder();
1688 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
1689 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
1690 ipv4Match.setIpv4Destination(prefix);
1691 Ipv4Match i4m = ipv4Match.build();
1692 match.setLayer3Match(i4m);
1694 EthernetMatchBuilder eth = new EthernetMatchBuilder();
1695 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
1696 ethTypeBuilder.setType(new EtherType(0x0800L));
1697 eth.setEthernetType(ethTypeBuilder.build());
1698 match.setEthernetMatch(eth.build());
1705 private static MatchBuilder createIPv4DstMatch() {
1706 MatchBuilder match = new MatchBuilder();
1707 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
1708 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
1709 ipv4Match.setIpv4Destination(prefix);
1710 Ipv4Match i4m = ipv4Match.build();
1711 match.setLayer3Match(i4m);
1719 private static MatchBuilder createIPv4SrcMatch() {
1720 MatchBuilder match = new MatchBuilder();
1721 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
1722 Ipv4Prefix prefix = new Ipv4Prefix("10.20.30.40/24");
1723 ipv4Match.setIpv4Source(prefix);
1724 Ipv4Match i4m = ipv4Match.build();
1725 match.setLayer3Match(i4m);
1727 EthernetMatchBuilder eth = new EthernetMatchBuilder();
1728 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
1729 ethTypeBuilder.setType(new EtherType(0x0800L));
1730 eth.setEthernetType(ethTypeBuilder.build());
1731 match.setEthernetMatch(eth.build());
1740 private static MatchBuilder createMatch2() {
1741 MatchBuilder match = new MatchBuilder();
1742 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
1743 Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1");
1744 ipv4Match.setIpv4Source(prefix);
1745 Ipv4Match i4m = ipv4Match.build();
1746 match.setLayer3Match(i4m);
1748 EthernetMatchBuilder eth = new EthernetMatchBuilder();
1749 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
1750 ethTypeBuilder.setType(new EtherType(0x0800L));
1751 eth.setEthernetType(ethTypeBuilder.build());
1752 match.setEthernetMatch(eth.build());
1759 private static MatchBuilder createMatch3() {
1760 MatchBuilder match = new MatchBuilder();
1761 EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
1762 EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
1763 ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
1764 ethernetMatch.setEthernetSource(ethSourceBuilder.build());
1765 match.setEthernetMatch(ethernetMatch.build());
1770 private static MatchBuilder createInphyportMatch() {
1771 MatchBuilder match = new MatchBuilder();
1772 match.setInPort(202L);
1773 match.setInPhyPort(10122L);
1777 private static MatchBuilder createEthernetMatch() {
1778 MatchBuilder match = new MatchBuilder();
1780 byte[] mask1 = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
1781 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
1783 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype
1785 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
1786 EtherType type = new EtherType(0x0800L);
1787 ethmatch.setEthernetType(ethtype.setType(type).build());
1789 EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet
1792 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
1793 ethdest.setAddress(macdest);
1794 ethdest.setMask(mask1);
1796 ethmatch.setEthernetDestination(ethdest.build());
1798 EthernetSourceBuilder ethsrc = new EthernetSourceBuilder();
1799 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
1800 ethsrc.setAddress(macsrc);
1801 ethsrc.setMask(mask2);
1803 ethmatch.setEthernetSource(ethsrc.build());
1804 match.setEthernetMatch(ethmatch.build());
1813 private static MatchBuilder createVlanMatch() {
1814 MatchBuilder match = new MatchBuilder();
1815 VlanMatchBuilder vlanBuilder = new VlanMatchBuilder(); // vlan match
1816 VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
1817 VlanId vlanId = new VlanId(10);
1818 VlanPcp vpcp = new VlanPcp((short) 3);
1819 vlanBuilder.setVlanPcp(vpcp);
1820 vlanIdBuilder.setVlanId(vlanId);
1821 vlanIdBuilder.setVlanIdPresent(true);
1822 vlanBuilder.setVlanId(vlanIdBuilder.build());
1823 match.setVlanMatch(vlanBuilder.build());
1830 private static MatchBuilder createArpMatch() {
1831 MatchBuilder match = new MatchBuilder();
1833 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
1834 MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
1835 MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
1837 byte[] mask = new byte[] { (byte) -1, (byte) -1, 0, 0, 0, 0 };
1838 byte[] mask2 = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0 };
1840 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
1841 EtherType type = new EtherType(0x0806L);
1842 ethmatch.setEthernetType(ethtype.setType(type).build());
1844 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
1845 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
1847 ArpMatchBuilder arpmatch = new ArpMatchBuilder(); // arp match
1848 ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
1849 arpsrc.setAddress(macsrc);
1850 arpsrc.setMask(mask);
1851 ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
1852 arpdst.setAddress(macdest);
1853 arpdst.setMask(mask2);
1854 arpmatch.setArpOp(2);
1855 arpmatch.setArpSourceHardwareAddress(arpsrc.build());
1856 arpmatch.setArpTargetHardwareAddress(arpdst.build());
1857 arpmatch.setArpSourceTransportAddress(srcip);
1858 arpmatch.setArpTargetTransportAddress(dstip);
1860 match.setEthernetMatch(ethmatch.build());
1861 match.setLayer3Match(arpmatch.build());
1869 private static MatchBuilder createIPMatch() {
1870 MatchBuilder match = new MatchBuilder();
1871 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
1872 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
1873 EtherType type = new EtherType(0x0800L);
1874 ethmatch.setEthernetType(ethtype.setType(type).build());
1875 match.setEthernetMatch(ethmatch.build());
1877 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
1878 ipmatch.setIpProtocol((short) 1);
1879 Dscp dscp = new Dscp((short) 3);
1880 ipmatch.setIpDscp(dscp);
1881 ipmatch.setIpEcn((short) 2);
1882 match.setIpMatch(ipmatch.build());
1889 private static MatchBuilder createL3IPv4Match() {
1890 MatchBuilder match = new MatchBuilder();
1892 EthernetMatchBuilder eth = new EthernetMatchBuilder();
1893 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
1894 ethTypeBuilder.setType(new EtherType(0x0800L));
1895 eth.setEthernetType(ethTypeBuilder.build());
1896 match.setEthernetMatch(eth.build());
1898 Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
1899 Ipv4Prefix dstip = new Ipv4Prefix("200.71.9.52/10"); // ipv4 match
1900 Ipv4Prefix srcip = new Ipv4Prefix("100.1.1.1/8");
1901 Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
1902 ipv4match.setIpv4Destination(dstip);
1903 ipv4match.setIpv4Source(srcip);
1904 match.setLayer3Match(ipv4match.build());
1913 private static MatchBuilder createL3IPv6Match() {
1914 MatchBuilder match = new MatchBuilder();
1916 EthernetMatchBuilder eth = new EthernetMatchBuilder();
1917 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
1918 ethTypeBuilder.setType(new EtherType(0x86ddL));
1919 eth.setEthernetType(ethTypeBuilder.build());
1920 match.setEthernetMatch(eth.build());
1922 Ipv6Prefix dstip6 = new Ipv6Prefix("2002::2/64");
1923 Ipv6Prefix srcip6 = new Ipv6Prefix("2001:0:0:0:0:0:0:1/56");
1924 Ipv6Address ndtarget = new Ipv6Address("2001:db8:0:1:fd97:f9f0:a810:782e");
1925 MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
1926 MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
1927 Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
1928 nextheader.setIpv6Exthdr(58);
1929 Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
1930 Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
1931 ipv6label.setIpv6Flabel(label);
1932 ipv6label.setFlabelMask(new byte[] { 0, 1, -1, -1 });
1934 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
1936 icmpv6match.setIcmpv6Type((short) 135);
1937 icmpv6match.setIcmpv6Code((short) 0);
1938 match.setIcmpv6Match(icmpv6match.build());
1940 Ipv6MatchBuilder ipv6match = new Ipv6MatchBuilder();
1941 // ipv6match.setIpv6Source(srcip6);
1942 // ipv6match.setIpv6Destination(dstip6);
1943 // ipv6match.setIpv6ExtHeader(nextheader.build());
1944 ipv6match.setIpv6NdSll(ndsll);
1945 ipv6match.setIpv6NdTll(ndtll);
1946 // ipv6match.setIpv6NdTarget(ndtarget);
1947 ipv6match.setIpv6Label(ipv6label.build());
1949 match.setLayer3Match(ipv6match.build());
1958 private static MatchBuilder createICMPv4Match() {
1959 MatchBuilder match = new MatchBuilder();
1960 EthernetMatchBuilder eth = new EthernetMatchBuilder();
1961 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
1962 ethTypeBuilder.setType(new EtherType(0x0800L));
1963 eth.setEthernetType(ethTypeBuilder.build());
1964 match.setEthernetMatch(eth.build());
1966 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
1967 ipmatch.setIpProtocol((short) 1);
1968 match.setIpMatch(ipmatch.build());
1970 Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder(); // icmpv4
1972 icmpv4match.setIcmpv4Type((short) 8);
1973 icmpv4match.setIcmpv4Code((short) 0);
1974 match.setIcmpv4Match(icmpv4match.build());
1981 private static MatchBuilder createICMPv6Match() {
1983 MatchBuilder match = new MatchBuilder();
1984 EthernetMatchBuilder eth = new EthernetMatchBuilder();
1985 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
1986 ethTypeBuilder.setType(new EtherType(0x86ddL));
1987 eth.setEthernetType(ethTypeBuilder.build());
1988 match.setEthernetMatch(eth.build());
1990 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
1991 ipmatch.setIpProtocol((short) 58);
1992 match.setIpMatch(ipmatch.build());
1994 Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6
1996 icmpv6match.setIcmpv6Type((short) 135);
1997 icmpv6match.setIcmpv6Code((short) 1);
1998 match.setIcmpv6Match(icmpv6match.build());
2006 private static MatchBuilder createToSMatch() {
2007 MatchBuilder match = new MatchBuilder();
2008 EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
2009 EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
2010 EtherType type = new EtherType(0x0800L);
2011 ethmatch.setEthernetType(ethtype.setType(type).build());
2012 match.setEthernetMatch(ethmatch.build());
2014 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2015 ipmatch.setIpProtocol((short) 6);
2016 Dscp dscp = new Dscp((short) 8);
2017 ipmatch.setIpDscp(dscp);
2018 match.setIpMatch(ipmatch.build());
2027 private static MatchBuilder createL4TCPMatch() {
2028 MatchBuilder match = new MatchBuilder();
2030 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2031 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2032 ethTypeBuilder.setType(new EtherType(0x0800L));
2033 eth.setEthernetType(ethTypeBuilder.build());
2034 match.setEthernetMatch(eth.build());
2036 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2037 ipmatch.setIpProtocol((short) 6);
2038 match.setIpMatch(ipmatch.build());
2040 PortNumber srcport = new PortNumber(1213);
2041 PortNumber dstport = new PortNumber(646);
2042 TcpMatchBuilder tcpmatch = new TcpMatchBuilder(); // tcp match
2043 tcpmatch.setTcpSourcePort(srcport);
2044 tcpmatch.setTcpDestinationPort(dstport);
2045 match.setLayer4Match(tcpmatch.build());
2053 private static MatchBuilder createL4UDPMatch() {
2054 MatchBuilder match = new MatchBuilder();
2056 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2057 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2058 ethTypeBuilder.setType(new EtherType(0x0800L));
2059 eth.setEthernetType(ethTypeBuilder.build());
2060 match.setEthernetMatch(eth.build());
2062 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2063 ipmatch.setIpProtocol((short) 17);
2064 match.setIpMatch(ipmatch.build());
2066 PortNumber srcport = new PortNumber(1325);
2067 PortNumber dstport = new PortNumber(42);
2068 UdpMatchBuilder udpmatch = new UdpMatchBuilder(); // udp match
2069 udpmatch.setUdpDestinationPort(dstport);
2070 udpmatch.setUdpSourcePort(srcport);
2071 match.setLayer4Match(udpmatch.build());
2079 private static MatchBuilder createL4SCTPMatch() {
2080 MatchBuilder match = new MatchBuilder();
2082 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2083 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2084 ethTypeBuilder.setType(new EtherType(0x0800L));
2085 eth.setEthernetType(ethTypeBuilder.build());
2086 match.setEthernetMatch(eth.build());
2088 IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version
2089 ipmatch.setIpProtocol((short) 132);
2090 match.setIpMatch(ipmatch.build());
2092 SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
2093 PortNumber srcport = new PortNumber(1435);
2094 PortNumber dstport = new PortNumber(22);
2095 sctpmatch.setSctpSourcePort(srcport);
2096 sctpmatch.setSctpDestinationPort(dstport);
2097 match.setLayer4Match(sctpmatch.build());
2105 private static MatchBuilder createMetadataMatch() {
2106 MatchBuilder match = new MatchBuilder();
2107 byte[] metamask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
2108 MetadataBuilder metadata = new MetadataBuilder(); // metadata match
2109 metadata.setMetadata(BigInteger.valueOf(500L));
2110 metadata.setMetadataMask(metamask);
2111 match.setMetadata(metadata.build());
2119 private static MatchBuilder createMplsMatch() {
2120 MatchBuilder match = new MatchBuilder();
2122 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2123 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2124 ethTypeBuilder.setType(new EtherType(0x8847L));
2125 eth.setEthernetType(ethTypeBuilder.build());
2126 match.setEthernetMatch(eth.build());
2128 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
2130 protomatch.setMplsLabel((long) 36008);
2131 protomatch.setMplsTc((short) 4);
2132 protomatch.setMplsBos((short) 1);
2133 match.setProtocolMatchFields(protomatch.build());
2142 private static MatchBuilder createPbbMatch() {
2143 MatchBuilder match = new MatchBuilder();
2145 EthernetMatchBuilder eth = new EthernetMatchBuilder();
2146 EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
2147 ethTypeBuilder.setType(new EtherType(0x88E7L));
2148 eth.setEthernetType(ethTypeBuilder.build());
2149 match.setEthernetMatch(eth.build());
2151 ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); // mpls
2153 protomatch.setPbb(new PbbBuilder().setPbbIsid(4L).setPbbMask(new byte[] { 0, 1, 0, 0 }).build());
2154 match.setProtocolMatchFields(protomatch.build());
2163 private static MatchBuilder createTunnelIDMatch() {
2164 MatchBuilder match = new MatchBuilder();
2165 TunnelBuilder tunnel = new TunnelBuilder(); // tunnel id match
2166 tunnel.setTunnelId(BigInteger.valueOf(10668));
2167 byte[] mask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
2168 tunnel.setTunnelMask(mask);
2169 match.setTunnel(tunnel.build());
2174 public void _removeMDFlow(CommandInterpreter ci) {
2175 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
2176 NodeBuilder tn = createTestNode(ci.nextArgument());
2177 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
2178 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class)
2179 .child(Node.class, tn.getKey()).augmentation(FlowCapableNode.class)
2180 .child(Table.class, new TableKey(tf.getTableId())).child(Flow.class, tf.getKey())
2182 modification.removeOperationalData(nodeBuilderToInstanceId(tn));
2183 modification.removeOperationalData(path1);
2184 modification.removeConfigurationData(nodeBuilderToInstanceId(tn));
2185 modification.removeConfigurationData(path1);
2186 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
2188 RpcResult<TransactionStatus> result = commitFuture.get();
2189 TransactionStatus status = result.getResult();
2190 ci.println("Status of Flow Data Loaded Transaction: " + status);
2192 } catch (InterruptedException e) {
2193 LOG.error(e.getMessage(), e);
2194 } catch (ExecutionException e) {
2195 LOG.error(e.getMessage(), e);
2199 public void _addMDFlow(CommandInterpreter ci) {
2200 NodeBuilder tn = createTestNode(ci.nextArgument());
2201 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
2202 writeFlow(ci, tf, tn);
2205 private void writeFlow(CommandInterpreter ci, FlowBuilder flow, NodeBuilder nodeBuilder) {
2206 DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
2207 InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class)
2208 .child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class)
2209 .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.getKey())
2211 modification.putOperationalData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
2212 modification.putOperationalData(path1, flow.build());
2213 modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
2214 modification.putConfigurationData(path1, flow.build());
2215 Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
2217 RpcResult<TransactionStatus> result = commitFuture.get();
2218 TransactionStatus status = result.getResult();
2219 ci.println("Status of Flow Data Loaded Transaction: " + status);
2221 } catch (InterruptedException e) {
2222 LOG.error(e.getMessage(), e);
2223 } catch (ExecutionException e) {
2224 LOG.error(e.getMessage(), e);
2228 public void _modifyMDFlow(CommandInterpreter ci) {
2229 NodeBuilder tn = createTestNode(ci.nextArgument());
2230 FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
2231 tf.setFlowName(updatedFlowName);
2232 writeFlow(ci, tf, tn);
2233 tf.setFlowName(originalFlowName);
2234 writeFlow(ci, tf, tn);
2237 private static NodeRef createNodeRef(String string) {
2238 NodeKey key = new NodeKey(new NodeId(string));
2239 InstanceIdentifier<Node> path = InstanceIdentifier.builder().node(Nodes.class).node(Node.class, key)
2242 return new NodeRef(path);
2246 public String getHelp() {