blob: cb3c740d970da4661f59f1af84f4b2c22a1877ab [file] [log] [blame]
Ayaka Koshibe48229222016-05-16 18:04:26 -07001/*
Brian O'Connor0a4e6742016-09-15 23:03:10 -07002 * Copyright 2016-present Open Networking Laboratory
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;
21
22/**
23 * Test adapter for the ClusterMetadata service.
24 */
25public class ClusterMetadataServiceAdapter implements ClusterMetadataService {
26
27 @Override
28 public ClusterMetadata getClusterMetadata() {
29 final NodeId nid = new NodeId("test-node");
30 final IpAddress addr = IpAddress.valueOf(0);
31 final Partition p = new DefaultPartition(PartitionId.from(1), Sets.newHashSet(nid));
32 return new ClusterMetadata("test-cluster",
33 Sets.newHashSet(new DefaultControllerNode(nid, addr)),
34 Sets.newHashSet(p));
35 }
36
37 @Override
38 public ControllerNode getLocalNode() {
39 return null;
40 }
41
42 @Override
43 public void addListener(ClusterMetadataEventListener listener) {
44 }
45
46 @Override
47 public void removeListener(ClusterMetadataEventListener listener) {
48 }
49
50}