Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Examples: Tests

It is assumed here that Test Agents (as many as are required for the tests) have been created according to the section Creating and Deploying a New Test Agent.

YANG Model Paths for Tests

Item YANG model path: /accounts/account/tests ...
tests /.
test[id] /test
id /test/id
name /test/name
status /test/status
start-time /test/start-time
end-time /test/end-time
report-url /test/report-url
steps /test/steps
step[id] /test/steps/step
name /test/steps/step/name
id /test/steps/step/id
start-time /test/steps/step/start-time
end-time /test/steps/step/end-time
status /test/steps/step/status
status-message /test/steps/step/status-message
templates /templates
template[name] /templates/template
name /templates/template/name
description /templates/template/description
parameters /templates/template/parameters
parameter[key] /templates/template/parameters/parameter
key /templates/template/parameters/parameter/key
type /templates/template/parameters/parameter/type

Prerequisites for Test Orchestration

  • In order to start a test through NETCONF using ncclient, it is required to first build a test template using the Control Center GUI as detailed in the section Setting Up Test Templates. All fields specified in that template as "Template input" will be required as parameters in the XML when orchestrating the initiation of the test template.
    • Running tests in Paragon Active Assurance is considered as "state" in the context of orchestration. State data is non-writable data that is not stored in the configuration database, as opposed to the configuration data mentioned in the section Overview of Test Agent Orchestration. This basically means that changes to tests or templates in the Control Center GUI will not cause any sync-related issues between Control Center and the configuration database.
  • To get report-url right in test reports, you need to make sure the Control Center URL is correctly configured. This is done in the file /opt/netrounds-confd/settings.py. By default the Control Center host name is retrieved using socket.gethostname(): see below. If this does not yield the correct result, you need to set the host name (or the entire URL) manually in this file.

Starting a Test

As described in the section Creating and Deploying a New Test Agent, run the command

from the directory /opt/netrounds-confd/ in order to output the YANG model. In this model, the RPC for starting a test using ncclient looks as follows:

For explanations, see the section Legend.

The following steps are shown below:

  1. Test Agents have been registered to the Paragon Active Assurance account, but no tests have yet been started.
  2. The required input parameters are identified in the test template that will be run.
  3. A 60 second HTTP test is started using ncclient.

Step 1: At the outset, no tests have been initiated in the Paragon Active Assurance account. See the screenshot below from the Control Center GUI.

Step 2: The template we will use to initiate the test in this example is an HTTP test template. It has two mandatory input fields (Clients and URL) which we have specified as such when building the template in the Control Center GUI. See the section Setting Up Test Templates.

We will define these parameters (among others) in the XML configuration communicated to the configuration database by our NETCONF manager (ncclient).

Step 3: The HTTP test is initiated using ncclient.

Below is example code where the required configuration information and parameters are specified for the HTTP test template. Depending on how the template has been built, the details here may vary.

For each parameter, the <key> attribute needs to be supplied. The key is identical to the parameter's Variable name in Control Center. You can inspect variable names as follows:

  • Click Tests on the side bar and select New Test Sequence.
  • Click My Templates.
  • Click the Edit link below the template of interest.
  • Click the Edit input button in the top right corner.

In our example, and by default, the variable names are simply lowercase versions of the display names seen in Control Center ("url" vs. "URL", etc.). However, in the Control Center GUI, you can rename the variables to whatever you like.

Besides the key, each parameter needs to have its type specified: for example, <string> for the URL. Please note that you need to review the complete YANG model in order to obtain full information on types. For Test Agent interfaces the type has a more complex structure, as evidenced under <clients> in the code below.

We can now run the script using ncclient. Assuming all is correct, the test will be initiated and its execution displayed in Control Center:

If the test is successfully started, Control Center will respond with the test ID. In this example, the test ID is 3:

The test ID can also be found in the URL for the test in the Control Center GUI. In this example, that URL is https://host/demo/testing/3/.

Retrieving Test Results

The most straightforward way to retrieve test results is by pointing to the test ID.

Below is Python code for getting the results from the above HTTP test with ID = 3:

The output will look something like this:

Exporting and Importing Test Templates

Test templates can be exported in JSON format and reimported in that format into Control Center. This is useful if you want to use test templates in a different installation of Control Center. (The initial creation of the templates is best handled through the Control Center GUI.)

Below is code for performing the export and import.

Exporting Test Templates

The template is contained in the json_config object.

Importing Test Templates

A JSON config object holding test templates can be reimported into Control Center as follows.