import logging
from jpype.types import *
from com.automatics.rdkb.utils import BroadBandCommonUtils
from automaticsPythonLib.annotation.PythonScriptAnnotation import TestCaseId
from automaticsPythonLib.automatics import AutomaticsTapApi
logger = logging.getLogger()
@TestCaseId('TC-RDKB-FSPYTHON-LAYOUTTEST-001')
def nvramFileSystemLayoutcheckImageVersionInDevice(dut):
testCaseId = "TC-RDKB-FSPYTHON-LAYOUTTEST-001";
tapEnv = AutomaticsTapApi.getInstance()
stepNum = "s1S1";
errorMessage = "nvramcommand isexecution notin properly mounted after code downloaddevice failed";
status = JBoolean(False);
logger.info("#######################################################################################");
logger.info("STARTING TEST CASE: TC-RDKB-FSPYTHON-LAYOUTTEST-1001001");
logger.info("TEST DESCRIPTION: nvramValidation fileof systemdevice layout validationversion");
logger.info("TEST STEPS : ");
logger.info("1. CheckRun whethera nvramCommand isin properlythe mounteddevice andVIA itSSH hasto read-parse write permission after code download");
logger.info("2. Verify the file access by creating a dummy file in nvramthe version.txt file");
logger.info("#######################################################################################");
try:
logger.info("**********************************************************************************");
logger.info("**********************************************************************************");
logger.info(
"STEP 1: DESCRIPTION : Check whether nvram is properly mounted and itValidate hasthe read-version writeof permissionthe afterdevice code download");
logger.info(
"STEP 1: ACTION : \"checkRun mounteda statuscommand usingin mountthe command(mountdevice |to grepview -w \"nvram\") and verify read-write permission in nvramthe current RDK version in device\"");
logger.info(
"STEP 1: EXPECTED : nvramThe shouldcurrent beversion properlyin mountedthe anddevice should havebe read-write permission(mtd:data on /nvram type jffs2 (rw,relatime)received as response");
logger.info("**********************************************************************************");
response = tapEnv.executeCommandUsingSsh(dut, JString("mount | grep -w nvramcat /version.txt"));
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, JBoolean(status), errorMessage, JBoolean(False));
logger.info("################### COMPLETED POST-CONFIGURATIONS ###################"); |