-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0 | ||
|
||
description: Demo example | ||
|
||
metadata: | ||
template_name: sample-tosca-vnfd | ||
|
||
topology_template: | ||
inputs: | ||
image_name: | ||
type: string | ||
description: image name | ||
|
||
mem_size: | ||
type: string | ||
description: mem size | ||
|
||
disk_size: | ||
type: string | ||
description: disk size | ||
|
||
num_cpu: | ||
type: integer | ||
description: cpu num | ||
|
||
|
||
node_templates: | ||
VDU1: | ||
type: tosca.nodes.nfv.VDU.Tacker | ||
capabilities: | ||
nfv_compute: | ||
properties: | ||
num_cpus: { get_input: num_cpu} | ||
mem_size: { get_input: mem_size} | ||
disk_size: { get_input: disk_size} | ||
properties: | ||
image: { get_input: image_name} | ||
availability_zone: nova | ||
mgmt_driver: noop | ||
config: | | ||
param0: key1 | ||
param1: key2 | ||
user_data_format: RAW | ||
user_data: | | ||
#!/bin/sh | ||
echo "ubuntu" | sudo -S echo "my hostname is hi" > /home/ubuntu/1.txt | ||
echo "127.0.0.1 `hostname`"|sudo tee -a /etc/hosts | ||
echo "ubuntu" | sudo -S route add default gw 10.0.0.1 dev ens4 | ||
echo "echo \"ubuntu\" | sudo -S route add default gw 10.0.0.1 dev ens4"|sudo tee -a /home/ubuntu/.bashrc | ||
echo "ubuntu" | sudo -S echo "Done" > /home/ubuntu/2.txt | ||
|
||
CP1: | ||
type: tosca.nodes.nfv.CP.Tacker | ||
properties: | ||
management: true | ||
order: 0 | ||
anti_spoofing_protection: false | ||
requirements: | ||
- virtualLink: | ||
node: VL1 | ||
- virtualBinding: | ||
node: VDU1 | ||
CP2: | ||
type: tosca.nodes.nfv.CP.Tacker | ||
properties: | ||
management: true | ||
order: 1 | ||
anti_spoofing_protection: false | ||
requirements: | ||
- virtualLink: | ||
node: VL2 | ||
- virtualBinding: | ||
node: VDU1 | ||
VL1: | ||
type: tosca.nodes.nfv.VL | ||
properties: | ||
network_name: net_mgmt | ||
vendor: Tacker | ||
VL2: | ||
type: tosca.nodes.nfv.VL | ||
properties: | ||
network_name: private | ||
vendor: Tacker | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
|
||
VNFNAME=$1 | ||
VNFDNAME=$1"VNFD" | ||
VNFDFILE=$1"-vnfd.yaml" | ||
echo 3:$3 4:$4 5:$5 6:$6 | ||
if [ "${2}" == "ssh" ] ; then | ||
sudo cp ubuntu1604-vnfd.yaml $VNFDFILE | ||
#sudo cp para-ubuntu-vnfd.yaml $VNFDFILE | ||
#sudo ./config_generate.sh ubuntu1604 '1024 MB' '5 GB' 1 | ||
elif [ "${2}" == "nmap" ] ; then | ||
#sudo cp custom-vnfd.yaml $VNFDFILE | ||
sudo cp para-ubuntu-vnfd.yaml $VNFDFILE | ||
sudo ./config_generate.sh ubuntu1604 '2048 MB' '5 GB' 1 | ||
elif [ "${2}" == "proxy" ] ; then | ||
#sudo cp proxy-vnfd.yaml $VNFDFILE | ||
sudo cp para-ubuntu-vnfd.yaml $VNFDFILE | ||
sudo ./config_generate.sh ubuntu1604python '2048 MB' '5 GB' 1 | ||
elif [ "${2}" == "epc" ] ; then | ||
#sudo cp epc-vnfd.yaml $VNFDFILE | ||
sudo cp para-ubuntu-vnfd.yaml $VNFDFILE | ||
sudo ./config_generate.sh ubuntu '2048 MB' '10 GB' 1 | ||
elif [ "${2}" == "nextepc" ] ; then | ||
#sudo cp para-ubuntu-vnfd.yaml $VNFDFILE | ||
sed '/ user_data: |/r install_basic.txt' para-ubuntu-vnfd.yaml|sudo tee $VNFDFILE | ||
sudo ./config_generate.sh next-epc '2048 MB' '5 GB' 1 | ||
elif [ "${2}" == "config" ] ; then | ||
sed '/ user_data: |/r install_basic.txt' para-ubuntu-vnfd.yaml|sudo tee $VNFDFILE | ||
sudo ./config_generate.sh "${3}" "${4}" "${5}" "${6}" | ||
elif [ "${2}" == "config3" ] ; then | ||
sed '/ user_data: |/r install_basic.txt' para-ubuntu-vnfd3.yaml|sudo tee $VNFDFILE | ||
sudo ./config_generate.sh "${3}" "${4}" "${5}" "${6}" | ||
|
||
else | ||
sudo cp ubuntu1604-vnfd.yaml $VNFDFILE | ||
fi | ||
|
||
|
||
echo $VNFNAME" "$VNFDNAME" "$VNFDFILE | ||
tacker vnfd-create --vnfd-file $VNFDFILE $VNFDNAME | ||
sleep 1 | ||
tacker vnf-create --vnfd-name $VNFDNAME --vim-name Site --param-file config.yaml $VNFNAME | ||
SERVERSTATUS=`openstack server list|grep $VNFNAME| awk '{print $6}'` | ||
until [ "${VNFSTATUS}" == "ACTIVE" ] | ||
do | ||
sleep 5 | ||
echo "wait for create" | ||
VNFSTATUS=`tacker vnf-list|grep $VNFNAME|awk '{print $9}'` | ||
if [ "${VNFSTATUS}" == "ERROR" ] ; then | ||
break; | ||
fi | ||
done | ||
echo "VNFNAME is "$VNFNAME" "$1 | ||
#VNFNAME=test9 | ||
VNFIP=`tacker vnf-list|grep $VNFNAME|awk '{print $7}'|sed 's/}//g'|sed 's/"//g'` | ||
SERVERID=`openstack server list|grep $VNFIP| awk '{print $2}'` | ||
echo "create OK" | ||
echo "server id is "$SERVERID | ||
|
||
VNFMNGIP=`openstack server list|grep $VNFIP| awk '{print $10}'|sed 's/net_mgmt=//g'` | ||
echo "vnf access ip is "$VNFMNGIP | ||
openstack console url show $SERVERID | ||
|
||
|
||
# | ||
#SERVERSTATUS=`openstack server list|grep ubuntu1604| awk '{print $6}'` | ||
|
||
|
||
|
||
|
||
|
||
#openstack server list | ||
#openstack console url show $SERVERID | ||
#if [ "${SERVERSTATUS}" == "ACTIVE" ] ; then | ||
# echo "create VNF done...." | ||
# exit 1 | ||
#fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
tenant_id: tenant1 | ||
service_name: tenant1_embb_streaming_1 | ||
network_type: lte | ||
network: tenant1_embb_1 | ||
service: streaming | ||
application: vlc | ||
image: lte-vlc | ||
traffic_at_cloud: 30 | ||
traffic_at_edge: 70 | ||
num_cpu: 2 | ||
mem_size: 4096 | ||
disk_size: 10240 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
tenant_id:tenant1 | ||
service_name: tenant1_embb_streaming_1 | ||
network_type: lte | ||
sst: embb | ||
slice_id: tenant1_embb_1 | ||
service: streaming | ||
required_latency: 10 | ||
connections: 100 |