22// License, v. 2.0. If a copy of the MPL was not distributed with this
33// file, You can obtain one at https://mozilla.org/MPL/2.0/.
44
5- use bgp :: config:: PeerConfig ;
6- use bgp :: session:: { FsmStateKind , MessageHistory } ;
5+ use crate :: config:: PeerConfig ;
6+ use crate :: session:: FsmStateKind ;
77use rdb:: { ImportExportPolicy , Path , PolicyAction , Prefix4 } ;
88use schemars:: JsonSchema ;
99use serde:: { Deserialize , Serialize } ;
1010use std:: collections:: { BTreeSet , HashMap } ;
11- use std:: num:: NonZeroU8 ;
1211use std:: time:: Duration ;
1312use std:: {
1413 collections:: BTreeMap ,
@@ -30,32 +29,13 @@ pub struct Router {
3029 pub graceful_shutdown : bool ,
3130}
3231
33- #[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
34- pub struct DeleteRouterRequest {
35- /// Autonomous system number for the router to remove
36- pub asn : u32 ,
37- }
38-
39- #[ derive( Debug , Deserialize , Serialize , JsonSchema , Clone ) ]
40- pub struct NeighborSelector {
41- pub asn : u32 ,
42- pub addr : IpAddr ,
43- }
44-
4532#[ derive( Debug , Deserialize , Serialize , JsonSchema , Clone ) ]
4633pub enum NeighborResetOp {
4734 Hard ,
4835 SoftInbound ,
4936 SoftOutbound ,
5037}
5138
52- #[ derive( Debug , Deserialize , Serialize , JsonSchema , Clone ) ]
53- pub struct NeighborResetRequest {
54- pub asn : u32 ,
55- pub addr : IpAddr ,
56- pub op : NeighborResetOp ,
57- }
58-
5939#[ derive( Debug , Deserialize , Serialize , JsonSchema , Clone , PartialEq ) ]
6040pub struct Neighbor {
6141 pub asn : u32 ,
@@ -154,12 +134,6 @@ impl Neighbor {
154134 }
155135}
156136
157- #[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
158- pub struct DeleteNeighborRequest {
159- pub asn : u32 ,
160- pub addr : IpAddr ,
161- }
162-
163137#[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
164138pub struct AddExportPolicyRequest {
165139 /// ASN of the router to apply the export policy to.
@@ -196,12 +170,6 @@ pub struct Withdraw4Request {
196170 pub prefixes : Vec < Prefix4 > ,
197171}
198172
199- #[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
200- pub struct AsnSelector {
201- /// ASN of the router to get imported prefixes from.
202- pub asn : u32 ,
203- }
204-
205173#[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
206174pub struct GracefulShutdownRequest {
207175 /// ASN of the router to gracefully shut down.
@@ -216,18 +184,6 @@ pub struct GetOriginated4Request {
216184 pub asn : u32 ,
217185}
218186
219- #[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
220- pub struct BestpathFanoutRequest {
221- /// Maximum number of equal-cost paths for ECMP forwarding
222- pub fanout : NonZeroU8 ,
223- }
224-
225- #[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
226- pub struct BestpathFanoutResponse {
227- /// Current maximum number of equal-cost paths for ECMP forwarding
228- pub fanout : NonZeroU8 ,
229- }
230-
231187#[ derive( Debug , Deserialize , Serialize , JsonSchema ) ]
232188pub struct GetRoutersRequest { }
233189
@@ -263,6 +219,18 @@ pub struct PeerInfo {
263219 pub timers : PeerTimers ,
264220}
265221
222+ #[ derive( Debug , Deserialize , Serialize , JsonSchema , Clone ) ]
223+ pub struct CheckerSource {
224+ pub asn : u32 ,
225+ pub code : String ,
226+ }
227+
228+ #[ derive( Debug , Deserialize , Serialize , JsonSchema , Clone ) ]
229+ pub struct ShaperSource {
230+ pub asn : u32 ,
231+ pub code : String ,
232+ }
233+
266234/// Apply changes to an ASN.
267235#[ derive( Debug , Deserialize , Serialize , JsonSchema , Clone ) ]
268236pub struct ApplyRequest {
@@ -314,31 +282,9 @@ pub struct BgpPeerConfig {
314282 pub vlan_id : Option < u16 > ,
315283}
316284
317- #[ derive( Debug , Deserialize , JsonSchema , Clone ) ]
318- pub struct MessageHistoryRequest {
319- pub asn : u32 ,
320- }
321-
322- #[ derive( Debug , Serialize , JsonSchema , Clone ) ]
323- pub struct MessageHistoryResponse {
324- pub by_peer : HashMap < IpAddr , MessageHistory > ,
325- }
326-
327285#[ derive( Debug , Deserialize , Serialize , JsonSchema , Clone ) ]
328286pub struct Rib ( BTreeMap < String , BTreeSet < Path > > ) ;
329287
330- #[ derive( Debug , Deserialize , Serialize , JsonSchema , Clone ) ]
331- pub struct CheckerSource {
332- pub asn : u32 ,
333- pub code : String ,
334- }
335-
336- #[ derive( Debug , Deserialize , Serialize , JsonSchema , Clone ) ]
337- pub struct ShaperSource {
338- pub asn : u32 ,
339- pub code : String ,
340- }
341-
342288pub enum PolicySource {
343289 Checker ( String ) ,
344290 Shaper ( String ) ,
0 commit comments