Revision 202be63d

View differences:

BGPpysim/fabrex1.edgelist
1
S,		T, Weight
2
SOURCE	X1	1
3
X1		X2	1
4
X1		Y1	1
5
X2		X3	1
6
X2		Y2	1
7
X3		Y3	1
8
X3		X4	1
BGPpysim/genFABREXfig1.py
1
#!/usr/bin/python
2

  
3
import code
4
import networkx as nx
5
from collections import defaultdict
6

  
7
G = nx.DiGraph()
8

  
9
# 1-hop metric/weight
10
myedges = []
11
myedges += ('X4', 'Y3', {'weight': 1, 'type': 'transit'}),
12
myedges += ('X4', 'X3', {'weight': 1, 'type': 'transit'}),
13
myedges += ('X3', 'Y2', {'weight': 1, 'type': 'transit'}),
14
myedges += ('X3', 'X2', {'weight': 1, 'type': 'transit'}),
15
myedges += ('X2', 'Y1', {'weight': 1, 'type': 'transit'}),
16
myedges += ('X2', 'X1', {'weight': 1, 'type': 'transit'}),
17

  
18
# they were originally unlabeled
19
myedges += ('Y3', 'X3', {'weight': 1, 'type': 'transit'}),
20
myedges += ('Y2', 'X2', {'weight': 1, 'type': 'transit'}),
21
myedges += ('Y1', 'X1', {'weight': 1, 'type': 'transit'}),
22

  
23
# one link only from X1 to source, at run-time we will have
24
# to increase the weight to trigger the exponential path-exploration
25
myedges += ('X1', 'SOURCE', {'weight': 1, 'type': 'transit'}),
26

  
27
G.add_edges_from(myedges)
28

  
29
attrs = defaultdict(dict)
30
# Source export dest d
31
attrs['SOURCE']['ipNetworksToShare'] = 'd'
32
# Setting MRAI for all nodes
33
attrs['SOURCE']['mrai'] = 16
34
attrs['X1']['mrai'] = 8
35
attrs['Y1']['mrai'] = 8
36
attrs['X2']['mrai'] = 4
37
attrs['Y2']['mrai'] = 4
38
attrs['X3']['mrai'] = 2
39
attrs['Y3']['mrai'] = 2
40
attrs['X4']['mrai'] = 1
41

  
42
# Type of nodes
43
attrs['SOURCE']['type'] = 'C'
44
attrs['X1']['type'] = 'M'
45
attrs['Y1']['type'] = 'M'
46
attrs['X2']['type'] = 'M'
47
attrs['Y2']['type'] = 'M'
48
attrs['X3']['type'] = 'M'
49
attrs['Y3']['type'] = 'M'
50
attrs['X4']['type'] = 'M'
51

  
52

  
53
nx.set_node_attributes(G, attrs)
54

  
55
# G.nodes['SOURCE'].addAttribute("PrefixList"=['d'])
56

  
57
nx.write_graphml(G, 'test.graphml')
58
code.interact(local=dict(globals(), **locals()))

Also available in: Unified diff