-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from openvstorage/develop
Promote develop
- Loading branch information
Showing
35 changed files
with
2,039 additions
and
567 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Copyright (C) 2016 iNuron NV | ||
# | ||
# This file is part of Open vStorage Open Source Edition (OSE), | ||
# as available from | ||
# | ||
# http://www.openvstorage.org and | ||
# http://www.openvstorage.com. | ||
# | ||
# This file is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU Affero General Public License v3 (GNU AGPLv3) | ||
# as published by the Free Software Foundation, in version 3 as it comes | ||
# in the LICENSE.txt file of the Open vStorage OSE distribution. | ||
# | ||
# Open vStorage is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY of any kind. | ||
import json | ||
from ci.api_lib.helpers.api import OVSClient | ||
|
||
|
||
class CIConstants(object): | ||
""" | ||
Collection of multiple constants and constant related instances | ||
""" | ||
|
||
CONFIG_LOC = "/opt/OpenvStorage/ci/config/setup.json" | ||
TEST_SCENARIO_LOC = "/opt/OpenvStorage/ci/scenarios/" | ||
TESTRAIL_LOC = "/opt/OpenvStorage/ci/config/testrail.json" | ||
|
||
with open(CONFIG_LOC, 'r') as JSON_CONFIG: | ||
SETUP_CFG = json.load(JSON_CONFIG) | ||
|
||
HYPERVISOR_INFO = SETUP_CFG['ci'].get('hypervisor') | ||
DOMAIN_INFO = SETUP_CFG['setup']['domains'] | ||
BACKEND_INFO = SETUP_CFG['setup']['backends'] | ||
STORAGEROUTER_INFO = SETUP_CFG['setup']['storagerouters'] | ||
|
||
class classproperty(property): | ||
def __get__(self, cls, owner): | ||
return classmethod(self.fget).__get__(None, owner)() | ||
|
||
@classproperty | ||
def api(cls): | ||
return OVSClient(cls.SETUP_CFG['ci']['grid_ip'], | ||
cls.SETUP_CFG['ci']['user']['api']['username'], | ||
cls.SETUP_CFG['ci']['user']['api']['password']) | ||
|
||
@classmethod | ||
def get_vpool_names(cls): | ||
names = [] | ||
for sr_ip, items in cls.STORAGEROUTER_INFO.iteritems(): | ||
vpools = items.get('vpools') | ||
for vp_name, vp_info in vpools.iteritems(): | ||
if vp_name not in names: | ||
names.append(vp_name) | ||
return names |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.