Skip to content

Commit

Permalink
Merge branch 'release/1.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
TB-1993 committed Dec 23, 2024
2 parents b00cdab + d529cfd commit ddbb662
Show file tree
Hide file tree
Showing 17 changed files with 1,107 additions and 68 deletions.
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,41 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [1.2.0](https://github.com/rdkcentral/python_raft/compare/1.1.2...1.2.0)

- Update #103: Creation of remote hdmicec client [`#115`](https://github.com/rdkcentral/python_raft/pull/115)
- Fix #119: Corrected commonRemote to properly parse key [`#128`](https://github.com/rdkcentral/python_raft/pull/128)
- Adding support keySimulator in remotecontrollers [`#120`](https://github.com/rdkcentral/python_raft/pull/120)
- Fix #103 - Corrected hdmiCECContoller on device manager and added stop [`#103`](https://github.com/rdkcentral/python_raft/issues/103)
- Fix #107: Moved stream handling to it's own module. [`#107`](https://github.com/rdkcentral/python_raft/issues/107)
- Fix #107: Moved the stream logging out of the logging module [`#107`](https://github.com/rdkcentral/python_raft/issues/107)
- Merge pull request #128 from rdkcentral/feature/gh119_corrections_for_keysimulator [`#119`](https://github.com/rdkcentral/python_raft/issues/119)
- Fix #119: Corrected commonRemote to properly parse key [`#119`](https://github.com/rdkcentral/python_raft/issues/119)
- Fix #119: Fixed the code changes for combination of keys [`#119`](https://github.com/rdkcentral/python_raft/issues/119)
- Fix #119: Updated the code changes [`#119`](https://github.com/rdkcentral/python_raft/issues/119)
- Fix #119: Fixed the changes [`#119`](https://github.com/rdkcentral/python_raft/issues/119)
- Fix #119: Updated the changes [`#119`](https://github.com/rdkcentral/python_raft/issues/119)
- Fix #119: Reverting the previous commit changes [`#119`](https://github.com/rdkcentral/python_raft/issues/119)
- Fix #119: Changed the key value str to rccode [`#119`](https://github.com/rdkcentral/python_raft/issues/119)
- Fix #119: Updated the file name [`#119`](https://github.com/rdkcentral/python_raft/issues/119)
- Fix #119: Changed the file name in the example list [`#119`](https://github.com/rdkcentral/python_raft/issues/119)
- Fix #119: Added the keySimulator in the example list [`#119`](https://github.com/rdkcentral/python_raft/issues/119)
- Fix #119: Changed the code [`#119`](https://github.com/rdkcentral/python_raft/issues/119)
- Fix #119: Changed the code and removed the control flow issue [`#119`](https://github.com/rdkcentral/python_raft/issues/119)
- Fix #119: Removed the print statement [`#119`](https://github.com/rdkcentral/python_raft/issues/119)
- Fix #119: Updated the commonRemote file format [`#119`](https://github.com/rdkcentral/python_raft/issues/119)
- Fix #119: Updating the remotecontrollers with keysimulator [`#119`](https://github.com/rdkcentral/python_raft/issues/119)
- Fix #92: Removed deprecation comment from example_rack_config [`#92`](https://github.com/rdkcentral/python_raft/issues/92)
- Fix #92: Added missing cecTypes.py [`#92`](https://github.com/rdkcentral/python_raft/issues/92)
- Fix #92: Updated documentation and fixed bug in monitoring [`#92`](https://github.com/rdkcentral/python_raft/issues/92)
- Update #103 - Updated CEC controller interface to make it easier to use [`f25a966`](https://github.com/rdkcentral/python_raft/commit/f25a9663e145068174b10c7be5e5fb8c89f95ff0)
- Upgrade #92: Creation of HDMICEC module [`b61670b`](https://github.com/rdkcentral/python_raft/commit/b61670b0cc972f39c57aba54c5770316c0b23bf6)
- Update #107: Creation of remote hdmicec client [`3a28750`](https://github.com/rdkcentral/python_raft/commit/3a28750177a45d413621f9d9f13860d620142827)

#### [1.1.2](https://github.com/rdkcentral/python_raft/compare/1.1.1...1.1.2)

> 1 November 2024
- GH95 - Standardise console classes [`#106`](https://github.com/rdkcentral/python_raft/pull/106)
- GH93 - Upgrade ConfigParser class to work with includes [`#103`](https://github.com/rdkcentral/python_raft/pull/103)
- Fix #84 - Fixed options for cli selection of slot and rack [`#84`](https://github.com/rdkcentral/python_raft/issues/84)
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,17 @@ It understands how to:

### Requirements

- Python (=3.11.8)
- Python (version 3.10+)
- Pyenv can be used to manage multiple versions of Python (please refer to the [documentation](https://github.com/pyenv/pyenv?tab=readme-ov-file#installation)).

- All the packages listed in requirements.txt
- Can be installed using `$ pip install -r requirements.txt`

### User Installation

Clone the repository and ensure that all requirements are met.
Clone the repository and run the [`install_requirements.sh`](installation/install_requirements.sh) script.

Administrator rights are required to install the below packages. Without these some modules may not work:
- `cec-client` - Required to use the CECClient hdmiCECController module.

*If you do not have administrator rights, please ask your administrator to install the above packages for you.*

## Getting Started

Expand Down
69 changes: 33 additions & 36 deletions examples/configs/example_rack_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,18 @@

# This config file creates your environment, defaults are setup internally unless otherwise overridden.
# you will need at least 1 rack and 1 slot to operate.
# each module e.g. console options, will be off by default unless otherwise stated

# Depreciated
# slotx: address: IP of device while running locally, replaced with slotx: ip
# slotx: deviceConsole: IP of device while running locally, replaced with slotx: devices
# Each optional module will be off by default unless otherwise stated.
# Uncomment and fill out the sections for the modules you require.

# Data that is global to all tests.
globalConfig:
includes:
# [ includes: ]
# [ deviceConfig: "required.yml file" ]
deviceConfig: "example_device_config.yml"
capture:
# [capture: optional]
# [ocrEnginePath: "/usr/bin/tesseract"] # "C:\\Program Files\\Tesseract-OCR\\tesseract.exe" (For Windows) - tesseract binary
# [resolution: "1080p"] - Capture resolution
# [input: 0] - which input is connected to the video path
# [capture: optional] - This section is required for use with the videoCapture module.
# [ocrEnginePath: "/usr/bin/tesseract"] # "C:\\Program Files\\Tesseract-OCR\\tesseract.exe" (For Windows) - tesseract binary
# [resolution: "1080p"] - Capture resolution
# [input: 0] - which input is connected to the video path
# Note: Video capture will not be installed unless screenRegions: is defined in deviceConfig:
ocrEnginePath: "/usr/bin/tesseract" # "C:\\Program Files\\Tesseract-OCR\\tesseract.exe" (For Windows)
resolution: "1080p"
input: 0
local:
log: # log for each slot
directory: "./logs"
Expand All @@ -57,37 +48,41 @@ rackConfig:
# [ name: "required", description: "optional"]
name: "slot1"
devices:
# [ devices: ]
# [ type: "serial": port: "COM7" baudRate: "(default)115200" dataBits: "optional(8)" stopBits: "optional(1)" parity: "optional(None)" FlowControl: "optional(None)" ]
# [ type: "ssh": port: 22 username: "test" password: "test" ]
# [ type: "telnet": port: 23 username: "test" password: "test" ]
- dut:
ip: "127.0.0.1" # IP Address of the ADA Hub
description: "local PC"
platform: "linux PC"
consoles:
# - [ name ] - consoles should be listed here with a name. Defined as one of the types below.
# supported types:
# [ type: "serial", port: "COM7", baudRate: "(default)115200", dataBits: "optional(8)", stopBits: "optional(1)", parity: "optional(None)", FlowControl: "optional(None)", ]
# [ type: "ssh", port: 22, username: "test", password: "test" ]
# [ type: "telnet", port: 23, username: "test", password: "test" ]
- default:
type: "serial"
port: "/dev/ttyUSB0"
- ssh:
port: 22
username: "root"
ip: "192.168.99.1"
remoteController:
# [ remoteController: ]
# [ type: "olimex" ip: "192.168.0.17" port: 7 map: "llama_rc6", config: "remote_commander.yml" ]
# [ type: "skyProc" map: "skyq_map", config: "remote_commander.yml" ]

# [ remoteController: optional ] - This section is required for use with the remoteController module.
# supported types:
# [ type: "olimex", ip: "192.168.0.17", port: 7, map: "llama_rc6", config: "remote_commander.yml" ]
# [ type: "skyProc", map: "skyq_map", config: "remote_commander.yml" ]
# [ type: "None" ]
type: "none"
map: "skyq_map"
config: "example_remote_commander.yml"
outbound:
download_url: "tftp://tftp-server.com/rack1/slot1/" # download location for the CPE device
upload_url: "sftp://server-address/home/workspace/tftp/rack1/slot1/" # upload location
upload_url_base_dir: "sftp://server-address/home/workspace/tftp/rack1/slot1" # alternative upload location
httpProxy: 'socks5h://localhost:1234' # Local Proxy if required
workspaceDirectory: './logs/workspace' # Local working directory
powerSwitch: # Specific power switch for each slot
# To use keySimulator RDK Middleware is required
# [ type: "keySimulator", ip: "192.168.50.99", port: 10022, username: "root", password: '', map: "keysimulator_rdk", config: "rdk_keymap.yml" ]

# [ outbound: optional ] - This section is used to configure paths for downloads and uploads from your test
# supported usage:
# [download_url: "url" ] - download location for the CPE device
# [ upload_url: "url" ] - upload location
# [ upload_url_base_dir: "url" ] - alternative upload location
# [ httpProxy: "uri" ] - Local Proxy if required
# [ workspaceDirectory: "path to directory on host" ] - Local working directory

# [ powerSwitch: optional ] - Power switch for the slot
# supported types, if this section is undefined this is ok
# [type: "orvbioS20", ip: "", mac: "", port:"optional", relay:"optional"]
# [type: "kasa", ip: "", options:"--plug" ] # <- Plug
Expand All @@ -97,9 +92,11 @@ rackConfig:
# [type: "olimex", ip:"", port:"optional", relay:"" ]
# [type: "SLP", ip:"", username: "", password: "", outlet_id:"", port:"optional"]
# [type: "none" ] if section doesn't exist then type:none will be used
type: "HS100"
ip: "192.168.1.7"
port: 9999

# [ hdmiCECController: optional ] - Specific hdmiCECController for the slot
# supported types:
# [type: "cec-client", adaptor: "/dev/ttycec"]
# [type: "remote-cec-client", adaptor: "/dev/ttycec", address: "192.168.99.1", username(optional): "testuser", password(optional): "testpswd", port(optional): "22"]
- pi2:
ip: "192.168.99.1"
description: "local pi4"
Expand Down
18 changes: 9 additions & 9 deletions framework/core/commonRemote.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from framework.core.remoteControllerModules.skyProc import remoteSkyProc
from framework.core.remoteControllerModules.arduino import remoteArduino
from framework.core.remoteControllerModules.none import remoteNone
from framework.core.remoteControllerModules.keySimulator import remoteKeySimulator

class remoteControllerMapping():
def __init__(self, log:logModule, mappingConfig:dict):
Expand Down Expand Up @@ -75,7 +76,7 @@ def getMappedKey(self, key:str):
prefix = self.currentMap.get("prefix")
returnedKey=self.currentMap["codes"].get(key)
if prefix:
returnedKey = prefix+key
returnedKey = prefix + returnedKey
return returnedKey

def getKeyMap(self):
Expand All @@ -101,6 +102,8 @@ def setKeyMap(self, newMapName:dict ):
self.log.error("RemoteController keyMap [{}] not found".format(newMapName))
return False
found = False
if isinstance(self.maps, dict):
self.maps = list(self.maps.values())
for x in self.maps:
if x["name"] == newMapName:
self.currentMap = x
Expand Down Expand Up @@ -132,6 +135,8 @@ def __init__(self, log:logModule, remoteConfig:dict, **kwargs:dict):
self.remoteController = remoteSkyProc( self.log, remoteConfig )
elif self.type == "arduino":
self.remoteController = remoteArduino (self.log, remoteConfig)
elif self.type == "keySimulator":
self.remoteController = remoteKeySimulator (self.log, remoteConfig)
else: # remoteNone otherwise
self.remoteController = remoteNone( self.log, remoteConfig )

Expand All @@ -150,13 +155,7 @@ def __decodeRemoteMapConfig(self):
with open(configFile) as inputFile:
inputFile.seek(0, os.SEEK_SET)
config = yaml.full_load(inputFile)
keyDictionary = {}
for key, val in config.items():
if isinstance(val, dict):
for k, v in val.items():
keyDictionary[k] = v
else:
keyDictionary[key] = val
keyDictionary = config.get('remoteMaps',{})
return keyDictionary

def sendKey(self, keycode:dict, delay:int=1, repeat:int=1, randomRepeat:int=0):
Expand All @@ -180,6 +179,7 @@ def sendKey(self, keycode:dict, delay:int=1, repeat:int=1, randomRepeat:int=0):

mappedCode = self.remoteMap.getMappedKey( keycode.name )
result = self.remoteController.sendKey( mappedCode, repeat, delay)
return result

def setKeyMap( self, name:dict ):
"""Set the Key Translation Map
Expand All @@ -192,4 +192,4 @@ def setKeyMap( self, name:dict ):
def getKeyMap( self ):
"""Get the Key Translation Map
"""
self.remoteMap.getKeyMap()
return self.remoteMap.getKeyMap()
6 changes: 6 additions & 0 deletions framework/core/deviceManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from framework.core.powerControl import powerControlClass
from framework.core.outboundClient import outboundClientClass
from framework.core.commonRemote import commonRemoteClass
from framework.core.hdmiCECController import HDMICECController
from framework.core.utilities import utilities

dir_path = os.path.dirname(os.path.realpath(__file__))
Expand Down Expand Up @@ -149,11 +150,13 @@ def __init__(self, log:logModule, logPath:str, devices:dict):
# # Telnet
# # outbound
# # remoteController
# # hdmiCECController
self.log = log
self.consoles = dict()
self.powerControl = None
self.outBoundClient = None
self.remoteController = None
self.hdmiCECController = None
self.session = None
self.alive = False

Expand All @@ -174,6 +177,9 @@ def __init__(self, log:logModule, logPath:str, devices:dict):
config = device.get("remoteController")
if config != None:
self.remoteController = commonRemoteClass(log, config)
config = device.get("hdmiCECController")
if config != None:
self.hdmiCECController = HDMICECController(log, config)
self.session = self.getConsoleSession()

def getField(self, fieldName:str, itemsList:dict = None):
Expand Down
Loading

0 comments on commit ddbb662

Please sign in to comment.