blob: 2d152a106bce7ec7524a7c6e316af7ed92026c11 [file] [log] [blame]
Dhruv Dhody4d8943a2016-02-17 16:36:08 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
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 */
16
17package org.onosproject.ospf.controller.impl;
18
19import org.onlab.packet.Ip4Address;
20import org.onosproject.ospf.controller.OspfDeviceTed;
21import org.onosproject.ospf.controller.OspfRouter;
22
23/**
24 * Representation of an OSPF Router.
25 */
26public class OspfRouterImpl implements OspfRouter {
27
28 private Ip4Address routerIp;
29 private Ip4Address areaIdOfInterface;
30 private Ip4Address neighborRouterId;
31 private Ip4Address interfaceId;
32 private OspfDeviceTed deviceTed;
33 private boolean isOpaque;
34 private boolean isDr;
35
36 /**
37 * Gets IP address of the Router.
38 *
39 * @return IP address router
40 */
41 public Ip4Address routerIp() {
42 return routerIp;
43 }
44
45 /**
46 * Sets IP address of the Router.
Ray Milkey0bb1e102016-11-10 14:51:27 -080047 *
48 * @param routerIp IP address of the router
Dhruv Dhody4d8943a2016-02-17 16:36:08 +053049 */
50 public void setRouterIp(Ip4Address routerIp) {
51 this.routerIp = routerIp;
52 }
53
54 /**
55 * Gets the area id of this device.
56 *
57 * @return the area id od this device
58 */
59 public Ip4Address areaIdOfInterface() {
60 return areaIdOfInterface;
61 }
62
63 /**
64 * Sets the area id for this device.
Ray Milkey0bb1e102016-11-10 14:51:27 -080065 *
66 * @param areaIdOfInterface area identifier for the device
Dhruv Dhody4d8943a2016-02-17 16:36:08 +053067 */
68 public void setAreaIdOfInterface(Ip4Address areaIdOfInterface) {
69 this.areaIdOfInterface = areaIdOfInterface;
70 }
71
72 /**
73 * Gets IP address of the interface.
74 *
75 * @return IP address of the interface
76 */
77 public Ip4Address interfaceId() {
78 return interfaceId;
79 }
80
81 /**
82 * Gets IP address of the interface.
83 *
84 * @param interfaceId IP address of the interface
85 */
86 public void setInterfaceId(Ip4Address interfaceId) {
87 this.interfaceId = interfaceId;
88 }
89
90 /**
91 * Gets List of the device ted.
92 *
93 * @return List of the device ted.
94 */
95 public OspfDeviceTed deviceTed() {
96 return deviceTed;
97 }
98
99 /**
100 * Sets List of the device TED.
101 *
102 * @param deviceTed of the device TED.
103 */
104 public void setDeviceTed(OspfDeviceTed deviceTed) {
105 this.deviceTed = deviceTed;
106 }
107
108 /**
109 * Gets boolean value.
110 *
111 * @return boolean value.
112 */
113 public boolean isOpaque() {
114 return isOpaque;
115 }
116
117 /**
118 * Sets boolean value.
119 *
120 * @param opaque true if opaque else false
121 */
122 public void setOpaque(boolean opaque) {
123 isOpaque = opaque;
124 }
125
126 /**
127 * Gets neighbor's Router id.
128 *
129 * @return neighbor's Router id
130 */
131 public Ip4Address neighborRouterId() {
132 return neighborRouterId;
133 }
134
135 /**
136 * Sets neighbor's Router id.
137 *
138 * @param advertisingRouterId neighbor's Router id
139 */
140 public void setNeighborRouterId(Ip4Address advertisingRouterId) {
141 this.neighborRouterId = advertisingRouterId;
142 }
143
144 /**
145 * Gets if DR or not.
146 *
147 * @return true if DR else false
148 */
149 public boolean isDr() {
150 return isDr;
151 }
152
153 /**
154 * Sets dr or not.
155 *
156 * @param dr true if DR else false
157 */
158 public void setDr(boolean dr) {
159 isDr = dr;
160 }
Ray Milkey0bb1e102016-11-10 14:51:27 -0800161}