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:
parent
a871931bb6
commit
02e42be35b
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- Added support for key_name in TOSCA template for type
|
||||||
|
tosca.nodes.nfv.VDU.Tacker.
|
37
samples/tosca-templates/vnfd/tosca-vnfd-keyname.yaml
Normal file
37
samples/tosca-templates/vnfd/tosca-vnfd-keyname.yaml
Normal 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
|
@ -59,6 +59,14 @@ function fixup_nova_quota {
|
|||||||
nova quota-class-update --instances -1 --cores -1 default
|
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* ]]
|
if [[ "$venv" == dsvm-functional* ]]
|
||||||
then
|
then
|
||||||
owner=stack
|
owner=stack
|
||||||
@ -66,6 +74,7 @@ then
|
|||||||
log_dir="/tmp/${venv}-logs"
|
log_dir="/tmp/${venv}-logs"
|
||||||
|
|
||||||
fixup_nova_quota
|
fixup_nova_quota
|
||||||
|
add_key
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set owner permissions according to job's requirements.
|
# Set owner permissions according to job's requirements.
|
||||||
@ -76,7 +85,7 @@ sudo chown -R $owner:stack $TACKER_DIR
|
|||||||
echo "Running tacker $venv test suite"
|
echo "Running tacker $venv test suite"
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
sudo -H -u $owner $sudo_env tox -e $venv
|
sudo -H -u $owner $sudo_env tox -e $venv
|
||||||
testr_exit_code=$?
|
testr_exit_code=$?
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ topology_template:
|
|||||||
properties:
|
properties:
|
||||||
image: cirros-0.3.4-x86_64-uec
|
image: cirros-0.3.4-x86_64-uec
|
||||||
flavor: m1.tiny
|
flavor: m1.tiny
|
||||||
|
key_name: userKey
|
||||||
availability_zone: nova
|
availability_zone: nova
|
||||||
mgmt_driver: noop
|
mgmt_driver: noop
|
||||||
config: |
|
config: |
|
||||||
|
@ -12,6 +12,7 @@ resources:
|
|||||||
config_drive: true
|
config_drive: true
|
||||||
flavor: m1.tiny
|
flavor: m1.tiny
|
||||||
image: cirros-0.3.4-x86_64-uec
|
image: cirros-0.3.4-x86_64-uec
|
||||||
|
key_name: keyName
|
||||||
metadata: {param0: key0, param1: key1}
|
metadata: {param0: key0, param1: key1}
|
||||||
networks:
|
networks:
|
||||||
- port: {get_resource: vdu1-net_mgmt-port}
|
- port: {get_resource: vdu1-net_mgmt-port}
|
||||||
|
@ -10,6 +10,7 @@ vdus:
|
|||||||
management: True
|
management: True
|
||||||
network: net_mgmt
|
network: net_mgmt
|
||||||
user_data_format: RAW
|
user_data_format: RAW
|
||||||
|
key_name: keyName
|
||||||
user_data: |
|
user_data: |
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
echo "my hostname is `hostname`" > /tmp/hostname
|
echo "my hostname is `hostname`" > /tmp/hostname
|
||||||
|
@ -18,6 +18,7 @@ vdus:
|
|||||||
mgmt_driver: noop
|
mgmt_driver: noop
|
||||||
user_data: {get_input: user_data}
|
user_data: {get_input: user_data}
|
||||||
user_data_format: {get_input: user_data_format}
|
user_data_format: {get_input: user_data_format}
|
||||||
|
key_name: {get_input: key_name}
|
||||||
|
|
||||||
network_interfaces:
|
network_interfaces:
|
||||||
management:
|
management:
|
||||||
|
@ -359,6 +359,8 @@ class DeviceHeat(abstract_driver.DeviceAbstractDriver):
|
|||||||
metadata.update(vdu_dict['config'])
|
metadata.update(vdu_dict['config'])
|
||||||
for key, value in metadata.items():
|
for key, value in metadata.items():
|
||||||
metadata[key] = value[:255]
|
metadata[key] = value[:255]
|
||||||
|
if 'key_name' in vdu_dict:
|
||||||
|
properties['key_name'] = vdu_dict['key_name']
|
||||||
|
|
||||||
monitoring_policy = vdu_dict.get('monitoring_policy',
|
monitoring_policy = vdu_dict.get('monitoring_policy',
|
||||||
'noop')
|
'noop')
|
||||||
|
@ -57,6 +57,9 @@ node_types:
|
|||||||
type: string
|
type: string
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
|
key_name:
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
tosca.nodes.nfv.CP.Tacker:
|
tosca.nodes.nfv.CP.Tacker:
|
||||||
derived_from: tosca.nodes.nfv.CP
|
derived_from: tosca.nodes.nfv.CP
|
||||||
|
Loading…
Reference in New Issue
Block a user