Kolla AnsibleでTackerをインストール

# 環境

* Tackerをインストールする環境
    * OpenStack上のVM
        * OpenStackの構築に関しては以下記事を参照（**ただし、以下の作業記録にはHeatのインストールは含まれない**）
            * https://qiita.com/nakkoh/items/cdc0912e7d8b0f1088b7
    * OS: Centos 8.5
    * プロキシ環境

# 作業ログ

公式ドキュメントに沿ってインストールする。
https://docs.openstack.org/tacker/latest/install/kolla.html

## 事前準備

dnfのプロキシ設定

```
[centos@tacker ~]$ sudo vi /etc/dnf/dnf.conf
[centos@tacker ~]$ cat /etc/dnf/dnf.conf 
[main]

...

proxy=http://172.16.184.1:63128/
```

git, vimのインストール

```
[centos@tacker ~]$ sudo  dnf install git vim

...

Complete!
```

SELinuxの無効化。

```
[centos@tacker kolla-ansible]$  sudo setenforce 0
[centos@tacker kolla-ansible]$ getenforce
Permissive
[centos@tacker kolla-ansible]$ sudo vim /etc/selinux/config
[centos@tacker kolla-ansible]$ cat /etc/selinux/config 

...

SELINUX=disabled

...

```

## Kola Ansibleのインストール

```
[centos@tacker ~]$ https_proxy=http://172.16.184.1:63128/ git clone https://github.com/openstack/kolla-ansible.git -b stable/ussuri
Cloning into 'kolla-ansible'...
remote: Enumerating objects: 135539, done.
remote: Counting objects: 100% (13547/13547), done.
remote: Compressing objects: 100% (4693/4693), done.
remote: Total 135539 (delta 8350), reused 12532 (delta 7814), pack-reused 121992
Receiving objects: 100% (135539/135539), 24.25 MiB | 8.91 MiB/s, done.
Resolving deltas: 100% (89055/89055), done.
[centos@tacker ~]$ cd kolla-ansible/
[centos@tacker kolla-ansible]$ sudo dnf install python3-devel libffi-devel gcc openssl-devel python3-libselinux

...

[centos@tacker kolla-ansible]$ sudo pip3 install --proxy=http://172.16.184.1:63128/ -r requirements.txt

...

[centos@tacker kolla-ansible]$ sudo python3 setup.py install

...

[centos@tacker kolla-ansible]$ sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
[centos@tacker kolla-ansible]$ sudo dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm

...

Complete!
[centos@tacker kolla-ansible]$ sudo dnf install docker-ce docker-ce-cli

...

Complete!
[centos@tacker kolla-ansible]$ sudo systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
[centos@tacker kolla-ansible]$ sudo systemctl restart docker
[centos@tacker kolla-ansible]$ sudo pip3 install --proxy=http://172.16.184.1:63128/ 'ansible<2.10'

...

Successfully installed ansible-2.9.27
[centos@tacker kolla-ansible]$ sudo pip3 install docker --proxy=http://172.16.184.1:63128/

...

Successfully installed docker-5.0.3 websocket-client-1.2.3
```

`centos`ユーザーで`docker`コマンドを実行できるようにする。

```
[centos@tacker kolla-ansible]$ sudo usermod -g docker cento

（ログインし直す）

[centos@tacker kolla-ansible]$ docker version
Client: Docker Engine - Community
 Version:           20.10.12

...

```

dockerのプロキシ設定

```
[centos@tacker kolla-ansible]$ sudo mkdir /etc/systemd/system/docker.service.d
[centos@tacker kolla-ansible]$ http_proxy=http://172.16.184.1:63128/
[centos@tacker kolla-ansible]$ cat <<EOF | sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf
> [Service]
> Environment="HTTP_PROXY=${http_proxy}"
> Environment="HTTPS_PROXY=${http_proxy}"
> EOF
[Service]
Environment="HTTP_PROXY=http://172.16.184.1:63128/"
Environment="HTTPS_PROXY=http://172.16.184.1:63128/"
[centos@tacker kolla-ansible]$ sudo systemctl daemon-reload
[centos@tacker kolla-ansible]$ sudo systemctl restart docker.service
[centos@tacker kolla-ansible]$ docker info |grep -i proxy
 HTTP Proxy: http://172.16.184.1:63128/
 HTTPS Proxy: http://172.16.184.1:63128/
[centos@tacker kolla-ansible]$ docker pull nginx
Using default tag: latest

...

Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
```

## Tackerのインストール

```
[centos@tacker kolla-ansible]$ sudo mkdir /etc/kolla
[centos@tacker kolla-ansible]$ cp etc/kolla/globals.yml /etc/kolla/
[centos@tacker kolla-ansible]$ sudo cp etc/kolla/globals.yml /etc/kolla/
[centos@tacker kolla-ansible]$ sudo vim /etc/kolla/globals.yml 
[centos@tacker kolla-ansible]$ diff etc/kolla/globals.yml /etc/kolla/globals.yml 
34c34
< #kolla_install_type: "binary"
---
> kolla_install_type: "source"
53c53
< #kolla_internal_vip_address: "10.10.10.254"
---
> kolla_internal_vip_address: "10.0.0.178"
85c85
< #docker_namespace: "kolla"
---
> docker_namespace: "kolla"
243,244c243,244
< #enable_glance: "{{ enable_openstack_core | bool }}"
< #enable_haproxy: "yes"
---
> enable_glance: "no"
> enable_haproxy: "no"
246,250c246,250
< #enable_keystone: "{{ enable_openstack_core | bool }}"
< #enable_mariadb: "yes"
< #enable_memcached: "yes"
< #enable_neutron: "{{ enable_openstack_core | bool }}"
< #enable_nova: "{{ enable_openstack_core | bool }}"
---
> enable_keystone: "yes"
> enable_mariadb: "yes"
> enable_memcached: "yes"
> enable_neutron: "no"
> enable_nova: "no"
256c256
< #enable_barbican: "no"
---
> enable_barbican: "yes"
284,285c284,285
< #enable_heat: "{{ enable_openstack_core | bool }}"
< #enable_horizon: "{{ enable_openstack_core | bool }}"
---
> enable_heat: "no"
> enable_horizon: "yes"
308c308
< #enable_horizon_tacker: "{{ enable_tacker | bool }}"
---
> enable_horizon_tacker: "{{ enable_tacker | bool }}"
332c332
< #enable_mistral: "no"
---
> enable_mistral: "yes"
353c353
< #enable_openvswitch: "{{ enable_neutron | bool and neutron_plugin_agent != 'linuxbridge' }}"
---
> enable_openvswitch: "no"
372c372
< #enable_tacker: "no"
---
> enable_tacker: "yes"
[centos@tacker kolla-ansible]$ sudo cp etc/kolla/passwords.yml /etc/kolla/passwords.yml
[centos@tacker kolla-ansible]$ sudo kolla-genpwd
sudo: kolla-genpwd: command not found
```

`kolla-genpwd`コマンドがない。

```
[centos@tacker kolla-ansible]$ which kolla-genpwd
/usr/local/bin/kolla-genpwd
[centos@tacker kolla-ansible]$ sudo -i
[root@tacker ~]# echo $PATH
/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
```

パスが通ってないので、パス指定でコマンドを実行。

```
[centos@tacker kolla-ansible]$ sudo /usr/local/bin/kolla-genpwd
[centos@tacker kolla-ansible]$ ll /etc/kolla/passwords.yml 
-rw-r--r--. 1 root root 25608 Jan 27 08:58 /etc/kolla/passwords.yml
[centos@tacker kolla-ansible]$ sudo kolla-ansible deploy
sudo: kolla-ansible: command not found
[centos@tacker kolla-ansible]$ which kolla-ansible
/usr/local/bin/kolla-ansible
[centos@tacker kolla-ansible]$ sudo /usr/local/bin/kolla-ansible deploy
which: no ansible in (/sbin:/bin:/usr/sbin:/usr/bin)
ERROR: Ansible is not installed in the current (virtual) environment.
[centos@tacker kolla-ansible]$ pip3 list |grep ansible
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
ansible (2.9.27)
kolla-ansible (10.4.1.dev11)
[centos@tacker kolla-ansible]$ ansible --version
ansible 2.9.27
  config file = None
  configured module search path = ['/home/centos/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.8 (default, Sep 10 2021, 09:13:53) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
[centos@tacker kolla-ansible]$ sudo ansible --version
sudo: ansible: command not found
[centos@tacker kolla-ansible]$ which ansible
/usr/local/bin/ansible
```

また、`/usr/local/bin`のパスだよ。
パスを通してから再実行する。

```
[centos@tacker kolla-ansible]$ sudo -i
[root@tacker ~]# vim ~/.bash_profile

...

PATH=$PATH:/usr/local/bin

export PATH
[root@tacker ~]# source ~/.bash_profile 
[root@tacker ~]# ansible --version
ansible 2.9.27
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.8 (default, Sep 10 2021, 09:13:53) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
[root@tacker ~]# kolla-ansible deploy

...

PLAY RECAP **************************************************************************************************************************************************
localhost                  : ok=174  changed=114  unreachable=0    failed=0    skipped=73   rescued=0    ignored=1
[root@tacker ~]# kolla-ansible post-deploy
Post-Deploying Playbooks : ansible-playbook -i /usr/local/share/kolla-ansible/ansible/inventory/all-in-one -e @/etc/kolla/globals.yml -e @/etc/kolla/passwords.yml -e CONFIG_DIR=/etc/kolla  /usr/local/share/kolla-ansible/ansible/post-deploy.yml 
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details

PLAY [Creating admin openrc file on the deploy node] ********************************************************************************************************

TASK [Gathering Facts] **************************************************************************************************************************************
ok: [localhost]

TASK [Template out admin-openrc.sh] *************************************************************************************************************************
changed: [localhost]

PLAY RECAP **************************************************************************************************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
[root@tacker ~]# exit
logout
[centos@tacker kolla-ansible]$ docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Names}}"
CONTAINER ID   IMAGE                                                   NAMES
9181eb900cac   kolla/centos-source-tacker-server:ussuri                tacker_server
6ead9905b4e1   kolla/centos-source-tacker-conductor:ussuri             tacker_conductor
60d6a3f14b08   kolla/centos-source-barbican-worker:ussuri              barbican_worker
398bea45971a   kolla/centos-source-barbican-keystone-listener:ussuri   barbican_keystone_listener
c75958b3b311   kolla/centos-source-barbican-api:ussuri                 barbican_api
bc100870eb12   kolla/centos-source-mistral-executor:ussuri             mistral_executor
03e5e3518985   kolla/centos-source-mistral-event-engine:ussuri         mistral_event_engine
32574b4a291d   kolla/centos-source-mistral-engine:ussuri               mistral_engine
18be2c380d3b   kolla/centos-source-mistral-api:ussuri                  mistral_api
a29f30e7c8b2   kolla/centos-source-horizon:ussuri                      horizon
3898d6a95aa4   kolla/centos-source-keystone:ussuri                     keystone
0539385c9b2e   kolla/centos-source-keystone-fernet:ussuri              keystone_fernet
d9f9ef659290   kolla/centos-source-keystone-ssh:ussuri                 keystone_ssh
b89842f6a049   kolla/centos-source-rabbitmq:ussuri                     rabbitmq
9ee358042057   kolla/centos-source-memcached:ussuri                    memcached
ebbdbe943859   kolla/centos-source-mariadb:ussuri                      mariadb
404c54bfc286   kolla/centos-source-chrony:ussuri                       chrony
37655e2fc5c2   kolla/centos-source-cron:ussuri                         cron
e6091f24c142   kolla/centos-source-kolla-toolbox:ussuri                kolla_toolbox
597e5bd0cbd6   kolla/centos-source-fluentd:ussuri                      fluentd
[centos@tacker kolla-ansible]$ sudo pip3 install python-tackerclient --proxy=http://172.16.184.1:63128/

...

Successfully installed appdirs-1.4.4 attrs-21.4.0 autopage-0.5.0 cliff-3.10.0 cmd2-2.3.3 decorator-5.1.1 dogpile.cache-1.1.5 keystoneauth1-4.4.0 msgpack-1.0.3 munch-2.5.0 openstacksdk-0.61.0 os-service-types-1.7.0 osc-lib-2.4.2 oslo.context-3.4.0 oslo.log-4.6.1 oslo.serialization-4.2.0 pyinotify-0.9.6 pyperclip-1.8.2 python-dateutil-2.8.2 python-keystoneclient-4.4.0 python-tackerclient-1.9.0 requestsexceptions-1.4.0 simplejson-3.17.6 wcwidth-0.2.5
[centos@tacker kolla-ansible]$ sudo pip3 install python-openstackclient --proxy=http://172.16.184.1:63128/

...

Successfully installed certifi-2021.10.8 charset-normalizer-2.0.10 python-cinderclient-8.2.0 python-novaclient-17.6.0 python-openstackclient-5.7.0 requests-2.27.1

[centos@tacker kolla-ansible]$ sudo cat /etc/kolla/admin-openrc.sh > /tmp/admin-openrc.sh
[centos@tacker kolla-ansible]$ . /tmp/admin-openrc.sh
[centos@tacker kolla-ansible]$ openstack vim list

```

## OpenStack VIMの登録

Tackerが動作するOpenStackをVIMとして登録する。
OpenStackのアクセス情報を`vim_config.yaml`に指定する。

```
[centos@tacker ~]$ vim ./vim_config.yaml
[centos@tacker ~]$ cat ./vim_config.yaml 
auth_url: 'http://172.16.183.2:5000/v3'
username: 'admin'
password: '40f579a20797456d'
project_name: 'admin'
project_domain_name: 'Default'
user_domain_name: 'Default'
```

Tackerの方のOpenStackコマンドでVIMを登録する。

```
[centos@tacker ~]$ source /tmp/admin-openrc.sh
[centos@tacker ~]$ openstack vim register \
>     --config-file ./vim_config.yaml \
>     --is-default --fit-width openstack-admin-vim
+----------------+------------------------------------------------+
| Field          | Value                                          |
+----------------+------------------------------------------------+
| auth_cred      | {                                              |
|                |     "username": "admin",                       |
|                |     "user_domain_name": "Default",             |
|                |     "cert_verify": "True",                     |
|                |     "project_id": null,                        |
|                |     "project_name": "admin",                   |
|                |     "project_domain_name": "Default",          |
|                |     "auth_url": "http://172.16.183.2:5000/v3", |
|                |     "key_type": "barbican_key",                |
|                |     "secret_uuid": "***",                      |
|                |     "password": "***"                          |
|                | }                                              |
| auth_url       | http://172.16.183.2:5000/v3                    |
| created_at     | 2022-01-28 08:31:57.393679                     |
| description    |                                                |
| id             | 9564d5fb-03b9-4486-82d5-831cba1e6288           |
| is_default     | True                                           |
| name           | openstack-admin-vim                            |
| placement_attr | {                                              |
|                |     "regions": [                               |
|                |         "RegionOne"                            |
|                |     ]                                          |
|                | }                                              |
| project_id     | 92c7420e81e641a696b72eb7aa67fa12               |
| status         | PENDING                                        |
| type           | openstack                                      |
| updated_at     | None                                           |
| vim_project    | {                                              |
|                |     "name": "admin",                           |
|                |     "project_domain_name": "Default"           |
|                | }                                              |
+----------------+------------------------------------------------+
[centos@tacker ~]$ openstack vim list
+--------------------------------------+---------------------+----------------------------------+-----------+------------+-----------+
| ID                                   | Name                | Tenant_id                        | Type      | Is Default | Status    |
+--------------------------------------+---------------------+----------------------------------+-----------+------------+-----------+
| 9564d5fb-03b9-4486-82d5-831cba1e6288 | openstack-admin-vim | 92c7420e81e641a696b72eb7aa67fa12 | openstack | True       | REACHABLE |
+--------------------------------------+---------------------+----------------------------------+-----------+------------+-----------+
```

## VNFパッケージの作成とアップロード

* VNFパッケージ
    * VNFD、VMのイメージ、スクリプト、定義ファイルをパッケージングしたzipファイルのこと
* VNFD(VNF Descriptor)
    * TOSCAで定義されたVNFのトポロジに対して、どのようにデプロイやオペレーションするかを定義したもの
* TOSCA(Topology and Orchestration Specification for Cloud Applications)
    * クラウド上に展開されるシステム構成（トポロジ）を定義したもの
    * TOSCAを使用することで、異なるベンダ間のクラウドアプリケーションおよびサービスをスムーズに導入でき、多種多様なクラウドをまたがったアプリケーションの可搬性を確保し、システムの移行や連携を容易にできるメリットが得られる

参考
* https://docs.openstack.org/tacker/latest/user/vnf-package.html
* https://thinkit.co.jp/article/9767

CSARのディレクトリを作成。

```
[centos@tacker ~]$ mkdir -p ./sample_vnf_package_csar/TOSCA-Metadata \
>     ./sample_vnf_package_csar/Definitions \
>     ./sample_vnf_package_csar/Files
```

userdataを使用するときは、以下のディレクトリも必要なので一応つくっておく。

```
[centos@tacker ~]$ mkdir -p ./sample_vnf_package_csar/BaseHOT/simple \
>     ./sample_vnf_package_csar/UserData
```

`TOSCA.meta`を作成する。

```
[centos@tacker ~]$ cat <<EOF > ./sample_vnf_package_csar/TOSCA-Metadata/TOSCA.meta
> TOSCA-Meta-File-Version: 1.0
> Created-by: Dummy User
> CSAR-Version: 1.1
> Entry-Definitions: Definitions/sample_vnfd_top.yaml
> EOF
```

ETSI定義ファイルをダウンロード。
ETSIとは、European Telecommunications Standards Institute（欧州電気通信標準化機構）のことで、NFVアーキテクチャのリファレンスモデルを確立した団体のようである。
https://www.etsi.org/technologies/nfv

```
[centos@tacker ~]$ export TOSCA_VERSION=v2.6.1
[centos@tacker ~]$ cd ./sample_vnf_package_csar/Definitions
[centos@tacker Definitions]$ https_proxy=http://172.16.183.1:63128/ curl -O https://forge.etsi.org/rep/nfv/SOL001/raw/${TOSCA_VERSION}/etsi_nfv_sol001_common
_types.yaml

...

[centos@tacker Definitions]$ https_proxy=http://172.16.183.1:63128/ curl -O https://forge.etsi.org/rep/nfv/SOL001/raw/${TOSCA_VERSION}/etsi_nfv_sol001_vnfd_types.yaml

...

[centos@tacker Definitions]$ ls
etsi_nfv_sol001_common_types.yaml  etsi_nfv_sol001_vnfd_types.yaml
```

VNFDファイルを作成する。

```
[centos@tacker Definitions]$ cat <<EOF > sample_vnfd_top.yaml
> tosca_definitions_version: tosca_simple_yaml_1_2
> 
> description: Sample VNF
> 
> imports:
>  - etsi_nfv_sol001_common_types.yaml
>  - etsi_nfv_sol001_vnfd_types.yaml
>  - sample_vnfd_types.yaml
>  - sample_vnfd_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-4840d70a1177
>        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
> EOF
[centos@tacker Definitions]$ cat <<EOF > sample_vnfd_types.yaml
> 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:
>      id:
>        type: string
>        description: ID of this VNF
>        default: vnf_id
>      vendor:
>        type: string
>        description: name of the vendor who generate this VNF
>        default: vendor
>      version:
>        type: version
>        description: version of the software for this VNF
>        default: 1.0
>      descriptor_id:
>        type: string
>        constraints: [ valid_values: [ b1bb0ce7-ebca-4fa7-95ed-4840d70a1177 ] ]
>        default: b1bb0ce7-ebca-4fa7-95ed-4840d70a1177
>      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: This is the default flavour description
>    requirements:
>      - virtual_link_internal:
>          capability: tosca.capabilities.nfv.VirtualLinkable
>    interfaces:
>      Vnflcm:
>        type: tosca.interfaces.nfv.Vnflcm
> EOF
[centos@tacker Definitions]$ cat <<EOF > sample_vnfd_df_simple.yaml
> 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
>  - sample_vnfd_types.yaml
> 
> topology_template:
>  inputs:
>    id:
>      type: string
>    vendor:
>      type: string
>    version:
>      type: version
>    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_external: []
> 
>  node_templates:
>    VNF:
>      type: company.provider.VNF
>      properties:
>        flavour_description: A simple flavour
>      interfaces:
>        Vnflcm:
>          # supporting only 'instantiate', 'terminate', 'modify',
>          # and 'heal'
>          # not supporting LCM script, supporting only default LCM
>          instantiate: []
>          # instantiate_start: []
>          # instantiate_end: []
>          terminate: []
>          # terminate_start: []
>          # terminate_end: []
>          modify_information: []
>          # modify_information_start: []
>          # modify_information_end: []
>          # change_flavour: []
>          # change_flavour_start: []
>          # change_flavour_end: []
>          # change_external_connectivity: []
>          # change_external_connectivity_start: []
>          # change_external_connectivity_end: []
>          # operate: []
>          # operate_start: []
>          # operate_end: []
>          heal: []
>          # heal_start: []
>          # heal_end: []
>          # scale: []
>          # scale_start: []
>          # scale_end: []
>          # scale_to_level: []
>          # scale_to_level_start: []
>          # scale_to_level_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: 1
>        sw_image_data:
>          name: cirros-0.5.2-x86_64-disk
>          version: '0.5.2'
>          checksum:
>            algorithm: sha-256
>            hash: 8c7ecf5bd9a5a672a9f688b8fbf9dc6f032084bf54cc83716850b5e3ea164aa2
>          container_format: bare
>          disk_format: qcow2
>          min_disk: 1 GB
>          size: 1 GB
> 
>      capabilities:
>        virtual_compute:
>          properties:
>            virtual_memory:
>              virtual_mem_size: 512 MB
>            virtual_cpu:
>              num_virtual_cpu: 1
>            virtual_local_storage:
>              - size_of_storage: 1 GB
> 
>    CP1:
>      type: tosca.nodes.nfv.VduCp
>      properties:
>        layer_protocols: [ ipv4 ]
>      requirements:
>        - virtual_binding: VDU1
>        - virtual_link: internalVL1
> 
>    internalVL1:
>      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: 10.1.0.0/24
> EOF
[centos@tacker Definitions]$ ls
etsi_nfv_sol001_common_types.yaml  etsi_nfv_sol001_vnfd_types.yaml  sample_vnfd_df_simple.yaml  sample_vnfd_top.yaml  sample_vnfd_types.yaml
```

BaseHOTファイルを作成。

```
[centos@tacker Definitions]$ cd -
/home/centos
[centos@tacker ~]$ cat <<EOF > ./sample_vnf_package_csar/BaseHOT/simple/sample_lcm_with_user_data_hot.yaml
> heat_template_version: 2013-05-23
> description: 'Template for test _generate_hot_from_tosca().'
> 
> parameters:
>   nfv:
>     type: json
> 
> resources:
>   VDU1:
>     type: OS::Nova::Server
>     properties:
>       flavor:
>         get_resource: VDU1_flavor
>       name: VDU1
>       image: { get_param: [ nfv, VDU, VDU1, image ] }
>       networks:
>       - port:
>           get_resource: CP1
> 
>   CP1:
>     type: OS::Neutron::Port
>     properties:
>       network: { get_param: [ nfv, CP, CP1, network ] }
> 
>   VDU1_flavor:
>     type: OS::Nova::Flavor
>     properties:
>       ram: { get_param: [ nfv, VDU, VDU1, flavor, ram ] }
>       vcpus: { get_param: [ nfv, VDU, VDU1, flavor, vcpus ] }
>       disk: { get_param: [ nfv, VDU, VDU1, flavor, disk ] }
> 
> outputs: {}
> EOF
```

手順にはないが、`./sample_vnf_package_csar/Files/images`にイメージをダウンロードする必要があるようである。

```
[centos@tacker sample_vnf_package_csar]$ mkdir Files/images
[centos@tacker sample_vnf_package_csar]$ http_proxy=http://172.16.183.1:63128/ curl -o sample_vnf_package_csar/Files/images/cirros-0.5.2-x86_64-disk.img http://download.cirros-cloud.net/0.5.2/cirros-0.5.2-x86_64-disk.img
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   273  100   273    0     0   266k      0 --:--:-- --:--:-- --:--:--  266k
```


VNF Package CSARをzipファイルに圧縮。

```
[centos@tacker ~]$ cd ./sample_vnf_package_csar
[centos@tacker sample_vnf_package_csar]$ tree
.
├── BaseHOT
│   └── simple
│       └── sample_lcm_with_user_data_hot.yaml
├── Definitions
│   ├── etsi_nfv_sol001_common_types.yaml
│   ├── etsi_nfv_sol001_vnfd_types.yaml
│   ├── sample_vnfd_df_simple.yaml
│   ├── sample_vnfd_top.yaml
│   └── sample_vnfd_types.yaml
├── Files
│   └── images
│       └── cirros-0.5.2-x86_64-disk.img
├── TOSCA-Metadata
│   └── TOSCA.meta
└── UserData

7 directories, 8 files
[centos@tacker sample_vnf_package_csar]$ zip sample_vnf_package_csar.zip -r Definitions/ Files/ TOSCA-Metadata/
-bash: zip: command not found
[centos@tacker sample_vnf_package_csar]$ sudo dnf install zip

...

Complete!
[centos@tacker sample_vnf_package_csar]$ zip sample_vnf_package_csar.zip -r Definitions/ Files/ TOSCA-Metadata/ BaseHOT/
  adding: Definitions/ (stored 0%)
  adding: Definitions/etsi_nfv_sol001_common_types.yaml (deflated 76%)
  adding: Definitions/etsi_nfv_sol001_vnfd_types.yaml (deflated 83%)
  adding: Definitions/sample_vnfd_top.yaml (deflated 53%)
  adding: Definitions/sample_vnfd_types.yaml (deflated 70%)
  adding: Definitions/sample_vnfd_df_simple.yaml (deflated 69%)
  adding: Files/ (stored 0%)
  adding: Files/images/ (stored 0%)
  adding: Files/images/cirros-0.5.2-x86_64-disk.img (deflated 22%)
  adding: TOSCA-Metadata/ (stored 0%)
  adding: TOSCA-Metadata/TOSCA.meta (deflated 16%)
  adding: BaseHOT/ (stored 0%)
  adding: BaseHOT/simple/ (stored 0%)
  adding: BaseHOT/simple/sample_lcm_with_user_data_hot.yaml (deflated 58%)
[centos@tacker sample_vnf_package_csar]$ ls
BaseHOT  Definitions  Files  sample_vnf_package_csar.zip  TOSCA-Metadata  UserData
```

VNFパッケージを作成する。

```
[centos@tacker sample_vnf_package_csar]$ cd
[centos@tacker ~]$ openstack vnf package create --fit-width
Missing value auth-url required for auth plugin password
[centos@tacker ~]$ source /tmp/admin-openrc.sh
[centos@tacker ~]$ openstack vnf package create --fit-width
+-------------------+-------------------------------------------------------------------------------------------------+
| Field             | Value                                                                                           |
+-------------------+-------------------------------------------------------------------------------------------------+
| ID                | 04bda2ca-3f46-44d1-9487-aa3e86dd0cf1                                                            |
| Links             | {                                                                                               |
|                   |     "self": {                                                                                   |
|                   |         "href": "/vnfpkgm/v1/vnf_packages/04bda2ca-3f46-44d1-9487-aa3e86dd0cf1"                 |
|                   |     },                                                                                          |
|                   |     "packageContent": {                                                                         |
|                   |         "href": "/vnfpkgm/v1/vnf_packages/04bda2ca-3f46-44d1-9487-aa3e86dd0cf1/package_content" |
|                   |     }                                                                                           |
|                   | }                                                                                               |
| Onboarding State  | CREATED                                                                                         |
| Operational State | DISABLED                                                                                        |
| Usage State       | NOT_IN_USE                                                                                      |
| User Defined Data | {}                                                                                              |
+-------------------+-------------------------------------------------------------------------------------------------+
```

VNFパッケージのアップロード

```
[centos@tacker ~]$ openstack vnf package upload \
> --path ./sample_vnf_package_csar/sample_vnf_package_csar.zip \
> 04bda2ca-3f46-44d1-9487-aa3e86dd0cf1
Upload request for VNF package 04bda2ca-3f46-44d1-9487-aa3e86dd0cf1 has been accepted.
```

VNFパッケージの確認

```
[centos@tacker ~]$ openstack vnf package list
+--------------------------------------+------------------+------------------+-------------+-------------------+-------------------------------------------------------------------------------------------------+
| Id                                   | Vnf Product Name | Onboarding State | Usage State | Operational State | Links                                                                                           |
+--------------------------------------+------------------+------------------+-------------+-------------------+-------------------------------------------------------------------------------------------------+
| 04bda2ca-3f46-44d1-9487-aa3e86dd0cf1 |                  | CREATED          | NOT_IN_USE  | DISABLED          | {                                                                                               |
|                                      |                  |                  |             |                   |     "self": {                                                                                   |
|                                      |                  |                  |             |                   |         "href": "/vnfpkgm/v1/vnf_packages/04bda2ca-3f46-44d1-9487-aa3e86dd0cf1"                 |
|                                      |                  |                  |             |                   |     },                                                                                          |
|                                      |                  |                  |             |                   |     "packageContent": {                                                                         |
|                                      |                  |                  |             |                   |         "href": "/vnfpkgm/v1/vnf_packages/04bda2ca-3f46-44d1-9487-aa3e86dd0cf1/package_content" |
|                                      |                  |                  |             |                   |     }                                                                                           |
|                                      |                  |                  |             |                   | }                                                                                               |
+--------------------------------------+------------------+------------------+-------------+-------------------+-------------------------------------------------------------------------------------------------+
```

以下のドキュメントの出力例と`Vnf Product Name`, `Onboarding State`, `Operational State`が異なっている。

```
$ openstack vnf package list 
+--------------------------------------+------------------+------------------+-------------+-------------------+
| Id                                   | Vnf Product Name | Onboarding State | Usage State | Operational State |
+--------------------------------------+------------------+------------------+-------------+-------------------+
| e712a702-741f-4093-a971-b3ad69411ac1 | Sample VNF       | ONBOARDED        | NOT_IN_USE  | ENABLED           |
+--------------------------------------+------------------+------------------+-------------+-------------------+
```

tacker_serverの`kolla/tacker/tacker-conductor.log`を確認したところ、以下のエラーメッセージが見つかった。

```
2022-02-01 05:17:03.503 7 ERROR oslo_messaging.rpc.server The input "/var/lib/tacker/vnfpackages/04bda2ca-3f46-44d1-9487-aa3e86dd0cf1.zip" failed validation with the following error(s): 
2022-02-01 05:17:03.503 7 ERROR oslo_messaging.rpc.server 
2022-02-01 05:17:03.503 7 ERROR oslo_messaging.rpc.server       URLException: Failed to reach server "https://forge.etsi.org/rep/nfv/SOL001/raw/v2.6.1/etsi_nfv_sol001_common_types.yaml". Reason is: [Errno -2] Name or service not known.
```

プロキシ環境のため、外に出られずエラーになっていた。
アップロードしたVNFパッケージのバリデーションのため、外と通信しにいったのかな？

kolla ansibleでプロキシ設定する方法が見つからなかったため、dockerにプロキシを設定する。

```
[root@tacker ~]# mkdir .docker
[root@tacker ~]# cat <<EOF > .docker/config.json
> {
>  "proxies":
>  {
>    "default":
>    {
>      "httpProxy": "http://172.16.183.1:63128/",
>      "httpsProxy": "http://172.16.183.1:63128/",
>      "noProxy": "localhost,127.0.0.1,10.0.0.178,172.16.183.2"
>    }
>  }
> }
> EOF
```

Tackerを再デプロイする。

```
[root@tacker ~]# docker rm -f tacker_server
tacker_server
[root@tacker ~]# docker rm -f tacker_conductor
tacker_conductor
[root@tacker ~]# kolla-ansible deploy

...

PLAY RECAP **************************************************************************************************************************************************
localhost                  : ok=143  changed=9    unreachable=0    failed=0    skipped=71   rescued=0    ignored=0   

[root@tacker ~]# docker exec tacker_server env |grep -i proxy
http_proxy=http://172.16.183.1:63128/
HTTP_PROXY=http://172.16.183.1:63128/
https_proxy=http://172.16.183.1:63128/
HTTPS_PROXY=http://172.16.183.1:63128/
no_proxy=localhost,127.0.0.1,10.0.0.178,172.16.183.2
NO_PROXY=localhost,127.0.0.1,10.0.0.178,172.16.183.2
[root@tacker ~]# docker exec tacker_conductor env |grep -i proxy
http_proxy=http://172.16.183.1:63128/
HTTP_PROXY=http://172.16.183.1:63128/
https_proxy=http://172.16.183.1:63128/
HTTPS_PROXY=http://172.16.183.1:63128/
no_proxy=localhost,127.0.0.1,10.0.0.178,172.16.183.2
NO_PROXY=localhost,127.0.0.1,10.0.0.178,172.16.183.2
```

tackerのコンテナにプロキシが設定されていることを確認できた。
VNFパッケージを再作成する。

```
[centos@tacker ~]$ openstack vnf package create --fit-width
+-------------------+-------------------------------------------------------------------------------------------------+
| Field             | Value                                                                                           |
+-------------------+-------------------------------------------------------------------------------------------------+
| ID                | 756992f4-530b-4114-a001-10e70fc2209e                                                            |
| Links             | {                                                                                               |
|                   |     "self": {                                                                                   |
|                   |         "href": "/vnfpkgm/v1/vnf_packages/756992f4-530b-4114-a001-10e70fc2209e"                 |
|                   |     },                                                                                          |
|                   |     "packageContent": {                                                                         |
|                   |         "href": "/vnfpkgm/v1/vnf_packages/756992f4-530b-4114-a001-10e70fc2209e/package_content" |
|                   |     }                                                                                           |
|                   | }                                                                                               |
| Onboarding State  | CREATED                                                                                         |
| Operational State | DISABLED                                                                                        |
| Usage State       | NOT_IN_USE                                                                                      |
| User Defined Data | {}                                                                                              |
+-------------------+-------------------------------------------------------------------------------------------------+
[centos@tacker ~]$ openstack vnf package upload \
> --path ./sample_vnf_package_csar/sample_vnf_package_csar.zip \
> 756992f4-530b-4114-a001-10e70fc2209e
Upload request for VNF package 756992f4-530b-4114-a001-10e70fc2209e has been accepted.
[centos@tacker ~]$ openstack vnf package list
+--------------------------------------+------------------+------------------+-------------+-------------------+-------------------------------------------------------------------------------------------------+
| Id                                   | Vnf Product Name | Onboarding State | Usage State | Operational State | Links                                                                                           |
+--------------------------------------+------------------+------------------+-------------+-------------------+-------------------------------------------------------------------------------------------------+
| 756992f4-530b-4114-a001-10e70fc2209e | Sample VNF       | ONBOARDED        | NOT_IN_USE  | ENABLED           | {                                                                                               |
|                                      |                  |                  |             |                   |     "self": {                                                                                   |
|                                      |                  |                  |             |                   |         "href": "/vnfpkgm/v1/vnf_packages/756992f4-530b-4114-a001-10e70fc2209e"                 |
|                                      |                  |                  |             |                   |     },                                                                                          |
|                                      |                  |                  |             |                   |     "packageContent": {                                                                         |
|                                      |                  |                  |             |                   |         "href": "/vnfpkgm/v1/vnf_packages/756992f4-530b-4114-a001-10e70fc2209e/package_content" |
|                                      |                  |                  |             |                   |     }                                                                                           |
|                                      |                  |                  |             |                   | }                                                                                               |
+--------------------------------------+------------------+------------------+-------------+-------------------+-------------------------------------------------------------------------------------------------+
```


`Onboarding State`が`ONBOARDED`、`Operational State`が`ENABLED`になったので、うまくいったようである。

## VNFの作成

VNFD IDの確認

```
[centos@tacker ~]$ openstack vnf package show \
> 756992f4-530b-4114-a001-10e70fc2209e -c 'VNFD ID'
+---------+--------------------------------------+
| Field   | Value                                |
+---------+--------------------------------------+
| VNFD ID | b1bb0ce7-ebca-4fa7-95ed-4840d70a1177 |
+---------+--------------------------------------+
```

```
[centos@tacker ~]$ openstack vnflcm create \
> b1bb0ce7-ebca-4fa7-95ed-4840d70a1177 --fit-width
+-----------------------------+---------------------------------------------------------------------------------------------+
| Field                       | Value                                                                                       |
+-----------------------------+---------------------------------------------------------------------------------------------+
| ID                          | ebd84c1e-83f2-41e7-bb0b-c0b0628ef07e                                                        |
| Instantiation State         | NOT_INSTANTIATED                                                                            |
| Links                       | {                                                                                           |
|                             |     "self": {                                                                               |
|                             |         "href": "/vnflcm/v1/vnf_instances/ebd84c1e-83f2-41e7-bb0b-c0b0628ef07e"             |
|                             |     },                                                                                      |
|                             |     "instantiate": {                                                                        |
|                             |         "href": "/vnflcm/v1/vnf_instances/ebd84c1e-83f2-41e7-bb0b-c0b0628ef07e/instantiate" |
|                             |     }                                                                                       |
|                             | }                                                                                           |
| VNF Configurable Properties |                                                                                             |
| VNF Instance Description    | None                                                                                        |
| VNF Instance Name           | None                                                                                        |
| VNF Product Name            | Sample VNF                                                                                  |
| VNF Provider                | Company                                                                                     |
| VNF Software Version        | 1.0                                                                                         |
| VNFD ID                     | b1bb0ce7-ebca-4fa7-95ed-4840d70a1177                                                        |
| VNFD Version                | 1.0                                                                                         |
+-----------------------------+---------------------------------------------------------------------------------------------+
```

VNFをinstantiateする。

```
[centos@tacker ~]$ cat <<EOF > ./sample_param_file.json
> {
>   "flavourId": "simple"
> }
> EOF
[centos@tacker ~]$ openstack vnflcm instantiate \
> 1c0ca11c-555e-4974-a751-9784cdf8c1e7 ./sample_param_file.json
Instantiate request for VNF Instance 1c0ca11c-555e-4974-a751-9784cdf8c1e7 has been accepted.
[centos@tacker ~]$ openstack vnflcm list
+--------------------------------------+-------------------+---------------------+--------------+----------------------+------------------+--------------------------------------+
| ID                                   | VNF Instance Name | Instantiation State | VNF Provider | VNF Software Version | VNF Product Name | VNFD ID                              |
+--------------------------------------+-------------------+---------------------+--------------+----------------------+------------------+--------------------------------------+
| 1c0ca11c-555e-4974-a751-9784cdf8c1e7 | None              | NOT_INSTANTIATED    | Company      | 1.0                  | Sample VNF       | b1bb0ce7-ebca-4fa7-95ed-4840d70a1177 |
+--------------------------------------+-------------------+---------------------+--------------+----------------------+------------------+--------------------------------------+
```

`Instantiation State`が変らない。

`/var/log/kolla/tacker/tacker-conductor.log`に以下のエラーがあった。

```
2022-03-07 06:46:34.156 7 ERROR oslo_messaging.rpc.server tacker.common.exceptions.VnfInstantiationFailed: Vnf instantiation failed for vnf ebd84c1e-83f2-41e7-bb0b-c0b0628ef07e, error: ERROR: Property error: : resources.VDU1.properties.image: : Error validating value '': No images matching {'name': ''}.
```

イメージ名に空文字が指定されてしまっているようである。
VNFDテンプレートに問題がありそう。
ドキュメントのサンプルそのままをしようしたが、バグってる？

ググったところ、以下の定義が必要と思われる。
https://wiki.onap.org/download/attachments/45303641/NFV-SOL001v0130_clean.docx?version=1&modificationDate=1542631798000&api=v2

```yaml
topology_template:
 node_templates:
   VDU1:
     artifacts:
       sw_image:
        type: tosca.artifacts.nfv.SwImage
        file: ../Files/images/cirros-0.5.2-x86_64-disk.img
```

上記の定義を使用して再実施する。

```
[centos@tacker ~]$ openstack vnflcm delete 1c0ca11c-555e-4974-a751-9784cdf8c1e7
Vnf instance '1c0ca11c-555e-4974-a751-9784cdf8c1e7' deleted successfully
[centos@tacker ~]$ openstack vnflcm list

[centos@tacker ~]$ openstack vnf package update \
>     --operational-state 'DISABLED' \
> ea8b23b3-8c6a-4ff6-a4dd-a5ac4374f844
+-------------------+----------+
| Field             | Value    |
+-------------------+----------+
| Operational State | DISABLED |
+-------------------+----------+
[centos@tacker ~]$ openstack vnf package list
+--------------------------------------+------------------+------------------+-------------+-------------------+-------------------------------------------------------------------------------------------------+
| Id                                   | Vnf Product Name | Onboarding State | Usage State | Operational State | Links                                                                                           |
+--------------------------------------+------------------+------------------+-------------+-------------------+-------------------------------------------------------------------------------------------------+
| ea8b23b3-8c6a-4ff6-a4dd-a5ac4374f844 | Sample VNF       | ONBOARDED        | NOT_IN_USE  | DISABLED          | {                                                                                               

...

[centos@tacker ~]$ openstack vnf package delete ea8b23b3-8c6a-4ff6-a4dd-a5ac4374f844
All specified vnf-package(s) deleted successfully
[centos@tacker ~]$ openstack vnf package list
+--------------------------------------+------------------+------------------+-------------+-------------------+-------------------------------------------------------------------------------------------------+
| Id                                   | Vnf Product Name | Onboarding State | Usage State | Operational State | Links                                                                                           |
+--------------------------------------+------------------+------------------+-------------+-------------------+-------------------------------------------------------------------------------------------------+
| ea8b23b3-8c6a-4ff6-a4dd-a5ac4374f844 | Sample VNF       | ONBOARDED        | NOT_IN_USE  | DISABLED          | {                                                                                               

...
```

VNFパッケージが削除できない。
DBでエラーがでている。

```
2022-03-08 04:09:23.214 7 ERROR oslo_messaging.rpc.server oslo_db.exception.DBError: (pymysql.err.InternalError) (1292, "Truncated incorrect DOUBLE value: '1049a2cb-1325-422e-a7b3-5d9c2671fc5c'")
```

DOUBLE型の不正な値が削除されたとのことだが、バグ？
よくわからんので、Tackerを再デプロイする。

```
[root@tacker ~]# kolla-ansible destroy
WARNING:
    This will PERMANENTLY DESTROY all deployed kolla containers, volumes and host configuration.
    There is no way to recover from this action. To confirm, please add the following option:
    --yes-i-really-really-mean-it
[root@tacker ~]# kolla-ansible destroy --yes-i-really-really-mean-it
Destroy Kolla containers, volumes and host configuration : ansible-playbook -i /usr/local/share/kolla-ansible/ansible/inventory/all-in-one -e @/etc/kolla/globals.yml -e @/etc/kolla/passwords.yml -e CONFIG_DIR=/etc/kolla  /usr/local/share/kolla-ansible/ansible/destroy.yml

...

PLAY RECAP **************************************************************************************************************************************************
localhost                  : ok=8    changed=3    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0   

[root@tacker ~]# kolla-ansible deploy
Deploying Playbooks : ansible-playbook -i /usr/local/share/kolla-ansible/ansible/inventory/all-in-one -e @/etc/kolla/globals.yml -e @/etc/kolla/passwords.yml -e CONFIG_DIR=/etc/kolla  -e kolla_action=deploy /usr/local/share/kolla-ansible/ansible/site.yml

...

PLAY RECAP **************************************************************************************************************************************************
localhost                  : ok=174  changed=113  unreachable=0    failed=0    skipped=73   rescued=0    ignored=1   

[root@tacker ~]# docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Names}}"
CONTAINER ID   IMAGE                                                   NAMES
1e3b3a9a24be   kolla/centos-source-tacker-server:ussuri                tacker_server
c5002ff146b7   kolla/centos-source-tacker-conductor:ussuri             tacker_conductor

...
```

上記定義を使用して試したところ、イメージの指定はうまくいったようであるが、イメージのハッシュ値検証がエラーとなった。

```
2022-03-07 09:31:35.154 7 ERROR oslo_messaging.rpc.server tacker.common.exceptions.VnfPreInstantiationFailed: Vnf 'ae9ae433-fed1-42fc-917c-43019c3a0ed1' failed during pre-instantiation due to error: Image 56c67844-7ca5-49d2-bbb5-64e11234dbd3 checksum verification failed
```

イメージのハッシュを確認したが、定義は間違ってなさそうに見える。

```
[centos@tacker ~]$ sha256sum sample_vnf_package_csar/Files/images/cirros-0.5.2-x86_64-disk.img 
8c7ecf5bd9a5a672a9f688b8fbf9dc6f032084bf54cc83716850b5e3ea164aa2  sample_vnf_package_csar/Files/images/cirros-0.5.2-x86_64-disk.img
```

定義には以下のようにsha256を指定しているが、別のハッシュアルゴリズムが使用されているのかな？

```yaml
topology_template:
 node_templates:
   VDU1:
     properties:
       sw_image_data:
         checksum:
           algorithm: sha-256
           hash: 8c7ecf5bd9a5a672a9f688b8fbf9dc6f032084bf54cc83716850b5e3ea164aa2
```

試しにsha512で試してみる。

```yaml
topology_template:
 node_templates:
   VDU1:
     properties:
       sw_image_data:
         checksum:
         version: '0.5.2'
         checksum:
         #  algorithm: sha-256
         #  hash: 8c7ecf5bd9a5a672a9f688b8fbf9dc6f032084bf54cc83716850b5e3ea164aa2
           algorithm: sha-512
           hash: 42f14f8f8f4d03557a34b4e057289ee9015c93049c8404395651ceac450b94de95d2d39f7d00198b355221fbd38beec2d7df808a1311d9356bddc87efbbfec97
```

```
[centos@tacker ~]$ openstack vnflcm list
+--------------------------------------+-------------------+---------------------+--------------+----------------------+------------------+--------------------------------------+
| ID                                   | VNF Instance Name | Instantiation State | VNF Provider | VNF Software Version | VNF Product Name | VNFD ID                              |
+--------------------------------------+-------------------+---------------------+--------------+----------------------+------------------+--------------------------------------+
| 1dcad49c-b457-4575-8dab-a292eb4138e7 | None              | INSTANTIATED        | Company      | 1.0                  | Sample VNF       | b1bb0ce7-ebca-4fa7-95ed-4840d70a1177 |
+--------------------------------------+-------------------+---------------------+--------------+----------------------+------------------+--------------------------------------+
```

うまくいった。

```
[centos@rdo ~(keystone_admin)]$ openstack stack list
+--------------------------------------+---------------------------------------------+----------------------------------+-----------------+----------------------+--------------+
| ID                                   | Stack Name                                  | Project                          | Stack Status    | Creation Time        | Updated Time |
+--------------------------------------+---------------------------------------------+----------------------------------+-----------------+----------------------+--------------+
| 53f855b4-26cf-440a-9b78-f21b085ee472 | vnflcm_1dcad49c-b457-4575-8dab-a292eb4138e7 | c2b7c1d87c204b5aa1913603ae926ac8 | CREATE_COMPLETE | 2022-03-09T03:06:03Z | None         |
+--------------------------------------+---------------------------------------------+----------------------------------+-----------------+----------------------+--------------+
openstack stack resource list: error: the following arguments are required: <stack>
[centos@rdo ~(keystone_admin)]$ openstack stack resource list 53f855b4-26cf-440a-9b78-f21b085ee472 
+-----------------------+--------------------------------------+------------------------------------+-----------------+----------------------+
| resource_name         | physical_resource_id                 | resource_type                      | resource_status | updated_time         |
+-----------------------+--------------------------------------+------------------------------------+-----------------+----------------------+
| internalVL1           | 6279e4b8-3550-4d08-ba2a-f5592d2bdae9 | OS::Neutron::Net                   | CREATE_COMPLETE | 2022-03-09T03:06:04Z |
| CP1                   | 800397ad-6ece-486d-bdb3-81c71be2cff2 | OS::Neutron::Port                  | CREATE_COMPLETE | 2022-03-09T03:06:04Z |
| VDU1                  | 2d1b68d1-81dc-49a8-8001-f28a3a564e87 | OS::Nova::Server                   | CREATE_COMPLETE | 2022-03-09T03:06:04Z |
| VDU1_flavor           | bfab3989-1c7c-483a-95cc-d77c26d8fb64 | OS::Nova::Flavor                   | CREATE_COMPLETE | 2022-03-09T03:06:04Z |
| internalVL1_bandwidth | 08e733d7-0ad1-43a5-9d08-1dc8727a7336 | OS::Neutron::QoSBandwidthLimitRule | CREATE_COMPLETE | 2022-03-09T03:06:04Z |
| internalVL1_subnet    | 64652d72-6563-4f3f-a286-d64e95a7b38f | OS::Neutron::Subnet                | CREATE_COMPLETE | 2022-03-09T03:06:04Z |
| internalVL1_qospolicy | 66e02e54-b1b7-49c7-8e4f-0c6dcd3b3b0a | OS::Neutron::QoSPolicy             | CREATE_COMPLETE | 2022-03-09T03:06:04Z |
+-----------------------+--------------------------------------+------------------------------------+-----------------+----------------------+
```

stackが作成されて、インスタンスなどが作成されたことが確認できた。

本記事は以上になります。