diff --git a/ryu/app/rest_qos.py b/ryu/app/rest_qos.py index c5bac29a..ee3d45f4 100644 --- a/ryu/app/rest_qos.py +++ b/ryu/app/rest_qos.py @@ -1147,13 +1147,13 @@ class Action(object): if REST_ACTION in flow: actions = [] for act in flow[REST_ACTION]: - field_value = re.search('SET_FIELD: \{ip_dscp:(\d+)', act) + field_value = re.search(r'SET_FIELD: \{ip_dscp:(\d+)', act) if field_value: actions.append({REST_ACTION_MARK: field_value.group(1)}) - meter_value = re.search('METER:(\d+)', act) + meter_value = re.search(r'METER:(\d+)', act) if meter_value: actions.append({REST_ACTION_METER: meter_value.group(1)}) - queue_value = re.search('SET_QUEUE:(\d+)', act) + queue_value = re.search(r'SET_QUEUE:(\d+)', act) if queue_value: actions.append({REST_ACTION_QUEUE: queue_value.group(1)}) action = {REST_ACTION: actions} diff --git a/ryu/lib/ofctl_string.py b/ryu/lib/ofctl_string.py index 30394c65..fe0eeaea 100644 --- a/ryu/lib/ofctl_string.py +++ b/ryu/lib/ofctl_string.py @@ -39,7 +39,7 @@ def ofp_instruction_from_str(ofproto, action_str): action_str An action string. =========== ================================================= """ - action_re = re.compile("([a-z_]+)(\([^)]*\)|[^a-z_,()][^,()]*)*") + action_re = re.compile(r"([a-z_]+)(\([^)]*\)|[^a-z_,()][^,()]*)*") result = [] while len(action_str): m = action_re.match(action_str) @@ -303,7 +303,7 @@ class OfctlActionConverter(object): if k == 'table': recirc_table = str_to_int(v) elif k == 'zone': - m = re.search('\[(\d*)\.\.(\d*)\]', v) + m = re.search(r'\[(\d*)\.\.(\d*)\]', v) if m: zone_ofs_nbits = nicira_ext.ofs_nbits( int(m.group(1)), int(m.group(2))) diff --git a/ryu/lib/ovs/vsctl.py b/ryu/lib/ovs/vsctl.py index f3355a1c..53ee7f42 100644 --- a/ryu/lib/ovs/vsctl.py +++ b/ryu/lib/ovs/vsctl.py @@ -66,12 +66,12 @@ def valid_ovsdb_addr(addr): :return: True if valid, otherwise False. """ # Assumes Unix socket format: "unix:file" - m = re.match('unix:(\S+)', addr) + m = re.match(r'unix:(\S+)', addr) if m: file = m.group(1) return os.path.isfile(file) # Assumes TCP/SSL socket format: "tcp:ip:port" or "ssl:ip:port" - m = re.match('(tcp|ssl):(\S+):(\d+)', addr) + m = re.match(r'(tcp|ssl):(\S+):(\d+)', addr) if m: address = m.group(2) port = m.group(3) diff --git a/ryu/lib/packet/bmp.py b/ryu/lib/packet/bmp.py index bc49c577..0b4c3b84 100644 --- a/ryu/lib/packet/bmp.py +++ b/ryu/lib/packet/bmp.py @@ -69,7 +69,7 @@ BMP_PEER_DOWN_REASON_REMOTE_NO_NOTIFICATION = 4 class BMPMessage(packet_base.PacketBase, TypeDisp): - """Base class for BGP Monitoring Protocol messages. + r"""Base class for BGP Monitoring Protocol messages. An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte @@ -141,7 +141,7 @@ class BMPMessage(packet_base.PacketBase, TypeDisp): class BMPPeerMessage(BMPMessage): - """BMP Message with Per Peer Header + r"""BMP Message with Per Peer Header Following BMP Messages contain Per Peer Header after Common BMP Header. @@ -250,7 +250,7 @@ class BMPPeerMessage(BMPMessage): @BMPMessage.register_type(BMP_MSG_ROUTE_MONITORING) class BMPRouteMonitoring(BMPPeerMessage): - """BMP Route Monitoring Message + r"""BMP Route Monitoring Message ========================== =============================================== Attribute Description @@ -308,7 +308,7 @@ class BMPRouteMonitoring(BMPPeerMessage): @BMPMessage.register_type(BMP_MSG_STATISTICS_REPORT) class BMPStatisticsReport(BMPPeerMessage): - """BMP Statistics Report Message + r"""BMP Statistics Report Message ========================== =============================================== Attribute Description @@ -424,7 +424,7 @@ class BMPStatisticsReport(BMPPeerMessage): @BMPMessage.register_type(BMP_MSG_PEER_DOWN_NOTIFICATION) class BMPPeerDownNotification(BMPPeerMessage): - """BMP Peer Down Notification Message + r"""BMP Peer Down Notification Message ========================== =============================================== Attribute Description @@ -498,7 +498,7 @@ class BMPPeerDownNotification(BMPPeerMessage): @BMPMessage.register_type(BMP_MSG_PEER_UP_NOTIFICATION) class BMPPeerUpNotification(BMPPeerMessage): - """BMP Peer Up Notification Message + r"""BMP Peer Up Notification Message ========================== =============================================== Attribute Description @@ -605,7 +605,7 @@ class BMPPeerUpNotification(BMPPeerMessage): @BMPMessage.register_type(BMP_MSG_INITIATION) class BMPInitiation(BMPMessage): - """BMP Initiation Message + r"""BMP Initiation Message ========================== =============================================== Attribute Description @@ -669,7 +669,7 @@ class BMPInitiation(BMPMessage): @BMPMessage.register_type(BMP_MSG_TERMINATION) class BMPTermination(BMPMessage): - """BMP Termination Message + r"""BMP Termination Message ========================== =============================================== Attribute Description diff --git a/ryu/lib/packet/icmpv6.py b/ryu/lib/packet/icmpv6.py index 00b883bf..a391c087 100644 --- a/ryu/lib/packet/icmpv6.py +++ b/ryu/lib/packet/icmpv6.py @@ -75,7 +75,7 @@ BLOCK_OLD_SOURCES = 6 class icmpv6(packet_base.PacketBase): - """ICMPv6 (RFC 2463) header encoder/decoder class. + r"""ICMPv6 (RFC 2463) header encoder/decoder class. An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte order. @@ -553,7 +553,7 @@ class nd_option_tla(nd_option_la): @nd_router_advert.register_nd_option_type class nd_option_pi(nd_option): - """ICMPv6 sub encoder/decoder class for Neighbor discovery + r"""ICMPv6 sub encoder/decoder class for Neighbor discovery Prefix Information Option. (RFC 4861) This is used with ryu.lib.packet.icmpv6.nd_router_advert. @@ -884,7 +884,7 @@ class mldv2_report(mld): class mldv2_report_group(stringify.StringifyMixin): - """ + r""" ICMPv6 sub encoder/decoder class for MLD v2 Lister Report Group Record messages. (RFC 3810) diff --git a/ryu/lib/packet/igmp.py b/ryu/lib/packet/igmp.py index 8935da3b..d4c9552c 100644 --- a/ryu/lib/packet/igmp.py +++ b/ryu/lib/packet/igmp.py @@ -391,7 +391,7 @@ class igmpv3_report(igmp): class igmpv3_report_group(stringify.StringifyMixin): - """ + r""" Internet Group Management Protocol(IGMP, RFC 3376) Membership Report Group Record message encoder/decoder class. diff --git a/ryu/lib/packet/ipv6.py b/ryu/lib/packet/ipv6.py index 007dc564..6ceaced3 100644 --- a/ryu/lib/packet/ipv6.py +++ b/ryu/lib/packet/ipv6.py @@ -274,7 +274,7 @@ class dst_opts(opt_header): class option(stringify.StringifyMixin): - """IPv6 (RFC 2460) Options header encoder/decoder class. + r"""IPv6 (RFC 2460) Options header encoder/decoder class. This is used with ryu.lib.packet.ipv6.hop_opts or ryu.lib.packet.ipv6.dst_opts. @@ -496,7 +496,7 @@ class routing_type3(header): @ipv6.register_header_type(inet.IPPROTO_FRAGMENT) class fragment(header): - """IPv6 (RFC 2460) fragment header encoder/decoder class. + r"""IPv6 (RFC 2460) fragment header encoder/decoder class. This is used with ryu.lib.packet.ipv6.ipv6. diff --git a/ryu/lib/stringify.py b/ryu/lib/stringify.py index 94ffbbcb..e178408b 100644 --- a/ryu/lib/stringify.py +++ b/ryu/lib/stringify.py @@ -327,7 +327,7 @@ class StringifyMixin(object): @classmethod def from_jsondict(cls, dict_, decode_string=base64.b64decode, **additional_args): - """Create an instance from a JSON style dict. + r"""Create an instance from a JSON style dict. Instantiate this class with parameters specified by the dict. diff --git a/ryu/ofproto/nicira_ext.py b/ryu/ofproto/nicira_ext.py index 73297cfb..9ac673a3 100644 --- a/ryu/ofproto/nicira_ext.py +++ b/ryu/ofproto/nicira_ext.py @@ -298,7 +298,7 @@ NXM_IP_FRAG_NOT_LATER = (0, FLOW_NW_FRAG_LATER) def ofs_nbits(start, end): - """ + r""" The utility method for ofs_nbits This method is used in the class to set the ofs_nbits. diff --git a/ryu/ofproto/nx_actions.py b/ryu/ofproto/nx_actions.py index ae5c48f4..5fe0d545 100644 --- a/ryu/ofproto/nx_actions.py +++ b/ryu/ofproto/nx_actions.py @@ -248,7 +248,7 @@ def generate(ofp_name, ofpp_name): # For OpenFlow1.0 only class NXActionSetQueue(NXAction): - """ + r""" Set queue action This action sets the queue that should be used to queue @@ -338,7 +338,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionRegLoad(NXAction): - """ + r""" Load literal value action This action loads a literal value into a field or part of a field. @@ -405,7 +405,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionRegLoad2(NXAction): - """ + r""" Load literal value action This action loads a literal value into a field or part of a field. @@ -474,7 +474,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionNote(NXAction): - """ + r""" Note action This action does nothing at all. @@ -553,7 +553,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionSetTunnel(_NXActionSetTunnelBase): - """ + r""" Set Tunnel action This action sets the identifier (such as GRE) to the specified id. @@ -600,7 +600,7 @@ def generate(ofp_name, ofpp_name): _fmt_str = '!2xI' class NXActionSetTunnel64(_NXActionSetTunnelBase): - """ + r""" Set Tunnel action This action outputs to a port that encapsulates @@ -648,7 +648,7 @@ def generate(ofp_name, ofpp_name): _fmt_str = '!6xQ' class NXActionRegMove(NXAction): - """ + r""" Move register action This action copies the src to dst. @@ -737,7 +737,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionResubmit(NXAction): - """ + r""" Resubmit action This action searches one of the switch's flow tables. @@ -786,7 +786,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionResubmitTable(NXAction): - """ + r""" Resubmit action This action searches one of the switch's flow tables. @@ -840,7 +840,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionOutputReg(NXAction): - """ + r""" Add output action This action outputs the packet to the OpenFlow port number read from @@ -914,7 +914,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionOutputReg2(NXAction): - """ + r""" Add output action This action outputs the packet to the OpenFlow port number read from @@ -996,7 +996,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionLearn(NXAction): - """ + r""" Adds or modifies flow action This action adds or modifies a flow in OpenFlow table. @@ -1260,7 +1260,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionController(NXAction): - """ + r""" Send packet in message action This action sends the packet to the OpenFlow controller as @@ -1325,7 +1325,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionController2(NXAction): - """ + r""" Send packet in message action This action sends the packet to the OpenFlow controller as @@ -1571,7 +1571,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionDecTtlCntIds(NXAction): - """ + r""" Decrement TTL action This action decrements TTL of IPv4 packet or @@ -1682,7 +1682,7 @@ def generate(ofp_name, ofpp_name): # For OpenFlow1.0 only class NXActionPushMpls(NXActionMplsBase): - """ + r""" Push MPLS action This action pushes a new MPLS header to the packet. @@ -1717,7 +1717,7 @@ def generate(ofp_name, ofpp_name): # For OpenFlow1.0 only class NXActionPopMpls(NXActionMplsBase): - """ + r""" Pop MPLS action This action pops the MPLS header from the packet. @@ -1752,7 +1752,7 @@ def generate(ofp_name, ofpp_name): # For OpenFlow1.0 only class NXActionSetMplsTtl(NXAction): - """ + r""" Set MPLS TTL action This action sets the MPLS TTL. @@ -1851,7 +1851,7 @@ def generate(ofp_name, ofpp_name): # For OpenFlow1.0 only class NXActionSetMplsLabel(NXAction): - """ + r""" Set MPLS Lavel action This action sets the MPLS Label. @@ -1906,7 +1906,7 @@ def generate(ofp_name, ofpp_name): # For OpenFlow1.0 only class NXActionSetMplsTc(NXAction): - """ + r""" Set MPLS Tc action This action sets the MPLS Tc. @@ -2000,7 +2000,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionStackPush(NXActionStackBase): - """ + r""" Push field action This action pushes field to top of the stack. @@ -2032,7 +2032,7 @@ def generate(ofp_name, ofpp_name): _subtype = nicira_ext.NXAST_STACK_PUSH class NXActionStackPop(NXActionStackBase): - """ + r""" Pop field action This action pops field from top of the stack. @@ -2064,7 +2064,7 @@ def generate(ofp_name, ofpp_name): _subtype = nicira_ext.NXAST_STACK_POP class NXActionSample(NXAction): - """ + r""" Sample packets action This action samples packets and sends one sample for @@ -2137,7 +2137,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionSample2(NXAction): - """ + r""" Sample packets action This action samples packets and sends one sample for @@ -2218,7 +2218,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionFinTimeout(NXAction): - """ + r""" Change TCP timeout action This action changes the idle timeout or hard timeout or @@ -2279,7 +2279,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionConjunction(NXAction): - """ + r""" Conjunctive matches action This action ties groups of individual OpenFlow flows into @@ -2342,7 +2342,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionMultipath(NXAction): - """ + r""" Select multipath link action This action selects multipath link based on the specified parameters. @@ -2528,7 +2528,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionBundle(_NXActionBundleBase): - """ + r""" Select bundle link action This action selects bundle link based on the specified parameters. @@ -2581,7 +2581,7 @@ def generate(ofp_name, ofpp_name): ofs_nbits=0, dst=0, slaves=slaves) class NXActionBundleLoad(_NXActionBundleBase): - """ + r""" Select bundle link action This action has the same behavior as the bundle action, @@ -2642,7 +2642,7 @@ def generate(ofp_name, ofpp_name): ofs_nbits, dst, slaves) class NXActionCT(NXAction): - """ + r""" Pass traffic to the connection tracker action This action sends the packet through the connection tracker. @@ -2804,7 +2804,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionNAT(NXAction): - """ + r""" Network address translation action This action sends the packet through the connection tracker. @@ -2967,7 +2967,7 @@ def generate(ofp_name, ofpp_name): return data class NXActionOutputTrunc(NXAction): - """ + r""" Truncate output action This action truncate a packet into the specified size and outputs it. diff --git a/ryu/tests/integrated/test_vrrp_linux_multi.py b/ryu/tests/integrated/test_vrrp_linux_multi.py index dca70c47..ac5c3252 100644 --- a/ryu/tests/integrated/test_vrrp_linux_multi.py +++ b/ryu/tests/integrated/test_vrrp_linux_multi.py @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -""" +r""" Usage: PYTHONPATH=. ./bin/ryu-manager --verbose \ ryu.services.protocols.vrrp.dumper \ diff --git a/ryu/tests/integrated/test_vrrp_multi.py b/ryu/tests/integrated/test_vrrp_multi.py index 6aee6395..a26d949a 100644 --- a/ryu/tests/integrated/test_vrrp_multi.py +++ b/ryu/tests/integrated/test_vrrp_multi.py @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -""" +r""" Usage: PYTHONPATH=. ./bin/ryu-manager --verbose \ ryu.topology.switches \ diff --git a/ryu/tests/packet_data_generator3/gen.py b/ryu/tests/packet_data_generator3/gen.py index dca45cf9..7f2fbeef 100644 --- a/ryu/tests/packet_data_generator3/gen.py +++ b/ryu/tests/packet_data_generator3/gen.py @@ -319,7 +319,7 @@ if __name__ == '__main__': stdout=subprocess.PIPE) has_names = False try: - ver_tuple = re.search('\s(\d+)\.(\d+)(\.\d*|\s*$)', + ver_tuple = re.search(r'\s(\d+)\.(\d+)(\.\d*|\s*$)', ovs_version.stdout.readline().decode()).groups() if int(ver_tuple[0]) > 2 or \ int(ver_tuple[0]) == 2 and int(ver_tuple[1]) >= 8: