You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 33 Next »


Automatics - Introduction

Automatics is a test setup for verifying RDK builds. It can be integrated with CI flow to validate new changes checked in by user. Also, user can trigger automated tests against given RDK builds.

Automatics helps in faster release of RDK builds by validating builds using automated test execution. The results of test execution can be viewed from results page of Automatics.

Automatics Setup

Setup details will guide the user to setup Automatics system in their environment.  It includes following details.

  • Setup details of Automatics Orchestration
  • Setup for Automatics Core
  • Configuration of Jenkins jobs for test execution
  • Setup details of Automatics Property

Execution Environment

  • OS - Linux
  • Jenkins


Automatics Core

Automatics core is the base part of the system that performs the test execution.  It performs following functionality

  • Initialize devices for execution
  • Identify tests and create testng suite at runtime
  • Perform Pre-Test initialization
  • Execute testng tests
  • Update test results to Automatics orchestration
  • Perform Post-Test cleanup

Software Requirement

  • JDK 1.8
  • Maven 3

Setup

  • Pull the Automatics Core project from the repository (rdk/tools/automatics/automatics-core) with branch (“rdk-next”)
  • In pom.xml and update the url in distributionManagement with the respective artifact repository url in the place as mentioned below. Automatics core is required to be deployed to partner's repository. Partner implementation project requires core to be added as maven dependency for using its APIs.

<distributionManagement>

             <repository>

                          <url></url>

            </repository>

 </distributionManagement>     

  • Execute “mvn clean deploy” on project. This will deploy the Core project to the partner's repository.

Automatics Generic Tests

This project contains the generic test cases which will be executed by Automatics. The automation id and manual id in automated tests should be matching with the automation Id and manual Id present in Automatics orchestration. During test execution the execution status of each test step will be updated to Automatics orchestration. And, at the end final execution status will be updated to Automatics.

Software Requirement

  • JDK 1.8
  • Maven 3

Setup

  • Pull the latest AutomaticsGeneric Test project from the repository (rdk/tools/automatics/generic-automation-tests) with branch (“rdk-next”).
  • Update pom.xml with partner project as a dependency.
  • Merge the changes so that it will be available during tests execution.

Automatics Properties

Automatics system reads configuration data required for test execution from Automatics Props application. It is configuration management tool for Automatics system. User can configure automatics and partner specific config data and device model specific config data using this tool. The data from Automatics Properties will be consumed by  Automatics Core/Partner Implementation/Rest Implementation Projects for executing the test cases. Partner can also configure their environment specific config data to it.

There are two types of configuration data in Automatics Props. The templates of configuration files are available at source rdk/tools/automatics/automatics-props.

  • Automatics properties - Java properties file with key value pair.  (automatics.properties)
  • Device Props – Json file containing device configuration for each model. (device_config.json)


Following are the properties expected in automatics.properties file. In addition to this, partner can configure their data also.

Property

Description

Mandatory Properties

device.props

Holds url that renders device_config.json

Url format - {protocol}://{host}:{port}/AutomaticsProps/deviceProps.json

Core uses this property to fetch configuration on device models.

automatics.url

Holds base url of Automatics orchestration

Url format - {protocol}://{host}:{port}/Automatics/

Core uses this property to update results back to orchestration.

Optional Properties

RACK_BASE_URL

Holds base url for partner’s rest-based implementation of device management or hardware providers like PowerProvider.

Url format - {protocol}://{host}:{port}/

This property is required if partner prefers to go with rest-based implementation of device management or hardware providers like PowerProvider.

partner.impl.deviceManager

By default, Automatics core expects rest-based implementation of device management. However, if partner prefer to go with Java implementation of device management for Core, then this property should be set to true. Orchestration always expects device management APIs in rest only. So in this case, partner has to provide rest implementation for API for orchestration and Java API implementation for Core separately.


partner.impl.powerProvider

By default, Automatics core expects rest-based implementation of hardware providers like PowerProvider.

However, if partner prefer to go with Java implementation of PowerProvider, then this property should be set to true.

Login Page

Automatics Properties page will be displayed upn on login. Following are the default properties.

To edit, the properties, click on 'UNLOCKED' link on left top side of page. This will allow only one person to update the document at a time. We will get pop message, "Successfully Locked".

Now user can edit the values and finally click on 'Submit' button to save the values. On submit, the application will save the values and logout and display message "Updated Successfully".

Automatics properties file

  • Launch {protocol}//{host:port}/AutomaticsProps/automatics/props.
  • User will be redirected to automatics properties page where it contains all the Properties which can be changed based on the requirements.
  • Automatics Core/Partner Implementation/Rest Implementation Projects will read configuration values from this file.
  • To edit the values, please click on “unlocked” button. Update the values and click on submit. This will save the configuration values.

 Device properties file

  • Launch {protocol}// {host:port}/AutomaticsProps/deviceProps.
  • User will be redirected to device json page, where it contains the device model based configuration.
  • To edit device properties, user has to update the file device_config.json deployed in tomcat server at path apache-tomcat/webapps/automatics/. Currently, UI support is not available to edit values of device_config.json.

Software Requirement

  • JDK 1.8
  • Tomcat 7.0.92
  • Maven 3

Setup

  • Clone AutomaticsProps project from the repository (rdk/tools/automatics/automatics-props) with branch (“rdk-next”).
  • Execute “mvn clean install”, and war file will be generated at target directory.
  • Copy automaticsProps.war file to apache-tomcat/webapps directory
  • Create a directory named “back_up”, in apache-tomcat and place the sample “automatics.properties” file.  When ever user edits automatics properties, a backup file will be generated inside this directory.
  • Create a directory “automatics” inside apache-tomcat/webapps.
  • Copy “automatics.properties”, "device_config.json" and “config.properties” from automatics-props\src
  • Configure“config.properties” with username and password required for Automatics Properties UI login.
  •  Start the server using command ./startup.sh.

Automatics Partner Implementation

  • Add the “Automatics Core” project as the dependency to the pom.xml of Partner Project.
  • After partner project development is completed, deploy the project to partner repository by executing “mvn clean deploy”.

Partner XML configuration file

  • Partner can inject their implementation classes to Automatics core using Spring Dependency Injection. 
  • Automatics core expects spring configuration file partner-applicationContext.xml to be provided by partner project and it should be available at classpath during test execution.
  • All Java API implementations to be injected should be configured in partner-applicationContext.xml.
  • partner-applicationContext.xml file contains predefined bean id with respective implementation class. All beans uses "lazy-init" set to true so that bean instance will be created on demand only. And, for beans that requires separate instance for each device, property "scope" is set to value "prototype".

  partner-applicationContext.xml


Automatics Rest Implementation

  • Partner needs to provide REST based implementation for APIs in device management that is consumed by Automatics orchestration.
  • Other device management APIs consumed by Automatics core can be implemented using Java API or REST.
  • Automatics core provides rest clients for device management and hardware providers like Power Provider. Partner can provide REST implementation for them based on API specification. Automatics core, by default, will use rest implementation. However, if partners prefers to go with Java API implementation, then in Automatics Properties, update the following properties as shown.

"partner.impl.deviceManager=true”  - When set to true, Automatics expects Java based implementation of device management and it should be configured in partner-applicationContext.xml against bean "deviceProvider".

partner.impl.powerProvider=true”  - When set to true, Automatics expects Java based implementation of power provider and it should be configured in partner-applicationContext.xml against bean "powerProvider".

Jenkins 

Automatics performs test execution in Jenkins. User can view the status of Jenkins execution from Job Manager page of Automatics. The final execution status will be updated back to Automatics.

Setup

Steps to be taken care during Jenkins configuration

  • Install Jenkins
  • Configure Java 1.8 and Maven 3
  • Select Manage Jenkins and select Configure System
  • Create jenkins job with name configured in Automatics orchestration.
  • Within job, in General section

    • Check the “Discard old builds”.
    • Select Log Rotation and we can keep the days of build and Max # of builds.
    • Please configure following String parameters

filterTestIds, filterTestType, updateRdkPortal, settopList, JMD_ID, BUILD_NAME, executionMode, gr,grb 

    • Under Source Code Management, Select GIT and specify Repository base url. During execution, the test project repository path and branch will be available from 'gr' and 'grb' parameters.
    • Under Pre Steps in Build section, please add below
  1. In home directory, the path to be set up as Jenkins installed path in VM.
  2. Inside Maven Configuration, local maven repository to be set
  3. Inside Jenkins location, Jenkins URL and respective email address to be set.
  4. Under Global properties, we have to set the required list of environment variable.

 Configuring Jenkins Job

Steps to be taken care during job configuration.

  • From Jenkins select “New Item”, Specify name of the new job to be created.
  • If we want to clone from existing job, we can give name of the existing job in the Copy from text box present in the bottom and select “OK”

In General section

  • Check the “Discard old builds”.
  • Select Log Rotation and we can keep the days of build and Max # of builds.
  • Please configure String parameters filterTestIds, filterTestType, updateRdkPortal, settopList, JMD_ID, BUILD_NAME, executionMode, gr,grb in job
  • Under Source Code Management, Select GIT and specify Repository base url.
  • Under Pre Steps in Build section, please add below

pom.xml

clean install -U exec:java -DskipTests=true -DretryByDefault=false -DbuildType=RDK -Dhttps.protocols=TLSv1.1,TLSv1.2 -Dsun.security.ssl.allowUnsafeRenegotiation=true -Dautomatics.properties.file={automatics.properties.url }

  • Click on Apply and Save button.



Automatics API Specification


  • No labels