summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYoshihiro Kaneko <ykaneko0929@gmail.com>2014-05-13 20:46:56 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-05-14 13:20:58 +0900
commitc468fdd12675ff478636f8b803a1be1937afd404 (patch)
treedd3fc497329ecfa6e715ca93d28d664281d13b33
parent039f9a154cb7991a6cd08c3af246525d4e3d9e88 (diff)
services/protocols: fix pep8
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/services/protocols/bgp/application.py2
-rw-r--r--ryu/services/protocols/bgp/bgp_sample_conf.py4
-rw-r--r--ryu/services/protocols/bgp/operator/ssh.py14
-rw-r--r--ryu/services/protocols/vrrp/dumper.py42
-rw-r--r--ryu/services/protocols/vrrp/manager.py4
-rw-r--r--ryu/services/protocols/vrrp/monitor_linux.py2
-rw-r--r--ryu/services/protocols/vrrp/router.py8
-rw-r--r--ryu/services/protocols/vrrp/rpc_manager.py4
-rw-r--r--ryu/services/protocols/vrrp/sample_router.py40
9 files changed, 61 insertions, 59 deletions
diff --git a/ryu/services/protocols/bgp/application.py b/ryu/services/protocols/bgp/application.py
index 6737d7d6..01649263 100644
--- a/ryu/services/protocols/bgp/application.py
+++ b/ryu/services/protocols/bgp/application.py
@@ -58,7 +58,7 @@ CONF.register_opts([
cfg.StrOpt('bind-ip', default='0.0.0.0', help='rpc-bind-ip'),
cfg.StrOpt('bgp-config-file', default=DEFAULT_CONFIG_PATH,
help='bgp-config-file')
- ])
+])
@add_bgp_error_metadata(code=BIN_ERROR,
diff --git a/ryu/services/protocols/bgp/bgp_sample_conf.py b/ryu/services/protocols/bgp/bgp_sample_conf.py
index 61f203cc..cf20cce9 100644
--- a/ryu/services/protocols/bgp/bgp_sample_conf.py
+++ b/ryu/services/protocols/bgp/bgp_sample_conf.py
@@ -20,10 +20,10 @@ BGP = {
'10.0.0.1': {
'remote_as': 64513,
'multi_exit_disc': 100
- },
+ },
'10.10.0.2': {
'remote_as': 64514,
- },
+ },
},
'networks': [
diff --git a/ryu/services/protocols/bgp/operator/ssh.py b/ryu/services/protocols/bgp/operator/ssh.py
index 84858d77..ac937910 100644
--- a/ryu/services/protocols/bgp/operator/ssh.py
+++ b/ryu/services/protocols/bgp/operator/ssh.py
@@ -146,9 +146,9 @@ Hello, this is Ryu BGP speaker (version %s).
elif c == 'B':
self._lookup_hist_down()
elif c == 'C':
- self._movcursor(self.curpos+1)
+ self._movcursor(self.curpos + 1)
elif c == 'D':
- self._movcursor(self.curpos-1)
+ self._movcursor(self.curpos - 1)
else:
LOG.error("unknown CSI sequence. do nothing: %c" % c)
@@ -267,7 +267,7 @@ Hello, this is Ryu BGP speaker (version %s).
ret.append(cmpled_cmd)
continue
- if (i+1) == len(cmds):
+ if (i + 1) == len(cmds):
if is_spaced:
result, cmd = cmpleter('?')
result = result.value.replace('\n', '\n\r').rstrip()
@@ -292,7 +292,7 @@ Hello, this is Ryu BGP speaker (version %s).
else:
self._startnewline(buf='Error: Not implemented')
else:
- if (i+1) < len(cmds):
+ if (i + 1) < len(cmds):
self._startnewline(buf='Error: Ambiguous command')
else:
self._startnewline(buf=', '.join(matches))
@@ -374,13 +374,13 @@ Hello, this is Ryu BGP speaker (version %s).
self._movcursor(self.promptlen)
# <C-b>
elif c == chr(0x02):
- self._movcursor(self.curpos-1)
+ self._movcursor(self.curpos - 1)
# <C-e>
elif c == chr(0x05):
- self._movcursor(self.promptlen+len(self.buf))
+ self._movcursor(self.promptlen + len(self.buf))
# <C-f>
elif c == chr(0x06):
- self._movcursor(self.curpos+1)
+ self._movcursor(self.curpos + 1)
else:
LOG.error("unknown cursor move cmd.")
continue
diff --git a/ryu/services/protocols/vrrp/dumper.py b/ryu/services/protocols/vrrp/dumper.py
index 6f86e1ee..9bf899c4 100644
--- a/ryu/services/protocols/vrrp/dumper.py
+++ b/ryu/services/protocols/vrrp/dumper.py
@@ -45,11 +45,12 @@ class VRRPDumper(app_manager.RyuApp):
# or
#
# RFC 5795 6.4.1
- #(115)+ If the protected IPvX address is an IPv4 address, then:
+ # (115)+ If the protected IPvX address is an IPv4 address,
+ # then:
# (120) * Broadcast a gratuitous ARP request containing the
# virtual router MAC address for each IP address associated
# with the virtual router.
- #(125) + else // IPv6
+ # (125) + else // IPv6
# (130) * For each IPv6 address associated with the virtual
# router, send an unsolicited ND Neighbor Advertisement with
# the Router Flag (R) set, the Solicited Flag (S) unset, the
@@ -67,11 +68,12 @@ class VRRPDumper(app_manager.RyuApp):
# or
#
# RFC 5795 6.4.2
- #(375)+ If the protected IPvX address is an IPv4 address, then:
+ # (375)+ If the protected IPvX address is an IPv4 address,
+ # then:
# (380)* Broadcast a gratuitous ARP request on that interface
# containing the virtual router MAC address for each IPv4
# address associated with the virtual router.
- #(385) + else // ipv6
+ # (385) + else // ipv6
# (390) * Compute and join the Solicited-Node multicast
# address [RFC4291] for the IPv6 address(es) associated with
# the virtual router.
@@ -97,10 +99,10 @@ class VRRPDumper(app_manager.RyuApp):
# or
#
# RFC5798 6.4.3
- #(605) - If the protected IPvX address is an IPv4 address, then:
+ # (605) - If the protected IPvX address is an IPv4 address, then:
# (610) + MUST respond to ARP requests for the IPv4 address(es)
# associated with the virtual router.
- #(615) - else // ipv6
+ # (615) - else // ipv6
# (620) + MUST be a member of the Solicited-Node multicast
# address for the IPv6 address(es) associated with the virtual
# router.
@@ -110,13 +112,13 @@ class VRRPDumper(app_manager.RyuApp):
# router.
# (635) ++ If Accept_Mode is False: MUST NOT drop IPv6 Neighbor
# Solicitations and Neighbor Advertisements.
- #(640) +-endif // ipv4?
- #(645) - MUST forward packets with a destination link-layer MAC
- #address equal to the virtual router MAC address.
- #(650) - MUST accept packets addressed to the IPvX address(es)
- #associated with the virtual router if it is the IPvX address owner
- #or if Accept_Mode is True. Otherwise, MUST NOT accept these
- #packets.
+ # (640) +-endif // ipv4?
+ # (645) - MUST forward packets with a destination link-layer MAC
+ # address equal to the virtual router MAC address.
+ # (650) - MUST accept packets addressed to the IPvX address(es)
+ # associated with the virtual router if it is the IPvX address
+ # owner or if Accept_Mode is True. Otherwise, MUST NOT accept
+ # these packets.
elif new_state == vrrp_event.VRRP_STATE_BACKUP:
self.logger.info('becomes backup')
@@ -132,19 +134,19 @@ class VRRPDumper(app_manager.RyuApp):
# or
#
# RFC 5798 6.4.2 Backup
- #(305) - If the protected IPvX address is an IPv4 address, then:
+ # (305) - If the protected IPvX address is an IPv4 address, then:
# (310) + MUST NOT respond to ARP requests for the IPv4
# address(es) associated with the virtual router.
- #(315) - else // protected addr is IPv6
+ # (315) - else // protected addr is IPv6
# (320) + MUST NOT respond to ND Neighbor Solicitation messages
# for the IPv6 address(es) associated with the virtual router.
# (325) + MUST NOT send ND Router Advertisement messages for the
# virtual router.
- #(330) -endif // was protected addr IPv4?
- #(335) - MUST discard packets with a destination link-layer MAC
- #address equal to the virtual router MAC address.
- #(340) - MUST NOT accept packets addressed to the IPvX address(es)
- #associated with the virtual router.
+ # (330) -endif // was protected addr IPv4?
+ # (335) - MUST discard packets with a destination link-layer MAC
+ # address equal to the virtual router MAC address.
+ # (340) - MUST NOT accept packets addressed to the IPvX address(es)
+ # associated with the virtual router.
elif new_state == vrrp_event.VRRP_STATE_INITIALIZE:
if old_state is None:
self.logger.info('initialized')
diff --git a/ryu/services/protocols/vrrp/manager.py b/ryu/services/protocols/vrrp/manager.py
index 3b25c64c..40c730db 100644
--- a/ryu/services/protocols/vrrp/manager.py
+++ b/ryu/services/protocols/vrrp/manager.py
@@ -100,8 +100,8 @@ class VRRPManager(app_manager.RyuApp):
instance = VRRPInstance(name, monitor.name, config, interface)
self._instances[name] = instance
- #self.logger.debug('report_bricks')
- #app_manager.AppManager.get_instance().report_bricks() # debug
+ # self.logger.debug('report_bricks')
+ # app_manager.AppManager.get_instance().report_bricks() # debug
monitor.start()
router.start()
diff --git a/ryu/services/protocols/vrrp/monitor_linux.py b/ryu/services/protocols/vrrp/monitor_linux.py
index e3337de2..dfd5a9f6 100644
--- a/ryu/services/protocols/vrrp/monitor_linux.py
+++ b/ryu/services/protocols/vrrp/monitor_linux.py
@@ -148,7 +148,7 @@ class VRRPInterfaceMonitorNetworkDevice(monitor.VRRPInterfaceMonitor):
# unsigned char s6_addr[16]; /* IPv6 address */
# };
family = socket.IPPROTO_IPV6
- sockaddr = struct.pack('H', socket.AF_INET6)
+ sockaddr = struct.pack('H', socket.AF_INET6)
sockaddr += struct.pack('!H', 0)
sockaddr += struct.pack('!I', 0)
sockaddr += addrconv.ipv6.text_to_bin(vrrp.VRRP_IPV6_DST_ADDRESS)
diff --git a/ryu/services/protocols/vrrp/router.py b/ryu/services/protocols/vrrp/router.py
index 610a67b4..2994ca29 100644
--- a/ryu/services/protocols/vrrp/router.py
+++ b/ryu/services/protocols/vrrp/router.py
@@ -579,11 +579,11 @@ class VRRPV3StateBackup(VRRPState):
# EventStateChange(VRRP_SATE_BACKUP -> VRRP_STATE_MASTER)
#
# RFC 5795 6.4.2
- #(375) + If the protected IPvX address is an IPv4 address, then:
+ # (375) + If the protected IPvX address is an IPv4 address, then:
# (380) * Broadcast a gratuitous ARP request on that interface
# containing the virtual router MAC address for each IPv4
# address associated with the virtual router.
- #(385) + else // ipv6
+ # (385) + else // ipv6
# (390) * Compute and join the Solicited-Node multicast
# address [RFC4291] for the IPv6 address(es) associated with
# the virtual router.
@@ -684,11 +684,11 @@ class VRRPRouterV3(VRRPRouter):
# EventVRRPStateChanged(None->VRRP_STATE_MASTER)
#
# RFC 5795 6.4.1
- #(115) + If the protected IPvX address is an IPv4 address, then:
+ # (115) + If the protected IPvX address is an IPv4 address, then:
# (120) * Broadcast a gratuitous ARP request containing the
# virtual router MAC address for each IP address associated
# with the virtual router.
- #(125) + else // IPv6
+ # (125) + else // IPv6
# (130) * For each IPv6 address associated with the virtual
# router, send an unsolicited ND Neighbor Advertisement with
# the Router Flag (R) set, the Solicited Flag (S) unset, the
diff --git a/ryu/services/protocols/vrrp/rpc_manager.py b/ryu/services/protocols/vrrp/rpc_manager.py
index 7b92d2be..93426b15 100644
--- a/ryu/services/protocols/vrrp/rpc_manager.py
+++ b/ryu/services/protocols/vrrp/rpc_manager.py
@@ -83,7 +83,7 @@ class RpcVRRPManager(app_manager.RyuApp):
peer = Peer(self._rpc_events)
table = {
rpc.MessageType.REQUEST: peer._handle_vrrp_request,
- }
+ }
peer._endpoint = rpc.EndPoint(new_sock, disp_table=table)
self._peers.append(peer)
hub.spawn(self._peer_loop_thread, peer)
@@ -179,7 +179,7 @@ class RpcVRRPManager(app_manager.RyuApp):
"advertisement_interval": c.advertisement_interval,
"priority": c.priority,
"virtual_ip_address": str(netaddr.IPAddress(c.ip_addresses[0]))
- }
+ }
ret_list.append(info_dict)
return ret_list
diff --git a/ryu/services/protocols/vrrp/sample_router.py b/ryu/services/protocols/vrrp/sample_router.py
index ca834d29..d810acdd 100644
--- a/ryu/services/protocols/vrrp/sample_router.py
+++ b/ryu/services/protocols/vrrp/sample_router.py
@@ -77,11 +77,11 @@ class RouterBase(app_manager.RyuApp):
# or
#
# RFC 5795 6.4.1
- #(115)+ If the protected IPvX address is an IPv4 address, then:
+ # (115)+ If the protected IPvX address is an IPv4 address, then:
# (120) * Broadcast a gratuitous ARP request containing the
# virtual router MAC address for each IP address associated
# with the virtual router.
- #(125) + else // IPv6
+ # (125) + else // IPv6
# (130) * For each IPv6 address associated with the virtual
# router, send an unsolicited ND Neighbor Advertisement with
# the Router Flag (R) set, the Solicited Flag (S) unset, the
@@ -99,11 +99,11 @@ class RouterBase(app_manager.RyuApp):
# or
#
# RFC 5795 6.4.2
- #(375)+ If the protected IPvX address is an IPv4 address, then:
+ # (375)+ If the protected IPvX address is an IPv4 address, then:
# (380)* Broadcast a gratuitous ARP request on that interface
# containing the virtual router MAC address for each IPv4
# address associated with the virtual router.
- #(385) + else // ipv6
+ # (385) + else // ipv6
# (390) * Compute and join the Solicited-Node multicast
# address [RFC4291] for the IPv6 address(es) associated with
# the virtual router.
@@ -127,19 +127,19 @@ class RouterBase(app_manager.RyuApp):
# or
#
# RFC 5798 6.4.2 Backup
- #(305) - If the protected IPvX address is an IPv4 address, then:
+ # (305) - If the protected IPvX address is an IPv4 address, then:
# (310) + MUST NOT respond to ARP requests for the IPv4
# address(es) associated with the virtual router.
- #(315) - else // protected addr is IPv6
+ # (315) - else // protected addr is IPv6
# (320) + MUST NOT respond to ND Neighbor Solicitation messages
# for the IPv6 address(es) associated with the virtual router.
# (325) + MUST NOT send ND Router Advertisement messages for the
# virtual router.
- #(330) -endif // was protected addr IPv4?
- #(335) - MUST discard packets with a destination link-layer MAC
- #address equal to the virtual router MAC address.
- #(340) - MUST NOT accept packets addressed to the IPvX address(es)
- #associated with the virtual router.
+ # (330) -endif // was protected addr IPv4?
+ # (335) - MUST discard packets with a destination link-layer MAC
+ # address equal to the virtual router MAC address.
+ # (340) - MUST NOT accept packets addressed to the IPvX address(es)
+ # associated with the virtual router.
def _shutdowned(self):
self.logger.debug('shutdowned')
@@ -169,10 +169,10 @@ class RouterBase(app_manager.RyuApp):
# or
#
# RFC5798 6.4.3
- #(605) - If the protected IPvX address is an IPv4 address, then:
+ # (605) - If the protected IPvX address is an IPv4 address, then:
# (610) + MUST respond to ARP requests for the IPv4 address(es)
# associated with the virtual router.
- #(615) - else // ipv6
+ # (615) - else // ipv6
# (620) + MUST be a member of the Solicited-Node multicast
# address for the IPv6 address(es) associated with the virtual
# router.
@@ -182,13 +182,13 @@ class RouterBase(app_manager.RyuApp):
# router.
# (635) ++ If Accept_Mode is False: MUST NOT drop IPv6 Neighbor
# Solicitations and Neighbor Advertisements.
- #(640) +-endif // ipv4?
- #(645) - MUST forward packets with a destination link-layer MAC
- #address equal to the virtual router MAC address.
- #(650) - MUST accept packets addressed to the IPvX address(es)
- #associated with the virtual router if it is the IPvX address owner
- #or if Accept_Mode is True. Otherwise, MUST NOT accept these
- #packets.
+ # (640) +-endif // ipv4?
+ # (645) - MUST forward packets with a destination link-layer MAC
+ # address equal to the virtual router MAC address.
+ # (650) - MUST accept packets addressed to the IPvX address(es)
+ # associated with the virtual router if it is the IPvX address
+ # owner or if Accept_Mode is True. Otherwise, MUST NOT accept
+ # these packets.
elif new_state == vrrp_event.VRRP_STATE_BACKUP:
self._become_backup()