Top
ServerView Resource Orchestrator Cloud Edition V3.3.0 Design Guide
FUJITSU Software

F.6.2 Script Files

This section explains how to create script files.

Script Structure

This section explains the structure of scripts.
The process from establishing to releasing a telnet/ssh connection with the target network device is written in scripts.
The basic structure is shown in the following figure.

Variable Definition Section

Variable information is converted using information from the parameter file and DB and defined as a variable.

Connection (login)

Establishes a telnet connection to the admin LAN IP address defined in the variable.
Sends the login account defined in the variable.
Sends the login password defined in the variable.

Command Sending Section
  • If command files exist

    Send the content of the command file line by line.

  • If command files do not exist

    Executes the process of sending and receiving commands in a script.

Verification of execution results

If the command ends normally, the return value "normal" is set.
If the command process ends abnormally, the return value "error" is set.

Disconnection (logout)

Send the variable (logout string).
Disconnect the telnet connection.

Note

Define the process from connection to disconnection in the script.


Variable Information Usable in Scripts

Variables used in scripts are defined in the variable definition section.
Variables including variable information are defined between the reserved variables "%Unm_DefineStart%" and "%Unm_DefineEnd%" as follows.

# %Unm_DefineStart%

Define variables, including variable information.

# %Unm_DefineEnd%


Reserved variable names consist of character strings with "Unm" as a prefix and alphanumeric characters and an ampersand ("&"), underscores ("_"), and hyphens ("-"). "&" in a character string is a symbol utilized to split a character string into a meaningful string such as an L-Server name and a network resource name.
Reserved variable names which can be used in scripts are shown in the following table.

Table F.4 Reserved Variables that can be Used in Scripts

Information Type

Variable Name

Usage After Conversion

Variable information (beginning)

%Unm_DefineStart% (*1)

Specify the beginning of the range for variable conversion in a script.
Include this as a comment line once in a script.

Variable information (end)

%Unm_DefineEnd% (*1)

Specify the end of the range for variable conversion in a script.
Include this as a comment line once in a script.

Command file name

%Unm_CommandFileName% (*2)

Command file name

VLAN-ID

%Unm_VlanId% (*3)

VLAN-ID value

VLAN-ID

%Unm_VlanId&Network Resource Name% (*3)

VLAN-ID value

Admin IP address

%Unm_MyLoginIp%

IP address used for logging in to the target device via SSH/TELNET/FTP

Login account 1

%Unm_MyLoginAccount1%

Account name used for logging in to the target device via SSH/TELNET/FTP

Login account 2

%Unm_MyLoginAccount2%

Account name used for logging in to the target device via FTP

Login password 1

%Unm_MyLoginPass1%

SSH/TELNET password for logging in to the target device

Login password 2

%Unm_MyLoginPass2%

FTP password for logging in to the target device

Admin password 1

%Unm_MyAdminPass1%

Password to change to admin privileges of the target device

Admin account

%Unm_MyAdminAccount%

Admin account of the target device

Admin password 2

%Unm_MyAdminPass2%

Admin password of the target device

Login port

%Unm_LoginPort%

SSH/TELNET port for logging in to the target device

FTP admin IP address

%Unm_FtpLoginIp%

IP address for logging in from the target device via FTP

FTP login port

%Unm_FtpLoginPort%

Port used for logging in from the target device via FTP

FTP login account

%Unm_FtpLoginAccount%

Account name for logging in from the target device via FTP

FTP login password

%Unm_FtpLoginPass%

Password for logging in from the target device via FTP

Adjoining L2 switch 1

%Unm_SwNode1% (*4)

Network device name of the adjoining L2 switch connected to the physical rack server NIC
(If a physical server has redundant NICs, specify the first L2 switch connected to the first NIC)

Adjoining L2 switch 2

%Unm_SwNode2% (*4)

Network device name of second adjoining L2 switch connected to physical rack server redundant NIC

Adjoining L2 switch port 1

%Unm_SwPort1% (*4)

Port name of the second adjoining L2 switch connected to the physical rack server redundant NIC
Port name of the adjoining L2 switch connected to the physical rack server redundant NIC

Adjoining L2 switch port 2

%Unm_SwPort2% (*4)

Port name of second adjoining L2 switch connected to physical rack server redundant NIC

Network device IPv4 address

%Unm_Ipv4&Sequential Number&Network Resource Name% (*5)

IPv4 address configured on the interface of the automatic configuration target device

Network device IPv4 subnet

%Unm_Ipv4Subnet&Network Resource Name%

IPv4 subnet configured on the interface of the automatic configuration target device

Network device IPv4 subnet mask

%Unm_Ipv4SubnetMask&Network Resource Name%

IPv4 subnet mask configured on the interface of the automatic configuration target device

Network device IPv4 subnet mask length

%Unm_Ipv4SubnetMaskLength&Network Resource Name%

IPv4 subnet mask length configured on the interface of the automatic configuration device

Network device IPv6 address

%Unm_Ipv6&Sequential Number&Network Resource Name% (*5)

IPv6 address configured on the interface of the automatic configuration target device

Network device IPv6 prefix

%Unm_Ipv6Prefix&Network Resource Name%

IPv6 prefix configured on the interface of the automatic configuration target device

Network device IPv6 prefix length

%Unm_Ipv6PrefixLength&Network Resource Name%

IPv6 prefix length configured on the interface of the automatic configuration target device

VRID

%Unm_Vrid&Network Resource Name%

VRID configured on the interface of the automatic configuration target device

L-Platform name

%Unm_LplatformName%

Name of the L-Platform performing processing

L-PlatformID

%Unm_LplatformId%

Resource ID of the L-Platform performing processing

Firewall name

%Unm_FirewallName%

Name of the firewall processing the L-Platform

Firewall resource ID

%Unm_FirewallId%

Resource ID of the firewall processing the L-Platform

Server load balancer name

%Unm_SlbName%

The name of the processed SLB on the L-Platform

The server load balancer resource ID

%Unm_SlbId%

The resource ID of the processed SLB on the L-Platform

List of admin IP addresses of redundant network devices

%Unm_Group&Group Number%

List of admin IP addresses of the redundant network device corresponding to the group number of the script

The group number specified in the script list

Backup directory

%Unm_BackupDir% (*6)

Absolute path name of the backup directory

Current setting information

%Unm_Present&Variable name% (*7)

The content of the variable name used in the most recent configuration

Variable parameter specified by an infrastructure administrator

%Unm_Set_Variable_Character&Network_Resource_Name%

The value when a variable parameter excluding variable parameter limited by the system is specified in the interface configuration file

*1: The scope of the script lines converted by the script which converts variable information

  • When %Unm_DefineStart% is defined, but %Unm_DefineEnd% is not defined

    Lines from %Unm_DefineStart% to the last line of script files are considered as variable parameters to be converted.

  • When %Unm_DefineStart% is not defined, but %Unm_DefineEnd% is defined

    Variable parameter conversion is not executed in the script file.

  • When that %Unm_DefineStart% and %Unm_DefineEnd% are multiply defined

    Variable parameters between first %Unm_DefineStart% and %Unm_DefineEnd% from first line of file are the targets of variable parameter conversion.

*2: Command file name

In variable information of the command file name, configure the name added to "exec_discrimination number (8 - 10 digits)" before the command file name prescribed by the system.
When you use multiple command files in a script, it is necessary that variable parameters of the script are written as variable information of the command file name + n (n is a sequential number).

Example

"%Unm_CommandFileName%1.cli"
"%Unm_CommandFileName%2.cli"
"%Unm_CommandFileName%3.cli"
...

*3: VLAN-ID value of network resources

VLAN-ID values that can be used as variable information differ depending on the device to be configured automatically.
When you use the VLAN-ID value of a network resource as variable information, specify it in the following format in the script and the value will be resolved by the system.

  • When the automatically configured device is an L2 switch

    • VLAN-ID value : %Unm_VlanId%

      Specify the VLAN-ID configured for the network resource as variable information.

  • When the automatically configured device is a firewall

    • VLAN-ID value: %Unm_VlanId & Network resource name (up to 32 characters)%

      The VLAN-ID configured in the network resource corresponding to the specified network resource name is configured as variable information.
      For the network resource name, the name of the network resource in the segment used by the L-Platform can be used.

  • When the automatically configured device is a server load balancer

    • VLAN-ID value: %Unm_VlanId & Network resource name (up to 32 characters)%

      The VLAN-ID configured in the network resource corresponding to the specified network resource name is configured as variable information.
      For the network resource name, the name of the network resource in the segment where the server load balancer is located can be used.

*4: Reserved variable names when physical rack servers have redundant NICs

For a physical rack server with redundant NICs, the reserved variable names are as follows:

Figure F.4 Reserved Variable Names for Physical Rack Mount Servers with Redundant NICs

*5: Sequential numbers

Ensure that specified sequential numbers are the values corresponding to the IPv4/IPv6 addresses for the desired purpose.
Assign sequential numbers for each purpose to the IPv4/IPv6 addresses required by network devices, such as physical IPv4/IPv6 addresses for active units and virtual IPv4/IPv6 addresses for standby units.
Specify the mapping of the IPv4/IPv6 addresses for each purpose and assign sequential numbers in the following elements in the interface configuration file:

  • The IPv4Address element

  • The IPv6Address element

*6: Backup directory

Parameters in the following definition files are configured as a backup directory name.

  • Storage Location of the Definition File

    [Windows Manager]
    Installation_folder\SVROR\Manager\etc\customize_data\manager_backup.rcxprop

    [Linux Manager]
    /etc/opt/FJSVrcvmr/customize_data/manager_backup.rcxprop

  • Parameter Format of Definition Files

    ruleset_backup_dir=backup directory

    backup directory: specify the backup directory name using an absolute path.

    If this parameter is not specified, the following backup directory is specified by default.

    [Windows Manager]
    Installation_folder\SVROR\Manager\var\lserver_repair\ruleset_backup

    [Linux Manager]
    /var/opt/FJSVrcvmr/lserver_repair/ruleset_backup

*7: Current setting information

It is possible to obtain information from when creating resources for firewalls and server load balancers, until those resources are deleted.
When two or more types of scripts are executed during creation or modification of resources of firewalls or server load balancers, the variable name used by the script that was last executed can be used as the current setting information.
When using the current setting information, it is not possible to configure different values for individual scripts or to use different variable information names for individual scripts in the script list. The variable information name and value must be the same throughout the script list.
The variable names which can be specified for "variable name" of this reserved variable are the following reserved variable names, and user-defined variable names stated in the parameter file.

Table F.5 Reserved Variable Names that can be Used for "Variable Name"

Information Type

Reserved Variable Name

Command file name

%Unm_CommandFileName%

VLAN-ID

%Unm_VlanId&Network Resource Name%

L-Platform name

%Unm_LplatformName%

L-Platform resource ID

%Unm_LplatformId%

Firewall name

%Unm_FirewallName%

Firewall resource ID

%Unm_FirewallId%

Server load balancer name

%Unm_SlbName%

The server load balancer resource ID

%Unm_SlbId%

List of admin IP addresses of redundant network devices

%Unm_Group&Group Number%


Current setting information varies depending on how many times automatic configuration was performed.
"None" indicates that the variable name will not be converted because there is no value.

Table F.6 Example of Information Changed each time Auto-configuration is Executed

Number of Times Executed

Variable Name

Information of %Unm_Present & Variable name%

Variable Name Information

First time

A

None

1

B

None

2

C

None

3

Second time

A

1

11

B

2

2

C

3

None

Third time

A

11

11

B

2

2

C

None

1


Information

  • Reserved variable names are written in the following locations.

    • Any place in a command file

    • In the "node" operand and "param" operand in script lists

    • Between the "%Unm_DefineStart%" line and "%Unm_DefineEnd%" line in a script

  • When you do not use a sample script (as in cases where an infrastructure administrator creates their own new script), specify variable information which is usable in command files and scripts using character strings enclosed by % as in "% %". The maximum length of a variable information string is 128 characters.

  • In the character string enclosed by %, alphanumeric characters, underscores ("_"), and hyphens ("-") can be used. "Unm_" is a reserved variable name, so it cannot be included in variable names specified by users.

  • Variable information can be written in the following locations.

    • Any place in a command file

    • Between the "%Unm_DefineStart%" line and "%Unm_DefineEnd%" line in a script

Operation when Variable Information Conversion in a Script Fails

If conversion of variable information fails, variable information parameters are not converted and the script is executed.
If variable information in the command file is a character string before conversion, the script will not send that command or any associated commands to the network device.
A script execution error is not returned just because the conversion of variable information fails.
If conversion of the following variable information related with the adjoining L2 switch fails, the script is not executed and an error is returned because there is a problem when constructing information of the network device.

Return Codes Used by Scripts

The results of script execution are determined to be normal or abnormal based on their return code.
Based the code returned by a script, the process ends normally or recovery action is executed.
Return codes used for scripts are as follows.

Table F.7 Return Codes Used by Scripts

Return Code

Return Code Meaning

0

Processing of the script ended normally.

4

An error occurred in script execution, but the script can be executed again. (Connection closed or connection time out)

6

An error occurred in script execution, but the script can be executed again. (An error occurred before reflection of the definition on the network device)

8

An error occurred in script execution, and the script cannot be executed again. (Errors other than the above)
Changes the status of the network device for which the script was executed and the redundant network device into "error" and places them into "maintenance mode".
Take corrective action and then execute the following command to release "maintenance mode", which will change the status of the devices back to "normal".

  • Execute the rcxadm netdevice set command with the -attr mode=active option specified

    For information about the rcxadm netdevice command, refer to "3.8 rcxadm netdevice" in the "Reference Guide (Command/XML) CE".

Confirming Results of Script Execution

In order to check the progress of script execution and any errors in a script, create the script so that process content is logged to an arbitrary file.
Refer to the contents of the output log file to confirm results of script execution.
Sample scripts generate logs in the folder where rulesets are placed to provide reference information for infrastructure administrators.
When checking the content, copy the log file to an arbitrary user directory and then open the copied log file.

For the name of the log file output by sample scripts, refer to "G.5.5 Log Files of Sample Scripts".

Note

  • The above log file is used when infrastructure administrators check script action. Use of this log file by tenant users and administrators has not been considered. Accordingly, there is no protection between tenants.

  • Do not perform standard output or standard error output of script execution results, except for script files used by the rulesets for operations. If scripts which perform standard output or standard error output are used, automatic network device configuration may be aborted.

  • To perform standard output and standard error output of script execution results using the script files used by a ruleset for operations, it is necessary to specify the same processing method as the one used in the sample script. If you create and use an original processing method for standard output and standard error output, the execution result of the scripts for operations cannot be obtained and L-Platform operations may fail.

Operation when Script Executions Results are Abnormal

When there are abnormal script execution results when executing a script list, the operations that follow vary depending on the type of script list and the specifications of the definition file.

Script Lists

Operation when Script Executions Results are Abnormal

SCRIPT_EXECUTION_MODE=continue

SCRIPT_EXECUTION_MODE=stop

  • Script lists for setup

  • Script list for modification

  • Script lists for setup (physical server added)

  • Script lists for operations

Execution of the script is canceled.

If a script for recovery has been prepared, the script for recovery is executed. (*1)

  • Script list for deletion

  • Script lists for deletion (physical server deleted)

Execution of the script is continued.

Execution of the script is canceled.

  • Script lists for setup error recovery

  • Script lists for modification error recovery

  • Script lists for setup error recovery (physical server added)

Execution of the script is continued, without canceling execution of the script for recovery.

Execution of the script for recovery is canceled.

When the execution results are not abnormal, the script for recovery will be executed for all network devices.

*1: There are no scripts for recovery in script lists for operations.


For details of the specified parameters and possible parameter values of the definition file "SCRIPT_EXECUTION_MODE", refer to "F.7 Network Device Automatic Configuration and Operation Definition Files".


Differences in Operations Depending on Specifications in the Definition File "SCRIPT_EXECUTION_MODE"

The operations when executing scripts change depending on the specified values in the definition file "SCRIPT_EXECUTION_MODE". Decide the value to specify in "SCRIPT_EXECUTION_MODE" based on the specifications of the scripts being used.


Figure F.5 Example Script Operation not Reliant on SCRIPT_EXECUTION_MODE Specifications


Figure F.6 Example Script Operation for SCRIPT_EXECUTION_MODE=continue


Figure F.7 Example Script Operation for SCRIPT_EXECUTION_MODE=stop

Execution Conditions for Scripts for Recovery

This section explains the execution conditions for scripts for recovery.

For details of the specified parameters and possible parameter values of the definition file, refer to "F.7 Network Device Automatic Configuration and Operation Definition Files".