Satish K | f6d87cb | 2015-11-30 19:59:22 +0530 | [diff] [blame] | 1 | /* |
| 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 | package org.onosproject.iptopology.api; |
| 17 | |
| 18 | import static com.google.common.base.MoreObjects.toStringHelper; |
| 19 | |
| 20 | import java.util.Objects; |
| 21 | |
| 22 | /** |
| 23 | * This class provides implementation IS-IS and OSPF flags assigned to the prefix. |
| 24 | */ |
| 25 | public class IgpFlags { |
Priyanka B | 11aa343 | 2015-12-11 15:12:47 +0530 | [diff] [blame] | 26 | private final Boolean isisUpDown; |
| 27 | private final Boolean ospfNoUnicast; |
| 28 | private final Boolean ospfLclAddr; |
| 29 | private final Boolean ospfNssa; |
Satish K | f6d87cb | 2015-11-30 19:59:22 +0530 | [diff] [blame] | 30 | |
| 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 B | 11aa343 | 2015-12-11 15:12:47 +0530 | [diff] [blame] | 39 | public IgpFlags(Boolean isisUpDown, Boolean ospfNoUnicast, Boolean ospfLclAddr, |
| 40 | Boolean ospfNssa) { |
Satish K | f6d87cb | 2015-11-30 19:59:22 +0530 | [diff] [blame] | 41 | 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 B | 11aa343 | 2015-12-11 15:12:47 +0530 | [diff] [blame] | 50 | * @return IS-IS Up/Down bit enabled or not or null if is not configured |
Satish K | f6d87cb | 2015-11-30 19:59:22 +0530 | [diff] [blame] | 51 | */ |
Priyanka B | 11aa343 | 2015-12-11 15:12:47 +0530 | [diff] [blame] | 52 | public Boolean isisUpDown() { |
Satish K | f6d87cb | 2015-11-30 19:59:22 +0530 | [diff] [blame] | 53 | return isisUpDown; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Provides information whether OSPF is unicast or not. |
| 58 | * |
Priyanka B | 11aa343 | 2015-12-11 15:12:47 +0530 | [diff] [blame] | 59 | * @return OSPF no unicast Bit set or not or null if is not configured |
Satish K | f6d87cb | 2015-11-30 19:59:22 +0530 | [diff] [blame] | 60 | */ |
Priyanka B | 11aa343 | 2015-12-11 15:12:47 +0530 | [diff] [blame] | 61 | public Boolean ospfNoUnicast() { |
Satish K | f6d87cb | 2015-11-30 19:59:22 +0530 | [diff] [blame] | 62 | return ospfNoUnicast; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Provides information on OSPF local address. |
| 67 | * |
Priyanka B | 11aa343 | 2015-12-11 15:12:47 +0530 | [diff] [blame] | 68 | * @return OSPF local address Bit set or not or null if is not configured |
Satish K | f6d87cb | 2015-11-30 19:59:22 +0530 | [diff] [blame] | 69 | */ |
Priyanka B | 11aa343 | 2015-12-11 15:12:47 +0530 | [diff] [blame] | 70 | public Boolean ospfLclAddr() { |
Satish K | f6d87cb | 2015-11-30 19:59:22 +0530 | [diff] [blame] | 71 | return ospfLclAddr; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Provides information on OSPF propagate NSSA. |
| 76 | * |
Priyanka B | 11aa343 | 2015-12-11 15:12:47 +0530 | [diff] [blame] | 77 | * @return OSPF propagate NSSA Bit set or not or null if is not configured |
Satish K | f6d87cb | 2015-11-30 19:59:22 +0530 | [diff] [blame] | 78 | */ |
Priyanka B | 11aa343 | 2015-12-11 15:12:47 +0530 | [diff] [blame] | 79 | public Boolean ospfNssa() { |
Satish K | f6d87cb | 2015-11-30 19:59:22 +0530 | [diff] [blame] | 80 | 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 | } |