blob: 443ee29c1c7c7bd018958b7618045cac1e429e79 [file] [log] [blame]
Ayaka Koshibe48229222016-05-16 18:04:26 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Ayaka Koshibe48229222016-05-16 18:04:26 -07003 *
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 */
16package org.onosproject.cluster;
17
18import org.onlab.packet.IpAddress;
19
20import com.google.common.collect.Sets;
Jordan Halterman07f052b2017-10-08 14:22:41 -070021import org.onosproject.core.Version;
Ayaka Koshibe48229222016-05-16 18:04:26 -070022
23/**
24 * Test adapter for the ClusterMetadata service.
25 */
26public class ClusterMetadataServiceAdapter implements ClusterMetadataService {
27
28 @Override
29 public ClusterMetadata getClusterMetadata() {
30 final NodeId nid = new NodeId("test-node");
31 final IpAddress addr = IpAddress.valueOf(0);
Jordan Halterman07f052b2017-10-08 14:22:41 -070032 final Partition p = new DefaultPartition(PartitionId.from(1), Version.version("1.0.0"), Sets.newHashSet(nid));
Ayaka Koshibe48229222016-05-16 18:04:26 -070033 return new ClusterMetadata("test-cluster",
34 Sets.newHashSet(new DefaultControllerNode(nid, addr)),
35 Sets.newHashSet(p));
36 }
37
38 @Override
39 public ControllerNode getLocalNode() {
40 return null;
41 }
42
43 @Override
44 public void addListener(ClusterMetadataEventListener listener) {
45 }
46
47 @Override
48 public void removeListener(ClusterMetadataEventListener listener) {
49 }
50
51}