예제 #1
0
def test_server_login_fail():
    params = BASIC_API_PARAMS
    params["password"] = "******"
    api = BroadworksAPI(**params)
    assert api is not None
    assert api.__class__.__name__ == "BroadworksAPI"
    assert api.authenticated is False
    with pytest.raises(OCIErrorResponse) as excinfo:
        api.command("SystemSoftwareVersionGetRequest")
    assert "Invalid password" in str(excinfo.value)
    assert api.authenticated is False
예제 #2
0
def test_server_login():
    api = BroadworksAPI(**BASIC_API_PARAMS)
    assert api is not None
    assert api.__class__.__name__ == "BroadworksAPI"
    assert api.authenticated is False
    response = api.command("SystemSoftwareVersionGetRequest")
    assert api.authenticated is True
    assert response is not None
    assert response.type_ == "SystemSoftwareVersionGetResponse"
예제 #3
0
def main():
    parser = argparse.ArgumentParser(
        description="Parse Broadworks OCI-P schema, build interface code", )
    parser.add_argument("--host", type=str, required=True)
    parser.add_argument("--port", type=int, default=2208)
    parser.add_argument("--username", type=str, required=True)
    parser.add_argument("--password", type=str, required=True)
    args = parser.parse_args()

    api = BroadworksAPI(
        host=args.host,
        port=args.port,
        username=args.username,
        password=args.password,
    )
    result = api.command("ServiceProviderGetListRequest")
    for thing in result.service_provider_table:
        print(thing)