@Test
public void deleteAllPortsFromLag()
{

    CumulusLacpGroupHelper lacpHelper = new CumulusLacpGroupHelper( null );
    Configuration configuration = Configuration.parse( interfacesFileWithBondAnd2Ports );
    ConfigBlock cb = configuration.getConfigBlock( "bond47" );
    Bond bond = (Bond) cb;
    List<String> bondVlans = bond.vlans;
    SwitchLacpGroup lag = new SwitchLacpGroup();
    lag.setName( cb.name );
    lag.setPorts( Arrays.asList( "swp47", "swp48" ) );
    System.out.println( configuration.getString() );
    try
    {
        lacpHelper.deleteSwitchPortFromLacpGroup( lag, Arrays.asList( "swp47" ), configuration );
        System.out.println( configuration.getString() );
        lacpHelper.deleteSwitchPortFromLacpGroup( lag, Arrays.asList( "swp48" ), configuration );
    }
    catch ( HmsException e )
    {
        fail( "Failed to delete port from LACP group. Reason: " + e.getMessage() );
    }
    // validate now
    cb = configuration.getConfigBlock( "bond47" );
    if ( cb != null )
    {
        fail( "Incorrectly retained LAG without any slave ports." );
    }
    // also validate the VLAN aware bridge
    SwitchPort portSwp47 = configuration.bridges.get( 0 ).getMemberByName( "swp47" );
    SwitchPort portSwp48 = configuration.bridges.get( 0 ).getMemberByName( "swp48" );
    if ( portSwp47 == null || portSwp48 == null
        || configuration.bridges.get( 0 ).getMemberByName( "bond47" ) != null )
    {
        fail( "VLAN aware bridge settings are not proper. Either deleted ports are absent or the LAG is present" );
    }
    // now validate that the VLANs which were with the LAG has been propagated to the deleted port
    if ( portSwp47.vlans != bondVlans && !portSwp47.vlans.contains( bondVlans ) )
    {
        fail( "VLANs of the parent LACP bond have not propagated to the deleted port" );
    }
    if ( portSwp48.vlans != bondVlans && !portSwp48.vlans.contains( bondVlans ) )
    {
        fail( "VLANs of the parent LACP bond have not propagated to the deleted port" );
    }
    if ( !checkCumulusConfigurationSanctity( configuration ) )
        fail( "Corrupted the configuration because of which at least 1 port or a bond is present more than once." );
    System.out.println( configuration.getString() );
}