8.2. Ansible JSON Key Value Description

The following provides the key value pairs that must be contained in the JSON file supporting APPC/SDN-C Ansible action.

8.2.1. Table B1. Ansible JSON File key value description

TOSCA Definition

Field Name

Description

Type

Comment

PlaybookName

xNF provider must list name of the playbook relative path used to execute the xNF action.

Mandatory

Currently following Ansible standard naming, where main playbook is always named site.yml, and directory name where this main playbook resides, is named after the command/action playbook performs, in lower case, example, configure.

Action

Name of xNF action.

Optional

EnvParameters

A JSON dictionary which should list key attribute-value pairs to be passed to the Ansible playbook. These values usually are instance specific parameters that a playbook needs to execute an action targeting the xNF instance.

Optional

Attribute-value pairs vary from xNF action-to-action. Targeted xNF instance name is commonly a required attribute.

Attribute names (variable names) passed to Ansible shall follow Ansible valid variable names: “Variable names should be letters, numbers, and underscores. Variables should always start with a letter.”

NodeList

xNF inventory xNFC names with respective IP/VIP addresses, in xNFC groups, xNF instance local/site name, and other info required to build inventory hosts file playbook must be executed against.

Optional

If NodeList is not provided, inventory hosts file must be pre-loaded (xNF) in the Ansible Server in advance of request targeting instance otherwise request fails with inventory hosts file not found.

FileParameters

A JSON dictionary where keys are filenames and values are contents of files. The Ansible Server will utilize this feature to generate files with keys as filenames and values as content. This attribute can be used to generate files that a playbook may require as part of execution.

Optional

Depends on the xNF action and playbook design.

Timeout

Time (in seconds) that a playbook is expected to take to finish execution for the xNF. If playbook execution time exceeds this value, Ansible Server will terminate the playbook process.

Optional

InventoryNames

Default “None”, no names, inventory hosts file contains no names, just (OA&M) IP addresses. When set to “VM” or “VNFC” Ansible Server Rest API adds VM names or VNFC names, respectively, to the inventory hosts file besides IP addresses (or FQDNs). Names and IP addresses are provided by APPC/SDN-C in xNF NodeList.

Optional

This parameter is used by Ansible Server Rest API to build inventory hosts file matching what is required by xNF Type.

CAUTION: All templates, for a given xNF Type, shall use the same InventoryNames setting for all commands/playbooks, “None” (Default), “VM” or “VNFC”.

Ansible JSON file example:

{
  "Action":"Configure",
  "PlaybookName": "<VNFCode>/<Version>/ansible/configure/site.yml",
  "NodeList": [
    {
      "vnfc_type": "oam",
      "ne_id_vip": "vfdb9904vm001oam001",
      "floating_ip_address_vip": "1xx.2yy.zzz.109",
      "site": "wp0ny",
      "vm_info": [
        {
          "ne_id": "vfdb9904vm001oam001",
          "fixed_ip_address": "1xx.2yy.zzz.109"
        },
        {
          "ne_id": "vfdb9904vm002oam001",
          "fixed_ip_address": "1xx.2yy.zzz.110"
        }
      ]
    },
    {
      "vnfc_type": "rdb",
      "site": "wp0ny",
      "vm_info": [
        {
          "ne_id": "vfdb9904vm003rdb001",
          "fixed_ip_address": "1xx.2yy.zzz.105"
        },
        {
          "ne_id": "vfdb9904vm004rdb001",
          "fixed_ip_address": "1xx.2yy.zzz.106"
        }
      ]
    }
  ],
  "Timeout": 60,
  "InventoryNames": "None",
  "EnvParameters": {"vnf_instance": "$vnf-instance", "Retry": 3, "Wait": 5, "ConfigFile":"config.txt", "healthcheck_type": "$healthcheck_type",  "target_vm_list": ["$ne-id1","..."] },
  "FileParameters": {"config.txt":"db_ip=10.1.1.1, sip_timer=10000"}
}

In the above example, the Ansible Server Rest API code will:

  1. Process the “FileParameters” dictionary and generate a file named ‘config.txt’ with contents set to the value of the ‘config.txt’ key.

  2. Execute the playbook named ‘<VNFCode>/<Version>/ansible/configure/site.yml’ on nodes with listed IP addresses (or FQDNs) respectively while providing the following key value pairs to the playbook: Retry=3, Wait=5, ConfigFile=config.txt

  3. If execution time of the playbook exceeds 60 secs (across all hosts), it will be terminated.

  4. Inventory hosts file to be build with only IP addresses (or FQDNs), IP addresses and VM names, or IP addresses and VNFC names depending on InventoryNames setting in the template(s) passed to Ansible Server as part of the Rest API request. In a later section with Ansible examples, examples of supported inventory hosts file formats are shared.