예제 #1
0
def test_Node_syslog():
    PROXMOX_HOST = "proxmox-7"
    PROXMOX_PORT = 8006
    USER = "******"
    PASSWD = "strawberries"
    VMID = 108

    connection = Connector(PROXMOX_HOST, PROXMOX_PORT)
    connection.fetch_auth_token(USER, PASSWD)

    node = Node(connection, PROXMOX_HOST)

    assert node.syslog()
예제 #2
0
def test_Node_subscription():
    PROXMOX_HOST = "proxmox-7"
    PROXMOX_PORT = 8006
    USER = "******"
    PASSWD = "strawberries"
    VMID = 108

    connection = Connector(PROXMOX_HOST, PROXMOX_PORT)
    connection.fetch_auth_token(USER, PASSWD)

    node = Node(connection, PROXMOX_HOST)

    assert node.subscription()
예제 #3
0
def test_Node_rrddata():
    PROXMOX_HOST = "proxmox-7"
    PROXMOX_PORT = 8006
    USER = "******"
    PASSWD = "strawberries"
    VMID = 108

    connection = Connector(PROXMOX_HOST, PROXMOX_PORT)
    connection.fetch_auth_token(USER, PASSWD)

    node = Node(connection, PROXMOX_HOST)

    assert node.rrddata(timeframe='hour')
예제 #4
0
def test_Node_vzdump():
    PROXMOX_HOST = "proxmox-7"
    PROXMOX_PORT = 8006
    USER = "******"
    PASSWD = "strawberries"
    VMID = 108

    connection = Connector(PROXMOX_HOST, PROXMOX_PORT)
    connection.fetch_auth_token(USER, PASSWD)

    node = Node(connection, PROXMOX_HOST)

    assert node.vzdump(vmid=108, stdout=True, compress='gzip')
예제 #5
0
def test_Node_rrd():
    PROXMOX_HOST = "proxmox-7"
    PROXMOX_PORT = 8006
    USER = "******"
    PASSWD = "strawberries"
    VMID = 108

    connection = Connector(PROXMOX_HOST, PROXMOX_PORT)
    connection.fetch_auth_token(USER, PASSWD)

    node = Node(connection, PROXMOX_HOST)

    assert node.rrd(ds='cpu',timeframe='hour')
예제 #6
0
def test_Node_vzdump():
    PROXMOX_HOST = "proxmox-7"
    PROXMOX_PORT = 8006
    USER = "******"
    PASSWD = "strawberries"
    VMID = 108

    connection = Connector(PROXMOX_HOST, PROXMOX_PORT)
    connection.fetch_auth_token(USER, PASSWD)

    node = Node(connection, PROXMOX_HOST)

    assert node.vzdump(vmid=108, stdout=True, compress='gzip')
예제 #7
0
def test_OpenVZ_stop():
    PROXMOX_HOST = "proxmox-7"
    PROXMOX_PORT = 8006
    USER = "******"
    PASSWD = "strawberries"
    VMID = 108

    connection = Connector(PROXMOX_HOST, PROXMOX_PORT)
    connection.fetch_auth_token(USER, PASSWD)

    node = Node(connection, PROXMOX_HOST)
    vm = node.openvz(VMID)  # 108 is a testing vm 'packages'

    assert vm.stop()
예제 #8
0
def test_create_OpenVZ_Object_FromNode():
    PROXMOX_HOST = "proxmox-7"
    PROXMOX_PORT = 8006
    USER = "******"
    PASSWD = "strawberries"
    VMID = 108

    connection = Connector(PROXMOX_HOST, PROXMOX_PORT)
    connection.fetch_auth_token(USER, PASSWD)

    node = Node(connection, PROXMOX_HOST)
    vm = node.openvz(VMID)  # VMID is a testing vm 'packages'

    assert isinstance(vm, OpenVZ)
    assert vm.vmid == VMID
    assert vm.baseurl == 'https://{0}:8006/api2/json/nodes/{0}/openvz/{1}'.format(PROXMOX_HOST,VMID)
예제 #9
0
def test_Node_raiseExceptionOnUndefined():
    PROXMOX_HOST = "proxmox-7"
    PROXMOX_PORT = 8006
    USER = "******"
    PASSWD = "strawberries"
    VMID = 108

    connection = Connector(PROXMOX_HOST, PROXMOX_PORT)
    connection.fetch_auth_token(USER, PASSWD)

    node = Node(connection, PROXMOX_HOST)

    try:
        node.failme()
    except ProxmoxError as e:
        logging.debug(e)
        assert True
        return

    assert False
예제 #10
0
def test_Node_raiseExceptionOnUndefined():
    PROXMOX_HOST = "proxmox-7"
    PROXMOX_PORT = 8006
    USER = "******"
    PASSWD = "strawberries"
    VMID = 108

    connection = Connector(PROXMOX_HOST, PROXMOX_PORT)
    connection.fetch_auth_token(USER, PASSWD)

    node = Node(connection, PROXMOX_HOST)

    try:
        node.failme()
    except ProxmoxError as e:
        logging.debug(e)
        assert True
        return

    assert False
예제 #11
0
def test_create_Node_object():
    PROXMOX_HOST = "proxmox-7"
    PROXMOX_PORT = 8006
    USER = "******"
    PASSWD = "strawberries"
    VMID = 108

    connection = Connector(PROXMOX_HOST, PROXMOX_PORT)
    connection.fetch_auth_token(USER, PASSWD)

    node = Node(connection, PROXMOX_HOST)

    assert isinstance(node, Node)
    assert node.node == PROXMOX_HOST
    assert node.baseurl == 'https://{0}:8006/api2/json/nodes/{0}'.format(
        PROXMOX_HOST)