add infrastructure for hardware database #22

Open
jkimmel wants to merge 3 commits from jkimmel/docs:hw into master
7 changed files with 380 additions and 1 deletions

50
archetypes/hardware.md Normal file
View File

@ -0,0 +1,50 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
hardware:
manufacturer: MFG
model: Model
chip: SoC
recommended: true
cores: 2
threads: 4
clock: 1000
ram: 262144
flash: 262144
serial:
- ttl
- usb
- rj45
interface:
- dev: eth0
type: rj45
speed: 1000
features: [ 24V, dsa, PD ]
roleL3: wan
roleNode: wan
- dev: eth1
type: rj45
speed: 1000
features: [ 802.3af, dsa ]
roleL3: client
roleNode: client
- dev: eth4
type: sfp
speed: 1000
features: [ ]
roleL3: client
roleNode: batman
- dev: wifi2
type: 2ghz
speed: 150
features: [ "n", 1T, 1R ]
- dev: wifi5
type: 5ghz
speed: 866
features: [ ac, 2T, 2R ]
benchmark:
benchmark1: measurement
---
## Spezifikation
{{< detailsofhardware >}}

View File

@ -21,3 +21,4 @@ params:
BookRepo: https://git.freifunk-franken.de/freifunk-franken/docs
BookEditPath: _edit/master
BookDateFormat: 2006-01-02
FirmwareVersion: 20221201

View File

@ -4,4 +4,4 @@ bookCollapseSection: true
date: 2022-12-01T17:25:00+01:00
---
{{< section >}}
{{< tableofhardware >}}

View File

@ -0,0 +1,28 @@
---
title: "Foobar"
date: 2023-02-22T22:43:36+01:00
hardware:
manufacturer: MFG
model: Model
chip: Amazing SoC
recommended: false
cores: 16
threads: 16
clock: 1000
ram: 1024
flash: 64
serial:
- rj45
interface:
- dev: eth0
type: rj45
speed: 1000
features: [ 24V, 802.3af, PD ]
- dev: eth1
type: sfp
speed: 1000
features: [ dsa ]
---
## Spezifikation
{{< detailsofhardware >}}

74
content/hardware/test.md Normal file
View File

@ -0,0 +1,74 @@
---
title: "Compafoo FantasyRouter"
date: 2023-02-22T20:44:25+01:00
hardware:
manufacturer: Compafoo
model: FantasyRouter
chip: MediaTek MT7621
recommended: true
cores: 2
threads: 4
clock: 880
ram: 252312
flash: 262144
firmware:
- type: factory
usage: Erstinstalltion über Stock Firmware
fragmentL3: netgear_r6220-factory.img
fragmentNode: netgear_r6220-factory.img
- type: sysupgrade
usage: Installation und Update aus OpenWrt oder Freifunk Firmware
fragmentL3: netgear_r6220-sysupgrade.bin
fragmentNode: netgear_r6220-sysupgrade.bin
serial:
- ttl
interface:
- dev: eth0
type: rj45
speed: 1000
features: [ 24V, dsa ]
roleL3: wan
roleNode: wan
- dev: eth1
type: rj45
speed: 1000
features: [ 24V, dsa ]
roleL3: client
roleNode: client
- dev: eth2
type: rj45
speed: 1000
features: [ 24V, dsa ]
roleL3: client
roleNode: client
- dev: eth3
type: rj45
speed: 1000
features: [ 24V, dsa ]
roleL3: client
roleNode: batman
- dev: eth4
type: rj45
speed: 1000
features: [ 24V, dsa ]
roleL3: client
roleNode: batman
- dev: eth5
type: sfp
speed: 1000
features: [ 24V, dsa ]
- dev: wifi2
type: 2ghz
speed: 150
features: [ "n", 1T, 1R ]
- dev: wifi5
type: 5ghz
speed: 866
features: [ ac, 2T, 2R ]
benchmark:
benchmark1: failed
benchmarkTunnel: "666Mbps"
---
## Spezifikation
{{< detailsofhardware >}}

View File

@ -0,0 +1,200 @@
{{ $hw := .Page.Params.hardware }}
<h3>Datenblatt</h3>
{{ with $hw }}
<table>
<tbody>
<tr>
<td>Bezeichnung</td>
<td>{{ .manufacturer }} {{ .model }}</td>
</tr>
<tr>
<td>Empfohlen</td>
<td>{{ cond .recommended (emojify ":heavy_check_mark:") (emojify ":x:") }}</td>
</tr>
<tr>
<td>SoC</td>
<td>{{ .chip }}</td>
</tr>
<tr>
<td>CPU</td>
<td>{{ .cores }} Core {{ .threads }} Threads @ {{ .clock }} MHz</td>
</tr>
<tr>
<td>RAM</td>
<td>{{ div .ram 1024 }}MiB</td>
</tr>
<tr>
<td>Flash</td>
<td>{{ div .flash 1024 }}MiB</td>
</tr>
{{ with .serial }}
<tr>
<td>Serielle Schnittstelle</td>
<td>{{ delimit . ", " }}</td>
</tr>
{{ end }}
</tbody>
</table>
{{ end }}
{{ with $hw.interface }}
<h3>Schnittstellen</h3>
{{ $wired := where . "type" "in" (slice "rj45" "sfp") }}
{{ with $wired }}
<h4>Kabelgebunden</h4>
<table>
<thead>
<tr>
<th></th>
{{ range . -}}
<th>{{ .dev }}</th>
{{ end }}
</tr>
</thead>
<tbody>
<tr>
<th>Typ</th>
{{ range . -}}
<td>{{ .speed }}Mbps {{ .type | upper }}</td>
{{ end }}
</tr>
{{ if where . ".features" "intersect" (slice "24V" "802.3af" "802.3at" "PD") }}
<tr>
<th>PoE</th>
{{ range . -}}
<td>{{ delimit (intersect .features (slice "24V" "802.3af" "802.3at" "PD")) ", " }}</td>
{{ end }}
</tr>
{{ end }}
{{ if where . ".features" "intersect" (slice "dsa") }}
<tr>
<th>DSA Port</th>
{{ range . -}}
<td>{{ cond (in .features "dsa") (emojify ":heavy_check_mark:") "" }}</td>
{{ end }}
</tr>
{{ end }}
{{ if where . "roleL3" "!=" nil }}
<tr>
<th>Belegung L3</th>
{{ range . -}}
<td>{{ echoParam . "roleL3" }}</td>
{{ end }}
</tr>
{{ end }}
{{ if where . "roleNode" "!=" nil }}
<tr>
<th>Belegung Node</th>
{{ range . -}}
<td>{{ echoParam . "roleNode" }}</td>
{{ end }}
</tr>
{{ end }}
</tbody>
</table>
{{ end }}
{{ $wireless := where $hw.interface "type" "in" (slice "2ghz" "5ghz") }}
{{ with $wireless }}
<h4>Wireless</h4>
<table>
<thead>
<tr>
<th></th>
{{ range . -}}
<th>{{ .dev }}</th>
{{ end }}
</tr>
</thead>
<tbody>
{{ if where . ".features" "intersect" (slice "bg" "n" "ac" "ax") }}
<tr>
<th>Standard</th>
{{ range . -}}
<td>{{ delimit (intersect .features (slice "bg" "n" "ac" "ax")) ", " }}</td>
{{ end }}
</tr>
{{ end }}
{{ if where . ".speed" "!=" nil }}
<tr>
<th>Datenrate</th>
{{ range . -}}
<td>{{ echoParam . "speed" }} Mbit/s</td>
{{ end }}
</tr>
{{ end }}
</tbody>
</table>
{{ end }}
{{ end }}
{{ with $hw.benchmark }}
<h4>Benchmarks</h4>
<table>
<thead>
<tr>
<th>Benchmark</th>
<th>Messung</th>
</tr>
</thead>
<tbody>
{{ range $b, $m := . }}
<tr>
<td>{{ $b }}</td>
<td>{{ $m }}</td>
</tr>
{{ end }}
</tbody>
</table>
{{ end }}
{{ with $hw.firmware }}
<h3>Firmware Download</h3>
{{ range . }}
<h4>{{ .usage }} - "{{ .type }}"</h4>
<table>
<tr>
<td>Layer 3</td>
<td><a href="https://dev.freifunk-franken.de/layer3/{{ $.Site.Params.FirmwareVersion }}/fff-layer3-{{ $.Site.Params.FirmwareVersion }}-{{ .fragmentL3 }}">fff-layer3-{{ $.Site.Params.FirmwareVersion }}-{{ .fragmentL3 }}</a></td>
</tr>
<tr>
<td>Node</td>
<td><a href="https://dev.freifunk-franken.de/node/{{ $.Site.Params.FirmwareVersion }}/fff-node-{{ $.Site.Params.FirmwareVersion }}-{{ .fragmentNode }}">fff-node-{{ $.Site.Params.FirmwareVersion }}-{{ .fragmentNode }}</a></td>
</tr>
</table>
{{ end }}
{{ end }}
{{ with $hw.firmware }}
<h3>Firmware Download</h3>
<table>
<thead>
<tr>
<th>Verwendung</th>
<th>Layer 3</th>
<th>Node</th>
</tr>
</thead>
<tbody>
{{ range . }}
<tr>
<th>{{ .usage }}<br>"{{ .type }}"</th>
<td><a href="https://dev.freifunk-franken.de/layer3/{{ $.Site.Params.FirmwareVersion }}/fff-layer3-{{ $.Site.Params.FirmwareVersion }}-{{ .fragmentL3 }}">fff-layer3-{{ $.Site.Params.FirmwareVersion }}-{{ .fragmentL3 }}</a></td>
<td><a href="https://dev.freifunk-franken.de/node/{{ $.Site.Params.FirmwareVersion }}/fff-node-{{ $.Site.Params.FirmwareVersion }}-{{ .fragmentNode }}">fff-node-{{ $.Site.Params.FirmwareVersion }}-{{ .fragmentNode }}</a></td>
</tr>
{{ end }}
</tbody>
</table>
{{ end }}
<!-- test -->
<h2>debug :)</h2>
{{ template "treeview" .Page.Params.hardware }}
{{ define "treeview" }}
<ul>
{{ range $k, $v := . }}
<li>{{ $k }}
{{ if (or (reflect.IsMap $v) (reflect.IsSlice $v)) }}{{ template "treeview" $v }}{{ else }}{{ $v }}{{end}}
</li>
{{ end }}
</ul>
{{ end }}
{{ highlight (jsonify (dict "indent" "\t") .Page.Params.hardware) "json" }}

View File

@ -0,0 +1,26 @@
<table>
<tr>
<th>Hersteller</th>
<th>Modell</th>
<th>DSA Ports</th>
<th>Radios</th>
<th>Schnittstellen</th>
<th>Empfohlen</th>
</tr>
{{ range $device := where .Page.Pages "Params.hardware" "!=" nil }}
{{ $hw := $device.Params.hardware }}
<tr>
<td>{{ $hw.manufacturer }}</td>
<td><a href="{{ $device.RelPermalink }}">{{ $hw.model }}</a></td>
<td>{{ where $hw.interface "features" "intersect" (slice "dsa") | len }}</td>
<td>{{ where $hw.interface "type" "in" (slice "2ghz" "5ghz") | len }}</td>
<td>
{{ range $type := slice "sfp" "rj45" "2ghz" "5ghz" }}
{{ $n := (where $hw.interface "type" "in" (slice $type) | len) }}
{{ if gt $n 0 }}{{ $n }}x<code>{{ $type }}</code>{{ end }}
{{ end }}
</td>
<td>{{ cond $hw.recommended (emojify ":heavy_check_mark:") (emojify ":x:") }}</td>
</tr>
{{ end }}
</table>