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