blob: 403032a90fd5a9b8f3d993bf6c9b9de8801154ac [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 */
Yuta HIGUCHI5ec89f92014-10-12 01:01:43 -070016package org.onlab.onos.store.device.impl;
Yuta HIGUCHI9ee60f62014-10-09 10:00:01 -070017
18import static com.google.common.base.Preconditions.checkNotNull;
19
20import java.util.Map;
21
22import org.onlab.onos.cluster.NodeId;
23import org.onlab.onos.net.DeviceId;
24import org.onlab.onos.store.Timestamp;
25
26
27/**
28 * Device Advertisement message.
29 */
30public class DeviceAntiEntropyAdvertisement {
31
32 private final NodeId sender;
33 private final Map<DeviceFragmentId, Timestamp> deviceFingerPrints;
34 private final Map<PortFragmentId, Timestamp> portFingerPrints;
35 private final Map<DeviceId, Timestamp> offline;
36
37
38 public DeviceAntiEntropyAdvertisement(NodeId sender,
39 Map<DeviceFragmentId, Timestamp> devices,
40 Map<PortFragmentId, Timestamp> ports,
41 Map<DeviceId, Timestamp> offline) {
42 this.sender = checkNotNull(sender);
43 this.deviceFingerPrints = checkNotNull(devices);
44 this.portFingerPrints = checkNotNull(ports);
45 this.offline = checkNotNull(offline);
46 }
47
48 public NodeId sender() {
49 return sender;
50 }
51
52 public Map<DeviceFragmentId, Timestamp> deviceFingerPrints() {
53 return deviceFingerPrints;
54 }
55
56 public Map<PortFragmentId, Timestamp> ports() {
57 return portFingerPrints;
58 }
59
60 public Map<DeviceId, Timestamp> offline() {
61 return offline;
62 }
63
64 // For serializer
65 @SuppressWarnings("unused")
66 private DeviceAntiEntropyAdvertisement() {
67 this.sender = null;
68 this.deviceFingerPrints = null;
69 this.portFingerPrints = null;
70 this.offline = null;
71 }
72}