Many Perl methods have one or more options or attributes. The following list describes the notation used to define a method’s options in the lib/JUNOS/Methods.pm and lib/JUNOS/release/package_methods.pl files, and the notation that an application uses when invoking the method:
## Method : <get-system-uptime-information> ## Returns: <system-uptime-information> ## Command: "show system uptime" get_system_uptime_information => $NO_ARGS,
To invoke a method without options, follow the method name with an empty set of parentheses as in the following example:
$jnx->get_system_uptime_information(????);
## Method : <get-software-information>
## Returns: <software-information>
## Command: "show version"
get_software_information =>
brief => $TOGGLE,
detail => $TOGGLE,
},
To include a fixed-form option when invoking a method, set it to the value 1 (one) as in the following example:
$jnx->get_software_information(brief => 1);
## Method : <get-cos-drop-profile-information>
## Returns: <cos-drop-profile-information>
## Command: "show class-of-service drop-profile"
get_cos_drop_profile_information => {
profile_name => $STRING,
},
To include a variable value when invoking a method, enclose the value in single quotes as in the following example (which appears on two lines for legibility:
$jnx->get_cos_drop_profile_information(profile_name => \
'user-drop-profile');
load_configuration => {
rollback => $ATTRIBUTE
},
To include a numerical attribute value when invoking a method, set it to the appropriate value. The following example rolls the candidate configuration back to the previous configuration that has an index of 2:
$jnx->load_configuration(rollback => 2);
To include a string attribute value when invoking a method, enclose the value in single quotes as in the following example:
$jnx->get_configuration(format => ‘text’);
get_configuration => {
configuration => $DOM,
format => $ATTRIBUTE,
database => $ATTRIBUTE,
},
To include a set of configuration statements when invoking a method, provide a parsed set of statements or tag elements. The following example refers to a set of JUNOS XML configuration tag elements in the config-input.xml file. For further discussion, see Example: Loading Configuration Statements.
my $parser = new XML::DOM::Parser;
$jnx->load_configuration(
format => ‘xml’,
action => ‘merge’,
configuration => $parser->parsefile(config-input.xml)
);
A method can have a combination of fixed-form options, options with variable values, attributes, and a set of configuration statements. For example, the get_route_forwarding_table method has four fixed-form options and five options with variable values:
## Method : <get-forwarding-table-information>
## Returns: <forwarding-table-information>
## Command: "show route forwarding-table"
get_forwarding_table_information => {
detail => $TOGGLE,
extensive => $TOGGLE,
multicast => $TOGGLE,
family => $STRING,
vpn => $STRING,
summary => $TOGGLE,
matching => $STRING,
destination => $STRING,
label => $STRING,
},