blob: 0e4274d6d65ae95f0a50d6398bf0911033de6696 [file] [log] [blame]
Satish Kf6d87cb2015-11-30 19:59:22 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Satish Kf6d87cb2015-11-30 19:59:22 +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.iptopology.api;
17
18import static com.google.common.base.MoreObjects.toStringHelper;
19
20import java.util.Objects;
21
22/**
23 * This class provides implementation IS-IS and OSPF flags assigned to the prefix.
24 */
25public class IgpFlags {
Priyanka B11aa3432015-12-11 15:12:47 +053026 private final Boolean isisUpDown;
27 private final Boolean ospfNoUnicast;
28 private final Boolean ospfLclAddr;
29 private final Boolean ospfNssa;
Satish Kf6d87cb2015-11-30 19:59:22 +053030
31 /**
32 * Constructor to initialize its parameters.
33 *
34 * @param isisUpDown IS-IS Up/Down
35 * @param ospfNoUnicast OSPF no unicast
36 * @param ospfLclAddr OSPF local address
37 * @param ospfNssa OSPF propagate NSSA
38 */
Priyanka B11aa3432015-12-11 15:12:47 +053039 public IgpFlags(Boolean isisUpDown, Boolean ospfNoUnicast, Boolean ospfLclAddr,
40 Boolean ospfNssa) {
Satish Kf6d87cb2015-11-30 19:59:22 +053041 this.isisUpDown = isisUpDown;
42 this.ospfNoUnicast = ospfNoUnicast;
43 this.ospfLclAddr = ospfLclAddr;
44 this.ospfNssa = ospfNssa;
45 }
46
47 /**
48 * Provides information whether IS-IS is Up/Down.
49 *
Priyanka B11aa3432015-12-11 15:12:47 +053050 * @return IS-IS Up/Down bit enabled or not or null if is not configured
Satish Kf6d87cb2015-11-30 19:59:22 +053051 */
Priyanka B11aa3432015-12-11 15:12:47 +053052 public Boolean isisUpDown() {
Satish Kf6d87cb2015-11-30 19:59:22 +053053 return isisUpDown;
54 }
55
56 /**
57 * Provides information whether OSPF is unicast or not.
58 *
Priyanka B11aa3432015-12-11 15:12:47 +053059 * @return OSPF no unicast Bit set or not or null if is not configured
Satish Kf6d87cb2015-11-30 19:59:22 +053060 */
Priyanka B11aa3432015-12-11 15:12:47 +053061 public Boolean ospfNoUnicast() {
Satish Kf6d87cb2015-11-30 19:59:22 +053062 return ospfNoUnicast;
63 }
64
65 /**
66 * Provides information on OSPF local address.
67 *
Priyanka B11aa3432015-12-11 15:12:47 +053068 * @return OSPF local address Bit set or not or null if is not configured
Satish Kf6d87cb2015-11-30 19:59:22 +053069 */
Priyanka B11aa3432015-12-11 15:12:47 +053070 public Boolean ospfLclAddr() {
Satish Kf6d87cb2015-11-30 19:59:22 +053071 return ospfLclAddr;
72 }
73
74 /**
75 * Provides information on OSPF propagate NSSA.
76 *
Priyanka B11aa3432015-12-11 15:12:47 +053077 * @return OSPF propagate NSSA Bit set or not or null if is not configured
Satish Kf6d87cb2015-11-30 19:59:22 +053078 */
Priyanka B11aa3432015-12-11 15:12:47 +053079 public Boolean ospfNssa() {
Satish Kf6d87cb2015-11-30 19:59:22 +053080 return ospfNssa;
81 }
82
83 @Override
84 public int hashCode() {
85 return Objects.hash(isisUpDown, ospfNoUnicast, ospfLclAddr,
86 ospfNssa);
87 }
88
89 @Override
90 public boolean equals(Object obj) {
91 if (this == obj) {
92 return true;
93 }
94
95 if (obj instanceof IgpFlags) {
96 IgpFlags other = (IgpFlags) obj;
97 return Objects.equals(isisUpDown, other.isisUpDown)
98 && Objects.equals(ospfNoUnicast, other.ospfNoUnicast)
99 && Objects.equals(ospfLclAddr, other.ospfLclAddr)
100 && Objects.equals(ospfNssa, other.ospfNssa);
101 }
102 return false;
103 }
104
105 @Override
106 public String toString() {
107 return toStringHelper(this)
108 .add("isisUpDown", isisUpDown)
109 .add("ospfNoUnicast", ospfNoUnicast)
110 .add("ospfLclAddr", ospfLclAddr)
111 .add("ospfNssa", ospfNssa)
112 .toString();
113 }
114}