Skip to content
This repository was archived by the owner on Apr 22, 2024. It is now read-only.

Commit 473f5c5

Browse files
committed
Making small fixes
- Removed ignore D301 from setup.cfg - Fixing D301 warnings - Fixing list of itens in pyof/v0x04/common/table_feature.py
1 parent a5f55dc commit 473f5c5

9 files changed

Lines changed: 101 additions & 81 deletions

File tree

docs/conf.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,3 +389,47 @@
389389
# Order methods before attributes/properties on a class
390390
autodoc_member_order = 'groupwise'
391391
todo_include_todos = True
392+
393+
rst_epilog = """
394+
.. |PacketInReason_v0x04| replace::
395+
:class:`~pyof.v0x04.asynchronous.packet_in.PacketInReason`
396+
397+
.. |PortReason_v0x04| replace::
398+
:class:`~pyof.v0x04.asynchronous.port_status.PortReason`
399+
400+
.. |FlowRemoved_v0x04| replace::
401+
:class:`~pyof.v0x04.asynchronous.flow_removed.FlowRemoved`
402+
403+
.. |TableFeaturePropType_v0x04| replace::
404+
:class:`~pyof.v0x04.controller2switch.common.TableFeaturePropType`
405+
406+
.. |ListOfInstruction_v0x04| replace::
407+
:class:`~pyof.v0x04.common.flow_instructions.ListOfInstruction`
408+
409+
.. |GroupType_v0x04| replace::
410+
:class:`~pyof.v0x04.controller2switch.group_mod.GroupType`
411+
412+
.. |ListOfBuckets_v0x04| replace::
413+
:class:`~pyof.v0x04.controller2switch.group_mod.ListOfBuckets`
414+
415+
.. |MeterFlags_v0x04| replace::
416+
:class:`~pyof.v0x04.controller2switch.meter_mod.MeterFlags`
417+
418+
.. |Meter_v0x04| replace::
419+
:class:`~pyof.v0x04.controller2switch.meter_mod.Meter`
420+
421+
.. |MeterBandType_v0x04| replace::
422+
:class:`~pyof.v0x04.controller2switch.meter_mod.MeterBandType`
423+
424+
.. |BandStats_v0x04| replace::
425+
:class:`~.v0x04.controller2switch.multipart_reply.BandStats`
426+
427+
.. |ListOfActions_v0x04| replace::
428+
:class:`~pyof.v0x04.common.action.ListOfActions`
429+
430+
.. |ListOfOxmHeader_v0x04| replace::
431+
:class:`~pyof.v0x04.common.flow_match.ListOfOxmHeader`
432+
433+
.. |Property_v0x04| replace::
434+
:class:`~pyof.v0x04.controller2switch.common.Property`
435+
"""

pyof/v0x04/common/flow_match.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515

1616
__all__ = ('Ipv6ExtHdrFlags', 'Match', 'MatchField', 'MatchType',
17-
'OxmExperimenterHeader', 'OxmOfbMatchField', 'VlanId')
17+
'OxmExperimenterHeader', 'OxmOfbMatchField', 'VlanId',
18+
'ListOfOxmHeader')
1819

1920

2021
class Ipv6ExtHdrFlags(Enum):

pyof/v0x04/common/table_feature.py

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __init__(self, property_type=None):
8989
"""Constructor of Generic Instruction receives the parameters bellow.
9090
9191
Args:
92-
type(~pyof.v0x04.controller2switch.common.TableFeaturePropType):
92+
type(|TableFeaturePropType_v0x04|):
9393
Property Type value of this instance.
9494
"""
9595
super().__init__()
@@ -134,8 +134,8 @@ class InstructionsProperty(Property):
134134
"""Instructions property.
135135
136136
This class represents Property with the following types:
137-
OFPTFPT_INSTRUCTIONS
138-
OFPTFPT_INSTRUCTIONS_MISS
137+
- OFPTFPT_INSTRUCTIONS
138+
- OFPTFPT_INSTRUCTIONS_MISS
139139
"""
140140

141141
instruction_ids = ListOfInstruction()
@@ -145,9 +145,9 @@ def __init__(self, property_type=TableFeaturePropType.OFPTFPT_INSTRUCTIONS,
145145
"""Constructor of NextTablesProperty receives the parameters bellow.
146146
147147
Args:
148-
type(~pyof.v0x04.controller2switch.common.TableFeaturePropType):
148+
type(|TableFeaturePropType_v0x04|):
149149
Property Type value of this instance.
150-
next_table_ids(:class:`ListOfInstruction`):
150+
next_table_ids(|ListOfInstruction_v0x04|):
151151
List of InstructionGotoTable instances.
152152
"""
153153
super().__init__(property_type=property_type)
@@ -159,8 +159,8 @@ class NextTablesProperty(Property):
159159
"""Next Tables Property.
160160
161161
This class represents Property with the following types:
162-
OFPTFPT_NEXT_TABLES
163-
OFPTFPT_NEXT_TABLES_MISS
162+
- OFPTFPT_NEXT_TABLES
163+
- OFPTFPT_NEXT_TABLES_MISS
164164
"""
165165

166166
next_table_ids = ListOfInstruction()
@@ -170,10 +170,9 @@ def __init__(self, property_type=TableFeaturePropType.OFPTFPT_NEXT_TABLES,
170170
"""Constructor of NextTablesProperty receives the parameters bellow.
171171
172172
Args:
173-
type(~pyof.v0x04.controller2switch.common.TableFeaturePropType):
173+
type(|TableFeaturePropType_v0x04|):
174174
Property Type value of this instance.
175-
next_table_ids \
176-
(:class:`~pyof.v0x04.common.flow_instructions.ListOfInstruction`):
175+
next_table_ids (|ListOfInstruction_v0x04|):
177176
List of InstructionGotoTable instances.
178177
"""
179178
super().__init__(property_type)
@@ -185,10 +184,10 @@ class ActionsProperty(Property):
185184
"""Actions Property.
186185
187186
This class represents Property with the following type:
188-
OFPTFPT_WRITE_ACTIONS
189-
OFPTFPT_WRITE_ACTIONS_MISS
190-
OFPTFPT_APPLY_ACTIONS
191-
OFPTFPT_APPLY_ACTIONS_MISS
187+
- OFPTFPT_WRITE_ACTIONS
188+
- OFPTFPT_WRITE_ACTIONS_MISS
189+
- OFPTFPT_APPLY_ACTIONS
190+
- OFPTFPT_APPLY_ACTIONS_MISS
192191
"""
193192

194193
action_ids = ListOfActions()
@@ -199,10 +198,10 @@ def __init__(self,
199198
"""Constructor of ActionsProperty receives the parameters bellow.
200199
201200
Args:
202-
type(~pyof.v0x04.controller2switch.common.TableFeaturePropType):
201+
type(|TableFeaturePropType_v0x04|):
203202
Property Type value of this instance.
204-
action_ids(:class:`~pyof.v0x04.common.ListOfActions`): List of
205-
Action instances.
203+
action_ids(|ListOfActions_v0x04|):
204+
List of Action instances.
206205
"""
207206
super().__init__(property_type)
208207
self.action_ids = action_ids if action_ids else ListOfActions()
@@ -213,12 +212,12 @@ class OxmProperty(Property):
213212
""""Match, Wildcard or Set-Field property.
214213
215214
This class represents Property with the following types:
216-
OFPTFPT_MATCH
217-
OFPTFPT_WILDCARDS
218-
OFPTFPT_WRITE_SETFIELD
219-
OFPTFPT_WRITE_SETFIELD_MISS
220-
OFPTFPT_APPLY_SETFIELD
221-
OFPTFPT_APPLY_SETFIELD_MISS
215+
- OFPTFPT_MATCH
216+
- OFPTFPT_WILDCARDS
217+
- OFPTFPT_WRITE_SETFIELD
218+
- OFPTFPT_WRITE_SETFIELD_MISS
219+
- OFPTFPT_APPLY_SETFIELD
220+
- OFPTFPT_APPLY_SETFIELD_MISS
222221
"""
223222

224223
oxm_ids = ListOfOxmHeader()
@@ -228,9 +227,9 @@ def __init__(self, property_type=TableFeaturePropType.OFPTFPT_MATCH,
228227
"""Constructor of OxmProperty receives the parameters bellow.
229228
230229
Args:
231-
type(~pyof.v0x04.controller2switch.common.TableFeaturePropType):
230+
type(|TableFeaturePropType_v0x04|):
232231
Property Type value of this instance.
233-
oxm_ids(~pyof.v0x04.common.flow_match.ListOfOxmHeader):
232+
oxm_ids(|ListOfOxmHeader_v0x04|):
234233
List of OxmHeader instances.
235234
"""
236235
super().__init__(property_type)
@@ -248,8 +247,7 @@ def __init__(self, items=None):
248247
"""The constructor just assigns parameters to object attributes.
249248
250249
Args:
251-
items (~pyof.v0x04.controller2switch.common.Property):
252-
Instance or a list of instances.
250+
items (|Property_v0x04|): Instance or a list of instances.
253251
"""
254252
super().__init__(pyof_class=Property, items=items)
255253

@@ -301,8 +299,7 @@ def __init__(self, table_id=Table.OFPTT_ALL, name="",
301299
config(int): Field reseved for future use.
302300
max_entries(int): Describe the maximum number of flow entries that
303301
can be inserted into that table.
304-
properties(~pyof.v0x04.controller2switch.common.Property):
305-
List of Property intances.
302+
properties(Property_v0x04): List of Property intances.
306303
"""
307304
super().__init__()
308305
self.table_id = table_id

pyof/v0x04/common/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ def new_message_from_message_type(message_type):
4949
"""Given an OpenFlow Message Type, return an empty message of that type.
5050
5151
Args:
52-
messageType (:class:~.common.header.Type): Python-openflow message.
52+
messageType (:class:`~pyof.v0x04.common.header.Type`):
53+
Python-openflow message.
5354
5455
Returns:
5556
Empty OpenFlow message of the requested message type.
@@ -134,7 +135,8 @@ def new_message_from_header(header):
134135
"""Given an OF Header, return an empty message of header's message_type.
135136
136137
Args:
137-
header (~pyof.v0x04.common.header.Header): Unpacked OpenFlow Header.
138+
header (:class:`~pyof.v0x04.common.header.Header`):
139+
Unpacked OpenFlow Header.
138140
139141
Returns:
140142
Empty OpenFlow message of the same type of message_type attribute from

pyof/v0x04/controller2switch/get_async_reply.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,17 @@ def __init__(self, xid=None, packet_in_mask1=None, packet_in_mask2=None,
2727
2828
Args:
2929
xid (int): xid to be used on the message header.
30-
packet_in_mask1 \
31-
(~pyof.v0x04.asynchronous.packet_in.PacketInReason):
30+
packet_in_mask1 (|PacketInReason_v0x04|):
3231
A instance of PacketInReason
33-
packet_in_mask2 \
34-
(~pyof.v0x04.asynchronous.packet_in.PacketInReason):
32+
packet_in_mask2 (|PacketInReason_v0x04|):
3533
A instance of PacketInReason
36-
port_status_mask1 \
37-
(~pyof.v0x04.asynchronous.port_status.PortReason):
34+
port_status_mask1 (|PortReason_v0x04|):
3835
A instance of PortReason
39-
port_status_mask2 \
40-
(~pyof.v0x04.asynchronous.port_status.PortReason):
36+
port_status_mask2 (|PortReason_v0x04|):
4137
A instance of PortReason
42-
flow_removed_mask1 \
43-
(~pyof.v0x04.asynchronous.flow_removed.FlowRemoved):
38+
flow_removed_mask1 (|FlowRemoved_v0x04|):
4439
A instance of FlowRemoved.
45-
flow_removed_mask2 \
46-
(~pyof.v0x04.asynchronous.flow_removed.FlowRemoved):
40+
flow_removed_mask2 (|FlowRemoved_v0x04|):
4741
A instance of FlowRemoved.
4842
"""
4943
super().__init__(xid, packet_in_mask1, packet_in_mask2,

pyof/v0x04/controller2switch/group_mod.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
from pyof.v0x04.common.header import Header, Type
88
from pyof.v0x04.controller2switch.common import Bucket
99

10-
__all__ = ('GroupMod', 'GroupModCommand', 'GroupType', 'Group')
10+
__all__ = ('GroupMod', 'GroupModCommand', 'GroupType', 'Group',
11+
'ListOfBuckets')
1112

1213

1314
class Group(IntEnum):

pyof/v0x04/controller2switch/multipart_reply.py

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,9 @@ def __init__(self, length=None, group_type=None, group_id=None,
418418
419419
Args:
420420
length (int): Length of this entry.
421-
group_type\
422-
(:class:`~pyof.v0x04.controller2switch.group_mod.GroupType`):
423-
One of OFPGT_*.
421+
group_type (|GroupType_v0x04|): One of OFPGT_*.
424422
group_id (int): Group identifier.
425-
buckets \
426-
(:class:`~pyof.v0x04.controller2switch.group_mod.ListOfBucket`):
427-
List of buckets in group.
423+
buckets (|ListOfBuckets_v0x04|): List of buckets in group.
428424
"""
429425
super().__init__()
430426
self.length = length
@@ -535,13 +531,11 @@ def __init__(self, flags=MeterFlags.OFPMF_STATS, meter_id=None,
535531
"""The Constructor of MeterConfig receives the parameters below.
536532
537533
Args:
538-
flags\
539-
(:class:`~pyof.v0x04.controller2switch.meter_mod.MeterFlags`):
540-
Meter configuration flags.The default value is \
534+
flags (|MeterFlags_v0x04|):
535+
Meter configuration flags.The default value is
541536
MeterFlags.OFPMF_STATS
542-
meter_id \
543-
(:class:`~pyof.v0x04.controller2switch.meter_mod.Meter`):
544-
Meter Indentify.The value Meter.OFPM_ALL is used to \
537+
meter_id (|Meter_v0x04|):
538+
Meter Indentify.The value Meter.OFPM_ALL is used to
545539
refer to all Meters on the switch.
546540
bands(list): List of MeterBandHeader instances.
547541
"""
@@ -567,12 +561,9 @@ def __init__(self, max_meter=None, band_types=None, capabilities=None,
567561
568562
Args:
569563
max_meter(int): Maximum number of meters.
570-
band_types \
571-
(:class:`~pyof.v0x04.controller2switch.meter_mod.MeterBandType`):
564+
band_types (|MeterBandType_v0x04|):
572565
Bitmaps of OFPMBT_* values supported.
573-
capabilities \
574-
(:class:`~pyof.v0x04.controller2switch.meter_mod.MeterFlags`):
575-
Bitmaps of "ofp_meter_flags".
566+
capabilities (|MeterFlags_v0x04|): Bitmaps of "ofp_meter_flags".
576567
max_bands(int): Maximum bands per meters
577568
max_color(int): Maximum color value
578569
"""
@@ -615,9 +606,7 @@ def __init__(self, items=None):
615606
"""The constructor just assigns parameters to object attributes.
616607
617608
Args:
618-
items \
619-
(:class:`~pyof.v0x04.controller2switch.multipart_reply.BandStats`):
620-
Instance or a list of instances.
609+
items (|BandStats_v0x04|): Instance or a list of instances.
621610
"""
622611
super().__init__(pyof_class=BandStats, items=items)
623612

@@ -644,9 +633,7 @@ def __init__(self, meter_id=None, flow_count=None,
644633
"""The constructor just assigns parameters to object attributes.
645634
646635
Args:
647-
meter_id \
648-
(:class:`~pyof.v0x04.controller2switch.meter_mod.Meter`):
649-
Meter instance.
636+
meter_id (|Meter_v0x04|): Meter instance.
650637
flow_count(int): Number of flows bound to meter.
651638
packet_in_count(int): Number of packets in input.
652639
byte_in_count(int): Number of bytes in input.

pyof/v0x04/controller2switch/set_async.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,17 @@ def __init__(self, xid=None, packet_in_mask1=None, packet_in_mask2=None,
2929
3030
Args:
3131
xid (int): xid to be used on the message header.
32-
packet_in_mask1 \
33-
(~pyof.v0x04.asynchronous.packet_in.PacketInReason):
32+
packet_in_mask1 (|PacketInReason_v0x04|):
3433
A instance of PacketInReason
35-
packet_in_mask2 \
36-
(~pyof.v0x04.asynchronous.packet_in.PacketInReason):
34+
packet_in_mask2 (|PacketInReason_v0x04|):
3735
A instance of PacketInReason
38-
port_status_mask1 \
39-
(~pyof.v0x04.asynchronous.port_status.PortReason):
36+
port_status_mask1 (|PortReason_v0x04|):
4037
A instance of PortReason
41-
port_status_mask2 \
42-
(~pyof.v0x04.asynchronous.port_status.PortReason):
38+
port_status_mask2 (|PortReason_v0x04|):
4339
A instance of PortReason
44-
flow_removed_mask1 \
45-
(~pyof.v0x04.asynchronous.flow_removed.FlowRemoved):
40+
flow_removed_mask1 (|FlowRemoved_v0x04|):
4641
A instance of FlowRemoved.
47-
flow_removed_mask2 \
48-
(~pyof.v0x04.asynchronous.flow_removed.FlowRemoved):
42+
flow_removed_mask2 (|FlowRemoved_v0x04|):
4943
A instance of FlowRemoved.
5044
"""
5145
super().__init__(xid, packet_in_mask1, packet_in_mask2,

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ exclude = .eggs,ENV,build,docs/conf.py,venv
44
[pylama]
55
linters = isort,pydocstyle,radon,pylint,pycodestyle,pyflakes
66
skip = */v0x02/*
7-
ignore = D105,D203,D213,I0011,D301
7+
ignore = D105,D203,D213,I0011
88
# D105: Missing docstring in magic method [pep257]
99
# D203: 1 blank line required before class docstring (found 0) [pep257]
1010
# Conflicts with D211: No blank lines allowed before class docstring

0 commit comments

Comments
 (0)