| aguilard | 8c0a054 | 2023-11-13 13:16:32 +0000 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | ####################################################################################### |
| 3 | # Copyright ETSI Contributors and Others. |
| 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 |
| 14 | # implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | ####################################################################################### |
| 18 | |
| 19 | # Add VIM to OSM |
| 20 | if [ "${CLOUD_TYPE}" == "azure" ]; then |
| 21 | echo "Adding VIM to OSM" |
| 22 | set +x |
| 23 | osm vim-create --name "$VIM_TARGET" --account_type "$CLOUD_TYPE" --auth_url http://www.azure.com \ |
| 24 | --user "$AZURE_CLIENT_ID" --password "$AZURE_SECRET" --tenant "$AZURE_TENANT" --description "None" \ |
| 25 | --config "{region_name: '$AZURE_REGION', resource_group: '$RESOURCE_GROUP', |
| 26 | subscription_id: '$AZURE_SUBSCRIPTION_ID', vnet_name: '$VNET_NAME', |
| 27 | flavors_pattern: '$AZURE_FLAVORS_PATTERN'}" |
| 28 | sleep 10 |
| 29 | osm vim-show "$VIM_TARGET" |
| 30 | elif [ "${CLOUD_TYPE}" == "gcp" ]; then |
| 31 | echo "CLOUD_TYPE '${CLOUD_TYPE}' still not supported" |
| 32 | exit |
| 33 | else |
| 34 | echo "CLOUD_TYPE '${CLOUD_TYPE}' not valid" |
| 35 | exit |
| 36 | fi |
| 37 | |
| 38 | # Add SDN controller to OSM |
| 39 | if [ -n "$SDNC_TYPE" ] && [ -n "$SDNC_USER" ] && [ -n "$SDNC_URL" ]; then |
| 40 | echo "Adding $SDNC_TYPE SDN controller to OSM" |
| 41 | set +x |
| 42 | osm sdnc-create --name sdnc --user "$SDNC_USER" --password "$SDNC_PASSWORD" --url "$SDNC_URL" --type "$SDNC_TYPE" |
| 43 | sleep 3 |
| 44 | osm sdnc-list |
| 45 | # TO-DO: add port-mapping file to VIM |
| 46 | # osm vim-update "$VIM_TARGET" --sdn_controller sdnc --sdn_port_mapping port-mapping-etsi-vim.yaml |
| 47 | fi |
| 48 | |
| 49 | # Add K8s cluster to OSM |
| 50 | if [ -n "$K8S_CREDENTIALS" ] && [ -n "$VIM_TARGET" ] && [ -n "$K8S_IMAGE_NAME" ]; then |
| 51 | echo "Adding K8s cluster to OSM" |
| 52 | osm k8scluster-add --creds $K8S_CREDENTIALS --version v1 --vim $VIM_TARGET \ |
| 53 | --k8s-nets "{'net1': '$VIM_MGMT_NET'}" $K8S_IMAGE_NAME --description "Robot cluster" |
| 54 | sleep 20 |
| 55 | osm k8scluster-show $K8S_IMAGE_NAME |
| 56 | fi |