RDK Resources
[*RDK Preferred*]
Code Management Facility
RDK Forums
[RDK Conferences]
RDK Support
Archives
Papers & Presentations Archive
...
Sample code for an Automatics Test Case Written in Python and which use Utils and Core APIs for different operations
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
from jpype.types import * # Adding BroadBandCommonUtils from RDKB Utils projects from com.automatics.rdkb.utils import BroadBandCommonUtils from src.annotation.PythonScriptAnnotation import TestCaseId from src.com.automatics import AutomaticsTapApi from src.logging import AutomaticsPyLogger logger = AutomaticsPyLogger.setup_logging(__name__) @TestCaseId('TC-RDKB-FS-LAYOUT-001') def nvramFileSystemLayout(dut): testCaseId = "TC-RDKB-FS-LAYOUT-001"; tapEnv = AutomaticsTapApi.getInstance() stepNum = "s1"; errorMessage = "nvram is not properly mounted after code download"; status = JBoolean(False); logger.info("#######################################################################################"); logger.info("STARTING TEST CASE: TC-RDKB-FS-LAYOUT-1001"); logger.info("TEST DESCRIPTION: nvram file system layout validation"); logger.info("TEST STEPS : "); logger.info("1. Check whether nvram is properly mounted and it has read- write permission after code download"); logger.info("2. Verify the file access by creating a dummy file in nvram"); logger.info("#######################################################################################"); try: logger.info("**********************************************************************************"); logger.info("**********************************************************************************"); logger.info( "STEP 1: DESCRIPTION : Check whether nvram is properly mounted and it has read- write permission after code download"); logger.info( "STEP 1: ACTION : \"check mounted status using mount command(mount | grep -w \"nvram\") and verify read-write permission in nvram\""); logger.info( "STEP 1: EXPECTED : nvram should be properly mounted and should have read-write permission(mtd:data on /nvram type jffs2 (rw,relatime)"); logger.info("**********************************************************************************"); response = tapEnv.executeCommandUsingSsh(dut, JString("mount | grep -w nvram")); logger.info(response) except Exception as e: logger.info(str(e)) finally: logger.info("################### STARTING POST-CONFIGURATIONS ###################"); logger.info("POST-CONDITION STEPS"); logger.info("POST-CONDITION : DESCRIPTION : Remove dummy file"); logger.info("POST-CONDITION : ACTION : Remove the dummy file permanently (rm -rf /nvram/dummytest.sh)"); logger.info("POST-CONDITION : EXPECTED : Created dummy file should be removed"); status = BroadBandCommonUtils.removeFileAndVerifyStatus(tapEnv, dut, JString("/nvram/dummytest.sh")); if status: logger.info("POST-CONDITION : ACTUAL : Post condition executed successfully"); else: logger.info("POST-CONDITION : ACTUAL : Post condition failed"); logger.info("POST-CONFIGURATIONS : FINAL STATUS - " + str(status)); tapEnv.updateExecutionStatus(dut, testCaseId, stepNum, status, errorMessage, JBoolean(False)); logger.info("################### COMPLETED POST-CONFIGURATIONS ###################"); |
...