Stale table=44 flows remains on VM deletion
[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
15 public class NAPTEntryEvent {
16     private final String ipAddress;
17     private final int portNumber;
18     private final Long routerId;
19     private String flowDpn;
20     private final Operation op;
21     private final Protocol protocol;
22     private final PacketReceived packetReceived;
23     private final boolean pktProcessed;
24     private final long objectCreationTime;
25     private final NatPacketProcessingState state;
26
27     NAPTEntryEvent(String ipAddress, int portNumber, Long routerId, Operation op, Protocol protocol,
28             @Nullable PacketReceived packetReceived, boolean pktProcessed, @Nullable NatPacketProcessingState state) {
29         this.ipAddress = ipAddress;
30         this.portNumber = portNumber;
31         this.routerId = routerId;
32         this.op = op;
33         this.protocol = protocol;
34         this.packetReceived = packetReceived;
35         this.pktProcessed = pktProcessed;
36         this.state = state;
37         this.objectCreationTime = System.currentTimeMillis();
38     }
39
40     NAPTEntryEvent(String ipAddress, int portNumber, String flowDpn, Long routerId, Operation op, Protocol protocol) {
41         this.op = op;
42         this.ipAddress = ipAddress;
43         this.portNumber = portNumber;
44         this.routerId = routerId;
45         this.flowDpn = flowDpn;
46         this.protocol = protocol;
47         this.packetReceived = null;
48         this.pktProcessed = false;
49         this.state = null;
50         this.objectCreationTime = System.currentTimeMillis();
51     }
52
53     public PacketReceived getPacketReceived() {
54         return packetReceived;
55     }
56
57     public boolean isPktProcessed() {
58         return pktProcessed;
59     }
60
61     public String getIpAddress() {
62         return ipAddress;
63     }
64
65     public int getPortNumber() {
66         return portNumber;
67     }
68
69     public Long getRouterId() {
70         return routerId;
71     }
72
73     public String getFlowDpn() {
74         return flowDpn;
75     }
76
77     public Operation getOperation() {
78         return op;
79     }
80
81     public Protocol getProtocol() {
82         return protocol;
83     }
84
85     public long getObjectCreationTime() {
86         return objectCreationTime;
87     }
88
89     public NatPacketProcessingState getState() {
90         return state;
91     }
92
93     public enum Operation {
94         ADD, DELETE
95     }
96
97     public enum Protocol {
98         TCP, UDP
99     }
100 }