blob: 25c6d0a1884b294b44cae857516b82658f86cfac [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
Matteo Scandolodf2ac532021-02-05 14:05:41 -080031 echo -e "Check that component $CFG is active";
32 until curl --fail -sSL --user {{ .Values.onos.username }}:{{ .Values.onos.password }} -X GET "http://{{ .Release.Name }}-onos-classic-hs:8181/onos/v1/configuration/$CFG";
33 do
34 echo -e "Waiting for $CFG to be active";
35 sleep 5;
36 done
37 echo -e "Loading $CFG config";
Matteo Scandolob4c5f4e2020-11-11 12:05:23 -080038 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;
39 done