Revision d08d134a

View differences:

conf/dummyrouting.ini
1
[dummyRoutingTest]
2

  
3
testModule = dummyrouting
4
testClass = dummyRoutingRandomTest
5
duration = 20
6
#graphDefinition = data/fullmesh.edges
7
graphDefinition = data/toy.edges
8

  
9
[dummyRoutingSmallTest]
10

  
11
testModule = dummyrouting
12
testClass = dummyRoutingRandomTest
13
duration = 20
14
#graphDefinition = data/fullmesh.edges
15
graphDefinition = data/small.edges
16

  
17
[dummyRoutingLargeTest]
18

  
19
testModule = dummyrouting
20
testClass = dummyRoutingRandomTest
21
duration = 60
22
#graphDefinition = data/fullmesh.edges
23
graphDefinition = data/large.edges
24

  
25
[dummyRoutingTwoNodes]
26

  
27
testModule = dummyrouting
28
testClass = dummyRoutingRandomTest
29
duration = 5
30
#graphDefinition = data/fullmesh.edges
31
graphDefinition = data/twonodes.edges
32

  
33
[dummyRoutingDebugTest]
34

  
35
testModule = dummyrouting
36
testClass = dummyRoutingRandomTest
37
duration = 60
38
#graphDefinition = data/fullmesh.edges
39
graphDefinition = data/large-debug.edges
40

  
41

  
scripts/compare_topologies_recursively.py
1
#!/usr/bin/env python
2

  
3
import sys
4
sys.path.append('../community_networks_analysis')
5

  
6
from misclibs import navigateRoutingTables
7
from gengraphs import loadGraph
8
import glob
9
import json
10
import networkx as nx
11

  
12
if len(sys.argv) != 3:
13
    print "usage: ./compare_topologies_recursively.py ",\
14
            "path_prefix full_topology"
15
    sys.exit(1)
16

  
17
pathPrefix = sys.argv[1]
18
topoFile = sys.argv[2]
19
g = loadGraph(topoFile, remap=True)
20
print g.nodes()
21

  
22
jsonRt = {}
23
nodeList = set()
24

  
25
for topoFile in glob.glob(pathPrefix+"*.rt"):
26
    try:
27
        f = open(topoFile, "r")
28
        j = json.load(f)
29
    except Exception as e:
30
        print "NOK", str(e)
31
        sys.exit(1)
32
    nodeIP = ".".join(j["node"].split(":")[0].split(".")[:3])
33
    rt = j["rt"]
34
    jsonRt[nodeIP] = {}
35
    for dest, nh in rt.items():
36
        shortDest = ".".join(dest.split(".")[:3])
37
        shortNh = ".".join(nh[0].split(".")[:3])
38
        jsonRt[nodeIP][shortDest] = [shortNh] + nh[1:]
39

  
40
    nodeList.add(str(nodeIP))
41

  
42

  
43
nl = list(nodeList)
44

  
45

  
46
#for node, rt  in jsonRt.items():
47
#    if len(rt) != len(nl) - 1:
48
#        print "node ", node, "misses some routes"
49
#        print json.dumps(jsonRt, indent=1)
50
#        sys.exit(1)
51

  
52
#print json.dumps(jsonRt, indent=1)
53
errors = 0
54
for i in range(len(nl)):
55
    for j in range(i+1, len(nl)):
56
        s = int(nl[i].split(".")[2])
57
        d = int(nl[j].split(".")[2])
58
        print "== rt ", s, d
59
        route = navigateRoutingTables(jsonRt, nl[i],
60
                nl[j], [], 0)
61
        allroutes = [p for p in nx.all_shortest_paths(g, s, d)]
62

  
63
        shortedRoute =  [int(r.split(".")[2]) for r in route[0]]
64
        print "XX", shortedRoute
65
        print "YY", allroutes
66

  
67
        if shortedRoute not in allroutes:
68
            print "NOK!: route", shortedRoute, "not in ", allroutes
69
            errors += 1
70

  
71
print "Found ", errors, "errors"
72

  
73

  
74

  
75

  
76

  
77

  
78

  
scripts/killall.sh
1
#!/bin/bash
2

  
3
for i in `ps aux | grep dummy | grep python | awk '{print $2}'`; 
4
 do sudo kill $i; 
5
done
6
for i in `ps aux | grep dummy | grep python | awk '{print $2}'`; 
7
 do sudo kill -9 $i; 
8
done
scripts/show_network.py
1
#!/usr/bin/env python
2
import sys
3
sys.path.append('../community_networks_analysis')
4
from gengraphs import loadGraph
5
from gengraphs import genGraph
6
from misclibs import showGraph
7

  
8
g = loadGraph(sys.argv[1])
9
#g = genGraph("UNIT", 200)
10
showGraph(g)

Also available in: Unified diff