Start building sysrepo-ietf-alarms
The project also requires date library[1] but it was not running
correctly on our ARM. I had to patch the library with the workaround
from [2], hence the buildroot update.
[1] https://github.com/HowardHinnant/date
[2] https://github.com/HowardHinnant/date/issues/252
Change-Id: Ie82b8c9ea50b0198b024256ff81d67ba7344c190
diff --git a/package/Config.in b/package/Config.in
index 0ef80ea..a494e28 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -8,3 +8,4 @@
source "$BR2_EXTERNAL_CZECHLIGHT_PATH/package/grub2-tools/Config.in"
source "$BR2_EXTERNAL_CZECHLIGHT_PATH/package/reset-sysrepo/Config.in"
source "$BR2_EXTERNAL_CZECHLIGHT_PATH/package/rousette/Config.in"
+source "$BR2_EXTERNAL_CZECHLIGHT_PATH/package/sysrepo-ietf-alarms/Config.in"
diff --git a/package/czechlight-cfg-fs/czechlight-install-yang.sh b/package/czechlight-cfg-fs/czechlight-install-yang.sh
index 9c072d4..edfd6b1 100755
--- a/package/czechlight-cfg-fs/czechlight-install-yang.sh
+++ b/package/czechlight-cfg-fs/czechlight-install-yang.sh
@@ -9,6 +9,7 @@
CLA_YANG="${CLA_YANG:-/usr/share/cla-sysrepo/yang}"
VELIA_YANG="${VELIA_YANG:-/usr/share/velia/yang}"
+ALARMS_YANG="${ALARMS_YANG:-/usr/share/sysrepo-ietf-alarms/yang}"
PROC_CMDLINE="${PROC_CMDLINE:-/proc/cmdline}"
for ARG in $(cat "$PROC_CMDLINE"); do
@@ -73,6 +74,9 @@
sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-calibration-device@2019-06-25.yang --permissions 0660
fi
+sysrepoctl --search-dirs ${ALARMS_YANG} --install ${ALARMS_YANG}/ietf-alarms@2019-09-11.yang --permissions 0660 --enable-feature alarm-shelving --enable-feature alarm-summary
+sysrepoctl --search-dirs ${ALARMS_YANG} --install ${ALARMS_YANG}/sysrepo-ietf-alarms@2022-02-17.yang --permissions 0660
+
sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-system@2014-08-06.yang --permissions 0660
sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/czechlight-lldp@2020-11-04.yang --permissions 0660
diff --git a/package/czechlight-cfg-fs/czechlight-migrate.sh b/package/czechlight-cfg-fs/czechlight-migrate.sh
index bb95783..2046010 100755
--- a/package/czechlight-cfg-fs/czechlight-migrate.sh
+++ b/package/czechlight-cfg-fs/czechlight-migrate.sh
@@ -11,6 +11,7 @@
export CLA_YANG="${CLA_YANG:-/usr/share/cla-sysrepo/yang}"
export VELIA_YANG="${VELIA_YANG:-/usr/share/velia/yang}"
+export ALARMS_YANG="${ALARMS_YANG:-/usr/share/sysrepo-ietf-alarms/yang}"
# load migrations and perform a sanity check (filename's numerical prefix corresponds to the order in the MIGRATIONS array)
source $MIGRATIONS
diff --git a/package/sysrepo-ietf-alarms/Config.in b/package/sysrepo-ietf-alarms/Config.in
new file mode 100644
index 0000000..0d87925
--- /dev/null
+++ b/package/sysrepo-ietf-alarms/Config.in
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_SYSREPO_IETF_ALARMS
+ bool "velia"
+ select BR2_PACKAGE_DOCOPT_CPP
+ select BR2_PACKAGE_SPDLOG
+ select BR2_PACKAGE_SYSREPO
+ select BR2_PACKAGE_SYSREPO_CPP
+ select BR2_PACKAGE_CZECHLIGHT_CFG_FS
+ select BR2_PACKAGE_DATE
+ help
+ Implementing the `ietf-alarms` YANG module for sysrepo.
+
+ https://gerrit.cesnet.cz/q/project:CzechLight/sysrepo-ietf-alarms
diff --git a/package/sysrepo-ietf-alarms/sysrepo-ietf-alarms.hash b/package/sysrepo-ietf-alarms/sysrepo-ietf-alarms.hash
new file mode 100644
index 0000000..075e53a
--- /dev/null
+++ b/package/sysrepo-ietf-alarms/sysrepo-ietf-alarms.hash
@@ -0,0 +1 @@
+none xxx
diff --git a/package/sysrepo-ietf-alarms/sysrepo-ietf-alarms.mk b/package/sysrepo-ietf-alarms/sysrepo-ietf-alarms.mk
new file mode 100644
index 0000000..dab9957
--- /dev/null
+++ b/package/sysrepo-ietf-alarms/sysrepo-ietf-alarms.mk
@@ -0,0 +1,17 @@
+SYSREPO_IETF_ALARMS_VERSION = master
+SYSREPO_IETF_ALARMS_SITE = https://gerrit.cesnet.cz/CzechLight/sysrepo-ietf-alarms
+SYSREPO_IETF_ALARMS_SITE_METHOD = git
+SYSREPO_IETF_ALARMS_INSTALL_STAGING = NO
+SYSREPO_IETF_ALARMS_DEPENDENCIES = docopt-cpp spdlog date sysrepo sysrepo-cpp
+SYSREPO_IETF_ALARMS_LICENSE = Apache-2.0
+SYSREPO_IETF_ALARMS_LICENSE_FILES = LICENSE.md
+
+define SYSREPO_IETF_ALARMS_INSTALL_INIT_SYSTEMD
+ mkdir -p $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/
+ $(INSTALL) -D -m 0644 \
+ $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/sysrepo-ietf-alarms/sysrepo-ietf-alarms.service \
+ $(TARGET_DIR)/usr/lib/systemd/system/
+ ln -sf ../sysrepo-ietf-alarms.service $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/
+endef
+
+$(eval $(cmake-package))
diff --git a/package/sysrepo-ietf-alarms/sysrepo-ietf-alarms.service b/package/sysrepo-ietf-alarms/sysrepo-ietf-alarms.service
new file mode 100644
index 0000000..0bb5884
--- /dev/null
+++ b/package/sysrepo-ietf-alarms/sysrepo-ietf-alarms.service
@@ -0,0 +1,25 @@
+[Unit]
+Description=IETF-alarms management via sysrepo
+After=syslog.target network.target cfg-restore-sysrepo.service czechlight-migrate.service nacm-restore.service
+Before=rauc-mark-good.service
+PartOf=netopeer2.service
+Requires=cfg-restore-sysrepo.service czechlight-migrate.service nacm-restore.service
+ConditionKernelCommandLine=czechlight
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/sysrepo-ietf-alarmsd
+Group=sysrepo
+PrivateTmp=yes
+PrivateDevices=no
+ProtectSystem=yes
+ProtectHome=yes
+Restart=always
+RestartSec=10s
+LogRateLimitIntervalSec=10
+LogRateLimitBurst=30000
+SyslogLevel=alert
+
+[Install]
+WantedBy=multi-user.target
+RequiredBy=velia-health.service