@@ -142,7 +142,7 @@ def _link_nodes(self, node_one_id, node_two_id):
142142 :return: nodes, network nodes if present, and tunnel if present
143143 :rtype: tuple
144144 """
145- logger .info ("link message between node1(%s) and node2(%s)" , node_one_id , node_two_id )
145+ logger .debug ("link message between node1(%s) and node2(%s)" , node_one_id , node_two_id )
146146
147147 # values to fill
148148 net_one = None
@@ -154,7 +154,7 @@ def _link_nodes(self, node_one_id, node_two_id):
154154
155155 # both node ids are provided
156156 tunnel = self .broker .gettunnel (node_one_id , node_two_id )
157- logger .info ("tunnel between nodes: %s" , tunnel )
157+ logger .debug ("tunnel between nodes: %s" , tunnel )
158158 if nodeutils .is_node (tunnel , NodeTypes .TAP_BRIDGE ):
159159 net_one = tunnel
160160 if tunnel .remotenum == node_one_id :
@@ -182,8 +182,8 @@ def _link_nodes(self, node_one_id, node_two_id):
182182 net_two = node_two
183183 node_two = None
184184
185- logger .info ("link node types n1(%s) n2(%s) net1(%s) net2(%s) tunnel(%s)" ,
186- node_one , node_two , net_one , net_two , tunnel )
185+ logger .debug ("link node types n1(%s) n2(%s) net1(%s) net2(%s) tunnel(%s)" ,
186+ node_one , node_two , net_one , net_two , tunnel )
187187 return node_one , node_two , net_one , net_two , tunnel
188188
189189 # TODO: this doesn't appear to ever be used, EMANE or basic wireless range
@@ -198,7 +198,7 @@ def _link_wireless(self, objects, connect):
198198 objects = [x for x in objects if x ]
199199 if len (objects ) < 2 :
200200 raise ValueError ("wireless link failure: %s" , objects )
201- logger .info ("handling wireless linking objects(%) connect(%s)" , objects , connect )
201+ logger .debug ("handling wireless linking objects(%) connect(%s)" , objects , connect )
202202 common_networks = objects [0 ].commonnets (objects [1 ])
203203 if not common_networks :
204204 raise ValueError ("no common network found for wireless link/unlink" )
@@ -242,23 +242,27 @@ def add_link(self, node_one_id, node_two_id, interface_one=None, interface_two=N
242242 else :
243243 # 2 nodes being linked, ptp network
244244 if all ([node_one , node_two ]) and not net_one :
245+ logger .info ("adding link for peer to peer nodes: %s - %s" , node_one .name , node_two .name )
245246 ptp_class = nodeutils .get_node_class (NodeTypes .PEER_TO_PEER )
246247 start = self .state > EventTypes .DEFINITION_STATE .value
247248 net_one = self .add_object (cls = ptp_class , start = start )
248249
249250 # node to network
250251 if node_one and net_one :
252+ logger .info ("adding link from node to network: %s - %s" , node_one .name , net_one .name )
251253 interface = create_interface (node_one , net_one , interface_one )
252254 link_config (net_one , interface , link_options )
253255
254256 # network to node
255257 if node_two and net_one :
258+ logger .info ("adding link from network to node: %s - %s" , node_two .name , net_one .name )
256259 interface = create_interface (node_two , net_one , interface_two )
257260 if not link_options .unidirectional :
258261 link_config (net_one , interface , link_options )
259262
260263 # network to network
261264 if net_one and net_two :
265+ logger .info ("adding link from network to network: %s" , net_one .name , net_two .name )
262266 if nodeutils .is_node (net_two , NodeTypes .RJ45 ):
263267 interface = net_two .linknet (net_one )
264268 else :
@@ -282,21 +286,25 @@ def add_link(self, node_one_id, node_two_id, interface_one=None, interface_two=N
282286 # tunnel node logic
283287 key = link_options .key
284288 if key and nodeutils .is_node (net_one , NodeTypes .TUNNEL ):
289+ logger .info ("setting tunnel key for: %s" , net_one .name )
285290 net_one .setkey (key )
286291 if addresses :
287292 net_one .addrconfig (addresses )
288293 if key and nodeutils .is_node (net_two , NodeTypes .TUNNEL ):
294+ logger .info ("setting tunnel key for: %s" , net_two .name )
289295 net_two .setkey (key )
290296 if addresses :
291297 net_two .addrconfig (addresses )
292298
293299 # physical node connected with tunnel
294300 if not net_one and not net_two and (node_one or node_two ):
295301 if node_one and nodeutils .is_node (node_one , NodeTypes .PHYSICAL ):
302+ logger .info ("adding link for physical node: %s" , node_one .name )
296303 addresses = interface_one .get_addresses ()
297304 node_one .adoptnetif (tunnel , interface_one .id , interface_one .mac , addresses )
298305 link_config (node_one , tunnel , link_options )
299306 elif node_two and nodeutils .is_node (node_two , NodeTypes .PHYSICAL ):
307+ logger .info ("adding link for physical node: %s" , node_two .name )
300308 addresses = interface_two .get_addresses ()
301309 node_two .adoptnetif (tunnel , interface_two .id , interface_two .mac , addresses )
302310 link_config (node_two , tunnel , link_options )
@@ -351,11 +359,12 @@ def delete_link(self, node_one_id, node_two_id, interface_one_id, interface_two_
351359 interface_two = common_interface_two
352360 break
353361
354- logger .info ("deleting link for interfaces interface_one(%s) interface_two(%s)" ,
355- interface_one , interface_two )
356362 if all ([interface_one , interface_two ]) and any ([interface_one .net , interface_two .net ]):
357363 if interface_one .net != interface_two .net and all ([interface_one .up , interface_two .up ]):
358364 raise ValueError ("no common network found" )
365+
366+ logger .info ("deleting link node(%s):interface(%s) node(%s):interface(%s)" ,
367+ node_one .name , interface_one .name , node_two .name , interface_two .name )
359368 net_one = interface_one .net
360369 interface_one .detachnet ()
361370 interface_two .detachnet ()
@@ -488,7 +497,7 @@ def add_node(self, _type=NodeTypes.DEFAULT, _id=None, node_options=NodeOptions()
488497 name = "%s%s" % (node_class .__name__ , _id )
489498
490499 # create node
491- logger .info ("creating node(%s) id(%s) name(%s) start(%s)" , node_class , _id , name , start )
500+ logger .info ("creating node(%s) id(%s) name(%s) start(%s)" , node_class . __name__ , _id , name , start )
492501 node = self .add_object (cls = node_class , objid = _id , name = name , start = start )
493502
494503 # set node attributes
@@ -503,7 +512,6 @@ def add_node(self, _type=NodeTypes.DEFAULT, _id=None, node_options=NodeOptions()
503512 if _type in [NodeTypes .DEFAULT , NodeTypes .PHYSICAL ]:
504513 node .type = node_options .model
505514 logger .debug ("set node type: %s" , node .type )
506- logger .info ("setting model (%s) with services (%s)" , node .type , node_options .services )
507515 services = "|" .join (node_options .services ) or None
508516 self .services .addservicestonode (node , node .type , services )
509517
@@ -874,9 +882,10 @@ def shutdown(self):
874882 :return: nothing
875883 """
876884 logger .info ("shutting down all session" )
877- for session in self .sessions .values ():
878- session .shutdown ()
885+ sessions = self .sessions .copy ()
879886 self .sessions .clear ()
887+ for session in sessions .itervalues ():
888+ session .shutdown ()
880889
881890 def create_session (self , _id = None , master = True ):
882891 """
0 commit comments