pub struct TestNetwork<'a> { /* private fields */ }
Expand description
A virtual Network.
TestNetwork
is a single virtual broadcast domain backed by Netemul.
Created through TestSandbox::create_network
.
Implementations§
Source§impl<'a> TestNetwork<'a>
impl<'a> TestNetwork<'a>
Sourcepub fn into_proxy(self) -> NetworkProxy
pub fn into_proxy(self) -> NetworkProxy
Extracts the proxy to the backing network.
Note that this defeats the lifetime semantics that ensure the sandbox in
which this network was created lives as long as the network. The caller of
TestNetwork::into_proxy
is responsible for ensuring that the sandbox
outlives the network.
Sourcepub async fn set_config(&self, config: NetworkConfig) -> Result<(), Error>
pub async fn set_config(&self, config: NetworkConfig) -> Result<(), Error>
Sets the configuration for this network to config
.
Sourcepub async fn attach_endpoint(&self, ep: &TestEndpoint<'a>) -> Result<(), Error>
pub async fn attach_endpoint(&self, ep: &TestEndpoint<'a>) -> Result<(), Error>
Attaches ep
to this network.
Sourcepub async fn create_endpoint<S>(
&self,
name: S,
) -> Result<TestEndpoint<'a>, Error>
pub async fn create_endpoint<S>( &self, name: S, ) -> Result<TestEndpoint<'a>, Error>
Creates a new endpoint with name
attached to this network.
Characters may be dropped from the front of name
if it exceeds the maximum length.
Sourcepub async fn create_endpoint_with(
&self,
name: impl Into<Cow<'a, str>>,
config: EndpointConfig,
) -> Result<TestEndpoint<'a>, Error>
pub async fn create_endpoint_with( &self, name: impl Into<Cow<'a, str>>, config: EndpointConfig, ) -> Result<TestEndpoint<'a>, Error>
Creates a new endpoint with name
and config
attached to this network.
Characters may be dropped from the front of name
if it exceeds the maximum length.
Sourcepub fn create_fake_endpoint(&self) -> Result<TestFakeEndpoint<'a>, Error>
pub fn create_fake_endpoint(&self) -> Result<TestFakeEndpoint<'a>, Error>
Returns a fake endpoint.
Sourcepub async fn start_capture(&self, name: &str) -> Result<PacketCapture, Error>
pub async fn start_capture(&self, name: &str) -> Result<PacketCapture, Error>
Starts capturing packet in this network.
The packet capture will be stored under a predefined directory:
/custom_artifacts
. More details can be found here:
https://fuchsia.dev/fuchsia-src/development/testing/components/test_runner_framework?hl=en#custom-artifacts
Sourcepub async fn stop_capture(&self) -> Result<(), Error>
pub async fn stop_capture(&self) -> Result<(), Error>
Stops packet capture in this network.