Compare commits
2 Commits
8c371648d0
...
cc3842b384
| Author | SHA1 | Date | |
|---|---|---|---|
| cc3842b384 | |||
| f55066c1fb |
@ -77,8 +77,20 @@ message PeerStatus {
|
|||||||
|
|
||||||
message PeerStatusResponse { repeated PeerStatus peer_status = 1; }
|
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
|
// BGPServerAdminService implements an administrative interface to
|
||||||
// view the status and control the operation of this BGP server.
|
// view the status and control the operation of this BGP server.
|
||||||
service BGPServerAdminService {
|
service BGPServerAdminService {
|
||||||
|
// Get the status of a specific peer.
|
||||||
rpc PeerStatus(PeerStatusRequest) returns (PeerStatusResponse);
|
rpc PeerStatus(PeerStatusRequest) returns (PeerStatusResponse);
|
||||||
|
|
||||||
|
// Make a BGP announcement to a specific peer.
|
||||||
|
rpc AnnounceToPeer(AnnouncementRequest) returns (AnnouncementResponse);
|
||||||
}
|
}
|
||||||
@ -77,8 +77,20 @@ message PeerStatus {
|
|||||||
|
|
||||||
message PeerStatusResponse { repeated PeerStatus peer_status = 1; }
|
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
|
// BGPServerAdminService implements an administrative interface to
|
||||||
// view the status and control the operation of this BGP server.
|
// view the status and control the operation of this BGP server.
|
||||||
service BGPServerAdminService {
|
service BGPServerAdminService {
|
||||||
|
// Get the status of a specific peer.
|
||||||
rpc PeerStatus(PeerStatusRequest) returns (PeerStatusResponse);
|
rpc PeerStatus(PeerStatusRequest) returns (PeerStatusResponse);
|
||||||
|
|
||||||
|
// Make a BGP announcement to a specific peer.
|
||||||
|
rpc AnnounceToPeer(AnnouncementRequest) returns (AnnouncementResponse);
|
||||||
}
|
}
|
||||||
@ -1288,13 +1288,6 @@ where
|
|||||||
async fn handle_established_msg(&mut self, msg: BGPSubmessage) -> Result<()> {
|
async fn handle_established_msg(&mut self, msg: BGPSubmessage) -> Result<()> {
|
||||||
match msg {
|
match msg {
|
||||||
BGPSubmessage::UpdateMessage(u) => {
|
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.
|
// Have a seperate path for calling Multiprotocol NLRI processing.
|
||||||
for attr in &u.path_attributes {
|
for attr in &u.path_attributes {
|
||||||
match attr {
|
match attr {
|
||||||
|
|||||||
@ -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::bgp_server_admin_service_server::BgpServerAdminService;
|
||||||
use crate::route_server::route_server::route_service_server::RouteService;
|
use crate::route_server::route_server::route_service_server::RouteService;
|
||||||
use crate::route_server::route_server::AddressFamily;
|
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::DumpPathsRequest;
|
||||||
use crate::route_server::route_server::DumpPathsResponse;
|
use crate::route_server::route_server::DumpPathsResponse;
|
||||||
use crate::route_server::route_server::Path;
|
use crate::route_server::route_server::Path;
|
||||||
@ -40,7 +42,7 @@ use tokio::sync::oneshot;
|
|||||||
use tokio_stream::wrappers::ReceiverStream;
|
use tokio_stream::wrappers::ReceiverStream;
|
||||||
use tonic::Response;
|
use tonic::Response;
|
||||||
use tonic::Status;
|
use tonic::Status;
|
||||||
use tracing::warn;
|
use tracing::{info, warn};
|
||||||
|
|
||||||
pub mod route_server {
|
pub mod route_server {
|
||||||
tonic::include_proto!("bgpd.grpc");
|
tonic::include_proto!("bgpd.grpc");
|
||||||
@ -139,6 +141,26 @@ impl BgpServerAdminService for RouteServer {
|
|||||||
|
|
||||||
Ok(Response::new(result))
|
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]
|
#[tonic::async_trait]
|
||||||
|
|||||||
Reference in New Issue
Block a user