Skip to content

Commit

Permalink
bft: add support for dynamic devices enumerated in the config
Browse files Browse the repository at this point in the history
You can add devices dynamically with the following syntax in the
boardconfig:

	"devices": [
		{
			"type": "debian",
			"name": "wan",
			"ipaddr": "port2",
			"color": "cyan"
		},
		{
			"type": "debian",
			"name": "lan",
			"ipaddr": "port3",
			"color": "blue"
		}

Signed-off-by: Matthew McClintock <[email protected]>
  • Loading branch information
mattsm committed Oct 2, 2016
1 parent 8ad12b1 commit fd13f28
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
18 changes: 18 additions & 0 deletions bft
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,21 @@ def setup_legacy_devices(config):
port=config.board.get('2g_port', "22"))


def setup_dynamic_devices(config):
'''Sets up dynamic devices from devices node in JSON config file'''
for device in config.board['devices']:
if device['type'] == 'debian':
#TODO: support conn_cmd and ipaddr (for ssh)
d = debian.DebianBox(name=device['ipaddr'],
color=device.get('color', 'black'),
reboot=config.reboot_vms,
username=device.get('username', "root"),
password=device.get('password', "bigfoot1"),
port=config.board.get('port', "22"))
setattr(config, device['name'], d)
else:
print("Unknown device type for %d", device)

def main():
'''Connect to devices, run tests, record results.'''

Expand Down Expand Up @@ -102,6 +117,9 @@ def main():

setup_legacy_devices(config)

if 'devices' in config.board:
setup_dynamic_devices(config)

except Exception as e:
print(e)
connected_to_board = False
Expand Down
17 changes: 14 additions & 3 deletions docs/BOARD_FARM.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,19 @@ All routers in a board farm need an entry in the boardfarm_config.json file like
"<name>": {
"board_type": "<model>",
"conn_cmd": "telnet <server> <port>",
"lan_device": "10.0.0.107",
"wan_device": "bf-vm-YY.something.com",
"devices": [
{
"type": "debian",
"name": "wan",
"ipaddr": "port2",
"color": "cyan"
},
{
"type": "debian",
"name": "lan",
"ipaddr": "port3",
"color": "blue"
}
"powerip": "<powerserver>",
"powerport": "<outlet>"
}
Expand All @@ -221,7 +232,7 @@ Where:
* `name` is any unique name at all
* `model` is a descriptive model name
* `conn_cmd` is the command to run to connect to the board
* `lan_device` and `wan_device` are the devices connected to the board (must have ssh server)
* `devices' is an array of devices that will be added, must have a WAN device at minimum
* `powerip` and `powerport` are the network-control power unit and outlet to reset the board

Using a local serial port (i.e. no console server)
Expand Down

0 comments on commit fd13f28

Please sign in to comment.