Exported package for classifier-definitions and action-definitions
[groupbasedpolicy.git] / renderers / ofoverlay / src / main / java / org / opendaylight / groupbasedpolicy / renderer / ofoverlay / sf / AllowAction.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf;
10
11 import static org.opendaylight.groupbasedpolicy.renderer.ofoverlay.flow.FlowUtils.nxOutputRegAction;
12
13 import java.util.List;
14 import java.util.Map;
15
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ActionDefinitionId;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ActionName;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.Description;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definitions.ActionDefinition;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definitions.ActionDefinitionBuilder;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg7;
23
24
25 /**
26  * Allow action
27  */
28 public class AllowAction extends Action {
29
30     protected static final ActionDefinitionId ID = new ActionDefinitionId("f942e8fd-e957-42b7-bd18-f73d11266d17");
31     /**
32      * Access control - allow action-definition
33      */
34     public static final ActionDefinition DEFINITION = new ActionDefinitionBuilder().setId(ID)
35         .setName(new ActionName("allow"))
36         .setDescription(new Description("Allow the specified traffic to pass"))
37         .build();
38
39     // How allow is implemented in the PolicyEnforcer table
40     private final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action allow = nxOutputRegAction(NxmNxReg7.class);
41
42     @Override
43     public ActionDefinitionId getId() {
44         return ID;
45     }
46
47     @Override
48     public ActionDefinition getActionDef() {
49         return DEFINITION;
50     }
51
52     @Override
53     public List<ActionBuilder> updateAction(List<ActionBuilder> actions,
54                                             Map<String, Object> params,
55                                             Integer order) {
56         /*
57          * Allow action doesn't use parameters
58          * TODO: check to make sure ActionBuilder w/allow isn't already present
59          */
60         ActionBuilder ab = new ActionBuilder();
61         ab.setAction(allow)
62           .setOrder(order);
63         actions.add(ab);
64         return actions;
65     }
66
67 }