diff options
author | Yoshihiro Kaneko <ykaneko0929@gmail.com> | 2014-05-13 19:29:46 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-05-14 13:19:16 +0900 |
commit | 89a428b10bf2e954f136e4ab603f73aa1f7e9b69 (patch) | |
tree | 597ef7a1cb08a1bddaae088350d092e39f1cf915 | |
parent | f295487bef976e533de692c4d877e31344f6e595 (diff) |
app: 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/app/ofctl/service.py | 10 | ||||
-rw-r--r-- | ryu/app/ofctl_rest.py | 8 | ||||
-rw-r--r-- | ryu/app/rest.py | 4 | ||||
-rw-r--r-- | ryu/app/rest_firewall.py | 15 | ||||
-rw-r--r-- | ryu/app/rest_router.py | 30 | ||||
-rw-r--r-- | ryu/app/tunnel_port_updater.py | 11 |
6 files changed, 40 insertions, 38 deletions
diff --git a/ryu/app/ofctl/service.py b/ryu/app/ofctl/service.py index 415834ef..cb82d72f 100644 --- a/ryu/app/ofctl/service.py +++ b/ryu/app/ofctl/service.py @@ -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)) diff --git a/ryu/app/ofctl_rest.py b/ryu/app/ofctl_rest.py index edef9a75..51c1eefd 100644 --- a/ryu/app/ofctl_rest.py +++ b/ryu/app/ofctl_rest.py @@ -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 diff --git a/ryu/app/rest.py b/ryu/app/rest.py index bd2142fe..dd394945 100644 --- a/ryu/app/rest.py +++ b/ryu/app/rest.py @@ -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 diff --git a/ryu/app/rest_firewall.py b/ryu/app/rest_firewall.py index 3b4e3af5..01eb6e27 100644 --- a/ryu/app/rest_firewall.py +++ b/ryu/app/rest_firewall.py @@ -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 diff --git a/ryu/app/rest_router.py b/ryu/app/rest_router.py index fb1e7d6d..3a359236 100644 --- a/ryu/app/rest_router.py +++ b/ryu/app/rest_router.py @@ -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 diff --git a/ryu/app/tunnel_port_updater.py b/ryu/app/tunnel_port_updater.py index 3c1f5c8c..0e8da305 100644 --- a/ryu/app/tunnel_port_updater.py +++ b/ryu/app/tunnel_port_updater.py @@ -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) |