2 * Copyright (c) 2014 Ericsson India Global Services Pvt Ltd. 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
8 * Contributor: hema.gopalkrishnan@ericsson.com
10 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
12 import org.opendaylight.openflowjava.protocol.api.util.BinContent;
13 import org.opendaylight.openflowplugin.openflow.md.OFConstants;
14 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionSetNwDstReactor;
15 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionSetNwSrcReactor;
16 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchConvertorImpl;
17 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchReactor;
18 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
19 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
20 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.*;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.in._case.CopyTtlInBuilder;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.out._case.CopyTtlOutBuilder;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.mpls.ttl._case.DecMplsTtlBuilder;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupAction;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputAction;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbActionBuilder;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanAction;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstAction;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcAction;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlAction;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlActionBuilder;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.tos.action._case.SetNwTosAction;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.queue.action._case.SetQueueAction;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.queue.action._case.SetQueueActionBuilder;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstAction;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcAction;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdAction;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.pcp.action._case.SetVlanPcpAction;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.OutputPortValues;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.*;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.*;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumberValues;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumberValuesV10;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
64 import org.opendaylight.yangtools.yang.binding.Augmentation;
65 import org.slf4j.Logger;
66 import org.slf4j.LoggerFactory;
68 import java.math.BigInteger;
69 import java.util.ArrayList;
70 import java.util.List;
73 * @author usha@ericsson Action List:This class takes data from SAL layer and
74 * converts into OF Data
75 * @author avishnoi@in.ibm.com Added convertor for OF bucket actions to SAL
79 public final class ActionConvertor {
80 private static final Logger logger = LoggerFactory.getLogger(ActionConvertor.class);
81 private static final String PREFIX_SEPARATOR = "/";
82 final private static Long MAXPortOF13 = new Long(4294967040L); // 0xffffff00
83 final private static Long MAXPortOF10 = new Long(0xff00);
85 private ActionConvertor() {
90 * Translates SAL actions into OF Library actions
91 * @param actions SAL actions
92 * @param version Openflow protocol version used
94 * @return OF Library actions
96 public static List<Action> getActions(
97 List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actions,
98 short version, BigInteger datapathid)
101 List<Action> actionsList = new ArrayList<>();
104 for (int actionItem = 0; actionItem < actions.size(); actionItem++) {
106 ActionBuilder actionBuilder = new ActionBuilder();
108 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action = actions.get(
109 actionItem).getAction();
111 if (action instanceof OutputActionCase)
112 ofAction = salToOFOutputAction(action, actionBuilder, version);
113 else if (action instanceof GroupActionCase)
114 ofAction = SalToOFGroupAction(action, actionBuilder);
115 else if (action instanceof CopyTtlOutCase)
116 ofAction = SalToOFCopyTTLIOut(actionBuilder);
117 else if (action instanceof CopyTtlInCase)
118 ofAction = SalToOFCopyTTLIIn(actionBuilder);
119 else if (action instanceof SetMplsTtlActionCase)
120 ofAction = SalToOFSetMplsTtl(action, actionBuilder);
121 else if (action instanceof DecMplsTtlCase)
122 ofAction = SalToOFDecMplsTtl(actionBuilder);
123 else if (action instanceof PushVlanActionCase)
124 ofAction = SalToOFPushVlanAction(action, actionBuilder);
125 else if (action instanceof PopVlanActionCase)
126 ofAction = (version == OFConstants.OFP_VERSION_1_0) ? SalToOFStripVlan(actionBuilder, version)
127 : SalToOFPopVlan(actionBuilder);
128 else if (action instanceof PushMplsActionCase)
129 ofAction = SalToOFPushMplsAction(action, actionBuilder);
130 else if (action instanceof PopMplsActionCase)
131 ofAction = SalToOFPopMpls(action, actionBuilder);
132 else if (action instanceof SetQueueActionCase)
133 ofAction = SalToOFSetQueue(action, actionBuilder);
134 else if (action instanceof SetNwTtlActionCase)
135 ofAction = SalToOFSetNwTtl(action, actionBuilder);
136 else if (action instanceof DecNwTtlCase)
137 ofAction = SalToOFDecNwTtl(actionBuilder);
138 else if (action instanceof SetFieldCase)
139 ofAction = SalToOFSetField(action, actionBuilder, version, datapathid);
140 else if (action instanceof PushPbbActionCase)
141 ofAction = SalToOFPushPbbAction(action, actionBuilder);
142 else if (action instanceof PopPbbActionCase)
143 ofAction = SalToOFPopPBB(actionBuilder);
144 else if (action instanceof ExperimenterAction)
145 ofAction = SalToOFExperimenter(action, actionBuilder);
148 else if (action instanceof SetVlanIdActionCase)
149 ofAction = SalToOFSetVlanId(action, actionBuilder, version);
150 else if (action instanceof SetVlanPcpActionCase)
151 ofAction = SalToOFSetVlanpcp(action, actionBuilder, version);
152 else if (action instanceof StripVlanActionCase)
153 ofAction = SalToOFStripVlan(actionBuilder, version);
154 else if (action instanceof SetDlSrcActionCase)
155 ofAction = SalToOFSetDlSrc(action, actionBuilder, version);
156 else if (action instanceof SetDlDstActionCase)
157 ofAction = SalToOFSetDlDst(action, actionBuilder, version);
158 else if (action instanceof SetNwSrcActionCase)
159 ofAction = SalToOFSetNwSrc(action, actionBuilder, version);
160 else if (action instanceof SetNwDstActionCase)
161 ofAction = SalToOFSetNwDst(action, actionBuilder, version);
162 else if (action instanceof SetTpSrcActionCase)
163 ofAction = SalToOFSetTpSrc(action, actionBuilder, version);
164 else if (action instanceof SetTpDstActionCase)
165 ofAction = SalToOFSetTpDst(action, actionBuilder, version);
166 else if (action instanceof SetNwTosActionCase)
167 ofAction = SalToOFSetNwTos(action, actionBuilder, version);
169 if (ofAction != null) {
170 actionsList.add(ofAction);
176 private static Action SalToOFSetField(
177 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
178 ActionBuilder actionBuilder, short version, BigInteger datapathid) {
180 SetFieldCase setFieldCase = (SetFieldCase) action;
181 org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match match = setFieldCase
184 OxmFieldsActionBuilder oxmFieldsActionBuilder = new OxmFieldsActionBuilder();
185 MatchReactor.getInstance().convert(match, version, oxmFieldsActionBuilder, datapathid);
188 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class);
190 actionBuilder.addAugmentation(OxmFieldsAction.class, oxmFieldsActionBuilder.build());
191 return actionBuilder.build();
194 private static Action SalToOFDecNwTtl(ActionBuilder actionBuilder) {
196 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl.class);
197 return emtpyAction(actionBuilder);
200 private static Action SalToOFPushMplsAction(
201 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
202 ActionBuilder actionBuilder) {
203 PushMplsActionCase pushMplsActionCase = (PushMplsActionCase) action;
204 actionBuilder.setType(PushMpls.class);
206 return SalToOFPushAction(pushMplsActionCase.getPushMplsAction().getEthernetType(), actionBuilder);
209 private static Action SalToOFPushPbbAction(
210 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
211 ActionBuilder actionBuilder) {
212 PushPbbActionCase pushPbbActionCase = (PushPbbActionCase) action;
213 actionBuilder.setType(PushPbb.class);
215 return SalToOFPushAction(pushPbbActionCase.getPushPbbAction().getEthernetType(), actionBuilder);
218 private static Action SalToOFPushVlanAction(
219 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
220 ActionBuilder actionBuilder) {
221 PushVlanActionCase pushVlanActionCase = (PushVlanActionCase) action;
222 PushVlanAction pushVlanAction = pushVlanActionCase.getPushVlanAction();
223 actionBuilder.setType(PushVlan.class);
225 return SalToOFPushAction(pushVlanAction.getEthernetType(), actionBuilder);
228 private static Action SalToOFSetNwTtl(
229 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
230 ActionBuilder actionBuilder) {
231 SetNwTtlActionCase nwTtlActionCase = (SetNwTtlActionCase) action;
232 NwTtlActionBuilder nwTtlActionBuilder = new NwTtlActionBuilder();
233 nwTtlActionBuilder.setNwTtl(nwTtlActionCase.getSetNwTtlAction().getNwTtl());
234 actionBuilder.setType(SetNwTtl.class);
235 actionBuilder.addAugmentation(NwTtlAction.class, nwTtlActionBuilder.build());
236 return actionBuilder.build();
239 private static Action SalToOFSetQueue(
240 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
241 ActionBuilder actionBuilder) {
242 SetQueueActionCase setQueueActionCase = (SetQueueActionCase) action;
243 SetQueueAction setQueueAction = setQueueActionCase.getSetQueueAction();
245 QueueIdActionBuilder queueIdActionBuilder = new QueueIdActionBuilder();
246 queueIdActionBuilder.setQueueId(setQueueAction.getQueueId());
247 actionBuilder.setType(SetQueue.class);
248 actionBuilder.addAugmentation(QueueIdAction.class, queueIdActionBuilder.build());
250 return actionBuilder.build();
253 private static Action SalToOFPopMpls(
254 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
255 ActionBuilder actionBuilder) {
256 PopMplsActionCase popMplsActionCase = (PopMplsActionCase) action;
257 actionBuilder.setType(PopMpls.class);
259 return SalToOFPushAction(popMplsActionCase.getPopMplsAction().getEthernetType(), actionBuilder);
262 private static Action SalToOFPopVlan(ActionBuilder actionBuilder) {
263 actionBuilder.setType(PopVlan.class);
264 return emtpyAction(actionBuilder);
267 private static Action SalToOFPopPBB(ActionBuilder actionBuilder) {
268 actionBuilder.setType(PopPbb.class);
269 return emtpyAction(actionBuilder);
272 private static Action SalToOFExperimenter(
273 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
274 ActionBuilder actionBuilder) {
275 ExperimenterActionBuilder experimenterActionBuilder = new ExperimenterActionBuilder();
276 experimenterActionBuilder.setExperimenter(((ExperimenterAction) action).getExperimenter());
277 actionBuilder.setType(Experimenter.class);
280 ExperimenterAction.class,
281 (Augmentation<Action>) experimenterActionBuilder);
282 return actionBuilder.build();
285 private static Action SalToOFSetVlanId(
286 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
287 ActionBuilder actionBuilder, short version) {
289 SetVlanIdActionCase setvlanidcase = (SetVlanIdActionCase) action;
290 SetVlanIdAction setvlanidaction = setvlanidcase.getSetVlanIdAction();
292 if (version == OFConstants.OFP_VERSION_1_0) {
294 VlanVidActionBuilder vlanidActionBuilder = new VlanVidActionBuilder();
295 vlanidActionBuilder.setVlanVid(setvlanidaction.getVlanId().getValue());
297 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid.class);
298 actionBuilder.addAugmentation(VlanVidAction.class, vlanidActionBuilder.build());
299 return actionBuilder.build();
300 } else if (version >= OFConstants.OFP_VERSION_1_3) {
301 OxmFieldsActionBuilder oxmFieldsActionBuilder = new OxmFieldsActionBuilder();
303 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class);
304 List<MatchEntries> matchEntriesList = new ArrayList<>();
305 MatchEntriesBuilder matchEntriesBuilder = new MatchEntriesBuilder();
306 matchEntriesBuilder.setOxmClass(OpenflowBasicClass.class);
307 matchEntriesBuilder.setOxmMatchField(VlanVid.class);
308 VlanVidMatchEntryBuilder vlanVidBuilder = new VlanVidMatchEntryBuilder();
309 vlanVidBuilder.setCfiBit(true);
310 vlanVidBuilder.setVlanVid(setvlanidaction.getVlanId().getValue());
311 matchEntriesBuilder.addAugmentation(VlanVidMatchEntry.class, vlanVidBuilder.build());
312 matchEntriesBuilder.setHasMask(false);
313 matchEntriesList.add(matchEntriesBuilder.build());
314 oxmFieldsActionBuilder.setMatchEntries(matchEntriesList);
315 actionBuilder.addAugmentation(OxmFieldsAction.class, oxmFieldsActionBuilder.build());
316 return actionBuilder.build();
318 logger.error("Unknown Action Type for the Version", version);
323 private static Action SalToOFSetVlanpcp(
324 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
325 ActionBuilder actionBuilder, short version) {
327 SetVlanPcpActionCase setvlanpcpcase = (SetVlanPcpActionCase) action;
328 SetVlanPcpAction setvlanpcpaction = setvlanpcpcase.getSetVlanPcpAction();
330 if (version == OFConstants.OFP_VERSION_1_0) {
331 VlanPcpActionBuilder vlanpcpActionBuilder = new VlanPcpActionBuilder();
332 vlanpcpActionBuilder.setVlanPcp(setvlanpcpaction.getVlanPcp().getValue());
334 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanPcp.class);
335 actionBuilder.addAugmentation(VlanPcpAction.class, vlanpcpActionBuilder.build());
336 return actionBuilder.build();
337 } else if (version >= OFConstants.OFP_VERSION_1_3) {
338 OxmFieldsActionBuilder oxmFieldsActionBuilder = new OxmFieldsActionBuilder();
340 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class);
341 List<MatchEntries> matchEntriesList = new ArrayList<>();
342 matchEntriesList.add(MatchConvertorImpl.toOfVlanPcp(setvlanpcpaction.getVlanPcp()));
343 oxmFieldsActionBuilder.setMatchEntries(matchEntriesList);
344 actionBuilder.addAugmentation(OxmFieldsAction.class, oxmFieldsActionBuilder.build());
345 return actionBuilder.build();
347 logger.error("Unknown Action Type for the Version", version);
352 private static Action SalToOFStripVlan(ActionBuilder actionBuilder, short version) {
353 if (version == OFConstants.OFP_VERSION_1_0) {
355 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.StripVlan.class);
357 return emtpyAction(actionBuilder);
358 } else if (version >= OFConstants.OFP_VERSION_1_3) {
359 OxmFieldsActionBuilder oxmFieldsActionBuilder = new OxmFieldsActionBuilder();
361 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class);
362 List<MatchEntries> matchEntriesList = new ArrayList<>();
363 MatchEntriesBuilder matchEntriesBuilder = new MatchEntriesBuilder();
364 matchEntriesBuilder.setOxmClass(OpenflowBasicClass.class);
365 matchEntriesBuilder.setOxmMatchField(VlanVid.class);
366 VlanVidMatchEntryBuilder vlanVidBuilder = new VlanVidMatchEntryBuilder();
367 vlanVidBuilder.setCfiBit(true);
368 vlanVidBuilder.setVlanVid(new Integer(0x0000));
369 matchEntriesBuilder.addAugmentation(VlanVidMatchEntry.class, vlanVidBuilder.build());
370 matchEntriesBuilder.setHasMask(false);
371 matchEntriesList.add(matchEntriesBuilder.build());
372 oxmFieldsActionBuilder.setMatchEntries(matchEntriesList);
373 actionBuilder.addAugmentation(OxmFieldsAction.class, oxmFieldsActionBuilder.build());
374 return actionBuilder.build();
376 logger.error("Unknown Action Type for the Version", version);
381 private static Action SalToOFSetDlSrc(
382 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
383 ActionBuilder actionBuilder, short version) {
385 SetDlSrcActionCase setdlsrccase = (SetDlSrcActionCase) action;
386 SetDlSrcAction setdlsrcaction = setdlsrccase.getSetDlSrcAction();
388 if (version == OFConstants.OFP_VERSION_1_0) {
389 DlAddressActionBuilder dladdressactionbuilder = new DlAddressActionBuilder();
390 dladdressactionbuilder.setDlAddress(setdlsrcaction.getAddress());
392 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc.class);
393 actionBuilder.addAugmentation(DlAddressAction.class, dladdressactionbuilder.build());
394 return actionBuilder.build();
395 } else if (version >= OFConstants.OFP_VERSION_1_3) {
396 OxmFieldsActionBuilder oxmFieldsActionBuilder = new OxmFieldsActionBuilder();
398 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class);
399 List<MatchEntries> matchEntriesList = new ArrayList<>();
400 matchEntriesList.add(MatchConvertorImpl.toOfMacAddress(EthSrc.class, setdlsrcaction.getAddress(), null));
401 oxmFieldsActionBuilder.setMatchEntries(matchEntriesList);
402 actionBuilder.addAugmentation(OxmFieldsAction.class, oxmFieldsActionBuilder.build());
403 return actionBuilder.build();
405 logger.error("Unknown Action Type for the Version", version);
411 private static Action SalToOFSetDlDst(
412 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
413 ActionBuilder actionBuilder, short version) {
415 SetDlDstActionCase setdldstcase = (SetDlDstActionCase) action;
416 SetDlDstAction setdldstaction = setdldstcase.getSetDlDstAction();
418 if (version == OFConstants.OFP_VERSION_1_0) {
419 DlAddressActionBuilder dladdressactionbuilder = new DlAddressActionBuilder();
420 dladdressactionbuilder.setDlAddress(setdldstaction.getAddress());
422 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst.class);
423 actionBuilder.addAugmentation(DlAddressAction.class, dladdressactionbuilder.build());
424 return actionBuilder.build();
425 } else if (version >= OFConstants.OFP_VERSION_1_3) {
426 OxmFieldsActionBuilder oxmFieldsActionBuilder = new OxmFieldsActionBuilder();
428 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class);
429 List<MatchEntries> matchEntriesList = new ArrayList<>();
430 matchEntriesList.add(MatchConvertorImpl.toOfMacAddress(EthDst.class, setdldstaction.getAddress(), null));
431 oxmFieldsActionBuilder.setMatchEntries(matchEntriesList);
432 actionBuilder.addAugmentation(OxmFieldsAction.class, oxmFieldsActionBuilder.build());
433 return actionBuilder.build();
435 logger.error("Unknown Action Type for the Version", version);
441 protected static Action SalToOFSetNwSrc(
442 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
443 ActionBuilder actionBuilder, short version) {
446 ActionSetNwSrcReactor.getInstance().convert((SetNwSrcActionCase) action, version, actionBuilder, null);
447 } catch (Exception e) {
448 logger.error(e.getMessage(), e);
452 return actionBuilder.build();
455 protected static Action SalToOFSetNwDst(
456 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
457 ActionBuilder actionBuilder, short version) {
460 ActionSetNwDstReactor.getInstance().convert((SetNwDstActionCase) action, version, actionBuilder, null);
461 } catch (Exception e) {
462 logger.error(e.getMessage(), e);
466 return actionBuilder.build();
469 private static Action SalToOFSetNwTos(
470 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
471 ActionBuilder actionBuilder, short version) {
473 SetNwTosActionCase setnwtoscase = (SetNwTosActionCase) action;
474 SetNwTosAction setnwtosaction = setnwtoscase.getSetNwTosAction();
476 if (version == OFConstants.OFP_VERSION_1_0) {
477 NwTosActionBuilder tosBuilder = new NwTosActionBuilder();
478 tosBuilder.setNwTos(setnwtosaction.getTos().shortValue());
479 actionBuilder.addAugmentation(NwTosAction.class, tosBuilder.build());
481 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTos.class);
483 return actionBuilder.build();
484 } else if (version >= OFConstants.OFP_VERSION_1_3) {
485 OxmFieldsActionBuilder oxmFieldsActionBuilder = new OxmFieldsActionBuilder();
487 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class);
488 List<MatchEntries> matchEntriesList = new ArrayList<>();
489 matchEntriesList.add(MatchConvertorImpl.toOfIpDscp(new Dscp(setnwtosaction.getTos().shortValue())));
490 oxmFieldsActionBuilder.setMatchEntries(matchEntriesList);
491 actionBuilder.addAugmentation(OxmFieldsAction.class, oxmFieldsActionBuilder.build());
492 return actionBuilder.build();
494 logger.error("Unknown Action Type for the Version", version);
500 private static Action SalToOFSetTpSrc(
501 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
502 ActionBuilder actionBuilder, short version) {
504 if (version == OFConstants.OFP_VERSION_1_0) {
505 SetTpSrcActionCase settpsrccase = (SetTpSrcActionCase) action;
506 SetTpSrcAction settpsrcaction = settpsrccase.getSetTpSrcAction();
508 PortActionBuilder settpsrc = new PortActionBuilder();
509 PortNumber port = new PortNumber(settpsrcaction.getPort().getValue().longValue());
510 settpsrc.setPort(port);
513 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpSrc.class);
514 actionBuilder.addAugmentation(PortAction.class, settpsrc.build());
515 return actionBuilder.build();
517 logger.error("Unknown Action Type for the Version", version);
521 private static Action SalToOFSetTpDst(
522 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
523 ActionBuilder actionBuilder, short version) {
525 if (version == OFConstants.OFP_VERSION_1_0) {
526 SetTpDstActionCase settpdstcase = (SetTpDstActionCase) action;
527 SetTpDstAction settpdstaction = settpdstcase.getSetTpDstAction();
528 PortActionBuilder settpdst = new PortActionBuilder();
529 PortNumber port = new PortNumber(settpdstaction.getPort().getValue().longValue());
530 settpdst.setPort(port);
533 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpDst.class);
534 actionBuilder.addAugmentation(PortAction.class, settpdst.build());
535 return actionBuilder.build();
537 logger.error("Unknown Action Type for the Version", version);
541 private static Action SalToOFGroupAction(
542 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
543 ActionBuilder actionBuilder) {
545 GroupActionCase groupActionCase = (GroupActionCase) action;
546 GroupAction groupAction = groupActionCase.getGroupAction();
548 GroupIdActionBuilder groupIdBuilder = new GroupIdActionBuilder();
549 groupIdBuilder.setGroupId(groupAction.getGroupId());
550 actionBuilder.setType(Group.class);
551 actionBuilder.addAugmentation(GroupIdAction.class, groupIdBuilder.build());
552 return actionBuilder.build();
555 private static Action SalToOFPushAction(Integer ethernetType, ActionBuilder actionBuilder) {
556 EthertypeActionBuilder ethertypeActionBuilder = new EthertypeActionBuilder();
557 ethertypeActionBuilder.setEthertype(new EtherType(ethernetType));
560 actionBuilder.addAugmentation(EthertypeAction.class, ethertypeActionBuilder.build());
561 return actionBuilder.build();
564 private static Action SalToOFDecMplsTtl(ActionBuilder actionBuilder) {
566 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl.class);
567 return emtpyAction(actionBuilder);
570 private static Action SalToOFSetMplsTtl(
571 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
572 ActionBuilder actionBuilder) {
573 SetMplsTtlActionCase mplsTtlActionCase = (SetMplsTtlActionCase) action;
574 SetMplsTtlAction mplsTtlAction = mplsTtlActionCase.getSetMplsTtlAction();
576 MplsTtlActionBuilder mplsTtlActionBuilder = new MplsTtlActionBuilder();
577 mplsTtlActionBuilder.setMplsTtl(mplsTtlAction.getMplsTtl()/* SAL */);
579 actionBuilder.setType(SetMplsTtl.class);
580 actionBuilder.addAugmentation(MplsTtlAction.class, mplsTtlActionBuilder.build());
581 return actionBuilder.build();
584 private static Action SalToOFCopyTTLIIn(ActionBuilder actionBuilder) {
586 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn.class);
587 return emtpyAction(actionBuilder);
590 private static Action SalToOFCopyTTLIOut(ActionBuilder actionBuilder) {
592 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut.class);
593 return emtpyAction(actionBuilder);
597 private static Action emtpyAction(ActionBuilder actionBuilder) {
598 return actionBuilder.build();
601 private static Action salToOFOutputAction(
602 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
603 ActionBuilder actionBuilder, short version) {
605 OutputActionCase outputActionCase = ((OutputActionCase) action);
606 OutputAction outputAction = outputActionCase.getOutputAction();
607 PortActionBuilder portAction = new PortActionBuilder();
608 MaxLengthActionBuilder maxLenActionBuilder = new MaxLengthActionBuilder();
609 if (outputAction.getMaxLength() != null) {
610 maxLenActionBuilder.setMaxLength(outputAction.getMaxLength());
612 maxLenActionBuilder.setMaxLength(new Integer(0));
614 actionBuilder.addAugmentation(MaxLengthAction.class, maxLenActionBuilder.build());
616 Uri uri = outputAction.getOutputNodeConnector();
618 if (version >= OFConstants.OFP_VERSION_1_3) {
620 if (uri.getValue().equals(OutputPortValues.CONTROLLER.toString())) {
621 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.CONTROLLER
623 } else if (uri.getValue().equals(OutputPortValues.ALL.toString())) {
624 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.ALL.getIntValue())));
625 } else if (uri.getValue().equals(OutputPortValues.ANY.toString())) {
626 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.ANY.getIntValue())));
628 } else if (uri.getValue().equals(OutputPortValues.FLOOD.toString())) {
629 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.FLOOD.getIntValue())));
631 } else if (uri.getValue().equals(OutputPortValues.INPORT.toString())) {
632 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.INPORT.getIntValue())));
634 } else if (uri.getValue().equals(OutputPortValues.LOCAL.toString())) {
635 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.LOCAL.getIntValue())));
637 } else if (uri.getValue().equals(OutputPortValues.NORMAL.toString())) {
638 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.NORMAL.getIntValue())));
640 } else if (uri.getValue().equals(OutputPortValues.TABLE.toString())) {
641 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.TABLE.getIntValue())));
643 } else if (uri.getValue().equals(OutputPortValues.NONE.toString())) {
644 logger.error("Unknown Port Type for the Version");
645 } else if (InventoryDataServiceUtil.portNumberfromNodeConnectorId(outputAction.getOutputNodeConnector()
646 .getValue()) < MAXPortOF13) {
647 portAction.setPort(new PortNumber(InventoryDataServiceUtil.portNumberfromNodeConnectorId(outputAction
648 .getOutputNodeConnector().getValue())));
650 logger.error("Invalid Port for Output Action");
652 } else if (version == OFConstants.OFP_VERSION_1_0) {
654 if (uri.getValue().equals(OutputPortValues.CONTROLLER.toString())) {
655 portAction.setPort(new PortNumber((long) PortNumberValuesV10.CONTROLLER.getIntValue()));
656 } else if (uri.getValue().equals(OutputPortValues.ALL.toString())) {
657 portAction.setPort(new PortNumber((long) PortNumberValuesV10.ALL.getIntValue()));
658 } else if (uri.getValue().equals(OutputPortValues.FLOOD.toString())) {
659 portAction.setPort(new PortNumber((long) PortNumberValuesV10.FLOOD.getIntValue()));
660 } else if (uri.getValue().equals(OutputPortValues.INPORT.toString())) {
661 portAction.setPort(new PortNumber((long) PortNumberValuesV10.INPORT.getIntValue()));
662 } else if (uri.getValue().equals(OutputPortValues.LOCAL.toString())) {
663 portAction.setPort(new PortNumber((long) PortNumberValuesV10.LOCAL.getIntValue()));
664 } else if (uri.getValue().equals(OutputPortValues.NORMAL.toString())) {
665 portAction.setPort(new PortNumber((long) PortNumberValuesV10.NORMAL.getIntValue()));
666 } else if (uri.getValue().equals(OutputPortValues.TABLE.toString())) {
667 portAction.setPort(new PortNumber((long) PortNumberValuesV10.TABLE.getIntValue()));
668 } else if (uri.getValue().equals(OutputPortValues.NONE.toString())) {
669 portAction.setPort(new PortNumber((long) PortNumberValuesV10.NONE.getIntValue()));
670 } else if (uri.getValue().equals(OutputPortValues.ANY.toString())) {
671 logger.error("Unknown Port Type for the Version");
672 } else if (InventoryDataServiceUtil.portNumberfromNodeConnectorId(outputAction.getOutputNodeConnector()
673 .getValue()) < MAXPortOF10) {
674 portAction.setPort(new PortNumber(InventoryDataServiceUtil.portNumberfromNodeConnectorId(outputAction
675 .getOutputNodeConnector().getValue())));
677 logger.error("Invalid Port for Output Action");
682 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output.class);
683 actionBuilder.addAugmentation(PortAction.class, portAction.build());
684 return actionBuilder.build();
689 * Method to convert OF actions associated with bucket to SAL Actions.
692 * @return List of converted SAL Actions.
694 public static List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> toMDSalActions(
695 List<Action> actionList) {
697 List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> bucketActions = new ArrayList<>();
698 for (Action action : actionList) {
699 if (action.getType().equals(
700 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output.class)) {
701 bucketActions.add(ofToSALOutputAction(action));
703 } else if (action.getType().equals(
704 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group.class)) {
705 bucketActions.add(ofToSALGroupAction(action));
707 } else if (action.getType().equals(
708 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut.class)) {
709 CopyTtlOutBuilder copyTtlOutaction = new CopyTtlOutBuilder();
710 bucketActions.add(new CopyTtlOutCaseBuilder().setCopyTtlOut(copyTtlOutaction.build()).build());
712 } else if (action.getType().equals(
713 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn.class)) {
714 CopyTtlInBuilder copyTtlInaction = new CopyTtlInBuilder();
715 bucketActions.add(new CopyTtlInCaseBuilder().setCopyTtlIn(copyTtlInaction.build()).build());
717 } else if (action.getType().equals(
718 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl.class)) {
719 bucketActions.add(ofToSALSetMplsTtl(action));
721 } else if (action.getType().equals(
722 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl.class)) {
723 DecMplsTtlBuilder decMplsTtl = new DecMplsTtlBuilder();
724 bucketActions.add(new DecMplsTtlCaseBuilder().setDecMplsTtl(decMplsTtl.build()).build());
726 } else if (action.getType().equals(
727 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan.class)) {
728 bucketActions.add(ofToSALPushVlanAction(action));
730 } else if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan.class)
731 || action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.StripVlan.class)) {
732 // OF1.0 nodes will emit StripVlan and OF1.3+ will emit StripVlan/PopVlan, convert both to PopVlan for SAL
733 PopVlanActionBuilder popVlan = new PopVlanActionBuilder();
734 bucketActions.add(new PopVlanActionCaseBuilder().setPopVlanAction(popVlan.build()).build());
736 } else if (action.getType().equals(
737 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls.class)) {
738 bucketActions.add(ofToSALPushMplsAction(action));
740 } else if (action.getType().equals(
741 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls.class)) {
742 bucketActions.add(ofToSALPopMplsAction(action));
744 } else if (action.getType().equals(
745 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue.class)) {
746 bucketActions.add(ofToSALSetQueue(action));
748 } else if (action.getType().equals(
749 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl.class)) {
750 bucketActions.add(ofToSALSetNwTtl(action));
752 } else if (action.getType().equals(
753 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl.class)) {
754 DecNwTtlBuilder decNwTtl = new DecNwTtlBuilder();
755 bucketActions.add(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl.build()).build());
757 } else if (action.getType().equals(
758 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class)) {
759 bucketActions.add(new SetFieldCaseBuilder().setSetField(MatchConvertorImpl.fromOFSetFieldToSALSetFieldAction(action))
761 } else if (action.getType().equals(
762 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb.class)) {
763 bucketActions.add(ofToSALPushPbbAction(action));
765 } else if (action.getType().equals(
766 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb.class)) {
767 PopPbbActionBuilder popPbb = new PopPbbActionBuilder();
768 bucketActions.add(new PopPbbActionCaseBuilder().setPopPbbAction(popPbb.build()).build());
770 } else if (action.getType().equals(
771 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter.class)) {
772 // bucketActions.add(ofToSALExperimenter(action));
773 // TODO: Need to explore/discuss on how to handle experimenter
778 return bucketActions;
782 * Method converts OF Output action object to SAL Output action object.
785 * org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.
786 * action.rev130731.actions.actions.list.Action
787 * @return OutputAction
789 public static OutputActionCase ofToSALOutputAction(Action action) {
791 OutputActionBuilder outputAction = new OutputActionBuilder();
792 PortAction port = action.getAugmentation(PortAction.class);
794 outputAction.setOutputNodeConnector(new Uri(port.getPort().getValue().toString()));
796 logger.error("Provided action is not OF Output action, no associated port found!");
799 MaxLengthAction length = action.getAugmentation(MaxLengthAction.class);
800 if (length != null) {
801 outputAction.setMaxLength(length.getMaxLength());
803 logger.error("Provided action is not OF Output action, no associated length found!");
806 return new OutputActionCaseBuilder().setOutputAction(outputAction.build()).build();
810 * Method converts OF GroupAction object to SAL GroupAction object
813 * @return GroupAction
815 public static GroupActionCase ofToSALGroupAction(Action action) {
817 GroupActionBuilder groupAction = new GroupActionBuilder();
819 GroupIdAction groupId = action.getAugmentation(GroupIdAction.class);
820 groupAction.setGroupId(groupId.getGroupId());
822 return new GroupActionCaseBuilder().setGroupAction(groupAction.build()).build();
826 * Method converts OF SetMplsTTL action object to SAL SetMplsTTL action
832 public static SetMplsTtlActionCase ofToSALSetMplsTtl(Action action) {
834 SetMplsTtlActionBuilder mplsTtlAction = new SetMplsTtlActionBuilder();
835 MplsTtlAction mplsTtl = action.getAugmentation(MplsTtlAction.class);
836 mplsTtlAction.setMplsTtl(mplsTtl.getMplsTtl());
837 return new SetMplsTtlActionCaseBuilder().setSetMplsTtlAction(mplsTtlAction.build()).build();
841 * Method converts OF Pushvlan action to SAL PushVlan action.
844 * @return PushVlanAction
846 public static PushVlanActionCase ofToSALPushVlanAction(Action action) {
848 PushVlanActionBuilder pushVlanAction = new PushVlanActionBuilder();
850 EthertypeAction etherType = action.getAugmentation(EthertypeAction.class);
851 pushVlanAction.setEthernetType(etherType.getEthertype().getValue());
853 return new PushVlanActionCaseBuilder().setPushVlanAction(pushVlanAction.build()).build();
857 * Method converts OF PushMpls action to SAL PushMpls action.
860 * @return PushMplsAction
862 public static PushMplsActionCase ofToSALPushMplsAction(Action action) {
864 PushMplsActionBuilder pushMplsAction = new PushMplsActionBuilder();
866 EthertypeAction etherType = action.getAugmentation(EthertypeAction.class);
867 pushMplsAction.setEthernetType(etherType.getEthertype().getValue());
869 return new PushMplsActionCaseBuilder().setPushMplsAction(pushMplsAction.build()).build();
873 * Method converts OF PopMpls action to SAL PopMpls action.
876 * @return PopMplsActionCase
878 public static PopMplsActionCase ofToSALPopMplsAction(Action action) {
880 PopMplsActionBuilder popMplsAction = new PopMplsActionBuilder();
882 EthertypeAction etherType = action.getAugmentation(EthertypeAction.class);
883 popMplsAction.setEthernetType(etherType.getEthertype().getValue());
885 return new PopMplsActionCaseBuilder().setPopMplsAction(popMplsAction.build()).build();
889 * Method converts OF SetQueue action to SAL SetQueue action.
892 * @return SetQueueAction
894 public static SetQueueActionCase ofToSALSetQueue(Action action) {
896 SetQueueActionBuilder setQueueAction = new SetQueueActionBuilder();
898 QueueIdAction queueId = action.getAugmentation(QueueIdAction.class);
899 setQueueAction.setQueueId(queueId.getQueueId());
901 return new SetQueueActionCaseBuilder().setSetQueueAction(setQueueAction.build()).build();
905 * Method converts OF SetNwTtl action to SAL SetNwTtl action.
908 * @return SetNwTtlAction
910 public static SetNwTtlActionCase ofToSALSetNwTtl(Action action) {
912 SetNwTtlActionBuilder setNwTtl = new SetNwTtlActionBuilder();
913 NwTtlAction nwTtl = action.getAugmentation(NwTtlAction.class);
914 setNwTtl.setNwTtl(nwTtl.getNwTtl());
916 return new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtl.build()).build();
920 * Method converts OF Pushvlan action to SAL PushVlan action.
923 * @return PushVlanAction
925 public static PushPbbActionCase ofToSALPushPbbAction(Action action) {
927 PushPbbActionBuilder pushPbbAction = new PushPbbActionBuilder();
929 EthertypeAction etherType = action.getAugmentation(EthertypeAction.class);
930 pushPbbAction.setEthernetType(etherType.getEthertype().getValue());
932 return new PushPbbActionCaseBuilder().setPushPbbAction(pushPbbAction.build()).build();
935 public static Object ofToSALExperimenter(Action action) {
937 ExperimenterAction ExperimenterAction = action.getAugmentation(ExperimenterAction.class);
941 * TODO: Need to explore/discuss about how to handle experimenter