Example #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()
Example #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()
Example #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')
Example #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')
Example #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')
Example #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')
Example #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()
Example #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)
Example #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
Example #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
Example #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)