HP 800 User Manual page 370

Network access controller
Hide thumbs Also See for 800:
Table of Contents

Advertisement

System Administration
Adding Custom Tests
#
# Always use the doReturn function; this allows superclass to add or
modify
# any items in the returnHash as necessary.
#
return(self.doReturn(returnHash))
Figure 13-5. testTemplate.py (cont.)
13-22
1.
Use the template, as shown in figure 13-5, to create a new test script. As
an example, the new test script is called checkOpenPorts.py, and it
fails if any of the specified ports are open on the target host being tested.
Before examining the code, consider the following information about the
test scripts:
All test scripts contain a self.inputParams hash table that has all
input parameters configured through the policy properties HTML. For
example, if the testConfig variable for the test is set to:
<input id="myparam" name="myparam" value="">
Then, the self inputParams contains a myparams key that is set to
the value of the HTML input element set in the policy editor.
All test scripts contain a self.session member variable that is set
by NAC 800 when the test class is instantiated. It contains a reference
to a Session object, which is a built-in Python class defined by NAC
800 and is used internally by the BasicTests class described later
in this section. However, to retrieve the host name or IP address, use
host() method:
self.session.host()
when developing scripts.
All tests contain a reference to the BasicTests class called
self.bt. The self.bt class gives you access to commonly used
functions for testing endpoints including registry operations and
service operations. See "BasicTests API" on page 13-28 for more
information on the BasicTests API. This example does not use this
API.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Procurve nac 800

Table of Contents