OSDN Git Service

refactoring...
[ti2/ti2.git] / linkpair / collect / agent / linuxbridge_agent.py
index 99a0c2d..e701525 100755 (executable)
@@ -9,6 +9,7 @@ from linkpair.collect.agent.base_agent import BaseAgent
 
 
 class LinuxBridgeAgent(BaseAgent):
+
     '''
     Linux bridge Collector Agent
     '''
@@ -86,9 +87,10 @@ class LinuxBridgeAgent(BaseAgent):
 
                         # Other bridge port
                         else:
-                            #### VLAN interface
+                            # VLAN interface
                             if self._cu.get_port_vlan_master_if(port_name) != self._cu.PORT_VLAN_UNSPECIFIED:
-                                master_if = self._cu.get_port_vlan_master_if(port_name)
+                                master_if = self._cu.get_port_vlan_master_if(
+                                    port_name)
                                 if master_if in self._port_to_br:
                                     print port_name + " " + master_if
                                     self._port_to_br[port_name] = br_src
@@ -110,10 +112,11 @@ class LinuxBridgeAgent(BaseAgent):
                                         or self._u.d_push(re.match(r'^bond\d+$', master_if)):
                                     self._cu.add_linkpair(
                                         Device(br_src, Device.BR_TYPE),
-                                        Device("Physical NW", Device.PHYNET_TYPE),
+                                        Device(
+                                            "Physical NW", Device.PHYNET_TYPE),
                                         Port(port_name, Port.DEFAULT_TYPE),
                                         Port(""))
-        
+
                             else:
                                 continue
 #                                self._cu.add_linkpair(
@@ -121,8 +124,8 @@ class LinuxBridgeAgent(BaseAgent):
 #                                    Device("INTERNAL", Device.OS_ROUTE_TYPE),
 #                                    Port(port_name),
 #                                    Port(""))
-                                ## if (phys if):
+                                # if (phys if):
+
             # bridge interface line
             #                            [interfaces]
             elif self._u.d_push(re.match(r'^\s+(\S+)$', br_line)) is not None:
@@ -145,7 +148,7 @@ class LinuxBridgeAgent(BaseAgent):
                             continue
 
                         br_dst = self._port_to_br[peer_dst]
-                        #if self._cu.exist_linkpair(br_src, br_dst, peer_src, peer_dst):
+                        # if self._cu.exist_linkpair(br_src, br_dst, peer_src, peer_dst):
                         #    continue
 
                         if peer_dst in self._port_to_br:
@@ -182,10 +185,11 @@ class LinuxBridgeAgent(BaseAgent):
 
                         # Other bridge port
                         else:
-                                
-                            #### VLAN interface
+
+                            # VLAN interface
                             if self._cu.get_port_vlan_master_if(port_name) != self._cu.PORT_VLAN_UNSPECIFIED:
-                                master_if = self._cu.get_port_vlan_master_if(port_name)
+                                master_if = self._cu.get_port_vlan_master_if(
+                                    port_name)
                                 if master_if in self._port_to_br:
                                     port_src = port_name
                                     port_dst = master_if
@@ -198,7 +202,7 @@ class LinuxBridgeAgent(BaseAgent):
                                         Port(port_src),
                                         port_dst_obj,
                                         self._formatter.VLAN_DIST_FORMAT)
-        
+
                             else:
                                 continue
 #                                self._cu.add_linkpair(
@@ -206,12 +210,12 @@ class LinuxBridgeAgent(BaseAgent):
 #                                    Device("INTERNAL", Device.OS_ROUTE_TYPE),
 #                                    Port(port_name),
 #                                    Port(""))
-                                ## if (phys if):
+                                # if (phys if):
 
 #                 if port_name not in self._port_to_br and br_name != "":
 #                     self._port_to_br[port_name] = br_name
-# 
-#                     ## for OpenStack quntum...
+#
+# for OpenStack quntum...
 #                     if self._u.d_push(re.match(r'^qvb(.+)', port_name)):
 #                         quantum_idprefix = self._u.d_pop().group(1)
 #                         if "qvo" + quantum_idprefix in self._port_to_br:
@@ -230,5 +234,4 @@ class LinuxBridgeAgent(BaseAgent):
 #                             Device("INTERNAL", Device.OS_ROUTE_TYPE),
 #                             Port(port_name),
 #                             Port(""))
-#                         #print "int: " + br_name + ": " + port_name
-
+# print "int: " + br_name + ": " + port_name