2 * Copyright (c) 2016 Cisco Systems, 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.openflow.md.core.sal.convertor.flow;
11 import java.util.ArrayList;
12 import java.util.List;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow;
21 public final class FlowConvertorUtil {
22 private FlowConvertorUtil() {
26 * Method wrapping all the actions
27 * org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action
28 * in org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action, to set
29 * appropriate keys for actions.
31 * @param actionList the action list
34 public static List<Action> wrapActionList(List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types
35 .rev131112.action.Action> actionList) {
36 List<Action> actions = new ArrayList<>();
39 for (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action : actionList) {
40 ActionBuilder wrappedAction = new ActionBuilder();
41 wrappedAction.setAction(action);
42 wrappedAction.setKey(new ActionKey(actionKey));
43 wrappedAction.setOrder(actionKey);
44 actions.add(wrappedAction.build());
52 * Safely gets ip protocol from flow.
54 * @param flow the flow
55 * @return the ip protocol from flow
57 public static Short getIpProtocolFromFlow(Flow flow) {
58 Short ipProtocol = null;
60 if (flow.getMatch() != null && flow.getMatch().getIpMatch() != null) {
61 ipProtocol = flow.getMatch().getIpMatch().getIpProtocol();