@Test
public void deletePortFromLag()
{

    CumulusLacpGroupHelper lacpHelper = new CumulusLacpGroupHelper( null );
    Configuration configuration = Configuration.parse( interfacesFileWithBondAnd2Ports );
    ConfigBlock cb = configuration.getConfigBlock( "bond47" );
    Bond bond = (Bond) cb;
    SwitchLacpGroup lag = new SwitchLacpGroup();
    lag.setName( cb.name );
    lag.setPorts( Arrays.asList( "swp47", "swp48" ) );
    try
    {
        lacpHelper.deleteSwitchPortFromLacpGroup( lag, Arrays.asList( "swp47" ), configuration );
    }
    catch ( HmsException e )
    {
        fail( "Failed to delete port from LACP group. Reason: " + e.getMessage() );
    }
    // validate now
    int numMatch = 0;
    for ( SwitchPort switchPort : bond.slaves )
    {
        if ( switchPort.name.equals( "swp47" ) )
            fail( "Failed to delete port swp47 from LACP Group bond47" );
        else if ( switchPort.name.equals( "swp48" ) )
            ++numMatch;
    }
    if ( numMatch != 1 )
    {
        fail( "Deleted all ports from the Bond bond47 incorrectly!!!" );
    }
    // also validate the VLAN aware bridge
    SwitchPort portSwp47 = configuration.bridges.get( 0 ).getMemberByName( "swp47" );
    if ( portSwp47 == null || configuration.bridges.get( 0 ).getMemberByName( "bond47" ) == null )
    {
        fail( "VLAN aware bridge settings are not proper. Either the deleted port or the bond is absent from its configuration" );
    }
    // now validate that the VLANs which were with the LAG has been propagated to the deleted port
    if ( portSwp47.vlans != cb.vlans && !portSwp47.vlans.contains( cb.vlans ) )
    {
        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() );
}