2 * Copyright (c) 2011,2012 Big Switch Networks, Inc.
4 * Licensed under the Eclipse Public License, Version 1.0 (the
5 * "License"); you may not use this file except in compliance with the
6 * License. You may obtain a copy of the License at
8 * http://www.eclipse.org/legal/epl-v10.html
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 * implied. See the License for the specific language governing
14 * permissions and limitations under the License.
16 * This file incorporates work covered by the following copyright and
19 * Originally created by David Erickson, Stanford University
21 * Licensed under the Apache License, Version 2.0 (the "License");
22 * you may not use this file except in compliance with the
23 * License. You may obtain a copy of the License at
25 * http://www.apache.org/licenses/LICENSE-2.0
27 * Unless required by applicable law or agreed to in writing,
28 * software distributed under the License is distributed on an "AS
29 * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
30 * express or implied. See the License for the specific language
31 * governing permissions and limitations under the License.
38 package org.opendaylight.controller.hosttracker.internal;
40 import org.opendaylight.controller.sal.core.NodeConnector;
42 public class AttachmentPoint {
47 // Timeout for moving attachment points from OF/broadcast
49 public static final long INACTIVITY_INTERVAL = 30000; // 30 seconds
50 public static final long EXTERNAL_TO_EXTERNAL_TIMEOUT = 5000; // 5 seconds
51 public static final long OPENFLOW_TO_EXTERNAL_TIMEOUT = 30000; // 30 seconds
52 public static final long CONSISTENT_TIMEOUT = 30000; // 30 seconds
54 public AttachmentPoint(NodeConnector port, long activeSince, long lastSeen) {
56 this.activeSince = activeSince;
57 this.lastSeen = lastSeen;
60 public AttachmentPoint(NodeConnector port, long lastSeen) {
62 this.lastSeen = lastSeen;
63 this.activeSince = lastSeen;
66 public AttachmentPoint(AttachmentPoint ap) {
68 this.activeSince = ap.activeSince;
69 this.lastSeen = ap.lastSeen;
72 public NodeConnector getPort() {
76 public void setPort(NodeConnector port) {
80 public long getActiveSince() {
84 public void setActiveSince(long activeSince) {
85 this.activeSince = activeSince;
88 public long getLastSeen() {
92 public void setLastSeen(long lastSeen) {
93 if (this.lastSeen + INACTIVITY_INTERVAL < lastSeen)
94 this.activeSince = lastSeen;
95 if (this.lastSeen < lastSeen)
96 this.lastSeen = lastSeen;
100 public int hashCode() {
101 final int prime = 31;
103 result = prime * result + ((port == null) ? 0 : port.hashCode());
108 public boolean equals(Object obj) {
113 if (getClass() != obj.getClass())
115 AttachmentPoint other = (AttachmentPoint) obj;
117 if (other.port != null)
119 } else if (!port.equals(other.port))
125 public String toString() {
126 return "AttachmentPoint [port=" + port + ", activeSince=" + activeSince
127 + ", lastSeen=" + lastSeen + "]";