blob: a8f48cbfcc9bfab12c383ec35105868523d9633a [file] [log] [blame]
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +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 */
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053016package org.onosproject.bgpio.protocol;
17
18import java.util.LinkedList;
19
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053020import org.onosproject.bgpio.exceptions.BgpParseException;
21import org.onosproject.bgpio.types.BgpHeader;
22import org.onosproject.bgpio.types.BgpValueType;
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053023
24/**
25 * Abstraction of an entity providing BGP Open Message.
26 */
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053027public interface BgpOpenMsg extends BgpMessage {
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053028
29 @Override
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053030 BgpHeader getHeader();
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053031
32 @Override
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053033 BgpVersion getVersion();
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053034
35 @Override
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053036 BgpType getType();
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053037
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 */
Shashikanth VH09792f02016-05-10 16:59:57 +053050 long getAsNumber();
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053051
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 VH5dd8dbe2015-11-26 13:22:18 +053064 LinkedList<BgpValueType> getCapabilityTlv();
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053065
66 /**
67 * Builder interface with get and set functions to build Open message.
68 */
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053069 interface Builder extends BgpMessage.Builder {
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053070
71 @Override
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053072 BgpOpenMsg build() throws BgpParseException;
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053073
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053074 /**
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053075 * Sets hold time in Open Message and return its builder.
76 *
Vidyashree Ramaf49b22c2015-10-13 15:30:24 +053077 * @param holdtime hold timer value in open message
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053078 * @return builder by setting hold time
79 */
80 Builder setHoldTime(short holdtime);
81
82 /**
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053083 * Sets AS number in Open Message and return its builder.
84 *
Vidyashree Ramaf49b22c2015-10-13 15:30:24 +053085 * @param asNumber as number in open message
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053086 * @return builder by setting asNumber
87 */
88 Builder setAsNumber(short asNumber);
89
90 /**
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053091 * Sets BGP Identifier in Open Message and return its builder.
92 *
Vidyashree Ramaf49b22c2015-10-13 15:30:24 +053093 * @param bgpId BGP Identifier in open message
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053094 * @return builder by setting BGP Identifier
95 */
96 Builder setBgpId(int bgpId);
97
98 /**
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +053099 * Sets capabilities in Open Message and return its builder.
100 *
Vidyashree Ramaf49b22c2015-10-13 15:30:24 +0530101 * @param capabilityTlv capabilities in open message
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +0530102 * @return builder by setting capabilities
103 */
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +0530104 Builder setCapabilityTlv(LinkedList<BgpValueType> capabilityTlv);
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +0530105
Vidyashree Ramaf49b22c2015-10-13 15:30:24 +0530106 /**
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
Shashikanth VH44967ec2016-02-04 19:46:16 +0530124 /**
125 * Sets flow specification capability and return its builder.
126 *
127 * @param isFlowSpecCapabilitySet boolean value to know whether flow specification capability is set or not
128 *
129 * @return builder by setting capabilities
130 */
131 Builder setFlowSpecCapabilityTlv(boolean isFlowSpecCapabilitySet);
132
133 /**
134 * Sets VPN flow specification capability and return its builder.
135 *
136 * @param isVpnFlowSpecCapabilitySet boolean value to know whether flow spec capability is set or not
137 *
138 * @return builder by setting capabilities
139 */
140 Builder setVpnFlowSpecCapabilityTlv(boolean isVpnFlowSpecCapabilitySet);
141
Shashikanth VHb650bfa2016-04-18 12:54:03 +0530142 /**
143 * Sets flow specification route distribution policy capability and return its builder.
144 *
145 * @param isFlowSpecRpdCapabilitySet boolean value to know whether flow spec RPD capability is set or not
146 *
147 * @return builder by setting capabilities
148 */
149 Builder setFlowSpecRpdCapabilityTlv(boolean isFlowSpecRpdCapabilitySet);
150
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +0530151 @Override
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +0530152 Builder setHeader(BgpHeader bgpMsgHeader);
Vidyashree Rama6d4f84e2015-09-21 20:01:02 +0530153 }
154}