blob: b827c28ff9e92fe6628f82f80ce1fae1078c5599 [file] [log] [blame]
Dhruv Dhody4d8943a2016-02-17 16:36:08 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Dhruv Dhody4d8943a2016-02-17 16:36:08 +05303 *
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.ospf.controller.impl;
17
18import org.onlab.packet.Ip4Address;
19import org.onosproject.ospf.controller.DeviceInformation;
20
21import java.util.ArrayList;
22import java.util.List;
23
24/**
25 * Representation of an OSPF device information.
26 */
27public class DeviceInformationImpl implements DeviceInformation {
28
29 Ip4Address deviceId;
30 Ip4Address routerId;
31 List<Ip4Address> interfaceId = new ArrayList<>();
32 Ip4Address areaId;
33 boolean alreadyCreated;
34 boolean isDr;
35
36 Ip4Address neighborId;
37
38 /**
39 * Gets router id.
40 *
41 * @return router id
42 */
43 public Ip4Address routerId() {
44 return routerId;
45 }
46
47 /**
48 * Sets router id.
49 *
50 * @param routerId router id
51 */
52 public void setRouterId(Ip4Address routerId) {
53 this.routerId = routerId;
54 }
55
56 /**
57 * Gets device id.
58 *
59 * @return device id
60 */
61 public Ip4Address deviceId() {
62 return deviceId;
63 }
64
65 /**
66 * Sets device id.
67 *
68 * @param deviceId device id
69 */
70 public void setDeviceId(Ip4Address deviceId) {
71 this.deviceId = deviceId;
72 }
73
74 /**
75 * Gets interface id list.
76 *
77 * @return interface id list
78 */
79 public List<Ip4Address> interfaceId() {
80 return this.interfaceId;
81 }
82
83 /**
84 * Adds interface id to list.
85 *
86 * @param interfaceId interface id
87 */
88 public void addInterfaceId(Ip4Address interfaceId) {
89 this.interfaceId.add(interfaceId);
90 }
91
92 /**
93 * Gets area id.
94 *
95 * @return area id
96 */
97 public Ip4Address areaId() {
98 return areaId;
99 }
100
101 /**
102 * Sets area id.
103 *
104 * @param areaId area id
105 */
106 public void setAreaId(Ip4Address areaId) {
107 this.areaId = areaId;
108 }
109
110 /**
111 * Gets is already created or not.
112 *
113 * @return true if already created else false
114 */
115 public boolean isAlreadyCreated() {
116 return alreadyCreated;
117 }
118
119 /**
120 * Sets is already created or not.
121 *
122 * @param alreadyCreated true or false
123 */
124 public void setAlreadyCreated(boolean alreadyCreated) {
125 this.alreadyCreated = alreadyCreated;
126 }
127
128 /**
129 * Gets is DR or not.
130 *
131 * @return true if DR else false
132 */
133 public boolean isDr() {
134 return isDr;
135 }
136
137 /**
138 * Stes DR or not.
139 *
140 * @param dr true or false
141 */
142 public void setDr(boolean dr) {
143 this.isDr = dr;
144 }
145
146 /**
147 * Gets neighbor id.
148 *
149 * @return neighbor id
150 */
151 public Ip4Address neighborId() {
152 return neighborId;
153 }
154
155 /**
156 * Sets neighbor id.
157 *
158 * @param neighborId neighbor id
159 */
160 public void setNeighborId(Ip4Address neighborId) {
161 this.neighborId = neighborId;
162 }
163}