pub async fn delete_lif(&mut self, lif_id: UUID) -> Result<(), error::NetworkManager> {
        // Locate the lif to delete.
        let lif = self.lif_manager.lif_mut(&lif_id);
        let lif = match lif {
            None => {
                info!("delete_lif: lif not found {:?} ", lif_id);
                return Err(error::NetworkManager::Lif(error::Lif::NotFound));
            }
            Some(x) => x.clone(),
        };
        // reset all properties, shut down LIF
        self.hal.apply_properties(lif.pid(), lif.properties(), &LIFProperties::default()).await?;
        // delete bridge if there is one and shut down the related ports
        let ports = lif.ports();
        if ports.len() > 1 {
            self.hal.delete_bridge(lif.pid()).await?;
            //TODO(dpradilla) shut down the ports.
        }
        self.release_ports(&ports.collect::<Vec<PortId>>());
        // delete from database
        if self.lif_manager.remove_lif(lif_id).is_none() {
            return Err(error::NetworkManager::Lif(error::Lif::NotFound));
        }
        Ok(())
    }
/// Deletes the LIF of the given type.
Deletes the LIF of the given type.
Deletes the LIF of the given type .
pub async fn delete_lif(&mut self, lif_id: UUID) -> Result<(), error::NetworkManager> {
        // Locate the lif to delete.
        let lif = self.lif_manager.lif_mut(&lif_id);
        let lif = match lif {
            None => {
                info!("delete_lif: lif not found {:?} ", lif_id);
                return Err(error::NetworkManager::Lif(error::Lif::NotFound));
            }
            Some(x) => x.clone(),
        };
        // reset all properties, shut down LIF
        self.hal.apply_properties(lif.pid(), lif.properties(), &LIFProperties::default()).await?;
        // delete bridge if there is one and shut down the related ports
        let ports = lif.ports();
        if ports.len() > 1 {
            self.hal.delete_bridge(lif.pid()).await?;
            //TODO(dpradilla) shut down the ports.
        }
        self.release_ports(&ports.collect::<Vec<PortId>>());
        // delete from database
        if self.lif_manager.remove_lif(lif_id).is_none() {
            return Err(error::NetworkManager::Lif(error::Lif::NotFound));
        }
        Ok(())
    }
pub async fn delete_lif ( & mut self , lif_id : UUID ) -> Result < ( ) , error :: NetworkManager > { // Locate the lif to delete. let lif = self . lif_manager . lif_mut ( & lif_id ) ; let lif = match lif { None => { info ! ( " " lif_id ) ; return Err ( error :: NetworkManager :: Lif ( error :: Lif :: NotFound ) ) ; } Some ( x ) => x . clone ( ) , } ; // reset all properties, shut down LIF self . hal . apply_properties ( lif . pid ( ) , lif . properties ( ) , & LIFProperties :: default ( ) ) . await ? ; // delete bridge if there is one and shut down the related ports let ports = lif . ports ( ) ; if ports . len ( ) > 1 { self . hal . delete_bridge ( lif . pid ( ) ) . await ? ; //TODO(dpradilla) shut down the ports. } self . release_ports ( & ports . collect :: < Vec < PortId > > ( ) ) ; // delete from database if self . lif_manager . remove_lif ( lif_id ) . is_none ( ) { return Err ( error :: NetworkManager :: Lif ( error :: Lif :: NotFound ) ) ; } Ok ( ( ) ) }
Deletes the LIF of the given type.
Deletes the LIF of the given type .
&mut self
lif_id
UUID
&mut self
lif_id
UUID