async fn apply_configuration_on_new_port(
        &mut self,
        pid: PortId,
        topological_path: &str,
    ) -> error::Result<()> {
        // TODO(fxbug.dev/51208): Figure out a better way to do this.
        if self.config.device_id_is_an_uplink(topological_path) {
            info!("Discovered a new uplink: {}", topological_path);
            return self.configure_wan(pid, topological_path).await;
        }
        if self.config.device_id_is_a_downlink(topological_path) {
            info!("Discovered a new downlink: {}", topological_path);
            return self.configure_lan(&[pid], topological_path).await;
        }
        if self.config.is_unknown_device_id(topological_path) {
            info!("Discovered a new unknown device: {}", topological_path);
            return self.configure_default_interface(pid, topological_path).await;
        }

        // TODO(fxbug.dev/43251): Refactor this when we have the ability to add one port at a time to the
        // bridge, currently we have to wait until we've discovered all the ports before creating
        // the bridge.
        self.lans.push(pid);

        // If the configuration contains switched_vlan interfaces that matches this
        // topological_path add it to the bridge.
        if self.config.device_id_is_a_switched_vlan(topological_path) {
            // TODO(fxbug.dev/43251): Need to do this until we can add individual bridge members.
            if self.lans.len() == NUMBER_OF_PORTS_IN_LAN {
                let lans = self.lans.clone();
                info!("Creating new bridge with LAN ports: {:?}", lans);
                return self.configure_lan_bridge(&lans).await;
            }
        }
        Ok(())
    }
/// Applies configuration to the new port.
Applies configuration to the new port.
Applies configuration to the new port .
async fn apply_configuration_on_new_port(
        &mut self,
        pid: PortId,
        topological_path: &str,
    ) -> error::Result<()> {
        // TODO(fxbug.dev/51208): Figure out a better way to do this.
        if self.config.device_id_is_an_uplink(topological_path) {
            info!("Discovered a new uplink: {}", topological_path);
            return self.configure_wan(pid, topological_path).await;
        }
        if self.config.device_id_is_a_downlink(topological_path) {
            info!("Discovered a new downlink: {}", topological_path);
            return self.configure_lan(&[pid], topological_path).await;
        }
        if self.config.is_unknown_device_id(topological_path) {
            info!("Discovered a new unknown device: {}", topological_path);
            return self.configure_default_interface(pid, topological_path).await;
        }
        // TODO(fxbug.dev/43251): Refactor this when we have the ability to add one port at a time to the
        // bridge, currently we have to wait until we've discovered all the ports before creating
        // the bridge.
        self.lans.push(pid);
        // If the configuration contains switched_vlan interfaces that matches this
        // topological_path add it to the bridge.
        if self.config.device_id_is_a_switched_vlan(topological_path) {
            // TODO(fxbug.dev/43251): Need to do this until we can add individual bridge members.
            if self.lans.len() == NUMBER_OF_PORTS_IN_LAN {
                let lans = self.lans.clone();
                info!("Creating new bridge with LAN ports: {:?}", lans);
                return self.configure_lan_bridge(&lans).await;
            }
        }
        Ok(())
    }
async fn apply_configuration_on_new_port ( & mut self , pid : PortId , topological_path : & str , ) -> error :: Result < ( ) > { // TODO(fxbug.dev/51208): Figure out a better way to do this. if self . config . device_id_is_an_uplink ( topological_path ) { info ! ( " " topological_path ) ; return self . configure_wan ( pid , topological_path ) . await ; } if self . config . device_id_is_a_downlink ( topological_path ) { info ! ( " " topological_path ) ; return self . configure_lan ( & [ pid ] , topological_path ) . await ; } if self . config . is_unknown_device_id ( topological_path ) { info ! ( " " topological_path ) ; return self . configure_default_interface ( pid , topological_path ) . await ; } // TODO(fxbug.dev/43251): Refactor this when we have the ability to add one port at a time to the // bridge, currently we have to wait until we've discovered all the ports before creating // the bridge. self . lans . push ( pid ) ; // If the configuration contains switched_vlan interfaces that matches this // topological_path add it to the bridge. if self . config . device_id_is_a_switched_vlan ( topological_path ) { // TODO(fxbug.dev/43251): Need to do this until we can add individual bridge members. if self . lans . len ( ) == NUMBER_OF_PORTS_IN_LAN { let lans = self . lans . clone ( ) ; info ! ( " " lans ) ; return self . configure_lan_bridge ( & lans ) . await ; } } Ok ( ( ) ) }
Applies configuration to the new port.
Applies configuration to the new port .
&mut self
pid
PortId
topological_path
&str
&mut self
pid
PortId
topological_path
&str