blob: 3e8acda9f89dd363c2bfdd573c4ecb24cd9d97f9 [file] [log] [blame]
Kalyankumar Asangi27728f22016-02-17 15:46:28 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Kalyankumar Asangi27728f22016-02-17 15:46:28 +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.util;
17
18import org.onlab.packet.Ip4Address;
19
20/**
21 * Represents a router who is eligible for DR election.
22 */
23public class OspfEligibleRouter {
24
25 private Ip4Address ipAddress;
26 private Ip4Address routerId;
27 private int routerPriority;
28 private boolean isDr;
29 private boolean isBdr;
30
31 /**
32 * Creates an instance.
33 * Initialize IP address of eligible router.
34 */
35 public OspfEligibleRouter() {
36 ipAddress = Ip4Address.valueOf("0.0.0.0");
37 }
38
39 /**
40 * Gets the value of IP address.
41 *
42 * @return IP address
43 */
44 public Ip4Address getIpAddress() {
45 return ipAddress;
46 }
47
48 /**
49 * Sets the value of IP address.
50 *
51 * @param ipAddress IP address
52 */
53 public void setIpAddress(Ip4Address ipAddress) {
54 this.ipAddress = ipAddress;
55 }
56
57 /**
58 * Gets the value of router id.
59 *
60 * @return router id.
61 */
62 public Ip4Address getRouterId() {
63 return routerId;
64 }
65
66 /**
67 * Sets the value of router id.
68 *
69 * @param routerId router id
70 */
71 public void setRouterId(Ip4Address routerId) {
72 this.routerId = routerId;
73 }
74
75 /**
76 * Gets the value of router priority.
77 *
78 * @return router priority.
79 */
80 public int getRouterPriority() {
81 return routerPriority;
82 }
83
84 /**
85 * Sets the value of router priority.
86 *
87 * @param routerPriority router priority
88 */
89 public void setRouterPriority(int routerPriority) {
90 this.routerPriority = routerPriority;
91 }
92
93 /**
94 * Gets whether the router is DR.
95 *
96 * @return boolean true if router is DR else return false.
97 */
98 public boolean isDr() {
99 return isDr;
100 }
101
102 /**
103 * Sets the router is DR or not.
104 *
105 * @param isDr router is DR or not
106 */
107 public void setIsDr(boolean isDr) {
108 this.isDr = isDr;
109 }
110
111 /**
112 * Gets whether the router is BDR or not.
113 *
114 * @return boolean true if router is Bdr else return false.
115 */
116 public boolean isBdr() {
117 return isBdr;
118 }
119
120 /**
121 * Sets the router is BDR or not.
122 *
123 * @param isBdr the router is BDR or not
124 */
125 public void setIsBdr(boolean isBdr) {
126 this.isBdr = isBdr;
127 }
128}