blob: 82b4313d36e2a25e96fabcfc343e2fa629247236 [file] [log] [blame]
Brian O'Connorb7baf712015-07-28 23:27:03 -07001/*
2 * Copyright 2015 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 */
16package org.onosproject.incubator.net.domain;
17
18import com.google.common.annotations.Beta;
19import org.onlab.graph.Vertex;
20import org.onosproject.net.DeviceId;
21
22import static com.google.common.base.Preconditions.checkNotNull;
23
24/**
25 * Representation of the intent domain or a device that is part of the intent
26 * domain graph.
27 */
28@Beta
29public class DomainVertex implements Vertex {
30 // FIXME we will want to add a type enum or subclasses for the two different types
31
32 // A domain vertex is either an intent domain or a device:
33 private final IntentDomainId id;
34 // ----- or -----
35 private final DeviceId deviceId;
36
37 // Serialization constructor
38 private DomainVertex() {
39 this.id = null;
40 this.deviceId = null;
41 }
42
43 DomainVertex(IntentDomainId id) {
44 this.id = checkNotNull(id, "Intent domain ID cannot be null.");
45 this.deviceId = null;
46 }
47
48 DomainVertex(DeviceId id) {
49 this.id = null;
50 this.deviceId = checkNotNull(id, "Device ID cannot be null.");
51 }
52}