Refactor memory usage for the template cookied-mcp-ocata-dop-sl2

- Increase memory usage to allocate 128Gb RAM
- Use different environment variable names for CPU/RAM/VOL
  options for each type of nodes

Change-Id: Ic727a5307824a7995e2ee7f60325e947fbc1095b
diff --git a/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/underlay--user-data-cfg01.yaml b/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/underlay--user-data-cfg01.yaml
index dff52d9..51d430d 100644
--- a/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/underlay--user-data-cfg01.yaml
+++ b/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/underlay--user-data-cfg01.yaml
@@ -40,7 +40,7 @@
    #- sudo ifup ens4
 
    # Create swap
-   - fallocate -l 4G /swapfile
+   - fallocate -l 16G /swapfile
    - chmod 600 /swapfile
    - mkswap /swapfile
    - swapon /swapfile
diff --git a/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/underlay--user-data-cicd.yaml b/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/underlay--user-data-cicd.yaml
deleted file mode 100644
index 3bc891d..0000000
--- a/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/underlay--user-data-cicd.yaml
+++ /dev/null
@@ -1,94 +0,0 @@
-| # All the data below will be stored as a string object
-  #cloud-config, see http://cloudinit.readthedocs.io/en/latest/topics/examples.html
-
-  ssh_pwauth: True
-  users:
-   - name: root
-     sudo: ALL=(ALL) NOPASSWD:ALL
-     shell: /bin/bash
-     ssh_authorized_keys:
-     {% for key in config.underlay.ssh_keys %}
-      - ssh-rsa {{ key['public'] }}
-     {% endfor %}
-
-  disable_root: false
-  chpasswd:
-   list: |
-    root:r00tme
-   expire: False
-
-  bootcmd:
-   # Block access to SSH while node is preparing
-   - cloud-init-per once sudo iptables -A INPUT -p tcp --dport 22 -j DROP
-   # Enable root access
-   - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
-   - service sshd restart
-  output:
-    all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
-
-  runcmd:
-   - export TERM=linux
-   - export LANG=C
-   # Configure dhclient
-   - sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base
-   - sudo resolvconf -u
-
-   # Enable grub menu using updated config below
-   - update-grub
-
-   # Prepare network connection
-   # WARNING! On CID* nodes, admin network is connected to ens4, and control network to ens3 (as in the model)
-   # On other nodes (cfg01 and openstack), admin network is connected to ens3, and control network to ens4
-   - sudo ifup ens4
-
-   # Create swap
-   - fallocate -l 8G /swapfile
-   - chmod 600 /swapfile
-   - mkswap /swapfile
-   - swapon /swapfile
-   - echo "/swapfile   none    swap    defaults   0   0" >> /etc/fstab
-
-
-   ############## TCP Cloud cfg01 node ##################
-   #- sleep 120
-   - echo "Preparing base OS"
-   - which wget >/dev/null || (apt-get update; apt-get install -y wget)
-
-   - echo "deb [arch=amd64] http://apt.mirantis.com/xenial {{ REPOSITORY_SUITE }} salt extra" > /etc/apt/sources.list.d/mcp_salt.list;
-   - wget -O - http://apt.mirantis.com/public.gpg | apt-key add -;
-   - echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3 xenial main" > /etc/apt/sources.list.d/saltstack.list;
-   - wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3/SALTSTACK-GPG-KEY.pub | apt-key add -;
-
-   - apt-get clean
-   - eatmydata apt-get update && apt-get -y upgrade
-
-   # Install common packages
-   - eatmydata apt-get install -y python-pip git curl tmux byobu iputils-ping traceroute htop tree mc
-
-   # Install salt-minion and stop it until it is configured
-   - eatmydata apt-get install -y salt-minion && service salt-minion stop
-
-   # Install latest kernel
-   - eatmydata apt-get install -y linux-generic-hwe-16.04
-
-   ########################################################
-   # Node is ready, allow SSH access
-   #- echo "Allow SSH access ..."
-   #- sudo iptables -D INPUT -p tcp --dport 22 -j DROP
-   - reboot
-   ########################################################
-
-  write_files:
-   - path: /etc/default/grub.d/97-enable-grub-menu.cfg
-     content: |
-         GRUB_RECORDFAIL_TIMEOUT=30
-         GRUB_TIMEOUT=3
-         GRUB_TIMEOUT_STYLE=menu
-
-   - path: /etc/network/interfaces
-     content: |
-          auto ens3
-          iface ens3 inet manual
-          auto ens4
-          iface ens4 inet dhcp
-
diff --git a/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/underlay--user-data1604.yaml b/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/underlay--user-data1604.yaml
index 677c392..a5f6916 100644
--- a/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/underlay--user-data1604.yaml
+++ b/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/underlay--user-data1604.yaml
@@ -42,7 +42,7 @@
    #- sudo ifup ens4
 
    # Create swap
-   - fallocate -l 4G /swapfile
+   - fallocate -l 16G /swapfile
    - chmod 600 /swapfile
    - mkswap /swapfile
    - swapon /swapfile
diff --git a/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/underlay.yaml b/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/underlay.yaml
index 4cf97fa..9893151 100644
--- a/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/underlay.yaml
+++ b/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/underlay.yaml
@@ -20,7 +20,6 @@
 
 {% import 'cookied-mcp-ocata-dop-sl2/underlay--meta-data.yaml' as CLOUDINIT_META_DATA with context %}
 {% import 'cookied-mcp-ocata-dop-sl2/underlay--user-data-cfg01.yaml' as CLOUDINIT_USER_DATA_CFG01 with context %}
-{% import 'cookied-mcp-ocata-dop-sl2/underlay--user-data-cicd.yaml' as CLOUDINIT_USER_DATA_CICD with context %}
 {% import 'cookied-mcp-ocata-dop-sl2/underlay--user-data1604.yaml' as CLOUDINIT_USER_DATA_1604 with context %}
 
 ---
@@ -28,7 +27,6 @@
  - &interface_model {{ os_env('INTERFACE_MODEL', 'virtio') }}
  - &cloudinit_meta_data {{ CLOUDINIT_META_DATA }}
  - &cloudinit_user_data_cfg01 {{ CLOUDINIT_USER_DATA_CFG01 }}
- - &cloudinit_user_data_cicd {{ CLOUDINIT_USER_DATA_CICD }}
  - &cloudinit_user_data_1604 {{ CLOUDINIT_USER_DATA_1604 }}
 
 template:
@@ -174,13 +172,13 @@
         driver:
           name: devops.driver.libvirt
           params:
-            connection_string: !os_env CONNECTION_STRING, qemu:///system
-            storage_pool_name: !os_env STORAGE_POOL_NAME, default
+            connection_string: {{ os_env('CONNECTION_STRING', 'qemu:///system') }}
+            storage_pool_name: {{ os_env('STORAGE_POOL_NAME', 'default') }}
             stp: False
             hpet: False
             enable_acpi: true
-            use_host_cpu: !os_env DRIVER_USE_HOST_CPU, true
-            use_hugepages: !os_env DRIVER_USE_HUGEPAGES, false
+            use_host_cpu: {{ os_env('DRIVER_USE_HOST_CPU', true) }}
+            use_hugepages: {{ os_env('DRIVER_USE_HUGEPAGES', false) }}
 
         network_pools:
           admin: admin-pool01
@@ -212,7 +210,7 @@
 
         group_volumes:
          - name: cloudimage1604    # This name is used for 'backing_store' option for node volumes.
-           source_image: !os_env IMAGE_PATH1604  # https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img or
+           source_image: {{ os_env('IMAGE_PATH1604') }}  # https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img or
                                              # http://apt.tcpcloud.eu/images/ubuntu-16-04-x64-201608231004.qcow2
            format: qcow2
 
@@ -220,15 +218,15 @@
           - name: {{ HOSTNAME_CFG01 }}
             role: salt_master
             params:
-              vcpu: !os_env SLAVE_NODE_CPU, 2
-              memory: !os_env SLAVE_NODE_MEMORY, 3072
+              vcpu: {{ os_env('CFG_NODE_CPU', 2) }}
+              memory: {{ os_env('CFG_NODE_MEMORY', 4096) }}
               boot:
                 - hd
               cloud_init_volume_name: iso
               cloud_init_iface_up: ens3
               volumes:
                 - name: system
-                  capacity: !os_env NODE_VOLUME_SIZE, 150
+                  capacity: {{ os_env('CFG_NODE_VOLUME_SIZE', 150) }}
                   backing_store: cloudimage1604
                   format: qcow2
                 - name: iso  # Volume with name 'iso' will be used
@@ -258,15 +256,15 @@
           - name: {{ HOSTNAME_CID01 }}
             role: salt_minion
             params:
-              vcpu: !os_env SLAVE_NODE_CPU, 4
-              memory: !os_env SLAVE_NODE_MEMORY, 4096
+              vcpu: {{ os_env('CID_NODE_CPU', 3) }}
+              memory: {{ os_env('CID_NODE_MEMORY', 12288) }}
               boot:
                 - hd
               cloud_init_volume_name: iso
               cloud_init_iface_up: ens3
               volumes:
                 - name: system
-                  capacity: !os_env NODE_VOLUME_SIZE, 150
+                  capacity: {{ os_env('CID_NODE_VOLUME_SIZE', 150) }}
                   backing_store: cloudimage1604
                   format: qcow2
                 - name: iso  # Volume with name 'iso' will be used
@@ -296,15 +294,15 @@
           - name: {{ HOSTNAME_CID02 }}
             role: salt_minion
             params:
-              vcpu: !os_env SLAVE_NODE_CPU, 4
-              memory: !os_env SLAVE_NODE_MEMORY, 4096
+              vcpu: {{ os_env('CID_NODE_CPU', 3) }}
+              memory: {{ os_env('CID_NODE_MEMORY', 12288) }}
               boot:
                 - hd
               cloud_init_volume_name: iso
               cloud_init_iface_up: ens3
               volumes:
                 - name: system
-                  capacity: !os_env NODE_VOLUME_SIZE, 150
+                  capacity: {{ os_env('CID_NODE_VOLUME_SIZE', 150) }}
                   backing_store: cloudimage1604
                   format: qcow2
                 - name: iso  # Volume with name 'iso' will be used
@@ -322,15 +320,15 @@
           - name: {{ HOSTNAME_CID03 }}
             role: salt_minion
             params:
-              vcpu: !os_env SLAVE_NODE_CPU, 4
-              memory: !os_env SLAVE_NODE_MEMORY, 6144
+              vcpu: {{ os_env('CID_NODE_CPU', 3) }}
+              memory: {{ os_env('CID_NODE_MEMORY', 12288) }}
               boot:
                 - hd
               cloud_init_volume_name: iso
               cloud_init_iface_up: ens3
               volumes:
                 - name: system
-                  capacity: !os_env NODE_VOLUME_SIZE, 150
+                  capacity: {{ os_env('CID_NODE_VOLUME_SIZE', 150) }}
                   backing_store: cloudimage1604
                   format: qcow2
                 - name: iso  # Volume with name 'iso' will be used
@@ -348,15 +346,15 @@
           - name: {{ HOSTNAME_CTL01 }}
             role: salt_minion
             params:
-              vcpu: !os_env SLAVE_NODE_CPU, 2
-              memory: !os_env SLAVE_NODE_MEMORY, 6144
+              vcpu: {{ os_env('CTL_NODE_CPU', 3) }}
+              memory: {{ os_env('CTL_NODE_MEMORY', 12288) }}
               boot:
                 - hd
               cloud_init_volume_name: iso
               cloud_init_iface_up: ens3
               volumes:
                 - name: system
-                  capacity: !os_env NODE_VOLUME_SIZE, 150
+                  capacity: {{ os_env('CTL_NODE_VOLUME_SIZE', 150) }}
                   backing_store: cloudimage1604
                   format: qcow2
                 - name: cinder
@@ -377,15 +375,15 @@
           - name: {{ HOSTNAME_CTL02 }}
             role: salt_minion
             params:
-              vcpu: !os_env SLAVE_NODE_CPU, 2
-              memory: !os_env SLAVE_NODE_MEMORY, 6144
+              vcpu: {{ os_env('CTL_NODE_CPU', 3) }}
+              memory: {{ os_env('CTL_NODE_MEMORY', 12288) }}
               boot:
                 - hd
               cloud_init_volume_name: iso
               cloud_init_iface_up: ens3
               volumes:
                 - name: system
-                  capacity: !os_env NODE_VOLUME_SIZE, 150
+                  capacity: {{ os_env('CTL_NODE_VOLUME_SIZE', 150) }}
                   backing_store: cloudimage1604
                   format: qcow2
                 - name: cinder
@@ -406,15 +404,15 @@
           - name: {{ HOSTNAME_CTL03 }}
             role: salt_minion
             params:
-              vcpu: !os_env SLAVE_NODE_CPU, 2
-              memory: !os_env SLAVE_NODE_MEMORY, 6144
+              vcpu: {{ os_env('CTL_NODE_CPU', 3) }}
+              memory: {{ os_env('CTL_NODE_MEMORY', 12288) }}
               boot:
                 - hd
               cloud_init_volume_name: iso
               cloud_init_iface_up: ens3
               volumes:
                 - name: system
-                  capacity: !os_env NODE_VOLUME_SIZE, 150
+                  capacity: {{ os_env('CTL_NODE_VOLUME_SIZE', 150) }}
                   backing_store: cloudimage1604
                   format: qcow2
                 - name: cinder
@@ -435,15 +433,15 @@
           - name: {{ HOSTNAME_MON01 }}
             role: salt_minion
             params:
-              vcpu: !os_env SLAVE_NODE_CPU, 2
-              memory: !os_env SLAVE_NODE_MEMORY, 4096
+              vcpu: {{ os_env('MON_NODE_CPU', 2) }}
+              memory: {{ os_env('MON_NODE_MEMORY', 12288) }}
               boot:
                 - hd
               cloud_init_volume_name: iso
               cloud_init_iface_up: ens3
               volumes:
                 - name: system
-                  capacity: !os_env NODE_VOLUME_SIZE, 150
+                  capacity: {{ os_env('MON_NODE_VOLUME_SIZE', 150) }}
                   backing_store: cloudimage1604
                   format: qcow2
                 - name: cinder
@@ -464,15 +462,15 @@
           - name: {{ HOSTNAME_MON02 }}
             role: salt_minion
             params:
-              vcpu: !os_env SLAVE_NODE_CPU, 2
-              memory: !os_env SLAVE_NODE_MEMORY, 6144
+              vcpu: {{ os_env('MON_NODE_CPU', 2) }}
+              memory: {{ os_env('MON_NODE_MEMORY', 12288) }}
               boot:
                 - hd
               cloud_init_volume_name: iso
               cloud_init_iface_up: ens3
               volumes:
                 - name: system
-                  capacity: !os_env NODE_VOLUME_SIZE, 150
+                  capacity: {{ os_env('MON_NODE_VOLUME_SIZE', 150) }}
                   backing_store: cloudimage1604
                   format: qcow2
                 - name: cinder
@@ -493,15 +491,15 @@
           - name: {{ HOSTNAME_MON03 }}
             role: salt_minion
             params:
-              vcpu: !os_env SLAVE_NODE_CPU, 2
-              memory: !os_env SLAVE_NODE_MEMORY, 4096
+              vcpu: {{ os_env('MON_NODE_CPU', 2) }}
+              memory: {{ os_env('MON_NODE_MEMORY', 12288) }}
               boot:
                 - hd
               cloud_init_volume_name: iso
               cloud_init_iface_up: ens3
               volumes:
                 - name: system
-                  capacity: !os_env NODE_VOLUME_SIZE, 150
+                  capacity: {{ os_env('MON_NODE_VOLUME_SIZE', 150) }}
                   backing_store: cloudimage1604
                   format: qcow2
                 - name: cinder
@@ -522,15 +520,15 @@
           - name: {{ HOSTNAME_PRX01 }}
             role: salt_minion
             params:
-              vcpu: !os_env SLAVE_NODE_CPU, 1
-              memory: !os_env SLAVE_NODE_MEMORY, 2048
+              vcpu: {{ os_env('MON_NODE_CPU', 1) }}
+              memory: {{ os_env('MON_NODE_MEMORY', 4096) }}
               boot:
                 - hd
               cloud_init_volume_name: iso
               cloud_init_iface_up: ens3
               volumes:
                 - name: system
-                  capacity: !os_env NODE_VOLUME_SIZE, 150
+                  capacity: {{ os_env('MON_NODE_VOLUME_SIZE', 150) }}
                   backing_store: cloudimage1604
                   format: qcow2
                 - name: cinder
@@ -551,15 +549,15 @@
           - name: {{ HOSTNAME_CMP01 }}
             role: salt_minion
             params:
-              vcpu: !os_env SLAVE_NODE_CPU, 2
-              memory: !os_env SLAVE_NODE_MEMORY, 3072
+              vcpu: {{ os_env('CMP_NODE_CPU', 2) }}
+              memory: {{ os_env('CMP_NODE_MEMORY', 3072) }}
               boot:
                 - hd
               cloud_init_volume_name: iso
               cloud_init_iface_up: ens3
               volumes:
                 - name: system
-                  capacity: !os_env NODE_VOLUME_SIZE, 150
+                  capacity: {{ os_env('CMP_NODE_VOLUME_SIZE', 150) }}
                   backing_store: cloudimage1604
                   format: qcow2
                 - name: iso  # Volume with name 'iso' will be used
@@ -599,28 +597,28 @@
                   networks:
                     - external
 
-#          - name: {{ HOSTNAME_CMP02 }}
-#            role: salt_minion
-#            params:
-#              vcpu: !os_env SLAVE_NODE_CPU, 2
-#              memory: !os_env SLAVE_NODE_MEMORY, 3072
-#              boot:
-#                - hd
-#              cloud_init_volume_name: iso
-#              cloud_init_iface_up: ens3
-#              volumes:
-#                - name: system
-#                  capacity: !os_env NODE_VOLUME_SIZE, 150
-#                  backing_store: cloudimage1604
-#                  format: qcow2
-#                - name: iso  # Volume with name 'iso' will be used
-#                             # for store image with cloud-init metadata.
-#                  capacity: 1
-#                  format: raw
-#                  device: cdrom
-#                  bus: ide
-#                  cloudinit_meta_data: *cloudinit_meta_data
-#                  cloudinit_user_data: *cloudinit_user_data_1604
+          - name: {{ HOSTNAME_CMP02 }}
+            role: salt_minion
+            params:
+              vcpu: {{ os_env('CMP_NODE_CPU', 2) }}
+              memory: {{ os_env('CMP_NODE_MEMORY', 3072) }}
+              boot:
+                - hd
+              cloud_init_volume_name: iso
+              cloud_init_iface_up: ens3
+              volumes:
+                - name: system
+                  capacity: {{ os_env('CMP_NODE_VOLUME_SIZE', 150) }}
+                  backing_store: cloudimage1604
+                  format: qcow2
+                - name: iso  # Volume with name 'iso' will be used
+                             # for store image with cloud-init metadata.
+                  capacity: 1
+                  format: raw
+                  device: cdrom
+                  bus: ide
+                  cloudinit_meta_data: *cloudinit_meta_data
+                  cloudinit_user_data: *cloudinit_user_data_1604
 
               interfaces: *all_interfaces
               network_config: *all_network_config
@@ -628,15 +626,15 @@
           - name: {{ HOSTNAME_GTW01 }}
             role: salt_minion
             params:
-              vcpu: !os_env SLAVE_NODE_CPU, 1
-              memory: !os_env SLAVE_NODE_MEMORY, 2048
+              vcpu: {{ os_env('GTW_NODE_CPU', 1) }}
+              memory: {{ os_env('GTW_NODE_MEMORY', 2048) }}
               boot:
                 - hd
               cloud_init_volume_name: iso
               cloud_init_iface_up: ens3
               volumes:
                 - name: system
-                  capacity: !os_env NODE_VOLUME_SIZE, 150
+                  capacity: {{ os_env('GTW_NODE_VOLUME_SIZE', 150) }}
                   backing_store: cloudimage1604
                   format: qcow2
                 - name: iso  # Volume with name 'iso' will be used