Browse Source

Separate nodes of FT and split FT

Cherry-picked the following commits from the master branch.
No functional changes are included.

* 06b58b9e Increase timeout value of heat stack creation
* 0d412ba7 Add new FT set for tests with separated NFVO
* ba813054 Split FT to Legacy and SOL implementation
* 578b12e9 Add a seperate controller subnode to subdivide the memory load

Change-Id: I94c692a0a0576fbffdd7781994e99c476bb145df
changes/58/775658/3
Toshiaki Takahashi 2 months ago
parent
commit
308ed21a13
52 changed files with 1613 additions and 137 deletions
  1. +66
    -9
      .zuul.yaml
  2. +31
    -21
      devstack/lib/tacker
  3. +3
    -5
      devstack/plugin.sh
  4. +33
    -21
      devstack/settings
  5. +1
    -0
      playbooks/devstack/pre.yaml
  6. +1
    -1
      playbooks/devstack/run.yaml
  7. +9
    -0
      roles/modify-heat-policy/tasks/main.yaml
  8. +59
    -60
      roles/setup-default-vim/tasks/main.yaml
  9. +101
    -0
      tacker/tests/etc/samples/etsi/nfv/functional6/BaseHOT/simple/helloworld3.yaml
  10. +63
    -0
      tacker/tests/etc/samples/etsi/nfv/functional6/BaseHOT/simple/nested/VDU1.yaml
  11. +61
    -0
      tacker/tests/etc/samples/etsi/nfv/functional6/BaseHOT/simple/nested/VDU2.yaml
  12. +396
    -0
      tacker/tests/etc/samples/etsi/nfv/functional6/Definitions/helloworld3_df_simple.yaml
  13. +31
    -0
      tacker/tests/etc/samples/etsi/nfv/functional6/Definitions/helloworld3_top.vnfd.yaml
  14. +55
    -0
      tacker/tests/etc/samples/etsi/nfv/functional6/Definitions/helloworld3_types.yaml
  15. +4
    -0
      tacker/tests/etc/samples/etsi/nfv/functional6/TOSCA-Metadata/TOSCA.meta
  16. +0
    -0
      tacker/tests/etc/samples/etsi/nfv/functional6/UserData/__init__.py
  17. +35
    -0
      tacker/tests/etc/samples/etsi/nfv/functional6/UserData/lcm_user_data.py
  18. +0
    -0
      tacker/tests/functional/legacy/__init__.py
  19. +0
    -0
      tacker/tests/functional/legacy/nfvo/__init__.py
  20. +0
    -0
      tacker/tests/functional/legacy/nfvo/test_nfvo.py
  21. +0
    -0
      tacker/tests/functional/legacy/nfvo/test_vim.py
  22. +0
    -0
      tacker/tests/functional/legacy/vnfm/__init__.py
  23. +0
    -0
      tacker/tests/functional/legacy/vnfm/test_tosca_vnf.py
  24. +0
    -0
      tacker/tests/functional/legacy/vnfm/test_tosca_vnf_alarm.py
  25. +0
    -0
      tacker/tests/functional/legacy/vnfm/test_tosca_vnf_block_storage.py
  26. +0
    -0
      tacker/tests/functional/legacy/vnfm/test_tosca_vnf_floatingip.py
  27. +0
    -0
      tacker/tests/functional/legacy/vnfm/test_tosca_vnf_maintenance.py
  28. +0
    -0
      tacker/tests/functional/legacy/vnfm/test_tosca_vnf_multiple_vdu.py
  29. +0
    -0
      tacker/tests/functional/legacy/vnfm/test_tosca_vnf_reservation.py
  30. +0
    -0
      tacker/tests/functional/legacy/vnfm/test_tosca_vnf_scale.py
  31. +1
    -1
      tacker/tests/functional/legacy/vnfm/test_tosca_vnfc.py
  32. +0
    -0
      tacker/tests/functional/legacy/vnfm/test_tosca_vnfd.py
  33. +0
    -0
      tacker/tests/functional/legacy/vnfm/test_vnf.py
  34. +0
    -0
      tacker/tests/functional/legacy/vnfm/test_vnf_monitoring.py
  35. +0
    -0
      tacker/tests/functional/legacy/vnfm/test_vnf_placement_policy.py
  36. +0
    -0
      tacker/tests/functional/legacy/vnfm/test_vnfm_param.py
  37. +0
    -0
      tacker/tests/functional/sol/__init__.py
  38. +0
    -0
      tacker/tests/functional/sol/vnflcm/__init__.py
  39. +1
    -1
      tacker/tests/functional/sol/vnflcm/base.py
  40. +0
    -0
      tacker/tests/functional/sol/vnflcm/fake_vnflcm.py
  41. +0
    -0
      tacker/tests/functional/sol/vnflcm/fake_vnfpkgm.py
  42. +2
    -2
      tacker/tests/functional/sol/vnflcm/test_kubernetes.py
  43. +1
    -1
      tacker/tests/functional/sol/vnflcm/test_vnf_instance.py
  44. +14
    -14
      tacker/tests/functional/sol/vnflcm/test_vnf_instance_with_user_data.py
  45. +0
    -0
      tacker/tests/functional/sol/vnfpkgm/__init__.py
  46. +1
    -1
      tacker/tests/functional/sol/vnfpkgm/test_vnf_package.py
  47. +0
    -0
      tacker/tests/functional/sol_separated_nfvo/__init__.py
  48. +0
    -0
      tacker/tests/functional/sol_separated_nfvo/vnflcm/__init__.py
  49. +205
    -0
      tacker/tests/functional/sol_separated_nfvo/vnflcm/fake_grant.py
  50. +105
    -0
      tacker/tests/functional/sol_separated_nfvo/vnflcm/fake_vnfpkgm.py
  51. +316
    -0
      tacker/tests/functional/sol_separated_nfvo/vnflcm/test_vnf_instance_with_user_data_nfvo_separate.py
  52. +18
    -0
      tox.ini

+ 66
- 9
.zuul.yaml View File

@ -1,8 +1,10 @@
- nodeset:
name: openstack-3-nodes-focal
name: openstack-4-nodes-focal
nodes:
- name: controller
label: ubuntu-focal
- name: controller-tacker
label: ubuntu-focal
- name: compute1
label: ubuntu-focal
- name: compute2
@ -16,6 +18,7 @@
# Nodes that are not the controller
- name: subnode
nodes:
- controller-tacker
- compute1
- compute2
# Switch node for multinode networking setup
@ -25,15 +28,16 @@
# Peer nodes for multinode networking setup
- name: peers
nodes:
- controller-tacker
- compute1
- compute2
- job:
name: tacker-functional-devstack-multinode-python3
name: tacker-functional-devstack-multinode-legacy
parent: devstack
description: |
Base multinodes job for devstack-based functional tests
nodeset: openstack-3-nodes-focal
nodeset: openstack-4-nodes-focal
pre-run: playbooks/devstack/pre.yaml
run: playbooks/devstack/run.yaml
post-run: playbooks/devstack/post.yaml
@ -75,8 +79,15 @@
vars:
devstack_localrc:
CELLSV2_SETUP: singleconductor
PHYSICAL_NETWORK: mgmtphysnet0
OVS_BRIDGE_MAPPINGS: public:br-ex,mgmtphysnet0:br-infra
Q_DVR_MODE: dvr
DATABASE_TYPE: mysql
KEYSTONE_SERVICE_HOST: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}"
MYSQL_HOST: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}"
TACKER_HOST: "{{ hostvars['controller-tacker']['nodepool']['private_ipv4'] }}"
TACKER_MODE: standalone
IS_ZUUL_FT: True
Q_SERVICE_PLUGIN_CLASSES: router,neutron.services.metering.metering_plugin.MeteringPlugin,networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin,neutron.services.qos.qos_plugin.QoSPlugin,qos
Q_ML2_PLUGIN_EXT_DRIVERS: port_security,qos
L2_AGENT_EXTENSIONS: qos
@ -101,7 +112,6 @@
# https://storyboard.openstack.org/#!/story/2007732
# barbican: https://opendev.org/openstack/barbican
mistral: https://opendev.org/openstack/mistral
tacker: https://opendev.org/openstack/tacker
blazar: https://opendev.org/openstack/blazar
fenix: https://opendev.org/x/fenix
devstack_services:
@ -138,9 +148,6 @@
c-sch: true
c-vol: true
cinder: true
# Tacker services
tacker: true
tacker-conductor: true
# Services we don't need.
# This section is not really needed, it's for readability.
horizon: false
@ -152,14 +159,33 @@
s-proxy: false
c-bak: false
tox_install_siblings: false
tox_envlist: dsvm-functional
controller-tacker:
devstack_local_conf: {}
devstack_services:
q-agt: true
# Tacker services
tacker: true
tacker-conductor: true
devstack_plugins:
# Temporarily remove because of Ubuntu Focal Migration issue
# https://storyboard.openstack.org/#!/story/2008121
# https://review.opendev.org/#/c/752294/
# ceilometer: https://opendev.org/openstack/ceilometer
tacker: https://opendev.org/openstack/tacker
tox_envlist: dsvm-functional-legacy
group-vars:
subnode:
devstack_localrc:
CELLSV2_SETUP: singleconductor
PHYSICAL_NETWORK: mgmtphysnet0
OVS_BRIDGE_MAPPINGS: public:br-ex,mgmtphysnet0:br-infra
Q_DVR_MODE: dvr
DATABASE_TYPE: mysql
KEYSTONE_SERVICE_HOST: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}"
MYSQL_HOST: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}"
TACKER_HOST: "{{ hostvars['controller-tacker']['nodepool']['private_ipv4'] }}"
TACKER_MODE: standalone
IS_ZUUL_FT: True
# Since a VirtualInterfaceCreateException occurs during a test,
# the setting of network-vif-plugged is changed by the reference of
# the following URL.
@ -182,6 +208,35 @@
horizon: false
tls-proxy: false
- job:
name: tacker-functional-devstack-multinode-sol
parent: tacker-functional-devstack-multinode-legacy
description: |
Multinodes job for SOL devstack-based functional tests
host-vars:
controller-tacker:
tox_envlist: dsvm-functional-sol
- job:
name: tacker-functional-devstack-multinode-sol-separated-nfvo
parent: tacker-functional-devstack-multinode-sol
description: |
Multinodes job for SOL devstack-based functional tests
with separated NFVO
host-vars:
controller-tacker:
devstack_local_conf:
post-config:
$TACKER_CONF:
connect_vnf_packages:
base_url: http://127.0.0.1:9990/vnfpkgm/v1/vnf_packages
pipeline: package_content,vnfd,artifacts
connect_grant:
base_url: http://127.0.0.1:9990/grant/v1/grants
openstack_vim:
stack_retries: 120
tox_envlist: dsvm-functional-sol-separated-nfvo
- project:
templates:
- check-requirements
@ -192,4 +247,6 @@
- release-notes-jobs-python3
check:
jobs:
- tacker-functional-devstack-multinode-python3
- tacker-functional-devstack-multinode-legacy
- tacker-functional-devstack-multinode-sol
- tacker-functional-devstack-multinode-sol-separated-nfvo

+ 31
- 21
devstack/lib/tacker View File

@ -80,7 +80,6 @@ TACKER_NOVA_URL=${TACKER_NOVA_URL:-http://127.0.0.1:8774/v2}
TACKER_NOVA_CA_CERTIFICATES_FILE=${TACKER_NOVA_CA_CERTIFICATES_FILE:-}
TACKER_NOVA_API_INSECURE=${TACKER_NOVA_API_INSECURE:-False}
HEAT_CONF_DIR=/etc/heat
CEILOMETER_CONF_DIR=/etc/ceilometer
source ${TACKER_DIR}/tacker/tests/contrib/post_test_hook_lib.sh
@ -91,13 +90,6 @@ GLANCE_DEFAULT_BACKEND=${GLANCE_DEFAULT_BACKEND:=file}
# Functions
# ---------
# Test if any Tacker services are enabled
# is_tacker_enabled
function is_tacker_enabled {
[[ ,${ENABLED_SERVICES} =~ ,"tacker" ]] && return 0
return 1
}
# create_tacker_cache_dir() - Part of the _tacker_setup_keystone() process
function create_tacker_cache_dir {
# Create cache dir
@ -105,6 +97,28 @@ function create_tacker_cache_dir {
rm -f $TACKER_AUTH_CACHE_DIR/*
}
# function install_db_client_mysql() - ensure mysql client is installed
function install_db_client_mysql {
if is_oraclelinux; then
install_package mysql-community-client
elif is_fedora || is_suse; then
install_package mariadb-client
elif is_ubuntu; then
install_package mysql-client
else
exit_distro_not_supported "mysql client installation"
fi
}
# function install_db_client_postgresql() - ensure postgresql client is installed
function install_db_client_postgresql {
if is_ubuntu || is_fedora || is_suse; then
install_package postgresql-client
else
exit_distro_not_supported "postgresql client installation"
fi
}
# create_tacker_accounts() - Set up common required tacker accounts
# Tenant User Roles
@ -123,9 +137,9 @@ function create_tacker_accounts {
"nfv-orchestration" "Tacker NFV Orchestration Service")
get_or_create_endpoint $tacker_service \
"$REGION_NAME" \
"$TACKER_PROTOCOL://$SERVICE_HOST:$TACKER_PORT/" \
"$TACKER_PROTOCOL://$SERVICE_HOST:$TACKER_PORT/" \
"$TACKER_PROTOCOL://$SERVICE_HOST:$TACKER_PORT/"
"$TACKER_PROTOCOL://$TACKER_HOST:$TACKER_PORT/" \
"$TACKER_PROTOCOL://$TACKER_HOST:$TACKER_PORT/" \
"$TACKER_PROTOCOL://$TACKER_HOST:$TACKER_PORT/"
fi
}
@ -134,6 +148,9 @@ function create_tacker_accounts {
# init_tacker() - Initialize databases, etc.
function init_tacker {
# In case db service is disabled, which would have installed cli commands.
install_db_client_$DATABASE_TYPE
recreate_database $TACKER_DB_NAME
# Run Tacker db migrations
@ -241,7 +258,7 @@ function configure_tacker {
iniset $TACKER_CONF DEFAULT auth_strategy $TACKER_AUTH_STRATEGY
_tacker_setup_keystone $TACKER_CONF keystone_authtoken
if [[ "${TACKER_MODE}" == "all" ]]; then
if [[ "${TACKER_MODE}" == "all" || -v IS_ZUUL_FT ]]; then
iniset "/$Q_PLUGIN_CONF_FILE" ml2_type_flat flat_networks $PUBLIC_PHYSICAL_NETWORK,$MGMT_PHYS_NET
iniset "/$Q_PLUGIN_CONF_FILE" ovs bridge_mappings $PUBLIC_PHYSICAL_NETWORK:$PUBLIC_BRIDGE,$MGMT_PHYS_NET:$BR_MGMT
@ -417,9 +434,9 @@ function tacker_create_initial_network {
sudo ip address add ${NETWORK_GATEWAY_MGMT_IP} dev ${BR_MGMT}
}
function tacker_register_default_vim {
function tacker_setup_default_vim_resources {
# Note: These must be the same as in tacker/tests/etc/samples/local-vim.yaml
# and devstack/lib/tacker/vim_config.yaml
# and devstack/vim_config.yaml
DEFAULT_VIM_PROJECT_NAME="nfv"
DEFAULT_VIM_USER="nfv_user"
DEFAULT_VIM_PASSWORD="devstack"
@ -475,13 +492,6 @@ function tacker_register_default_vim {
}
function modify_heat_flavor_policy_rule {
local policy_file=$HEAT_CONF_DIR/policy.yaml
touch $policy_file
# Allow non-admin projects with 'admin' roles to create flavors in Heat
echo '"resource_types:OS::Nova::Flavor": "role:admin"' >> $policy_file
}
function configure_maintenance_event_types {
local event_definitions_file=$CEILOMETER_CONF_DIR/event_definitions.yaml
local maintenance_events_file=$TACKER_DIR/etc/ceilometer/maintenance_event_types.yaml


+ 3
- 5
devstack/plugin.sh View File

@ -32,15 +32,13 @@ if is_service_enabled tacker; then
tacker_horizon_install
fi
if [[ "${TACKER_MODE}" == "all" ]]; then
echo_summary "Modifying Heat policy.json file"
modify_heat_flavor_policy_rule
if [[ "${TACKER_MODE}" == "all" || -v IS_ZUUL_FT ]]; then
echo_summary "Setup initial tacker network"
tacker_create_initial_network
echo_summary "Check and download images for tacker initial"
tacker_check_and_download_images
echo_summary "Registering default VIM"
tacker_register_default_vim
echo_summary "Setup default VIM resources"
tacker_setup_default_vim_resources
if is_service_enabled ceilometer; then
echo_summary "Configure maintenance event types"


+ 33
- 21
devstack/settings View File

@ -4,25 +4,7 @@ TACKER_MODE=${TACKER_MODE:-all}
USE_BARBICAN=False
KUBERNETES_VIM=${KUBERNETES_VIM:-False}
if [ "${TACKER_MODE}" == "all" ]; then
# Nova
disable_service n-net
VIRT_DRIVER=libvirt
# TACKER_NEUTRON_AGENTS can be disabled by adding
# TACKER_NEUTRON_AGENTS='' in local.conf if neutron agents are running on a separate node
TACKER_NEUTRON_AGENTS=${TACKER_NEUTRON_AGENTS:-q-agt,q-dhcp,q-meta,q-l3}
for i in $(echo $TACKER_NEUTRON_AGENTS | sed 's/,/ /g')
do
enable_service $i
done
enable_service q-svc
enable_service neutron
enable_service tacker
# enable tacker-conductor will make systemctl enable conductor service
enable_service tacker-conductor
if [ "${TACKER_MODE}" == "all" -o ${IS_ZUUL_FT+yes} ]; then
MGMT_PHYS_NET=${MGMT_PHYS_NET:-mgmtphysnet0}
# br-infra is created by devstack multi node job
# https://opendev.org/zuul/zuul-jobs/src/branch/master/roles/multi-node-bridge
@ -42,6 +24,27 @@ if [ "${TACKER_MODE}" == "all" ]; then
SUBNET1=${SUBNET1:-subnet1}
FIXED_RANGE1=${FIXED_RANGE1:-10.10.1.0/24}
NETWORK_GATEWAY1=${NETWORK_GATEWAY1:-10.10.1.1}
fi
if [ "${TACKER_MODE}" == "all" ]; then
# Nova
disable_service n-net
VIRT_DRIVER=libvirt
# TACKER_NEUTRON_AGENTS can be disabled by adding
# TACKER_NEUTRON_AGENTS='' in local.conf if neutron agents are running on a separate node
TACKER_NEUTRON_AGENTS=${TACKER_NEUTRON_AGENTS:-q-agt,q-dhcp,q-meta,q-l3}
for i in $(echo $TACKER_NEUTRON_AGENTS | sed 's/,/ /g')
do
enable_service $i
done
enable_service q-svc
enable_service neutron
enable_service tacker
# enable tacker-conductor will make systemctl enable conductor service
enable_service tacker-conductor
if [ "${KUBERNETES_VIM}" == "True" ]; then
KURYR_NEUTRON_DEFAULT_PROJECT="default"
@ -61,8 +64,17 @@ if [ "${TACKER_MODE}" == "all" ]; then
done
fi
elif [ "${TACKER_MODE}" == "standalone" ]; then
# set the enabled services here. This will need tacker devstack plugin put as the last one in local.conf
ENABLED_SERVICES=key,horizon,tacker,tacker-conductor,mysql,dstat,barbican,mistral,mistral-api,mistral-engine,mistral-executor,mistral-event-engine
# TODO(takahashi-tsc) Remove gawk installation after the following bug is fixed.
# https://bugs.launchpad.net/devstack/+bug/1909041
# post-config requires gawk.
# Generally, gawk is requires by Nova,
# but Nova is not mandatory for Tacker.
# So we install gawk manually until the bug is fixed.
install_package gawk
enable_service dstat
enable_service tacker
enable_service tacker-conductor
else
die $LINENO "invalid value: $TACKER_MODE for TACKER_MODE"
fi

+ 1
- 0
playbooks/devstack/pre.yaml View File

@ -1,6 +1,7 @@
- hosts: all
roles:
- orchestrate-devstack
- modify-heat-policy
- setup-default-vim
- role: bindep
bindep_profile: test


+ 1
- 1
playbooks/devstack/run.yaml View File

@ -1,3 +1,3 @@
- hosts: controller
- hosts: controller-tacker
roles:
- tox

+ 9
- 0
roles/modify-heat-policy/tasks/main.yaml View File

@ -0,0 +1,9 @@
- name: Modify heat flavor policy rule
become: true
lineinfile:
path: /etc/heat/policy.yaml
regexp: '^"resource_types:OS::Nova::Flavor":'
line: '"resource_types:OS::Nova::Flavor": "role:admin"'
mode: 0644
create: true
when: devstack_plugins['heat']|default(false)

+ 59
- 60
roles/setup-default-vim/tasks/main.yaml View File

@ -1,68 +1,67 @@
- name: Copy files test setup default vim sh
copy:
remote_src=True
src={{ devstack_base_dir }}/tacker/tools/test-setup-default-vim.sh
dest={{ zuul_work_dir }}/tools/test-setup-default-vim.sh
mode=0755
when: inventory_hostname == "controller"
- block:
- name: Copy tools/test-setup-default-vim.sh
copy:
remote_src=True
src={{ devstack_base_dir }}/tacker/tools/test-setup-default-vim.sh
dest={{ zuul_work_dir }}/tools/test-setup-default-vim.sh
mode=0755
- name: Copy test vim file
copy:
remote_src=True
src={{ devstack_base_dir }}/tacker/tacker/tests/etc/samples/local-vim.yaml
dest={{ zuul_work_dir }}/tacker/tests/etc/samples/local-vim.yaml
when: inventory_hostname == "controller"
- name: Copy test vim file
copy:
remote_src=True
src={{ devstack_base_dir }}/tacker/tacker/tests/etc/samples/local-vim.yaml
dest={{ zuul_work_dir }}/tacker/tests/etc/samples/local-vim.yaml
- name: Check if project's tools/test-setup-default-vim.sh exists
stat:
path: "{{ zuul_work_dir }}/tools/test-setup-default-vim.sh"
register: p
- fail:
msg: >
{{ zuul_work_dir }}/tools/test-setup-default-vim.sh doesn't exists
or it doesn't have execute permission.
when: p.stat.exists != True or p.stat.executable != True
- name: Check if project's tools/test-setup-default-vim.sh exists
stat:
path: "{{ zuul_work_dir }}/tools/test-setup-default-vim.sh"
register: p
- fail:
msg: >
{{ zuul_work_dir }}/tools/test-setup-default-vim.sh doesn't exists
or it doesn't have execute permission.
when: p.stat.exists != True or p.stat.executable != True
- name: Get stackenv from devstack environment
slurp:
src: "{{ devstack_base_dir }}/devstack/.stackenv"
register: stackenv
- name: Get stackenv from devstack environment
slurp:
src: "{{ devstack_base_dir }}/devstack/.stackenv"
register: stackenv
- name: Set a keystone authentication uri
set_fact:
auth_uri: "{{
stackenv.content
| b64decode
| regex_replace('\n', ' ')
| regex_replace('^.*KEYSTONE_SERVICE_URI=([^ ]+).*$', '\\1')
}}"
when:
- p.stat.exists
- name: Set a keystone authentication uri
set_fact:
auth_uri: "{{
stackenv.content
| b64decode
| regex_replace('\n', ' ')
| regex_replace('^.*KEYSTONE_SERVICE_URI=([^ ]+).*$', '\\1')
}}"
when:
- p.stat.exists
- name: Replace the keystone authentication uri in the test-setup-default-vim.sh and local-vim.yaml
replace:
path: "{{ item }}"
regexp: "http://127.0.0.1/identity"
replace: "{{ auth_uri }}"
with_items:
- "{{ zuul_work_dir }}/tools/test-setup-default-vim.sh"
- "{{ zuul_work_dir }}/tacker/tests/etc/samples/local-vim.yaml"
when:
- inventory_hostname == 'controller'
- p.stat.exists
- name: Replace auth uri in test-setup-default-vim.sh and local-vim.yaml
replace:
path: "{{ item }}"
regexp: "http://127.0.0.1/identity"
replace: "{{ auth_uri }}"
with_items:
- "{{ zuul_work_dir }}/tools/test-setup-default-vim.sh"
- "{{ zuul_work_dir }}/tacker/tests/etc/samples/local-vim.yaml"
when:
- p.stat.exists
- name: Replace the config file path in the test-setup-default-vim.sh
replace:
path: "{{ zuul_work_dir }}/tools/test-setup-default-vim.sh"
regexp: '(?<=config-file )([^ ]+)(?= )'
replace: "{{ ansible_env.HOME }}/{{ zuul_work_dir }}/tacker/tests/etc/samples/local-vim.yaml"
- name: Replace the config file path in the test-setup-default-vim.sh
replace:
path: "{{ zuul_work_dir }}/tools/test-setup-default-vim.sh"
regexp: '(?<=config-file )([^ ]+)(?= )'
replace: "{{ ansible_env.HOME }}/{{ zuul_work_dir }}/tacker/tests/etc/samples/local-vim.yaml"
when: inventory_hostname == 'controller'
- name: Run tools/test-setup-default-vim.sh
command: tools/test-setup-default-vim.sh
args:
chdir: "{{ zuul_work_dir }}"
when:
- p.stat.exists
- p.stat.executable
- name: Run tools/test-setup-default-vim.sh
command: tools/test-setup-default-vim.sh
args:
chdir: "{{ zuul_work_dir }}"
when:
- inventory_hostname == 'controller'
- p.stat.exists
- p.stat.executable
- inventory_hostname == 'controller-tacker'

+ 101
- 0
tacker/tests/etc/samples/etsi/nfv/functional6/BaseHOT/simple/helloworld3.yaml View File

@ -0,0 +1,101 @@
heat_template_version: 2013-05-23
description: 'Simple Base HOT for Sample VNF'
parameters:
nfv:
type: json
resources:
VDU1:
type: OS::Heat::AutoScalingGroup
properties:
min_size: 1
max_size: 3
desired_capacity: 1
resource:
type: VDU1.yaml
properties:
flavor: { get_param: [ nfv, VDU, VDU1, flavor ] }
image: { get_param: [ nfv, VDU, VDU1, image ] }
zone: { get_param: [ nfv, vdu, VDU1, zone ] }
net1: { get_param: [ nfv, CP, VDU1_CP1, network ] }
net2: { get_param: [ nfv, CP, VDU1_CP2, network ] }
net3: { get_resource: extmanageNW_1 }
net4: { get_resource: extmanageNW_2 }
net5: { get_resource: internalNW_1 }
VDU1_scale_out:
type: OS::Heat::ScalingPolicy
properties:
scaling_adjustment: 1
auto_scaling_group_id:
get_resource: VDU1
adjustment_type: change_in_capacity
VDU1_scale_in:
type: OS::Heat::ScalingPolicy
properties:
scaling_adjustment: -1
auto_scaling_group_id:
get_resource: VDU1
adjustment_type: change_in_capacity
VDU2:
type: OS::Heat::AutoScalingGroup
depends_on: VDU1
properties:
min_size: 2
max_size: 2
desired_capacity: 2
resource:
type: VDU2.yaml
properties:
flavor: { get_param: [ nfv, VDU, VDU2, flavor ] }
image: { get_param: [ nfv, VDU, VDU2, image ] }
zone: { get_param: [ nfv, vdu, VDU2, zone ] }
net1: { get_param: [ nfv, CP, VDU2_CP1, network ] }
net2: { get_param: [ nfv, CP, VDU2_CP2, network ] }
net3: { get_resource: extmanageNW_1 }
net4: { get_resource: extmanageNW_2 }
net5: { get_resource: internalNW_1 }
VDU2_scale_out:
type: OS::Heat::ScalingPolicy
properties:
scaling_adjustment: 1
auto_scaling_group_id:
get_resource: VDU2
adjustment_type: change_in_capacity
VDU2_scale_in:
type: OS::Heat::ScalingPolicy
properties:
scaling_adjustment: -1
auto_scaling_group_id:
get_resource: VDU2
adjustment_type: change_in_capacity
extmanageNW_1:
type: OS::Neutron::Net
extmanageNW_2:
type: OS::Neutron::Net
internalNW_1:
type: OS::Neutron::Net
extmanageNW_1_subnet:
type: OS::Neutron::Subnet
properties:
ip_version: 4
network:
get_resource: extmanageNW_1
cidr: 192.168.3.0/24
extmanageNW_2_subnet:
type: OS::Neutron::Subnet
properties:
ip_version: 4
network:
get_resource: extmanageNW_2
cidr: 192.168.4.0/24
internalNW_1_subnet:
type: OS::Neutron::Subnet
properties:
ip_version: 4
network:
get_resource: internalNW_1
cidr: 192.168.5.0/24
outputs: {}

+ 63
- 0
tacker/tests/etc/samples/etsi/nfv/functional6/BaseHOT/simple/nested/VDU1.yaml View File

@ -0,0 +1,63 @@
heat_template_version: 2013-05-23
description: 'VDU1 HOT for Sample VNF'
parameters:
flavor:
type: string
image:
type: string
zone:
type: string
net1:
type: string
net2:
type: string
net3:
type: string
net4:
type: string
net5:
type: string
resources:
VDU1:
type: OS::Nova::Server
properties:
flavor: { get_param: flavor }
name: VDU1
image: { get_param: image }
networks:
- port:
get_resource: VDU1_CP1
- port:
get_resource: VDU1_CP2
- port:
get_resource: VDU1_CP3
- port:
get_resource: VDU1_CP4
- port:
get_resource: VDU1_CP5
availability_zone: { get_param: zone }
VDU1_CP1:
type: OS::Neutron::Port
properties:
network: { get_param: net1 }
VDU1_CP2:
type: OS::Neutron::Port
properties:
network: { get_param: net2 }
VDU1_CP3:
type: OS::Neutron::Port
properties:
network: { get_param: net3 }
VDU1_CP4:
type: OS::Neutron::Port
properties:
network: { get_param: net4 }
VDU1_CP5:
type: OS::Neutron::Port
properties:
network: { get_param: net5 }

+ 61
- 0
tacker/tests/etc/samples/etsi/nfv/functional6/BaseHOT/simple/nested/VDU2.yaml View File

@ -0,0 +1,61 @@
heat_template_version: 2013-05-23
description: 'VDU2 HOT for Sample VNF'
parameters:
flavor:
type: string
image:
type: string
zone:
type: string
net1:
type: string
net2:
type: string
net3:
type: string
net4:
type: string
net5:
type: string
resources:
VDU2:
type: OS::Nova::Server
properties:
flavor: { get_param: flavor }
name: VDU2
image: { get_param: image }
networks:
- port:
get_resource: VDU2_CP1
- port:
get_resource: VDU2_CP2
- port:
get_resource: VDU2_CP3
- port:
get_resource: VDU2_CP4
- port:
get_resource: VDU2_CP5
availability_zone: { get_param: zone }
VDU2_CP1:
type: OS::Neutron::Port
properties:
network: { get_param: net1 }
VDU2_CP2:
type: OS::Neutron::Port
properties:
network: { get_param: net2 }
VDU2_CP3:
type: OS::Neutron::Port
properties:
network: { get_param: net3 }
VDU2_CP4:
type: OS::Neutron::Port
properties:
network: { get_param: net4 }
VDU2_CP5:
type: OS::Neutron::Port
properties:
network: { get_param: net5 }

+ 396
- 0
tacker/tests/etc/samples/etsi/nfv/functional6/Definitions/helloworld3_df_simple.yaml View File

@ -0,0 +1,396 @@
tosca_definitions_version: tosca_simple_yaml_1_2
description: Simple deployment flavour for Sample VNF
imports:
- etsi_nfv_sol001_common_types.yaml
- etsi_nfv_sol001_vnfd_types.yaml
- helloworld3_types.yaml
topology_template:
inputs:
descriptor_id:
type: string
descriptor_version:
type: string
provider:
type: string
product_name:
type: string
software_version:
type: string
vnfm_info:
type: list
entry_schema:
type: string
flavour_id:
type: string
flavour_description:
type: string
substitution_mappings:
node_type: company.provider.VNF
properties:
flavour_id: simple
requirements:
virtual_link_external1_1: [ VDU1_CP1, virtual_link ]
virtual_link_external1_2: [ VDU2_CP1, virtual_link ]
virtual_link_external2_1: [ VDU1_CP2, virtual_link ]
virtual_link_external2_2: [ VDU2_CP2, virtual_link ]
node_templates:
VNF:
type: company.provider.VNF
properties:
flavour_description: A simple flavour
interfaces:
Vnflcm:
instantiate: []
instantiate_start: []
instantiate_end: []
terminate: []
terminate_start: []
terminate_end: []
modify_information: []
modify_information_start: []
modify_information_end: []
VDU1:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: VDU1
description: VDU1 compute node
vdu_profile:
min_number_of_instances: 1
max_number_of_instances: 3
sw_image_data:
name: cirros-0.4.0-x86_64-disk
version: '0.4.0'
checksum:
algorithm: sha-256
hash: a8dd75ecffd4cdd96072d60c2237b448e0c8b2bc94d57f10fdbc8c481d9005b8
container_format: bare
disk_format: qcow2
min_disk: 0 GB
min_ram: 256 MB
size: 12 GB
capabilities:
virtual_compute:
properties:
requested_additional_capabilities:
properties:
requested_additional_capability_name: m1.tiny
support_mandatory: true
target_performance_parameters:
entry_schema: test
virtual_memory:
virtual_mem_size: 512 MB
virtual_cpu:
num_virtual_cpu: 1
virtual_local_storage:
- size_of_storage: 3 GB
VDU2:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: VDU2
description: VDU2 compute node
vdu_profile:
min_number_of_instances: 2
max_number_of_instances: 2
sw_image_data:
name: cirros-0.4.0-x86_64-disk
version: '0.4.0'
checksum:
algorithm: sha-256
hash: a8dd75ecffd4cdd96072d60c2237b448e0c8b2bc94d57f10fdbc8c481d9005b8
container_format: bare
disk_format: qcow2
min_disk: 0 GB
min_ram: 256 MB
size: 12 GB
capabilities:
virtual_compute:
properties:
requested_additional_capabilities:
properties:
requested_additional_capability_name: m1.tiny
support_mandatory: true
target_performance_parameters:
entry_schema: test
virtual_memory:
virtual_mem_size: 512 MB
virtual_cpu:
num_virtual_cpu: 1
virtual_local_storage:
- size_of_storage: 3 GB
VDU1_CP1:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 0
requirements:
- virtual_binding: VDU1
VDU1_CP2:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 1
requirements:
- virtual_binding: VDU1
VDU1_CP3:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 2
requirements:
- virtual_binding: VDU1
- virtual_link: internalVL1
VDU1_CP4:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 3
requirements:
- virtual_binding: VDU1
- virtual_link: internalVL2
VDU1_CP5:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 4
requirements:
- virtual_binding: VDU1
- virtual_link: internalVL3
VDU2_CP1:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 0
requirements:
- virtual_binding: VDU2
VDU2_CP2:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 1
requirements:
- virtual_binding: VDU2
VDU2_CP3:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 2
requirements:
- virtual_binding: VDU2
- virtual_link: internalVL1
VDU2_CP4:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 3
requirements:
- virtual_binding: VDU2
- virtual_link: internalVL2
VDU2_CP5:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 4
requirements:
- virtual_binding: VDU2
- virtual_link: internalVL3
internalVL1:
type: tosca.nodes.nfv.VnfVirtualLink
properties:
connectivity_type:
layer_protocols: [ ipv4 ]
description: External Managed Virtual link in the VNF
vl_profile:
max_bitrate_requirements:
root: 1048576
leaf: 1048576
min_bitrate_requirements:
root: 1048576
leaf: 1048576
virtual_link_protocol_data:
- associated_layer_protocol: ipv4
l3_protocol_data:
ip_version: ipv4
cidr: 33.33.0.0/24
internalVL2:
type: tosca.nodes.nfv.VnfVirtualLink
properties:
connectivity_type:
layer_protocols: [ ipv4 ]
description: External Managed Virtual link in the VNF
vl_profile:
max_bitrate_requirements:
root: 1048576
leaf: 1048576
min_bitrate_requirements:
root: 1048576
leaf: 1048576
virtual_link_protocol_data:
- associated_layer_protocol: ipv4
l3_protocol_data:
ip_version: ipv4
cidr: 33.34.0.0/24
internalVL3:
type: tosca.nodes.nfv.VnfVirtualLink
properties:
connectivity_type:
layer_protocols: [ ipv4 ]
description: Internal Virtual link in the VNF
vl_profile:
max_bitrate_requirements:
root: 1048576
leaf: 1048576
min_bitrate_requirements:
root: 1048576
leaf: 1048576
virtual_link_protocol_data:
- associated_layer_protocol: ipv4
l3_protocol_data:
ip_version: ipv4
cidr: 33.35.0.0/24
policies:
- scaling_aspects:
type: tosca.policies.nfv.ScalingAspects
properties:
aspects:
worker_instance:
name: worker_instance_aspect
description: worker_instance scaling aspect
max_scale_level: 2
step_deltas:
- delta_1
- VDU1_initial_delta:
type: tosca.policies.nfv.VduInitialDelta
properties:
initial_delta:
number_of_instances: 1
targets: [ VDU1 ]
- VDU2_initial_delta:
type: tosca.policies.nfv.VduInitialDelta
properties:
initial_delta:
number_of_instances: 2
targets: [ VDU2 ]
- VDU1_scaling_aspect_deltas:
type: tosca.policies.nfv.VduScalingAspectDeltas
properties:
aspect: worker_instance
deltas:
delta_1:
number_of_instances: 1
targets: [ VDU1 ]
- instantiation_levels:
type: tosca.policies.nfv.InstantiationLevels
properties:
levels:
instantiation_level_1:
description: Smallest size
scale_info:
worker_instance:
scale_level: 0
instantiation_level_2:
description: Largest size
scale_info:
worker_instance:
scale_level: 2
default_level: instantiation_level_1
- VDU1_instantiation_levels:
type: tosca.policies.nfv.VduInstantiationLevels
properties:
levels:
instantiation_level_1:
number_of_instances: 1
instantiation_level_2:
number_of_instances: 3
targets: [ VDU1 ]
- VDU2_instantiation_levels:
type: tosca.policies.nfv.VduInstantiationLevels
properties:
levels:
instantiation_level_1:
number_of_instances: 2
instantiation_level_2:
number_of_instances: 2
targets: [ VDU2 ]
- internalVL1_instantiation_levels:
type: tosca.policies.nfv.VirtualLinkInstantiationLevels
properties:
levels:
instantiation_level_1:
bitrate_requirements:
root: 1048576
leaf: 1048576
instantiation_level_2:
bitrate_requirements:
root: 1048576
leaf: 1048576
targets: [ internalVL1 ]
- internalVL2_instantiation_levels:
type: tosca.policies.nfv.VirtualLinkInstantiationLevels
properties:
levels:
instantiation_level_1:
bitrate_requirements:
root: 1048576
leaf: 1048576
instantiation_level_2:
bitrate_requirements:
root: 1048576
leaf: 1048576
targets: [ internalVL2 ]
- internalVL3_instantiation_levels:
type: tosca.policies.nfv.VirtualLinkInstantiationLevels
properties:
levels:
instantiation_level_1:
bitrate_requirements:
root: 1048576
leaf: 1048576
instantiation_level_2:
bitrate_requirements:
root: 1048576
leaf: 1048576
targets: [ internalVL3 ]
- policy_antiaffinity_vdu1:
type: tosca.policies.nfv.AntiAffinityRule
targets: [ VDU1 ]
properties:
scope: zone
- policy_antiaffinity_vdu2:
type: tosca.policies.nfv.AntiAffinityRule
targets: [ VDU2 ]
properties:
scope: zone

+ 31
- 0
tacker/tests/etc/samples/etsi/nfv/functional6/Definitions/helloworld3_top.vnfd.yaml View File

@ -0,0 +1,31 @@
tosca_definitions_version: tosca_simple_yaml_1_2
description: Sample VNF
imports:
- etsi_nfv_sol001_common_types.yaml
- etsi_nfv_sol001_vnfd_types.yaml
- helloworld3_types.yaml
- helloworld3_df_simple.yaml
topology_template:
inputs:
selected_flavour:
type: string
description: VNF deployment flavour selected by the consumer. It is provided in the API
node_templates:
VNF:
type: company.provider.VNF
properties:
flavour_id: { get_input: selected_flavour }
descriptor_id: b1bb0ce7-ebca-4fa7-95ed-4840d7000000
provider: Company
product_name: Sample VNF
software_version: '1.0'
descriptor_version: '1.0'
vnfm_info:
- Tacker
requirements:
#- virtual_link_external # mapped in lower-level templates
#- virtual_link_internal # mapped in lower-level templates

+ 55
- 0
tacker/tests/etc/samples/etsi/nfv/functional6/Definitions/helloworld3_types.yaml View File

@ -0,0 +1,55 @@
tosca_definitions_version: tosca_simple_yaml_1_2
description: VNF type definition
imports:
- etsi_nfv_sol001_common_types.yaml
- etsi_nfv_sol001_vnfd_types.yaml
node_types:
company.provider.VNF:
derived_from: tosca.nodes.nfv.VNF
properties:
descriptor_id:
type: string
constraints: [ valid_values: [ b1bb0ce7-ebca-4fa7-95ed-4840d7000000 ] ]
default: b1bb0ce7-ebca-4fa7-95ed-4840d7000000
descriptor_version:
type: string
constraints: [ valid_values: [ '1.0' ] ]
default: '1.0'
provider:
type: string
constraints: [ valid_values: [ 'Company' ] ]
default: 'Company'
product_name:
type: string
constraints: [ valid_values: [ 'Sample VNF' ] ]
default: 'Sample VNF'
software_version:
type: string
constraints: [ valid_values: [ '1.0' ] ]
default: '1.0'
vnfm_info:
type: list
entry_schema:
type: string
constraints: [ valid_values: [ Tacker ] ]
default: [ Tacker ]
flavour_id:
type: string
constraints: [ valid_values: [ simple ] ]
default: simple
flavour_description:
type: string
default: "falvour"
requirements:
- virtual_link_external1:
capability: tosca.capabilities.nfv.VirtualLinkable
- virtual_link_external2:
capability: tosca.capabilities.nfv.VirtualLinkable
- virtual_link_internal:
capability: tosca.capabilities.nfv.VirtualLinkable
interfaces:
Vnflcm:
type: tosca.interfaces.nfv.Vnflcm

+ 4
- 0
tacker/tests/etc/samples/etsi/nfv/functional6/TOSCA-Metadata/TOSCA.meta View File

@ -0,0 +1,4 @@
TOSCA-Meta-File-Version: 1.0
CSAR-Version: 1.1
Created-by: Onboarding portal
Entry-Definitions: Definitions/helloworld3_top.vnfd.yaml

tacker/tests/functional/nfvo/__init__.py → tacker/tests/etc/samples/etsi/nfv/functional6/UserData/__init__.py View File


+ 35
- 0
tacker/tests/etc/samples/etsi/nfv/functional6/UserData/lcm_user_data.py View File

@ -0,0 +1,35 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from tacker.vnfm.lcm_user_data.abstract_user_data import AbstractUserData
import tacker.vnfm.lcm_user_data.utils as UserDataUtil
class SampleUserData(AbstractUserData):
@staticmethod
def instantiate(base_hot_dict=None,
vnfd_dict=None,
inst_req_info=None,
grant_info=None):
api_param = UserDataUtil.get_diff_base_hot_param_from_api(
base_hot_dict, inst_req_info)
initial_param_dict = \
UserDataUtil.create_initial_param_server_port_dict(
base_hot_dict)
vdu_flavor_dict = \
UserDataUtil.create_vdu_flavor_capability_name_dict(vnfd_dict)
vdu_image_dict = UserDataUtil.create_sw_image_dict(vnfd_dict)
cpd_vl_dict = UserDataUtil.create_network_dict(
inst_req_info, initial_param_dict)
final_param_dict = UserDataUtil.create_final_param_dict(
initial_param_dict, vdu_flavor_dict, vdu_image_dict, cpd_vl_dict)
return {**final_param_dict, **api_param}

tacker/tests/functional/vnflcm/__init__.py → tacker/tests/functional/legacy/__init__.py View File


tacker/tests/functional/vnfm/__init__.py → tacker/tests/functional/legacy/nfvo/__init__.py View File


tacker/tests/functional/nfvo/test_nfvo.py → tacker/tests/functional/legacy/nfvo/test_nfvo.py View File


tacker/tests/functional/nfvo/test_vim.py → tacker/tests/functional/legacy/nfvo/test_vim.py View File


tacker/tests/functional/vnfpkgm/__init__.py → tacker/tests/functional/legacy/vnfm/__init__.py View File


tacker/tests/functional/vnfm/test_tosca_vnf.py → tacker/tests/functional/legacy/vnfm/test_tosca_vnf.py View File


tacker/tests/functional/vnfm/test_tosca_vnf_alarm.py → tacker/tests/functional/legacy/vnfm/test_tosca_vnf_alarm.py View File


tacker/tests/functional/vnfm/test_tosca_vnf_block_storage.py → tacker/tests/functional/legacy/vnfm/test_tosca_vnf_block_storage.py View File


tacker/tests/functional/vnfm/test_tosca_vnf_floatingip.py → tacker/tests/functional/legacy/vnfm/test_tosca_vnf_floatingip.py View File


tacker/tests/functional/vnfm/test_tosca_vnf_maintenance.py → tacker/tests/functional/legacy/vnfm/test_tosca_vnf_maintenance.py View File


tacker/tests/functional/vnfm/test_tosca_vnf_multiple_vdu.py → tacker/tests/functional/legacy/vnfm/test_tosca_vnf_multiple_vdu.py View File


tacker/tests/functional/vnfm/test_tosca_vnf_reservation.py → tacker/tests/functional/legacy/vnfm/test_tosca_vnf_reservation.py View File


tacker/tests/functional/vnfm/test_tosca_vnf_scale.py → tacker/tests/functional/legacy/vnfm/test_tosca_vnf_scale.py View File


tacker/tests/functional/vnfm/test_tosca_vnfc.py → tacker/tests/functional/legacy/vnfm/test_tosca_vnfc.py View File


tacker/tests/functional/vnfm/test_tosca_vnfd.py → tacker/tests/functional/legacy/vnfm/test_tosca_vnfd.py View File


tacker/tests/functional/vnfm/test_vnf.py → tacker/tests/functional/legacy/vnfm/test_vnf.py View File


tacker/tests/functional/vnfm/test_vnf_monitoring.py → tacker/tests/functional/legacy/vnfm/test_vnf_monitoring.py View File


tacker/tests/functional/vnfm/test_vnf_placement_policy.py → tacker/tests/functional/legacy/vnfm/test_vnf_placement_policy.py View File


tacker/tests/functional/vnfm/test_vnfm_param.py → tacker/tests/functional/legacy/vnfm/test_vnfm_param.py View File


+ 0
- 0
tacker/tests/functional/sol/__init__.py View File


+ 0
- 0
tacker/tests/functional/sol/vnflcm/__init__.py View File


tacker/tests/functional/vnflcm/base.py → tacker/tests/functional/sol/vnflcm/base.py View File


tacker/tests/functional/vnflcm/fake_vnflcm.py → tacker/tests/functional/sol/vnflcm/fake_vnflcm.py View File


tacker/tests/functional/vnflcm/fake_vnfpkgm.py → tacker/tests/functional/sol/vnflcm/fake_vnfpkgm.py View File


tacker/tests/functional/vnflcm/test_kubernetes.py → tacker/tests/functional/sol/vnflcm/test_kubernetes.py View File


tacker/tests/functional/vnflcm/test_vnf_instance.py → tacker/tests/functional/sol/vnflcm/test_vnf_instance.py View File


tacker/tests/functional/vnflcm/test_vnf_instance_with_user_data.py → tacker/tests/functional/sol/vnflcm/test_vnf_instance_with_user_data.py View File


+ 0
- 0
tacker/tests/functional/sol/vnfpkgm/__init__.py View File


tacker/tests/functional/vnfpkgm/test_vnf_package.py → tacker/tests/functional/sol/vnfpkgm/test_vnf_package.py View File


+ 0
- 0
tacker/tests/functional/sol_separated_nfvo/__init__.py View File


+ 0
- 0
tacker/tests/functional/sol_separated_nfvo/vnflcm/__init__.py View File


+ 205
- 0
tacker/tests/functional/sol_separated_nfvo/vnflcm/fake_grant.py View File

@ -0,0 +1,205 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
from oslo_serialization import jsonutils
from tacker.tests import uuidsentinel
class Grant:
GRANT_REQ_PATH = '/grant/v1/grants'
ZONES = [
{
"id": uuidsentinel.zone_id,
"zoneId": "nova",
"vimConnectionId": uuidsentinel.vim_connection_id
}
]
ADDITIONAL_PARAMS = {
"key": "value"
}
@staticmethod
def _make_vim_connection_info(tenant_id):
access_info = {
"username": "nfv_user",
"region": "RegionOne",
"password": "devstack",
"tenant": tenant_id
}
return [{
"id": uuidsentinel.vim_connection_id,
"vimType": "ETSINFV.OPENSTACK_KEYSTONE.v_2",
"interfaceInfo": {
"endpoint": "http://127.0.0.1/identity"
},
"accessInfo": access_info
}]
@staticmethod
def _make_add_resources(req_add_resources):
add_resources = []
for req_add_resource in req_add_resources:
res_add_resource = {
"resourceDefinitionId": req_add_resource['id'],
"vimConnectionId": uuidsentinel.vim_connection_id
}
if req_add_resource['type'] == 'COMPUTE':
res_add_resource["zoneId"] = uuidsentinel.zone_id
add_resources.append(res_add_resource)
return add_resources
@staticmethod
def _make_remove_resources(req_remove_resources):
res_remove_resources = []
for req_remove_resource in req_remove_resources:
res_remove_resource = {
"resourceDefinitionId": req_remove_resource['id']
}
res_remove_resources.append(res_remove_resource)
return res_remove_resources
@staticmethod
def _make_vim_assets(image_id, flavour_id="1"):
# set m1.tiny="1" for flavour_id
vim_assets = {
"computeResourceFlavours": [
{
"vimConnectionId": uuidsentinel.vim_connection_id,
"vnfdVirtualComputeDescId": "VDU1",
"vimFlavourId": flavour_id
},
{
"vimConnectionId": uuidsentinel.vim_connection_id,
"vnfdVirtualComputeDescId": "VDU2",
"vimFlavourId": flavour_id
}
],
"softwareImages": [
{
"vimConnectionId": uuidsentinel.vim_connection_id,
"vnfdSoftwareImageId": "VDU1",
"vimSoftwareImageId": image_id
},
{
"vimConnectionId": uuidsentinel.vim_connection_id,
"vnfdSoftwareImageId": "VDU2",
"vimSoftwareImageId": image_id
}
]
}
return vim_assets
@staticmethod
def _make_response_template(request_body):
res = {
"id": uuidsentinel.__getattr__(request_body['vnfLcmOpOccId']),
"vnfInstanceId": request_body['vnfInstanceId'],
"vnfLcmOpOccId": request_body['vnfLcmOpOccId'],
}
res["_links"] = {
"self": {
# set fake server port.
"href": os.path.join(
'http://localhost:9990',
Grant.GRANT_REQ_PATH)},
"vnfLcmOpOcc": {
"href": os.path.join(
'http://localhost:9890/vnflcm/v1/vnf_lcm_op_occs',
request_body['vnfLcmOpOccId'])},
"vnfInstance": {
"href": os.path.join(
'http://localhost:9890/vnflcm/v1/vnf_instances',
request_body['vnfInstanceId'])}}
return res
@staticmethod
def _convert_body_to_dict(body):
if isinstance(body, str):
return jsonutils.loads(body)
return body
@staticmethod
def make_inst_response_body(request_body, tenant_id, image_id):
request_body = Grant._convert_body_to_dict(request_body)
res = Grant._make_response_template(request_body)
res["vimConnections"] = Grant._make_vim_connection_info(tenant_id)
res["zones"] = Grant.ZONES
if 'addResources' in request_body.keys():
res["addResources"] = Grant._make_add_resources(
request_body['addResources'])
res["vimAssets"] = Grant._make_vim_assets(
image_id)
res["additionalParams"] = Grant.ADDITIONAL_PARAMS
return res
@staticmethod
def make_heal_response_body(request_body, tenant_id, image_id):
request_body = Grant._convert_body_to_dict(request_body)
res = Grant._make_response_template(request_body)
res["vimConnections"] = Grant._make_vim_connection_info(tenant_id)
res["zones"] = Grant.ZONES
if 'addResources' in request_body.keys():
res["addResources"] = Grant._make_add_resources(
request_body['addResources'])
if 'removeResources' in request_body.keys():
res["removeResources"] = Grant._make_remove_resources(
request_body['removeResources'])
res["vimAssets"] = Grant._make_vim_assets(image_id)
return res
@staticmethod
def make_scaleout_response_body(request_body, tenant_id, image_id):
request_body = Grant._convert_body_to_dict(request_body)
res = Grant._make_response_template(request_body)
res["vimConnections"] = Grant._make_vim_connection_info(tenant_id)
res["zones"] = Grant.ZONES
if 'addResources' in request_body.keys():
res["addResources"] = Grant._make_add_resources(
request_body['addResources'])
res["vimAssets"] = Grant._make_vim_assets(
image_id)
return res
@staticmethod
def make_scalein_response_body(request_body):
request_body = Grant._convert_body_to_dict(request_body)
res = Grant._make_response_template(request_body)
if 'removeResources' in request_body.keys():
res["removeResources"] = Grant._make_remove_resources(
request_body['removeResources'])
return res
@staticmethod
def make_term_response_body(request_body):
request_body = Grant._convert_body_to_dict(request_body)
res = Grant._make_response_template(request_body)
if 'removeResources' in request_body.keys():
res["removeResources"] = Grant._make_remove_resources(
request_body['removeResources'])
return res

+ 105
- 0
tacker/tests/functional/sol_separated_nfvo/vnflcm/fake_vnfpkgm.py View File

@ -0,0 +1,105 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_utils import uuidutils
class VnfPackage:
VNF_PACKAGE_REQ_PATH = "/vnfpkgm/v1/vnf_packages"
@staticmethod
def make_list_response_body():
return [VnfPackage.make_individual_response]
@staticmethod
def make_individual_response_body(vnfd_id, vnf_package_hash):
add_artifact_hash = (
"6513f21e44aa3da349f248188a44" +
"bc304a3653a04122d8fb4535423c8" +
"e1d14cd6a153f735bb0982e2" +
"161b5b5186106570c17a9" +
"e58b64dd39390617cd5a350f78")
sw_image_hash = (
"6513f21e44aa3da349" +
"f248188a44bc304a3653a04" +
"122d8fb4535423c8e1d14c" +
"d6a153f735bb0982e2161b5" +
"b5186106570c17a9e58b6" +
"4dd39390617cd5a350f78")
data = {
"id": uuidutils.generate_uuid(),
"vnfdId": vnfd_id,
"vnfProvider": "Company",
"vnfProductName": "Sample VNF",
"vnfSoftwareVersion": "1.0",
"vnfdVersion": "1.0",
"checksum": {
"algorithm": "SHA-512",
"hash": vnf_package_hash
},
"softwareImages": [
{
"id": "sw_image",
"name": "cirros-0.4.0-x86_64-disk",
"provider": "Company",
"version": "0.4.0",
"checksum": {
"algorithm": "SHA-512",
"hash": sw_image_hash
},
"containerFormat": "BARE",
"diskFormat": "QCOW2",
"createdAt": "2020-09-01T12:34:56Z",
"minDisk": "2147483648",
"minRam": "268435456",
"size": "1073741824",
"userMetadata": {
"key": "value"
},
"imagePath": "Files/images/cirros-0.4.0-x86_64-disk.img"
}
],
"additionalArtifacts": [
{
"artifactPath":
"Files/images/cirros-0.4.0-x86_64-disk.img",
"checksum": {
"algorithm": "SHA-512",
"hash": add_artifact_hash
},
"metadata": {
"key": "value"
}
}
],
"onboardingState": "ONBOARDED",
"operationalState": "ENABLED",
"usageState": "NOT_IN_USE",
"userDefinedData": {
"key": "value"
},
"_links": {
"self": {
"href": "GetPackage URI"
},
"vnfd": {
"href": "GetVNFD URI"
},
"packageContent": {
"href": "GetPackageContent URI"
}
}
}
return data

+ 316
- 0
tacker/tests/functional/sol_separated_nfvo/vnflcm/test_vnf_instance_with_user_data_nfvo_separate.py View File

@ -0,0 +1,316 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import hashlib
import os
from tacker.tests.functional.sol.vnflcm import base as vnflcm_base
from tacker.tests.functional.sol.vnflcm import fake_vnflcm