コード例 #1
0
ファイル: boot_job.py プロジェクト: showsmall/JimV-C
def r_delete(ids):
    operate_rule_base = Base(the_class=OperateRule)
    operate_rule_base.delete(ids=ids,
                             ids_rule=Rules.IDS.value,
                             by_field='boot_job_id')

    return boot_job_base.delete(ids=ids,
                                ids_rule=Rules.IDS.value,
                                by_field='id')
コード例 #2
0
def r_delete(ids):
    os_template_initialize_operate_base = Base(
        the_class=OSTemplateInitializeOperate)
    os_template_initialize_operate_base.delete(
        ids=ids,
        ids_rule=Rules.IDS.value,
        by_field='os_template_initialize_operate_set_id')

    return os_template_initialize_operate_set_base.delete(
        ids=ids, ids_rule=Rules.IDS.value, by_field='id')
コード例 #3
0
__author__ = 'James Iter'
__date__ = '2017/3/30'
__contact__ = '*****@*****.**'
__copyright__ = '(c) 2017 by James Iter.'

blueprint = Blueprint('api_os_template',
                      __name__,
                      url_prefix='/api/os_template')

blueprints = Blueprint('api_os_templates',
                       __name__,
                       url_prefix='/api/os_templates')

os_template_base = Base(the_class=OSTemplate,
                        the_blueprint=blueprint,
                        the_blueprints=blueprints)


@Utils.dumps2response
def r_create():

    os_template = OSTemplate()

    args_rules = [
        Rules.LABEL.value, Rules.PATH.value, Rules.ACTIVE.value,
        Rules.OS_TYPE.value, Rules.ICON.value, Rules.BOOT_JOB_ID_EXT.value
    ]

    os_template.label = request.json.get('label')
    os_template.path = request.json.get('path')
コード例 #4
0
ファイル: operate_rule.py プロジェクト: showsmall/JimV-C
__author__ = 'James Iter'
__date__ = '2017/6/19'
__contact__ = '*****@*****.**'
__copyright__ = '(c) 2017 by James Iter.'

blueprint = Blueprint('api_operate_rule',
                      __name__,
                      url_prefix='/api/operate_rule')

blueprints = Blueprint('api_operate_rules',
                       __name__,
                       url_prefix='/api/operate_rules')

operate_rule_base = Base(the_class=OperateRule,
                         the_blueprint=blueprint,
                         the_blueprints=blueprints)


@Utils.dumps2response
def r_create():

    boot_job = BootJob()
    operate_rule = OperateRule()

    args_rules = [
        Rules.BOOT_JOB_ID_EXT.value, Rules.OPERATE_RULE_KIND.value,
        Rules.OPERATE_RULE_SEQUENCE.value
    ]

    operate_rule.boot_job_id = request.json.get('boot_job_id')
コード例 #5
0
ファイル: performance.py プロジェクト: showsmall/JimV-C
__author__ = 'James Iter'
__date__ = '2017/7/2'
__contact__ = '*****@*****.**'
__copyright__ = '(c) 2017 by James Iter.'

blueprint = Blueprint('api_performance',
                      __name__,
                      url_prefix='/api/performance')

blueprints = Blueprint('api_performances',
                       __name__,
                       url_prefix='/api/performances')

cpu_memory = Base(the_class=CPUMemory,
                  the_blueprint=blueprint,
                  the_blueprints=blueprints)
traffic = Base(the_class=Traffic,
               the_blueprint=blueprint,
               the_blueprints=blueprints)
disk_io = Base(the_class=DiskIO,
               the_blueprint=blueprint,
               the_blueprints=blueprints)


@Utils.dumps2response
def r_cpu_memory_get_by_filter():
    return cpu_memory.get_by_filter()


@Utils.dumps2response
コード例 #6
0
from models import SSHKeyGuestMapping
from models import Guest
from models import Utils
from models import Rules

__author__ = 'James Iter'
__date__ = '2018/2/26'
__contact__ = '*****@*****.**'
__copyright__ = '(c) 2018 by James Iter.'

blueprint = Blueprint('api_ssh_key', __name__, url_prefix='/api/ssh_key')

blueprints = Blueprint('api_ssh_keys', __name__, url_prefix='/api/ssh_keys')

ssh_key_base = Base(the_class=SSHKey,
                    the_blueprint=blueprint,
                    the_blueprints=blueprints)
guest_base = Base(the_class=Guest,
                  the_blueprint=blueprint,
                  the_blueprints=blueprints)


@Utils.dumps2response
def r_create():

    args_rules = [Rules.LABEL.value, Rules.PUBLIC_KEY.value]

    try:
        ret = dict()
        ret['state'] = ji.Common.exchange_state(20000)
コード例 #7
0
from api.base import Base
from models import Log
from models import Rules
from models import Utils

__author__ = 'James Iter'
__date__ = '2017/4/8'
__contact__ = '*****@*****.**'
__copyright__ = '(c) 2017 by James Iter.'

blueprint = Blueprint('api_log', __name__, url_prefix='/api/log')

blueprints = Blueprint('api_logs', __name__, url_prefix='/api/logs')

log_base = Base(the_class=Log,
                the_blueprint=blueprint,
                the_blueprints=blueprints)


@Utils.dumps2response
def r_get(ids):
    return log_base.get(ids=ids, ids_rule=Rules.IDS.value, by_field='id')


@Utils.dumps2response
def r_get_by_filter():
    return log_base.get_by_filter()


@Utils.dumps2response
def r_content_search():
コード例 #8
0
__author__ = 'James Iter'
__date__ = '2017/7/2'
__contact__ = '*****@*****.**'
__copyright__ = '(c) 2017 by James Iter.'

blueprint = Blueprint('api_guest_performance',
                      __name__,
                      url_prefix='/api/guest_performance')

blueprints = Blueprint('api_guest_performances',
                       __name__,
                       url_prefix='/api/guest_performances')

guest_cpu_memory = Base(the_class=GuestCPUMemory,
                        the_blueprint=blueprint,
                        the_blueprints=blueprints)
guest_traffic = Base(the_class=GuestTraffic,
                     the_blueprint=blueprint,
                     the_blueprints=blueprints)
guest_disk_io = Base(the_class=GuestDiskIO,
                     the_blueprint=blueprint,
                     the_blueprints=blueprints)


@Utils.dumps2response
def r_cpu_memory_get_by_filter():
    return guest_cpu_memory.get_by_filter()


@Utils.dumps2response
コード例 #9
0
 def create_access_policy(self):
     return Base.make_request()
コード例 #10
0
 def create_group(self, name):
     Base.make_request()
     return Group(name)
コード例 #11
0
 def add_member(self):
     return Base.make_request()
コード例 #12
0
 def create(cls):
     Base.make_request()
     return cls("User Name")
コード例 #13
0
 def authenticate(self):
     Base.make_request()
     return "success"
コード例 #14
0
__author__ = 'James Iter'
__date__ = '2018/2/4'
__contact__ = '*****@*****.**'
__copyright__ = '(c) 2018 by James Iter.'

blueprint = Blueprint('api_os_template_initialize_operate_set',
                      __name__,
                      url_prefix='/api/os_template_initialize_operate_set')

blueprints = Blueprint('api_os_templates_initialize_operate_set',
                       __name__,
                       url_prefix='/api/os_templates_initialize_operate_set')

os_template_initialize_operate_set_base = Base(
    the_class=OSTemplateInitializeOperateSet,
    the_blueprint=blueprint,
    the_blueprints=blueprints)


@Utils.dumps2response
def r_create():

    os_template_initialize_operate_set = OSTemplateInitializeOperateSet()

    args_rules = [
        Rules.LABEL.value, Rules.DESCRIPTION.value, Rules.ACTIVE.value
    ]

    os_template_initialize_operate_set.label = request.json.get('label')
    os_template_initialize_operate_set.description = request.json.get(
        'description')
コード例 #15
0
blueprint = Blueprint(
    'api_os_template_initialize_operate',
    __name__,
    url_prefix='/api/os_template_initialize_operate'
)

blueprints = Blueprint(
    'api_os_template_initialize_operates',
    __name__,
    url_prefix='/api/os_template_initialize_operates'
)


os_template_initialize_operate_base = \
    Base(the_class=OSTemplateInitializeOperate, the_blueprint=blueprint, the_blueprints=blueprints)


@Utils.dumps2response
def r_create():

    os_template_initialize_operate_set = OSTemplateInitializeOperateSet()
    os_template_initialize_operate = OSTemplateInitializeOperate()

    args_rules = [
        Rules.OS_TEMPLATE_INITIALIZE_OPERATE_SET_ID_EXT.value,
        Rules.OS_TEMPLATE_INITIALIZE_OPERATE_KIND.value,
        Rules.OS_TEMPLATE_INITIALIZE_OPERATE_SEQUENCE.value
    ]

    os_template_initialize_operate.os_template_initialize_operate_set_id = \
コード例 #16
0

blueprint = Blueprint(
    'api_snapshot',
    __name__,
    url_prefix='/api/snapshot'
)

blueprints = Blueprint(
    'api_snapshots',
    __name__,
    url_prefix='/api/snapshots'
)


snapshot_base = Base(the_class=Snapshot, the_blueprint=blueprint, the_blueprints=blueprints)


@Utils.dumps2response
def r_create():

    args_rules = [
        Rules.GUEST_UUID.value
    ]

    if 'label' in request.json:
        args_rules.append(
            Rules.LABEL.value,
        )

    try:
コード例 #17
0
 def create(cls, name):
     Base.make_request()
     return cls(name)
コード例 #18
0
 def list_fixtures(self):
     Base.make_request()
     return [Fixture("Muh Fixture 2")]
コード例 #19
0
ファイル: guest.py プロジェクト: constct/JimV-C
from models import Guest
from models import OSTemplate
from models import GuestXML
from models import status

__author__ = 'James Iter'
__date__ = '2017/3/22'
__contact__ = '*****@*****.**'
__copyright__ = '(c) 2017 by James Iter.'

blueprint = Blueprint('api_guest', __name__, url_prefix='/api/guest')

blueprints = Blueprint('api_guests', __name__, url_prefix='/api/guests')

guest_base = Base(the_class=Guest,
                  the_blueprint=blueprint,
                  the_blueprints=blueprints)


@Utils.dumps2response
def r_create():

    args_rules = [
        Rules.CPU.value, Rules.MEMORY.value, Rules.OS_TEMPLATE_ID.value,
        Rules.QUANTITY.value, Rules.REMARK.value, Rules.PASSWORD.value,
        Rules.LEASE_TERM.value
    ]

    if 'node_id' in request.json:
        args_rules.append(Rules.NODE_ID.value, )
コード例 #20
0
def list():
    Base.make_request()
    return [Org("Muh Org 2")]
コード例 #21
0

blueprint = Blueprint(
    'api_user',
    __name__,
    url_prefix='/api/user'
)

blueprints = Blueprint(
    'api_users',
    __name__,
    url_prefix='/api/users'
)


user_base = Base(the_class=User, the_blueprint=blueprint, the_blueprints=blueprints)


@Utils.dumps2response
def r_sign_in():

    args_rules = [
        Rules.LOGIN_NAME.value,
        Rules.PASSWORD.value
    ]

    user = User()
    user.login_name = request.json.get('login_name')
    user.password = request.json.get('password')

    try:
コード例 #22
0
ファイル: boot_job.py プロジェクト: showsmall/JimV-C
from api.base import Base
from models import Rules
from models import Utils
from models.boot_job import BootJob, OperateRule

__author__ = 'James Iter'
__date__ = '2017/6/19'
__contact__ = '*****@*****.**'
__copyright__ = '(c) 2017 by James Iter.'

blueprint = Blueprint('api_boot_job', __name__, url_prefix='/api/boot_job')

blueprints = Blueprint('api_boot_jobs', __name__, url_prefix='/api/boot_jobs')

boot_job_base = Base(the_class=BootJob,
                     the_blueprint=blueprint,
                     the_blueprints=blueprints)


@Utils.dumps2response
def r_create():

    boot_job = BootJob()

    args_rules = [Rules.NAME.value, Rules.USE_FOR.value, Rules.REMARK.value]

    boot_job.name = request.json.get('name')
    boot_job.use_for = request.json.get('use_for')
    boot_job.remark = request.json.get('remark')

    try:
コード例 #23
0
ファイル: host_performance.py プロジェクト: zhaozlgit/JimV-C
__author__ = 'James Iter'
__date__ = '2017/8/7'
__contact__ = '*****@*****.**'
__copyright__ = '(c) 2017 by James Iter.'

blueprint = Blueprint('api_host_performance',
                      __name__,
                      url_prefix='/api/host_performance')

blueprints = Blueprint('api_host_performances',
                       __name__,
                       url_prefix='/api/host_performances')

host_cpu_memory = Base(the_class=HostCPUMemory,
                       the_blueprint=blueprint,
                       the_blueprints=blueprints)
host_traffic = Base(the_class=HostTraffic,
                    the_blueprint=blueprint,
                    the_blueprints=blueprints)
host_disk_usage_io = Base(the_class=HostDiskUsageIO,
                          the_blueprint=blueprint,
                          the_blueprints=blueprints)


@Utils.dumps2response
def r_cpu_memory_get_by_filter():
    return host_cpu_memory.get_by_filter()


@Utils.dumps2response
コード例 #24
0
ファイル: run_case.py プロジェクト: wangguangxue159/api_test1
import unittest
from HTMLTestRunner import HTMLTestRunner
from api.base import Base
from setting import username, password, TEST_REPORT_FILE

if __name__ == '__main__':
    Base().login(username, password)

    suite = unittest.TestLoader().discover('./cases', 'test*case.py')

    with open(TEST_REPORT_FILE, 'wb') as f:
        runner = HTMLTestRunner(f, title='测试报告')
        runner.run(suite)