Loading src/tests/p4/probe/probe-tfs/deploy.sh +2 −1 Original line number Diff line number Diff line # build the software cargo build --release --target=x86_64-unknown-linux-musl # uncomment the line below if you want to build it # cargo build --release --target=x86_64-unknown-linux-musl # build a .env file with the info from context and monitoring services Loading src/tests/p4/probe/probe-tfs/src/agent.rs +9 −8 Original line number Diff line number Diff line Loading @@ -58,13 +58,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { let kpi_id_trigger = kpi_id.clone(); let t1 = tokio::spawn(async move { loop { let monitoring_host = env::var("MONITORINGSERVICE_SERVICE_HOST").unwrap_or_else(|_| panic!("receiver: Could not find monitoring host!")); let monitoring_port = env::var("MONITORINGSERVICE_SERVICE_PORT_GRPC").unwrap_or_else(|_| panic!("receiver: Could not find monitoring port!")); let mut monitoring_client = MonitoringServiceClient::connect(format!("http://{}:{}", monitoring_host, monitoring_port)).await.unwrap(); println!("receiver: Connected to the monitoring service!"); loop { println!("receiver: Awaiting for new connection!"); let (stream, _socket) = listener.accept().await.unwrap(); Loading Loading @@ -95,7 +94,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { let now = SystemTime::now() .duration_since(SystemTime::UNIX_EPOCH) .unwrap() .as_millis(); // See struct std::time::Duration methods .as_secs(); // See struct std::time::Duration methods let kpi = Kpi { kpi_id: kpi_id.clone(), Loading @@ -108,7 +107,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { } ), }; // println!("Request: {:?}", kpi); let response = monitoring_client.include_kpi(tonic::Request::new(kpi)).await; // println!("Response: {:?}", response); if response.is_err() { println!("receiver: Issue with the response from monitoring!"); } Loading Loading @@ -162,7 +163,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { let _response = monitoring_client.set_kpi(tonic::Request::new(kpi_descriptor)).await.unwrap().into_inner(); let mut kpi_id = kpi_id_trigger.lock().await; println!("stream: KPI ID: {:?}", &kpi_id); println!("stream: KPI ID: {:?}", _response); *kpi_id = Some(_response.clone()); let mut should_ping = ping_trigger.lock().await; *should_ping = true; Loading src/tests/p4/probe/probe-tfs/target/x86_64-unknown-linux-musl/release/tfsagent −1.73 KiB (8.36 MiB) File changed.No diff preview for this file type. View original file View changed file Loading
src/tests/p4/probe/probe-tfs/deploy.sh +2 −1 Original line number Diff line number Diff line # build the software cargo build --release --target=x86_64-unknown-linux-musl # uncomment the line below if you want to build it # cargo build --release --target=x86_64-unknown-linux-musl # build a .env file with the info from context and monitoring services Loading
src/tests/p4/probe/probe-tfs/src/agent.rs +9 −8 Original line number Diff line number Diff line Loading @@ -58,13 +58,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { let kpi_id_trigger = kpi_id.clone(); let t1 = tokio::spawn(async move { loop { let monitoring_host = env::var("MONITORINGSERVICE_SERVICE_HOST").unwrap_or_else(|_| panic!("receiver: Could not find monitoring host!")); let monitoring_port = env::var("MONITORINGSERVICE_SERVICE_PORT_GRPC").unwrap_or_else(|_| panic!("receiver: Could not find monitoring port!")); let mut monitoring_client = MonitoringServiceClient::connect(format!("http://{}:{}", monitoring_host, monitoring_port)).await.unwrap(); println!("receiver: Connected to the monitoring service!"); loop { println!("receiver: Awaiting for new connection!"); let (stream, _socket) = listener.accept().await.unwrap(); Loading Loading @@ -95,7 +94,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { let now = SystemTime::now() .duration_since(SystemTime::UNIX_EPOCH) .unwrap() .as_millis(); // See struct std::time::Duration methods .as_secs(); // See struct std::time::Duration methods let kpi = Kpi { kpi_id: kpi_id.clone(), Loading @@ -108,7 +107,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { } ), }; // println!("Request: {:?}", kpi); let response = monitoring_client.include_kpi(tonic::Request::new(kpi)).await; // println!("Response: {:?}", response); if response.is_err() { println!("receiver: Issue with the response from monitoring!"); } Loading Loading @@ -162,7 +163,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { let _response = monitoring_client.set_kpi(tonic::Request::new(kpi_descriptor)).await.unwrap().into_inner(); let mut kpi_id = kpi_id_trigger.lock().await; println!("stream: KPI ID: {:?}", &kpi_id); println!("stream: KPI ID: {:?}", _response); *kpi_id = Some(_response.clone()); let mut should_ping = ping_trigger.lock().await; *should_ping = true; Loading
src/tests/p4/probe/probe-tfs/target/x86_64-unknown-linux-musl/release/tfsagent −1.73 KiB (8.36 MiB) File changed.No diff preview for this file type. View original file View changed file