27c450ebbf66ca5c58f57931e72b9f9c19bc3d51
[genius.git] / mdsalutil / mdsalutil-api / src / main / java / org / opendaylight / genius / mdsalutil / actions / ActionPopMpls.java
1 /*
2  * Copyright © 2016 Red Hat, Inc. and others.
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 package org.opendaylight.genius.mdsalutil.actions;
9
10 import org.opendaylight.genius.mdsalutil.ActionInfo;
11 import org.opendaylight.genius.mdsalutil.NwConstants;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
17
18 /**
19  * Pop MPLS action.
20  */
21 public class ActionPopMpls extends ActionInfo {
22     private static final long serialVersionUID = 1L;
23
24     public ActionPopMpls() {
25         this(0);
26     }
27
28     public ActionPopMpls(int actionKey) {
29         super(actionKey);
30     }
31
32     @Override
33     public Action buildAction() {
34         return buildAction(getActionKey());
35     }
36
37     @Override
38     public Action buildAction(int newActionKey) {
39         return new ActionBuilder().setAction(
40                 new PopMplsActionCaseBuilder().setPopMplsAction(
41                         new PopMplsActionBuilder().setEthernetType(
42                                 NwConstants.ETHTYPE_IPV4).build()).build())
43                 .setKey(new ActionKey(newActionKey)).build();
44     }
45 }