-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from sarcasticadmin/sa/issue-128
[READY] issue-128 - Adding golden files for template validation on openwrt
- Loading branch information
Showing
25 changed files
with
415 additions
and
10 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: 2 | ||
jobs: | ||
test: | ||
docker: | ||
# Lockdown version after gomplate issue is resolved | ||
# https://github.com/hairyhenderson/gomplate/issues/484 | ||
- image: hairyhenderson/gomplate | ||
steps: | ||
- checkout: | ||
path: tests/unit/openwrt | ||
- run: | ||
name: openwrt golden file test | ||
command: sh test.sh | ||
|
||
workflows: | ||
version: 2 | ||
build_and_test: | ||
jobs: | ||
- test |
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 |
---|---|---|
@@ -1,31 +1,31 @@ | ||
# scale-network | ||
configurations, tooling and scripts for [SCALE's](https://www.socallinuxexpo.org/) on-site expo network | ||
configurations, tooling and scripts for [SCaLE's](https://www.socallinuxexpo.org/) on-site expo network | ||
|
||
## Table of Contents | ||
* [CONTRIBUTING](./CONTRIBUTING.md) | ||
* [MAPS](./MAPS.md) | ||
* [SWITCH CONFIG](./switch-configuration/README.md) | ||
* [ANSIBLE](./ansible/README.md) | ||
* [OPENWRT](./openwrt/README.md) | ||
* [TESTING](./tests/serverspec/README.md) | ||
* [TESTING](./tests/README.md) | ||
|
||
## Requirements | ||
To use this git repo you will need the following pkgs: | ||
- git >= 1.8.2 | ||
- git-lfs | ||
- gomplete == 2.2.0 | ||
- gomplate >= 3.2.0 | ||
|
||
### Installation | ||
#### Gomplate | ||
Installation of `gomplate` is a little bit tricky since it doesnt come in a `.deb`: | ||
```bash | ||
sudo -i | ||
cd /usr/local/bin/ | ||
curl -O https://github.com/hairyhenderson/gomplate/releases/download/v2.2.0/gomplate_linux-amd64 -L | ||
curl -O https://github.com/hairyhenderson/gomplate/releases/download/<version>/gomplate_linux-amd64 -L | ||
mv gomplate_linux-amd64 gomplate | ||
``` | ||
|
||
## Contributing | ||
SCALE happens once a year but the team has ongoing projects and prep year round. | ||
SCaLE happens once a year but the team has ongoing projects and prep year round. | ||
If you are interesting in volunteering please request to join our mailing list: | ||
https://lists.linuxfests.org/cgi-bin/mailman/listinfo/tech |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
* | ||
*/ | ||
!.gitignore | ||
!*-example.yaml |
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,2 @@ | ||
.gomplateignore | ||
*.sw* |
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,6 @@ | ||
# Tests | ||
|
||
## Table of Contents | ||
|
||
* [SERVERSPEC](./serverspec/README.md) | ||
* [OPENWRT UNITTEST](./unit/openwrt/README.md) |
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,20 @@ | ||
# Openwrt Goldens | ||
|
||
## Usage | ||
|
||
To test the template output from whats generated using gomplate. If does this by `diff`ing | ||
a known good generated set of files found in `./golden` with generated files in `./tmp`. | ||
|
||
Just run: | ||
|
||
``` | ||
sh test.sh | ||
``` | ||
|
||
If it returns a diff then the goldens dont match the current output. If this is intended | ||
due to other code changes then you can run the same script with `-u` to update the goldens. | ||
|
||
``` | ||
sh test.sh -u | ||
``` | ||
> **NOTE:** This all needs to be done from the scripts current directory |
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,59 @@ | ||
## Following "macros" may be used in options below: | ||
## %t - target name (address) | ||
## %T - target description | ||
## %a - alarm name | ||
## %A - alarm type ("down"/"loss"/"delay") | ||
## %r - reason of message ("ALARM"/"alarm canceled"/"alarm canceled (config reload)") | ||
## %p - probes send | ||
## %P - probes received | ||
## %l - recent average packet loss | ||
## %d - recent average delay | ||
## %s - current timestamp | ||
## %% - '%' character | ||
|
||
## User and group the pinger should run as | ||
# Needs to be root for interacting with wifi | ||
user "root" | ||
group "nogroup" | ||
|
||
## Location of the pid-file (default: "/var/run/apinger.pid") | ||
#pid_file "/var/run/apinger.pid" | ||
|
||
status { | ||
## File where the status information whould be written to | ||
file "/tmp/apinger.status" | ||
## Interval between file updates | ||
## when 0 or not set, file is written only when SIGUSR1 is received | ||
interval 10s | ||
} | ||
|
||
## Target defaults that are inheretted by each target | ||
## and can be overwritten | ||
target default { | ||
## How often the probe should be sent | ||
interval 2s | ||
|
||
## How many replies should be used to compute average delay | ||
## for controlling "delay" alarms | ||
avg_delay_samples 10 | ||
|
||
## How many probes should be used to compute average loss | ||
avg_loss_samples 50 | ||
## The delay (in samples) after which loss is computed | ||
## without this delays larger than interval would be treated as loss | ||
avg_loss_delay_samples 20 | ||
} | ||
|
||
alarm down "wifi" { | ||
time 10s | ||
## Turn off network | ||
command on "/usr/bin/logger -t apinger %t %a: %r && wifi down" | ||
## Turn on network | ||
command off "/usr/bin/logger -t apinger %t %a: %r && wifi up" | ||
combine 10s | ||
} | ||
|
||
target "8.8.8.8" { | ||
description "endpoint validation" | ||
alarms override "wifi" | ||
} |
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,61 @@ | ||
config interface 'loopback' | ||
option ifname 'lo' | ||
option proto 'static' | ||
option ipaddr '127.0.0.1' | ||
option netmask '255.0.0.0' | ||
|
||
config globals 'globals' | ||
option ula_prefix 'fdfa:7251:0374::/48' | ||
|
||
|
||
config switch | ||
option name 'switch0' | ||
option reset '1' | ||
option enable_vlan '1' | ||
option enable_vlan4k '1' | ||
option blinkrate '2' | ||
|
||
|
||
|
||
config interface 'mgmt' | ||
option ifname 'eth1' | ||
option proto 'dhcp' | ||
option type 'bridge' | ||
|
||
config interface 'mgmt6' | ||
option ifname '@mgmt' | ||
option proto 'dhcpv6' | ||
option reqprefix 'no' | ||
|
||
config interface 'staffwifi' | ||
option ifname 'eth1.108 eth1.508' | ||
option proto 'none' | ||
option type 'bridge' | ||
|
||
config interface 'scaleslow' | ||
option ifname 'eth1.100 eth1.500' | ||
option proto 'none' | ||
option type 'bridge' | ||
|
||
config interface 'scalefast' | ||
option ifname 'eth1.101 eth1.501' | ||
option proto 'none' | ||
option type 'bridge' | ||
|
||
|
||
|
||
config switch_port | ||
option device 'switch0' | ||
option port '1' | ||
option led '6' | ||
|
||
config switch_port | ||
option device 'switch0' | ||
option port '2' | ||
option led '9' | ||
|
||
config switch_port | ||
option device 'switch0' | ||
option port '5' | ||
option led '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,57 @@ | ||
|
||
config wifi-device 'radio0' | ||
option type 'mac80211' | ||
option hwmode '11g' | ||
option path 'pci0000:00/0000:00:11.0' | ||
option htmode 'HT20' | ||
option channel '11' | ||
option txpower '8' | ||
option country 'US' | ||
|
||
config wifi-device 'radio1' | ||
option type 'mac80211' | ||
option hwmode '11a' | ||
option path 'pci0000:00/0000:00:12.0' | ||
option htmode 'HT20' | ||
option channel '36' | ||
option txpower '8' | ||
option country 'US' | ||
|
||
|
||
|
||
config wifi-iface 'scaleslow_radio0' | ||
option device 'radio0' | ||
option ssid 'scale-public-slow' | ||
option mode 'ap' | ||
option network 'scaleslow' | ||
option encryption 'psk2' | ||
option key 'tuxlinux' | ||
option disabled '0' | ||
|
||
config wifi-iface 'staffwifi_radio0' | ||
option device 'radio0' | ||
option ssid 'scale-staff-24' | ||
option mode 'ap' | ||
option network 'staffwifi' | ||
option encryption 'psk2' | ||
option key 'testpassword' | ||
option disabled '0' | ||
|
||
config wifi-iface 'scalefast_radio1' | ||
option device 'radio1' | ||
option ssid 'scale-public-fast' | ||
option mode 'ap' | ||
option network 'scalefast' | ||
option encryption 'psk2' | ||
option key 'tuxlinux' | ||
option disabled '0' | ||
|
||
config wifi-iface 'staffwifi_radio1' | ||
option device 'radio1' | ||
option ssid 'scale-staff-5' | ||
option mode 'ap' | ||
option network 'staffwifi' | ||
option encryption 'psk2' | ||
option key 'testpassword' | ||
option disabled '0' | ||
|
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 @@ | ||
0 * * * * /usr/sbin/logrotate -f /etc/logrotate.conf -s /tmp/logrotate.status |
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,18 @@ | ||
# rotate log files daily | ||
daily | ||
|
||
# keep 2 days worth of backlogs | ||
rotate 2 | ||
|
||
# create new (empty) log files after rotating old ones | ||
create | ||
|
||
notifempty | ||
nomail | ||
missingok | ||
|
||
# uncomment this if you want your log files compressed | ||
compress | ||
|
||
# packages can drop log rotation information into this directory | ||
include /etc/logrotate.d |
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,7 @@ | ||
/var/log/messages { | ||
missingok | ||
notifempty | ||
compress | ||
size 500k | ||
copytruncate | ||
} |
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,9 @@ | ||
root:x:0:0:root:/root:/bin/ash | ||
daemon:*:1:1:daemon:/var:/bin/false | ||
ftp:*:55:55:ftp:/home/ftp:/bin/false | ||
network:*:101:101:network:/var:/bin/false | ||
nobody:*:65534:65534:nobody:/var:/bin/false | ||
dnsmasq:x:453:453:dnsmasq:/var/run/dnsmasq:/bin/false | ||
sshd:x:22:22:sshd:/var/run/sshd:/bin/false | ||
zabbix:x:53:53:zabbix:/var/run/zabbix:/bin/false | ||
lldp:x:121:129:lldp:/var/run/lldp:/bin/false |
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,7 @@ | ||
# Put your custom commands here that should be executed once | ||
# the system init finished. By default this file does nothing. | ||
|
||
# TODO make this a true service | ||
/root/bin/wifi-details.sh & | ||
|
||
exit 0 |
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 @@ | ||
nameserver 8.8.8.8 |
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,20 @@ | ||
module(load="imuxsock") | ||
module(load="imklog") | ||
module(load="imudp") | ||
#input(type="imudp" port="514") | ||
#module(load="imtcp") | ||
#input(type="imtcp" port="514") | ||
|
||
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat | ||
|
||
*.info;mail.none;authpriv.none;cron.none /var/log/messages | ||
|
||
authpriv.* /var/log/secure | ||
|
||
mail.* /var/log/maillog | ||
|
||
cron.* /var/log/cron | ||
|
||
local7.* /var/log/boot.log | ||
|
||
*.* action(type="omfwd" target="server2.scale.lan" port="514" protocol="udp") |
Oops, something went wrong.