Ejemplo n.º 1
0
        cli_result = vtyService.write(TEST_CMD2)
        logger.info("Test Command : %s", TEST_CMD2)
        logger.info("Test Command Max Response: %s", MAX_RESPONSE_LENGTH)
        logger.info("CLI Result for Test Command : %s", cli_result)
        try:
            """Show the parser state attributes"""
            tutorial.show_parser_state_attributes(parser_state)
        except OnepRemoteProcedureException as re:
            logger.error("Error in getting parser state", str(re))
        """Cancel the command execution"""
        #  START SNIPPET: vty_cancel_cmd
        vtyService.cancel()
        #  END SNIPPET: vty_cancel_cmd
        """Close the VTY connection on NE"""
        #  START SNIPPET: vty_close
        vtyService.close()
        #  END SNIPPET: vty_close
        """Check if the VTY is still open"""
        logger.info("Is Open - %s", vtyService.is_open())
        """Destroy the VTY"""
        #  START SNIPPET: vty_destroy
        vtyService.destroy()
        #  END SNIPPET: vty_destroy
    except Exception, e:
        #  START SNIPPET: disconnect_ne
        tutorial.disconnect()
        #  END SNIPPET: disconnect_ne
        logger.error(str(e))
    tutorial.disconnect()
    sys.exit(0)