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) {
36 public Action buildAction() {
37 return buildAction(getActionKey());
41 public Action buildAction(int newActionKey) {
42 return new ActionBuilder()
44 new SetFieldCaseBuilder()
47 .setProtocolMatchFields(
48 new ProtocolMatchFieldsBuilder().setMplsLabel(label).build())
51 .setKey(new ActionKey(newActionKey))
56 public boolean equals(Object other) {
60 if (other == null || getClass() != other.getClass()) {
63 if (!super.equals(other)) {
67 ActionSetFieldMplsLabel that = (ActionSetFieldMplsLabel) other;
69 return label == that.label;
73 public int hashCode() {
74 int result = super.hashCode();
75 result = 31 * result + (int) (label ^ label >>> 32);