d605efb703a692121256aa6aa6697025232c0600
[it/dep.git] / nonrtric / data / prepare_data.sh
1 #!/bin/bash
2
3 #  ============LICENSE_START===============================================
4 #  Copyright (C) 2020 Nordix Foundation. All rights reserved.
5 #  ========================================================================
6 #  Licensed under the Apache License, Version 2.0 (the "License");
7 #  you may not use this file except in compliance with the License.
8 #  You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 #  Unless required by applicable law or agreed to in writing, software
13 #  distributed under the License is distributed on an "AS IS" BASIS,
14 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 #  See the License for the specific language governing permissions and
16 #  limitations under the License.
17 #  ============LICENSE_END=================================================
18 #
19
20 # This script is populating some data into nonrtric for demo/test purpose.
21 # First this script copies data/ folder into one of the rics, in below case a1-sim-osc-0.
22 # Then from the ric, run populate_policy_data.sh and populate_enrichment_data.sh.
23 # populate_policy_data.sh creates policy-types, service, and policies.
24 # populate_enrichment_data.sh creates EiProducer, EiType, and EiJob.
25 #
26 # Why we run the scripts in the ric, not from the host?
27 # Because a1-simulators(ric) are deployed in statefulset,
28 # they are not exposed to outside the k8s cluster.
29 # And we must create policy type into the ric first.
30 # Similarly, the enrichmentservice is not exposed outside the k8s cluster,
31 # hence the commands for populating enrichment data need to be run from within the cluster.
32
33 kubectl -n nonrtric cp run_in_k8s a1-sim-osc-0:/usr/src/app/
34 kubectl -n nonrtric exec -it a1-sim-osc-0 -- bash -c 'cd run_in_k8s/ && ./populate_policy_data.sh && ./populate_enrichment_data.sh'