summaryrefslogtreecommitdiff
path: root/scripts/websocket_test.py
AgeCommit message (Collapse)AuthorFilesLines
2025-02-12Fix websocket test scriptEd Tanous1-1/+1
Unclear when or why this changed in python, but doesn't really matter. Fix the script. Tested: Script now succeeds with rest option enabled. Change-Id: I3e548aad03c6150f404d5fddc742f8baa5274a83 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2023-02-06Fix CI; Run blackGunnar Mills1-4/+4
Seeing CI fails: ``` Running beautysh Running black reformatted scripts/websocket_test.py ``` ``` diff --git a/scripts/websocket_test.py b/scripts/websocket_test.py index 21c7f160..fce9cd7e 100755 --- a/scripts/websocket_test.py +++ b/scripts/websocket_test.py @@ -45,10 +45,10 @@ async def hello(): authbytes = "{}:{}".format(args.username, args.password).encode("ascii") auth = "Basic {}".format(base64.b64encode(authbytes).decode("ascii")) headers = {"Authorization": auth} - async with websockets.connect( - uri, ssl=ssl_context, extra_headers=headers - ) if args.ssl else websockets.connect( - uri, extra_headers=headers + async with ( + websockets.connect(uri, ssl=ssl_context, extra_headers=headers) + if args.ssl + else websockets.connect(uri, extra_headers=headers) ) as websocket: request = json.dumps( { Format: FAILED ``` Change-Id: I8020716f2f9b9f1745d817728d3fe1eccd0bf778 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2022-12-07format: reformat with latest openbmc-build-scriptsPatrick Williams1-20/+26
Reformat the repository using the latest from openbmc-build-scripts. Add the `static/redfish` directory to be ignored by prettier since these files come from elsewhere and having the ability to do a direct diff is handy. Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I74464d6f97047b4888a591e0d8a4f5ca970ac69e
2022-02-25scripts: websocket: make ssl optionalNan Zhou1-1/+8
Tested: The following command worked. ``` python scripts/websocket_test.py --host localhost:18080 --no-ssl ``` Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: Ib14bd8ecdb5f0cad4a8e0478d69abcdc3e46c3ec
2021-08-04Enable pycodestyleEd Tanous1-1/+3
This commit allows our python code to be run through the CI format-code scripts. The exact content is copied from sdbusplus. Tested, ran pycodeformat on each script, observed it passing. Ran each script individually. check_base_registry seems broken previous to this commit, although it provides the same output. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I7eacfa355b794f49308b900c2988809d2aa122c3
2019-10-10Update websocket test scriptEd Tanous1-20/+59
This commit reworks the websocket test script to be more usable without editing it. Namely it: 1. Moves the script to the websockets library, as it seems to be in more use 2. Implements an argument parser, so the script doesn't require modification of host and username/password variables to use. 3. Moves to basic auth, which doesn't require a secondary login 4. implements better parsing of the result rather than simply printing the json scructure directly. Tested: Ran ./websocket_test.py --host <myhostname> Observed streaming sensor values in the form: System_Airflow 72.00 CFM Fan_1 6153.00 RPM System_Airflow 72.22 CFM Fan_6 6048.00 RPM System_Airflow 72.24 CFM Baseboard_12Volt 12.21 Volts P105_PCH_AUX 1.05 Volts PSU1_Input_Power 94.62 Watts PSU2_Output_Current 6.72 Amps Signed-off-by: Ed Tanous <ed.tanous@intel.com> Change-Id: I617f73a5b70f61a391e9c61638f0bcf4437bf6ce
2018-08-24Make dbus monitor compatible with phosphor-restEd Tanous1-0/+21
This patchset makes the dbus monitor compatible with the upstream dbus monitor, which should help adoption. Performance seems greatly improved compared to the python implementation. The example given in the documentation of watching for sensors and state changes is checked in as a test script websocket_test.py, and seems to consume less of the CPU than the actual sensors that get produced (about 4% CPU on my ast2500) when producing 30 sensor updates per second. This can likely be improved in the future by batching change events, but it seems to be performant enough for the moment. Tested: Used test script checked in, and verified webui can register state change events properly. Change-Id: I7d4c61d0259b7773eb46df0f59f8fea1c7796450 Signed-off-by: Ed Tanous <ed.tanous@intel.com>