async fn configure_lan_bridge(&mut self, pids: &[PortId]) -> error::Result<()> {
        let switched_vlans = pids.iter().map(|pid| {
            self.port_manager
                .topo_path(*pid)
                .ok_or_else(|| {
                    error::NetworkManager::Config(error::Config::NotFound {
                        msg: format!("topo_path not found in port manager map: {:?}", pid),
                    })
                })
                .and_then(|t| self.config.get_switched_vlan_by_device_id(t))
        });
        let routed_vlan = self.config.all_ports_have_same_bridge(switched_vlans)?;
        let bridge_name = self.config.get_bridge_name(&routed_vlan).to_string();
        let vlan_id = routed_vlan.vlan_id;
        let properties = self.config.create_routed_vlan_properties(&routed_vlan)?;
        let lif = self.create_lif(LIFType::LAN, bridge_name, Some(vlan_id), pids).await?;
        self.update_lif_properties(lif.id().uuid(), &properties).await?;
        // TODO(cgibson): Add support for packet filtering on bridge ports.
        info!("Created new LAN bridge with properties: {:?}", properties);
        Ok(())
    }
/// Configures a bridge from the provided ports.
Configures a bridge from the provided ports.
Configures a bridge from the provided ports .
async fn configure_lan_bridge(&mut self, pids: &[PortId]) -> error::Result<()> {
        let switched_vlans = pids.iter().map(|pid| {
            self.port_manager
                .topo_path(*pid)
                .ok_or_else(|| {
                    error::NetworkManager::Config(error::Config::NotFound {
                        msg: format!("topo_path not found in port manager map: {:?}", pid),
                    })
                })
                .and_then(|t| self.config.get_switched_vlan_by_device_id(t))
        });
        let routed_vlan = self.config.all_ports_have_same_bridge(switched_vlans)?;
        let bridge_name = self.config.get_bridge_name(&routed_vlan).to_string();
        let vlan_id = routed_vlan.vlan_id;
        let properties = self.config.create_routed_vlan_properties(&routed_vlan)?;
        let lif = self.create_lif(LIFType::LAN, bridge_name, Some(vlan_id), pids).await?;
        self.update_lif_properties(lif.id().uuid(), &properties).await?;
        // TODO(cgibson): Add support for packet filtering on bridge ports.
        info!("Created new LAN bridge with properties: {:?}", properties);
        Ok(())
    }
async fn configure_lan_bridge ( & mut self , pids : & [ PortId ] ) -> error :: Result < ( ) > { let switched_vlans = pids . iter ( ) . map ( | pid | { self . port_manager . topo_path ( * pid ) . ok_or_else ( | | { error :: NetworkManager :: Config ( error :: Config :: NotFound { msg : format ! ( " " pid ) , } ) } ) . and_then ( | t | self . config . get_switched_vlan_by_device_id ( t ) ) } ) ; let routed_vlan = self . config . all_ports_have_same_bridge ( switched_vlans ) ? ; let bridge_name = self . config . get_bridge_name ( & routed_vlan ) . to_string ( ) ; let vlan_id = routed_vlan . vlan_id ; let properties = self . config . create_routed_vlan_properties ( & routed_vlan ) ? ; let lif = self . create_lif ( LIFType :: LAN , bridge_name , Some ( vlan_id ) , pids ) . await ? ; self . update_lif_properties ( lif . id ( ) . uuid ( ) , & properties ) . await ? ; // TODO(cgibson): Add support for packet filtering on bridge ports. info ! ( " " properties ) ; Ok ( ( ) ) }
Configures a bridge from the provided ports.
Configures a bridge from the provided ports .
&mut self
pids
&[PortId]
&mut self
pids
&[PortId]