Compare commits

...

2 Commits

Author SHA1 Message Date
cc3842b384 Add skeleton of announce_to_peer function
Some checks failed
Rust / build (push) Has been cancelled
2024-10-07 10:47:24 +00:00
f55066c1fb Fix build: remove call to removed function 2024-10-07 10:27:56 +00:00
4 changed files with 47 additions and 8 deletions

View File

@ -77,8 +77,20 @@ message PeerStatus {
message PeerStatusResponse { repeated PeerStatus peer_status = 1; }
message AnnouncementRequest {
string peer_name = 1;
Prefix prefix = 2;
repeated string large_communities = 3;
}
message AnnouncementResponse {}
// BGPServerAdminService implements an administrative interface to
// view the status and control the operation of this BGP server.
service BGPServerAdminService {
// Get the status of a specific peer.
rpc PeerStatus(PeerStatusRequest) returns (PeerStatusResponse);
// Make a BGP announcement to a specific peer.
rpc AnnounceToPeer(AnnouncementRequest) returns (AnnouncementResponse);
}

View File

@ -77,8 +77,20 @@ message PeerStatus {
message PeerStatusResponse { repeated PeerStatus peer_status = 1; }
message AnnouncementRequest {
string peer_name = 1;
Prefix prefix = 2;
repeated string large_communities = 3;
}
message AnnouncementResponse {}
// BGPServerAdminService implements an administrative interface to
// view the status and control the operation of this BGP server.
service BGPServerAdminService {
// Get the status of a specific peer.
rpc PeerStatus(PeerStatusRequest) returns (PeerStatusResponse);
// Make a BGP announcement to a specific peer.
rpc AnnounceToPeer(AnnouncementRequest) returns (AnnouncementResponse);
}

View File

@ -1288,13 +1288,6 @@ where
async fn handle_established_msg(&mut self, msg: BGPSubmessage) -> Result<()> {
match msg {
BGPSubmessage::UpdateMessage(u) => {
if !self.decide_accept_message(&u.path_attributes) {
info!(
"Rejected message due to path attributes: {:?}",
u.path_attributes
);
}
// Have a seperate path for calling Multiprotocol NLRI processing.
for attr in &u.path_attributes {
match attr {

View File

@ -20,6 +20,8 @@ use crate::rib_manager::RouteManagerCommands;
use crate::route_server::route_server::bgp_server_admin_service_server::BgpServerAdminService;
use crate::route_server::route_server::route_service_server::RouteService;
use crate::route_server::route_server::AddressFamily;
use crate::route_server::route_server::AnnouncementRequest;
use crate::route_server::route_server::AnnouncementResponse;
use crate::route_server::route_server::DumpPathsRequest;
use crate::route_server::route_server::DumpPathsResponse;
use crate::route_server::route_server::Path;
@ -40,7 +42,7 @@ use tokio::sync::oneshot;
use tokio_stream::wrappers::ReceiverStream;
use tonic::Response;
use tonic::Status;
use tracing::warn;
use tracing::{info, warn};
pub mod route_server {
tonic::include_proto!("bgpd.grpc");
@ -139,6 +141,26 @@ impl BgpServerAdminService for RouteServer {
Ok(Response::new(result))
}
async fn announce_to_peer(
&self,
request: tonic::Request<AnnouncementRequest>,
) -> Result<tonic::Response<AnnouncementResponse>, Status> {
info!("Processing announce_to_peer: {:?}", request);
let request = request.get_ref();
if let Some(peer) = self.peer_state_machines.get(&request.peer_name) {
info!("Would make announcement to peer: {}", &request.peer_name);
} else {
return Err(Status::invalid_argument(format!(
"No such peer: {}",
&request.peer_name,
)));
}
Ok(Response::new(AnnouncementResponse::default()))
}
}
#[tonic::async_trait]