Add key injection support to tosca.nodes.nfv.VDU.Tacker

Implement the 'key_name' parameter in templates by adding the new property
to tacker_nfv_defs.yaml.

Change-Id: I1838b283a60c387a7cb92e6c8ebebe7ca8ac5141
Closes-Bug: #1578785
This commit is contained in:
Tin Lam 2016-06-06 18:50:04 -05:00
parent a871931bb6
commit 02e42be35b
9 changed files with 60 additions and 1 deletions

View File

@ -0,0 +1,4 @@
---
features:
- Added support for key_name in TOSCA template for type
tosca.nodes.nfv.VDU.Tacker.

View File

@ -0,0 +1,37 @@
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: Demo example with key_name
metadata:
template_name: sample-tosca-vnfd-keyname
topology_template:
node_templates:
VDU1:
type: tosca.nodes.nfv.VDU.Tacker
properties:
image: cirros-0.3.4-x86_64-uec
flavor: m1.tiny
availability_zone: nova
mgmt_driver: noop
key_name: userKey
config: |
param0: key1
param1: key2
CP1:
type: tosca.nodes.nfv.CP.Tacker
properties:
management: true
anti_spoofing_protection: false
requirements:
- virtualLink:
node: VL1
- virtualBinding:
node: VDU1
VL1:
type: tosca.nodes.nfv.VL
properties:
network_name: net1
vendor: Tacker

View File

@ -59,6 +59,14 @@ function fixup_nova_quota {
nova quota-class-update --instances -1 --cores -1 default
}
# Adding nova keypair to support key_name (#1578785).
function add_key {
echo "Adding nova key"
source $DEVSTACK_DIR/openrc admin admin
userId=$(openstack user list | awk '/\ nfv_user\ / {print $2}')
nova keypair-add userKey --user $userId > keypair.priv
}
if [[ "$venv" == dsvm-functional* ]]
then
owner=stack
@ -66,6 +74,7 @@ then
log_dir="/tmp/${venv}-logs"
fixup_nova_quota
add_key
fi
# Set owner permissions according to job's requirements.

View File

@ -12,6 +12,7 @@ topology_template:
properties:
image: cirros-0.3.4-x86_64-uec
flavor: m1.tiny
key_name: userKey
availability_zone: nova
mgmt_driver: noop
config: |

View File

@ -12,6 +12,7 @@ resources:
config_drive: true
flavor: m1.tiny
image: cirros-0.3.4-x86_64-uec
key_name: keyName
metadata: {param0: key0, param1: key1}
networks:
- port: {get_resource: vdu1-net_mgmt-port}

View File

@ -10,6 +10,7 @@ vdus:
management: True
network: net_mgmt
user_data_format: RAW
key_name: keyName
user_data: |
#!/bin/sh
echo "my hostname is `hostname`" > /tmp/hostname

View File

@ -18,6 +18,7 @@ vdus:
mgmt_driver: noop
user_data: {get_input: user_data}
user_data_format: {get_input: user_data_format}
key_name: {get_input: key_name}
network_interfaces:
management:

View File

@ -359,6 +359,8 @@ class DeviceHeat(abstract_driver.DeviceAbstractDriver):
metadata.update(vdu_dict['config'])
for key, value in metadata.items():
metadata[key] = value[:255]
if 'key_name' in vdu_dict:
properties['key_name'] = vdu_dict['key_name']
monitoring_policy = vdu_dict.get('monitoring_policy',
'noop')

View File

@ -57,6 +57,9 @@ node_types:
type: string
required: false
key_name:
type: string
required: false
tosca.nodes.nfv.CP.Tacker:
derived_from: tosca.nodes.nfv.CP