Bump odlparent->6.0.0,mdsal->5.0.3
[netvirt.git] / natservice / impl / src / main / java / org / opendaylight / netvirt / natservice / internal / NAPTEntryEvent.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
9 package org.opendaylight.netvirt.natservice.internal;
10
11 import org.eclipse.jdt.annotation.Nullable;
12 import org.opendaylight.netvirt.natservice.internal.NaptPacketInHandler.NatPacketProcessingState;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceived;
14 import org.opendaylight.yangtools.yang.common.Uint32;
15
16 public class NAPTEntryEvent {
17     private final String ipAddress;
18     private final int portNumber;
19     private final Uint32 routerId;
20     private String flowDpn;
21     private final Operation op;
22     private final Protocol protocol;
23     private final PacketReceived packetReceived;
24     private final boolean pktProcessed;
25     private final long objectCreationTime;
26     private final NatPacketProcessingState state;
27
28     NAPTEntryEvent(String ipAddress, int portNumber, Uint32 routerId, Operation op, Protocol protocol,
29             @Nullable PacketReceived packetReceived, boolean pktProcessed, @Nullable NatPacketProcessingState state) {
30         this.ipAddress = ipAddress;
31         this.portNumber = portNumber;
32         this.routerId = routerId;
33         this.op = op;
34         this.protocol = protocol;
35         this.packetReceived = packetReceived;
36         this.pktProcessed = pktProcessed;
37         this.state = state;
38         this.objectCreationTime = System.currentTimeMillis();
39     }
40
41     NAPTEntryEvent(String ipAddress, int portNumber, String flowDpn, Uint32 routerId, Operation op, Protocol protocol) {
42         this.op = op;
43         this.ipAddress = ipAddress;
44         this.portNumber = portNumber;
45         this.routerId = routerId;
46         this.flowDpn = flowDpn;
47         this.protocol = protocol;
48         this.packetReceived = null;
49         this.pktProcessed = false;
50         this.state = null;
51         this.objectCreationTime = System.currentTimeMillis();
52     }
53
54     public PacketReceived getPacketReceived() {
55         return packetReceived;
56     }
57
58     public boolean isPktProcessed() {
59         return pktProcessed;
60     }
61
62     public String getIpAddress() {
63         return ipAddress;
64     }
65
66     public int getPortNumber() {
67         return portNumber;
68     }
69
70     public Uint32 getRouterId() {
71         return routerId;
72     }
73
74     public String getFlowDpn() {
75         return flowDpn;
76     }
77
78     public Operation getOperation() {
79         return op;
80     }
81
82     public Protocol getProtocol() {
83         return protocol;
84     }
85
86     public long getObjectCreationTime() {
87         return objectCreationTime;
88     }
89
90     public NatPacketProcessingState getState() {
91         return state;
92     }
93
94     public enum Operation {
95         ADD, DELETE
96     }
97
98     public enum Protocol {
99         TCP, UDP
100     }
101 }