tacker/samples/tests/functional/sol_kubernetes_v2/test_cnf_container_update_after/pkggen.py
Ai Hamano dd7d27e325 Create a VNF Package Generation Tool
This patch creates a tool to generate VNF Packages
for the following VIM types.
- ETSINFV.OPENSTACK_KEYSTONE.V_3
- ETSINFV.KUBERNETES.V_1
- ETSINFV.HELM.V_3

Each VNF Package is created based on the following VNF Packages.
- samples/tests/functional/
  - sol_v2_common/userdata_standard
  - sol_kubernetes_v2/test_instantiate_cnf_resources
  - sol_kubernetes_v2/test_helm_instantiate

This patch also refactors pkggen.py, which generates VNF packages
for these FTs, and the associated FTs.

Change-Id: I19fe633ae00f70ddf5fff7223f6bfe2afae80489
2024-09-06 04:34:55 +00:00

42 lines
1.4 KiB
Python

# Copyright (C) 2023 Fujitsu
# All Rights Reserved.
#
# 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 json
import os
import shutil
import tempfile
from oslo_utils import uuidutils
from tacker.tests.functional.sol_kubernetes_v2 import paramgen
from tacker.tests.functional.sol_v2_common import utils as common_utils
from tacker.tests import utils
zip_file_name = os.path.basename(os.path.abspath(".")) + '.zip'
tmp_dir = tempfile.mkdtemp()
vnfd_id = uuidutils.generate_uuid()
mgmt_driver_path = utils.mgmt_drivers("container_update_mgmt_v2.py")
common_utils.make_zip(".", tmp_dir, vnfd_id, mgmt_driver=mgmt_driver_path)
shutil.move(os.path.join(tmp_dir, zip_file_name), ".")
shutil.rmtree(tmp_dir)
cnf_modify_update_req = paramgen.test_cnf_update_modify(vnfd_id)
with open("cnf_modify_update_req", "w", encoding='utf-8') as f:
f.write(json.dumps(cnf_modify_update_req, indent=2))