blob: 60c5945d3d6ffef505bdbcc7118e7b69403818a4 [file] [log] [blame]
tomb36046e2014-08-27 00:22:24 -07001package org.onlab.onos.net;
2
3/**
4 * Representation of a network edge location where an end-station host is
5 * connected.
6 */
tombb58c202014-09-07 22:51:50 -07007public class HostLocation extends ConnectPoint {
8
toma56d5fe2014-09-17 11:05:47 -07009 // Note that time is explicitly excluded from the notion of equality.
tombb58c202014-09-07 22:51:50 -070010 private final long time;
11
tomf5d85d42014-10-02 05:27:56 -070012 /**
13 * Creates a new host location using the supplied device & port.
14 *
15 * @param deviceId device identity
16 * @param portNumber device port number
17 * @param time time when detected, in millis since start of epoch
18 */
tombb58c202014-09-07 22:51:50 -070019 public HostLocation(DeviceId deviceId, PortNumber portNumber, long time) {
20 super(deviceId, portNumber);
21 this.time = time;
22 }
tomb36046e2014-08-27 00:22:24 -070023
24 /**
tom297dfc02014-10-08 10:42:56 -070025 * Creates a new host location derived from the supplied connection point.
26 *
27 * @param connectPoint connection point
28 * @param time time when detected, in millis since start of epoch
29 */
30 public HostLocation(ConnectPoint connectPoint, long time) {
31 super(connectPoint.deviceId(), connectPoint.port());
32 this.time = time;
33 }
34
35 /**
tomf5d85d42014-10-02 05:27:56 -070036 * Returns the time when the location was established, given in
tomb36046e2014-08-27 00:22:24 -070037 * milliseconds since start of epoch.
38 *
tomf5d85d42014-10-02 05:27:56 -070039 * @return time in milliseconds since start of epoch
tomb36046e2014-08-27 00:22:24 -070040 */
tombb58c202014-09-07 22:51:50 -070041 public long time() {
42 return time;
43 }
44
tomb36046e2014-08-27 00:22:24 -070045}