blob: ccd0e3d62f97d1b3115e3f278beaff995b811abd [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
Jan Kundrát9b2aab82021-04-14 01:14:44 +020010CLA_YANG=/usr/share/cla-sysrepo/yang
11VELIA_YANG=/usr/share/velia/yang
Jan Kundrát2f100fc2020-11-02 22:10:16 +010012REPO=/etc/sysrepo/yang
13
14for ARG in $(cat /proc/cmdline); do
15 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
Jan Kundrátb41f0082021-03-09 22:20:35 +010051sysrepoctl --change ietf-hardware --permissions 0664 --enable-feature hardware-sensor --apply
Tomáš Peckac34a5452020-12-16 21:29:09 +010052
Jan Kundrátb41f0082021-03-09 22:20:35 +010053if [[ ${YANG_ROADM} == 1 ]]; then
Jan Kundrát9b2aab82021-04-14 01:14:44 +020054 sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-roadm-device@2021-03-05.yang
Jan Kundrát2f100fc2020-11-02 22:10:16 +010055 sysrepoctl --change czechlight-roadm-device --group optics --permissions 0664 --apply
56 if [[ ${WITH_FEATURE} ]]; then
Jan Kundrát9cccf702021-12-03 11:09:07 +010057 for FEATURE in ${WITH_FEATURE}; do
58 sysrepoctl --change czechlight-roadm-device --enable-feature ${FEATURE}
59 done
Jan Kundrát2f100fc2020-11-02 22:10:16 +010060 fi
Jan Kundrát9b2aab82021-04-14 01:14:44 +020061 sysrepocfg --datastore=startup --format=json --module=czechlight-roadm-device --import="${CLA_YANG}/${INITIAL_DATA}.json"
Jan Kundrát2f100fc2020-11-02 22:10:16 +010062fi
63
Jan Kundrátb41f0082021-03-09 22:20:35 +010064if [[ ${YANG_COHERENT} == 1 ]]; then
Jan Kundrát9b2aab82021-04-14 01:14:44 +020065 sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-coherent-add-drop@2021-03-05.yang
66 sysrepocfg --datastore=startup --format=json --module=czechlight-coherent-add-drop --new-data="${CLA_YANG}/${INITIAL_DATA}.json"
Jan Kundrát00876bd2021-01-29 19:51:59 +010067 sysrepoctl --change czechlight-coherent-add-drop --group optics --permissions 0664 --apply
Jan Kundrát2f100fc2020-11-02 22:10:16 +010068fi
69
Jan Kundrátb41f0082021-03-09 22:20:35 +010070if [[ ${YANG_INLINE} == 1 ]]; then
Jan Kundrát9b2aab82021-04-14 01:14:44 +020071 sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-inline-amp@2021-03-05.yang
72 sysrepocfg --datastore=startup --format=json --module=czechlight-inline-amp --import="${CLA_YANG}/${INITIAL_DATA}.json"
Jan Kundrát00876bd2021-01-29 19:51:59 +010073 sysrepoctl --change czechlight-inline-amp --group optics --permissions 0664 --apply
Jan Kundrát2f100fc2020-11-02 22:10:16 +010074fi
75
Jan Kundrátb41f0082021-03-09 22:20:35 +010076if [[ ${YANG_CALIBRATION} == 1 ]]; then
Jan Kundrát9b2aab82021-04-14 01:14:44 +020077 sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-calibration-device@2019-06-25.yang
78 sysrepocfg --datastore=startup --format=json --module=czechlight-calibration-device --import="${CLA_YANG}/${INITIAL_DATA}.json"
Jan Kundrát00876bd2021-01-29 19:51:59 +010079 sysrepoctl --change czechlight-calibration-device --group optics --permissions 0664 --apply
Jan Kundrát2f100fc2020-11-02 22:10:16 +010080fi
81
Jan Kundrát9b2aab82021-04-14 01:14:44 +020082sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-system@2014-08-06.yang
Jan Kundrátb41f0082021-03-09 22:20:35 +010083sysrepoctl --change ietf-system --permissions 0664 --apply
Tomáš Pecka01df8482021-01-13 18:04:19 +010084
Tomáš Peckaea0e7692021-08-10 11:21:45 +020085sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/czechlight-lldp@2020-11-04.yang
Jan Kundrátb41f0082021-03-09 22:20:35 +010086sysrepoctl --change czechlight-lldp --permissions 0664 --apply
Jan Kundrát2f100fc2020-11-02 22:10:16 +010087
Jan Kundrát9b2aab82021-04-14 01:14:44 +020088sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/czechlight-system@2021-01-13.yang
Jan Kundrátb41f0082021-03-09 22:20:35 +010089sysrepoctl --change czechlight-system --permissions 0664 --apply
Tomáš Pecka25aae682021-01-27 14:45:57 +010090
Jan Kundrát9b2aab82021-04-14 01:14:44 +020091sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/czechlight-firewall@2021-01-25.yang
Jan Kundrátb41f0082021-03-09 22:20:35 +010092sysrepoctl --change czechlight-firewall --permissions 0600 --apply
93sysrepoctl --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 +010094
Tomáš Pecka5a030092021-04-14 00:36:40 +020095sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/iana-if-type@2017-01-19.yang
96sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-interfaces@2018-02-20.yang
97sysrepoctl --change ietf-interfaces --permissions 0664 --apply
98sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-ip@2018-02-22.yang
99sysrepoctl --change ietf-ip --permissions 0664 --apply
100sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-routing@2018-03-13.yang
101sysrepoctl --change ietf-routing --permissions 0664 --apply
102sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-ipv4-unicast-routing@2018-03-13.yang
103sysrepoctl --change ietf-ipv4-unicast-routing --permissions 0664 --apply
104sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-ipv6-unicast-routing@2018-03-13.yang
105sysrepoctl --change ietf-ipv6-unicast-routing --permissions 0664 --apply
106sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/czechlight-network@2021-02-22.yang
107sysrepoctl --change czechlight-network --permissions 0664 --apply
108
Jan Kundrát34d2f482021-01-11 19:24:09 +0100109# If not do not copy here from startup -> running, running might be stale.
110sysrepocfg -C startup