Novell ZENWORKS NETWORK ACCESS CONTROL 5.0 - 09-22-2008 User Manual page 350

Table of Contents

Advertisement

_____________________________________________________________________________
except:
_____________________________________________________________________________
#
# Always use the doReturn function; this allows superclass to add or modify
# any items in the returnHash as necessary.
#
return(self.doReturn(returnHash))
1 Use the template, as shown in
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 Novell
ZENworks Network Access Control when the test class is instantiated. It contains a
reference to a Session object, which is a built-in Python class defined by Novell
ZENworks Network Access Control 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
more information on the BasicTests API. This example does not use this API.
2
"checkOpenPorts.py script" on page 351
test. The file is included on the Novell ZENworks Network Access Control CD as /
sampleScripts/checkOpenPorts.py. Review the code. The comments explain each
section of the code.
350 Novell ZENworks Network Access Control Users Guide
#
# Replace 'pass' with your test here. Modify the returnHash accordingly.
#
pass
#
# Set the return status when exception occurs
#
import sys
returnHash['status_code'] = 0
returnHash['result_code'] = "unknown_error"
returnHash['result_message']
return(returnHash)
"testTemplate.py" on page
= sys.exc_type, sys.exc_value
348, to create a new test script. As an
Section 16.10.5, "BasicTests API," on page 356
shows the code for the new checkOpenPorts.py
for

Advertisement

Table of Contents
loading

This manual is also suitable for:

Zenworks network access control 5.0

Table of Contents