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 abstract class FlowConvertorUtil {
24 * Method wrapping all the actions org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action
25 * in org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action, to set appropriate keys
28 * @param actionList the action list
31 public static List<Action> wrapActionList(List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> actionList) {
32 List<Action> actions = new ArrayList<>();
35 for (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action : actionList) {
36 ActionBuilder wrappedAction = new ActionBuilder();
37 wrappedAction.setAction(action);
38 wrappedAction.setKey(new ActionKey(actionKey));
39 wrappedAction.setOrder(actionKey);
40 actions.add(wrappedAction.build());
48 * Safely gets ip protocol from flow.
50 * @param flow the flow
51 * @return the ip protocol from flow
53 public static Short getIpProtocolFromFlow(Flow flow) {
54 Short ipProtocol = null;
56 if (flow.getMatch() != null && flow.getMatch().getIpMatch() != null) {
57 ipProtocol = flow.getMatch().getIpMatch().getIpProtocol();