class CumulusTorSwitchService implements ISwitchService {

    @Override
    public SwitchOspfConfig getOspf( SwitchNode switchNode )
        throws HmsException
    {
        SwitchOspfConfig ospf = new SwitchOspfConfig();
        SwitchOspfGlobalConfig globalConfig = new SwitchOspfGlobalConfig();
        SwitchOspfNetworkConfig networkConfig = null;
        SwitchOspfInterfaceConfig interfaceConfig = null;
        List<SwitchOspfNetworkConfig> networkConfigList = new ArrayList<SwitchOspfNetworkConfig>();
        List<SwitchOspfInterfaceConfig> interfaceConfigList = new ArrayList<SwitchOspfInterfaceConfig>();
        SwitchSession switchSession = getSession( switchNode );
        String[] quaggaConfig = null;
        String[] tokens = null;

        /* Prepare the mammoth object */
        ospf.setGlobal( globalConfig );
        globalConfig.setInterfaces( interfaceConfigList );
        globalConfig.setNetworks( networkConfigList );

        /*
         * Let's start by pulling in bulk data from the switch
         */
        String[] commandSet = {
            "echo '{password}' | sudo -S cat /etc/quagga/Quagga.conf".replaceAll( "\\{password\\}",
                                                                                  switchNode.getPassword() ),
            CumulusConstants.LIST_QUAGGA_DAEMONS_COMMAND.replaceAll( "\\{password\\}", switchNode.getPassword() ) };

        String[][] combinedOutput = GetMultipleCmdResults( switchSession, commandSet );

        if ( combinedOutput.length < 1 )
        {
            throw new HmsException( "Failed to retrieve necessary information from switch" );
        }

        /* Get all the output in pre-formatted avatar now */
        quaggaConfig = combinedOutput[0];

        if ( ( quaggaConfig.length == 0 ) || quaggaConfig[0].matches( ".*No such file or directory.*" ) )
        {
            return ospf; /* Could not find anything */
        }

        /*
         * Start parsing the file line by line now
         */
        for ( String line : quaggaConfig )
        {
            line = line.trim(); /* Parse the line properly */
            if ( line.matches( "^router-id.*" ) )
            {
                /* Global router-id */
                tokens = line.split( "\\s+" );
                if ( tokens.length >= 2 )
                    globalConfig.setRouterId( tokens[1] );

                ospf.setEnabled( true );
            }
            else if ( line.matches( ".*passive-interface default.*" ) )
            {
                /* Global Mode */
                if ( line.startsWith( "no" ) )
                    globalConfig.setDefaultMode( OspfMode.ACTIVE );
                else
                    globalConfig.setDefaultMode( OspfMode.PASSIVE );
            }
            else if ( line.matches( ".*network .*area.*" ) )
            {
                /* Network and area details */
                networkConfig = new SwitchOspfNetworkConfig();
                tokens = line.split( "\\s+" );
                if ( tokens.length < 4 )
                    continue; // Skip, cannot parse this

                networkConfig.setArea( tokens[3] );
                networkConfig.setNetwork( tokens[1] );
                networkConfigList.add( networkConfig );
            }
            else if ( line.matches( ".*passive-interface.*swp[0-9]+.*" ) )
            {
                /* Interface name and mode */
                interfaceConfig = new SwitchOspfInterfaceConfig();
                tokens = line.split( "\\s+" );
                if ( tokens.length < 2 )
                    continue; // Skip, cannot parse this

                if ( line.startsWith( "no" ) )
                    interfaceConfig.setMode( InterfaceMode.ACTIVE );
                else
                    interfaceConfig.setMode( InterfaceMode.PASSIVE );

                interfaceConfig.setName( tokens[tokens.length - 1] ); /* Last token is interface name */
                interfaceConfigList.add( interfaceConfig );
            }
        }

        return ospf;
    }

}