class CumulusVlanHelper {

    public boolean updateLAGOnSwitchPorts( SwitchNode switchNode, SwitchLacpGroup lacpGroup )
        throws HmsException
    {
        /* Validate the input */
        if ( lacpGroup == null || lacpGroup.getName() == null || lacpGroup.getName().trim().equals( "" ) )
        {
            throw new HmsException( "Cannot create LACP group with empty/null name." );
        }

        /* Validate the port list */
        if ( lacpGroup.getPorts() == null || lacpGroup.getPorts().isEmpty() )
        {
            throw new HmsException( "Cannot create LACP group with empty port list." );
        }

        CumulusTorSwitchSession session = (CumulusTorSwitchSession) CumulusUtil.getSession( switchNode );
        Configuration configuration = null;
        try
        {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            session.download( baos, CumulusConstants.INTERFACES_FILE );
            configuration = Configuration.parse( new ByteArrayInputStream( baos.toByteArray() ) );
        }
        catch ( Exception e )
        {
            logger.error( "Exception received while parsing interfaces file.", e );
        }

        try
        {
            configuration = updateLAGOnSwitchPorts( lacpGroup, configuration );
        }
        catch ( Exception e )
        {
            String errMsg = String.format( "Error on Switch %s : %s", switchNode.getSwitchId(), e.getMessage() );
            throw new HmsOobNetworkException( errMsg, e, HmsOobNetworkErrorCode.ARGUMENT_SYNTAX_ERROR );
        }

        /* Upload the file */
        ByteArrayInputStream bais = new ByteArrayInputStream( configuration.getString().getBytes() );
        CumulusUtil.validateSourceClause( switchNode );
        CumulusUtil.uploadAsRoot( switchNode, bais, CumulusConstants.INTERFACES_FILE );

        CumulusUtil.configurePersistenceDirectory( switchNode );

        /* Activate the VLAN in the current session */
        SshExecResult result =
            session.executeEnhanced( CumulusConstants.RELOAD_INTERFACES.replaceAll( "\\{password\\}",
                                                                                    CumulusUtil.qr( switchNode.getPassword() ) ) );
        result.logIfError( logger );

        return true;
    }

    public  CumulusVlanHelper( CumulusTorSwitchService service );

}