Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +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 | */ |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 16 | package org.onosproject.bgpio.protocol; |
| 17 | |
| 18 | import java.util.LinkedList; |
| 19 | |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame^] | 20 | import org.onosproject.bgpio.exceptions.BgpParseException; |
| 21 | import org.onosproject.bgpio.types.BgpHeader; |
| 22 | import org.onosproject.bgpio.types.BgpValueType; |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 23 | |
| 24 | /** |
| 25 | * Abstraction of an entity providing BGP Open Message. |
| 26 | */ |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame^] | 27 | public interface BgpOpenMsg extends BgpMessage { |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 28 | |
| 29 | @Override |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame^] | 30 | BgpHeader getHeader(); |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 31 | |
| 32 | @Override |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame^] | 33 | BgpVersion getVersion(); |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 34 | |
| 35 | @Override |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame^] | 36 | BgpType getType(); |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 37 | |
| 38 | /** |
| 39 | * Returns hold time of Open Message. |
| 40 | * |
| 41 | * @return hold time of Open Message |
| 42 | */ |
| 43 | short getHoldTime(); |
| 44 | |
| 45 | /** |
| 46 | * Returns AS Number of Open Message. |
| 47 | * |
| 48 | * @return AS Number of Open Message |
| 49 | */ |
| 50 | short getAsNumber(); |
| 51 | |
| 52 | /** |
| 53 | * Returns BGP Identifier of Open Message. |
| 54 | * |
| 55 | * @return BGP Identifier of Open Message |
| 56 | */ |
| 57 | int getBgpId(); |
| 58 | |
| 59 | /** |
| 60 | * Returns capabilities of Open Message. |
| 61 | * |
| 62 | * @return capabilities of Open Message |
| 63 | */ |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame^] | 64 | LinkedList<BgpValueType> getCapabilityTlv(); |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 65 | |
| 66 | /** |
| 67 | * Builder interface with get and set functions to build Open message. |
| 68 | */ |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame^] | 69 | interface Builder extends BgpMessage.Builder { |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 70 | |
| 71 | @Override |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame^] | 72 | BgpOpenMsg build() throws BgpParseException; |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 73 | |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 74 | /** |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 75 | * Sets hold time in Open Message and return its builder. |
| 76 | * |
Vidyashree Rama | f49b22c | 2015-10-13 15:30:24 +0530 | [diff] [blame] | 77 | * @param holdtime hold timer value in open message |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 78 | * @return builder by setting hold time |
| 79 | */ |
| 80 | Builder setHoldTime(short holdtime); |
| 81 | |
| 82 | /** |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 83 | * Sets AS number in Open Message and return its builder. |
| 84 | * |
Vidyashree Rama | f49b22c | 2015-10-13 15:30:24 +0530 | [diff] [blame] | 85 | * @param asNumber as number in open message |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 86 | * @return builder by setting asNumber |
| 87 | */ |
| 88 | Builder setAsNumber(short asNumber); |
| 89 | |
| 90 | /** |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 91 | * Sets BGP Identifier in Open Message and return its builder. |
| 92 | * |
Vidyashree Rama | f49b22c | 2015-10-13 15:30:24 +0530 | [diff] [blame] | 93 | * @param bgpId BGP Identifier in open message |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 94 | * @return builder by setting BGP Identifier |
| 95 | */ |
| 96 | Builder setBgpId(int bgpId); |
| 97 | |
| 98 | /** |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 99 | * Sets capabilities in Open Message and return its builder. |
| 100 | * |
Vidyashree Rama | f49b22c | 2015-10-13 15:30:24 +0530 | [diff] [blame] | 101 | * @param capabilityTlv capabilities in open message |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 102 | * @return builder by setting capabilities |
| 103 | */ |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame^] | 104 | Builder setCapabilityTlv(LinkedList<BgpValueType> capabilityTlv); |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 105 | |
Vidyashree Rama | f49b22c | 2015-10-13 15:30:24 +0530 | [diff] [blame] | 106 | /** |
| 107 | * Sets isLargeAsCapabilityTlvSet and return its builder. |
| 108 | * |
| 109 | * @param isLargeAsCapabilitySet |
| 110 | * boolean value to know whether large AS capability is set or not |
| 111 | * @return builder by setting capabilities |
| 112 | */ |
| 113 | Builder setLargeAsCapabilityTlv(boolean isLargeAsCapabilitySet); |
| 114 | |
| 115 | /** |
| 116 | * Sets isLsCapabilityTlvSet and return its builder. |
| 117 | * |
| 118 | * @param isLsCapabilitySet |
| 119 | * boolean value to know whether LS capability is set or not |
| 120 | * @return builder by setting capabilities |
| 121 | */ |
| 122 | Builder setLsCapabilityTlv(boolean isLsCapabilitySet); |
| 123 | |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 124 | @Override |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame^] | 125 | Builder setHeader(BgpHeader bgpMsgHeader); |
Vidyashree Rama | 6d4f84e | 2015-09-21 20:01:02 +0530 | [diff] [blame] | 126 | } |
| 127 | } |