summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--INFO14
-rw-r--r--INFO.yaml28
-rwxr-xr-xci/build-auto.sh129
-rw-r--r--lib/auto/testcase/resiliency/AutoResilItfCloud.py30
-rw-r--r--lib/auto/testcase/resiliency/AutoResilMgTestDef.py141
-rw-r--r--lib/auto/testcase/resiliency/clouds.yaml20
-rw-r--r--setup/VIMs/OpenStack/auto_script_config_openstack_for_onap.py602
-rw-r--r--setup/VIMs/OpenStack/clouds.yaml99
9 files changed, 706 insertions, 360 deletions
diff --git a/.gitignore b/.gitignore
index acb5d9d..70a5649 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,6 @@
/lib/auto.egg-info
/build
/dist
+/docs_build
+/docs_output
+/opnfvdocs
diff --git a/INFO b/INFO
index 10020fd..b266f87 100644
--- a/INFO
+++ b/INFO
@@ -1,3 +1,5 @@
+(obsolete: use only INFO.yaml)
+
Project: ONAP-Automated OPNFV (Auto)
Project Creation Date: August 15, 2017
Project Category:
@@ -13,15 +15,21 @@ Repository: auto
Committers:
Tina Tsou (tina.tsou@arm.com)
Harry Huang (huangxiangyu5@huawei.com)
+Mohankumar Navaneethan (mnavaneethan@mvista.com)
Song Zhu (song.zhu@arm.com)
-Prasad Gorja (prasad.gorja@nxp.com)
Liang Ou (oul.gd@chinatelecom.cn)
+Gerard Damm (gerard.damm@wipro.com)
+Joe Kidder (joe.kidder@5thlayer.com)
+Cristina Pauna (cristina.pauna@enea.com)
+Paul Vaduva (paul.vaduva@enea.com)
+Martin Klozik (martin.klozik@tieto.com)
+Richard Elias (richard.elias@tieto.com)
+
+Prasad Gorja (prasad.gorja@nxp.com)
Lei Chen (chenlei@caict.ac.cn)
Xiaoyu Wang (wxy_cttl@126.com)
Xu Lu (luxu_hd@163.com)
Eric Maye (eric.dmaye@wipro.com)
Chen Zhang (zhangchen.bri@chinatelecom.cn)
-Mohankumar Navaneethan (mnavaneethan@mvista.com)
-Gerard Damm (gerard.damm@wipro.com)
Link to TSC approval of the project: http://meetbot.opnfv.org/meetings/opnfv-meeting/2017/opnfv-meeting.2017-08-15-12.59.html
diff --git a/INFO.yaml b/INFO.yaml
index aee9a7b..00dbfda 100644
--- a/INFO.yaml
+++ b/INFO.yaml
@@ -38,10 +38,10 @@ committers:
email: 'huangxiangyu5@huawei.com'
company: 'huawei.com'
id: 'huangxiangyu'
- - name: 'Madhukesh Sambashivaiah'
- email: 'madhukeshs@gmail.com'
- company: 'gmail.com'
- id: 'madhukeshs'
+ - name: 'Mohankumar Navaneethan'
+ email: 'mnavaneethan@mvista.com'
+ company: 'Cavium'
+ id: 'nmohankumar'
- name: 'Song Zhu'
email: 'song.zhu@arm.com'
company: 'arm.com'
@@ -54,6 +54,26 @@ committers:
email: 'gerard.damm@wipro.com'
company: 'Wipro'
id: 'gerard_damm'
+ - name: 'Joe Kidder'
+ email: 'joe.kidder@5thlayer.com'
+ company: '5thlayer.com'
+ id: 'joe.kidder'
+ - name: 'Cristina Pauna'
+ email: 'cristina.pauna@enea.com'
+ company: 'enea.com'
+ id: 'cristinapauna'
+ - name: 'Paul Vaduva'
+ email: 'paul.vaduva@enea.com'
+ company: 'enea.com'
+ id: 'pvaduva'
+ - name: 'Martin Klozik'
+ email: 'martin.klozik@tieto.com'
+ company: 'tieto.com'
+ id: 'mklozik'
+ - name: 'Richard Elias'
+ email: 'richard.elias@tieto.com'
+ company: 'tieto.com'
+ id: 'richardxelias'
tsc:
# yamllint disable rule:line-length
approval: 'http//meetbot.opnfv.org/meetings/opnfv-meeting/2017/opnfv-meeting.2017-08-15-12.59.html'
diff --git a/ci/build-auto.sh b/ci/build-auto.sh
new file mode 100755
index 0000000..611d83a
--- /dev/null
+++ b/ci/build-auto.sh
@@ -0,0 +1,129 @@
+#!/bin/bash
+#
+# Copyright 2015-2018 Intel Corporation., Tieto
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# CI helper script for execution of AUTO project jenkins jobs.
+# This script is based on the file ci/build-vsperf.sh from OPNFV vswitchperf
+# project.
+
+# Usage:
+# build-auto.sh job_type
+# where job_type is one of "verify", "merge", "daily"
+#
+# Example:
+# ./ci/build-auto.sh daily
+
+#
+# exit codes
+#
+EXIT=0
+EXIT_UNKNOWN_JOB_TYPE=1
+
+#
+# configuration
+#
+AUTOENV_DIR="$HOME/autoenv"
+
+#
+# main
+#
+echo
+
+# enter workspace dir
+cd $WORKSPACE
+
+# create virtualenv if needed
+if [ ! -e $AUTOENV_DIR ] ; then
+ echo "Create AUTO environment"
+ echo "======================="
+ virtualenv "$AUTOENV_DIR"
+ echo
+fi
+
+# activate and update virtualenv
+echo "Update AUTO environment"
+echo "======================="
+source "$AUTOENV_DIR"/bin/activate
+pip install -r ./requirements.txt
+echo
+
+# execute job based on passed parameter
+case $1 in
+ "verify")
+ echo "==============="
+ echo "AUTO verify job"
+ echo "==============="
+
+ # Example of verify job body. Functions can call
+ # external scripts, etc.
+
+ #execute_auto_pylint_check
+ #execute_auto_doc_check
+ #install_opnfv MCP
+ #install_onap
+ #execute_sanity_check
+ #execute_tests $1
+
+ # Everything went well, so report SUCCESS to Jenkins
+ exit $EXIT
+ ;;
+ "merge")
+ echo "=============="
+ echo "AUTO merge job"
+ echo "=============="
+
+ # Example of merge job body. Functions can call
+ # external scripts, etc.
+
+ #execute_auto_pylint_check
+ #execute_auto_doc_check
+ #install_opnfv MCP
+ #install_onap
+ #execute_sanity_check
+ #execute_tests $1
+
+ # Everything went well, so report SUCCESS to Jenkins
+ exit $EXIT
+ ;;
+ "daily")
+ echo "=============="
+ echo "AUTO daily job"
+ echo "=============="
+
+ # Example of daily job body. Functions can call
+ # external scripts, etc.
+
+ #install_opnfv MCP
+ #install_onap
+ #execute_sanity_check
+ #execute_tests $1
+ #push_results_and_logs_to_artifactory
+
+ # Everything went well, so report SUCCESS to Jenkins
+ exit $EXIT
+ ;;
+ *)
+ echo
+ echo "ERRROR: Unknown job type \"$1\""
+ echo
+ exit $EXIT_UNKNOWN_JOB_TYPE
+ ;;
+esac
+
+exit $EXIT_UNKNOWN_JOB_TYPE
+
+#
+# end
+#
diff --git a/lib/auto/testcase/resiliency/AutoResilItfCloud.py b/lib/auto/testcase/resiliency/AutoResilItfCloud.py
index 302a662..7feb518 100644
--- a/lib/auto/testcase/resiliency/AutoResilItfCloud.py
+++ b/lib/auto/testcase/resiliency/AutoResilItfCloud.py
@@ -159,7 +159,8 @@ def gdtest_openstack():
# Method 1 (preferred) : assume there is a clouds.yaml file in PATH, starting path search with local directory
#conn = openstack.connect(cloud='armopenstack', region_name='RegionOne')
#conn = openstack.connect(cloud='hpe16openstackEuphrates', region_name='RegionOne')
- conn = openstack.connect(cloud='hpe16openstackFraser', region_name='RegionOne')
+ #conn = openstack.connect(cloud='hpe16openstackFraser', region_name='RegionOne')
+ conn = openstack.connect(cloud='unh-hpe-openstack-fraser', region_name='RegionOne')
# if getting error: AttributeError: module 'openstack' has no attribute 'connect', check that openstack is installed for this python version
@@ -208,8 +209,8 @@ def gdtest_openstack():
openstack_list_projects(conn)
openstack_list_domains(conn)
- # VM: hpe16-Auto-UC2-gdtest-compute1
- gds_ID = '715c677a-7914-4ca8-8c6d-75bf29eeb940'
+ # VM test: create a test VM in the OpenStack instance, enter its ID here
+ gds_ID = '5d07da11-0e85-4256-9894-482dcee4a5f0'
gds = conn.compute.get_server(gds_ID)
print('\ngds.name=',gds.name)
print('gds.status=',gds.status)
@@ -229,27 +230,8 @@ def gdtest_openstack():
- #VM: test3
- gds_ID = 'd3ceffc3-5967-4f18-b8b5-b1b2bd7ab76d'
- gds = conn.compute.get_server(gds_ID)
- print('\ngds.name=',gds.name)
- print('gds.status=',gds.status)
- print('suspending...')
- conn.compute.suspend_server(gds_ID) # NOT synchronous: returns before suspension action is completed
- wait_seconds = 10
- print(' waiting',wait_seconds,'seconds...')
- time.sleep(wait_seconds)
- gds = conn.compute.get_server(gds_ID) # need to refresh data; not maintained live
- print('gds.status=',gds.status)
- print('resuming...')
- conn.compute.resume_server(gds_ID)
- print(' waiting',wait_seconds,'seconds...')
- time.sleep(wait_seconds)
- gds = conn.compute.get_server(gds_ID) # need to refresh data; not maintained live
- print('gds.status=',gds.status)
-
- #Volume: hpe16-Auto-UC2-gdtest-volume1
- gdv_ID = '5a6c1dbd-5097-4a9b-8f79-6f03cde18bf6'
+ #Volume test: volume attached to test VM; get its ID and enter it here
+ gdv_ID = 'd0206ff2-507c-444a-9871-b5b7ea704994'
gdv = conn.block_storage.get_volume(gdv_ID)
# no API for stopping/restarting a volume... only delete. ONAP would have to completely migrate a VNF depending on this volume
print('\ngdv.name=',gdv.name)
diff --git a/lib/auto/testcase/resiliency/AutoResilMgTestDef.py b/lib/auto/testcase/resiliency/AutoResilMgTestDef.py
index 7e0b50d..edf899a 100644
--- a/lib/auto/testcase/resiliency/AutoResilMgTestDef.py
+++ b/lib/auto/testcase/resiliency/AutoResilMgTestDef.py
@@ -54,7 +54,9 @@ import sys
from enum import Enum
from datetime import datetime, timedelta
import AutoResilGlobal
-#import openstack
+import openstack
+import time
+
# Constants with definition file names
FILE_PHYSICAL_RESOURCES = "ResourcesPhysical.bin"
@@ -319,8 +321,9 @@ class TestDefinition(AutoBaseObject):
self.test_code_list.append(self.test_code010)
- def run_test_code(self):
- """Run currently selected test code. Common code runs here, specific code is invoked through test_code_list and test_code_ID."""
+ def run_test_code(self, *test_code_args, **test_code_kwargs):
+ """Run currently selected test code. Common code runs here, specific code is invoked through test_code_list and test_code_ID.
+ Optional parameters can be passed if needed (unnamed or named), interpreted accordingly by selected test code."""
try:
# here, trigger start code from challenge def (to simulate VM failure), manage Recovery time measurement,
# specific monitoring of VNF, trigger stop code from challenge def
@@ -355,7 +358,8 @@ class TestDefinition(AutoBaseObject):
# call specific test definition code, via table of functions; this code should monitor a VNF and return when restoration is observed
test_code_index = self.test_code_ID - 1 # lists are indexed from 0 to N-1
- self.test_code_list[test_code_index]() # invoke corresponding method, via index; could check for return code
+ # invoke corresponding method, via index; could check for return code
+ self.test_code_list[test_code_index](*test_code_args, **test_code_kwargs)
# memorize restoration detection time and compute recovery time
test_exec.restoration_detection_time = datetime.now()
@@ -382,23 +386,23 @@ class TestDefinition(AutoBaseObject):
# library of test codes, probably 1 per test case, so test_case_ID would be the same as test_code_ID
- def test_code001(self):
+ def test_code001(self, *test_code_args, **test_code_kwargs):
"""Test case code number 001."""
print("This is test_code001 from TestDefinition #", self.ID, ", test case #", self.test_case_ID, sep='')
- def test_code002(self):
+ def test_code002(self, *test_code_args, **test_code_kwargs):
"""Test case code number 002."""
print("This is test_code002 from TestDefinition #", self.ID, ", test case #", self.test_case_ID, sep='')
- def test_code003(self):
+ def test_code003(self, *test_code_args, **test_code_kwargs):
"""Test case code number 003."""
print("This is test_code003 from TestDefinition #", self.ID, ", test case #", self.test_case_ID, sep='')
- def test_code004(self):
+ def test_code004(self, *test_code_args, **test_code_kwargs):
"""Test case code number 004."""
print("This is test_code004 from TestDefinition #", self.ID, ", test case #", self.test_case_ID, sep='')
- def test_code005(self):
+ def test_code005(self, *test_code_args, **test_code_kwargs):
"""Test case code number 005."""
print("This is test_code005 from TestDefinition #", self.ID, ", test case #", self.test_case_ID, sep='')
@@ -407,23 +411,46 @@ class TestDefinition(AutoBaseObject):
# return when VNF is recovered
# may provision for failure to recover (max time to wait; return code: recovery OK boolean)
- def test_code006(self):
+ # June 2018, test of code logic, using newly released OpenStack SDK 0.14.0
+ # VM is created arbitrarily, not yet with ONAP
+ # Openstack cloud was created by Fuel/MCP, descriptor in clouds.yaml file
+ # VM resume done in Horizon (to simulate an ONAP-based recovery)
+ # retrieved status values: {'ACTIVE', 'SUSPENDED'}
+ # loop: wait 2 seconds, check status, stop loop when status is ACTIVE
+ conn = openstack.connect(cloud='unh-hpe-openstack-fraser', region_name='RegionOne')
+ test_VM_ID = '5d07da11-0e85-4256-9894-482dcee4a5f0' # arbitrary in this test, grab from OpenStack
+ test_VM = conn.compute.get_server(test_VM_ID)
+ print(' test_VM.name=',test_VM.name)
+ print(' test_VM.status=',test_VM.status)
+ test_VM_current_status = test_VM.status
+ wait_seconds = 2
+ nb_seconds_waited = 0
+ while test_VM_current_status != 'ACTIVE':
+ print(' waiting',wait_seconds,'seconds...')
+ time.sleep(wait_seconds)
+ test_VM = conn.compute.get_server(test_VM_ID) # need to get VM object ID, for an updated status attribute
+ test_VM_current_status = test_VM.status
+ nb_seconds_waited = nb_seconds_waited + wait_seconds
+ print(' nb_seconds_waited=',nb_seconds_waited)
+
+
+ def test_code006(self, *test_code_args, **test_code_kwargs):
"""Test case code number 006."""
print("This is test_code006 from TestDefinition #", self.ID, ", test case #", self.test_case_ID, sep='')
- def test_code007(self):
+ def test_code007(self, *test_code_args, **test_code_kwargs):
"""Test case code number 007."""
print("This is test_code007 from TestDefinition #", self.ID, ", test case #", self.test_case_ID, sep='')
- def test_code008(self):
+ def test_code008(self, *test_code_args, **test_code_kwargs):
"""Test case code number 008."""
print("This is test_code008 from TestDefinition #", self.ID, ", test case #", self.test_case_ID, sep='')
- def test_code009(self):
+ def test_code009(self, *test_code_args, **test_code_kwargs):
"""Test case code number 009."""
print("This is test_code009 from TestDefinition #", self.ID, ", test case #", self.test_case_ID, sep='')
- def test_code010(self):
+ def test_code010(self, *test_code_args, **test_code_kwargs):
"""Test case code number 010."""
print("This is test_code010 from TestDefinition #", self.ID, ", test case #", self.test_case_ID, sep='')
@@ -622,20 +649,25 @@ class ChallengeDefinition(AutoBaseObject):
self.stop_challenge_code_list.append(self.stop_challenge_code010)
- def run_start_challenge_code(self):
- """Run currently selected challenge code, start portion."""
+ def run_start_challenge_code(self, *chall_code_args, **chall_code_kwargs):
+ """Run currently selected challenge code, start portion.
+ Optional parameters can be passed if needed (unnamed or named), interpreted accordingly by selected test code."""
+
try:
code_index = self.challenge_code_ID - 1 # lists are indexed from 0 to N-1
- self.start_challenge_code_list[code_index]() # invoke corresponding start method, via index
+ # invoke corresponding start method, via index
+ self.start_challenge_code_list[code_index](*chall_code_args, **chall_code_kwargs)
except Exception as e:
print(type(e), e)
sys.exit()
- def run_stop_challenge_code(self):
- """Run currently selected challenge code, stop portion."""
+ def run_stop_challenge_code(self, *chall_code_args, **chall_code_kwargs):
+ """Run currently selected challenge code, stop portion.
+ Optional parameters can be passed if needed (unnamed or named), interpreted accordingly by selected test code."""
try:
code_index = self.challenge_code_ID - 1 # lists are indexed from 0 to N-1
- self.stop_challenge_code_list[code_index]() # invoke corresponding stop method, via index
+ # invoke corresponding stop method, via index
+ self.stop_challenge_code_list[code_index](*chall_code_args, **chall_code_kwargs)
except Exception as e:
print(type(e), e)
sys.exit()
@@ -643,35 +675,35 @@ class ChallengeDefinition(AutoBaseObject):
# library of challenge codes
- def start_challenge_code001(self):
+ def start_challenge_code001(self, *chall_code_args, **chall_code_kwargs):
"""Start Challenge code number 001."""
print("This is start_challenge_code001 from ChallengeDefinition #",self.ID, sep='')
- def stop_challenge_code001(self):
+ def stop_challenge_code001(self, *chall_code_args, **chall_code_kwargs):
"""Stop Challenge code number 001."""
print("This is stop_challenge_code001 from ChallengeDefinition #",self.ID, sep='')
- def start_challenge_code002(self):
+ def start_challenge_code002(self, *chall_code_args, **chall_code_kwargs):
"""Start Challenge code number 002."""
print("This is start_challenge_code002 from ChallengeDefinition #",self.ID, sep='')
- def stop_challenge_code002(self):
+ def stop_challenge_code002(self, *chall_code_args, **chall_code_kwargs):
"""Stop Challenge code number 002."""
print("This is stop_challenge_code002 from ChallengeDefinition #",self.ID, sep='')
- def start_challenge_code003(self):
+ def start_challenge_code003(self, *chall_code_args, **chall_code_kwargs):
"""Start Challenge code number 003."""
print("This is start_challenge_code003 from ChallengeDefinition #",self.ID, sep='')
- def stop_challenge_code003(self):
+ def stop_challenge_code003(self, *chall_code_args, **chall_code_kwargs):
"""Stop Challenge code number 003."""
print("This is stop_challenge_code003 from ChallengeDefinition #",self.ID, sep='')
- def start_challenge_code004(self):
+ def start_challenge_code004(self, *chall_code_args, **chall_code_kwargs):
"""Start Challenge code number 004."""
print("This is start_challenge_code004 from ChallengeDefinition #",self.ID, sep='')
- def stop_challenge_code004(self):
+ def stop_challenge_code004(self, *chall_code_args, **chall_code_kwargs):
"""Stop Challenge code number 004."""
print("This is stop_challenge_code004 from ChallengeDefinition #",self.ID, sep='')
- def start_challenge_code005(self):
+ def start_challenge_code005(self, *chall_code_args, **chall_code_kwargs):
"""Start Challenge code number 005."""
print("This is start_challenge_code005 from ChallengeDefinition #",self.ID, sep='')
# challenge #5, related to test case #5, i.e. test def #5
@@ -682,8 +714,23 @@ class ChallengeDefinition(AutoBaseObject):
# conn.compute.servers() to get list of servers, using VM ID, check server.id and/or server.name
# conn.compute.suspend_server(this server id)
-
- def stop_challenge_code005(self):
+ # June 2018, test of code logic, using newly released OpenStack SDK 0.14.0
+ # VM is created arbitrarily, not yet with ONAP
+ # Openstack cloud was created by Fuel/MCP, descriptor in clouds.yaml file
+ # VM resume done in Horizon (to simulate an ONAP-based recovery)
+ conn = openstack.connect(cloud='unh-hpe-openstack-fraser', region_name='RegionOne')
+ test_VM_ID = '5d07da11-0e85-4256-9894-482dcee4a5f0' # arbitrary in this test, grab from OpenStack
+ test_VM = conn.compute.get_server(test_VM_ID)
+ print(' test_VM.name=',test_VM.name)
+ print(' test_VM.status=',test_VM.status)
+ print(' suspending...')
+ conn.compute.suspend_server(test_VM_ID)
+ # wait a bit before continuing: ensure VM is actually suspended
+ wait_seconds = 10
+ print(' waiting',wait_seconds,'seconds...')
+ time.sleep(wait_seconds)
+
+ def stop_challenge_code005(self, *chall_code_args, **chall_code_kwargs):
"""Stop Challenge code number 005."""
print("This is stop_challenge_code005 from ChallengeDefinition #",self.ID, sep='')
# challenge #5, related to test case #5, i.e. test def #5
@@ -694,39 +741,49 @@ class ChallengeDefinition(AutoBaseObject):
# conn.compute.servers() to get list of servers, using VM ID, check server.id and/or server.name
# conn.compute.conn.compute.resume_server(this server id)
+ # June 2018, test of code logic, using newly released OpenStack SDK 0.14.0
+ # this resume would be the normal challenge stop, but not in the case of this test
+ conn = openstack.connect(cloud='unh-hpe-openstack-fraser', region_name='RegionOne')
+ test_VM_ID = '5d07da11-0e85-4256-9894-482dcee4a5f0' # arbitrary in this test, grab from OpenStack
+ test_VM = conn.compute.get_server(test_VM_ID)
+ print(' test_VM.name=',test_VM.name)
+ print(' test_VM.status=',test_VM.status)
+ print(' suspending...')
+ conn.compute.resume_server(test_VM_ID)
+
- def start_challenge_code006(self):
+ def start_challenge_code006(self, *chall_code_args, **chall_code_kwargs):
"""Start Challenge code number 006."""
print("This is start_challenge_code006 from ChallengeDefinition #",self.ID, sep='')
- def stop_challenge_code006(self):
+ def stop_challenge_code006(self, *chall_code_args, **chall_code_kwargs):
"""Stop Challenge code number 006."""
print("This is stop_challenge_code006 from ChallengeDefinition #",self.ID, sep='')
- def start_challenge_code007(self):
+ def start_challenge_code007(self, *chall_code_args, **chall_code_kwargs):
"""Start Challenge code number 007."""
print("This is start_challenge_code007 from ChallengeDefinition #",self.ID, sep='')
- def stop_challenge_code007(self):
+ def stop_challenge_code007(self, *chall_code_args, **chall_code_kwargs):
"""Stop Challenge code number 007."""
print("This is stop_challenge_code007 from ChallengeDefinition #",self.ID, sep='')
- def start_challenge_code008(self):
+ def start_challenge_code008(self, *chall_code_args, **chall_code_kwargs):
"""Start Challenge code number 008."""
print("This is start_challenge_code008 from ChallengeDefinition #",self.ID, sep='')
- def stop_challenge_code008(self):
+ def stop_challenge_code008(self, *chall_code_args, **chall_code_kwargs):
"""Stop Challenge code number 008."""
print("This is stop_challenge_code008 from ChallengeDefinition #",self.ID, sep='')
- def start_challenge_code009(self):
+ def start_challenge_code009(self, *chall_code_args, **chall_code_kwargs):
"""Start Challenge code number 009."""
print("This is start_challenge_code009 from ChallengeDefinition #",self.ID, sep='')
- def stop_challenge_code009(self):
+ def stop_challenge_code009(self, *chall_code_args, **chall_code_kwargs):
"""Stop Challenge code number 009."""
print("This is stop_challenge_code009 from ChallengeDefinition #",self.ID, sep='')
- def start_challenge_code010(self):
+ def start_challenge_code010(self, *chall_code_args, **chall_code_kwargs):
"""Start Challenge code number 010."""
print("This is start_challenge_code010 from ChallengeDefinition #",self.ID, sep='')
- def stop_challenge_code010(self):
+ def stop_challenge_code010(self, *chall_code_args, **chall_code_kwargs):
"""Stop Challenge code number 010."""
print("This is stop_challenge_code010 from ChallengeDefinition #",self.ID, sep='')
@@ -797,7 +854,7 @@ def init_challenge_definitions():
# in CLI:
# $ nova suspend NAME
# $ nova resume NAME
- # but better use openstack SDK
+ # but better use OpenStack SDK
chall_def_startChallengeAPICommandSent = []
chall_def_stopChallengeAPICommandSent = []
diff --git a/lib/auto/testcase/resiliency/clouds.yaml b/lib/auto/testcase/resiliency/clouds.yaml
index e6ec824..7bfd717 100644
--- a/lib/auto/testcase/resiliency/clouds.yaml
+++ b/lib/auto/testcase/resiliency/clouds.yaml
@@ -32,14 +32,16 @@ clouds:
password: opnfv_secret
region_name: RegionOne
- # Openstack instance on LaaS hpe16, from OPNFV Fraser, controller IP@ (mgt: 172.16.10.36; public: 10.16.0.107)
+ # Openstack instance on generic LaaS hpe, from OPNFV Fraser, controller IP@ (mgt: 172.16.10.36; public: 10.16.0.107)
# keystone endpoints (openstack endpoint list --service keystone)
# admin: http://172.16.10.36:35357/v3
# internal: http://172.16.10.36:5000/v3
# public: http://10.16.0.107:5000/v3
# Horizon: https://10.16.0.107:8078, but need SSH port forwarding through 10.10.100.26 to be reached from outside
# "If you are using Identity v3 you need to specify the user and the project domain name"
- hpe16openstackFraser:
+
+ # generic cloud name, for a UNH IOL hpe server, for OPNFV Fraser, OpenStack installed by Fuel/MCP
+ unh-hpe-openstack-fraser:
auth:
auth_url: http://10.16.0.107:5000/v3
project_name: admin
@@ -48,6 +50,7 @@ clouds:
user_domain_name: Default
project_domain_name: Default
region_name: RegionOne
+ identity_api_version: 3
# ubuntu@ctl01:~$ openstack project show admin
# +-------------+----------------------------------+
@@ -82,19 +85,6 @@ clouds:
# | name | heat_user_domain |
# +-------------+---------------------------------------------+
-# admin user (from Horizon on hpe16):
-# Domain ID default
-# Domain Name Default
-# User Name admin
-# Description None
-# ID df0ea50cfcff4bbfbfdfefccdb018834
-# Email root@localhost
-# Enabled Yes
-# Primary Project ID 04fcfe7aa83f4df79ae39ca748aa8637
-# Primary Project Name admin
-
-
-
# export OS_AUTH_URL=http://10.16.0.107:5000/v3
# export OS_PROJECT_ID=04fcfe7aa83f4df79ae39ca748aa8637
diff --git a/setup/VIMs/OpenStack/auto_script_config_openstack_for_onap.py b/setup/VIMs/OpenStack/auto_script_config_openstack_for_onap.py
index bab2c59..e4b94f5 100644
--- a/setup/VIMs/OpenStack/auto_script_config_openstack_for_onap.py
+++ b/setup/VIMs/OpenStack/auto_script_config_openstack_for_onap.py
@@ -24,13 +24,15 @@
# https://wiki.opnfv.org/pages/viewpage.action?pageId=12389095
#docstring
-"""This script configures an OpenStack instance to make it ready to interface with an ONAP instance, for example to host VM-based VNFs deployed by ONAP.
+"""This script configures an OpenStack instance to make it ready to interface with an ONAP instance, for example to host VM-based VNFs deployed by ONAP. It can also remove the created objects, when used in a clean-up procedure.
+Use -h option to see usage (-del to delete objects, -deb to print debug information).
+Requirements: python 3, OpenStack SDK (0.14 or greater), clouds.yaml file, .img files are downloaded
Auto project: https://wiki.opnfv.org/pages/viewpage.action?pageId=12389095
"""
######################################################################
-# This script configures an OpenStack instance (e.g. from an OPNFV installer like FUEL/MCP) to make it
-# ready to interface with an ONAP instance, for example to host VM-based VNFs deployed by ONAP.
+# This script configures an OpenStack instance (e.g. from an OPNFV installer like FUEL/MCP, Compass4nfv, ...)
+# to make it ready to interface with an ONAP instance, for example to host VM-based VNFs deployed by ONAP.
# After running this script, the created OpenStack object names/IDs can be used for example to populate
# YAML&ENV files used by ONAP (installation of ONAP itself, VNF descriptor files, etc.).
@@ -42,12 +44,15 @@ Auto project: https://wiki.opnfv.org/pages/viewpage.action?pageId=12389095
# (optional, probably not needed: create a new group, which can be associated to a project, and contains users)
# 2) create an ONAP user within the ONAP project, so as not to use the "admin" user for ONAP
# (associate user to group if applicable; credentials: name/pwd or name/APIkey, or token)
-# 3) create an ONAP security group, to allow ICMP traffic (for pings) and TCP port 22 (for SSH), rather than changing default security group(s)
-# (optional, probably not needed: create new region; default region RegionOne is OK)
+# 3) create an ONAP security group, to allow ICMP traffic (for pings) and TCP port 22 (for SSH),
+# rather than changing default security group(s)
+# (optional, probably not needed: create a new region; default region RegionOne is OK)
# 4) create a public network for ONAP VNFs, with subnet and CIDR block
# (so components have access to the Internet, via router and gateway, on unnamed ports, dynamic IP@ allocation)
-# 5) create a private and an OAM network for ONAP VNFs or other ONAP components, with their respective subnet and CIDR block
-# (ONAP VNFs will be deployed in this private and/or OAM network(s), usually with named ports and static IP@ as per VNF configuration file)
+# 5) create a private and an OAM network for ONAP VNFs or other ONAP components,
+# with their respective subnet and CIDR block
+# (ONAP VNFs will be deployed in this private and/or OAM network(s), usually with named ports
+# and static IP@ as per VNF configuration file)
# 6) create an OpenStack router, with interfaces to the public, private and OAM networks,
# and a reference to an external network (gateway) provided by the OpenStack instance installation
# 7) create VM flavors as needed: m1.medium, etc.
@@ -59,11 +64,13 @@ Auto project: https://wiki.opnfv.org/pages/viewpage.action?pageId=12389095
# - python3 is installed
# - OpenStack SDK is installed for python3
# - there is a clouds.yaml file (describing the OpenStack instance, especially the Auth URL and admin credentials)
+# - .img files (Ubuntu Trusty Tahr, Xenial Xerus, Cirros, ... are downloaded, and stored in IMAGES_DIR
# - the script connects to OpenStack as a user with admin rights
# typical commands to install OpenStack SDK Python client:
# apt install python3-pip
# pip3 install --upgrade pip
+# hash -r
# pip3 list
# pip3 install openstacksdk
# pip3 install --upgrade openstacksdk
@@ -85,7 +92,8 @@ ONAP_USER_NAME = 'ONAP_user'
ONAP_USER_PASSWORD = 'auto_topsecret'
ONAP_USER_DESC = 'OpenStack User created for ONAP'
-ONAP_TENANT_NAME = 'ONAP_tenant' # "project" is a more generic concept than "tenant"; a tenant is type of project; quotas are per project;
+ONAP_TENANT_NAME = 'ONAP_tenant'
+# note: "project" is a more generic concept than "tenant"; a tenant is type of project; quotas are per project;
ONAP_TENANT_DESC = 'OpenStack Project/Tenant created for ONAP'
ONAP_SECU_GRP_NAME = 'ONAP_security_group'
@@ -93,30 +101,35 @@ ONAP_SECU_GRP_DESC = 'Security Group created for ONAP'
ONAP_PUBLIC_NET_NAME = 'ONAP_public_net'
ONAP_PUBLIC_SUBNET_NAME = 'ONAP_public_subnet'
-ONAP_PUBLIC_SUBNET_CIDR = '192.168.99.0/24' # some arbitrary CIDR, but typically in a private (IANA-reserved) address range
+ONAP_PUBLIC_SUBNET_CIDR = '192.168.99.0/24'
+# note: some arbitrary CIDR, but typically in a private (IANA-reserved) address range
ONAP_PUBLIC_NET_DESC = 'Public network created for ONAP, for unnamed ports, dynamic IP@, access to the Internet (e.g., Nexus repo) via Gateway'
ONAP_PRIVATE_NET_NAME = 'ONAP_private_net'
ONAP_PRIVATE_SUBNET_NAME = 'ONAP_private_subnet'
-ONAP_PRIVATE_SUBNET_CIDR = '10.0.0.0/16' # should match ONAP installation; Private and OAM may be the same network
+ONAP_PRIVATE_SUBNET_CIDR = '10.0.0.0/16'
+# note: CIDR should match ONAP installation; Private and OAM may be the same network
ONAP_PRIVATE_NET_DESC = 'Private network created for ONAP, for named ports, static IP@, inter-component communication'
ONAP_OAM_NET_NAME = 'ONAP_OAM_net'
ONAP_OAM_SUBNET_NAME = 'ONAP_OAM_subnet'
-ONAP_OAM_SUBNET_CIDR = '10.99.0.0/16' # should match ONAP installation; Private and OAM may be the same network
+ONAP_OAM_SUBNET_CIDR = '10.99.0.0/16'
+# note: CIDR should match ONAP installation; Private and OAM may be the same network
ONAP_OAM_NET_DESC = 'OAM network created for ONAP, for named ports, static IP@, inter-component communication'
ONAP_ROUTER_NAME = 'ONAP_router'
ONAP_ROUTER_DESC = 'Router created for ONAP'
-EXTERNAL_NETWORK_NAME = 'floating_net' # OpenStack instance external network (gateway) name to be used as router's gateway
+# OpenStack instance external network (gateway) name to be used as router's gateway
+EXTERNAL_NETWORK_NAME = 'floating_net'
-ONAP_KEYPAIR_NAME = 'ONAP_keypair' # keypair that can be used to SSH into created servers (VNF VMs)
+# keypair that can be used to SSH into created servers (VNF VMs)
+ONAP_KEYPAIR_NAME = 'ONAP_keypair'
# OpenStack cloud name and region name, which should be the same as in the clouds.yaml file used by this script
-OPENSTACK_CLOUD_NAME = 'hpe16openstackFraser'
+OPENSTACK_CLOUD_NAME = 'unh-hpe-openstack-fraser'
OPENSTACK_REGION_NAME = 'RegionOne'
-# OpenStack domain is: Default
+# note: OpenStack domain is: Default
######################################################################
@@ -144,45 +157,58 @@ def print_debug(*args):
######################################################################
def delete_all_ONAP():
- """Delete all ONAP-specific OpenStack objects (normally not needed, but may be useful during tests)."""
+ """Delete all ONAP-specific OpenStack objects (normally not needed, but may be useful during tests, and for clean-up)."""
print('\nOPNFV Auto, script to delete ONAP objects in an OpenStack instance')
try:
# connect to OpenStack instance using Connection object from OpenStack SDK
print('Opening connection...')
conn = openstack.connect(
- identity_api_version = 3, # must indicate Identity version (until fixed); can also be in clouds.yaml
- cloud = OPENSTACK_CLOUD_NAME,
- region_name = OPENSTACK_REGION_NAME)
+ identity_api_version = 3, # must indicate Identity version (until fixed); can also be in clouds.yaml
+ cloud = OPENSTACK_CLOUD_NAME,
+ region_name = OPENSTACK_REGION_NAME)
+
# delete router; must delete router before networks (and must delete VMs before routers)
print('Deleting ONAP router...')
onap_router = conn.network.find_router(ONAP_ROUTER_NAME)
print_debug('onap_router:',onap_router)
if onap_router != None:
+
+ # delete router interfaces before deleting router
+ router_network = conn.network.find_network(ONAP_PUBLIC_NET_NAME)
+ if router_network != None:
+ if router_network.subnet_ids != None:
+ print_debug('router_network.subnet_ids:',router_network.subnet_ids)
+ for subnet_id in router_network.subnet_ids:
+ print(' Deleting interface to',ONAP_PUBLIC_NET_NAME,'...')
+ conn.network.remove_interface_from_router(onap_router, subnet_id)
+
+ router_network = conn.network.find_network(ONAP_PRIVATE_NET_NAME)
+ if router_network != None:
+ if router_network.subnet_ids != None:
+ print_debug('router_network.subnet_ids:',router_network.subnet_ids)
+ for subnet_id in router_network.subnet_ids:
+ print(' Deleting interface to',ONAP_PRIVATE_NET_NAME,'...')
+ conn.network.remove_interface_from_router(onap_router, subnet_id)
+
+ router_network = conn.network.find_network(ONAP_OAM_NET_NAME)
+ if router_network != None:
+ if router_network.subnet_ids != None:
+ print_debug('router_network.subnet_ids:',router_network.subnet_ids)
+ for subnet_id in router_network.subnet_ids:
+ print(' Deleting interface to',ONAP_OAM_NET_NAME,'...')
+ conn.network.remove_interface_from_router(onap_router, subnet_id)
+
+ # and finally delete ONAP router
conn.network.delete_router(onap_router.id)
+
else:
print('No ONAP router found...')
+ # TODO@@@ verify if there are ports on networks (e.g., from VMs); if yes, can't delete network
- # try: # try to circumvent !=None issue with OpenStack Resource.py; nope;
- # onap_router = conn.network.find_router(ONAP_ROUTER_NAME)
- # print_debug('onap_router:',onap_router)
- # print_debug('onap_router.name:',onap_router.name)
- # print_debug('onap_router.id:',onap_router.id)
- # conn.network.delete_router(onap_router.id)
- # conn.network.delete_router(onap_router)
- # except Exception as e:
- # print('issue Deleting ONAP router...')
- # print('*** Exception:',type(e), e)
- # exceptionType, exceptionValue, exceptionTraceback = sys.exc_info()
- # print('*** traceback.print_tb():')
- # traceback.print_tb(exceptionTraceback)
- # print('*** traceback.print_exception():')
- # traceback.print_exception(exceptionType, exceptionValue, exceptionTraceback)
-
-
- # delete private network (which should also delete associated subnet and ports if any)
+ # delete private network (which should also delete associated subnet if any)
print('Deleting ONAP private network...')
private_network = conn.network.find_network(ONAP_PRIVATE_NET_NAME)
print_debug('private_network:',private_network)
@@ -191,7 +217,7 @@ def delete_all_ONAP():
else:
print('No ONAP private network found...')
- # delete OAM network (which should also delete associated subnet and ports if any)
+ # delete OAM network (which should also delete associated subnet if any)
print('Deleting ONAP OAM network...')
oam_network = conn.network.find_network(ONAP_OAM_NET_NAME)
print_debug('oam_network:',oam_network)
@@ -200,7 +226,7 @@ def delete_all_ONAP():
else:
print('No ONAP OAM network found...')
- # delete public network (which should also delete associated subnet and ports if any)
+ # delete public network (which should also delete associated subnet if any)
print('Deleting ONAP public network...')
public_network = conn.network.find_network(ONAP_PUBLIC_NET_NAME)
print_debug('public_network:',public_network)
@@ -209,6 +235,8 @@ def delete_all_ONAP():
else:
print('No ONAP public network found...')
+ # TODO@@@ verify if security group is in use (e.g., by a VM), otherwise can't delete it
+
# delete security group
print('Deleting ONAP security group...')
onap_security_group = conn.network.find_security_group(ONAP_SECU_GRP_NAME)
@@ -245,6 +273,8 @@ def delete_all_ONAP():
else:
print('No ONAP keypair found...')
+ # no need to delete images and flavors
+
except Exception as e:
print('*** Exception:',type(e), e)
@@ -267,65 +297,9 @@ def configure_all_ONAP():
# connect to OpenStack instance using Connection object from OpenStack SDK
print('Opening connection...')
conn = openstack.connect(
- identity_api_version = 3, # must indicate Identity version (until fixed); can also be in clouds.yaml
- cloud = OPENSTACK_CLOUD_NAME,
- region_name = OPENSTACK_REGION_NAME)
-
- ###################################################################
- # TESTS: IGNORE/DELETE (BEGIN)
- # gdserver_ID = '8bc274a2-8c0d-4795-9b4d-faa0a21e1d88'
- # gdserver = conn.compute.get_server(gdserver_ID)
- # print('\ngdserver.name=',gdserver.name)
- # print('gdserver.status=',gdserver.status)
-
- # print("\nList Users:")
- # i=1
- # for user in conn.identity.users():
- # print('User',str(i),user.name,'\n',user,'\n')
- # i+=1
-
- # print("\nList Projects:")
- # i=1
- # for project in conn.identity.projects():
- # print('Project',str(i),project.name,'\n',project,'\n')
- # i+=1
-
- # print("\nList Roles:")
- # i=1
- # for role in conn.identity.roles():
- # print('Role',str(i),role.name,'\n',role,'\n')
- # i+=1
-
- # print("\nList Networks:")
- # i=1
- # for network in conn.network.networks():
- # print('Network',str(i),network.name,'\n',network,'\n')
- # i+=1
-
- # print("\nList Routers:")
- # i=1
- # for router in conn.network.routers():
- # print('Router',str(i),router.name,'\n',router,'\n')
- # i+=1
-
- # print("\nList Flavors:")
- # i=1
- # for flvr in conn.compute.flavors():
- # print('Flavor',str(i),flvr.name,'\n',flvr,'\n')
- # i+=1
-
- # print("\nList Images:")
- # i=1
- # for img in conn.compute.images():
- # print('Image',str(i),img.name,'\n',img,'\n')
- # i+=1
-
- # router = conn.network.find_router('gd_test_router')
- # print('gd router\n',router,'\n\n')
- # router = conn.network.find_router('e4e59f63-8063-4774-a97a-c110c6969e4a')
- # print('gd router\n',router,'\n\n')
- # TESTS: IGNORE/DELETE (END)
- ###################################################################
+ identity_api_version = 3, # must indicate Identity version (until fixed); can also be in clouds.yaml
+ cloud = OPENSTACK_CLOUD_NAME,
+ region_name = OPENSTACK_REGION_NAME)
print('Creating ONAP project/tenant...')
@@ -396,7 +370,8 @@ def configure_all_ONAP():
port_range_min = None,
port_range_max = None)
except Exception as e:
- print(description_text, ' Exception:', type(e), e)
+ print(' rule:', description_text, ' may already exist')
+ print_debug(description_text, ' Exception:', type(e), e)
try:
description_text = 'enable ICMP egress IPv4'
@@ -411,7 +386,8 @@ def configure_all_ONAP():
port_range_min = None,
port_range_max = None)
except Exception as e:
- print(description_text, ' Exception:', type(e), e)
+ print(' rule:', description_text, ' may already exist')
+ print_debug(description_text, ' Exception:', type(e), e)
try:
description_text = 'enable SSH (TCP port 22) ingress IPv4'
@@ -426,7 +402,8 @@ def configure_all_ONAP():
port_range_min = '22',
port_range_max = '22')
except Exception as e:
- print(description_text, ' Exception:', type(e), e)
+ print(' rule:', description_text, ' may already exist')
+ print_debug(description_text, ' Exception:', type(e), e)
try:
description_text = 'enable SSH (TCP port 22) egress IPv4'
@@ -441,7 +418,8 @@ def configure_all_ONAP():
port_range_min = '22',
port_range_max = '22')
except Exception as e:
- print(description_text, ' Exception:', type(e), e)
+ print(' rule:', description_text, ' may already exist')
+ print_debug(description_text, ' Exception:', type(e), e)
try:
description_text = 'enable IP traffic ingress IPv4'
@@ -456,7 +434,8 @@ def configure_all_ONAP():
port_range_min = None,
port_range_max = None)
except Exception as e:
- print(description_text, ' Exception:', type(e), e)
+ print(' rule:', description_text, ' may already exist')
+ print_debug(description_text, ' Exception:', type(e), e)
try:
description_text = 'enable IP traffic ingress IPv6'
@@ -471,44 +450,48 @@ def configure_all_ONAP():
port_range_min = None,
port_range_max = None)
except Exception as e:
- print(description_text, ' Exception:', type(e), e)
+ print(' rule:', description_text, ' may already exist')
+ print_debug(description_text, ' Exception:', type(e), e)
# IPv4 IP egress rule should already exist by default
- # try:
- # description_text = 'enable IP traffic egress IPv4'
- # print(' Creating rule:',description_text,'...')
- # conn.network.create_security_group_rule(
- # security_group_id = onap_security_group.id,
- # description = description_text,
- # protocol = None,
- # direction = 'egress',
- # ethertype = 'IPv4',
- # remote_ip_prefix = '0.0.0.0/0',
- # port_range_min = None,
- # port_range_max = None)
- # except Exception as e:
- # print(description_text, ' Exception:', type(e), e)
+ try:
+ description_text = 'enable IP traffic egress IPv4'
+ print(' Creating rule:',description_text,'...')
+ conn.network.create_security_group_rule(
+ security_group_id = onap_security_group.id,
+ description = description_text,
+ protocol = None,
+ direction = 'egress',
+ ethertype = 'IPv4',
+ remote_ip_prefix = '0.0.0.0/0',
+ port_range_min = None,
+ port_range_max = None)
+ except Exception as e:
+ print(' rule:', description_text, ' may already exist')
+ print_debug(description_text, ' Exception:', type(e), e)
# IPv6 IP egress rule should already exist by default
- # try:
- # description_text = 'enable IP traffic egress IPv6'
- # print(' Creating rule:',description_text,'...')
- # conn.network.create_security_group_rule(
- # security_group_id = onap_security_group.id,
- # description = description_text,
- # protocol = None,
- # direction = 'egress',
- # ethertype = 'IPv6',
- # remote_ip_prefix = '::/0',
- # port_range_min = None,
- # port_range_max = None)
- # except Exception as e:
- # print(description_text, ' Exception:', type(e), e)
+ try:
+ description_text = 'enable IP traffic egress IPv6'
+ print(' Creating rule:',description_text,'...')
+ conn.network.create_security_group_rule(
+ security_group_id = onap_security_group.id,
+ description = description_text,
+ protocol = None,
+ direction = 'egress',
+ ethertype = 'IPv6',
+ remote_ip_prefix = '::/0',
+ port_range_min = None,
+ port_range_max = None)
+ except Exception as e:
+ print(' rule:', description_text, ' may already exist')
+ print_debug(description_text, ' Exception:', type(e), e)
# public network
print('Creating ONAP public network...')
public_network = conn.network.find_network(ONAP_PUBLIC_NET_NAME)
+ public_subnet = None
if public_network != None:
print('ONAP public network already exists')
else:
@@ -530,13 +513,14 @@ def configure_all_ONAP():
ip_version = 4,
is_dhcp_enabled = True,
dns_nameservers = [DNS_SERVER_IP]) # list of DNS IP@
+ print_debug('public_subnet:',public_subnet)
print_debug('public_network: after subnet',public_network)
- print_debug('public_subnet:',public_subnet)
# private network
print('Creating ONAP private network...')
private_network = conn.network.find_network(ONAP_PRIVATE_NET_NAME)
+ private_subnet = None
if private_network != None:
print('ONAP private network already exists')
else:
@@ -557,13 +541,14 @@ def configure_all_ONAP():
ip_version = 4,
is_dhcp_enabled = True,
dns_nameservers = [DNS_SERVER_IP]) # list of DNS IP@; maybe not needed for private network
- print_debug('private_network: after subnet',private_network)
print_debug('private_subnet:',private_subnet)
+ print_debug('private_network: after subnet',private_network)
# OAM network
print('Creating ONAP OAM network...')
oam_network = conn.network.find_network(ONAP_OAM_NET_NAME)
+ oam_subnet = None
if oam_network != None:
print('ONAP OAM network already exists')
else:
@@ -584,8 +569,8 @@ def configure_all_ONAP():
ip_version = 4,
is_dhcp_enabled = True,
dns_nameservers = [DNS_SERVER_IP]) # list of DNS IP@; maybe not needed for OAM network
- print_debug('oam_network: after subnet',oam_network)
print_debug('oam_subnet:',oam_subnet)
+ print_debug('oam_network: after subnet',oam_network)
# router
@@ -630,131 +615,93 @@ def configure_all_ONAP():
conn.network.add_interface_to_router(onap_router, subnet_id = oam_subnet.id)
print_debug('onap_router: after adding interfaces',onap_router)
- # point to OpenStack external network (i.e. Gateway for router); network_id is passed in a body dictionary
- # (external network such as floating_net)
- # syntax: add_gateway_to_router(router, **body)
- #print('Adding external network (gateway) to ONAP router...')
-
- # nope
- # network_dict_body = {'network_id': public_network.id}
- # nope
- # network_dict_body = {
- # 'external_fixed_ips': [{'subnet_id' : public_subnet.id}],
- # 'network_id': public_network.id
- # }
-
- # external_network = conn.network.find_network(EXTERNAL_NETWORK_NAME)
- # print_debug('external_network:',external_network)
- # external_subnet_ID_list = external_network.subnet_ids
- # print_debug('external_subnet_ID_list:',external_subnet_ID_list)
-
- # # build external_fixed_ips: list of dictionaries, each with 'subnet_id' key (and may have 'ip_address' key as well)
- # onap_gateway_external_subnets = []
- # for ext_subn_id in external_subnet_ID_list: # there should be only one subnet ID in the list, but go through each item, just in case
- # onap_gateway_external_subnets.append({'subnet_id':ext_subn_id})
-
- # #network_dict_body = {'gateway' : {'network_id' : external_network.id}}
- # #network_dict_body = {'network_id' : external_network.id}
- # #conn.network.add_gateway_to_router(onap_router, body=network_dict_body)
- # #conn.network.add_gateway_to_router(onap_router, network_id=external_network.id)
- # #conn.network.add_gateway_to_router(onap_router, **network_dict_body)
-
- # network_dict_body = {
- # 'network_id': external_network.id,
- # 'enable_snat': True, # True should be the default, so there should be no need to set it
- # 'external_fixed_ips': onap_gateway_external_subnets
- # }
- # #conn.network.add_gateway_to_router(onap_router, **network_dict_body)
- # print_debug('onap_router: after add_gateway_to_router',onap_router)
-
-
-
-
- # # also create 5 flavors, from tiny to xlarge (hard-coded, no need for parameters)
- # # (Flavor is a Resource)
- # print('Creating flavors...')
- # print('Creating m1.tiny Flavor...')
- # tiny_flavor = conn.compute.find_flavor("m1.tiny")
- # if tiny_flavor != None:
- # print('m1.tiny Flavor already exists')
- # else:
- # tiny_flavor = conn.compute.create_flavor(
- # name = 'm1.tiny',
- # vcpus = 1,
- # disk = 1,
- # ram = 512,
- # ephemeral = 0,
- # #swap = 0,
- # #rxtx_factor = 1.0,
- # is_public = True)
- # print_debug('tiny_flavor: ',tiny_flavor)
-
- # print('Creating m1.small Flavor...')
- # small_flavor = conn.compute.find_flavor("m1.small")
- # if small_flavor != None:
- # print('m1.small Flavor already exists')
- # else:
- # small_flavor = conn.compute.create_flavor(
- # name = 'm1.small',
- # vcpus = 1,
- # disk = 20,
- # ram = 2048,
- # ephemeral = 0,
- # #swap = 0,
- # #rxtx_factor = 1.0,
- # is_public = True)
- # print_debug('small_flavor: ',small_flavor)
-
- # print('Creating m1.medium Flavor...')
- # medium_flavor = conn.compute.find_flavor("m1.medium")
- # if medium_flavor != None:
- # print('m1.medium Flavor already exists')
- # else:
- # medium_flavor = conn.compute.create_flavor(
- # name = 'm1.medium',
- # vcpus = 2,
- # disk = 40,
- # ram = 4096,
- # ephemeral = 0,
- # #swap = 0,
- # #rxtx_factor = 1.0,
- # is_public = True)
- # print_debug('medium_flavor: ',medium_flavor)
-
- # print('Creating m1.large Flavor...')
- # large_flavor = conn.compute.find_flavor("m1.large")
- # if large_flavor != None:
- # print('m1.large Flavor already exists')
- # else:
- # large_flavor = conn.compute.create_flavor(
- # name = 'm1.large',
- # vcpus = 4,
- # disk = 80,
- # ram = 8192,
- # ephemeral = 0,
- # #swap = 0,
- # #rxtx_factor = 1.0,
- # is_public = True)
- # print_debug('large_flavor: ',large_flavor)
-
- # print('Creating m1.xlarge Flavor...')
- # xlarge_flavor = conn.compute.find_flavor("m1.xlarge")
- # if xlarge_flavor != None:
- # print('m1.xlarge Flavor already exists')
- # else:
- # xlarge_flavor = conn.compute.create_flavor(
- # name = 'm1.xlarge',
- # vcpus = 8,
- # disk = 160,
- # ram = 16384,
- # ephemeral = 0,
- # #swap = 0,
- # #rxtx_factor = 1.0,
- # is_public = True)
- # print_debug('xlarge_flavor: ',xlarge_flavor)
+
+ # also create 5 flavors, from tiny to xlarge (hard-coded, no need for parameters)
+ # (Flavor is a Resource)
+ print('Creating flavors...')
+ print('Creating m1.tiny Flavor...')
+ tiny_flavor = conn.compute.find_flavor("m1.tiny")
+ if tiny_flavor != None:
+ print('m1.tiny Flavor already exists')
+ else:
+ tiny_flavor = conn.compute.create_flavor(
+ name = 'm1.tiny',
+ vcpus = 1,
+ disk = 1,
+ ram = 512,
+ ephemeral = 0,
+ #swap = 0,
+ #rxtx_factor = 1.0,
+ is_public = True)
+ print_debug('tiny_flavor: ',tiny_flavor)
+
+ print('Creating m1.small Flavor...')
+ small_flavor = conn.compute.find_flavor("m1.small")
+ if small_flavor != None:
+ print('m1.small Flavor already exists')
+ else:
+ small_flavor = conn.compute.create_flavor(
+ name = 'm1.small',
+ vcpus = 1,
+ disk = 20,
+ ram = 2048,
+ ephemeral = 0,
+ #swap = 0,
+ #rxtx_factor = 1.0,
+ is_public = True)
+ print_debug('small_flavor: ',small_flavor)
+
+ print('Creating m1.medium Flavor...')
+ medium_flavor = conn.compute.find_flavor("m1.medium")
+ if medium_flavor != None:
+ print('m1.medium Flavor already exists')
+ else:
+ medium_flavor = conn.compute.create_flavor(
+ name = 'm1.medium',
+ vcpus = 2,
+ disk = 40,
+ ram = 4096,
+ ephemeral = 0,
+ #swap = 0,
+ #rxtx_factor = 1.0,
+ is_public = True)
+ print_debug('medium_flavor: ',medium_flavor)
+
+ print('Creating m1.large Flavor...')
+ large_flavor = conn.compute.find_flavor("m1.large")
+ if large_flavor != None:
+ print('m1.large Flavor already exists')
+ else:
+ large_flavor = conn.compute.create_flavor(
+ name = 'm1.large',
+ vcpus = 4,
+ disk = 80,
+ ram = 8192,
+ ephemeral = 0,
+ #swap = 0,
+ #rxtx_factor = 1.0,
+ is_public = True)
+ print_debug('large_flavor: ',large_flavor)
+
+ print('Creating m1.xlarge Flavor...')
+ xlarge_flavor = conn.compute.find_flavor("m1.xlarge")
+ if xlarge_flavor != None:
+ print('m1.xlarge Flavor already exists')
+ else:
+ xlarge_flavor = conn.compute.create_flavor(
+ name = 'm1.xlarge',
+ vcpus = 8,
+ disk = 160,
+ ram = 16384,
+ ephemeral = 0,
+ #swap = 0,
+ #rxtx_factor = 1.0,
+ is_public = True)
+ print_debug('xlarge_flavor: ',xlarge_flavor)
# create images: Ubuntu 16.04, 14.04, CirrOS, ...
+ # store them in images/ directory
# 64-bit QCOW2 image for cirros-0.4.0-x86_64-disk.img
# description: CirrOS minimal Linux distribution
# http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
@@ -770,31 +717,109 @@ def configure_all_ONAP():
# http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img
# user: ubuntu
- # do not use compute proxy for images; there is an image proxy (v1, and v2); use shade layer, directly with Connection object;
+ # do not use compute proxy for images; there is an image proxy (v1, and v2);
+ # use shade layer, directly with Connection object: Connection.create_image()
# conn.get_image() returns a Python Munch object (subclass of Dictionary)
- # URL download not supported yet; download image separately, place it in the directory
+ # However, URL download not supported yet; download image separately, place it in the directory
# https://docs.openstack.org/openstacksdk/latest/user/connection.html#openstack.connection.Connection.create_image
+ # image proxy: conn.image.upload_image()
+ # Image class:
+ # https://docs.openstack.org/openstacksdk/latest/user/resources/image/v2/image.html#openstack.image.v2.image.Image
+ # URL should be supported by image proxy
+
+ # TODO@@@ try image v2 proxy, if it supports URLs;
+ # maybe load only images for current CPU (i.e. only x86 images for x86, only Arm images for Arm)
+ # TODO@@@ list image names/URLs in dictionary, and load then in a loop
+
+ # Pattern: prepare an attribute dictionary, then call conn.image.upload_image()
+ # image_attributes_dict = {}
+ # image_attributes_dict['name']='cirros-0.4.0-aarch64-disk.img'
+ # image_attributes_dict['url']='http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-aarch64-disk.img'
+ # conn.image.upload_image(disk_format='qcow2',**image_attributes_dict)
+
+ # With a dictionary of names/URLs :
+ # image_ref_dict = {}
+ # image_ref_dict['cirros-0.4.0-x86_64-disk.img']='http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img'
+ # image_ref_dict['cirros-0.4.0-arm-disk.img']='http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-arm-disk.img'
+ # image_ref_dict['cirros-0.4.0-aarch64-disk.img']='http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-aarch64-disk.img'
+ # etc.
+ # for image_name in image_ref_dict:
+ # image_attributes_dict['name'] = image_name
+ # image_attributes_dict['url'] = image_ref_dict[image_name]
+ # conn.image.upload_image(disk_format='qcow2',**image_attributes_dict)
+
+
+ # Create and populate image dictionary
+ image_ref_dict = {}
+
+ # Ubuntu 16.04 LTS (Xenial Xerus) images
+ image_ref_dict['xenial-server-cloudimg-amd64-disk1.img']='https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img'
+ image_ref_dict['xenial-server-cloudimg-arm64-disk1.img']='https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-arm64-disk1.img'
+
+ # Ubuntu 14.04.5 LTS (Trusty Tahr) images
+ image_ref_dict['trusty-server-cloudimg-amd64-disk1.img']='http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img'
+ image_ref_dict['trusty-server-cloudimg-arm64-disk1.img']='http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-arm64-disk1.img'
+
+ # CirrOS images
+ image_ref_dict['cirros-0.4.0-x86_64-disk.img']='http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img'
+ image_ref_dict['cirros-0.4.0-arm-disk.img']='http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-arm-disk.img'
+ image_ref_dict['cirros-0.4.0-aarch64-disk.img']='http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-aarch64-disk.img'
+
+
+ # if URL-based upload using image proxy works, it will replace the section below which assumes image files
+ # are in a subdirectory, and uses Connection.create_image() instead of Connection.image.upload_image()
+ IMAGES_DIR = 'images/'
+
+ IMAGE_NAME = 'CirrOS_0.4.0_minimal_Linux_distribution x86'
+ print('Creating image:',IMAGE_NAME,'...')
+ if conn.get_image(IMAGE_NAME) != None:
+ print(IMAGE_NAME,'image already exists')
+ else:
+ conn.create_image(IMAGE_NAME, filename=IMAGES_DIR+'cirros-0.4.0-x86_64-disk.img')
+
+ IMAGE_NAME = 'CirrOS_0.4.0_minimal_Linux_distribution ARM'
+ print('Creating image:',IMAGE_NAME,'...')
+ if conn.get_image(IMAGE_NAME) != None:
+ print(IMAGE_NAME,'image already exists')
+ else:
+ conn.create_image(IMAGE_NAME, filename=IMAGES_DIR+'cirros-0.4.0-arm-disk.img')
+
+ IMAGE_NAME = 'CirrOS_0.4.0_minimal_Linux_distribution AARCH64'
+ print('Creating image:',IMAGE_NAME,'...')
+ if conn.get_image(IMAGE_NAME) != None:
+ print(IMAGE_NAME,'image already exists')
+ else:
+ conn.create_image(IMAGE_NAME, filename=IMAGES_DIR+'cirros-0.4.0-aarch64-disk.img')
+
+ IMAGE_NAME = 'Ubuntu_Server_16.04_LTS_Xenial_Xerus x86'
+ print('Creating image:',IMAGE_NAME,'...')
+ if conn.get_image(IMAGE_NAME) != None:
+ print(IMAGE_NAME,'image already exists')
+ else:
+ conn.create_image(IMAGE_NAME, filename=IMAGES_DIR+'xenial-server-cloudimg-amd64-disk1.img')
- IMAGE_NAME = 'CirrOS_0.4.0_minimal_Linux_distribution'
+ IMAGE_NAME = 'Ubuntu_Server_16.04_LTS_Xenial_Xerus ARM64'
print('Creating image:',IMAGE_NAME,'...')
if conn.get_image(IMAGE_NAME) != None:
print(IMAGE_NAME,'image already exists')
else:
- conn.create_image(IMAGE_NAME, filename='cirros-0.4.0-x86_64-disk.img')
+ conn.create_image(IMAGE_NAME, filename=IMAGES_DIR+'xenial-server-cloudimg-arm64-disk1.img')
- IMAGE_NAME = 'Ubuntu_Server_16.04_LTS_Xenial_Xerus'
+ IMAGE_NAME = 'Ubuntu_Server_14.04_LTS_Trusty_Tahr x86'
print('Creating image:',IMAGE_NAME,'...')
if conn.get_image(IMAGE_NAME) != None:
print(IMAGE_NAME,'image already exists')
else:
- conn.create_image(IMAGE_NAME, filename='xenial-server-cloudimg-amd64-disk1.img')
+ conn.create_image(IMAGE_NAME, filename=IMAGES_DIR+'trusty-server-cloudimg-amd64-disk1.img')
+ # End section with Connection.create_image()
- IMAGE_NAME = 'Ubuntu_Server_14.04_LTS_Trusty_Tahr'
+ IMAGE_NAME = 'Ubuntu_Server_14.04_LTS_Trusty_Tahr ARM64'
print('Creating image:',IMAGE_NAME,'...')
if conn.get_image(IMAGE_NAME) != None:
print(IMAGE_NAME,'image already exists')
else:
- conn.create_image(IMAGE_NAME, filename='trusty-server-cloudimg-amd64-disk1.img')
+ conn.create_image(IMAGE_NAME, filename=IMAGES_DIR+'trusty-server-cloudimg-arm64-disk1.img')
+ # End section with Connection.create_image()
# create a keypair, if needed e.g. for VNF VMs; maybe to SSH for testing
@@ -813,12 +838,46 @@ def configure_all_ONAP():
print(onap_keypair.private_key)
print_debug('onap_keypair:',onap_keypair)
+
print('\nSUMMARY:')
- print('ONAP public network ID:',public_network.id)
- print('ONAP private network ID:',private_network.id)
- print('ONAP private network subnet ID:',private_subnet.id)
- print('ONAP private network subnet CIDR:',private_subnet.cidr)
- print('\n')
+ # Grab live objects (don't reuse earlier references), in case the script is used on an already configured instance
+ # This way, the summary is still displayed even if the script execution did not create anything
+ # Also, this double-checks that displayed information is accurate, freshly retrieved from the OpenStack instance
+
+ public_network = conn.network.find_network(ONAP_PUBLIC_NET_NAME)
+ if public_network != None:
+ print('ONAP public network ID:',public_network.id)
+ for fetched_subnet_ID in public_network.subnet_ids:
+ fetched_subnet = conn.network.get_subnet(fetched_subnet_ID)
+ if fetched_subnet != None:
+ print(' ONAP public network subnet ID:',fetched_subnet.id)
+ print(' ONAP public network subnet CIDR:',fetched_subnet.cidr)
+ else:
+ print('no ONAP public network')
+
+ private_network = conn.network.find_network(ONAP_PRIVATE_NET_NAME)
+ if private_network != None:
+ print('ONAP private network ID:',private_network.id)
+ for fetched_subnet_ID in private_network.subnet_ids:
+ fetched_subnet = conn.network.get_subnet(fetched_subnet_ID)
+ if fetched_subnet != None:
+ print(' ONAP private network subnet ID:',fetched_subnet.id)
+ print(' ONAP private network subnet CIDR:',fetched_subnet.cidr)
+ else:
+ print('no ONAP private network')
+
+ oam_network = conn.network.find_network(ONAP_OAM_NET_NAME)
+ if oam_network != None:
+ print('ONAP OAM network ID:',oam_network.id)
+ for fetched_subnet_ID in oam_network.subnet_ids:
+ fetched_subnet = conn.network.get_subnet(fetched_subnet_ID)
+ if fetched_subnet != None:
+ print(' ONAP OAM network subnet ID:',fetched_subnet.id)
+ print(' ONAP OAM network subnet CIDR:',fetched_subnet.cidr)
+ else:
+ print('no ONAP OAM network')
+ print('END SUMMARY\n')
+
except Exception as e:
print('*** Exception:',type(e), e)
@@ -849,7 +908,7 @@ def main():
help = 'delete ONAP configuration',
action = 'store_true')
- # parse arguments, modify global variable if need be, and use corresponding script
+ # parse arguments, modify global variable if need be, and use corresponding script (create objects, or delete objects)
args = parser.parse_args()
if args.debug:
global DEBUG_VAR
@@ -862,4 +921,3 @@ def main():
if __name__ == "__main__":
main()
-
diff --git a/setup/VIMs/OpenStack/clouds.yaml b/setup/VIMs/OpenStack/clouds.yaml
new file mode 100644
index 0000000..7bfd717
--- /dev/null
+++ b/setup/VIMs/OpenStack/clouds.yaml
@@ -0,0 +1,99 @@
+clouds:
+
+ # Openstack instance on Arm pod, controller IP@ 172.16.10.10
+ # Horizon: https://10.10.50.103/project/
+ # Identity API according to Horizon dashboard: https://10.10.50.103:5000/v2.0
+ # other potential auth_url: http://172.16.10.10:35357/v3
+ # (OS_AUTH_URL=http://controller:35357/v3)
+ # 2 project names: admin, service (project = tenant)
+ # project ID: 122caf64b3df4818bf2ce5ba793226b2
+ # EC2 URL: https://10.10.50.103:8773/services/Cloud
+ # EC2 access key: bcf3c69a7d1c405e9757f87f26faf19f
+ # 10.10.50.0/8: floating IP@
+ # 10.10.10.0/8: fixed IP@
+ armopenstack:
+ auth:
+ auth_url: https://10.10.50.103:5000/v2.0
+ project_name: admin
+ username: admin
+ password: opnfv_secret
+ region_name: RegionOne
+
+ # Openstack instance on LaaS hpe16, from OPNFV Euphrates, controller IP@ (mgt: 172.16.10.101; public: 10.16.0.101)
+ # keystone endpoints (openstack endpoint list --service keystone)
+ # admin: http://172.16.10.101:35357/v2.0
+ # internal: http://172.16.10.101:5000/v2.0
+ # public: http://10.16.0.101:5000/v2.0 : works on LaaS hpe16, from hpe16
+ hpe16openstackEuphrates:
+ auth:
+ auth_url: http://10.16.0.101:5000/v2.0
+ project_name: admin
+ username: admin
+ password: opnfv_secret
+ region_name: RegionOne
+
+ # Openstack instance on generic LaaS hpe, from OPNFV Fraser, controller IP@ (mgt: 172.16.10.36; public: 10.16.0.107)
+ # keystone endpoints (openstack endpoint list --service keystone)
+ # admin: http://172.16.10.36:35357/v3
+ # internal: http://172.16.10.36:5000/v3
+ # public: http://10.16.0.107:5000/v3
+ # Horizon: https://10.16.0.107:8078, but need SSH port forwarding through 10.10.100.26 to be reached from outside
+ # "If you are using Identity v3 you need to specify the user and the project domain name"
+
+ # generic cloud name, for a UNH IOL hpe server, for OPNFV Fraser, OpenStack installed by Fuel/MCP
+ unh-hpe-openstack-fraser:
+ auth:
+ auth_url: http://10.16.0.107:5000/v3
+ project_name: admin
+ username: admin
+ password: opnfv_secret
+ user_domain_name: Default
+ project_domain_name: Default
+ region_name: RegionOne
+ identity_api_version: 3
+
+# ubuntu@ctl01:~$ openstack project show admin
+# +-------------+----------------------------------+
+# | Field | Value |
+# +-------------+----------------------------------+
+# | description | OpenStack Admin tenant |
+# | domain_id | default |
+# | enabled | True |
+# | id | 04fcfe7aa83f4df79ae39ca748aa8637 |
+# | is_domain | False |
+# | name | admin |
+# | parent_id | default |
+# +-------------+----------------------------------+
+
+# (openstack) domain show default
+# +-------------+----------------------------------------------------------+
+# | Field | Value |
+# +-------------+----------------------------------------------------------+
+# | description | Domain created automatically to support V2.0 operations. |
+# | enabled | True |
+# | id | default |
+# | name | Default |
+# +-------------+----------------------------------------------------------+
+
+# (openstack) domain show heat_user_domain
+# +-------------+---------------------------------------------+
+# | Field | Value |
+# +-------------+---------------------------------------------+
+# | description | Contains users and projects created by heat |
+# | enabled | True |
+# | id | d9c29adac0fe4816922d783b257879d6 |
+# | name | heat_user_domain |
+# +-------------+---------------------------------------------+
+
+
+# export OS_AUTH_URL=http://10.16.0.107:5000/v3
+# export OS_PROJECT_ID=04fcfe7aa83f4df79ae39ca748aa8637
+# export OS_PROJECT_NAME="admin"
+# export OS_USER_DOMAIN_NAME="Default"
+# export OS_USERNAME="admin"
+# export OS_PASSWORD="opnfv_secret"
+# export OS_REGION_NAME="RegionOne"
+# export OS_INTERFACE=public
+# export OS_IDENTITY_API_VERSION=3
+
+