diff options
Diffstat (limited to 'tests/onap-demo/blueprints/tosca-vnfd-onap-demo/blueprint.yaml')
-rw-r--r-- | tests/onap-demo/blueprints/tosca-vnfd-onap-demo/blueprint.yaml | 292 |
1 files changed, 292 insertions, 0 deletions
diff --git a/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/blueprint.yaml b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/blueprint.yaml new file mode 100644 index 0000000..6d9abf9 --- /dev/null +++ b/tests/onap-demo/blueprints/tosca-vnfd-onap-demo/blueprint.yaml @@ -0,0 +1,292 @@ +tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0 + +description: Hello VES ONAP + +metadata: + template_name: tosca-vnfd-onap-demo + +topology_template: + node_templates: + VDU1: + type: tosca.nodes.nfv.VDU.Tacker + properties: + image: models-xenial-server + flavor: onap.demo + availability_zone: nova + config_drive: true + user_data_format: RAW + user_data: | + #!/bin/bash + set -x + mkdir /home/ubuntu + chown -R ubuntu /home/ubuntu + mkdir /home/ubuntu/.ssh + cat << EOM >/home/ubuntu/.ssh/authorized_keys + <pubkey> + EOM + sudo mount /dev/sr0 /mnt/ + mkdir /tmp/www + cd /tmp/www + mkdir html + cat >Dockerfile <<EOM + FROM nginx + COPY html /usr/share/nginx/html + EOM + host=$(hostname) + id=$(cut -d ',' -f 3 /mnt/openstack/latest/meta_data.json) + cat <<EOM >html/index.html + <!DOCTYPE html> + <html> + <head> + <title>Hello World!</title> + <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1"/> + <style> + body { width: 100%; background-color: white; color: black; padding: 0px; margin: 0px; font-family: sans-serif; font-size:100%; } + </style> + </head> + <body> + <large>Welcome to OPNFV @ $host!</large><br/> + <a href="http://wiki.opnfv.org"><img src="https://www.opnfv.org/sites/all/themes/opnfv/logo.png"></a> + <div> + <p>Instance ID fom config drive file /mnt/openstack/latest/meta_data.json></p> + <pre> + $id + </pre> + <p>Server setup completed at $(date)</p> + </div> + </body></html> + EOM + wget -O /tmp/www/html/favicon.ico https://git.opnfv.org/models/plain/tests/blueprints/tosca-vnfd-3node-tacker/favicon.ico + sudo apt-get install apt-transport-https ca-certificates curl software-properties-common + curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add - + sudo apt-key update + echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" >~/dockerrepo + sudo tee -a /etc/apt/sources.list.d/docker.list ~/dockerrepo + sudo add-apt-repository "deb https://apt.dockerproject.org/repo/ ubuntu-xenial main" + sudo apt-get update + sudo apt-get install -y docker-engine + sudo docker pull nginx + sudo docker build -t vhello . + sudo docker run --name vHello -d -p 80:80 vhello + config: | + param0: key1 + param1: key2 + + CP11: + type: tosca.nodes.nfv.CP.Tacker + properties: + management: true + anti_spoofing_protection: false + requirements: + - virtualLink: + node: VL1 + - virtualBinding: + node: VDU1 + + CP12: + type: tosca.nodes.nfv.CP.Tacker + properties: + anti_spoofing_protection: false + requirements: + - virtualLink: + node: VL2 + - virtualBinding: + node: VDU1 + + VDU2: + type: tosca.nodes.nfv.VDU.Tacker + properties: + image: models-xenial-server + flavor: onap.demo + availability_zone: nova + config_drive: true + user_data_format: RAW + user_data: | + #!/bin/bash + set -x + mkdir /home/ubuntu + chown -R ubuntu /home/ubuntu + mkdir /home/ubuntu/.ssh + cat << EOM >/home/ubuntu/.ssh/authorized_keys + <pubkey> + EOM + sudo mount /dev/sr0 /mnt/ + mkdir /tmp/www + cd /tmp/www + mkdir html + cat >Dockerfile <<EOM + FROM nginx + COPY html /usr/share/nginx/html + EOM + host=$(hostname) + id=$(cut -d ',' -f 3 /mnt/openstack/latest/meta_data.json) + cat <<EOM >html/index.html + <!DOCTYPE html> + <html> + <head> + <title>Hello World!</title> + <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1"/> + <style> + body { width: 100%; background-color: white; color: black; padding: 0px; margin: 0px; font-family: sans-serif; font-size:100%; } + </style> + </head> + <body> + <large>Welcome to OPNFV @ $host!</large><br/> + <a href="http://wiki.opnfv.org"><img src="https://www.opnfv.org/sites/all/themes/opnfv/logo.png"></a> + <div> + <p>Instance ID fom config drive file /mnt/openstack/latest/meta_data.json></p> + <pre> + $id + </pre> + <p>Server setup completed at $(date)</p> + </div> + </body></html> + EOM + wget -O /tmp/www/html/favicon.ico https://git.opnfv.org/models/plain/tests/blueprints/tosca-vnfd-3node-tacker/favicon.ico + sudo apt-get install apt-transport-https ca-certificates curl software-properties-common + curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add - + sudo apt-key update + echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" >~/dockerrepo + sudo tee -a /etc/apt/sources.list.d/docker.list ~/dockerrepo + sudo add-apt-repository "deb https://apt.dockerproject.org/repo/ ubuntu-xenial main" + sudo apt-get update + sudo apt-get install -y docker-engine + sudo docker pull nginx + sudo docker build -t vhello . + sudo docker run --name vHello -d -p 80:80 vhello + config: | + param0: key1 + param1: key2 + + CP21: + type: tosca.nodes.nfv.CP.Tacker + properties: + management: true + anti_spoofing_protection: false + requirements: + - virtualLink: + node: VL1 + - virtualBinding: + node: VDU2 + + CP22: + type: tosca.nodes.nfv.CP.Tacker + properties: + anti_spoofing_protection: false + requirements: + - virtualLink: + node: VL2 + - virtualBinding: + node: VDU2 + + VDU3: + type: tosca.nodes.nfv.VDU.Tacker + properties: + image: models-xenial-server + flavor: onap.demo + availability_zone: nova + config_drive: true + user_data_format: RAW + user_data: | + #!/bin/bash + set -x + mkdir /home/ubuntu + chown -R ubuntu /home/ubuntu + mkdir /home/ubuntu/.ssh + cat << EOM >/home/ubuntu/.ssh/authorized_keys + <pubkey> + EOM + sudo mount /dev/sr0 /mnt/ + cat << EOF >/tmp/setup.sh + echo "1" | sudo tee /proc/sys/net/ipv4/ip_forward + sudo sysctl net.ipv4.ip_forward=1 + sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -m state \\ + --state NEW -m statistic --mode nth --every 2 --packet 0 \\ + -j DNAT --to-destination <vdu1_ip>:80 + sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -m state \\ + --state NEW -m statistic --mode nth --every 2 --packet 0 \\ + -j DNAT --to-destination <vdu2_ip>:80 + sudo iptables -t nat -A POSTROUTING -j MASQUERADE + EOF + bash /tmp/setup.sh + config: | + param0: key1 + param1: key2 + + config: | + param0: key1 + param1: key2 + + CP31: + type: tosca.nodes.nfv.CP.Tacker + properties: + management: true + anti_spoofing_protection: false + requirements: + - virtualLink: + node: VL1 + - virtualBinding: + node: VDU3 + + CP32: + type: tosca.nodes.nfv.CP.Tacker + properties: + anti_spoofing_protection: false + requirements: + - virtualLink: + node: VL2 + - virtualBinding: + node: VDU3 + + VDU4: + type: tosca.nodes.nfv.VDU.Tacker + properties: + image: models-xenial-server + flavor: onap.demo + availability_zone: nova + user_data_format: RAW + user_data: | + #!/bin/bash + set -x + mkdir /home/ubuntu + chown -R ubuntu /home/ubuntu + mkdir /home/ubuntu/.ssh + cat << EOM >/home/ubuntu/.ssh/authorized_keys + <pubkey> + EOM + config: | + param0: key1 + param1: key2 + + CP41: + type: tosca.nodes.nfv.CP.Tacker + properties: + management: true + anti_spoofing_protection: false + requirements: + - virtualLink: + node: VL1 + - virtualBinding: + node: VDU4 + + CP42: + type: tosca.nodes.nfv.CP.Tacker + properties: + anti_spoofing_protection: false + requirements: + - virtualLink: + node: VL2 + - virtualBinding: + node: VDU4 + + VL1: + type: tosca.nodes.nfv.VL + properties: + network_name: vnf_mgmt + vendor: Tacker + + VL2: + type: tosca.nodes.nfv.VL + properties: + network_name: vnf_private + vendor: Tacker |