services/protocols: fix pep8
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
039f9a154c
commit
c468fdd126
@ -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,
|
||||
|
@ -20,10 +20,10 @@ BGP = {
|
||||
'10.0.0.1': {
|
||||
'remote_as': 64513,
|
||||
'multi_exit_disc': 100
|
||||
},
|
||||
},
|
||||
'10.10.0.2': {
|
||||
'remote_as': 64514,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
'networks': [
|
||||
|
@ -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
|
||||
|
@ -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')
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user