diff --git a/build.rs b/build.rs index cd0edb41..a33b97a4 100644 --- a/build.rs +++ b/build.rs @@ -16,8 +16,8 @@ fn main() -> Result<(), Box> { .file_descriptor_set_path(out_dir.join("descriptor.bin")) .compile( &[ - "./proto/runtime/v1/runtime.proto", - "./proto/provider/v1/provider.proto", + "./proto/intent_brokering/runtime/v1/runtime.proto", + "./proto/intent_brokering/provider/v1/provider.proto", ], &["./proto/"], )?; diff --git a/docs/adr/0020-integration-and-e2e-testing.md b/docs/adr/0020-integration-and-e2e-testing.md index f6f1d2fd..4aca0d21 100644 --- a/docs/adr/0020-integration-and-e2e-testing.md +++ b/docs/adr/0020-integration-and-e2e-testing.md @@ -28,7 +28,7 @@ well as from the CI. Integration tests will be invoking the Chariott runtime server code directly, without using the [upstream gRPC -layer](../../proto/chariott/runtime/v1/runtime.proto). We will not mock out any parts +layer](../../intent_brokering/proto/intent_brokering/runtime/v1/runtime.proto). We will not mock out any parts from the Chariott runtime when integration testing, hence we will need to set up a provider that is exposing a gRPC endpoint in order to handle intent fulfillments. @@ -88,4 +88,4 @@ This approach is equivalent to the setup in [ADR `cargo test`, and come with the advantages a test framework has without taking a dependency on test framework which we do not already use. -[charc]: ../../tools/charc.md +[charc]: ../../intent_brokering/tools/charc.md diff --git a/intent_brokering/ess/benches/load_bench.rs b/intent_brokering/ess/benches/load_bench.rs index 2d807fdc..616cc4da 100644 --- a/intent_brokering/ess/benches/load_bench.rs +++ b/intent_brokering/ess/benches/load_bench.rs @@ -1,7 +1,7 @@ -use intent_brokering_common::tokio_runtime_fork::BuilderExt; use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; use ess::EventSubSystem; use futures::StreamExt; +use intent_brokering_common::tokio_runtime_fork::BuilderExt; use std::sync::Arc; use tokio::sync::broadcast::{self, Receiver}; type Ess = EventSubSystem; diff --git a/intent_brokering/examples/applications/cloud-object-detection/src/detection.rs b/intent_brokering/examples/applications/cloud-object-detection/src/detection.rs index fe5c2e8a..79bf6779 100644 --- a/intent_brokering/examples/applications/cloud-object-detection/src/detection.rs +++ b/intent_brokering/examples/applications/cloud-object-detection/src/detection.rs @@ -2,8 +2,8 @@ // Licensed under the MIT license. // SPDX-License-Identifier: MIT -use intent_brokering_common::error::{Error, ResultExt}; use examples_common::examples::detection::{DetectRequest, DetectResponse, DetectionObject}; +use intent_brokering_common::error::{Error, ResultExt}; use reqwest::Client; use serde::{Deserialize, Serialize}; use std::{env, mem}; diff --git a/intent_brokering/examples/applications/cloud-object-detection/src/main.rs b/intent_brokering/examples/applications/cloud-object-detection/src/main.rs index 066d80c6..c6eab63b 100644 --- a/intent_brokering/examples/applications/cloud-object-detection/src/main.rs +++ b/intent_brokering/examples/applications/cloud-object-detection/src/main.rs @@ -2,16 +2,16 @@ // Licensed under the MIT license. // SPDX-License-Identifier: MIT -mod intent_provider; mod detection; +mod intent_provider; +use examples_common::chariott; use intent_brokering_common::error::Error; use intent_brokering_common::shutdown::RouterExt as _; use intent_brokering_proto::{ provider::provider_service_server::ProviderServiceServer, runtime::{intent_registration::Intent, intent_service_registration::ExecutionLocality}, }; -use examples_common::chariott; use tonic::transport::Server; use crate::intent_provider::IntentProvider; diff --git a/intent_brokering/examples/applications/dog-mode-logic/src/dog_mode_status.rs b/intent_brokering/examples/applications/dog-mode-logic/src/dog_mode_status.rs index d73e28e6..e8b4535a 100644 --- a/intent_brokering/examples/applications/dog-mode-logic/src/dog_mode_status.rs +++ b/intent_brokering/examples/applications/dog-mode-logic/src/dog_mode_status.rs @@ -4,7 +4,6 @@ use anyhow::{anyhow, Error}; use async_stream::try_stream; -use intent_brokering_proto::common::Blob; use examples_common::{ chariott::{ api::{Chariott, ChariottExt as _, GrpcChariott}, @@ -13,6 +12,7 @@ use examples_common::{ examples::proto::detection::{DetectRequest, DetectResponse}, }; use futures::{stream::BoxStream, TryStreamExt}; +use intent_brokering_proto::common::Blob; use tokio_stream::StreamExt; use tracing::{info, warn}; diff --git a/intent_brokering/examples/applications/dog-mode-logic/src/main.rs b/intent_brokering/examples/applications/dog-mode-logic/src/main.rs index 76cd5908..63a5772a 100644 --- a/intent_brokering/examples/applications/dog-mode-logic/src/main.rs +++ b/intent_brokering/examples/applications/dog-mode-logic/src/main.rs @@ -384,8 +384,8 @@ async fn on_dog_mode_timer( #[cfg(test)] mod tests { use async_trait::async_trait; - use intent_brokering_common::error::Error; use examples_common::chariott::{api::Service, inspection::Entry}; + use intent_brokering_common::error::Error; use super::*; diff --git a/intent_brokering/examples/applications/invoke-command/src/main.rs b/intent_brokering/examples/applications/invoke-command/src/main.rs index 08858b23..af881ce4 100644 --- a/intent_brokering/examples/applications/invoke-command/src/main.rs +++ b/intent_brokering/examples/applications/invoke-command/src/main.rs @@ -6,13 +6,13 @@ mod intent_provider; use std::sync::Arc; +use examples_common::chariott; use intent_brokering_common::error::Error; use intent_brokering_common::shutdown::RouterExt as _; use intent_brokering_proto::{ provider::provider_service_server::ProviderServiceServer, runtime::{intent_registration::Intent, intent_service_registration::ExecutionLocality}, }; -use examples_common::chariott; use tonic::transport::Server; use crate::intent_provider::IntentProvider; diff --git a/intent_brokering/examples/applications/kv-app/README.md b/intent_brokering/examples/applications/kv-app/README.md index 413e87f1..96dcc5bc 100644 --- a/intent_brokering/examples/applications/kv-app/README.md +++ b/intent_brokering/examples/applications/kv-app/README.md @@ -66,7 +66,7 @@ Open a channel for receiving events: ```bash grpcurl -v -plaintext -import-path proto -proto \ - intent_brokering/proto/streaming/v1/streaming.proto 0.0.0.0:50064 \ + intent_brokering/proto/intent_brokering/streaming/v1/streaming.proto 0.0.0.0:50064 \ intent_brokering.streaming.v1.ChannelService/Open | tee events.log & ``` diff --git a/intent_brokering/examples/applications/kv-app/src/main.rs b/intent_brokering/examples/applications/kv-app/src/main.rs index 4bf977b3..84cde2d3 100644 --- a/intent_brokering/examples/applications/kv-app/src/main.rs +++ b/intent_brokering/examples/applications/kv-app/src/main.rs @@ -6,6 +6,7 @@ mod intent_provider; use std::sync::Arc; +use examples_common::chariott; use intent_brokering_common::error::Error; use intent_brokering_common::shutdown::RouterExt as _; use intent_brokering_proto::{ @@ -13,7 +14,6 @@ use intent_brokering_proto::{ runtime::{intent_registration::Intent, intent_service_registration::ExecutionLocality}, streaming::channel_service_server::ChannelServiceServer, }; -use examples_common::chariott; use tonic::transport::Server; use crate::intent_provider::{IntentProvider, StreamingStore}; diff --git a/intent_brokering/examples/applications/local-object-detection/src/detection.rs b/intent_brokering/examples/applications/local-object-detection/src/detection.rs index 9ccb24d5..aa7870c3 100644 --- a/intent_brokering/examples/applications/local-object-detection/src/detection.rs +++ b/intent_brokering/examples/applications/local-object-detection/src/detection.rs @@ -2,9 +2,9 @@ // Licensed under the MIT license. // SPDX-License-Identifier: MIT -use intent_brokering_common::error::Error; use examples_common::examples::detection::{DetectRequest, DetectResponse, DetectionObject}; use image::{io::Reader, DynamicImage, GenericImageView}; +use intent_brokering_common::error::Error; use ndarray::prelude::Array; use serde::{Deserialize, Serialize}; use std::{ diff --git a/intent_brokering/examples/applications/local-object-detection/src/main.rs b/intent_brokering/examples/applications/local-object-detection/src/main.rs index 74049db9..4eddbf05 100644 --- a/intent_brokering/examples/applications/local-object-detection/src/main.rs +++ b/intent_brokering/examples/applications/local-object-detection/src/main.rs @@ -2,16 +2,16 @@ // Licensed under the MIT license. // SPDX-License-Identifier: MIT -mod intent_provider; mod detection; +mod intent_provider; +use examples_common::chariott; use intent_brokering_common::error::Error; use intent_brokering_common::shutdown::RouterExt as _; use intent_brokering_proto::{ provider::provider_service_server::ProviderServiceServer, runtime::{intent_registration::Intent, intent_service_registration::ExecutionLocality}, }; -use examples_common::chariott; use tonic::transport::Server; use crate::intent_provider::IntentProvider; diff --git a/intent_brokering/examples/applications/lt-consumer/src/main.rs b/intent_brokering/examples/applications/lt-consumer/src/main.rs index 4622c9ae..2bc28974 100644 --- a/intent_brokering/examples/applications/lt-consumer/src/main.rs +++ b/intent_brokering/examples/applications/lt-consumer/src/main.rs @@ -3,16 +3,16 @@ // SPDX-License-Identifier: MIT use bollard::{container::StatsOptions, Docker}; -use intent_brokering_common::{ - config::env, - error::{Error, ResultExt}, -}; use examples_common::chariott::{ self, api::{Chariott, GrpcChariott}, value::Value, }; use futures_util::stream::StreamExt; +use intent_brokering_common::{ + config::env, + error::{Error, ResultExt}, +}; use metrics_util::Summary; use serde::Serialize; use std::{ diff --git a/intent_brokering/examples/applications/lt-provider/src/main.rs b/intent_brokering/examples/applications/lt-provider/src/main.rs index 462f7aa0..469bf5fc 100644 --- a/intent_brokering/examples/applications/lt-provider/src/main.rs +++ b/intent_brokering/examples/applications/lt-provider/src/main.rs @@ -7,6 +7,8 @@ use std::{ time::Duration, }; +use examples_common::chariott; +use examples_common::chariott::value::Value; use intent_brokering_common::{ config::env, error::{Error, ResultExt as _}, @@ -19,8 +21,6 @@ use intent_brokering_proto::{ }, runtime::{intent_registration::Intent, intent_service_registration::ExecutionLocality}, }; -use examples_common::chariott; -use examples_common::chariott::value::Value; use rand::{rngs::SmallRng, SeedableRng}; use rand_distr::{DistIter, Distribution, Normal}; use tokio::time::sleep; diff --git a/intent_brokering/examples/applications/mock-vas/README.md b/intent_brokering/examples/applications/mock-vas/README.md index d1452037..e401eba4 100644 --- a/intent_brokering/examples/applications/mock-vas/README.md +++ b/intent_brokering/examples/applications/mock-vas/README.md @@ -18,7 +18,7 @@ From the root directory: 1. In a terminal (A) start Chariott with `cargo run`. 2. In another terminal (B) start the mock-vas with `cargo run -p mock-vas`. 3. In a terminal (C), open a channel to the mock-vas with `grpcurl -v -plaintext \ - -import-path proto -proto proto/streaming/v1/streaming.proto \ + -import-path proto -proto proto/intent_brokering/streaming/v1/streaming.proto \ localhost:50051 intent_brokering.streaming.v1.ChannelService/Open` and take a note of the returned channel id in the metadata _x-chariott-channel-id_. 4. In another terminal D call the following, using the channel id from the @@ -51,7 +51,7 @@ From the root directory: In order to do so, you need to: -- Implement the [streaming proto](../../../proto/streaming/v1/streaming.proto) +- Implement the [streaming proto](../../../proto/intent_brokering/streaming/v1/streaming.proto) and specifically the `OpenRequest` endpoint with a service. - This is done in the common examples library in [streaming.rs](../../common/src/chariott/streaming.rs) - Make sure to serve this service with your gRPC server. diff --git a/intent_brokering/examples/applications/mock-vas/src/communication.rs b/intent_brokering/examples/applications/mock-vas/src/communication.rs index c210745b..1ad05650 100644 --- a/intent_brokering/examples/applications/mock-vas/src/communication.rs +++ b/intent_brokering/examples/applications/mock-vas/src/communication.rs @@ -2,8 +2,8 @@ // Licensed under the MIT license. // SPDX-License-Identifier: MIT -use intent_brokering_common::shutdown::{ctrl_c_cancellation, RouterExt}; use futures::future::join_all; +use intent_brokering_common::shutdown::{ctrl_c_cancellation, RouterExt}; use std::net::SocketAddr; use std::sync::Arc; use tokio::spawn; diff --git a/intent_brokering/examples/applications/mock-vas/src/intent_provider.rs b/intent_brokering/examples/applications/mock-vas/src/intent_provider.rs index e1a6ba71..6e183b17 100644 --- a/intent_brokering/examples/applications/mock-vas/src/intent_provider.rs +++ b/intent_brokering/examples/applications/mock-vas/src/intent_provider.rs @@ -7,6 +7,10 @@ use std::sync::Arc; use std::vec; use async_trait::async_trait; +use examples_common::chariott; +use examples_common::chariott::inspection::{fulfill, Entry}; +use examples_common::chariott::streaming::ProtoExt as _; +use examples_common::chariott::value::Value; use intent_brokering_proto::{ common::{ discover_fulfillment::Service, DiscoverFulfillment, FulfillmentEnum, FulfillmentMessage, @@ -14,10 +18,6 @@ use intent_brokering_proto::{ }, provider::{provider_service_server::ProviderService, FulfillRequest, FulfillResponse}, }; -use examples_common::chariott; -use examples_common::chariott::inspection::{fulfill, Entry}; -use examples_common::chariott::streaming::ProtoExt as _; -use examples_common::chariott::value::Value; use tonic::{Request, Response, Status}; use url::Url; diff --git a/intent_brokering/examples/applications/mock-vas/src/main.rs b/intent_brokering/examples/applications/mock-vas/src/main.rs index a1d08770..a920f84b 100644 --- a/intent_brokering/examples/applications/mock-vas/src/main.rs +++ b/intent_brokering/examples/applications/mock-vas/src/main.rs @@ -2,15 +2,15 @@ // Licensed under the MIT license. // SPDX-License-Identifier: MIT -mod intent_provider; mod communication; +mod intent_provider; mod simulation; +use examples_common::chariott; use intent_brokering_common::error::Error; use intent_brokering_proto::runtime::{ intent_registration::Intent, intent_service_registration::ExecutionLocality, }; -use examples_common::chariott; chariott::provider::main!(wain); diff --git a/intent_brokering/examples/applications/mock-vas/src/simulation.rs b/intent_brokering/examples/applications/mock-vas/src/simulation.rs index fa182c83..4455d8d7 100644 --- a/intent_brokering/examples/applications/mock-vas/src/simulation.rs +++ b/intent_brokering/examples/applications/mock-vas/src/simulation.rs @@ -2,8 +2,8 @@ // Licensed under the MIT license. // SPDX-License-Identifier: MIT -use intent_brokering_common::error::{Error, ResultExt}; use examples_common::chariott::value::Value; +use intent_brokering_common::error::{Error, ResultExt}; use std::{env, sync::Arc}; use tokio::sync::broadcast::{self, Sender}; use tokio_util::sync::CancellationToken; diff --git a/intent_brokering/examples/applications/proto/examples/detection/v1/detection.proto b/intent_brokering/examples/applications/proto/examples/detection/v1/detection.proto index f17e347b..1b89b3bd 100644 --- a/intent_brokering/examples/applications/proto/examples/detection/v1/detection.proto +++ b/intent_brokering/examples/applications/proto/examples/detection/v1/detection.proto @@ -6,7 +6,7 @@ syntax = "proto3"; package examples.detection.v1; -import "common/v1/common.proto"; +import "intent_brokering/common/v1/common.proto"; message DetectRequest { intent_brokering.common.v1.Blob blob = 1; diff --git a/intent_brokering/examples/applications/simple-provider/src/main.rs b/intent_brokering/examples/applications/simple-provider/src/main.rs index 9e50dd60..0be479d1 100644 --- a/intent_brokering/examples/applications/simple-provider/src/main.rs +++ b/intent_brokering/examples/applications/simple-provider/src/main.rs @@ -8,6 +8,7 @@ use std::{net::SocketAddr, sync::Arc, time::Duration}; use url::Url; +use examples_common::chariott; use intent_brokering_common::error::Error; use intent_brokering_common::shutdown::RouterExt as _; use intent_brokering_proto::{ @@ -18,7 +19,6 @@ use intent_brokering_proto::{ IntentServiceRegistration, RegisterRequest, RegistrationState, }, }; -use examples_common::chariott; use tokio::time::sleep; use tonic::transport::{Channel, Server}; use tracing::warn; diff --git a/intent_brokering/examples/applications/simulated-camera/README.md b/intent_brokering/examples/applications/simulated-camera/README.md index 5a3b133f..d3567557 100644 --- a/intent_brokering/examples/applications/simulated-camera/README.md +++ b/intent_brokering/examples/applications/simulated-camera/README.md @@ -15,7 +15,7 @@ manual mode where you specify the frame rate event yourself. `intent_brokering/examples/applications/simulated-camera` directory. 5. In another terminal, open a channel to the simulated-camera with `grpcurl -v \ -plaintext -import-path proto -proto \ - intent_brokering/proto/streaming/v1/streaming.proto localhost:50066 \ + intent_brokering/proto/intent_brokering/streaming/v1/streaming.proto localhost:50066 \ intent_brokering.streaming.v1.ChannelService/Open` and take a note of the returned channel id in the metadata _x-chariott-channel-id_. 6. In yet another terminal, call the following, using the channel id from the diff --git a/intent_brokering/examples/applications/simulated-camera/src/camera.rs b/intent_brokering/examples/applications/simulated-camera/src/camera.rs index fc2a4a38..cd6fdaac 100644 --- a/intent_brokering/examples/applications/simulated-camera/src/camera.rs +++ b/intent_brokering/examples/applications/simulated-camera/src/camera.rs @@ -3,9 +3,9 @@ // SPDX-License-Identifier: MIT use async_stream::try_stream; -use intent_brokering_common::error::Error; use core::panic; use examples_common::chariott::value::Value; +use intent_brokering_common::error::Error; use std::collections::HashMap; use std::path::PathBuf; use std::sync::Arc; diff --git a/intent_brokering/examples/applications/simulated-camera/src/communication.rs b/intent_brokering/examples/applications/simulated-camera/src/communication.rs index d9554dfa..6b681f8a 100644 --- a/intent_brokering/examples/applications/simulated-camera/src/communication.rs +++ b/intent_brokering/examples/applications/simulated-camera/src/communication.rs @@ -5,6 +5,7 @@ use std::sync::Arc; use std::{env::args, net::SocketAddr}; +use futures::future::join_all; use intent_brokering_common::{ error::{Error, ResultExt as _}, shutdown::{ctrl_c_cancellation, RouterExt as _}, @@ -13,7 +14,6 @@ use intent_brokering_proto::{ provider::provider_service_server::ProviderServiceServer, streaming::channel_service_server::ChannelServiceServer, }; -use futures::future::join_all; use tokio::spawn; use tonic::transport::Server; use url::Url; diff --git a/intent_brokering/examples/applications/simulated-camera/src/main.rs b/intent_brokering/examples/applications/simulated-camera/src/main.rs index bf9e7e9d..57e09848 100644 --- a/intent_brokering/examples/applications/simulated-camera/src/main.rs +++ b/intent_brokering/examples/applications/simulated-camera/src/main.rs @@ -3,14 +3,14 @@ // SPDX-License-Identifier: MIT mod camera; -mod intent_provider; mod communication; +mod intent_provider; +use examples_common::chariott; use intent_brokering_common::error::Error; use intent_brokering_proto::runtime::{ intent_registration::Intent, intent_service_registration::ExecutionLocality, }; -use examples_common::chariott; chariott::provider::main!(wain); diff --git a/intent_brokering/examples/common/src/chariott/api.rs b/intent_brokering/examples/common/src/chariott/api.rs index 23e8a5d2..2ab7aa13 100644 --- a/intent_brokering/examples/common/src/chariott/api.rs +++ b/intent_brokering/examples/common/src/chariott/api.rs @@ -15,6 +15,7 @@ use std::{ use super::{inspection::Entry as InspectionEntry, value::Value}; use async_trait::async_trait; +use futures::{stream::BoxStream, StreamExt}; use intent_brokering_common::error::{Error, ResultExt as _}; use intent_brokering_proto::{ common::{ @@ -23,10 +24,12 @@ use intent_brokering_proto::{ InvokeFulfillment, InvokeIntent, ReadFulfillment, ReadIntent, SubscribeFulfillment, SubscribeIntent, WriteFulfillment, WriteIntent, }, - runtime::{intent_brokering_service_client::IntentBrokeringServiceClient, FulfillRequest, FulfillResponse}, + runtime::{ + intent_brokering_service_client::IntentBrokeringServiceClient, FulfillRequest, + FulfillResponse, + }, streaming::{channel_service_client::ChannelServiceClient, OpenRequest}, }; -use futures::{stream::BoxStream, StreamExt}; use tonic::{transport::Channel, Request, Response}; use tracing::debug; diff --git a/intent_brokering/examples/common/src/chariott/registration.rs b/intent_brokering/examples/common/src/chariott/registration.rs index d0d56da6..ccbffd80 100644 --- a/intent_brokering/examples/common/src/chariott/registration.rs +++ b/intent_brokering/examples/common/src/chariott/registration.rs @@ -148,9 +148,12 @@ impl Builder { ) -> Result<(), Error> { if client.is_none() { *client = Some( - IntentBrokeringServiceClient::connect(self.chariott_url.to_string()).await.map_err_with( - format!("Could not connect to Chariott ({})", self.chariott_url), - )?, + IntentBrokeringServiceClient::connect(self.chariott_url.to_string()) + .await + .map_err_with(format!( + "Could not connect to Chariott ({})", + self.chariott_url + ))?, ); } diff --git a/intent_brokering/proto.rs/build.rs b/intent_brokering/proto.rs/build.rs index b44af2f8..4323d30a 100644 --- a/intent_brokering/proto.rs/build.rs +++ b/intent_brokering/proto.rs/build.rs @@ -6,9 +6,9 @@ use std::{error::Error, path::Path}; use tonic_build::configure; fn main() -> Result<(), Box> { - compile_with_common("../proto/runtime/v1/runtime.proto")?; - compile_with_common("../proto/provider/v1/provider.proto")?; - compile_with_common("../proto/streaming/v1/streaming.proto")?; + compile_with_common("../proto/intent_brokering/runtime/v1/runtime.proto")?; + compile_with_common("../proto/intent_brokering/provider/v1/provider.proto")?; + compile_with_common("../proto/intent_brokering/streaming/v1/streaming.proto")?; Ok(()) } diff --git a/intent_brokering/proto/buf.yaml b/intent_brokering/proto/buf.yaml index 8ef1c5eb..f5a5bcc0 100644 --- a/intent_brokering/proto/buf.yaml +++ b/intent_brokering/proto/buf.yaml @@ -9,4 +9,4 @@ lint: - ENUM_ZERO_VALUE_SUFFIX ignore_only: RPC_RESPONSE_STANDARD_NAME: - - chariott/streaming/v1/streaming.proto + - intent_brokering/streaming/v1/streaming.proto diff --git a/intent_brokering/proto/common/v1/common.proto b/intent_brokering/proto/intent_brokering/common/v1/common.proto similarity index 100% rename from intent_brokering/proto/common/v1/common.proto rename to intent_brokering/proto/intent_brokering/common/v1/common.proto diff --git a/intent_brokering/proto/provider/v1/provider.proto b/intent_brokering/proto/intent_brokering/provider/v1/provider.proto similarity index 93% rename from intent_brokering/proto/provider/v1/provider.proto rename to intent_brokering/proto/intent_brokering/provider/v1/provider.proto index 95140535..980ea5b0 100644 --- a/intent_brokering/proto/provider/v1/provider.proto +++ b/intent_brokering/proto/intent_brokering/provider/v1/provider.proto @@ -13,7 +13,7 @@ syntax = "proto3"; package intent_brokering.provider.v1; -import "common/v1/common.proto"; +import "intent_brokering/common/v1/common.proto"; /** * The provider service definition. diff --git a/intent_brokering/proto/runtime/v1/runtime.proto b/intent_brokering/proto/intent_brokering/runtime/v1/runtime.proto similarity index 98% rename from intent_brokering/proto/runtime/v1/runtime.proto rename to intent_brokering/proto/intent_brokering/runtime/v1/runtime.proto index 26ad207f..8f0ddeae 100644 --- a/intent_brokering/proto/runtime/v1/runtime.proto +++ b/intent_brokering/proto/intent_brokering/runtime/v1/runtime.proto @@ -12,7 +12,7 @@ syntax = "proto3"; package intent_brokering.runtime.v1; -import "common/v1/common.proto"; +import "intent_brokering/common/v1/common.proto"; /** * The service entry point to Chariott Intent Brokering. All functionality is provided through diff --git a/intent_brokering/proto/streaming/v1/streaming.proto b/intent_brokering/proto/intent_brokering/streaming/v1/streaming.proto similarity index 97% rename from intent_brokering/proto/streaming/v1/streaming.proto rename to intent_brokering/proto/intent_brokering/streaming/v1/streaming.proto index 1dc69581..31290a93 100644 --- a/intent_brokering/proto/streaming/v1/streaming.proto +++ b/intent_brokering/proto/intent_brokering/streaming/v1/streaming.proto @@ -17,7 +17,7 @@ syntax = "proto3"; package intent_brokering.streaming.v1; -import "common/v1/common.proto"; +import "intent_brokering/common/v1/common.proto"; import "google/protobuf/timestamp.proto"; /** diff --git a/intent_brokering/src/chariott_grpc.rs b/intent_brokering/src/chariott_grpc.rs index 2c562a70..260baafb 100644 --- a/intent_brokering/src/chariott_grpc.rs +++ b/intent_brokering/src/chariott_grpc.rs @@ -190,8 +190,9 @@ mod tests { use intent_brokering_proto::{ common, runtime::{ - intent_brokering_service_server::IntentBrokeringService, intent_registration, AnnounceRequest, - IntentRegistration, IntentServiceRegistration, RegisterRequest, RegistrationState, + intent_brokering_service_server::IntentBrokeringService, intent_registration, + AnnounceRequest, IntentRegistration, IntentServiceRegistration, RegisterRequest, + RegistrationState, }, }; use tonic::Code; @@ -398,7 +399,10 @@ mod tests { IntentKind::Subscribe, ), ] { - assert_eq!(expected, IntentBrokeringServer::::map_intent_variant(&intent)); + assert_eq!( + expected, + IntentBrokeringServer::::map_intent_variant(&intent) + ); } } @@ -433,7 +437,7 @@ mod tests { fn setup() -> IntentBrokeringServer { let broker = IntentBroker::new("https://localhost:4243".parse().unwrap(), StreamingEss::new()); // DevSkim: ignore DS162092 - IntentBrokeringServer::new(Registry::new(broker.clone(), Default::default()), broker) + IntentBrokeringServer::new(Registry::new(broker.clone(), Default::default()), broker) } fn create_announce_request() -> AnnounceRequest { diff --git a/intent_brokering/src/execution.rs b/intent_brokering/src/execution.rs index 31e36090..480017ef 100644 --- a/intent_brokering/src/execution.rs +++ b/intent_brokering/src/execution.rs @@ -152,6 +152,7 @@ pub(crate) mod tests { registry::{IntentConfiguration, IntentKind}, }; use async_trait::async_trait; + use futures::Stream; use intent_brokering_proto::{ common::{ DiscoverFulfillment, FulfillmentEnum, FulfillmentMessage, InspectIntent, @@ -159,7 +160,6 @@ pub(crate) mod tests { }, streaming::{channel_service_server::ChannelService, OpenRequest}, }; - use futures::Stream; use tokio_stream::StreamExt as _; use tonic::{Code, Request}; diff --git a/intent_brokering/tests/chariott_integration.rs b/intent_brokering/tests/chariott_integration.rs index e7a65274..69346b0a 100644 --- a/intent_brokering/tests/chariott_integration.rs +++ b/intent_brokering/tests/chariott_integration.rs @@ -6,6 +6,11 @@ use std::sync::atomic::{AtomicU16, Ordering}; use std::time::Instant; use async_trait::async_trait; +use common::get_uuid; +use examples_common::chariott::{ + api::{Chariott, ChariottCommunication}, + value::Value, +}; use intent_brokering::registry::{ ExecutionLocality, IntentConfiguration, IntentKind, ServiceConfiguration, ServiceId, }; @@ -15,14 +20,11 @@ use intent_brokering_common::error::{Error, ResultExt as _}; use intent_brokering_common::shutdown::RouterExt as _; use intent_brokering_proto::{ common::{IntentEnum, IntentMessage}, - runtime::{intent_brokering_service_server::IntentBrokeringService, FulfillRequest, FulfillResponse}, + runtime::{ + intent_brokering_service_server::IntentBrokeringService, FulfillRequest, FulfillResponse, + }, streaming::channel_service_server::ChannelServiceServer, }; -use common::get_uuid; -use examples_common::chariott::{ - api::{Chariott, ChariottCommunication}, - value::Value, -}; use provider::Provider; use tokio::task::spawn; use tokio_util::sync::CancellationToken; diff --git a/intent_brokering/tests/provider.rs b/intent_brokering/tests/provider.rs index 2948676e..8c11fd7c 100644 --- a/intent_brokering/tests/provider.rs +++ b/intent_brokering/tests/provider.rs @@ -5,6 +5,7 @@ use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use async_trait::async_trait; +use examples_common::chariott::value::Value; use intent_brokering_proto::{ common::{FulfillmentEnum, FulfillmentMessage, IntentEnum, InvokeFulfillment, InvokeIntent}, provider::{ @@ -12,7 +13,6 @@ use intent_brokering_proto::{ FulfillRequest, FulfillResponse, }, }; -use examples_common::chariott::value::Value; use tokio::{net::TcpSocket, spawn}; use tokio_stream::wrappers::TcpListenerStream; use tonic::{transport::Server, Request, Response, Status}; diff --git a/intent_brokering/tests/registry-e2e.rs b/intent_brokering/tests/registry-e2e.rs index ce31c586..60b43c9a 100644 --- a/intent_brokering/tests/registry-e2e.rs +++ b/intent_brokering/tests/registry-e2e.rs @@ -4,14 +4,14 @@ use std::time::Duration; -use intent_brokering_proto::runtime::{ - intent_registration::Intent, intent_service_registration::ExecutionLocality, -}; use common::get_uuid; use examples_common::chariott::{ api::{Chariott, ChariottExt as _, GrpcChariott}, registration::Builder as RegistrationBuilder, }; +use intent_brokering_proto::runtime::{ + intent_registration::Intent, intent_service_registration::ExecutionLocality, +}; use tokio::time::*; use tokio_stream::StreamExt as _; diff --git a/intent_brokering/tests/store-e2e.rs b/intent_brokering/tests/store-e2e.rs index a5a1ef89..67e4b928 100644 --- a/intent_brokering/tests/store-e2e.rs +++ b/intent_brokering/tests/store-e2e.rs @@ -4,12 +4,12 @@ use std::{collections::HashSet, error::Error as _, time::Duration}; -use intent_brokering_common::error::Error; use common::get_uuid; use examples_common::chariott::{ api::{Chariott, ChariottExt, Event, GrpcChariott}, value::Value, }; +use intent_brokering_common::error::Error; use tokio::time::{sleep_until, Instant}; use tokio_stream::StreamExt as _; diff --git a/intent_brokering/tools/charc b/intent_brokering/tools/charc index 7aa6733f..ce47b232 100755 --- a/intent_brokering/tools/charc +++ b/intent_brokering/tools/charc @@ -36,7 +36,7 @@ EOF fi local ID; ID="$(date -u +%s.%N)" echo "$REQ" > "$GRPC_LOG_DIR_PATH/req-$ID" - grpcurl -plaintext -import-path ../proto -proto ../proto/runtime/v1/runtime.proto \ + grpcurl -plaintext -import-path ../proto -proto ../proto/intent_brokering/runtime/v1/runtime.proto \ -d @ "${CHARIOTT_ADDRESS:-0.0.0.0:4243}" \ intent_brokering.runtime.v1.IntentBrokeringService/Fulfill <<< "$REQ" \ | tee "$GRPC_LOG_DIR_PATH/rsp-$ID" @@ -211,7 +211,7 @@ cmd_listen() { mkfifo "$EVENT_STREAM_FIFO" fi grpcurl -v -plaintext -import-path ../proto -proto \ - ../proto/streaming/v1/streaming.proto "$ADDRESS" \ + ../proto/intent_brokering/streaming/v1/streaming.proto "$ADDRESS" \ intent_brokering.streaming.v1.ChannelService/Open > "$EVENT_STREAM_FIFO" & echo>"$LISTENER_PID_FILE_PATH" $! touch "$EVENTS_FILE_PATH" "$MUX_EVENTS_FILE_PATH"