blob: 9c072d410e0413774a48f64c85fe8e1983c234db [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
Tomáš Pecka68366cd2022-06-06 09:27:41 +020010CLA_YANG="${CLA_YANG:-/usr/share/cla-sysrepo/yang}"
11VELIA_YANG="${VELIA_YANG:-/usr/share/velia/yang}"
12PROC_CMDLINE="${PROC_CMDLINE:-/proc/cmdline}"
Jan Kundrát2f100fc2020-11-02 22:10:16 +010013
Tomáš Pecka68366cd2022-06-06 09:27:41 +020014for ARG in $(cat "$PROC_CMDLINE"); do
Jan Kundrát2f100fc2020-11-02 22:10:16 +010015 case "${ARG}" in
16 czechlight=*)
17 CZECHLIGHT="${ARG:11}"
18 ;;
19 esac
20done
21
Jan Kundrát811c0b02021-02-05 19:16:43 +010022INITIAL_DATA=${CZECHLIGHT%%-g2}
23
Jan Kundrát2f100fc2020-11-02 22:10:16 +010024case "${CZECHLIGHT}" in
Jan Kundrát811c0b02021-02-05 19:16:43 +010025 sdn-roadm-line*)
Jan Kundrát2f100fc2020-11-02 22:10:16 +010026 YANG_ROADM=1
27 WITH_FEATURE=hw-line-9
Jan Kundrát2f100fc2020-11-02 22:10:16 +010028 ;;
Jan Kundrát811c0b02021-02-05 19:16:43 +010029 sdn-roadm-add-drop*)
Jan Kundrát2f100fc2020-11-02 22:10:16 +010030 YANG_ROADM=1
31 WITH_FEATURE=hw-add-drop-20
Jan Kundrát2f100fc2020-11-02 22:10:16 +010032 ;;
Jan Kundrát811c0b02021-02-05 19:16:43 +010033 sdn-roadm-hires-add-drop*)
34 YANG_ROADM=1
Jan Kundrát9cccf702021-12-03 11:09:07 +010035 WITH_FEATURE="hw-add-drop-20 pre-wss-ocm"
Jan Kundrát811c0b02021-02-05 19:16:43 +010036 INITIAL_DATA=sdn-roadm-add-drop
37 ;;
38 sdn-roadm-coherent-a-d*)
Jan Kundrát2f100fc2020-11-02 22:10:16 +010039 YANG_COHERENT=1
40 ;;
Jan Kundrát811c0b02021-02-05 19:16:43 +010041 sdn-inline*)
Jan Kundrát2f100fc2020-11-02 22:10:16 +010042 YANG_INLINE=1
43 ;;
44 calibration-box)
45 YANG_CALIBRATION=1
46 ;;
47esac
48
Jan Kundrát9b2aab82021-04-14 01:14:44 +020049sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/iana-hardware@2018-03-13.yang
50sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/ietf-hardware@2018-03-13.yang
Tomáš Peckad3861ce2022-05-11 11:51:30 +020051sysrepoctl --change ietf-hardware --permissions 0660 --enable-feature hardware-sensor
Tomáš Peckac34a5452020-12-16 21:29:09 +010052
Jan Kundrátb41f0082021-03-09 22:20:35 +010053if [[ ${YANG_ROADM} == 1 ]]; then
Václav Kubernát8cd61562021-12-08 13:27:31 +010054 FEATURE_ARGS=""
Jan Kundrát2f100fc2020-11-02 22:10:16 +010055 if [[ ${WITH_FEATURE} ]]; then
Jan Kundrát9cccf702021-12-03 11:09:07 +010056 for FEATURE in ${WITH_FEATURE}; do
Václav Kubernát8cd61562021-12-08 13:27:31 +010057 FEATURE_ARGS="${FEATURE_ARGS} --enable-feature ${FEATURE}"
Jan Kundrát9cccf702021-12-03 11:09:07 +010058 done
Jan Kundrát2f100fc2020-11-02 22:10:16 +010059 fi
Tomáš Peckad3861ce2022-05-11 11:51:30 +020060 sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-roadm-device@2021-03-05.yang ${FEATURE_ARGS} --permissions 0660
Jan Kundrát2f100fc2020-11-02 22:10:16 +010061fi
62
Jan Kundrátb41f0082021-03-09 22:20:35 +010063if [[ ${YANG_COHERENT} == 1 ]]; then
Tomáš Peckad3861ce2022-05-11 11:51:30 +020064 sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-coherent-add-drop@2021-03-05.yang --permissions 0660
Tomáš Peckad3861ce2022-05-11 11:51:30 +020065 sysrepoctl --change czechlight-coherent-add-drop --permissions 0660
Jan Kundrát2f100fc2020-11-02 22:10:16 +010066fi
67
Jan Kundrátb41f0082021-03-09 22:20:35 +010068if [[ ${YANG_INLINE} == 1 ]]; then
Tomáš Peckad3861ce2022-05-11 11:51:30 +020069 sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-inline-amp@2021-03-05.yang --permissions 0660
Jan Kundrát2f100fc2020-11-02 22:10:16 +010070fi
71
Jan Kundrátb41f0082021-03-09 22:20:35 +010072if [[ ${YANG_CALIBRATION} == 1 ]]; then
Tomáš Peckad3861ce2022-05-11 11:51:30 +020073 sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-calibration-device@2019-06-25.yang --permissions 0660
Jan Kundrát2f100fc2020-11-02 22:10:16 +010074fi
75
Tomáš Peckad3861ce2022-05-11 11:51:30 +020076sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-system@2014-08-06.yang --permissions 0660
Tomáš Pecka01df8482021-01-13 18:04:19 +010077
Tomáš Peckad3861ce2022-05-11 11:51:30 +020078sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/czechlight-lldp@2020-11-04.yang --permissions 0660
Jan Kundrát2f100fc2020-11-02 22:10:16 +010079
Jan Kundrátd2eecf52022-07-13 18:15:12 +020080sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/czechlight-system@2022-07-08.yang --permissions 0660
Tomáš Pecka25aae682021-01-27 14:45:57 +010081
Tomáš Pecka5a030092021-04-14 00:36:40 +020082sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/iana-if-type@2017-01-19.yang
Tomáš Peckad3861ce2022-05-11 11:51:30 +020083sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-interfaces@2018-02-20.yang --permissions 0660
84sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-ip@2018-02-22.yang --permissions 0660
85sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-routing@2018-03-13.yang --permissions 0660
86sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-ipv4-unicast-routing@2018-03-13.yang --permissions 0660
87sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-ipv6-unicast-routing@2018-03-13.yang --permissions 0660
88sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/czechlight-network@2021-02-22.yang --permissions 0660
Tomáš Pecka5a030092021-04-14 00:36:40 +020089
Tomáš Peckad3861ce2022-05-11 11:51:30 +020090sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/czechlight-firewall@2021-01-25.yang --permissions 0600
Jan Kundrát8ee8b3b2022-02-17 19:03:14 +010091sysrepoctl --change ietf-access-control-list --enable-feature match-on-eth --enable-feature eth --enable-feature match-on-ipv4 --enable-feature ipv4 --enable-feature match-on-ipv6 --enable-feature ipv6 --enable-feature mixed-eth-ipv4-ipv6