blob: 73664e84eb8a2ca4f89722c9f91fb43d12029952 [file] [log] [blame]
Dhruv Dhody4d8943a2016-02-17 16:36:08 +05301/*
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 */
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.
47 */
48 public void setRouterIp(Ip4Address routerIp) {
49 this.routerIp = routerIp;
50 }
51
52 /**
53 * Gets the area id of this device.
54 *
55 * @return the area id od this device
56 */
57 public Ip4Address areaIdOfInterface() {
58 return areaIdOfInterface;
59 }
60
61 /**
62 * Sets the area id for this device.
63 */
64 public void setAreaIdOfInterface(Ip4Address areaIdOfInterface) {
65 this.areaIdOfInterface = areaIdOfInterface;
66 }
67
68 /**
69 * Gets IP address of the interface.
70 *
71 * @return IP address of the interface
72 */
73 public Ip4Address interfaceId() {
74 return interfaceId;
75 }
76
77 /**
78 * Gets IP address of the interface.
79 *
80 * @param interfaceId IP address of the interface
81 */
82 public void setInterfaceId(Ip4Address interfaceId) {
83 this.interfaceId = interfaceId;
84 }
85
86 /**
87 * Gets List of the device ted.
88 *
89 * @return List of the device ted.
90 */
91 public OspfDeviceTed deviceTed() {
92 return deviceTed;
93 }
94
95 /**
96 * Sets List of the device TED.
97 *
98 * @param deviceTed of the device TED.
99 */
100 public void setDeviceTed(OspfDeviceTed deviceTed) {
101 this.deviceTed = deviceTed;
102 }
103
104 /**
105 * Gets boolean value.
106 *
107 * @return boolean value.
108 */
109 public boolean isOpaque() {
110 return isOpaque;
111 }
112
113 /**
114 * Sets boolean value.
115 *
116 * @param opaque true if opaque else false
117 */
118 public void setOpaque(boolean opaque) {
119 isOpaque = opaque;
120 }
121
122 /**
123 * Gets neighbor's Router id.
124 *
125 * @return neighbor's Router id
126 */
127 public Ip4Address neighborRouterId() {
128 return neighborRouterId;
129 }
130
131 /**
132 * Sets neighbor's Router id.
133 *
134 * @param advertisingRouterId neighbor's Router id
135 */
136 public void setNeighborRouterId(Ip4Address advertisingRouterId) {
137 this.neighborRouterId = advertisingRouterId;
138 }
139
140 /**
141 * Gets if DR or not.
142 *
143 * @return true if DR else false
144 */
145 public boolean isDr() {
146 return isDr;
147 }
148
149 /**
150 * Sets dr or not.
151 *
152 * @param dr true if DR else false
153 */
154 public void setDr(boolean dr) {
155 isDr = dr;
156 }
157}