blob: 01d33fc7986b74898c5d58454b01f2fddd1e37b9 [file] [log] [blame]
Jan Kundrát2f100fc2020-11-02 22:10:16 +01001#!/bin/bash
2
3set -ex
4
Jan Kundrát2f100fc2020-11-02 22:10:16 +01005YANG_ROADM=0
6YANG_COHERENT=0
7YANG_INLINE=0
8YANG_CALIBRATION=0
9
10YANG_DIR=/usr/share/cla-sysrepo/yang
11REPO=/etc/sysrepo/yang
12
13for ARG in $(cat /proc/cmdline); do
14 case "${ARG}" in
15 czechlight=*)
16 CZECHLIGHT="${ARG:11}"
17 ;;
18 esac
19done
20
Jan Kundrát811c0b02021-02-05 19:16:43 +010021INITIAL_DATA=${CZECHLIGHT%%-g2}
22
Jan Kundrát2f100fc2020-11-02 22:10:16 +010023case "${CZECHLIGHT}" in
Jan Kundrát811c0b02021-02-05 19:16:43 +010024 sdn-roadm-line*)
Jan Kundrát2f100fc2020-11-02 22:10:16 +010025 YANG_ROADM=1
26 WITH_FEATURE=hw-line-9
Jan Kundrát2f100fc2020-11-02 22:10:16 +010027 ;;
Jan Kundrát811c0b02021-02-05 19:16:43 +010028 sdn-roadm-add-drop*)
Jan Kundrát2f100fc2020-11-02 22:10:16 +010029 YANG_ROADM=1
30 WITH_FEATURE=hw-add-drop-20
Jan Kundrát2f100fc2020-11-02 22:10:16 +010031 ;;
Jan Kundrát811c0b02021-02-05 19:16:43 +010032 sdn-roadm-hires-add-drop*)
33 YANG_ROADM=1
34 WITH_FEATURE=hw-add-drop-20
Jan Kundrát811c0b02021-02-05 19:16:43 +010035 INITIAL_DATA=sdn-roadm-add-drop
36 ;;
37 sdn-roadm-coherent-a-d*)
Jan Kundrát2f100fc2020-11-02 22:10:16 +010038 YANG_COHERENT=1
39 ;;
Jan Kundrát811c0b02021-02-05 19:16:43 +010040 sdn-inline*)
Jan Kundrát2f100fc2020-11-02 22:10:16 +010041 YANG_INLINE=1
42 ;;
43 calibration-box)
44 YANG_CALIBRATION=1
45 ;;
46esac
47
Jan Kundrátb41f0082021-03-09 22:20:35 +010048sysrepoctl --search-dirs ${YANG_DIR} --install ${YANG_DIR}/iana-hardware@2018-03-13.yang
49sysrepoctl --search-dirs ${YANG_DIR} --install ${YANG_DIR}/ietf-hardware@2018-03-13.yang
50sysrepoctl --change ietf-hardware --permissions 0664 --enable-feature hardware-sensor --apply
Tomáš Peckac34a5452020-12-16 21:29:09 +010051
Jan Kundrátb41f0082021-03-09 22:20:35 +010052if [[ ${YANG_ROADM} == 1 ]]; then
53 sysrepoctl --search-dirs ${YANG_DIR} --install ${YANG_DIR}/czechlight-roadm-device@2021-03-05.yang
Jan Kundrát2f100fc2020-11-02 22:10:16 +010054 sysrepoctl --change czechlight-roadm-device --group optics --permissions 0664 --apply
55 if [[ ${WITH_FEATURE} ]]; then
56 sysrepoctl --change czechlight-roadm-device --enable-feature ${WITH_FEATURE}
57 fi
Jan Kundrát811c0b02021-02-05 19:16:43 +010058 sysrepocfg --datastore=startup --format=json --module=czechlight-roadm-device --import="${YANG_DIR}/${INITIAL_DATA}.json"
Jan Kundrát2f100fc2020-11-02 22:10:16 +010059fi
60
Jan Kundrátb41f0082021-03-09 22:20:35 +010061if [[ ${YANG_COHERENT} == 1 ]]; then
62 sysrepoctl --search-dirs ${YANG_DIR} --install ${YANG_DIR}/czechlight-coherent-add-drop@2021-03-05.yang
Jan Kundrát811c0b02021-02-05 19:16:43 +010063 sysrepocfg --datastore=startup --format=json --module=czechlight-coherent-add-drop --new-data="${YANG_DIR}/${INITIAL_DATA}.json"
Jan Kundrát00876bd2021-01-29 19:51:59 +010064 sysrepoctl --change czechlight-coherent-add-drop --group optics --permissions 0664 --apply
Jan Kundrát2f100fc2020-11-02 22:10:16 +010065fi
66
Jan Kundrátb41f0082021-03-09 22:20:35 +010067if [[ ${YANG_INLINE} == 1 ]]; then
68 sysrepoctl --search-dirs ${YANG_DIR} --install ${YANG_DIR}/czechlight-inline-amp@2021-03-05.yang
Jan Kundrát811c0b02021-02-05 19:16:43 +010069 sysrepocfg --datastore=startup --format=json --module=czechlight-inline-amp --import="${YANG_DIR}/${INITIAL_DATA}.json"
Jan Kundrát00876bd2021-01-29 19:51:59 +010070 sysrepoctl --change czechlight-inline-amp --group optics --permissions 0664 --apply
Jan Kundrát2f100fc2020-11-02 22:10:16 +010071fi
72
Jan Kundrátb41f0082021-03-09 22:20:35 +010073if [[ ${YANG_CALIBRATION} == 1 ]]; then
Jan Kundrátcf5dd8a2020-11-05 15:59:11 +010074 sysrepoctl --search-dirs ${YANG_DIR} --install ${YANG_DIR}/czechlight-calibration-device@2019-06-25.yang
Jan Kundrát811c0b02021-02-05 19:16:43 +010075 sysrepocfg --datastore=startup --format=json --module=czechlight-calibration-device --import="${YANG_DIR}/${INITIAL_DATA}.json"
Jan Kundrát00876bd2021-01-29 19:51:59 +010076 sysrepoctl --change czechlight-calibration-device --group optics --permissions 0664 --apply
Jan Kundrát2f100fc2020-11-02 22:10:16 +010077fi
78
Jan Kundrátb41f0082021-03-09 22:20:35 +010079sysrepoctl --search-dirs /usr/share/velia/yang --install /usr/share/velia/yang/ietf-system@2014-08-06.yang
80sysrepoctl --change ietf-system --permissions 0664 --apply
Tomáš Pecka01df8482021-01-13 18:04:19 +010081
Jan Kundrátb41f0082021-03-09 22:20:35 +010082sysrepoctl --search-dirs /usr/share/lldp-systemd-networkd-sysrepo/yang --install /usr/share/lldp-systemd-networkd-sysrepo/yang/czechlight-lldp@2020-11-04.yang
83sysrepoctl --change czechlight-lldp --permissions 0664 --apply
Jan Kundrát2f100fc2020-11-02 22:10:16 +010084
Jan Kundrátb41f0082021-03-09 22:20:35 +010085sysrepoctl --search-dirs /usr/share/velia/yang --install /usr/share/velia/yang/czechlight-system@2021-01-13.yang
86sysrepoctl --change czechlight-system --permissions 0664 --apply
Tomáš Pecka25aae682021-01-27 14:45:57 +010087
Jan Kundrátb41f0082021-03-09 22:20:35 +010088sysrepoctl --search-dirs /usr/share/velia/yang --install /usr/share/velia/yang/czechlight-firewall@2021-01-25.yang
89sysrepoctl --change czechlight-firewall --permissions 0600 --apply
90sysrepoctl --change ietf-access-control-list --enable-feature eth --enable-feature match-on-eth --enable-feature match-on-ipv4 --enable-feature ipv4 --enable-feature match-on-ipv6 --enable-feature ipv6 --enable-feature mixed-eth-ipv4-ipv6
Václav Kubernát22e240c2021-02-04 10:14:19 +010091
Jan Kundrát34d2f482021-01-11 19:24:09 +010092# If not do not copy here from startup -> running, running might be stale.
93sysrepocfg -C startup