sql/135: IMMUTABLE derivation helpers (modulation NRZ/PAM4/DP-16QAM/DP-QPSK/ Coherent, fec_type, inbuilt_fec, coherent) keyed off speed_gbps + form_factor + part_number/standard_name regex. Fill-only, idempotent via fn_tip_enrich_modulation_fec() + daily self-healing cron. Coverage >=100G 3-8% -> 46%. Rules built by a 4-lens optical-standards workflow, adversarially verified (10G-ZR, CFP2-DCO, AOC/DAC scope, bare-QSFP28 fixes folded in before apply). sql/136: speed_gbps made nullable + tip_speed_is_implausible() + BEFORE trigger trg_speed_plausibility (sanitize junk to NULL on write, never abort). One-time cleanup nulled 4708 junk rows (reversible via tip_speed_gbps_rollback); legit FC/SDI/CPRI/OTN gray band preserved. sql/137: v_transceiver_speed_errors flags only real optics -> 596 (was 2134).
22 lines
930 B
Bash
22 lines
930 B
Bash
#!/bin/bash
|
|
# Daily self-healing enrichment: fills modulation/fec_type/inbuilt_fec/coherent on
|
|
# new/changed transceivers via the idempotent fill-only fn_tip_enrich_modulation_fec().
|
|
# The speed plausibility guard (trg_speed_plausibility) already self-heals on write.
|
|
# Cron: 30 3 * * * /opt/tip/scripts/enrich-modulation-fec.sh
|
|
set -uo pipefail
|
|
LOG=/opt/tip/logs/enrich-modulation-fec.log
|
|
mkdir -p "$(dirname "$LOG")"
|
|
TS=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
|
|
|
|
# shellcheck disable=SC1091
|
|
source /opt/tip/.env 2>/dev/null || true
|
|
PW="${POSTGRES_PASSWORD:-}" # short-named var carries the secret to docker, no literal
|
|
N=$(docker exec -e PGPASSWORD="$PW" tip-postgres psql -U tip -d transceiver_db -tAc \
|
|
"select fn_tip_enrich_modulation_fec()" 2>/dev/null | tr -d '[:space:]')
|
|
|
|
if [[ "${N:-}" =~ ^[0-9]+$ ]]; then
|
|
echo "[$TS] enrich rows-touched=$N" >> "$LOG"
|
|
else
|
|
echo "[$TS] enrich FAILED (db unreachable?)" >> "$LOG"
|
|
fi
|