blob: 9132c85603162991a80d549ffdb2dab858dcb726 [file] [log] [blame]
Matteo Scandolob4c5f4e2020-11-11 12:05:23 -08001---
2
3# Copyright 2020-present Open Networking Foundation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16apiVersion: v1
17kind: ConfigMap
18metadata:
19 name: {{ .Release.Name }}-onos-configs-loader
20data:
21 loader.sh: >
22 set -euo pipefail
23
24 echo -e "Loading netcfg into ONOS\n";
25 curl --fail -sSL --user {{ .Values.onos.username }}:{{ .Values.onos.password }} -X POST "http://{{ .Release.Name }}-onos-classic-hs:8181/onos/v1/network/configuration/" -H Content-type:application/json -d @/opt/configs/netcfg.json;
26
27 echo -e "Loading component configs into ONOS\n";
28 CFGS=$(ls /opt/configs | grep -v netcfg.json);
29 for CFG in ${CFGS};
30 do
31 echo -e "Loading $CFG config"
32 curl --fail -sSL --user {{ .Values.onos.username }}:{{ .Values.onos.password }} -X POST "http://{{ .Release.Name }}-onos-classic-hs:8181/onos/v1/configuration/$CFG" -H Content-type:application/json -d @/opt/configs/$CFG;
33 done