From f6cfce42ff1ad5f49d76028d7cdf67ab158ed3cb Mon Sep 17 00:00:00 2001 From: mrpa Date: Tue, 26 Jan 2021 17:21:42 +0100 Subject: Added a note in 4.1.1.5 Running Python Unit-Test Suite (AFTH) Added the new section 4.1.25 Custom Script full example (AFTH) Added the new section 3.4 Custom Scripts basic test (Test Spec). Change-Id: I729768eb72417264b1a286638372a584361a7e33 Signed-off-by: mrpa --- .../doc/automation_framework_test_harness.xml | 126 +++++++++++++++++++++ .../doc/sample_test_cases.xml | 96 +++++++++++++++- 2 files changed, 218 insertions(+), 4 deletions(-) (limited to 'doc') diff --git a/doc/book-enea-nfv-access-auto-fw-th-user-guide/doc/automation_framework_test_harness.xml b/doc/book-enea-nfv-access-auto-fw-th-user-guide/doc/automation_framework_test_harness.xml index 4ab9cd1..fd21087 100644 --- a/doc/book-enea-nfv-access-auto-fw-th-user-guide/doc/automation_framework_test_harness.xml +++ b/doc/book-enea-nfv-access-auto-fw-th-user-guide/doc/automation_framework_test_harness.xml @@ -343,6 +343,12 @@ NOTSET 0
Running Python Unit-Test Suite + + Please update all JSON configuration files to use the name of + your vCPE agent device. In the following chapters, intelc3850-2 is + used as an example. + + Below you'll find sample unit-test command line options for running the Fortigate deployment scenario: @@ -2407,6 +2413,126 @@ phase always-after-startup from inteld1521-6
+
+ Custom Script - Full Example + + All Python API used in this example are described in detail in the following sections. + + The list of custom scripts can be found in + <AF-TH-install-dir>/lab_config/customScripts: + + + + test_fail_after_always. Phase: + always-after-startup. + + + + test_fail_after_once. Phase: + once-after-startup. + + + + test_fail_before_always. Phase: + always-before-startup. + + + + test_fail_before_once. Phase: + once-before-startup. + + + + test_success_after_always. Phase: + always-after-startup. + + + + test_success_after_once. Phase: + once-after-startup. + + + + test_success_before_always. Phase: + always-before-startup. + + + + test_success_before_once. Phase: + once-before-startup. + + + + + The following example uses the + test_success_after_always custom script. + + +
+ Uploading a Custom Script to the uCPE Manager + + $ python automation_framework/customScripts/upload.py \ +-f lab_config/customScripts/test_success_after_always -e always-after-startup +2020-04-14 14:08:02,824 - DEBUG: Started logging +2020-04-14 14:08:02,915 - INFO: Upload Custom Script +2020-04-14 14:08:02,994 - DEBUG: Login successful on host '172.24.3.109' +2020-04-14 14:08:02,995 - DEBUG: Session token is: 97544990-7e48-11ea-835c-02423a1c239f +2020-04-14 14:08:02,996 - DEBUG: Upload test_success_after_always to uCPE Manager. \ +Content: #!/bin/bash +echo test_success_after_always +2020-04-14 14:08:03,138 - INFO: Done +2020-04-14 14:08:03,169 - DEBUG: Logging out and exiting... +
+ +
+ Uploading a Custom Script from the uCPE Manager to a + Device + + $ python automation_framework/customScripts/uploadOnDevice.py -c \ +test_success_after_always -e always-after-startup -n inteld1521-6 +2020-04-14 14:26:26,205 - DEBUG: Started logging +2020-04-14 14:26:26,206 - INFO: Upload Custom Script on Device +2020-04-14 14:26:26,251 - DEBUG: Login successful on host '172.24.3.109' +2020-04-14 14:26:26,252 - DEBUG: Session token is: 28ebcb10-7e4b-11ea-835c-02423a1c239f +2020-04-14 14:26:26,286 - DEBUG: Found device with name 'inteld1521-6' +2020-04-14 14:26:26,287 - DEBUG: Upload test_success_after_always to inteld1521-6 +2020-04-14 14:26:26,314 - INFO: Done +2020-04-14 14:26:26,341 - DEBUG: Logging out and exiting... +
+ +
+ Removing a Custom Script from a Device + + $ python automation_framework/customScripts/deleteOnDevice.py -c \ +test_success_after_always -e always-after-startup -n inteld1521-6 +2020-04-14 14:33:52,288 - DEBUG: Started logging +2020-04-14 14:33:52,288 - INFO: Delete Custom Script on Device +2020-04-14 14:33:52,327 - DEBUG: Login successful on host '172.24.3.109' +2020-04-14 14:33:52,327 - DEBUG: Session token is: 32cde4f0-7e4c-11ea-835c-02423a1c239f +2020-04-14 14:33:52,349 - DEBUG: Found device with name 'inteld1521-6' +2020-04-14 14:33:52,349 - DEBUG: Delete test_success_after_always, \ +phase always-after-startup from inteld1521-6 +2020-04-14 14:33:52,373 - INFO: Done +2020-04-14 14:33:52,391 - DEBUG: Logging out and exiting... +
+ +
+ Removing a Custom Script from the uCPE Manager + + $ python automation_framework/customScripts/delete.py -c \ +test_success_after_always -e always-after-startup +2020-04-14 14:39:22,042 - DEBUG: Started logging +2020-04-14 14:39:22,042 - INFO: Delete Custom Script on uCPE Manager +2020-04-14 14:39:22,081 - DEBUG: Login successful on host '172.24.3.109' +2020-04-14 14:39:22,082 - DEBUG: Session token is: f75a83a0-7e4c-11ea-835c-02423a1c239f +2020-04-14 14:39:22,099 - DEBUG: Found custom script: 'test_success_after_always' +2020-04-14 14:39:22,099 - DEBUG: Delete script test_success_after_always, \ +phase always-after-startup from uCPE Manager +2020-04-14 14:39:22,118 - INFO: Done +2020-04-14 14:39:22,135 - DEBUG: Logging out and exiting... +
+
+
Adding an Offline Configuration Store diff --git a/doc/book-enea-nfv-access-system-test-specification/doc/sample_test_cases.xml b/doc/book-enea-nfv-access-system-test-specification/doc/sample_test_cases.xml index f4b2fc7..2fa087b 100644 --- a/doc/book-enea-nfv-access-system-test-specification/doc/sample_test_cases.xml +++ b/doc/book-enea-nfv-access-system-test-specification/doc/sample_test_cases.xml @@ -1502,8 +1502,8 @@ FortigateFWInstance tested successfully! targetptr="fortigate_firewall_uc_1">FortiGate VNF as a Firewall in the + xmlns:ns="http://www.w3.org/2001/XInclude" + xpointer="element(book_enea_nfv_access_example_usecases/1)" /> Manual. @@ -1512,8 +1512,8 @@ FortigateFWInstance tested successfully! targetdoc="book_enea_nfv_access_auto_fw_th_user_guide" targetptr="python_testsuite">Python Unit-Test Suite in . + xmlns:ns="http://www.w3.org/2001/XInclude" + xpointer="element(book_enea_nfv_access_auto_fw_th_user_guide/1)" />. @@ -1714,4 +1714,92 @@ LAN-to-LAN connectivity (through VPN tunnel)tested successfully!
+ +
+ Custom Scripts - Basic Test + + The basic test script can be found in + <AF-TH-install-dir>/playbooks/customScripts/basicTest.yml. + + The basicTest.yml script requires the following + steps: + + + + Upload a Custom Script onto the uCPE Manager. + + + + Upload the Custom Script onto a Device. + + + + Reboot the Device. + + + + Wait for the Device to be up and running. + + + + Remove the Custom Script from the Device. + + + + Remove the Custom Script from the uCPE Manager. + + + + Preconditions: + + + + A device must have been previously added and connected to the + uCPE Manager. + + + + The device JSON configuration file must have been created: + <AF-TH-install-dir>/lab_config/<Device-name>/<Device-name>.json. + + + + The custom script should have been previously saved in + <AF-TH-install-dir>/lab_config/customScripts. + + + + Add device settings in the hosts Ansible inventory file under + [customScriptDevice] and remove the inteld1521-1 + example. + + + + Example: + + [customScriptDevice] +inteld1521-1 ansible_host=172.24.12.73 ansible_port=22 ansible_user=root \ + ansible_pass=root + + Action: Run + basicTest.yml (example data for + test_success_after_always): + + ansible-playbook playbooks/customScripts/basicTest.yml -e "device=<Device-name>" \ +-e "scriptName=test_success_after_always" -e "phase=always-after-startup" \ +-e "expectedStatus=success" + + Result: Output of + basicTest.yml: + + test_success_after_always was uploaded to uCPE Manager! +test_success_after_always was uploaded to <Device-name>! + +<Device-name> device is connected! +test_success_after_always from phase always-after-startup was removed \ +from <Device-name>! + +test_success_after_always from phase always-after-startup was removed \ +from uCPE Manager! +
\ No newline at end of file -- cgit v1.2.3-54-g00ecf