DRA-VNF Example
This section provides an example for configuring the installer with a dra-vnf test bed. The dra-vnf example includes the following roles and VMs:
-
master:
master-0
-
control:
control-0
control-1
-
DRA Director:
dra-director-1
dra-director-2
-
DRA Worker:
dra-worker-1
dra-worker-2
-
DRA Distributor:
dra-distributor-1
dra-distributor-2
dra-distributor-3
dra-distributor-4
Artifacts Structure Example
cps@installer:/data/deployer/envs/dra-vnf$ tree
.
|-- base.env
|-- base.esxi.env
|-- user_data.yml
|-- user_data.yml.pam
`-- vms
|-- control-0
| |-- control-0
| | |-- interfaces.esxi
| | |-- user_data.yml
| | |-- vm.env
| | `-- vm.esxi.env
| |-- role.env
| `-- role.esxi.env
|-- control-1
| |-- control-1
| | |-- interfaces.esxi
| | |-- user_data.yml
| | |-- vm.env
| | `-- vm.esxi.env
| |-- role.env
| `-- role.esxi.env
|-- dra-director
| |-- dra-director-1
| | |-- interfaces.esxi
| | |-- user_data.yml
| | |-- vm.env
| | `-- vm.esxi.env
| |-- dra-director-2
| | |-- interfaces.esxi
| | |-- user_data.yml
| | |-- vm.env
| | `-- vm.esxi.env
| |-- role.env
| `-- role.esxi.env
|-- dra-distributor
| |-- dra-distributor-1
| | |-- interfaces.esxi
| | |-- vm.env
| | `-- vm.esxi.env
| |-- dra-distributor-2
| | |-- interfaces.esxi
| | |-- vm.env
| | `-- vm.esxi.env
| |-- dra-distributor-3
| | |-- interfaces.esxi
| | |-- vm.env
| | `-- vm.esxi.env
| |-- dra-distributor-4
| | |-- interfaces.esxi
| | |-- vm.env
| | `-- vm.esxi.env
| |-- role.env
| |-- role.esxi.env
| `-- user_data.yml
|-- dra-worker
| |-- dra-worker-1
| | |-- interfaces.esxi
| | |-- vm.env
| | `-- vm.esxi.env
| |-- dra-worker-2
| | |-- interfaces.esxi
| | |-- vm.env
| | `-- vm.esxi.env
| |-- role.env
| `-- role.esxi.env
`-- master
|-- master-0
| |-- interfaces.esxi
| |-- user_data.yml
| |-- vm.env
| `-- vm.esxi.env
|-- role.env
`-- role.esxi.env
18 directories, 55 files
cps@installer:/data/deployer/envs/dra-vnf$
Top Level Directory
/data/deployer/envs/example-dra-vnf/base.env
/data/deployer/envs/example-dra-vnf/base.esxi.env
/data/deployer/envs/example-dra-vnf/user_data.yml
/data/deployer/envs/example-dra-vnf/base.esxi.env
/data/deployer/envs/example-dra-vnf/esxi
/data/deployer/envs/example-dra-vnf/vms
base.env
All the settings in the base.env file can be overridden in vms/role/role.env and vms/role/vm_name/vm.env files.
MASTER_IP=192.169.21.10
INTERNAL_NETWORK=192.169.21.0/24
WEAVE_PASSWORD=cisco123
CLUSTER_ID=test-cluster
SYSTEM_ID=test-system
MASTER_IP: Internal address of master VM.
base.esxi.env
All the settings in the base.esxi.env file can be overridden in the vms/role/role.esxi.env and vms/role/vm_name/vm.esxi.env files.
VMDK="cps-docker-host_18.0.1.dra.vmdk"
VMDK_DISK_TYPE="thick"
VSPHERE_HOST="example-vsphere.cisco.com"
VSPHERE_USER="administrator@vsphere.local"
VSPHERE_PASSWORD="foo123"
VSPHERE_DISABLE_SSL_VERIFICATION="True"
VSPHERE_RESERVE_MEMORY="True"
DATACENTER="Microservices"
-
VMDK: Place the VMDK file at the top level directory of your VNF environment structure example-dra-vnf/microservices.vmdk_file_name.
Another option is to specify the full path such as /data/deployer/envs/images/microservices.vmdk_file_name
Replace microservices.vmdk_file_name with the actual VMDK file name.
-
VMDK_DISK_TYPE: VMDK disk type. See the link for a list of supported disk types.
-
VSPHERE_HOST: DNS name or IP address of the vSphere host.
-
VSPHERE_USER: (Optional) Login user for vSphere. If the user name is not specified, installer prompts user for vSphere login user name.
-
VSPHERE_PASSWORD: (Optional) vSphere password. If the password is not specified, installer prompts user for password
-
VSPHERE_DISABLE_SSL_VERIFICATION: (Optional) Disable verification of vSphere SSL Certificate. This is necessary if your vSphere server is using a Self Signed Certificate
-
VSPHERE_RESERVE_MEMORY: (Optional) Reserve VM's memory before starting the VM
-
DATACENTER: Datacenter for VM placement.
user_data.yml
Use the Jinja2 template to create the user data file for cloud-init.
Cloud-init user data template: This file is for reference only. You need to create cloud-init file based on your requirements.
#cloud-config
debug: True
output: {all: '| tee -a /var/log/cloud-init-output.log'}
users:
- name: cps
sudo: ['ALL=(ALL) NOPASSWD:ALL']
groups: docker
ssh-authorized-keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDzjJjndIvUiBta4VSIbd2gJmlMWcQ8wtejg
AbiXtoFZdtMdo9G0ZDEOtxHNNDPwWujMiYAkZhZWX/zON9raavU8lg cps@root-public-key
resize_rootfs: true
write_files:
- path: /root/swarm.json
content: |
{
"role": "{{ ROLE }}",
"identifier": "{{ IDENTIFIER }}",
"master": "{{ MASTER_IP }}",
"network": "{{ INTERNAL_NETWORK }}",
{% if WEAVE_PASSWORD is defined %}"weavePw": "{{ WEAVE_PASSWORD }}", {% endif %}
"zing": "{{ RUN_ZING | default(1) }}",
"cluster_id": "{{ CLUSTER_ID }}",
"system_id": "{{ SYSTEM_ID }}"
}
owner: root:root
permissions: '0644'
- path: /home/cps/.bash_aliases
encoding: text/plain
content: |
# A convenient shortcut to get to the Orchestrator CLI
alias cli="ssh -p 2024 admin@localhost"
owner: cps:cps
permissions: '0644'
runcmd:
- [vmware-toolbox-cmd, timesync, enable ]
example-dra-vnf/vms/role
example-dra-vnf/master/role.env
example-dra-vnf/master/role.esxi.env
example-dra-vnf/master/master-0
role.env
All settings in the role.env file can be overridden in the vms/role/vm_name/vm.env file. In non-master roles the role.env file is empty.
CPS_ISO=”cisco-policy-dra.iso”
where, CPS_ISO is the CPS ISO file. This is required for master virtual machines.
Not used in non-master virtual machines. It is possible to specify this with a full path /data/deployer/envs/images/cisco-policy-dra.iso.
role.esxi.env
All settings in the role.esxi.env file can be overridden in the vms/vm_name/vm.esxi.env file.
CPU=16
RAM=65536
NETWORK_0=Management
NETWORK_1=Internal
# Data disk size in GB
VM_DATA_DISK_SIZE="200"
VM_DATA_DISK_TYPE="thick"
-
CPU: Number of CPUs.
-
RAM: Memory in megabytes (65536/1024 = 64 GB)
-
NETWORK_0: The name of the first network assigned to the VM. Name is case sensitive and must match the network name configured in vSphere. Network interface names are defined using the scheme in "Interface Numbering" section.
Add a NETWORK_N setting for each network required.
-
VM_DATA_DISK_SIZE: Data disk size in GB for master and control VMs.
-
VM_DATA_DISK_TYPE: VM data disk type. See the link for a list of supported disk types.
Data Disk
A data disk is a separate disk for the control and master virtual machines and is configured in the artifacts environment files before installing a CPS system. The data has a /data partition and a /stats partition. Perform the following steps to add a data disk to master and control VMs.
-
Specify VM_DATA_DISK_SIZE and VM_DATA_DISK_TYPE in example-env/vms/<role>/role.esxi.env file.
-
Specify VM_DATA_VMDK_ROOT_PATH and VM_DATA_DISK_NAME in example-env/vms/<role>/role.esxi.env file.
-
Specify disk file system and mount point in example-env/vms/<role>/<vm_name>/user_data.yml file.
The installer checks for an existing data disk in VM_DATA_VMDK_ROOT_PATH/<disk_name>. If a data disk exists, the disk is attached to the target VM. If a data disk does not exist, the installer creates a new VMDK disk and attaches it to the VM. Cloud init is responsible for formatting the disk and mounting it. If the data disk has an ext-4 file system, cloud-int does not reformat the disk, preserving existing data.
If a VM is deleted with the deployer container's cps delete example-dra control-0
command, the data disk is detached before the VM is deleted. Detached disks are not deleted when the VM is deleted.
master-0
The master-0 directory is the name of a VM. This directory name must match the hostname of the VM.
example-dra-vnf/vms/master/vm_name
Directory containing configuration information for a VM
example-dra-vnf/vms/master/master-0/interfaces.esxi
example-dra-vnf/vms/master/master-0/vm.env
example-dra-vnf/vms/master/master-0/vm.esxi.env
interfaces.esxi
The contents of the interfaces.esxi file are placed in /etc/network/interfaces file on the VM. Any valid content for the ubuntu /etc/network/interfaces file can be placed in interfaces.esxi.
auto lo
iface lo inet loopback
auto ens160
iface ens160 inet static
address 10.10.10.155
netmask 255.255.255.0
gateway 10.10.10.1
dns-nameservers 172.10.5.25 172.11.5.25 172.12.5.25
auto ens192
iface ens192 inet static
address 192.169.21.10
netmask 255.255.255.0
vm.env
HOSTNAME=master-0
FQDN=master-0.local
vm.esxi.env
ESXI_DNS_NAME="example-esxi-1.cisco.com"
DATASTORE="datastore1"
VM_DATA_VMDK_ROOT_PATH="[datastore1] data-disks"
VM_DATA_DISK_NAME="master-0-data.vmdk"
-
ESXI_DNS_NAME: DNS name of the VM's target ESXi server.
-
ESXI_IP: IP address of ESXi server. This can be used instead of ESXI_DNS_NAME. If both, ESXI_DNS_NAME and ESXI_IP are specified, ESXI_DNS_NAME is used.
vCenter always directs the API client to the DNS name of the target ESXi server regardless if the EXSi host's IP address or
DNS name is specified. The installation fails if the deployer VM cannot resolve the ESXi's DNS name. To avoid this, update
the "cps" bash function in the file /etc/bash.aliases and add --add-host <esxi dns name>:<ip address>
for each ESXi server. Use sudo
to modify the file.
/etc/bash.aliases
function cps () {
docker run \
--add-host esxi-1.example.com:10.0.0.1 \
--add-host esxi-2.example.com:10.0.0.2 \
-v /data/deployer:/data/deployer \
-v /data/vmware/:/export/ \
-it --rm dockerhub.cisco.com/cps-docker-v2/cps-deployer/deployer:latest \
/root/cps "$@"
}
-
DATASTORE: Case sensitive name of the vSphere datastore used to store the VM.
-
VM_DATA_VMDK_ROOT_PATH: Root path to store the master or control VM's data disk.
-
VM_DATA_DISK_NAME: Name of the VMDK disk.
VM Level user_data.yml for Data Disks
Place this file at the VM level for master and control VMs when using a separate data disks.
Note |
This file is for reference only. You need to create user_data.yml file based on your requirements. |
#cloud-config
# ESC velocity escape variable during deployment
#set ( $DS = "$" )
debug: True
output: {all: '| tee -a /var/log/cloud-init-output.log'}
users:
- name: cps
sudo: ['ALL=(ALL) NOPASSWD:ALL']
groups: docker
ssh-authorized-keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDzjJjndIvUiBta4VSIbd2g
JmlMWcQ8wtejgAbiXtoFZdtMdo9G0ZDEOtxHNNDPwWujMiYAkZhZWX/zON9raav
U8lgD9+YcRopWUtujIC71YjtoxIj EWEaj/50jegN cps@root-public-key
resize_rootfs: true
write_files:
- path: /root/swarm.json
content: |
{
"role": "{{ ROLE }}",
"identifier": "{{ IDENTIFIER }}",
"master": "{{ MASTER_IP }}",
"network": "{{ INTERNAL_NETWORK }}",
{% if WEAVE_PASSWORD is defined %}"weavePw": "{{ WEAVE_PASSWORD }}", {% endif %}
"zing": "{{ RUN_ZING | default(1) }}",
"cluster_id": "{{ CLUSTER_ID }}",
"system_id": "{{ SYSTEM_ID }}"
}
owner: root:root
permissions: '0644'
- path: /home/cps/.bash_aliases
encoding: text/plain
content: |
# A convenient shortcut to get to the Orchestrator CLI
alias cli="ssh -p 2024 admin@localhost"
alias pem="wget --quiet http://171.70.34.121/microservices/latest/cps.pem ; chmod 400 cps.pem ; echo 'Retrieved \"cps.pem\" key file'"
owner: cps:cps
permissions: '0644'
disk_setup:
/dev/sdb:
table_type: 'gpt'
layout:
- 35
- 65
overwrite: False
fs_setup:
- label: DATA
device: /dev/sdb
filesystem: 'ext4'
partition: auto
overwrite: False
- label: STATS
device: /dev/sdb
filesystem: 'ext4'
partition: auto
overwrite: False
mounts:
- [ "LABEL=DATA", /data, "ext4", "defaults,nofail", "0", "2" ]
- [ "LABEL=STATS", /stats, "ext4", "defaults,nofail", "0", "2" ]
runcmd:
- [vmware-toolbox-cmd, timesync, enable ]