run_vitrage & stop_vitrage & get_topology
Change-Id: Idd2928bb839a9740f14ea0023bcf93f1cf569e37
This commit is contained in:
parent
cd932db3ff
commit
190e4a3087
@ -1,276 +1,389 @@
|
||||
{
|
||||
"directed": true,
|
||||
"graph": {
|
||||
|
||||
},
|
||||
"graph": {},
|
||||
"nodes": [
|
||||
{
|
||||
"state": "RUNNING",
|
||||
"name": "node1",
|
||||
"id": 0
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "vm-8",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "ACTIVE",
|
||||
"project_id": "0683517e1e354d2ba25cba6937f44e79",
|
||||
"type": "nova.instance",
|
||||
"id": "RESOURCE:nova.instance:20d12a8a-ea9a-89c6-5947-83bea959362e"
|
||||
},
|
||||
{
|
||||
"state": "ERROR",
|
||||
"name": "zone0",
|
||||
"id": 1
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "vm-2",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "ACTIVE",
|
||||
"project_id": "0683517e1e354d2ba25cba6937f44e79",
|
||||
"type": "nova.instance",
|
||||
"id": "RESOURCE:nova.instance:dc35fa2f-4515-1653-ef6b-03b471bb395b"
|
||||
},
|
||||
{
|
||||
"state": "SUBOPTIMAL",
|
||||
"name": "zone1",
|
||||
"id": 2
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "vm-13",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "ACTIVE",
|
||||
"project_id": "0683517e1e354d2ba25cba6937f44e79",
|
||||
"type": "nova.instance",
|
||||
"id": "RESOURCE:nova.instance:9879cf5a-bdcf-3651-3017-961ed887ec86"
|
||||
},
|
||||
{
|
||||
"state": "RUNNING",
|
||||
"name": "zone2",
|
||||
"id": 3
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "vm-10",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "ACTIVE",
|
||||
"project_id": "0683517e1e354d2ba25cba6937f44e79",
|
||||
"type": "nova.instance",
|
||||
"id": "RESOURCE:nova.instance:fe124f4b-9ed7-4591-fcd1-803cf5c33cb1"
|
||||
},
|
||||
{
|
||||
"state": "ERROR",
|
||||
"name": "host0",
|
||||
"id": 4
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "vm-11",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "ACTIVE",
|
||||
"project_id": "0683517e1e354d2ba25cba6937f44e79",
|
||||
"type": "nova.instance",
|
||||
"id": "RESOURCE:nova.instance:f2e48a97-7350-061e-12d3-84c6dc3e67c0"
|
||||
},
|
||||
{
|
||||
"state": "SUBOPTIMAL",
|
||||
"name": "host1",
|
||||
"id": 5
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "host-2",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "available",
|
||||
"type": "nova.host",
|
||||
"id": "RESOURCE:nova.host:host-2"
|
||||
},
|
||||
{
|
||||
"state": "RUNNING",
|
||||
"name": "host2",
|
||||
"id": 6
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "host-3",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "available",
|
||||
"type": "nova.host",
|
||||
"id": "RESOURCE:nova.host:host-3"
|
||||
},
|
||||
{
|
||||
"state": "ERROR",
|
||||
"name": "host3",
|
||||
"id": 7
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "host-0",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "available",
|
||||
"type": "nova.host",
|
||||
"id": "RESOURCE:nova.host:host-0"
|
||||
},
|
||||
{
|
||||
"state": "SUBOPTIMAL",
|
||||
"name": "host4",
|
||||
"id": 8
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "host-1",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "available",
|
||||
"type": "nova.host",
|
||||
"id": "RESOURCE:nova.host:host-1"
|
||||
},
|
||||
{
|
||||
"state": "RUNNING",
|
||||
"name": "host5",
|
||||
"id": 9
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "vm-9",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "ACTIVE",
|
||||
"project_id": "0683517e1e354d2ba25cba6937f44e79",
|
||||
"type": "nova.instance",
|
||||
"id": "RESOURCE:nova.instance:275097cf-954e-8e24-b185-9514e24b8591"
|
||||
},
|
||||
{
|
||||
"state": "ERROR",
|
||||
"name": "host6",
|
||||
"id": 10
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "vm-1",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "ACTIVE",
|
||||
"project_id": "0683517e1e354d2ba25cba6937f44e79",
|
||||
"type": "nova.instance",
|
||||
"id": "RESOURCE:nova.instance:a0f0805f-c804-cffe-c25a-1b38f555ed68"
|
||||
},
|
||||
{
|
||||
"state": "SUBOPTIMAL",
|
||||
"name": "vm0",
|
||||
"id": 11
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "vm-14",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "ACTIVE",
|
||||
"project_id": "0683517e1e354d2ba25cba6937f44e79",
|
||||
"type": "nova.instance",
|
||||
"id": "RESOURCE:nova.instance:56af57d2-34a4-19b1-5106-b613637a11a7"
|
||||
},
|
||||
{
|
||||
"state": "RUNNING",
|
||||
"name": "vm1",
|
||||
"id": 12
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "zone-1",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "available",
|
||||
"type": "nova.zone",
|
||||
"id": "RESOURCE:nova.zone:zone-1"
|
||||
},
|
||||
{
|
||||
"state": "ERROR",
|
||||
"name": "vm2",
|
||||
"id": 13
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "vm-3",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "ACTIVE",
|
||||
"project_id": "0683517e1e354d2ba25cba6937f44e79",
|
||||
"type": "nova.instance",
|
||||
"id": "RESOURCE:nova.instance:16e14c58-d254-2bec-53e4-c766e48810aa"
|
||||
},
|
||||
{
|
||||
"state": "SUBOPTIMAL",
|
||||
"name": "vm3",
|
||||
"id": 14
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "vm-7",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "ACTIVE",
|
||||
"project_id": "0683517e1e354d2ba25cba6937f44e79",
|
||||
"type": "nova.instance",
|
||||
"id": "RESOURCE:nova.instance:f35a1e10-74ff-7332-8edf-83cd6ffcb2de"
|
||||
},
|
||||
{
|
||||
"state": "RUNNING",
|
||||
"name": "vm4",
|
||||
"id": 15
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "vm-4",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "ACTIVE",
|
||||
"project_id": "0683517e1e354d2ba25cba6937f44e79",
|
||||
"type": "nova.instance",
|
||||
"id": "RESOURCE:nova.instance:ea8a450e-cab1-2272-f431-494b40c5c378"
|
||||
},
|
||||
{
|
||||
"state": "ERROR",
|
||||
"name": "vm5",
|
||||
"id": 16
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "vm-6",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "ACTIVE",
|
||||
"project_id": "0683517e1e354d2ba25cba6937f44e79",
|
||||
"type": "nova.instance",
|
||||
"id": "RESOURCE:nova.instance:6e42bdc3-b776-1b2c-2c7d-b7a8bb98f721"
|
||||
},
|
||||
{
|
||||
"state": "SUBOPTIMAL",
|
||||
"name": "vm6",
|
||||
"id": 17
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "vm-5",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "ACTIVE",
|
||||
"project_id": "0683517e1e354d2ba25cba6937f44e79",
|
||||
"type": "nova.instance",
|
||||
"id": "RESOURCE:nova.instance:8c951613-c660-87c0-c18b-0fa3293ce8d8"
|
||||
},
|
||||
{
|
||||
"state": "RUNNING",
|
||||
"name": "vm7",
|
||||
"id": 18
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "zone-0",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "available",
|
||||
"type": "nova.zone",
|
||||
"id": "RESOURCE:nova.zone:zone-0"
|
||||
},
|
||||
{
|
||||
"state": "ERROR",
|
||||
"name": "vm8",
|
||||
"id": 19
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "vm-0",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "ACTIVE",
|
||||
"project_id": "0683517e1e354d2ba25cba6937f44e79",
|
||||
"type": "nova.instance",
|
||||
"id": "RESOURCE:nova.instance:78353ce4-2710-49b5-1341-b8cbb6000ebc"
|
||||
},
|
||||
{
|
||||
"state": "SUBOPTIMAL",
|
||||
"name": "vm9",
|
||||
"id": 20
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "vm-12",
|
||||
"update_timestamp": "2015-12-01T12:46:41Z",
|
||||
"state": "ACTIVE",
|
||||
"project_id": "0683517e1e354d2ba25cba6937f44e79",
|
||||
"type": "nova.instance",
|
||||
"id": "RESOURCE:nova.instance:35bf479a-75d9-80a9-874e-d3b50fb2dd2e"
|
||||
},
|
||||
{
|
||||
"state": "RUNNING",
|
||||
"name": "vm10",
|
||||
"id": 21
|
||||
},
|
||||
{
|
||||
"state": "ERROR",
|
||||
"name": "vm11",
|
||||
"id": 22
|
||||
},
|
||||
{
|
||||
"state": "SUBOPTIMAL",
|
||||
"name": "vm12",
|
||||
"id": 23
|
||||
},
|
||||
{
|
||||
"state": "RUNNING",
|
||||
"name": "vm13",
|
||||
"id": 24
|
||||
},
|
||||
{
|
||||
"state": "ERROR",
|
||||
"name": "vm14",
|
||||
"id": 25
|
||||
},
|
||||
{
|
||||
"state": "SUBOPTIMAL",
|
||||
"name": "vm15",
|
||||
"id": 26
|
||||
"category": "RESOURCE",
|
||||
"is_placeholder": false,
|
||||
"is_deleted": false,
|
||||
"name": "node",
|
||||
"type": "node",
|
||||
"id": "RESOURCE:node"
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
{
|
||||
"source": 1,
|
||||
"target": 0,
|
||||
"relationship": "contains"
|
||||
},
|
||||
{
|
||||
"source": 2,
|
||||
"target": 0,
|
||||
"relationship": "contains"
|
||||
},
|
||||
{
|
||||
"source": 3,
|
||||
"target": 0,
|
||||
"relationship": "contains"
|
||||
},
|
||||
{
|
||||
"source": 4,
|
||||
"target": 2,
|
||||
"relationship": "contains"
|
||||
},
|
||||
{
|
||||
"source": 5,
|
||||
"target": 1,
|
||||
"relationship": "contains"
|
||||
},
|
||||
{
|
||||
"source": 6,
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 3,
|
||||
"relationship": "contains"
|
||||
"key": "contains",
|
||||
"source": 5
|
||||
},
|
||||
{
|
||||
"source": 7,
|
||||
"target": 2,
|
||||
"relationship": "contains"
|
||||
},
|
||||
{
|
||||
"source": 8,
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 1,
|
||||
"relationship": "contains"
|
||||
"key": "contains",
|
||||
"source": 5
|
||||
},
|
||||
{
|
||||
"source": 9,
|
||||
"target": 3,
|
||||
"relationship": "contains"
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 16,
|
||||
"key": "contains",
|
||||
"source": 5
|
||||
},
|
||||
{
|
||||
"source": 10,
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 11,
|
||||
"key": "contains",
|
||||
"source": 5
|
||||
},
|
||||
{
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 13,
|
||||
"key": "contains",
|
||||
"source": 6
|
||||
},
|
||||
{
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 4,
|
||||
"key": "contains",
|
||||
"source": 6
|
||||
},
|
||||
{
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 14,
|
||||
"key": "contains",
|
||||
"source": 6
|
||||
},
|
||||
{
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 20,
|
||||
"key": "contains",
|
||||
"source": 7
|
||||
},
|
||||
{
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 0,
|
||||
"key": "contains",
|
||||
"source": 7
|
||||
},
|
||||
{
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 19,
|
||||
"key": "contains",
|
||||
"source": 7
|
||||
},
|
||||
{
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 15,
|
||||
"key": "contains",
|
||||
"source": 7
|
||||
},
|
||||
{
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 9,
|
||||
"key": "contains",
|
||||
"source": 8
|
||||
},
|
||||
{
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 10,
|
||||
"key": "contains",
|
||||
"source": 8
|
||||
},
|
||||
{
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 2,
|
||||
"relationship": "contains"
|
||||
"key": "contains",
|
||||
"source": 8
|
||||
},
|
||||
{
|
||||
"source": 11,
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 17,
|
||||
"key": "contains",
|
||||
"source": 8
|
||||
},
|
||||
{
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 6,
|
||||
"relationship": "contains"
|
||||
"key": "contains",
|
||||
"source": 12
|
||||
},
|
||||
{
|
||||
"source": 12,
|
||||
"target": 5,
|
||||
"relationship": "contains"
|
||||
},
|
||||
{
|
||||
"source": 13,
|
||||
"target": 4,
|
||||
"relationship": "contains"
|
||||
},
|
||||
{
|
||||
"source": 14,
|
||||
"target": 10,
|
||||
"relationship": "contains"
|
||||
},
|
||||
{
|
||||
"source": 15,
|
||||
"target": 9,
|
||||
"relationship": "contains"
|
||||
},
|
||||
{
|
||||
"source": 16,
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 8,
|
||||
"relationship": "contains"
|
||||
"key": "contains",
|
||||
"source": 12
|
||||
},
|
||||
{
|
||||
"source": 17,
|
||||
"target": 7,
|
||||
"relationship": "contains"
|
||||
},
|
||||
{
|
||||
"source": 18,
|
||||
"target": 6,
|
||||
"relationship": "contains"
|
||||
},
|
||||
{
|
||||
"source": 19,
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 5,
|
||||
"relationship": "contains"
|
||||
"key": "contains",
|
||||
"source": 18
|
||||
},
|
||||
{
|
||||
"source": 20,
|
||||
"target": 4,
|
||||
"relationship": "contains"
|
||||
},
|
||||
{
|
||||
"source": 21,
|
||||
"target": 10,
|
||||
"relationship": "contains"
|
||||
},
|
||||
{
|
||||
"source": 22,
|
||||
"target": 9,
|
||||
"relationship": "contains"
|
||||
},
|
||||
{
|
||||
"source": 23,
|
||||
"target": 8,
|
||||
"relationship": "contains"
|
||||
},
|
||||
{
|
||||
"source": 24,
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 7,
|
||||
"relationship": "contains"
|
||||
"key": "contains",
|
||||
"source": 18
|
||||
},
|
||||
{
|
||||
"source": 25,
|
||||
"target": 6,
|
||||
"relationship": "contains"
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 18,
|
||||
"key": "contains",
|
||||
"source": 21
|
||||
},
|
||||
{
|
||||
"source": 26,
|
||||
"target": 5,
|
||||
"relationship": "contains"
|
||||
"relationship_name": "contains",
|
||||
"is_deleted": false,
|
||||
"target": 12,
|
||||
"key": "contains",
|
||||
"source": 21
|
||||
}
|
||||
],
|
||||
"multigraph": false
|
||||
}
|
||||
"multigraph": true
|
||||
}
|
@ -15,6 +15,7 @@ oslo.service>=1.0.0 # Apache-2.0
|
||||
oslo.i18n>=2.1.0
|
||||
pecan>=0.8.0
|
||||
PasteDeploy>=1.5.0
|
||||
testtools>=1.4.0
|
||||
Werkzeug>=0.7
|
||||
keystonemiddleware>=2.3.0
|
||||
stevedore>=1.5.0 # Apache-2.0
|
||||
|
86
run_vitrage.sh
Executable file
86
run_vitrage.sh
Executable file
@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function usage {
|
||||
echo "Usage: $0 [OPTION]..."
|
||||
echo "Run Vitrage Tempest tests"
|
||||
echo ""
|
||||
echo " -h, --help Print this usage message"
|
||||
echo " -d, --debug Run tests with testtools instead of testr. This allows you to use PDB"
|
||||
echo " -t, --serial Run testr serially"
|
||||
echo " -c, --coverage Generate coverage report"
|
||||
echo " -- [TESTROPTIONS] After the first '--' you can pass arbitrary arguments to testr "
|
||||
}
|
||||
|
||||
testrargs=""
|
||||
debug=0
|
||||
serial=0
|
||||
coverage=0
|
||||
wrapper=""
|
||||
|
||||
if ! options=$(getopt -o VNnfuctphd -l help,debug,serial,coverage -- "$@")
|
||||
then
|
||||
# parse error
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval set -- $options
|
||||
first_uu=yes
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-h|--help) usage; exit;;
|
||||
-d|--debug) debug=1;;
|
||||
-c|--coverage) coverage=1;;
|
||||
-t|--serial) serial=1;;
|
||||
--) [ "yes" == "$first_uu" ] || testrargs="$testrargs $1"; first_uu=no ;;
|
||||
*) testrargs="$testrargs $1";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
cd `dirname "$0"`
|
||||
|
||||
function testr_init {
|
||||
if [ ! -d .testrepository ]; then
|
||||
${wrapper} testr init
|
||||
fi
|
||||
}
|
||||
|
||||
function run_tests {
|
||||
testr_init
|
||||
|
||||
echo "run env"
|
||||
nosetests -vx vitrage_tempest_tests/tests/run_vitrage_env.py
|
||||
|
||||
echo "run tests"
|
||||
${wrapper} find . -type f -name "*.pyc" -delete
|
||||
export OS_TEST_PATH=./vitrage_tempest_tests/tests
|
||||
|
||||
if [ "$testrargs" = "" ]; then
|
||||
testrargs="discover ../vitrage_tempest_tests/tests"
|
||||
fi
|
||||
|
||||
if [ $debug -eq 1 ]; then
|
||||
${wrapper} python -m testtools.run $testrargs
|
||||
return $?
|
||||
fi
|
||||
|
||||
if [ $coverage -eq 1 ]; then
|
||||
${wrapper} python setup.py test --coverage
|
||||
return $?
|
||||
fi
|
||||
|
||||
if [ $serial -eq 1 ]; then
|
||||
${wrapper} testr run --subunit $testrargs | ${wrapper} subunit-trace -n -f
|
||||
else
|
||||
${wrapper} testr run --parallel --subunit $testrargs | ${wrapper} subunit-trace -n -f
|
||||
fi
|
||||
|
||||
echo "stop env"
|
||||
nosetests -vx vitrage_tempest_tests/tests/stop_vitrage_env.py
|
||||
}
|
||||
|
||||
run_tests
|
||||
retval=$?
|
||||
|
||||
exit $retval
|
@ -0,0 +1,15 @@
|
||||
# Copyright 2016 - Nokia
|
||||
#
|
||||
# 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.
|
||||
|
||||
__author__ = 'stack'
|
@ -0,0 +1,15 @@
|
||||
# Copyright 2016 - Nokia
|
||||
#
|
||||
# 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.
|
||||
|
||||
__author__ = 'stack'
|
21
vitrage_tempest_tests/tests/api/base.py
Normal file
21
vitrage_tempest_tests/tests/api/base.py
Normal file
@ -0,0 +1,21 @@
|
||||
# Copyright 2016 Nokia
|
||||
#
|
||||
# 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.
|
||||
from vitrage.tests.base import BaseTest
|
||||
|
||||
|
||||
class BaseVitrageTest(BaseTest):
|
||||
"""Base test class for Vitrage API tests."""
|
||||
|
||||
def __init__(self, *args, **kwds):
|
||||
super(BaseVitrageTest, self).__init__(*args, **kwds)
|
15
vitrage_tempest_tests/tests/api/topology/__init__.py
Normal file
15
vitrage_tempest_tests/tests/api/topology/__init__.py
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright 2016 - Nokia
|
||||
#
|
||||
# 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.
|
||||
|
||||
__author__ = 'stack'
|
93
vitrage_tempest_tests/tests/api/topology/topology.py
Normal file
93
vitrage_tempest_tests/tests/api/topology/topology.py
Normal file
@ -0,0 +1,93 @@
|
||||
# Copyright 2016 Nokia
|
||||
#
|
||||
# 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.
|
||||
|
||||
import os
|
||||
|
||||
import oslo_messaging
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from vitrage.api.controllers.v1.topology import TopologyController
|
||||
from vitrage_tempest_tests.tests.api.base import BaseVitrageTest
|
||||
from vitrage_tempest_tests.tests.base_mock import BaseMock
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class BaseTopologyTest(BaseVitrageTest):
|
||||
"""Topology test class for Vitrage API tests."""
|
||||
|
||||
def __init__(self, *args, **kwds):
|
||||
super(BaseTopologyTest, self).__init__(*args, **kwds)
|
||||
self.created_graphs = []
|
||||
self.name = 'tempest_graph'
|
||||
self.depth = ''
|
||||
self.query = ''
|
||||
self.root = ''
|
||||
|
||||
""" Get client """
|
||||
transport = oslo_messaging.get_transport(cfg.CONF)
|
||||
cfg.CONF.set_override('rpc_backend', 'rabbit')
|
||||
target = oslo_messaging.Target(topic='rpcapiv1')
|
||||
self.client = oslo_messaging.RPCClient(transport, target)
|
||||
|
||||
def test_get_graph(self):
|
||||
"""Wrapper that returns a test graph."""
|
||||
self.graph_type = 'graph'
|
||||
self.graph = self._get_topology()
|
||||
self._validate_graph_correctness()
|
||||
LOG.debug('The graph ' + self.name + ' does not exist')
|
||||
|
||||
def test_get_tree(self):
|
||||
"""Wrapper that returns a test tree."""
|
||||
self.graph_type = 'tree'
|
||||
self.graph = self._get_topology()
|
||||
self._validate_graph_correctness()
|
||||
LOG.debug('The graph tree ' + self.name + ' exist')
|
||||
|
||||
def _get_topology(self):
|
||||
"""Get Graph objects returned by the v1 client """
|
||||
try:
|
||||
g = TopologyController().get_graph(graph_type=self.graph_type)
|
||||
|
||||
except Exception as e:
|
||||
LOG.exception("Failed to get topology (graph_type = " +
|
||||
self.graph_type + ") %s ", e)
|
||||
return None
|
||||
|
||||
return g
|
||||
|
||||
def _validate_graph_correctness(self):
|
||||
"""Compare Graph object to graph form os terminal """
|
||||
|
||||
print("The topology graph taken by api is : %s", self.graph)
|
||||
|
||||
def _create_graph_by_mock(self):
|
||||
"""Create MOCK Graph and copied to the string """
|
||||
processor = BaseMock.create_processor_with_graph(self)
|
||||
entity_graph = processor.entity_graph
|
||||
a = entity_graph.output_graph()
|
||||
print (a)
|
||||
|
||||
@staticmethod
|
||||
def _show_topology():
|
||||
text_out = os.popen("vitrage topology show").read()
|
||||
print (text_out)
|
||||
|
||||
if "RESOURCE" not in text_out:
|
||||
LOG.info('The topology graph does not exist')
|
||||
return False
|
||||
else:
|
||||
LOG.info('The topology graph exist')
|
||||
return True
|
39
vitrage_tempest_tests/tests/base_mock.py
Normal file
39
vitrage_tempest_tests/tests/base_mock.py
Normal file
@ -0,0 +1,39 @@
|
||||
# Copyright 2016 Nokia
|
||||
#
|
||||
# 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.
|
||||
import testtools
|
||||
from vitrage.entity_graph.processor import processor as proc
|
||||
from vitrage.tests.mocks import mock_syncronizer as mock_sync
|
||||
|
||||
|
||||
class BaseMock(testtools.TestCase):
|
||||
"""Base test class for Vitrage API tests."""
|
||||
|
||||
def create_processor_with_graph(self):
|
||||
events = self._create_mock_events()
|
||||
processor = proc.Processor()
|
||||
|
||||
for event in events:
|
||||
processor.process_event(event)
|
||||
|
||||
return processor
|
||||
|
||||
@staticmethod
|
||||
def _create_mock_events():
|
||||
gen_list = mock_sync.simple_zone_generators(
|
||||
2, 4, snapshot_events=2, snap_vals={'sync_mode': 'init_snapshot'})
|
||||
gen_list += mock_sync.simple_host_generators(
|
||||
2, 4, 4, snap_vals={'sync_mode': 'init_snapshot'})
|
||||
gen_list += mock_sync.simple_instance_generators(
|
||||
4, 15, 15, snap_vals={'sync_mode': 'init_snapshot'})
|
||||
return mock_sync.generate_sequential_events_list(gen_list)
|
156
vitrage_tempest_tests/tests/run_vitrage_env.py
Normal file
156
vitrage_tempest_tests/tests/run_vitrage_env.py
Normal file
@ -0,0 +1,156 @@
|
||||
# Copyright 2016 Nokia
|
||||
#
|
||||
# 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.
|
||||
from oslo_log import log as logging
|
||||
|
||||
import os
|
||||
import re
|
||||
import testtools
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class RunVitrageEnv(testtools.TestCase):
|
||||
"""RunVitrageEnv class. Run Vitrage env."""
|
||||
|
||||
def __init__(self, *args, **kwds):
|
||||
super(RunVitrageEnv, self).__init__(*args, **kwds)
|
||||
self.filename = '/opt/stack/vitrage/etc/vitrage/vitrage.conf'
|
||||
self.port = '8999'
|
||||
|
||||
def test_run_env(self):
|
||||
self._set_env_params()
|
||||
print("The host ip address = " + self.host + " with port " + self.port)
|
||||
|
||||
LOG.info('MARINA!!!')
|
||||
if self._show_vitrage_processes() is True:
|
||||
print ("The vitrage processed existed and should be removed")
|
||||
LOG.info('The vitrage processed existed and should be removed')
|
||||
self._stop_vitrage_processes()
|
||||
|
||||
os.system("openstack service create rca" +
|
||||
" --os-username " + self.user +
|
||||
" --os-password " + self.password +
|
||||
" --os-auth-url " + self.url +
|
||||
" --os-project-name admin" +
|
||||
" --name vitrage")
|
||||
os.system("openstack endpoint create rca --os-username " + self.user +
|
||||
" --os-password " + self.password +
|
||||
" --os-auth-url " + self.url +
|
||||
" --os-project-name admin" +
|
||||
" --adminurl http://" + self.host + ":" + self.port +
|
||||
" --internalurl http://" + self.host + ":" + self.port +
|
||||
" --publicurl http://" + self.host + ":" + self.port +
|
||||
" --region RegionOne")
|
||||
|
||||
os.chdir('/tmp')
|
||||
os.system("\rm nohup.out")
|
||||
os.system("nohup vitrage-graph &")
|
||||
os.system("nohup vitrage-api &")
|
||||
|
||||
if self._show_vitrage_processes() is False:
|
||||
LOG.error("No vitrage processes founded")
|
||||
raise ValueError("No vitrage processes founded")
|
||||
|
||||
if self._validate_vitrage_processes() is False:
|
||||
LOG.error("The vitrage processes are not correct")
|
||||
self._stop_vitrage_processes()
|
||||
raise ValueError("The vitrage processes are not correct")
|
||||
|
||||
@staticmethod
|
||||
def _show_vitrage_processes():
|
||||
text_out = os.popen(
|
||||
"ps -ef | grep vitrage-api | grep -v grep").read()
|
||||
print (text_out)
|
||||
|
||||
text_out2 = os.popen(
|
||||
"ps -ef | grep vitrage-graph | grep -v grep").read()
|
||||
print (text_out2)
|
||||
|
||||
if ("vitrage-api" in text_out) and ("vitrage-graph" in text_out2):
|
||||
LOG.info('The vitrage processes exists')
|
||||
return True
|
||||
elif "vitrage-api" in text_out:
|
||||
LOG.info('Only vitrage-api process exist')
|
||||
return True
|
||||
elif "vitrage-graph" in text_out2:
|
||||
LOG.info('Only vitrage-graph process exist')
|
||||
return True
|
||||
else:
|
||||
LOG.info('The vitrage process does not run')
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def _get_field_from_file(pattern, lines_arr):
|
||||
p = re.compile(pattern)
|
||||
for line in lines_arr:
|
||||
m = p.search(line)
|
||||
if m:
|
||||
print("The field value is " + m.group(1))
|
||||
return m.group(1)
|
||||
return None
|
||||
|
||||
def _set_env_params(self):
|
||||
lines_arr = []
|
||||
with open(self.filename, 'r') as the_file:
|
||||
for line in the_file:
|
||||
if "#" not in line and line.strip() != '':
|
||||
lines_arr.append(line)
|
||||
|
||||
self.user = self._get_field_from_file(
|
||||
"admin_user = (\w+)", lines_arr)
|
||||
text_out = os.popen("echo $OS_USERNAME").read()
|
||||
if text_out not in self.user:
|
||||
os.system("export OS_USERNAME=" + self.user)
|
||||
|
||||
self.tenent_user = self._get_field_from_file(
|
||||
"admin_tenant_name = (\w+)", lines_arr)
|
||||
text_out = os.popen("echo $OS_TENANT_NAME").read()
|
||||
if text_out not in self.tenent_user:
|
||||
os.system("export OS_TENANT_NAME=" + self.tenent_user)
|
||||
|
||||
self.password = self._get_field_from_file(
|
||||
"admin_password = (\w+)", lines_arr)
|
||||
text_out = os.popen("echo $OS_PASSWORD").read()
|
||||
if text_out not in self.password:
|
||||
os.system("export OS_PASSWORD=" + self.password)
|
||||
|
||||
self.host = self._get_field_from_file(
|
||||
"(\d+\.\d+\.\d+\.\d+)", lines_arr)
|
||||
self.url = "http://" + self.host + ":5000/v2.0"
|
||||
text_out = os.popen("echo $OS_AUTH_URL").read()
|
||||
if text_out not in self.url:
|
||||
os.system("export OS_AUTH_URL=" + self.url)
|
||||
|
||||
@staticmethod
|
||||
def _stop_vitrage_processes():
|
||||
text_out = os.popen("pgrep vitrage-api").read()
|
||||
print (text_out)
|
||||
if text_out != '':
|
||||
LOG.info("The vitrage-api process exist")
|
||||
os.system("kill -9 " + text_out)
|
||||
|
||||
text_out2 = os.popen("pgrep vitrage-graph").read()
|
||||
print (text_out2)
|
||||
if text_out2 != '':
|
||||
LOG.info("The vitrage-graph process exist")
|
||||
os.system("kill -9 " + text_out2)
|
||||
|
||||
@staticmethod
|
||||
def _validate_vitrage_processes():
|
||||
text_out2 = os.popen("grep 'ERROR vitrage' nohup.out").read()
|
||||
if text_out2 != '':
|
||||
LOG.info("The error is : " + text_out2)
|
||||
print("The error is : " + text_out2)
|
||||
return False
|
||||
return True
|
44
vitrage_tempest_tests/tests/stop_vitrage_env.py
Normal file
44
vitrage_tempest_tests/tests/stop_vitrage_env.py
Normal file
@ -0,0 +1,44 @@
|
||||
# Copyright 2016 Nokia
|
||||
#
|
||||
# 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.
|
||||
from oslo_log import log as logging
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import testtools
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class StopVitrageEnv(testtools.TestCase):
|
||||
"""RunVitrageEnv class. Run Vitrage env."""
|
||||
|
||||
def __init__(self, *args, **kwds):
|
||||
super(StopVitrageEnv, self).__init__(*args, **kwds)
|
||||
self.filename = '/etc/vitrage/vitrage.conf'
|
||||
|
||||
@staticmethod
|
||||
def test_stop_vitrage_processes():
|
||||
f = subprocess.Popen("pgrep vitrage-api",
|
||||
stdout=subprocess.PIPE, shell=True)
|
||||
text_out, std_error = f.communicate()
|
||||
print (text_out)
|
||||
if text_out != '':
|
||||
os.system("kill -9 " + text_out)
|
||||
|
||||
f = subprocess.Popen("pgrep vitrage-graph",
|
||||
stdout=subprocess.PIPE, shell=True)
|
||||
text_out, std_error2 = f.communicate()
|
||||
print (text_out)
|
||||
if text_out != '':
|
||||
os.system("kill -9 " + text_out)
|
Loading…
Reference in New Issue
Block a user