Allow vdu (VM) names to be specified as a parameter
Adding support to accept name property in the VDU TOSCA node type which will be passed to Heat to create the VM with this specific name. Closes-bug: 1570557 Change-Id: Iac0ae4397edcc5398cf8c1fdede709c6e903cceb
This commit is contained in:
parent
ff5b90fdac
commit
c7c0dc9bc4
|
@ -0,0 +1,84 @@
|
|||
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
|
||||
|
||||
description: Demo example
|
||||
|
||||
metadata:
|
||||
template_name: sample-tosca-vnfd-vdu-name
|
||||
|
||||
topology_template:
|
||||
inputs:
|
||||
vdu-name:
|
||||
type: string
|
||||
description: Vdu name
|
||||
default: test-vdu
|
||||
cp-name:
|
||||
type: string
|
||||
description: Cp name
|
||||
default: test-cp
|
||||
node_templates:
|
||||
VDU1:
|
||||
type: tosca.nodes.nfv.VDU.Tacker
|
||||
capabilities:
|
||||
nfv_compute:
|
||||
properties:
|
||||
num_cpus: 1
|
||||
mem_size: 512 MB
|
||||
disk_size: 1 GB
|
||||
properties:
|
||||
name: {get_input : vdu-name}
|
||||
image: cirros-0.3.4-x86_64-uec
|
||||
availability_zone: nova
|
||||
mgmt_driver: noop
|
||||
config: |
|
||||
param0: key1
|
||||
param1: key2
|
||||
|
||||
CP1:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
name: {get_input : cp-name}
|
||||
management: true
|
||||
anti_spoofing_protection: false
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL1
|
||||
- virtualBinding:
|
||||
node: VDU1
|
||||
|
||||
CP2:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
anti_spoofing_protection: false
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL2
|
||||
- virtualBinding:
|
||||
node: VDU1
|
||||
|
||||
CP3:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
anti_spoofing_protection: false
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL3
|
||||
- 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: net0
|
||||
vendor: Tacker
|
||||
|
||||
VL3:
|
||||
type: tosca.nodes.nfv.VL
|
||||
properties:
|
||||
network_name: net1
|
||||
vendor: Tacker
|
|
@ -6,10 +6,20 @@ metadata:
|
|||
template_name: sample-tosca-vnfd
|
||||
|
||||
topology_template:
|
||||
inputs:
|
||||
vdu-name:
|
||||
type: string
|
||||
description: Vdu name
|
||||
default: test-vdu
|
||||
cp-name:
|
||||
type: string
|
||||
description: Cp name
|
||||
default: test-cp
|
||||
node_templates:
|
||||
VDU1:
|
||||
type: tosca.nodes.nfv.VDU.Tacker
|
||||
properties:
|
||||
name: {get_input : vdu-name}
|
||||
image: cirros-0.3.4-x86_64-uec
|
||||
flavor: m1.tiny
|
||||
key_name: userKey
|
||||
|
@ -22,6 +32,7 @@ topology_template:
|
|||
CP1:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
name: {get_input : cp-name}
|
||||
management: true
|
||||
anti_spoofing_protection: false
|
||||
requirements:
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
import time
|
||||
|
||||
from neutronclient.v2_0 import client as neutron_client
|
||||
from novaclient import client as nova_client
|
||||
from oslo_config import cfg
|
||||
from tempest.lib import base
|
||||
|
@ -66,6 +67,11 @@ class BaseTackerTest(base.BaseTestCase):
|
|||
vim_params['project_name'],
|
||||
vim_params['auth_url'])
|
||||
|
||||
@classmethod
|
||||
def neutronclient(cls):
|
||||
vim_params = cls.get_credentials()
|
||||
return neutron_client.Client(**vim_params)
|
||||
|
||||
def wait_until_vnf_status(self, vnf_id, target_status, timeout,
|
||||
sleep_interval):
|
||||
start_time = int(time.time())
|
||||
|
|
|
@ -57,6 +57,18 @@ class VnfTestToscaCreate(base.BaseTackerTest):
|
|||
vnf_id, evt_constants.RES_EVT_CREATE,
|
||||
vnf_instance['vnf'][evt_constants.RES_EVT_CREATED_FLD])
|
||||
|
||||
servers = self.novaclient().servers.list()
|
||||
vdus = []
|
||||
for server in servers:
|
||||
vdus.append(server.name)
|
||||
self.assertIn('test-vdu', vdus)
|
||||
|
||||
port_list = self.neutronclient().list_ports()['ports']
|
||||
vdu_ports = []
|
||||
for port in port_list:
|
||||
vdu_ports.append(port['name'])
|
||||
self.assertIn('test-cp', vdu_ports)
|
||||
|
||||
# Delete vnf_instance with vnf_id
|
||||
try:
|
||||
self.client.delete_vnf(vnf_id)
|
||||
|
|
|
@ -159,6 +159,9 @@ node_types:
|
|||
nfv_compute:
|
||||
type: tosca.datatypes.compute_properties
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
required: false
|
||||
image:
|
||||
# type: tosca.artifacts.Deployment.Image.VM
|
||||
type: string
|
||||
|
@ -218,6 +221,9 @@ node_types:
|
|||
tosca.nodes.nfv.CP.Tacker:
|
||||
derived_from: tosca.nodes.nfv.CP
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
required: false
|
||||
management:
|
||||
type: boolean
|
||||
required: false
|
||||
|
|
Loading…
Reference in New Issue