Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -ex |
| 4 | |
Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 5 | YANG_ROADM=0 |
| 6 | YANG_COHERENT=0 |
| 7 | YANG_INLINE=0 |
| 8 | YANG_CALIBRATION=0 |
| 9 | |
Jan Kundrát | 9b2aab8 | 2021-04-14 01:14:44 +0200 | [diff] [blame] | 10 | CLA_YANG=/usr/share/cla-sysrepo/yang |
| 11 | VELIA_YANG=/usr/share/velia/yang |
Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 12 | REPO=/etc/sysrepo/yang |
| 13 | |
| 14 | for ARG in $(cat /proc/cmdline); do |
| 15 | case "${ARG}" in |
| 16 | czechlight=*) |
| 17 | CZECHLIGHT="${ARG:11}" |
| 18 | ;; |
| 19 | esac |
| 20 | done |
| 21 | |
Jan Kundrát | 811c0b0 | 2021-02-05 19:16:43 +0100 | [diff] [blame] | 22 | INITIAL_DATA=${CZECHLIGHT%%-g2} |
| 23 | |
Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 24 | case "${CZECHLIGHT}" in |
Jan Kundrát | 811c0b0 | 2021-02-05 19:16:43 +0100 | [diff] [blame] | 25 | sdn-roadm-line*) |
Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 26 | YANG_ROADM=1 |
| 27 | WITH_FEATURE=hw-line-9 |
Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 28 | ;; |
Jan Kundrát | 811c0b0 | 2021-02-05 19:16:43 +0100 | [diff] [blame] | 29 | sdn-roadm-add-drop*) |
Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 30 | YANG_ROADM=1 |
| 31 | WITH_FEATURE=hw-add-drop-20 |
Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 32 | ;; |
Jan Kundrát | 811c0b0 | 2021-02-05 19:16:43 +0100 | [diff] [blame] | 33 | sdn-roadm-hires-add-drop*) |
| 34 | YANG_ROADM=1 |
| 35 | WITH_FEATURE=hw-add-drop-20 |
Jan Kundrát | 811c0b0 | 2021-02-05 19:16:43 +0100 | [diff] [blame] | 36 | INITIAL_DATA=sdn-roadm-add-drop |
| 37 | ;; |
| 38 | sdn-roadm-coherent-a-d*) |
Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 39 | YANG_COHERENT=1 |
| 40 | ;; |
Jan Kundrát | 811c0b0 | 2021-02-05 19:16:43 +0100 | [diff] [blame] | 41 | sdn-inline*) |
Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 42 | YANG_INLINE=1 |
| 43 | ;; |
| 44 | calibration-box) |
| 45 | YANG_CALIBRATION=1 |
| 46 | ;; |
| 47 | esac |
| 48 | |
Jan Kundrát | 9b2aab8 | 2021-04-14 01:14:44 +0200 | [diff] [blame] | 49 | sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/iana-hardware@2018-03-13.yang |
| 50 | sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/ietf-hardware@2018-03-13.yang |
Jan Kundrát | b41f008 | 2021-03-09 22:20:35 +0100 | [diff] [blame] | 51 | sysrepoctl --change ietf-hardware --permissions 0664 --enable-feature hardware-sensor --apply |
Tomáš Pecka | c34a545 | 2020-12-16 21:29:09 +0100 | [diff] [blame] | 52 | |
Jan Kundrát | b41f008 | 2021-03-09 22:20:35 +0100 | [diff] [blame] | 53 | if [[ ${YANG_ROADM} == 1 ]]; then |
Jan Kundrát | 9b2aab8 | 2021-04-14 01:14:44 +0200 | [diff] [blame] | 54 | sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-roadm-device@2021-03-05.yang |
Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 55 | sysrepoctl --change czechlight-roadm-device --group optics --permissions 0664 --apply |
| 56 | if [[ ${WITH_FEATURE} ]]; then |
| 57 | sysrepoctl --change czechlight-roadm-device --enable-feature ${WITH_FEATURE} |
| 58 | fi |
Jan Kundrát | 9b2aab8 | 2021-04-14 01:14:44 +0200 | [diff] [blame] | 59 | sysrepocfg --datastore=startup --format=json --module=czechlight-roadm-device --import="${CLA_YANG}/${INITIAL_DATA}.json" |
Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 60 | fi |
| 61 | |
Jan Kundrát | b41f008 | 2021-03-09 22:20:35 +0100 | [diff] [blame] | 62 | if [[ ${YANG_COHERENT} == 1 ]]; then |
Jan Kundrát | 9b2aab8 | 2021-04-14 01:14:44 +0200 | [diff] [blame] | 63 | sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-coherent-add-drop@2021-03-05.yang |
| 64 | sysrepocfg --datastore=startup --format=json --module=czechlight-coherent-add-drop --new-data="${CLA_YANG}/${INITIAL_DATA}.json" |
Jan Kundrát | 00876bd | 2021-01-29 19:51:59 +0100 | [diff] [blame] | 65 | sysrepoctl --change czechlight-coherent-add-drop --group optics --permissions 0664 --apply |
Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 66 | fi |
| 67 | |
Jan Kundrát | b41f008 | 2021-03-09 22:20:35 +0100 | [diff] [blame] | 68 | if [[ ${YANG_INLINE} == 1 ]]; then |
Jan Kundrát | 9b2aab8 | 2021-04-14 01:14:44 +0200 | [diff] [blame] | 69 | sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-inline-amp@2021-03-05.yang |
| 70 | sysrepocfg --datastore=startup --format=json --module=czechlight-inline-amp --import="${CLA_YANG}/${INITIAL_DATA}.json" |
Jan Kundrát | 00876bd | 2021-01-29 19:51:59 +0100 | [diff] [blame] | 71 | sysrepoctl --change czechlight-inline-amp --group optics --permissions 0664 --apply |
Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 72 | fi |
| 73 | |
Jan Kundrát | b41f008 | 2021-03-09 22:20:35 +0100 | [diff] [blame] | 74 | if [[ ${YANG_CALIBRATION} == 1 ]]; then |
Jan Kundrát | 9b2aab8 | 2021-04-14 01:14:44 +0200 | [diff] [blame] | 75 | sysrepoctl --search-dirs ${CLA_YANG} --install ${CLA_YANG}/czechlight-calibration-device@2019-06-25.yang |
| 76 | sysrepocfg --datastore=startup --format=json --module=czechlight-calibration-device --import="${CLA_YANG}/${INITIAL_DATA}.json" |
Jan Kundrát | 00876bd | 2021-01-29 19:51:59 +0100 | [diff] [blame] | 77 | sysrepoctl --change czechlight-calibration-device --group optics --permissions 0664 --apply |
Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 78 | fi |
| 79 | |
Jan Kundrát | 9b2aab8 | 2021-04-14 01:14:44 +0200 | [diff] [blame] | 80 | sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/ietf-system@2014-08-06.yang |
Jan Kundrát | b41f008 | 2021-03-09 22:20:35 +0100 | [diff] [blame] | 81 | sysrepoctl --change ietf-system --permissions 0664 --apply |
Tomáš Pecka | 01df848 | 2021-01-13 18:04:19 +0100 | [diff] [blame] | 82 | |
Jan Kundrát | b41f008 | 2021-03-09 22:20:35 +0100 | [diff] [blame] | 83 | sysrepoctl --search-dirs /usr/share/lldp-systemd-networkd-sysrepo/yang --install /usr/share/lldp-systemd-networkd-sysrepo/yang/czechlight-lldp@2020-11-04.yang |
| 84 | sysrepoctl --change czechlight-lldp --permissions 0664 --apply |
Jan Kundrát | 2f100fc | 2020-11-02 22:10:16 +0100 | [diff] [blame] | 85 | |
Jan Kundrát | 9b2aab8 | 2021-04-14 01:14:44 +0200 | [diff] [blame] | 86 | sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/czechlight-system@2021-01-13.yang |
Jan Kundrát | b41f008 | 2021-03-09 22:20:35 +0100 | [diff] [blame] | 87 | sysrepoctl --change czechlight-system --permissions 0664 --apply |
Tomáš Pecka | 25aae68 | 2021-01-27 14:45:57 +0100 | [diff] [blame] | 88 | |
Jan Kundrát | 9b2aab8 | 2021-04-14 01:14:44 +0200 | [diff] [blame] | 89 | sysrepoctl --search-dirs ${VELIA_YANG} --install ${VELIA_YANG}/czechlight-firewall@2021-01-25.yang |
Jan Kundrát | b41f008 | 2021-03-09 22:20:35 +0100 | [diff] [blame] | 90 | sysrepoctl --change czechlight-firewall --permissions 0600 --apply |
| 91 | sysrepoctl --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át | 22e240c | 2021-02-04 10:14:19 +0100 | [diff] [blame] | 92 | |
Jan Kundrát | 34d2f48 | 2021-01-11 19:24:09 +0100 | [diff] [blame] | 93 | # If not do not copy here from startup -> running, running might be stale. |
| 94 | sysrepocfg -C startup |