Lines Matching refs:self
59 def __init__(self, intBW=0, extBW=0, intLatency=0, extLatency=0):
68 self.nodes = []
69 self.router = None # created in makeTopology
70 self.intBW = intBW
71 self.extBW = extBW
72 self.intLatency = intLatency
73 self.extLatency = extLatency
75 def add(self, node):
76 self.nodes.append(node)
78 def makeTopology(self, options, network, IntLink, ExtLink, Router):
83 self.router = Router(router_id=self.num_routers())
84 network.routers.append(self.router)
86 for node in self.nodes:
92 link_out = IntLink(link_id=self.num_int_links(), src_node=self.router,
94 link_in = IntLink(link_id=self.num_int_links(), src_node=node.router,
95 dst_node=self.router)
103 elif self.intBW:
104 link_out.bandwidth_factor = self.intBW
105 link_in.bandwidth_factor = self.intBW
110 elif self.intLatency:
111 link_out.latency = self.intLatency
112 link_in.latency = self.intLatency
119 link = ExtLink(link_id=self.num_ext_links(), ext_node=node,
120 int_node=self.router)
122 if self.intBW:
123 link.bandwidth_factor = self.intBW
124 if self.intLatency:
125 link.latency = self.intLatency
129 def __len__(self):
130 return len([i for i in self.nodes if type(i) != Cluster]) + \
131 sum([len(i) for i in self.nodes if type(i) == Cluster])