Initial implementation of ONAP scenarios 69/64369/51
authorMartin Klozik <martin.klozik@tieto.com>
Thu, 1 Nov 2018 08:49:45 +0000 (09:49 +0100)
committerMartin Klozik <martin.klozik@tieto.com>
Tue, 4 Dec 2018 10:24:34 +0000 (11:24 +0100)
Patch introduces a new specific scenarios os-nosdn-onap-*ha
for automatic ONAP deployment on top of the OPNFV installation.
Deployment and configuration of ONAP is managed by OPNFV Auto project.

New scenarios are based on generic os-nosdn-nofeature-*ha scenarios.

Auto project is responsible for os-nosdn-onap-*ha development
and maintenance.

JIRA: AUTO-71

Change-Id: I8b177668d856f30b62d1d135b80a95c32ebb9937
Signed-off-by: Martin Klozik <martin.klozik@tieto.com>
mcp/config/scenario/os-nosdn-onap-ha.yaml [new file with mode: 0644]
mcp/config/scenario/os-nosdn-onap-noha.yaml [new file with mode: 0644]
mcp/config/states/onap [new file with mode: 0755]

diff --git a/mcp/config/scenario/os-nosdn-onap-ha.yaml b/mcp/config/scenario/os-nosdn-onap-ha.yaml
new file mode 100644 (file)
index 0000000..d0e9c40
--- /dev/null
@@ -0,0 +1,46 @@
+##############################################################################
+# Copyright (c) 2018 Mirantis Inc., Enea AB, Tieto and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+# Scenario details:
+#   Specific scenario for ONAP deployment on top of OPNFV
+#   Scenario is based on generic os-nosdn-nofeature-ha scenario
+# Responsible: Auto project
+---
+cluster:
+  domain: mcp-ovs-ha.local
+  states:
+    - openstack_ha
+    - networks
+    - onap
+virtual:
+  nodes:
+    control:
+      - kvm01
+      - kvm02
+      - kvm03
+    compute:
+      - cmp001
+      - cmp002
+  # Below values are only used for each node if said node is virtual
+  mas01:
+    vcpus: 4
+    ram: 6144
+  kvm01:
+    vcpus: 4
+    ram: 14336
+  kvm02:
+    vcpus: 4
+    ram: 14336
+  kvm03:
+    vcpus: 4
+    ram: 14336
+  cmp001:
+    vcpus: 32
+    ram: 102400
+  cmp002:
+    vcpus: 32
+    ram: 102400
diff --git a/mcp/config/scenario/os-nosdn-onap-noha.yaml b/mcp/config/scenario/os-nosdn-onap-noha.yaml
new file mode 100644 (file)
index 0000000..ae62554
--- /dev/null
@@ -0,0 +1,39 @@
+##############################################################################
+# Copyright (c) 2017-2018 Mirantis Inc., Enea AB, Tieto and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+# Scenario details:
+#   Specific scenario for ONAP deployment on top of OPNFV
+#   Scenario is based on generic os-nosdn-nofeature-noha scenario
+# Responsible: Auto project
+---
+cluster:
+  domain: mcp-ovs-noha.local
+  states:
+    - openstack_noha
+    - neutron_gateway
+    - networks
+    - onap
+virtual:
+  nodes:
+    control:
+      - ctl01
+      - gtw01
+    compute:
+      - cmp001
+      - cmp002
+  # Below values are only used for each node if said node is virtual
+  ctl01:
+    vcpus: 4
+    ram: 16384
+  gtw01:
+    ram: 2048
+  cmp001:
+    vcpus: 36
+    ram: 122880
+  cmp002:
+    vcpus: 36
+    ram: 122880
diff --git a/mcp/config/states/onap b/mcp/config/states/onap
new file mode 100755 (executable)
index 0000000..d196074
--- /dev/null
@@ -0,0 +1,65 @@
+#!/bin/bash -e
+##############################################################################
+# Copyright (c) 2018 Tieto
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+# Deploy ONAP on top of OPNFV installed by Fuel/MCP
+# ONAP installation is managed by OPNFV Auto project
+
+AUTO_INSTALL_DIR=/opt/auto
+AUTO_REPO='https://gerrit.opnfv.org/gerrit/auto'
+ONAP_INSTALL_SCRIPT='ci/deploy-onap-fuel.sh'
+
+echo "Clone Auto Repo"
+salt -C 'I@nova:controller and *01*' cmd.run "\
+    rm -rf $AUTO_INSTALL_DIR; \
+    git clone $AUTO_REPO $AUTO_INSTALL_DIR"
+
+echo "ONAP installation starts at $(date)"
+echo "It can take several hours to finish."
+
+# detect compute HW configuration, i.e. minimal values available across
+# all compute nodes
+CMP_COUNT=$(salt -C 'I@nova:compute' grains.get id --out txt | wc -l)
+CMP_MIN_MEM=$(salt -C 'I@nova:compute' grains.get mem_total --out txt  |\
+    sed -re 's/^[^:]+: ([0-9]+)$/\1/g' | sort -n | head -n1)
+CMP_MIN_CPUS=$(salt -C 'I@nova:compute' grains.get num_cpus --out txt  |\
+    sed -re 's/^[^:]+: ([0-9]+)$/\1/g' | sort -n | head -n1)
+# check disk size for storage of instances; if shared storage is mounted,
+# then return its size, otherwise sum up avalable space of root disk of all
+# compute nodes
+STORAGE_PATH='/var/lib/nova/instances'
+MOUNT_COUNT=$(salt "cmp*" mount.is_mounted $STORAGE_PATH --out txt |\
+    grep True | wc -l)
+if [ $MOUNT_COUNT -eq $CMP_COUNT ] ; then
+    CMP_STORAGE_TOTAL=$(salt "cmp*" cmd.run "df -BGB $STORAGE_PATH" --out txt |\
+        grep "$STORAGE_PATH" |\
+        sed -re 's/^.* +([0-9]+)GB +([0-9]+GB +){2}.*$/\1/g' |\
+        sort -n | head -n1)
+else
+    CMP_STORAGE_TOTAL=0
+    for STORAGE in $(salt "cmp*" cmd.run "df -BGB /" --out txt | grep '/$' |\
+        sed -re 's/^.* +([0-9]+GB +){2}([0-9]+)GB +.*$/\2/g') ; do
+        CMP_STORAGE_TOTAL=$(($CMP_STORAGE_TOTAL+$STORAGE));
+    done
+fi
+
+# Deploy ONAP with detected configuration
+# execute installation from the 1st controller node
+CTL01=$(salt  -C 'I@nova:controller and *01*' grains.get id --out txt |\
+    head -n1 | cut -d':' -f1)
+ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
+    -i /root/fuel/mcp/scripts/mcp.rsa -l ubuntu $CTL01 "bash -s" <<COMMANDS
+  sudo -i
+  source /root/keystonercv3
+  cd $AUTO_INSTALL_DIR
+  export CMP_COUNT=$CMP_COUNT
+  export CMP_MIN_MEM=$CMP_MIN_MEM
+  export CMP_MIN_CPUS=$CMP_MIN_CPUS
+  export CMP_STORAGE_TOTAL=$CMP_STORAGE_TOTAL
+  export AUTO_INSTALL_DIR=$AUTO_INSTALL_DIR
+  $ONAP_INSTALL_SCRIPT | tee $AUTO_INSTALL_DIR/auto_deploy.log
+COMMANDS