async fn run_netstack_and_get_ipv6_addrs_for_endpoint<N: Netstack>(
    endpoint: &netemul::TestEndpoint<'_>,
    launcher: &sys::LauncherProxy,
    name: String,
) -> Result<Vec<net::Subnet>> {
    // Launch the netstack service.

    let mut app = AppBuilder::new(N::VERSION.get_url())
        .spawn(launcher)
        .context("failed to spawn netstack")?;
    let netstack = app
        .connect_to_protocol::<netstack::NetstackMarker>()
        .context("failed to connect to netstack service")?;

    // Add the device and get its interface state from netstack.
    // TODO(fxbug.dev/48907) Support Network Device. This helper fn should use stack.fidl
    // and be agnostic over interface type.
    let id = netstack
        .add_ethernet_device(
            &name,
            &mut netstack::InterfaceConfig {
                name: name[..fidl_fuchsia_posix_socket::INTERFACE_NAME_LENGTH.into()].to_string(),
                filepath: "/fake/filepath/for_test".to_string(),
                metric: 0,
            },
            endpoint
                .get_ethernet()
                .await
                .context("add_ethernet_device requires an Ethernet endpoint")?,
        )
        .await
        .context("add_ethernet_device FIDL error")?
        .map_err(fuchsia_zircon::Status::from_raw)
        .context("add_ethernet_device error")?;
    let interface = netstack
        .get_interfaces()
        .await
        .context("failed to get interfaces")?
        .into_iter()
        .find(|interface| interface.id == id)
        .ok_or(anyhow::anyhow!("failed to find added ethernet device"))?;

    // Kill the netstack.
    //
    // Note, simply dropping `component_controller` would also kill the netstack
    // but we explicitly kill it and wait for the terminated event before
    // proceeding.
    let () = app.kill().context("failed to kill app")?;
    let _exit_status = app.wait().await.context("failed to observe netstack termination")?;

    Ok(interface.ipv6addrs)
}
/// Launches a new netstack with the endpoint and returns the IPv6 addresses
/// initially assigned to it.
///
/// If `run_netstack_and_get_ipv6_addrs_for_endpoint` returns successfully, it
/// is guaranteed that the launched netstack has been terminated. Note, if
/// `run_netstack_and_get_ipv6_addrs_for_endpoint` does not return successfully,
/// the launched netstack will still be terminated, but no guarantees are made
/// about when that will happen.
Launches a new netstack with the endpoint and returns the IPv6 addresses
initially assigned to it.

If `run_netstack_and_get_ipv6_addrs_for_endpoint` returns successfully, it
is guaranteed that the launched netstack has been terminated. Note, if
`run_netstack_and_get_ipv6_addrs_for_endpoint` does not return successfully,
the launched netstack will still be terminated, but no guarantees are made
about when that will happen.
Launches a new netstack with the endpoint and returns the IPv6 addresses initially assigned to it . If ` run_netstack_and_get_ipv6_addrs_for_endpoint ` returns successfully it is guaranteed that the launched netstack has been terminated . Note if ` run_netstack_and_get_ipv6_addrs_for_endpoint ` does not return successfully the launched netstack will still be terminated but no guarantees are made about when that will happen .
async fn run_netstack_and_get_ipv6_addrs_for_endpoint<N: Netstack>(
    endpoint: &netemul::TestEndpoint<'_>,
    launcher: &sys::LauncherProxy,
    name: String,
) -> Result<Vec<net::Subnet>> {
    // Launch the netstack service.
    let mut app = AppBuilder::new(N::VERSION.get_url())
        .spawn(launcher)
        .context("failed to spawn netstack")?;
    let netstack = app
        .connect_to_protocol::<netstack::NetstackMarker>()
        .context("failed to connect to netstack service")?;
    // Add the device and get its interface state from netstack.
    // TODO(fxbug.dev/48907) Support Network Device. This helper fn should use stack.fidl
    // and be agnostic over interface type.
    let id = netstack
        .add_ethernet_device(
            &name,
            &mut netstack::InterfaceConfig {
                name: name[..fidl_fuchsia_posix_socket::INTERFACE_NAME_LENGTH.into()].to_string(),
                filepath: "/fake/filepath/for_test".to_string(),
                metric: 0,
            },
            endpoint
                .get_ethernet()
                .await
                .context("add_ethernet_device requires an Ethernet endpoint")?,
        )
        .await
        .context("add_ethernet_device FIDL error")?
        .map_err(fuchsia_zircon::Status::from_raw)
        .context("add_ethernet_device error")?;
    let interface = netstack
        .get_interfaces()
        .await
        .context("failed to get interfaces")?
        .into_iter()
        .find(|interface| interface.id == id)
        .ok_or(anyhow::anyhow!("failed to find added ethernet device"))?;
    // Kill the netstack.
    //
    // Note, simply dropping `component_controller` would also kill the netstack
    // but we explicitly kill it and wait for the terminated event before
    // proceeding.
    let () = app.kill().context("failed to kill app")?;
    let _exit_status = app.wait().await.context("failed to observe netstack termination")?;
    Ok(interface.ipv6addrs)
}
async fn run_netstack_and_get_ipv6_addrs_for_endpoint < N : Netstack > ( endpoint : & netemul :: TestEndpoint < ' _ > , launcher : & sys :: LauncherProxy , name : String , ) -> Result < Vec < net :: Subnet > > { // Launch the netstack service. let mut app = AppBuilder :: new ( N :: VERSION . get_url ( ) ) . spawn ( launcher ) . context ( " " ) ? ; let netstack = app . connect_to_protocol :: < netstack :: NetstackMarker > ( ) . context ( " " ) ? ; // Add the device and get its interface state from netstack. // TODO(fxbug.dev/48907) Support Network Device. This helper fn should use stack.fidl // and be agnostic over interface type. let id = netstack . add_ethernet_device ( & name , & mut netstack :: InterfaceConfig { name : name [ .. fidl_fuchsia_posix_socket :: INTERFACE_NAME_LENGTH . into ( ) ] . to_string ( ) , filepath : " " . to_string ( ) , metric : 0 , } , endpoint . get_ethernet ( ) . await . context ( " " ) ? , ) . await . context ( " " ) ? . map_err ( fuchsia_zircon :: Status :: from_raw ) . context ( " " ) ? ; let interface = netstack . get_interfaces ( ) . await . context ( " " ) ? . into_iter ( ) . find ( | interface | interface . id == id ) . ok_or ( anyhow :: anyhow ! ( " " ) ) ? ; // Kill the netstack. // // Note, simply dropping `component_controller` would also kill the netstack // but we explicitly kill it and wait for the terminated event before // proceeding. let ( ) = app . kill ( ) . context ( " " ) ? ; let _exit_status = app . wait ( ) . await . context ( " " ) ? ; Ok ( interface . ipv6addrs ) }
Launches a new netstack with the endpoint and returns the IPv6 addresses
initially assigned to it.
Launches a new netstack with the endpoint and returns the IPv6 addresses initially assigned to it .
endpoint
&netemul::TestEndpoint<'_>
launcher
&sys::LauncherProxy
name
String
endpoint
&netemul::TestEndpoint<'_>
launcher
&sys::LauncherProxy
name
String