sync_factory_server¶
Source code: sync_factory_server.py
Connect to factory server to find software updates and upload logs.
Description¶
This test will create connections from DUT to Chrome OS factory server and invoke remote procedure calls for syncing data and programs.
This test will sync following items:
If
sync_time
is enabled (default True), sync system time from server.If
sync_event_logs
is enabled (default True), sync theevent_log
YAML event logs to factory server.If
flush_testlog
is enabled (default False), flush TestLog to factory server (which should have Instalog node running).If
upload_report
is enabled (default False), upload aGooftool
style report collecting system information and manufacturing logs to server.If
update_toolkit
is enabled (default True), compare the factory software (toolkit) installed on DUT with the active version on server, and update if needed.If
upload_reg_codes
is enabled (default False), upload the registration codes to server usingUploadCSVEntry
API, and have the data stored inregistration_code_log.csv
file on server. If the reg codes must be sent back to partner’s shopfloor backend, please use shopfloor_service pytest and ActivateRegCode API instead.If
upload_zero_touch_ids
is enabled (default False), upload the attested device ID and serial number pair using theUploadCSVEntry
API. The CSV can be downloaded from Dome server in the Logs -> CSV page.
Additionally, if argument server_url
is specified, this test will update the
stored ‘default factory server URL’ so all following tests connecting to factory
server via server_proxy.GetServerProxy()
will use the new URL.
server_url
supports few different input:
If a string is given, that is interpreted as simple URL. For example,
"http://10.3.0.11:8080/"
.If a mapping (dict) is given, take key as network IP/CIDR and value as URL. For example,
{"10.3.0.0/24": "http://10.3.0.11:8080"}
Test Procedure¶
Basically no user interaction required unless a toolkit update is found.
Make sure network is connected.
Start the test and it will try to reach factory server and sync time and logs.
If update_toolkit is True, compare installed toolkit with server’s active version.
If a new version is found, a message like ‘A software update is available.’ will be displayed on screen. Operator can follow the instruction (usually just press space) to start downloading and installing new software.
Dependency¶
Nothing special. This test uses only server components in Chrome OS Factory Software.
Examples¶
To connect to default server and sync time, event logs, and update software, add this in test list:
{
"pytest_name": "sync_factory_server"
}
To only sync time and logs, and never update software (useful for stations):
{
"pytest_name": "sync_factory_server",
"args": {
"update_toolkit": false
}
}
To sync time and logs, and then upload a report:
{
"pytest_name": "sync_factory_server",
"args": {
"upload_report": true
}
}
To override default factory server URL for all tests, change the
default_factory_server_url
in test list constants:
{
"constants": {
"default_factory_server_url": "http://192.168.3.11:8080"
}
}
It is also possible to override and create one test item using different factory server URL, and all tests after that:
{
"pytest_name": "sync_factory_server",
"args": {
"server_url": "http://192.168.3.11:8080"
}
}
To implement “station specific factory server” in JSON test lists, extend
SyncFactoryServer
from generic_common.test_list.json
as:
{ "inherit": "SyncFactoryServer",
"args": {
"server_url": "eval! locals.factory_server_url"
}
}
And then in each station (or stage), override URL in locals:
{"SMT": {"locals": {"factory_server_url": "http://192.168.3.11:8080" }}},
{"FAT": {"locals": {"factory_server_url": "http://10.3.0.11:8080" }}},
{"RunIn": {"locals": {"factory_server_url": "http://10.1.2.10:7000" }}},
{"FFT": {"locals": {"factory_server_url": "http://10.3.0.11:8080" }}},
{"GRT": {"locals": {"factory_server_url": "http://172.30.1.2:8081" }}},
To implement “auto-detect factory server by received DHCP IP address”, specify a mapping object with key set to “IP/CIDR” and value set to server URL:
{
"constants": {
"default_factory_server_url": {
"192.168.3.0/24": "http://192.168.3.11:8080",
"10.3.0.0/24": "http://10.3.0.11:8080",
"10.1.0.0/16": "http://10.1.2.10:8080"
}
}
}
Test Arguments¶
Name |
Type |
Description |
---|---|---|
first_retry_secs |
int |
(optional; default: |
retry_secs |
int |
(optional; default: |
timeout_secs |
int |
(optional; default: |
update_toolkit |
bool |
(optional; default: |
update_without_prompt |
bool |
(optional; default: |
sync_time |
bool |
(optional; default: |
sync_event_logs |
bool |
(optional; default: |
flush_testlog |
bool |
(optional; default: |
upload_reg_codes |
bool |
(optional; default: |
upload_sn |
bool |
(optional; default: |
upload_report |
bool |
(optional; default: |
report_stage |
str, None |
(optional; default: |
report_serial_number_name |
str, None |
(optional; default: |
server_url |
str, dict, None |
(optional; default: |
upload_zero_touch_ids |
bool |
(optional; default: |
upload_csv_entries |
bool |
(optional; default: |