junoscript-perl

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

       and Perl modules required by JUNOS::Device and its samples.
    Back to Top  

   Installation
   Instructions for UNIX Systems

    1. Make sure perl is installed. If necessary, see Installation of Perl.

       % which perl
       % perl -v

       The JUNOScript Perl Client requires perl version 5.0004 or later.
       Verify that you are running that version of the perl executable. If
       not, check your PATH or install the latest release of perl.

    1. Download the JUNOScript gzip archive from the Juniper Networks
       website. The archive is named junoscript-n.n-type.tar.gz, where n.n is
       a release code such as 5.1 and type is either export or domestic. For
       instructions, see Download.
        
    2. Unzip and untar the archive.

       On FreeBSD and Linux systems:
       % tar zxf junoscript-n.n-type.tar.gz

       On Solaris systems:
       % gzip -dc junoscript-n.n-type.tar.gz | tar xf -
        
    3. Change to the JUNOScript directory.
       % cd junoscript-n.n
        
    4. Download the gzip archive of the prerequisite library and modules from
       the Juniper Networks Web site in a directory called prereqs, which
       must be directly under the junoscript-n.n directory. The archive is
       named junoscript-prereqs-n.n-type.tar.gz where n.n is a release code
       such as 5.1 and type is either export or domestic. For instructions,
       see Download.
        
    5. Unzip and untar the archive.

       On FreeBSD and Linux systems:
       [/my/junoscript-n.n]% tar zxf junoscript-prereqs-n.n-type.tar.gz

       On Solaris systems:
       [/my/junoscript-n.n]% gzip -dc junoscript-prereqs-n.n-type.tar.gz |
       tar xf -
        
    6. Install the required C binaries and Perl modules. If you wish to
       install the required files in your private directory instead of the
       standard directory, you can use the -install_directory option to
       specify your private installation directory. The standard directory is
       the installation directory configured in the perl executable. Usually,
       the standard directory is /usr/lib or /usr/local/lib, and you'll need
       root privilege to install modules in these directories.

       If installing modules under the standard directory (normally
       /usr/local/lib and you'll need root privilege):
       [/my/junoscript-n.n]% perl install-prereqs.pl -force

       Installing modules under your own private directory (see notes below):
       [/my/junoscript-n.n]% setenv PERL5LIB /my/private/directory/lib
       [/my/junoscript-n.n]% setenv MANPATH "$MANPATH/:$PERL5LIB/../man"
       [/my/junoscript-n.n]% setenv PATH "$PATH/:$PERL5LIB/../bin"
       [/my/junoscript-n.n]% perl install-prereqs.pl -install_directory
       $PERL5LIB -force

       As the install-prereqs.pl script installs the last few modules, it
       prompts you for input. Simply following the instructions and accept
       default responses whenever they are offered. The only exception is
       during installation of the SSH module: here you must choose one of the
       cipher packages supported by the JUNOScript server-- DES, DES3 or
       Blowfish.

       The option -force forces install-prereqs.pl to install a module even
       if an older version already exists or make test fails. For more
       information on the install-prereqs.pl options, type perl
       install-prereqs.pl -help.
        
    7. Create JUNOS::Device makefile.

       If installing JUNOS::Device under the standard directory (it's
       normally /usr/local/lib):
       [/my/junoscript-n.n]% perl Makefile.PL

       If installing JUNOS::Device under your own private directory:
       [/my/junoscript-n.n]% perl Makefile.PL LIB=$PERL5LIB
       INSTALLMAN3DIR=$PERL5LIB/../man/man3
        
    8. Test and install the JUNOS::Device module.

       [/my/junoscript-n.n]% make
       [/my/junoscript-n.n]% make test
       [/my/junoscript-n.n]% make install
        

   Notes for private directory installation:

     * If you are installing the JUNOScript modules in a private directory,
       remember to set PERL5LIB, MANPATH, and PATH environment variables
       before installing the Perl modules and running the examples. If the
       PERL5LIB variable is set, perl will first look for Perl modules in the
       specified directory before looking in the standard directory. (If
       you're using sh, ksh or bash, use EXPORT instead of setenv.)

       % setenv MANPATH "$MANPATH/:$PERL5LIB/../man"
       % man JUNOS::Device
       % setenv PATH "$PATH/:$PERL5LIB/../bin"
       % which xsltproc
        
    Back to Top  

   Running the Sample Scripts

   The JUNOScript Perl distribution includes sample scripts that demonstrate
   how to use JUNOScript to retrieve and change the configuration of a
   Juniper Networks router. The samples reside in the junoscript-n.n/examples
   directory.

   Reading configuration: Chassis Inventory
   This example sends a <get-chassis-information> request to the Juniper
   Networks router and displays the result to the standard output. Depending
   on the command line option, it uses XSLT to display the result in plain
   text, HTML, or raw XML. The purpose of this example is to show the power
   and flexibility of combining the JUNOScript and XSLT.

    1. Change directory to examples/get_chassis_inventory.
       [/my/junoscript-n.n]% cd examples/get_chassis_inventory
        
    1. Run the script get_chassis_inventory.pl.
       [/my/junoscript-n.n/examples/get_chassis_inventory]% perl
       get_chassis_inventory.pl [-d] [-o <outputfile>] [-x <xslfile>] [-m
       <access>] [-l <login>] [-p <password>] <router>

   Example:
   [/my/junoscript-n.n/examples/get_chassis_inventory]% perl
   get_chassis_inventory.pl router11
   login: johndoe
   password:

   Where:
   -d
   Optional. The default is debug off. If this flag is present, all debugging
   statements from the JUNOS modules will be sent to standard output.

   -x <xslfile>
   -o <outputfile>
   Optional.  If <xslfile> is specified, the <xslfile> is used for rendering
   the output.  If <xslfile> is not specified, xsl/chassis_inventory_csv.xsl
   is used by default.  You can use any of the three XSL files (csv, html,
   and xml) or create your own.  If <outputfile> is specified, the
   transformation will be put into <outputfile>. If <outputfile> is not
   specified, the result will be displayed on the standard output. 

   -m <access>
   Optional. The default value is telnet. It specifies which transport should
   be used to communicate with the Juniper Networks router. The valid values
   are ssh, ssl, clear-text, and telnet.

   -l <login>
   -p <password>
   The login identity and password to use when accessing the Juniper Networks
   router. The login identity must already exist in the router configuration
   and must have at least read privilege on the router. (Configure the login
   account by using the CLI command set system login user.) If these
   arguments are not provided on the command line, the user will be prompted
   to enter the information.

README  view on Meta::CPAN

    4. Populate tables in the database.
       [/my/junoscript-n.n/examples/RDB]% perl pop_tables.pl
       myrouter.acme.com.xmlconfig

       pop_tables.pl displays the exact command to type for step 7, it
       includes the primary key to identify the configuration.
        
    5. Use RDB tools to manipulate the data as desired.
        
    6. Regenerate XML from your database:
       [/my/junoscript-n.n/examples/RDB]% perl unpop_tables.pl
       jun_configuration 1 > config.xml
    Back to Top  

   Installation of PERL

   UNIX
    1. Retrieve the perl source package (http://cpan.org/src/stable.tar.gz)
        
    1. Install the stable.tar.gz.

       FreeBSD and Linux:
       % tar zxf stable.tar.gz

       Solaris:
       % gzip -dc stable.tar.gz | tar xf -

       Follow instruction in perl-5.6.1/INSTALL to install perl. You can make
       your private directory the standard directory for installation, then
       the perl executables and any Perl modules you install will
       automatically go to the directory you specified. Otherwise, take the
       defaults and the executables and modules will be installed under
       /usr/local.
    Back to Top  

   Installation of Perl Modules Required by Examples

   You can tell install-prereqs.pl to install only the modules required by
   JUNOS::Device or by a specific example. By default install-prereqs.pl
   install all required modules for JUNOS::Device, get_chassis_inventory.pl,
   load_configuration.pl and diagnose_bgp.pl. The RDB installation is kept
   separate because it required the installation of a RDB. This section shows
   you how to specify which set of modules to install.

   UNIX
    1. Go to the junoscript directory.
       % cd junoscript-n.n
        
    1. Install the Perl modules required by the specific example. If you wish
       to install the required files in your private directory instead of the
       standard directory, you can use the -install_directory option to
       specify your private installation directory. The standard directory is
       the installation directory configured in the perl executable.

       Installing modules under the standard directory (it's normally
       /usr/local/lib and you'll need root privilege):
       [/my/junoscript-n.n]% perl install-prereqs.pl -used_by <example>
       -force

       Installing modules under your own private directory (see notes below):
       [/my/junoscript-n.n]% setenv PERL5LIB /my/private/directory/lib
       [/my/junoscript-n.n]% perl install-prereqs.pl -used_by <example>
       -install_directory $PERL5LIB -force

       Where <example> is get_chassis_inventory, load_configuration, RDB,
       diagnose_bgp, or JUNOS::Device. If the -used_by option is not used,
       the default is to install all required modules except those required
       by RDB. The reason required modules for RDB is not part of the default
       installation is because it requires an RDB being installed first.

       When install-prereqs.pl is installing Term::ReadKey, it will prompt
       user for inputs.

       The option -force forces install-prereqs.pl to install the module even
       if an older version already exists or 'make test' fails. For more
       information on the install-prereqs.pl options, type 'perl
       install-prereqs.pl -help'.

   Notes for private directory installation:

     * Remember to set PERL5LIB before installation of the Perl modules and
       running the examples. PERL5LIB is an environment variable, it can be
       set to a colon-separated list of directories. If set, perl will first
       look for Perl modules in the PERL5LIB directories before looking in
       the standard directory. The instruction above uses the csh syntax for
       setting environment variable. For sh, ksh and bash, use EXPORT
       PERL5LIB=/my/private/directory/lib.
        
    Back to Top  

   Dependencies

   When you run the install script, you'll see the list of C libraries,
   executables, and Perl modules required by JUNOS::Device and its examples.
   The only module that the install script does not address is the mysql
   distribution. To run the RDB example, you must first install mysql before
   running the installation for RDB.

   If you wish to find out what are missing dependencies on your system
   without running the install script, you can run the following commands.

     perl required-mod.pl

    Back to Top  

   FAQ
   Installation

    1. The installation of Math::Pari failed. When I looked into the
       Math-Pari-<version>.log, it complaint about an illegal 'as' option -P
       is used.

       Check the versions of your gcc and as, using 'as -V' and 'gcc -v'. We
       recommend that you use gcc version 2.8.1 or higher and as 5.0 or
       higher.

       Also make sure your PATH is set correctly so the /usr/ccs/bin/as is
       used not /usr/local/bin/as.

    1. The installation of MIME::Base64, HTML::Parser, ... failed.  When I
       looked into the log files, they all complaint about 'ssh: cc not



( run in 0.662 second using v1.01-cache-2.11-cpan-39bf76dae61 )