Mohamed Rahil | a3b9e99 | 2016-02-16 20:26:49 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame^] | 2 | * Copyright 2016-present Open Networking Laboratory |
Mohamed Rahil | a3b9e99 | 2016-02-16 20:26:49 +0530 | [diff] [blame] | 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.ospf.protocol.lsa.subtypes; |
| 17 | |
| 18 | import com.google.common.base.MoreObjects; |
| 19 | import org.onlab.packet.Ip4Address; |
| 20 | |
| 21 | /** |
| 22 | * Defines the OSPF external destination. |
| 23 | */ |
| 24 | public class OspfExternalDestination { |
| 25 | |
| 26 | private boolean isType1orType2Metric; |
| 27 | private int metric; |
| 28 | private Ip4Address forwardingAddress; |
| 29 | private int externalRouterTag; |
| 30 | |
| 31 | /** |
| 32 | * Gets whether type1 or type 2 metric. |
| 33 | * |
| 34 | * @return true if Type1 or false if Type2 metric |
| 35 | */ |
| 36 | public boolean isType1orType2Metric() { |
| 37 | return isType1orType2Metric; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Sets whether type1 or Type2 metric. |
| 42 | * |
| 43 | * @param isType1orType2Metric is type 1 or type 2 metric |
| 44 | */ |
| 45 | public void setType1orType2Metric(boolean isType1orType2Metric) { |
| 46 | this.isType1orType2Metric = isType1orType2Metric; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Gets the metric value. |
| 51 | * |
| 52 | * @return metric value |
| 53 | */ |
| 54 | public int metric() { |
| 55 | return metric; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Sets the metric value. |
| 60 | * |
| 61 | * @param metric metric value |
| 62 | */ |
| 63 | public void setMetric(int metric) { |
| 64 | this.metric = metric; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Gets forwarding address. |
| 69 | * |
| 70 | * @return forwarding address |
| 71 | */ |
| 72 | public Ip4Address forwardingAddress() { |
| 73 | return forwardingAddress; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Sets forwarding address. |
| 78 | * |
| 79 | * @param forwardingAddress forwarding address |
| 80 | */ |
| 81 | public void setForwardingAddress(Ip4Address forwardingAddress) { |
| 82 | this.forwardingAddress = forwardingAddress; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Gets external router tag. |
| 87 | * |
| 88 | * @return external router tag |
| 89 | */ |
| 90 | public int externalRouterTag() { |
| 91 | return externalRouterTag; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Sets external router tag. |
| 96 | * |
| 97 | * @param externalRouterTag external router tag |
| 98 | */ |
| 99 | public void setExternalRouterTag(int externalRouterTag) { |
| 100 | this.externalRouterTag = externalRouterTag; |
| 101 | } |
| 102 | |
| 103 | @Override |
| 104 | public String toString() { |
| 105 | return MoreObjects.toStringHelper(getClass()) |
| 106 | .omitNullValues() |
| 107 | .add("isType1orType2Metric", isType1orType2Metric) |
| 108 | .add("metric", metric) |
| 109 | .add("forwardingAddress", forwardingAddress) |
| 110 | .add("externalRouterTag", externalRouterTag) |
| 111 | .toString(); |
| 112 | } |
| 113 | } |