blob: f394905e85faa57067009c93d1c540224c9be643 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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 implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Madan Jampani47c93732014-10-06 20:46:08 -070016package org.onlab.onos.store.device.impl;
17
18import java.util.List;
19
20import org.onlab.onos.net.DeviceId;
21import org.onlab.onos.net.device.PortDescription;
22import org.onlab.onos.net.provider.ProviderId;
Yuta HIGUCHIeecee552014-10-16 14:09:01 -070023import org.onlab.onos.store.impl.Timestamped;
Madan Jampani47c93732014-10-06 20:46:08 -070024
Yuta HIGUCHI9ee60f62014-10-09 10:00:01 -070025import com.google.common.base.MoreObjects;
26
Madan Jampani2206e012014-10-06 21:04:20 -070027/**
28 * Information published by GossipDeviceStore to notify peers of a port
29 * change event.
30 */
Madan Jampani47c93732014-10-06 20:46:08 -070031public class InternalPortEvent {
32
33 private final ProviderId providerId;
34 private final DeviceId deviceId;
35 private final Timestamped<List<PortDescription>> portDescriptions;
36
37 protected InternalPortEvent(
38 ProviderId providerId,
39 DeviceId deviceId,
40 Timestamped<List<PortDescription>> portDescriptions) {
41 this.providerId = providerId;
42 this.deviceId = deviceId;
43 this.portDescriptions = portDescriptions;
44 }
45
46 public DeviceId deviceId() {
47 return deviceId;
48 }
49
50 public ProviderId providerId() {
51 return providerId;
52 }
53
54 public Timestamped<List<PortDescription>> portDescriptions() {
55 return portDescriptions;
56 }
Yuta HIGUCHI3cc19072014-10-07 17:33:23 -070057
Yuta HIGUCHI9ee60f62014-10-09 10:00:01 -070058 @Override
59 public String toString() {
60 return MoreObjects.toStringHelper(getClass())
61 .add("providerId", providerId)
62 .add("deviceId", deviceId)
63 .add("portDescriptions", portDescriptions)
64 .toString();
65 }
66
Yuta HIGUCHI3cc19072014-10-07 17:33:23 -070067 // for serializer
68 protected InternalPortEvent() {
69 this.providerId = null;
70 this.deviceId = null;
71 this.portDescriptions = null;
72 }
Madan Jampani47c93732014-10-06 20:46:08 -070073}