move vpnservice and cleanup poms
[netvirt.git] / vpnmanager / vpnmanager-impl / src / main / java / org / opendaylight / netvirt / vpnmanager / ArpReplyOrRequest.java
1 /*
2  * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. 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 package org.opendaylight.netvirt.vpnmanager;
9
10 import java.util.Objects;
11 import org.opendaylight.genius.mdsalutil.NwConstants;
12
13 public enum ArpReplyOrRequest {
14     REQUEST("ARP-REQUEST"), REPLY("ARP-REPLY");
15
16     private String name;
17
18     ArpReplyOrRequest(String name) {
19         this.name = name;
20     }
21
22     public String getName() {
23         return this.name;
24     }
25
26     public int getArpOperation() {
27         int arpOperation =
28             (Objects.equals(name, ArpReplyOrRequest.REQUEST.getName())
29                     ? NwConstants.ARP_REQUEST : NwConstants.ARP_REPLY);
30         return arpOperation;
31     }
32
33     public int calculateConsistentHashCode() {
34         if (this.name != null) {
35             return this.name.hashCode();
36         } else {
37             return 0;
38         }
39     }
40 }