app: 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:
Yoshihiro Kaneko 2014-05-13 19:29:46 +09:00 committed by FUJITA Tomonori
parent f295487bef
commit 89a428b10b
6 changed files with 40 additions and 38 deletions

View File

@ -107,7 +107,7 @@ class OfctlService(app_manager.RyuApp):
@set_ev_cls(event.SendMsgRequest, MAIN_DISPATCHER)
def _handle_send_msg(self, req):
if not req.reply_cls is None:
if req.reply_cls is not None:
self._observe_msg(req.reply_cls)
msg = req.msg
@ -119,9 +119,9 @@ class OfctlService(app_manager.RyuApp):
barrier_xid = barrier.xid
si = self._switches[datapath.id]
assert not xid in si.results
assert not xid in si.xids
assert not barrier_xid in si.barriers
assert xid not in si.results
assert xid not in si.xids
assert barrier_xid not in si.barriers
si.results[xid] = []
si.xids[xid] = req
si.barriers[barrier_xid] = xid
@ -145,7 +145,7 @@ class OfctlService(app_manager.RyuApp):
return
result = si.results.pop(xid)
req = si.xids.pop(xid)
if not req.reply_cls is None:
if req.reply_cls is not None:
self._unobserve_msg(req.reply_cls)
if any(self._is_error(r) for r in result):
rep = event.Reply(exception=exception.OFError(result=result))

View File

@ -36,7 +36,8 @@ LOG = logging.getLogger('ryu.app.ofctl_rest')
# REST API
#
## Retrieve the switch stats
# Retrieve the switch stats
#
# get the list of all switches
# GET /stats/switches
@ -67,9 +68,8 @@ LOG = logging.getLogger('ryu.app.ofctl_rest')
#
# get groups stats of the switch
# GET /stats/group/<dpid>
#
#
## Update the switch stats
# Update the switch stats
#
# add a flow entry
# POST /stats/flowentry/add

View File

@ -34,8 +34,8 @@ from ryu.exception import PortNotFound, PortAlreadyExist
from ryu.lib import dpid as dpid_lib
from ryu.lib import mac as mac_lib
## TODO:XXX
## define db interface and store those information into db
# TODO:XXX
# define db interface and store those information into db
# REST API

View File

@ -42,16 +42,17 @@ from ryu.ofproto import ofproto_v1_3
from ryu.ofproto import ofproto_v1_3_parser
#=============================
# =============================
# REST API
#=============================
# =============================
#
# Note: specify switch and vlan group, as follows.
# {switch-id} : 'all' or switchID
# {vlan-id} : 'all' or vlanID
#
#
## about Firewall status
# about Firewall status
#
# get status of all firewall switches
# GET /firewall/module/status
@ -62,8 +63,8 @@ from ryu.ofproto import ofproto_v1_3_parser
# set disable the firewall switches
# PUT /firewall/module/disable/{switch-id}
#
#
## about Firewall logs
# about Firewall logs
#
# get log status of all firewall switches
# GET /firewall/log/status
@ -74,8 +75,8 @@ from ryu.ofproto import ofproto_v1_3_parser
# set log disable the firewall switches
# PUT /firewall/log/disable/{switch-id}
#
#
## about Firewall rules
# about Firewall rules
#
# get rules of the firewall switches
# * for no vlan

View File

@ -49,16 +49,16 @@ from ryu.ofproto import ofproto_v1_2
from ryu.ofproto import ofproto_v1_3
#=============================
# =============================
# REST API
#=============================
# =============================
#
# Note: specify switch and vlan group, as follows.
# {switch_id} : 'all' or switchID
# {vlan_id} : 'all' or vlanID
#
#
## 1. get address data and routing data.
# 1. get address data and routing data.
#
# * get data of no vlan
# GET /router/{switch_id}
@ -66,8 +66,8 @@ from ryu.ofproto import ofproto_v1_3
# * get data of specific vlan group
# GET /router/{switch_id}/{vlan_id}
#
#
## 2. set address data or routing data.
# 2. set address data or routing data.
#
# * set data of no vlan
# POST /router/{switch_id}
@ -82,8 +82,8 @@ from ryu.ofproto import ofproto_v1_3
# case2-2: set default route.
# parameter = {"gateway": "E.F.G.H"}
#
#
## 3. delete address data or routing data.
# 3. delete address data or routing data.
#
# * delete data of no vlan
# DELETE /router/{switch_id}
@ -297,7 +297,7 @@ class RestRouterAPI(app_manager.RyuApp):
def stats_reply_handler_v1_2(self, ev):
self._stats_reply_handler(ev)
#TODO: Update routing table when port status is changed.
# TODO: Update routing table when port status is changed.
# REST command template
@ -562,8 +562,8 @@ class Router(dict):
def packet_in_handler(self, msg):
pkt = packet.Packet(msg.data)
#TODO: Packet library convert to string
#self.logger.debug('Packet in = %s', str(pkt), self.sw_id)
# TODO: Packet library convert to string
# self.logger.debug('Packet in = %s', str(pkt), self.sw_id)
header_list = dict((p.protocol_name, p)
for p in pkt.protocols if type(p) != str)
if header_list:
@ -1562,10 +1562,10 @@ class OfCtl(object):
actions = [self.dp.ofproto_parser.OFPActionOutput(output, 0)]
self.dp.send_packet_out(buffer_id=UINT32_MAX, in_port=in_port,
actions=actions, data=data)
#TODO: Packet library convert to string
#if data_str is None:
# data_str = str(packet.Packet(data))
#self.logger.debug('Packet out = %s', data_str, extra=self.sw_id)
# TODO: Packet library convert to string
# if data_str is None:
# data_str = str(packet.Packet(data))
# self.logger.debug('Packet out = %s', data_str, extra=self.sw_id)
def set_normal_flow(self, cookie, priority):
out_port = self.dp.ofproto.OFPP_NORMAL

View File

@ -245,11 +245,12 @@ class TunnelDP(object):
# serialize requests to this OVS DP
_RequestUpdateRemote = collections.namedtuple('_RequestUpdateRemote',
('remote_dpid', 'remote_ip'))
_RequestAddTunnelPort = collections.namedtuple('_RequestAddTunnelPort',
('remote_dpid', 'remote_ip'))
_RequestAddTunnelPort = collections.namedtuple('_RequestAddTunnelPort',
('remote_dpid',
'remote_ip'))
_RequestDelTunnelPort = collections.namedtuple('_RequestDelTunnelPort',
('remote_ip'))
('remote_ip'))
class _RequestClose(object):
pass
@ -325,8 +326,8 @@ class TunnelDPSet(dict):
pass
#import collections
#class TunnelRequests(collections.defaultdict(set)):
# import collections
# class TunnelRequests(collections.defaultdict(set)):
class TunnelRequests(dict):
def add(self, dpid0, dpid1):
self.setdefault(dpid0, set()).add(dpid1)