10 int b[N] = { 10, 20, 30 };
12 // TODO: Allow specifying loglevel in evironment
14 // static struct option long_opts[] = {
15 // { "loglevel", 1, 0, 'l' },
22 // printf("usage: negotiation [ options ]\n");
23 // printf(" -l, --loglevel <number>|<domain>=<number>,...\n");
27 frsh_contract_t contract[N];
28 frsh_vres_id_t vres[N];
29 frsh_rel_time_t budget, period, deadline;
32 WVTEST_MAIN("basic negotiation")
36 // while ((opt = getopt_long(argc, argv, "l:", &long_opts[0], NULL)) != EOF) {
39 ul_log_domain_arg2levels("forb_proto_inet=6");
44 // exit(opt == 'h' ? 0 : 1);
48 ret = WVFRSH(frsh_init());
51 /* Negotiate N contracts */
53 ret = WVFRSH(frsh_contract_init(&contract[i]));
56 ret = WVFRSH(frsh_contract_set_resource_and_label(
58 DUMMY_RESOURCE_TYPE, DUMMY_RESOURCE_ID,
62 budget = fosa_msec_to_rel_time(b[i]);
63 period = fosa_msec_to_rel_time(100);
64 deadline = fosa_msec_to_rel_time(50);
65 ret = WVFRSH(frsh_contract_set_basic_params(&contract[i],
72 ret = WVFRSH(frsh_contract_set_timing_reqs(&contract[i],
76 ret = WVFRSH(frsh_contract_negotiate(&contract[i], &vres[i]));
81 WVTEST_MAIN("renegotiation")
83 for (i=0; i<2 /*N*/; i++) {
84 // FIXME: There is a bug on the test - the 3rd renegotiation fails
85 budget = fosa_msec_to_rel_time(2*b[i]);
86 period = fosa_msec_to_rel_time(110);
87 ret = WVFRSH(frsh_contract_set_basic_params(&contract[i],
94 ret = WVFRSH(frsh_contract_renegotiate_sync(&contract[i], vres[i]));
99 WVTEST_MAIN("cancelation")
101 /* Cancel N contracts */
102 for (i=0; i<N; i++) {
103 ret = WVFRSH(frsh_contract_cancel(vres[i]));