-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Unittesting P6] Add fake device support and lime-config test #567
Merged
gmarcos87
merged 6 commits into
libremesh:master
from
spiccinini:unittesting_p6_device_lime_config
Sep 2, 2019
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
16d2378
hardware_detection: allow configuring search paths
spiccinini 2b70028
lime-config: move main() into config.main()
spiccinini 1a2a3ff
testing: add librerouter-v1 device support
spiccinini 4407fc9
openwrt_wan: use utils.getBoardAsTable()
spiccinini 5be5cd9
lime.config: unhardcode lime config path
spiccinini 60b72b8
testing: add lime-config test using librerouter-v1 device
spiccinini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"model" : { | ||
"id" : "librerouter-v1", | ||
"name" : "LibreRouter v1" | ||
}, | ||
"network" : { | ||
"lan" : { | ||
"ifname" : "eth1.2", | ||
"protocol" : "static" | ||
}, | ||
"wan" : { | ||
"ifname" : "eth0.1", | ||
"protocol" : "dhcp" | ||
} | ||
}, | ||
"switch" : { | ||
"switch0" : { | ||
"enable" : true, | ||
"reset" : true, | ||
"ports" : [ | ||
{ | ||
"num" : 0, | ||
"device" : "eth0", | ||
"need_tag" : false, | ||
"want_untag" : false | ||
}, | ||
{"num" : 5, "role" : "wan"}, | ||
{ | ||
"num" : 6, | ||
"device" : "eth1", | ||
"need_tag" : false, | ||
"want_untag" : false | ||
}, | ||
{"num" : 1, "role" : "lan"}, | ||
{"num" : 2, "role" : "lan"}, | ||
{"num" : 3, "role" : "lan"}, | ||
{"num" : 4, "role" : "lan"}, | ||
], | ||
"roles" : [ | ||
{ | ||
"role" : "wan", | ||
"ports" : "5 0t", | ||
"device" : "eth0.1" | ||
}, | ||
{ | ||
"role" : "lan", | ||
"ports" : "1 2 3 4 6t", | ||
"device" : "eth1.2" | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
config interface 'loopback' | ||
spiccinini marked this conversation as resolved.
Show resolved
Hide resolved
|
||
option ifname 'lo' | ||
option proto 'static' | ||
option ipaddr '127.0.0.1' | ||
option netmask '255.0.0.0' | ||
|
||
config globals 'globals' | ||
option ula_prefix 'auto' | ||
|
||
config interface 'lan' | ||
option type 'bridge' | ||
option ifname 'eth1.2' | ||
option proto 'static' | ||
option ipaddr '192.168.1.1' | ||
option netmask '255.255.255.0' | ||
option ip6assign '60' | ||
|
||
config interface 'wan' | ||
option ifname 'eth0.1' | ||
option proto 'dhcp' | ||
|
||
config interface 'wan6' | ||
option ifname 'eth0.1' | ||
option proto 'dhcpv6' | ||
|
||
config switch | ||
option name 'switch0' | ||
option reset '1' | ||
option enable_vlan '1' | ||
|
||
config switch_vlan | ||
option device 'switch0' | ||
option vlan '1' | ||
option ports '5 0t' | ||
|
||
config switch_vlan | ||
option device 'switch0' | ||
option vlan '2' | ||
option ports '1 2 3 4 6t' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
config wifi-device 'radio0' | ||
option type 'mac80211' | ||
option channel '11' | ||
option hwmode '11g' | ||
option path 'platform/qca955x_wmac' | ||
option htmode 'HT20' | ||
option disabled '1' | ||
|
||
config wifi-iface 'default_radio0' | ||
option device 'radio0' | ||
option network 'lan' | ||
option mode 'ap' | ||
option ssid 'OpenWrt' | ||
option encryption 'none' | ||
|
||
config wifi-device 'radio1' | ||
option type 'mac80211' | ||
option channel '36' | ||
option hwmode '11a' | ||
option path 'pci0000:00/0000:00:00.0' | ||
option htmode 'HT20' | ||
option disabled '1' | ||
|
||
config wifi-iface 'default_radio1' | ||
option device 'radio1' | ||
option network 'lan' | ||
option mode 'ap' | ||
option ssid 'OpenWrt' | ||
option encryption 'none' | ||
|
||
config wifi-device 'radio2' | ||
option type 'mac80211' | ||
option channel '36' | ||
option hwmode '11a' | ||
option path 'pci0000:01/0000:01:00.0' | ||
option htmode 'HT20' | ||
option disabled '1' | ||
|
||
config wifi-iface 'default_radio2' | ||
option device 'radio2' | ||
option network 'lan' | ||
option mode 'ap' | ||
option ssid 'OpenWrt' | ||
option encryption 'none' | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this file available somewhere already? can find the same one in the /etc/board.json of the librerouters...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This files is created on first boot by
/bin/board_detect
that I think is run by/etc/preinit
that is run byprocd
./etc/board.json
is created with information gathered mostly by/etc/board.d/02_network
so the way the information is stored on the code is in bash form.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we can't get it from there for the tests then? (just thinking on deduplicating it because of the implications on maintenance...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure to be understanding your question. You mean from inside a LinbreRouter? Yes that is what I did (I copied the board.json file and the other two files, network and wireless) and that is what I think we should do for other devices too. I don't think there is an online database of this files so we don't have to do it. If we want to have this kind of integration test "with device emulation" then I don't think we have other options, or maybe I am not seeing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean getting that information from where it comes instead of hardcoding it...
don't worry, it is a lower priority thing. important to keep an eye on deduplication, but certainly not urgent