~james-page/ubuntu/saucy/openvswitch/1.12-snapshot

« back to all changes in this revision

Viewing changes to tests/test-multipath.c

  • Committer: James Page
  • Date: 2013-08-21 10:16:57 UTC
  • mfrom: (1.1.20)
  • Revision ID: james.page@canonical.com-20130821101657-3o0z0qeiv5zkwlzi
New upstream snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (c) 2010, 2012 Nicira, Inc.
 
2
 * Copyright (c) 2010, 2012, 2013 Nicira, Inc.
3
3
 *
4
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
5
 * you may not use this file except in compliance with the License.
35
35
    enum { MP_MAX_LINKS = 63 };
36
36
    struct ofpact_multipath mp;
37
37
    bool ok = true;
 
38
    char *error;
38
39
    int n;
39
40
 
40
41
    set_program_name(argv[0]);
44
45
        ovs_fatal(0, "usage: %s multipath_action", program_name);
45
46
    }
46
47
 
47
 
    multipath_parse(&mp, argv[1]);
 
48
    error = multipath_parse(&mp, argv[1]);
 
49
    if (error) {
 
50
        ovs_fatal(0, "%s", error);
 
51
    }
 
52
 
48
53
    for (n = 1; n <= MP_MAX_LINKS; n++) {
49
54
        enum { N_FLOWS = 65536 };
50
55
        double disruption, perfect, distribution;
57
62
        memset(histogram, 0, sizeof histogram);
58
63
        for (i = 0; i < N_FLOWS; i++) {
59
64
            int old_link, new_link;
 
65
            struct flow_wildcards wc;
60
66
            struct flow flow;
61
67
 
62
68
            random_bytes(&flow, sizeof flow);
63
69
            memset(flow.zeros, 0, sizeof flow.zeros);
 
70
            flow.mpls_depth = 0;
64
71
 
65
72
            mp.max_link = n - 1;
66
 
            multipath_execute(&mp, &flow);
 
73
            multipath_execute(&mp, &flow, &wc);
67
74
            old_link = flow.regs[0];
68
75
 
69
76
            mp.max_link = n;
70
 
            multipath_execute(&mp, &flow);
 
77
            multipath_execute(&mp, &flow, &wc);
71
78
            new_link = flow.regs[0];
72
79
 
73
80
            assert(old_link >= 0 && old_link < n);