2 * Copyright (c) 2016 Red Hat, 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
8 package org.opendaylight.genius.mdsalutil.actions;
10 import org.opendaylight.genius.mdsalutil.ActionInfo;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;
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.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder;
19 * Set MPLS label field action.
21 public class ActionSetFieldMplsLabel extends ActionInfo {
22 private static final long serialVersionUID = 1L;
24 private final long label;
26 public ActionSetFieldMplsLabel(long label) {
30 public ActionSetFieldMplsLabel(int actionKey, long label) {
35 public long getLabel() {
40 public Action buildAction() {
41 return buildAction(getActionKey());
45 public Action buildAction(int newActionKey) {
46 return new ActionBuilder()
48 new SetFieldCaseBuilder()
51 .setProtocolMatchFields(
52 new ProtocolMatchFieldsBuilder().setMplsLabel(label).build())
55 .setKey(new ActionKey(newActionKey))
60 public boolean equals(Object other) {
64 if (other == null || getClass() != other.getClass()) {
67 if (!super.equals(other)) {
71 ActionSetFieldMplsLabel that = (ActionSetFieldMplsLabel) other;
73 return label == that.label;
77 public int hashCode() {
78 int result = super.hashCode();
79 result = 31 * result + (int) (label ^ label >>> 32);
84 public String toString() {
85 return "ActionSetFieldMplsLabel [label=" + label + ", getActionKey()=" + getActionKey() + "]";