Ejemplo n.º 1
0
def test_network_get(test_data):
    args = [
        "network", "get", "--auth_token", test_data["auth_token"], "--network",
        test_data["networks"][0]
    ]
    cmd_line = ztcc.process_command_line(args)
    auth_token, network, controller, member, url, headers = \
        ztcc.set_ctx(cmd_line)
    result = ztcc.network_command(cmd_line, url, headers, network, controller)
    assert result == 0
Ejemplo n.º 2
0
def test_member_del_ip(test_data, capsys):
    args = [
        "member", "update", "--auth_token", test_data["auth_token"],
        "--network", test_data["networks"][0], "--member",
        test_data["members"][0], "--ip_del", test_data["test_ips"][0]
    ]
    cmd_line = ztcc.process_command_line(args)
    auth_token, network, controller, member, url, headers = \
        ztcc.set_ctx(cmd_line)
    result = ztcc.network_command(cmd_line, url, headers, network, member)
    assert result == 0
Ejemplo n.º 3
0
def test_member_dis_bridging(test_data, capsys):
    args = [
        "member", "update", "--auth_token", test_data["auth_token"],
        "--network", test_data["networks"][0], "--member",
        test_data["members"][0], "--disable_active_bridging"
    ]
    cmd_line = ztcc.process_command_line(args)
    auth_token, network, controller, member, url, headers = \
        ztcc.set_ctx(cmd_line)
    result = ztcc.network_command(cmd_line, url, headers, network, member)
    assert result == 0
Ejemplo n.º 4
0
def test_net_del_pool(test_data, capsys):
    args = [
        "network", "update", "--auth_token", test_data["auth_token"],
        "--network", test_data["networks"][0], "--ip_pool_del",
        test_data["test_pools"][0]
    ]
    cmd_line = ztcc.process_command_line(args)
    auth_token, network, controller, member, url, headers = \
        ztcc.set_ctx(cmd_line)
    result = ztcc.network_command(cmd_line, url, headers, network, controller)
    assert result == 0
    cap = capsys.readouterr()
Ejemplo n.º 5
0
def test_net_disable_broadcast(test_data, capsys):
    args = [
        "network", "update", "--auth_token", test_data["auth_token"],
        "--network", test_data["networks"][0], "--disable_broadcast"
    ]
    cmd_line = ztcc.process_command_line(args)
    auth_token, network, controller, member, url, headers = \
        ztcc.set_ctx(cmd_line)
    result = ztcc.network_command(cmd_line, url, headers, network, controller)
    assert result == 0
    cap = capsys.readouterr()
    assert '"enableBroadcast": false' in cap.out
Ejemplo n.º 6
0
def test_update_net_private(test_data, capsys):
    args = [
        "network", "update", "--auth_token", test_data["auth_token"],
        "--network", test_data["networks"][0], "--private"
    ]
    cmd_line = ztcc.process_command_line(args)
    auth_token, network, controller, member, url, headers = \
        ztcc.set_ctx(cmd_line)
    result = ztcc.network_command(cmd_line, url, headers, network, controller)
    assert result == 0
    cap = capsys.readouterr()
    assert '"private": true' in cap.out
Ejemplo n.º 7
0
def test_net_disable_v4_assign(test_data, capsys):
    args = [
        "network", "update", "--auth_token", test_data["auth_token"],
        "--network", test_data["networks"][0], "--disable_v4_assign"
    ]
    cmd_line = ztcc.process_command_line(args)
    auth_token, network, controller, member, url, headers = \
        ztcc.set_ctx(cmd_line)
    result = ztcc.network_command(cmd_line, url, headers, network, controller)
    assert result == 0
    cap = capsys.readouterr()
    m = re.search(r"v4AssignMode.{,16}zt.{,4}false", cap.out,
                  re.MULTILINE | re.DOTALL)
    assert m
Ejemplo n.º 8
0
def test_create_delete_network(test_data, capsys):
    args = [
        "network", "create", "--auth_token", test_data["auth_token"],
        "--controller", test_data["controllers"][0], "--name",
        test_data["test_network_name"]
    ]
    cmd_line = ztcc.process_command_line(args)
    auth_token, network, controller, member, url, headers = \
        ztcc.set_ctx(cmd_line)
    result = ztcc.network_command(cmd_line, url, headers, network, controller)
    assert result == 0

    cap = capsys.readouterr()
    m = re.search('("id": ")([a-f0-9]{16})', cap.out, re.MULTILINE)
    net_to_delete = m.group(2)
    args = [
        "network", "delete", "--auth_token", test_data["auth_token"],
        "--network", net_to_delete
    ]
    cmd_line = ztcc.process_command_line(args)
    auth_token, network, controller, member, url, headers = \
        ztcc.set_ctx(cmd_line)
    result = ztcc.network_command(cmd_line, url, headers, network, controller)
    assert result == 0