HPlogo Using NS 3000/iX Network Services: HP 3000 MPE/iX Computer Systems > Chapter 8 NetCI

Sample Applications

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

The following are sample NetCI applications that you can develop to use in a production environment. You can write a script file containing applicable commands, flow control statements, and data that will automatically perform different operations on multiple remote nodes.

Sample Script File 1

This application summarizes the network configuration for each node in NET3 of our sample internetwork. The following script will display all the entries in the network directory file for the NETXPORT (Network Transport) subsystem. We will write a script file called GETCONF that contains NMMGR commands to be executed on each node in NET3. Logging will also be used to send all output to an MPE log file called ALLCONF. This log file will be interactively entered with the LOG command before you execute the script file.

The GETCONF script file contains the following commands:

%file nmmgrcmd=$stdinx

reads input from the script file.

%run nmmgr.pub.sys

runs the NMMGR configuration program.

opendir nsdir.net.sys


opens the network directory file.

listdir

displays information on all entries for all nodes.

openconf nsconf.net.sys

opens the current NS configuration information file.

versionconf "A.02.03"

verifies the configuration version.

pathconf=netxport.ni.lan1 protocol.ip

specifies the path for the configuration file to be read.

readconf

displays the network configuration for the NETXPORT subsystem.

exit

exits NMMGR.

We are now ready to execute the script file, GETCONF, on all nodes in NET3 of our sample internetwork. If you recall our sample configuration file, node J was deleted from the NetCI configuration. However, we will assume we have added node J back into the configuration. Now we will crate a list called NET3 with the NEWLIST command.

     NetCI>NEWLIST NET3

We will then assign all the nodes in NET3 to this list with the ALTLIST command.

     NetCI>ALTLIST ADD NET3 H,L,K,J,I,Y

We can verify this by entering the SHOWLIST command at the NetCI prompt:

     NetCI>SHOWLIST NET3
     NET3     Nodes on list:       Y  I  J  K  L  H

Before executing the script file, we should create a disc file with a bigger record size so there will be no data overflow. We will use the BUILD command to create a disc file called ALLCONF with 10,000 records, each 80 characters long, and ASCII format. Next, we will run NetCI and redirect all output to be saved in this file with the LOG command.

     :BUILD ALLCONF;REC=- 80,100,F,ASCII;DISC=10000
     :RUN NETCI.PUB.SYS

To execute the GETCONF script file, enter

     NetCI>LOG ALLCONF     NetCI>NET3 PLAY GETCONF     ALLNODES>/LOGRESET     ALLNODES>/EXIT

The script file will be executed sequentially on all the nodes in NET3. After the script file is executed, we can then print the logfile, ALLCONF, to view the network directory and configuration file information for all the nodes in NET3.

Since it is likely that the script file will take awhile to execute, you may want to create a job stream to execute it.

Sample Script File 2

This application shows how to install a new version of software and to convert existing files for use with this new software. We will write a script file, INSTALL, that copies the file, PROG, and the conversion program, CONVERT, to a new group, NEWVERS, at each node in NET3. We will then execute the CONVERT program to convert the file (PROG.NEWVERS). After the conversion, we will purge the old file in the APPLIC group (PROG.APPLIC) and rename the new converted file to the same file name and group as the old file. You can use NetCI to perform this task using one script file, INSTALL, and the PLAY global command.

The INSTALL script file contains the following commands:

%dsline local=!1

file equation for the node defined as local. The referenced node will be specified with the PLAY command.

%newgroup newvers

creates a new group called newvers on the node.

%dscopy

runs the DSCOPY subsystem.

prog.newvers:local [operator.sys] to @.NEWVERS;REP

specifies that the target file will have the same file name as the source file. REP option replaces the existing file in the destination node with the new file if a file with the same name exists.

convert.newvers:local [operator.sys] to @.NEWVERS;REP

specifies that the target file will have the same file name as the source file. REP option replaces the existing file in the destination node with the new file if a file with the same name exists.

//

exits DSCOPY.

%run convert.newvers

executes the CONVERT program to convert the PROG file.

%purge convert.newvers

purges CONVERT program file on target node.

%purge prog.applic

purges old existing file in the APPLIC group on target node.

%rename prog.newvers,prog. applic

renames converted file on target node to the same file and group name as the old file.

%purgegroup newvers

purges the newvers group on the target node.

yes

response to the question verifying that the newvers group is to be purged.

%run prog.applic;info= "showversion"

checks that the converted file has been converted for use with the new version of software.

%tellop...**applic: version a.01.01 installed & ready**

displays a message that the current software version has been successfully installed and is ready for use.

We are now ready to execute the script file, INSTALL, on all nodes in NET3 of our sample internetwork. If you recall from Sample Script File 1, all nodes in NET3 are members of the list called NET3.

To execute the INSTALL script file, enter

     NetCI>NET3 PLAY INSTALL H

If you specify the output to a log file, you can later scan the file for errors. Additional MPE statements can be added to provide for more robust error checking such as the handling of unexpected errors. For example, if someone is running the application, the :PURGE command will fail. We can use MPE commands such as :IF or :ELSE to also modify the execution of the script file.

Sample Script File 3

This application shows how you can create a script file containing a job stream for the nodes in NET3 of our sample internetwork. The following script will contain the :STREAM job command for the different nodes. When you execute the script file called SYSCONF, this will stream a job file called CONFJOB which will then execute the SYSINFO program (which lists the configuration information for the node).

All the commands in the CONFJOB job file may also be included in a script file. However, we will assume you already have an existing job file that contains these commands. You only need to create a script file to stream the job file. By streaming an existing job file within a script file, you do not need to type again all the commands from the job file into the script file, and you can always run the job file in MPE.

The SYSCONF script file contains the following stream command:

%stream confjob.util.sys

streams a job on a node.

Although the script file contains only one command line, it is sometimes easier to enter PLAY SYSCONF than entering the entire command line.The CONFJOB job file contains the following commands and data:

!job net3,operator.sys/net3k;hipri;pri=cs;outclass=epoc,13

!comment this will print the system configuration report

!file conflist=sysinfo;dev=pp;env=elite.hpenv.sys

!run sysinfo.prv.telesup

out pp

title "NET3"

all

exit

!eoj

The job file, CONFJOB, will run a program on the node or list that you specify with the PLAY command. This program called SYSINFO will generate a report listing the node's configuration. The configuration includes the devices on the system, other system information such as MPE tables, program stack size usages, directory usage, system logging, user logging, spooling, virtual memory, GIC hardware configuration summary, data communication device summary, and so forth.

To execute this script file against all the nodes in NET3, we will execute the SYSCONF script file on the previously configured list named NET3. To execute this script file, enter

     NetCI>NET3 PLAY SYSCONF

This will stream the job for each node in NET3. When the job is completed for nodes Y, I, J, K, L, and H, the configuration listing will be sent to the printer.

Example

The following example shows how you can also create a script file which can be executed on each node/list instead of a script file containing a job stream. We will write a script file called NODCONF that will execute the SYSINFO program on the node that you specify with the PLAY command. Logging will be used to send all output to a log file called REPORT.

The NODCONF script file contains the following commands:

%/log report

redirects output to logfile called REPORT.

%run sysinfo.prv.telesup

executes program.

title "NET3"

information required by program.

all

information required by program.

exit

exits program.

%/logreset

resets output back to the screen.

We are now ready to execute the script file, NODCONF, on any node. For example, to execute the script file on node L, enter

     NetCI>L PLAY NODCONF

which will generate the system configuration listing for node L.

To execute the script file on all nodes in NET3, enter

     NetCI>NET3 PLAY NODCONF

which will generate the system configuration listing for NET3. The listings for node L and NET3 will be in the REPORT log file residing on node K which is the management node.

Sample Script File 4

This application shows how you can create a script file called SYSOP containing operations or jobs to be run at a particular time. The following script file shows how you can effectively use flow control commands to control the execution of these operations or jobs to be run at particular times.

The SYSOP script file contains the following commands:

%/while hour < 24%    /comment The following operations are done between 8am and 5pm.%    /if hour > 7%        /if hour < 18%            showjob job=@j%        /else%            /comment This operation is done only at 8pm.%            /if hour = 20%                showjob job=@s%            /endif%            /comment At 10pm the following operation must be done.%            /if hour = 22%                listf @ipc@.maildb.hpoffice,2%            /endif%        /endif%    /endif%    /inc hour%    /comment Replace v in the following statement with the remaining%    /comment number of seconds until the next approximate hour.%    /wait v%/endwhile

We are now ready to execute the script file, SYSOP, on any node. Before we execute the script file, we must interactively assign a value (the current time) to the variable called "hour". To set the current time, enter

     NetCI>LET HOUR=X (X is current hour, for example, 6 for 6 A.M.)

After specifying the current time, we are now ready to execute the SYSOP script file. To execute this script file, enter

     NETCI>NET3 PLAY SYSOP

to run particular operations at specified times on all the nodes that are members of the NET3 list.

If you are executing the script file on a list, you should change the wait duration to a value that will allow the file enough time to execute on all nodes during each hour. For example, if it takes approximately 1200 seconds to execute the script file on all nodes that are members of the NET3 list, you could assign 2400 seconds as the wait value. This would be enough time for execution to have occurred on all the nodes. The script file will take about 1200 seconds to execute and then wait 2400 seconds to execute again. This will be approximately the next hour.

Feedback to webmaster