Skip to content
This repository was archived by the owner on Sep 7, 2020. It is now read-only.
Closed

Ppm 30 #1583

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
455 commits
Select commit Hold shift + click to select a range
92231bc
bwl: move calc_curr_traffic() to base class
mariomaz Jul 6, 2020
4a873fd
bcl: network_utils: create method to get iface stats
mariomaz Jul 6, 2020
e64c31b
bwl: monitor: get radio and VAP stats for nl80211
mariomaz Jul 6, 2020
afe701b
bcl: network_utils: add unit test for get_iface_status
mariomaz Jul 7, 2020
e531e01
agent: slave: remove duplicated code in ieee_802_3_link_metrics_colle…
mariomaz Jul 7, 2020
f7eb6ea
prplmesh utils: increase prplmesh_watchdog sleep time
Jul 12, 2020
86edcfd
framework: bpl: Add generation for prplmesh_platform_db file
Jul 11, 2020
79bed4f
common: scripts: Remove creating prplmesh_platform_db
Jul 11, 2020
9e31450
framework: bpl: Create stub for get_ctrl_path methods
Jul 10, 2020
8c86826
framework: bpl: Add implementation for bpl_cfg_get_wpa_supplicant_ctr…
Jul 10, 2020
861bf5d
framework: bpl: Add implementation for bpl_cfg_get_hostapd_ctrl_path()
Jul 10, 2020
f3ee028
agent: fronthaul_manager: Add wpa_ctrl_path in hal_conf
Jul 11, 2020
9e333f4
common: bwl: Add wpa_ctrl_path as a part of hal_conf structure
Jul 12, 2020
26f00c7
bwl: dummy: Modify ap_wlan_hal_dummy constructor
Jul 12, 2020
62d937b
bwl: dwpal: Modify ap_wlan_hal_dwpal constructor
Jul 12, 2020
6fe2eaa
bwl: nl80211: Modify ap_wlan_hal_nl80211 constructor
Jul 12, 2020
a520dfa
agent: fronthaul_manager: Modify monitor_thread
Jul 12, 2020
5811c75
bwl: dummy: Modify mon_wlan_hal_dummy constructor
Jun 27, 2020
db8488c
bwl: dwpal: Modify mon_wlan_hal_dwpal constructor
Jun 27, 2020
a83024e
bwl: nl80211: Modify mon_wlan_hal_nl80211 constructor
Jun 27, 2020
2d19265
agent: backhaul_manager: Update WPA_ATTACH handler
Jul 12, 2020
878d502
bwl: dummy: Modify sta_wlan_hal_dummy constructor
Jun 27, 2020
a71c4bd
bwl: dwpal: Modify sta_wlan_hal_dwpal constructor
Jun 27, 2020
efc9f3d
bwl: nl80211: Modify sta_wlan_hal_nl80211 constructor
Jun 27, 2020
8ea1c51
bwl: nl80211: Update initialization for m_wpa_ctrl_path
Jun 27, 2020
f5dab27
AUTHORS.md: Add new author
Jul 14, 2020
cd34216
CODEOWNERS: add Adam Dov as a code owner
arnout Jul 14, 2020
e9c14b2
controller: bml: fix for comment
itayx Jul 2, 2020
d3ba21c
bcl: add BML structs const defines
itayx Jun 24, 2020
1322bc0
tlvf: add BML_CLIENT messages for smart-steering
itayx Jun 24, 2020
e50b423
controller: bml: add client smart-steering APIs
itayx Jun 25, 2020
03f095b
son_management: add client smart-steering support
itayx Jun 24, 2020
479f00f
beerocks_cli: add smart-steering client APIs.
itayx Jun 28, 2020
32bfbe3
common: bwl: Fix building nl80211 for linux
Jul 14, 2020
4c48460
tests: gate unit test: added google test
RanRegev Jun 25, 2020
aced812
tests: added beerocks_agent_unit_tests to ci
RanRegev Jul 15, 2020
6310d5b
test_flows: test_capi_wireless_onboarding: trigger WPS
arnout Jul 15, 2020
c750ef6
agent: ucc_listener: implement missing dev_get_parameter for macaddr
arnout Jul 15, 2020
928bf9b
cmake: remove Findzmq.cmake file
Jul 9, 2020
02e1d2c
vscode: devcontainer: remove zmq dependencies
Jul 9, 2020
7c46b85
transport: move Message class into the transport
Jul 9, 2020
2b97ade
mapf: common: cleanup and re-enable unit tests
Jul 9, 2020
a7f76ff
transport: broker: various review fixes
Jul 9, 2020
8b29ada
transport: messages: various review fixes
Jul 9, 2020
16cc009
transport: tests: remove unused tests
Jul 9, 2020
8b0b228
treewide: rename btl bus references to broker
Jul 9, 2020
0f6e564
cppcheck: mapf issues cleanup
Jul 9, 2020
2a30392
broker: interface vs inheritance refactoring
Jul 12, 2020
68298ec
tlvf: Fix dropped out vs messages
morantr Jul 16, 2020
891d391
dwpal: Fix dwpal parsing
morantr Jul 16, 2020
4eeaae9
agent: Add/Fix prints on monitor thread
morantr Jul 16, 2020
911c9d7
tests: boardfarm: add "prplWRT_STA" device
abelog Jun 30, 2020
64ba87d
boardfarm: environment.py: VirtualAPHostapd add get_ssid and get_psk
abelog Jul 6, 2020
5c173e7
boardfarm: environment.py: ALEntityPrplWrt: incorrect usage of log read
abelog Jul 6, 2020
13cf576
boardfarm: environment.py: set VirtualAPHostapd according to device VAPs
abelog Jul 6, 2020
b756225
boardfarm: station: add wifi_connect_check method
abelog Jul 6, 2020
0035ae3
boardfarm: prplWRT device: close serial connection
abelog Jul 7, 2020
a1ec103
common: tlvf: Remove SLAVE_JOINED_4ADDR_MODE_NOTIFICATION
Jul 15, 2020
2988e42
beerocks: network_utils: Add 0 terminator in linux_get_iface_name
Jul 15, 2020
611f730
agent: backhaul_manager: Replace if_indextoname()
Jul 14, 2020
83a8707
agent: platform_manager: Replace if_indextoname()
Jul 14, 2020
1a3d572
common: bcl: Replace if_indextoname()
Jul 14, 2020
0bfd3a6
common: bwl: Replace if_indextoname()
Jul 14, 2020
5fe4e82
controller: db: make persistent params param names public
adam1985d Jul 12, 2020
90d9131
controller: db: replace .at() with operator[] in unordered map
adam1985d Jul 14, 2020
bd93433
controller: db: check persistent db enabled before bpl access
adam1985d Jul 13, 2020
f71ef97
controller: db: add missing function description
adam1985d Jul 13, 2020
eaa7de6
controller: db: add persistent db clients counter
adam1985d Jul 13, 2020
312cf31
controller: db: replace bpl direct add/remove with db APIs
adam1985d Jul 13, 2020
13db0cb
controller: db: add API to set node params from map
adam1985d Jul 13, 2020
adc9461
controller: db: add function to get client to be removed
adam1985d Jul 13, 2020
49cc08d
controller: db: add function to remove most aged client
adam1985d Jul 13, 2020
6137241
controller: db: remove a client if persistent db is full
adam1985d Jul 13, 2020
3f0c7e6
controller: db: refactor load_persistent_db_clients()
adam1985d Jul 13, 2020
7a37d3b
controller: son_master: load clients from persistent db
adam1985d Jul 13, 2020
2fc4443
agent: Add parameters needed by the Topology flow to AgentDB
morantr Jul 1, 2020
43966cb
agent: Use local_gw and local_controller from AgentDB
morantr Jul 1, 2020
1d05ad7
agent: Use bridge iface_name and mac from AgentDB
morantr Jul 2, 2020
82c4d91
agent: Use ethernet interface name from AgentDB
morantr Jul 5, 2020
b9fd9e4
agent: Use radio interface name and mac from AgentDB
morantr Jul 6, 2020
dd8c41b
agent: Use backhaul connection type from AgentDB
morantr Jul 6, 2020
0b37761
agent: Use selected backhaul from AgentDB
morantr Jul 6, 2020
180c4d5
agent: Use freq_type and max_bandwidth from AgentDB
morantr Jul 7, 2020
75a8ab4
agent: Use bssids (vaps) list from AgentDB
morantr Jul 7, 2020
d228d1b
agent: Use associated_clients list from AgentDB
morantr Jul 8, 2020
4018de6
agent: Use neighbor_devices list from AgentDB
morantr Jul 8, 2020
afb7319
cppcheck: Add "useStlAlgorithm" to the suppression list
morantr Jul 8, 2020
5d32864
cppcheck: Update existing issues file
morantr Jul 20, 2020
0ae193f
common: tlvf: Remove HOSTAP_CHANNEL_SWITCH_REQUEST
Jul 17, 2020
e956821
common: tlvf: Remove code from autogenerated files
Jul 17, 2020
3ba4753
agent: son_slave: Remove case from handler
Jul 21, 2020
1d03e2c
controller: son_master: Remove case from handler
Jul 21, 2020
f24b837
common: tlvf: Remove deprecated code
Jul 21, 2020
2aea8fe
common: tlvf: Remove deprecated messages
Jul 21, 2020
7cf810d
controller: son_management: Remove deprecated case
Jul 21, 2020
02e792c
controller: beerocks_cli: Remove deprecated cli command
Jul 21, 2020
1fd0ede
common: tlvf: Remove deprecated code from autogenerated files
Jul 21, 2020
581edbd
common: tlvf: Remove deprecated cli message
Jul 21, 2020
f1848cd
controller: cli: Remove deprecated cli command
Jul 17, 2020
6e7155f
controller: bml: Remove deprecat4ed methods
Jul 17, 2020
b1e8228
controller: bml_internal: Remove get_device_info()
Jul 17, 2020
b9c3e75
controller: bml: Remove case from process_cmdu_header()
Jul 17, 2020
014a47d
agent: platform_manager: Remove case from handle_cmdu()
Jul 17, 2020
da03ca7
commont: tlvf: Remove useless code from autogenerated files
Jul 17, 2020
9393223
common: tlvf: Remove ACTION_PLATFORM_DEVICE_INFO_
Jul 17, 2020
7659807
framework: bpl: Remove deprecated method
Jul 21, 2020
b927047
framework: bpl: Remove deprecated method
Jul 21, 2020
719dda8
framework: bpl: Remove deprecated structure
Jul 21, 2020
f1fe72f
controller: bml: Remove deprecated structure
Jul 21, 2020
24ea670
common: tlvf: Modify autogenerated file
Jul 21, 2020
16219d2
common: tlvf: Remove deprecated structure sDeviceInfo
Jul 21, 2020
9258329
prplwrt: feed_wlan_6x: bump tag
kantera800 Jul 20, 2020
6c9becf
agent: Remove internal agent son_slave_watchdog
morantr Jul 21, 2020
213140d
agent: Remove son_slave watchdog configuration
morantr Jul 21, 2020
8929c4f
agent: Remove code that creates son_slaves processes
morantr Jul 21, 2020
c021ff6
agent: Initialize loggers
morantr Jul 21, 2020
b01a3d3
agent: Move run_son_slave location
morantr Jul 22, 2020
91e5260
agent: Run son_slaves threads on main Agent context
morantr Jul 22, 2020
a68652d
agent: Remove the option to run son_slave with "-i <iface>" option
morantr Jul 22, 2020
871b3a3
tools: Remove "pgrep" on son_slave processes
morantr Jul 22, 2020
881dad3
tools: Change testflows repeater operational check to use BML
morantr Jul 22, 2020
31321c5
cppcheck: Update existing issues file
morantr Jul 22, 2020
5975ae8
framework: encryption: wps_calculate_keys: use correct kdf length
arnout Jul 22, 2020
745d77a
tlvf: "get client list" response returns a list of sMacAddr
adam1985d Jul 23, 2020
076a577
controller: "get client list" response returns a list of MACs
adam1985d Jul 23, 2020
15c6960
bml: move translation to bml structure to bml_internal
adam1985d Jul 23, 2020
2092c3d
bml: implement translation to bml structure to bml_internal
adam1985d Jul 23, 2020
48a56c6
.gitlab-ci.yml: boardfarm-tests: add missing dependency on image
arnout Jul 24, 2020
c715460
ci: easymesh_cert: collect hostapd logs
rmelotte Jul 13, 2020
31af961
bwl: dwpal: add scan dump in progress flag
itayx Jul 28, 2020
99d02bf
framework: CMake: Change installation path of framework logging.conf
morantr Jul 27, 2020
e5cc333
framework: Rename framework logging.conf
morantr Jul 27, 2020
91d5b69
framework: Update reading path of the logging configuration file
morantr Jul 27, 2020
fa287c4
bwl: dwpal: fix sta_wlan_hal_dwpal::roam return code
mariomaz Jul 24, 2020
02f8b29
bwl: nl80211: complete sta_wlan_hal
mariomaz Jul 21, 2020
5cbb8c5
bwl: dwpal: fix sta_wlan_hal_dwpal::add_network return code
mariomaz Jul 24, 2020
0aa9eda
controller: son_master: Remove case for VS message
Jul 16, 2020
ab28d8a
agent: son_slave: Remove case from VS message handler
Jul 16, 2020
4f64d30
agent: son_slave: Remove process_keep_alive method
Jul 16, 2020
6acb909
common: bcl: Remove deprecated error code
Jul 16, 2020
9d06d4b
common: tlvf: Remove AGENT_PING_ message
Jul 15, 2020
b58a27b
agent: son_slave: Remove deprecated variable
Jul 20, 2020
a81b957
controller: database: Remove deprecated variable
Jul 20, 2020
2d30130
common: tlvf: Remove slave_keep_alive_retries
Jul 20, 2020
e327b03
cpmmon: bcl: Remove unused variable
Jul 21, 2020
527cda7
agent: son_slave: Remove deprecated variable
Jul 21, 2020
0d10404
controller: son_master: Remove case for deprecated message
Jul 23, 2020
749cddb
agent: monitor_thread: Remove depredcated case from handler
Jul 23, 2020
2dfd30c
agent: monitor_thread: Remove deprecated event
Jul 23, 2020
a0170df
common: bwl: Remove deprecated event from nl80211
Jul 23, 2020
c6de518
common: bwl: Remove deprecated event from dwpal
Jul 23, 2020
eec7941
common: bwl: Remove deprecated event
Jul 23, 2020
7acd4f2
agent: fronthaul_manager: Remove deprecated method
Jul 23, 2020
a717e68
agnet: son_slave: Remove deprecated message
Jul 23, 2020
5d61404
common: tlvf: Remove deprecated VS message
Jul 23, 2020
e316656
controller: beerocks_cli: Remove deprecated CLI command
Jul 23, 2020
007b144
controller: son_management: Remove case from handler
Jul 22, 2020
b5a4903
common: tlvf: Remove deprecated message
Jul 24, 2020
c1c2485
agent: son_slave: Remove case from VS message handler
Jul 22, 2020
257f178
common: tlvf: Remove deprecated VS messages
Jul 22, 2020
3786c8d
tests: boardfarm: Duplicate CMDU & TLV methods in boardfarm test base…
Jul 19, 2020
99eb2ee
tests: boardfarm: Change device names with more suitable ones
Jul 20, 2020
9002889
tests: boardfarm: Make adjustments and move link metric query test
Jul 20, 2020
c10d4b7
agent: ucc_listener: take the ssid into account when looking for "mac…
rmelotte Jul 27, 2020
b80d3c7
common: tlvf: Remove deprecated message
Jul 23, 2020
cae7bbf
common: tlvf: Remove deprecated autogenerated code
Jul 23, 2020
5568249
agent: son_slave: Remove case for deprecated message
Jul 23, 2020
fe5aaed
controller: son_master: Remove deprecated case from handler
Jul 23, 2020
798e071
common: tlvf: Remove deprecated message
Jul 24, 2020
26ae9da
agent: monitor_thread: Remove deprecated code
Jul 24, 2020
3c0ce8b
controller: cli: Remove unused cli commands
Jul 15, 2020
bd422c9
common: tlvf: Remove useless messages
Jul 29, 2020
e21f21c
controller: son_master: Remove unused code
Jul 15, 2020
9eb70bc
controller: db: Remove deprecated update_node_last_ping_sent()
Jul 17, 2020
f4ed1fa
controller: son_management: Remove unused code
Jul 15, 2020
2ab69ee
agent: son_slave: Remove useless code
Jul 15, 2020
99955ba
common: tlvf: Remove ACTION_CONTROL_CONTROLLER_PING_REQUEST/RESPONSE
Jul 15, 2020
fc4b2dc
agent: monitor_thread: Remove deprecated methods
Jul 22, 2020
ee0f45b
common: bwl: Remove deprecated method
Jul 22, 2020
4964f83
common: bwl: Remove RRM_STA_Statistics_Response
Jul 22, 2020
df6189e
agent: fronthaul_manager: Remove deprecated VS message
Jul 22, 2020
66124ed
controller: son_master: Remove case from VS message handler
Jul 21, 2020
fe02619
common: tlvf: Remove deprecated VS message
Jul 21, 2020
e7b3707
agent: son_slave: Remove case for deprecated message
Jul 21, 2020
dc4445a
controller: beerocks_cli: Remove deprecated CLI command
Jul 21, 2020
1d595a4
controller: son_management: Remove deprecated case from handler
Jul 21, 2020
6b2c370
agent: son_slave: Remove case from VS message handler
Jul 21, 2020
125b211
common: tlvf: Remove deprecated CLI message
Jul 29, 2020
5c6f5c0
common: tlvf: Remove deprecated messages
Jul 21, 2020
fed9a3c
framework: bpl: uci: add new UCI DB interface
itayx Jul 23, 2020
aa7c937
framework: bpl: uci: add UCI helper functions.
itayx Jul 23, 2020
221e96e
framework: bpl: uci: Implement section_exists function.
itayx Jul 23, 2020
5476f35
framework: bpl: uci: Implement add_section function.
itayx Jul 23, 2020
56fe731
framework: bpl: uci: Implement set_section function.
itayx Jul 23, 2020
2e93454
framework: bpl: uci: Implement get_section function.
itayx Jul 23, 2020
0053c4e
framework: bpl: uci: Implement get_section_type function.
itayx Jul 23, 2020
4a9a28d
framework: bpl: uci: Implement get_option function.
itayx Jul 23, 2020
b1a551c
framework: bpl: uci: Implement delete_section function.
itayx Jul 23, 2020
bfb3852
framework: bpl: uci: Implement get_all_sections function.
itayx Jul 23, 2020
d2a4107
framework: bpl: use the UCI APIs in the BPL DB.
itayx Jul 23, 2020
f71f762
bml: rdkb hal: enum elements names conflict with RDKB WiFi HAL ones
Jul 28, 2020
666d338
bml: BML_CLIENT: change sta_mac type from char to uint8_t
adam1985d Jul 28, 2020
7300404
beerocks_cli_bml: Fix client APIs
adam1985d Jul 28, 2020
29f92ed
controller: bml: fix return values
adam1985d Jul 28, 2020
57ec6b0
bml: cli: fix selected_bands debug prints
adam1985d Jul 29, 2020
e5dae02
bml: remove the unsupported stay_on_selected_device
adam1985d Jul 29, 2020
eb2b792
controller: bml: refactor client_get_client
adam1985d Jul 28, 2020
84d7f0e
controller: bml: validate set_client input parameters
adam1985d Jul 28, 2020
da8a485
controller: db: change aging check to use the remaining time
adam1985d Jul 22, 2020
227e127
controller: db: change client_db_entry_to_mac to get a copy
adam1985d Jul 22, 2020
e8f6ea6
controller: db: add `using ValuesMap` for cleaner code
adam1985d Jul 22, 2020
83a15ae
controller: db: change selected_bands type
adam1985d Jul 23, 2020
01baa0c
controller: db: load_persistent_db_clients: handle db is full
adam1985d Jul 22, 2020
96bd1fd
controller: db: add API to get all configured clients
adam1985d Jul 22, 2020
bad377b
controller: read list of clients from DB
adam1985d Jul 26, 2020
ed7161a
controller: read client information from DB
adam1985d Jul 26, 2020
ac52db5
controller: set client information to DB
adam1985d Jul 28, 2020
1ceb8d2
db: set the initial-radio when stay-on-initial-radio is set
adam1985d Jul 28, 2020
ac11831
controller: db: set the initial-radio on client connection
adam1985d Jul 29, 2020
5aad03c
controller: db: fix function return value on success to true
adam1985d Aug 2, 2020
f5a3a1b
common: prplmesh_utils.sh: change prplmesh_utils.sh status output
orenvor Jul 26, 2020
e5ccae0
tools: install AMBIORIX to the Ubuntu Docker builder
abelog Jul 17, 2020
e5d8170
agent: Cleanup irrelevant code
morantr Jul 28, 2020
95765c0
tlvf: Cleanup unused messages
morantr Jul 28, 2020
cb2fb89
agnet: Clear ethernet backhaul information on local gw
morantr Jul 28, 2020
8684958
agent: Set and clear interface mac
morantr Jul 29, 2020
1908e74
agent: Move media_type function to different file
morantr Jul 28, 2020
5b21b6f
agent: Add a skeleton for the Topology task
morantr Jul 29, 2020
c0f96be
agent: Add send_topology_notification function
morantr Jul 29, 2020
c1ed13c
agent: Add send_topology_discovery function
morantr Jul 29, 2020
f7bc0e0
agent: Add to the topology task a work function
morantr Jul 29, 2020
0c791ec
agent: Move the topology discovery handler to the Topology Task
morantr Jul 29, 2020
ced9199
agent: Move the topology query handler to the Topology Task
morantr Jul 29, 2020
d831fb0
agent: Add an event handler to the Topology Task
morantr Jul 29, 2020
e0b4ddf
agent: Add VS message handler to the Topology Task
morantr Jul 29, 2020
7507f84
agent: Split topology query handler to functions
morantr Jul 29, 2020
76b1248
cppcheck: Update existing issues file
morantr Jul 29, 2020
ee6d773
PPM-30: Changes to bf plugins for docker-compose
odkq Aug 4, 2020
c0bcdaa
PPM-30: Changes on class ALEntityDocker for compose
odkq Aug 4, 2020
8ea7ebf
PPM-30: Define test entrypoint and json config
odkq Aug 4, 2020
4242080
PPM-30: Dockerfile and docker-compose.yml
odkq Aug 4, 2020
34a067e
PPM-30: dctest.py script to wrap docker-compose
odkq Aug 4, 2020
a7c0852
PPM-30: Add test to boardfarm-ci
odkq Aug 4, 2020
c1e5262
PPM-30: Check return error on _run_shell
odkq Aug 4, 2020
38b7836
Added device prplmesh_compose.py
odkq Aug 4, 2020
7e90bb2
boardfarm-ci: Set device on prplmesh_compose.py
odkq Aug 5, 2020
5b6846d
boardfarm-ci: Add mockup of prplmesh_status_check
odkq Aug 5, 2020
fa9af45
Use original name and docker-name for hostname in environment.py
odkq Aug 6, 2020
a652eae
Merge branch 'PPM-30' of https://github.com/prplfoundation/prplMesh i…
odkq Aug 6, 2020
bfa9bd7
boardfarm-ci: Use docker_name
odkq Aug 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ upload-artifacts:
- build-for-glinet-b1300
- build-for-turris-omnia


.run-test-in-docker:
stage: test
extends: .in-prplmesh-builder
Expand All @@ -198,6 +199,15 @@ bwl_dummy_unit_tests:
bcl_unit_tests:
extends: .run-test-in-docker

dctest_one_test:
stage: test
script:
- ./dctest.py
tags:
- boardfarm-compose
needs:
- job: build-in-docker

mapf_common_encryption_tests:
extends: .run-test-in-docker

Expand Down
255 changes: 255 additions & 0 deletions dctest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
#!/usr/bin/env python3
#
# Launch the test suite using docker and docker-compose. This script wraps
# the creation of the bridge(s) to be able to connect external devices with
# the docker network, launching the service for boardfarm.
#
# As this script is run outside containers, it does not use anything apart
# from Python 3.5 (will work on later versions but only uses 3.5 features)
#
# The best way to make sure no Python 3.5+ features are used is running the
# script with a Python 3.5.0 interpreter. Compile it from:
#
# https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
#
# Also, when calling a function look for 'New in version 3.X' where X > 5
#
from __future__ import print_function # To check for python2 or < 3.5 execution
import argparse
import fcntl
import os
import grp
import shutil
import getpass
import sys
from subprocess import Popen, PIPE


if not (sys.version_info.major == 3 and sys.version_info.minor >= 5):
print("This script requires Python 3.5 or higher!")
print("You are using Python {}.{}.".format(sys.version_info.major, sys.version_info.minor))
sys.exit(1)


def check_docker_versions():
DOCKER_MAJOR = 19
DC_MAJOR = 1
DC_MINOR = 25
docker_version = os.popen('docker --version').read().split(' ')[2]
docker_major = int(docker_version.split('.')[0])
if docker_major < DOCKER_MAJOR:
fmt = "This script requires docker {}.0 or higher"
print(fmt.format(DOCKER_MAJOR))
print("You are usng version {}".format(docker_version))
sys.exit(1)
dc_version = os.popen('docker-compose --version').read().split(' ')[2]
dc_major = int(dc_version.split('.')[0])
dc_minor = int(dc_version.split('.')[1])
if dc_major < DC_MAJOR:
fmt = "This script requires docker-compose {}.{} or higher"
print(fmt.format(DC_MAJOR, DC_MINOR))
print("You are usng version {}".format(dc_version))
sys.exit(1)
if dc_minor < DC_MINOR:
fmt = "This script requires docker-compose {}.{} or higher"
print(fmt.format(DC_MAJOR, DC_MINOR))
print("You are usng version {}".format(dc_version))
sys.exit(1)


class Services:
def __init__(self, bid=None):
self.scriptdir = os.path.dirname(os.path.realpath(__file__))
os.chdir(self.scriptdir)
self.rootdir = self.scriptdir

if bid is not None:
self.build_id = bid
print('Using ID {}'.format(self.build_id))
# return
else:
self.build_id = self.get_build_id()

self.logdir = os.path.join(self.scriptdir, 'logs')
device_name = 'dockerized_device-{}'.format(self.build_id)
self.devicedir = os.path.join(self.logdir, device_name)
repeater_name = 'repeater1-{}'.format(self.build_id)
self.repeaterdir = os.path.join(self.logdir, repeater_name)
if not os.path.exists(self.logdir):
os.makedirs(self.logdir)
if not os.path.exists(self.devicedir):
print('Making {}'.format(self.devicedir))
os.makedirs(self.devicedir)
if not os.path.exists(self.repeaterdir):
print('Making {}'.format(self.repeaterdir))
os.makedirs(self.repeaterdir)

def cleanlogs(self):
shutil.rmtree(os.path.join(self.scriptdir, 'logs'))

def _setNonBlocking(fd):
"""
Set the file description of the given file descriptor to non-blocking.
"""
flags = fcntl.fcntl(fd, fcntl.F_GETFL)
flags = flags | os.O_NONBLOCK
fcntl.fcntl(fd, fcntl.F_SETFL, flags)

def get_build_id(self):
ci_pipeline_id = os.getenv('CI_PIPELINE_ID')
if ci_pipeline_id is not None:
return ci_pipeline_id

# Otherwise we are running on the local machine, just find last id
# created and add one
last_id = 0
if not os.path.exists('logs'):
return str(1)
for d in os.listdir('logs'):
if d.startswith('dockerized_device-'):
suffix = d[len('dockerized_device-'):]
isuffix = int(suffix)
if isuffix > last_id:
last_id = isuffix
if last_id == 0:
new_id = 1
else:
new_id = last_id + 1
return str(new_id)

def copy_build_dir(self):
new_id = self.build_id
self.build_dir = 'build-{}'.format(new_id)
shutil.copytree('build', 'build-{}'.format(self.build_dir))
print('Copied build/ into {}'.format(self.build_dir))

def dc(self, args, interactive=False):
params = ['docker-compose', '-f',
'tools/docker/boardfarm-ci/docker-compose.yml']
# params += ['-p', 'boardfarm-ci-{}'.format(self.build_id)]
params += args
local_env = os.environ
local_env['ROOT_DIR'] = self.rootdir
docker_gid = grp.getgrnam('docker')[2]
local_env['CURRENT_UID'] = str(os.getuid()) + ':' + str(docker_gid)
local_env['CURRENT_ID'] = str(os.getuid())
local_env['RUN_ID'] = self.build_id

if os.getenv('CI_PIPELINE_ID') is None:
# Running locally
local_env['CI_PIPELINE_ID'] = 'latest'
local_env['FINAL_ROOT_DIR'] = self.rootdir
else:
# Running inside gitlab-ci
local_env['FINAL_ROOT_DIR'] = '/builds/prpl-foundation/prplMesh'

# local_env['CURRENT_UID']= str(os.getuid()) + ':' + str(os.getgid())
if not interactive:
proc = Popen(params, stdout=PIPE, stderr=PIPE)
for line in proc.stdout:
print(line.decode(), end='')
proc.stdout.close()
else:
proc = Popen(params)
return_code = proc.wait()
return return_code


def vararg_callback(option, opt_str, value, parser):
assert value is None
value = []

def floatable(str):
try:
float(str)
return True
except ValueError:
return False

for arg in parser.rargs:
# stop on --foo like options
if arg[:2] == "--" and len(arg) > 2:
break
# stop on -a, but not on -3 or -3.0
if arg[:1] == "-" and len(arg) > 1 and not floatable(arg):
break
value.append(arg)

del parser.rargs[:len(value)]
setattr(parser.values, option.dest, value)


def cleanup(rc):
if rc != 0:
print('Return code !=0 -> {}'.format(rc))
if getpass.getuser() == 'gitlab-runner':
os.system('chown -R gitlab-runner:gitlab-runner .')
sys.exit(rc)


if __name__ == '__main__':
check_docker_versions()
parser = argparse.ArgumentParser(description='Dockerized test launcher')
parser.add_argument('--test', dest='test', type=str, help='Test to be run')
parser.add_argument('--clean', dest='clean', action='store_true',
help='Clean containers images and networks')
parser.add_argument('--build', dest='build', action='store_true',
help='Rebuild containers')
parser.add_argument('--shell', dest='shell', action='store_true',
help='Run a shell on the bf container')
parser.add_argument('--comp', dest='comp', action='store_true',
help='Pass the rest of arguments to docker-compose')
parser.add_argument('--id', dest='bid', type=str,
help='Specify the id to use for build/shell/comp/clean')
args, rest = parser.parse_known_args()

if os.getenv('CI_PIPELINE_ID') is not None:
args.bid == os.getenv('CI_PIPELINE_ID')

if args.comp:
if args.bid is None:
print('Specify --id for the --comp parameter')
sys.exit(0)
services = Services(bid=args.bid)
if len(rest) == 0:
print('Usage: dctest --id <id> --comp <arguments to docker-compose>')
sys.exit(1)
sys.exit(services.dc(rest, interactive=True))
else:
if len(rest) > 0:
print('Unknown parameters: {}'.format(rest))
sys.exit(1)

if args.clean:
if args.bid is None:
print('Specify --id for the --clean parameter')
sys.exit(0)
services = Services(bid=args.bid)
rc = services.dc(['down', '--remove-orphans', '--rmi', 'all'])
cleanup(rc)
elif args.shell:
if not args.bid:
print('Specify --id for the shell parameter')
sys.exit(0)
services = Services(bid=args.bid)
rc = services.dc(['run', '--rm', '--service-ports', '--entrypoint',
'/bin/bash', 'boardfarm'], interactive=True)
cleanup(rc)
elif args.build:
if not args.bid:
print('Specify --id for the build parameter')
sys.exit(0)
services = Services(bid=args.bid)
rc = services.dc(['build'], interactive=True)
cleanup(rc)
else:
if args.bid:
services = Services(bid=args.bid) # With new build id
else:
services = Services() # With new build id
# rc = services.dc(['up', 'boardfarm'])
# rc = services.dc(['run', '--service-ports', '--entrypoint',
# '/bin/bash', 'boardfarm'], interactive=True)
rc = services.dc(['run', '--rm', '--service-ports', '--use-aliases',
'boardfarm'], interactive=True)
cleanup(rc)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# See LICENSE file for more details.

import pexpect
from typing import Dict

from boardfarm.devices import linux

Expand All @@ -16,14 +17,18 @@ class CommandError(Exception):
class PrplMeshBase(linux.LinuxDevice):
"""PrplMesh abstract device."""

def _run_shell_cmd(self, cmd: str = "", args: list = None, timeout: int = 30):
def _run_shell_cmd(self, cmd: str = "", args: list = None, timeout: int = 30,
env: Dict[str, str] = None):
"""Wrapper that executes command with specified args on host machine and logs output."""

res, exitstatus = pexpect.run(cmd, args=args, timeout=timeout, encoding="utf-8",
withexitstatus=1)
if env is not None:
res, exitstatus = pexpect.run(cmd, args=args, timeout=timeout, encoding="utf-8",
withexitstatus=1, env=env)
else:
res, exitstatus = pexpect.run(cmd, args=args, timeout=timeout, encoding="utf-8",
withexitstatus=1)
entry = " ".join((cmd, " ".join(args)))
if exitstatus != 0:
raise CommandError("Error executing {}:\n{}".format(entry, res))
raise CommandError("Error executing {}".format(entry))

self.log_calls += entry
self.log += "$ " + entry + "\r\n" + res
Expand All @@ -34,25 +39,14 @@ def check_status(self):
It is used by boardfarm to indicate that spawned device instance is ready for test
and also after test - to insure that device still operational.
"""
pass

def close(self):
"""Method required by boardfarm.

Purpose is to close connection to device's consoles.
"""
# self._run_shell_cmd(os.path.join(rootdir, "tools", "docker", "test.sh"),
# ["-v", "-n", "controller"])
pass

def isalive(self):
"""Method required by boardfarm.

States that device is operational and its consoles are accessible.
"""
pass

def touch(self):
"""Method required by boardfarm.

Purpose is to keep consoles active, so they don't disconnect for long running activities.
"""
pass
return True
Loading