summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormrpa <miruna.paun@enea.com>2021-01-26 17:21:42 +0100
committerMiruna Paun <mrpa@enea.se>2021-01-27 15:30:21 +0200
commitf6cfce42ff1ad5f49d76028d7cdf67ab158ed3cb (patch)
treeb310e077197ff42211de5d47f53417db47add024
parent1eee467409871bc24c5385e825afa7139c19a9f1 (diff)
downloadnfv-access-documentation-f6cfce42ff1ad5f49d76028d7cdf67ab158ed3cb.tar.gz
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 <miruna.paun@enea.com>
-rw-r--r--doc/book-enea-nfv-access-auto-fw-th-user-guide/doc/automation_framework_test_harness.xml126
-rw-r--r--doc/book-enea-nfv-access-system-test-specification/doc/sample_test_cases.xml96
2 files changed, 218 insertions, 4 deletions
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</programlisting></para>
343 <section id="run_ut_suite"> 343 <section id="run_ut_suite">
344 <title>Running Python Unit-Test Suite</title> 344 <title>Running Python Unit-Test Suite</title>
345 345
346 <note>
347 <para>Please update all JSON configuration files to use the name of
348 your vCPE agent device. In the following chapters, intelc3850-2 is
349 used as an example.</para>
350 </note>
351
346 <para>Below you'll find sample unit-test command line options for 352 <para>Below you'll find sample unit-test command line options for
347 running the Fortigate <emphasis role="bold">deployment</emphasis> 353 running the Fortigate <emphasis role="bold">deployment</emphasis>
348 scenario:</para> 354 scenario:</para>
@@ -2407,6 +2413,126 @@ phase always-after-startup from inteld1521-6
2407 </section> 2413 </section>
2408 </section> 2414 </section>
2409 2415
2416 <section id="custom_script_eg">
2417 <title>Custom Script - Full Example</title>
2418
2419 <para>All Python API used in this example are described in detail in the following sections.</para>
2420
2421 <para>The list of custom scripts can be found in
2422 <literal>&lt;AF-TH-install-dir&gt;/lab_config/customScripts</literal>:</para>
2423
2424 <itemizedlist spacing="compact">
2425 <listitem>
2426 <para><filename>test_fail_after_always</filename>. Phase:
2427 always-after-startup.</para>
2428 </listitem>
2429
2430 <listitem>
2431 <para><filename>test_fail_after_once</filename>. Phase:
2432 once-after-startup.</para>
2433 </listitem>
2434
2435 <listitem>
2436 <para><filename>test_fail_before_always</filename>. Phase:
2437 always-before-startup.</para>
2438 </listitem>
2439
2440 <listitem>
2441 <para><filename>test_fail_before_once</filename>. Phase:
2442 once-before-startup.</para>
2443 </listitem>
2444
2445 <listitem>
2446 <para><filename>test_success_after_always</filename>. Phase:
2447 always-after-startup.</para>
2448 </listitem>
2449
2450 <listitem>
2451 <para><filename>test_success_after_once</filename>. Phase:
2452 once-after-startup.</para>
2453 </listitem>
2454
2455 <listitem>
2456 <para><filename>test_success_before_always</filename>. Phase:
2457 always-before-startup.</para>
2458 </listitem>
2459
2460 <listitem>
2461 <para><filename>test_success_before_once</filename>. Phase:
2462 once-before-startup.</para>
2463 </listitem>
2464 </itemizedlist>
2465
2466 <note>
2467 <para>The following example uses the
2468 <filename>test_success_after_always</filename> custom script.</para>
2469 </note>
2470
2471 <section id="upload_customscrp_ucpemg">
2472 <title>Uploading a Custom Script to the uCPE Manager</title>
2473
2474 <programlisting>$ python automation_framework/customScripts/upload.py \
2475-f lab_config/customScripts/test_success_after_always -e always-after-startup
24762020-04-14 14:08:02,824 - DEBUG: Started logging
24772020-04-14 14:08:02,915 - INFO: Upload Custom Script
24782020-04-14 14:08:02,994 - DEBUG: Login successful on host '172.24.3.109'
24792020-04-14 14:08:02,995 - DEBUG: Session token is: 97544990-7e48-11ea-835c-02423a1c239f
24802020-04-14 14:08:02,996 - DEBUG: Upload test_success_after_always to uCPE Manager. \
2481Content: #!/bin/bash
2482echo test_success_after_always
24832020-04-14 14:08:03,138 - INFO: Done
24842020-04-14 14:08:03,169 - DEBUG: Logging out and exiting...</programlisting>
2485 </section>
2486
2487 <section id="upload_customscrp_device">
2488 <title>Uploading a Custom Script from the uCPE Manager to a
2489 Device</title>
2490
2491 <programlisting>$ python automation_framework/customScripts/uploadOnDevice.py -c \
2492test_success_after_always -e always-after-startup -n inteld1521-6
24932020-04-14 14:26:26,205 - DEBUG: Started logging
24942020-04-14 14:26:26,206 - INFO: Upload Custom Script on Device
24952020-04-14 14:26:26,251 - DEBUG: Login successful on host '172.24.3.109'
24962020-04-14 14:26:26,252 - DEBUG: Session token is: 28ebcb10-7e4b-11ea-835c-02423a1c239f
24972020-04-14 14:26:26,286 - DEBUG: Found device with name 'inteld1521-6'
24982020-04-14 14:26:26,287 - DEBUG: Upload test_success_after_always to inteld1521-6
24992020-04-14 14:26:26,314 - INFO: Done
25002020-04-14 14:26:26,341 - DEBUG: Logging out and exiting...</programlisting>
2501 </section>
2502
2503 <section id="removing_customscrp_device">
2504 <title>Removing a Custom Script from a Device</title>
2505
2506 <programlisting>$ python automation_framework/customScripts/deleteOnDevice.py -c \
2507test_success_after_always -e always-after-startup -n inteld1521-6
25082020-04-14 14:33:52,288 - DEBUG: Started logging
25092020-04-14 14:33:52,288 - INFO: Delete Custom Script on Device
25102020-04-14 14:33:52,327 - DEBUG: Login successful on host '172.24.3.109'
25112020-04-14 14:33:52,327 - DEBUG: Session token is: 32cde4f0-7e4c-11ea-835c-02423a1c239f
25122020-04-14 14:33:52,349 - DEBUG: Found device with name 'inteld1521-6'
25132020-04-14 14:33:52,349 - DEBUG: Delete test_success_after_always, \
2514phase always-after-startup from inteld1521-6
25152020-04-14 14:33:52,373 - INFO: Done
25162020-04-14 14:33:52,391 - DEBUG: Logging out and exiting...</programlisting>
2517 </section>
2518
2519 <section id="remove_customscrp_ucpemg">
2520 <title>Removing a Custom Script from the uCPE Manager</title>
2521
2522 <programlisting>$ python automation_framework/customScripts/delete.py -c \
2523test_success_after_always -e always-after-startup
25242020-04-14 14:39:22,042 - DEBUG: Started logging
25252020-04-14 14:39:22,042 - INFO: Delete Custom Script on uCPE Manager
25262020-04-14 14:39:22,081 - DEBUG: Login successful on host '172.24.3.109'
25272020-04-14 14:39:22,082 - DEBUG: Session token is: f75a83a0-7e4c-11ea-835c-02423a1c239f
25282020-04-14 14:39:22,099 - DEBUG: Found custom script: 'test_success_after_always'
25292020-04-14 14:39:22,099 - DEBUG: Delete script test_success_after_always, \
2530phase always-after-startup from uCPE Manager
25312020-04-14 14:39:22,118 - INFO: Done
25322020-04-14 14:39:22,135 - DEBUG: Logging out and exiting...</programlisting>
2533 </section>
2534 </section>
2535
2410 <section id="add_offline_config_store"> 2536 <section id="add_offline_config_store">
2411 <title>Adding an Offline Configuration Store</title> 2537 <title>Adding an Offline Configuration Store</title>
2412 2538
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!</programlisting></para>
1502 targetptr="fortigate_firewall_uc_1">FortiGate VNF as a 1502 targetptr="fortigate_firewall_uc_1">FortiGate VNF as a
1503 Firewall in the <ns:include 1503 Firewall in the <ns:include
1504 href="../../s_docbuild/olinkdb/pardoc-names.xml" 1504 href="../../s_docbuild/olinkdb/pardoc-names.xml"
1505 xpointer="element(book_enea_nfv_access_example_usecases/1)" 1505 xmlns:ns="http://www.w3.org/2001/XInclude"
1506 xmlns:ns="http://www.w3.org/2001/XInclude" /></olink> 1506 xpointer="element(book_enea_nfv_access_example_usecases/1)" /></olink>
1507 Manual.</para> 1507 Manual.</para>
1508 </listitem> 1508 </listitem>
1509 1509
@@ -1512,8 +1512,8 @@ FortigateFWInstance tested successfully!</programlisting></para>
1512 targetdoc="book_enea_nfv_access_auto_fw_th_user_guide" 1512 targetdoc="book_enea_nfv_access_auto_fw_th_user_guide"
1513 targetptr="python_testsuite">Python Unit-Test Suite in 1513 targetptr="python_testsuite">Python Unit-Test Suite in
1514 <ns:include href="../../s_docbuild/olinkdb/pardoc-names.xml" 1514 <ns:include href="../../s_docbuild/olinkdb/pardoc-names.xml"
1515 xpointer="element(book_enea_nfv_access_auto_fw_th_user_guide/1)" 1515 xmlns:ns="http://www.w3.org/2001/XInclude"
1516 xmlns:ns="http://www.w3.org/2001/XInclude" /></olink>.</para> 1516 xpointer="element(book_enea_nfv_access_auto_fw_th_user_guide/1)" /></olink>.</para>
1517 </listitem> 1517 </listitem>
1518 </itemizedlist> 1518 </itemizedlist>
1519 </listitem> 1519 </listitem>
@@ -1714,4 +1714,92 @@ LAN-to-LAN connectivity (through VPN tunnel)tested successfully!</programlisting
1714-e "site1=inteld1521-1 site2=inteld1521-2 arch=XeonD"</programlisting></para> 1714-e "site1=inteld1521-1 site2=inteld1521-2 arch=XeonD"</programlisting></para>
1715 </section> 1715 </section>
1716 </section> 1716 </section>
1717
1718 <section id="custom_scripts_bt">
1719 <title>Custom Scripts - Basic Test</title>
1720
1721 <para>The basic test script can be found in
1722 <literal>&lt;AF-TH-install-dir&gt;/playbooks/customScripts/basicTest.yml</literal>.</para>
1723
1724 <para>The <filename>basicTest.yml</filename> script requires the following
1725 steps:</para>
1726
1727 <orderedlist spacing="compact">
1728 <listitem>
1729 <para>Upload a Custom Script onto the uCPE Manager.</para>
1730 </listitem>
1731
1732 <listitem>
1733 <para>Upload the Custom Script onto a Device.</para>
1734 </listitem>
1735
1736 <listitem>
1737 <para>Reboot the Device.</para>
1738 </listitem>
1739
1740 <listitem>
1741 <para>Wait for the Device to be up and running.</para>
1742 </listitem>
1743
1744 <listitem>
1745 <para>Remove the Custom Script from the Device.</para>
1746 </listitem>
1747
1748 <listitem>
1749 <para>Remove the Custom Script from the uCPE Manager.</para>
1750 </listitem>
1751 </orderedlist>
1752
1753 <para><emphasis role="bold">Preconditions:</emphasis></para>
1754
1755 <itemizedlist>
1756 <listitem>
1757 <para>A device must have been previously added and connected to the
1758 uCPE Manager.</para>
1759 </listitem>
1760
1761 <listitem>
1762 <para>The device JSON configuration file must have been created:
1763 <filename>&lt;AF-TH-install-dir&gt;/lab_config/&lt;Device-name&gt;/&lt;Device-name&gt;.json</filename>.</para>
1764 </listitem>
1765
1766 <listitem>
1767 <para>The custom script should have been previously saved in
1768 <literal>&lt;AF-TH-install-dir&gt;/lab_config/customScripts</literal>.</para>
1769 </listitem>
1770
1771 <listitem>
1772 <para>Add device settings in the <literal>hosts</literal> Ansible inventory file under
1773 <literal>[customScriptDevice]</literal> and remove the <literal>inteld1521-1</literal>
1774 example.</para>
1775 </listitem>
1776 </itemizedlist>
1777
1778 <para><emphasis role="bold">Example:</emphasis></para>
1779
1780 <programlisting>[customScriptDevice]
1781inteld1521-1 ansible_host=172.24.12.73 ansible_port=22 ansible_user=root \
1782 ansible_pass=root</programlisting>
1783
1784 <para><emphasis role="bold">Action:</emphasis> Run
1785 <filename>basicTest.yml</filename> (example data for
1786 <filename>test_success_after_always</filename>):</para>
1787
1788 <programlisting>ansible-playbook playbooks/customScripts/basicTest.yml -e "device=&lt;Device-name&gt;" \
1789-e "scriptName=test_success_after_always" -e "phase=always-after-startup" \
1790-e "expectedStatus=success"</programlisting>
1791
1792 <para><emphasis role="bold">Result:</emphasis> Output of
1793 <filename>basicTest.yml</filename>:</para>
1794
1795 <programlisting>test_success_after_always was uploaded to uCPE Manager!
1796test_success_after_always was uploaded to &lt;Device-name&gt;!
1797
1798&lt;Device-name&gt; device is connected!
1799test_success_after_always from phase always-after-startup was removed \
1800from &lt;Device-name&gt;!
1801
1802test_success_after_always from phase always-after-startup was removed \
1803from uCPE Manager!</programlisting>
1804 </section>
1717</chapter> \ No newline at end of file 1805</chapter> \ No newline at end of file