kolla-ansible/contrib/demos/tacker/deploy-tacker-demo
Nguyen Hai c752d66a1c Update tacker CLI to openstack CLI in tacker demo
- Change to openstack CLI
- Change the way to run demo from "sh" to "./" for
matching with README.rst in tacker demo folder.

Change-Id: I17b755cd8d52f594785ef13634bfa233e63841a7
2018-07-24 07:02:48 +00:00

74 lines
1.9 KiB
Bash

#!/bin/bash
function gen_config {
echo "Generating sample config"
DEMO_NET=$(openstack network list | awk '/demo-net/ { print $2 }')
IMAGE_ID=$(openstack image list | awk '/cirros/ { print $2 }')
cat > ./kolla-sample-vim.yaml <<EOF
auth_url: ${OS_AUTH_URL}
username: ${OS_USERNAME}
password: ${OS_PASSWORD}
project_name: ${OS_PROJECT_NAME}
project_domain_name: ${OS_PROJECT_DOMAIN_NAME}
user_domain_name: ${OS_USER_DOMAIN_NAME}
EOF
cat > ./kolla-sample-vnfd.yaml <<EOF
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: Demo example
metadata:
template_name: sample-tosca-vnfd
topology_template:
node_templates:
VDU1:
type: tosca.nodes.nfv.VDU.Tacker
capabilities:
nfv_compute:
properties:
num_cpus: 1
mem_size: 512 MB
disk_size: 0 GB
properties:
image: ${IMAGE_ID}
availability_zone: nova
mgmt_driver: noop
user_data_format: RAW
user_data: |
#!/bin/sh
echo 1 > /proc/sys/net/ipv4/ip_forward
CP11:
type: tosca.nodes.nfv.CP.Tacker
properties:
management: true
order: 0
anti_spoofing_protection: false
requirements:
- virtualLink:
node: VL1
- virtualBinding:
node: VDU1
VL1:
type: tosca.nodes.nfv.VL
properties:
network_name: ${DEMO_NET}
vendor: Tacker
EOF
}
function deploy {
echo "Registering sample VIM"
openstack vim register --config-file ./kolla-sample-vim.yaml --description "kolla sample vim" --is-default kolla-sample-vim
echo "Creating sample VNFD"
openstack vnf descriptor create --vnfd-file ./kolla-sample-vnfd.yaml kolla-sample-vnfd
echo "Creating sample VNF"
VNFD_ID=$(openstack vnf descriptor list | awk '/kolla-sample-vnfd/ { print $2 }')
openstack vnf create --vnfd-id ${VNFD_ID} kolla-sample-vnf
}
gen_config
deploy