class CumulusTorSwitchService implements ISwitchService {

    @Override
    public List<String> getSwitchPortList( SwitchNode switchNode )
    {
        List<String> portList = portListCache.get( switchNode );
        if ( portList != null )
        {
            return portList;
        }
        else
        {
            portList = new ArrayList<String>();
        }

        SshExecResult result = null;
        String portResult;

        try
        {
            CumulusTorSwitchSession switchSession = (CumulusTorSwitchSession) getSession( switchNode );
            result = switchSession.executeEnhanced( CumulusConstants.IP_LIST_PORTS_COMMAND );
            result.logIfError( logger );

            portResult = result.getStdoutAsString();
            for ( String portLine : portResult.split( "\n" ) )
            {
                String[] portArr = portLine.split( ":", 3 );
                if ( portArr.length >= 3 )
                {
                    String p = portArr[1].trim();
                    if ( p.matches( "eth[0-9]+|swp[0-9]+" ) )
                        portList.add( p );
                }
            }

            if ( portList.size() > 4 )
            {
                portListCache.set( switchNode, portList );
            }
        }
        catch ( Exception e )
        {
            logger.error( "Exception occured while getting switch ports", e );
        }

        return portList;
    }

}