Configure Behavior Testing in CloudPak for Network Automation ( CP4NA )

Use Case: Validate changing states of services

This article is for users who are familiar with CloudPak for Network Automation ( CP4NA ), earlier called Telco Network Cloud Orchestrator ( TNC-O ) / Agile LifeCycle Manager ( ALM ) and intend to learn how to configure basic behavior tests.

Pre-Requisite: It is expected that you have a running instance of CloudPak for Network Automation ( CP4NA ) and able to use it for the below exercise.

Launch the UI of CP4NA

The package used for this exercise is a simple assembly descriptor named my_first_assembly. This is created for demo purpose with 2 Component Resources whose descriptor is a package called t_simple.

Steps:

1) Open Designer -> Assembly Designer

2) Open the assembly descriptor — my_first_assembly ( version 1.0)

3) Observe that there are 2 tabs at the bottom of the page, one capturing the assembly design ( Composition ) and the other denoting behavior testing.

4) Click on tab Behavior Testing

5) The Behavior testing tab opens.

6) There are 3 tabs within this: Assembly Configuration, Scenarios and Results as shown below:

7) Click on Create Assembly Configuration

8) This opens the Create Assembly Configuration pop up window

9) In the ‘Create Assembly Configuration’ pop up window provide the configuration name, description, property values as shown below and click Save.

10) The newly created assembly configuration is shown

11) Go to Scenarios tab

12) Create a scenario called Lifecycle Test

13) Open the created Lifecycle scenario

14) Choose an Assembly Configuration

15) Change the state to Installed at the start of the test phase and change it to Inactive after the scenario is complete. The scenario is set to Inactive in the lab so we are able to observe the same. If the same is set to Uninstall instead of Inactive, the service will be uninstalled and we will not be able to observe the execution. In order to re-run the test either change the state to Uninstall or manually uninstall the service.

16) After assembly configuration, choose the scenario from the Scenario Palette

17) Drag the scenario template from palette “When I change the state of an assembly”

18) Add other scenarios below the existing scenario as shown below

19) After adding the scenarios, click “Run Scenario” to test the assembly behavior

20) The scenario execution progress is displayed as below:

21) After the scenario is run, Go to Recent Assembly Instances and observe that a new instance with the name sut has been created. Also observe the state of the instance has been set to Inactive, as we have configured assembly state to be set to Inactive after testing. If uninstall state was chosen, then the instance also gets uninstalled, once the testing completes. Initiating another behavior test will attempt to create an instance with the same name ( sut ) and then fail. So, before commencing another behavior test, ensure that the instance from earlier test is no longer available.

22) Observe that the results of the behavior testing are available in the Results tab as shown below:

23) If the state is set to Inactive for the sut, ensure it is uninstalled, before running the test case again.

Viewing the execution of test scenarios.

Go to Recent Assembly Instances, on the sut row, click the 3 dots next to Open button and select Execution History

This shows the history of execution capturing the change of states as shown below:

Conclusion:

In this article, we discussed the steps to configure behavior testing for lifecycle states. The same can be extended to validate metrics and other automations.

--

--