Installation guide
System Administration
Adding Custom Tests
13-15
4. You can change the result[“result_message”] to whatever text
you want. This message is what the end-user sees in the access windows.
This text also appears in the management console when you run reports.
5. Every test must return a hash with the following keys:
status_code – 0 test did not run, error occurred, 1
test ran
result_code – pass, fail
result_message – the text to display to the user
NOTE: Do not change the status_code or the result_code for this example.
6. Once you have completed your edits and saved the
myCheckSoftwareNotAllowed.py file, copy it to the following
directory on the NAC 800 MS:
/usr/local/nac/scripts/Custom/Tests
7. If you have created new base classes, copy them to the following directory
on the NAC 800 MS:
/usr/local/nac/scripts/Custom/BaseClasses
#
# All test classes must define the runTest method with the self and debug
# parameters
#
def runTest(self,debug=0):
#
# Get the result hash from the CheckSoftwareNotAllowed test
# and modify the result message based on the result code.
#
result = CheckSoftwareNotAllowed.runTest(self,debug)
if result["result_code"] == "fail":
result["result_message"] = "The MyCheckSoftwareNotAllowed test
failed."
elif result["result_code"] == "pass":
result["result_message"] = "The MyCheckSoftwareNotAllowed test
passed."
return result
Figure 13-3. Test Script Code (cont.)