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

Commit 82511d3

Browse files
committed
Change StatsTypes to singular
Change it to match the project defaults. Fix #470
1 parent 7027e83 commit 82511d3

17 files changed

Lines changed: 35 additions & 35 deletions

pyof/v0x01/controller2switch/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
# Third-party imports
1818

19-
__all__ = ('ConfigFlag', 'StatsTypes', 'AggregateStatsReply',
19+
__all__ = ('ConfigFlag', 'StatsType', 'AggregateStatsReply',
2020
'AggregateStatsRequest', 'DescStats', 'FlowStats',
2121
'FlowStatsRequest', 'PortStats', 'PortStatsRequest', 'QueueStats',
2222
'QueueStatsRequest', 'TableStats', 'VendorStats',
@@ -37,7 +37,7 @@ class ConfigFlag(IntEnum):
3737
OFPC_FRAG_MASK = 3
3838

3939

40-
class StatsTypes(IntEnum):
40+
class StatsType(IntEnum):
4141
"""Type field to be used both in both request and reply.
4242
4343
It specifies the kind of information being passed and determines how the

pyof/v0x01/controller2switch/stats_reply.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from pyof.foundation.base import GenericMessage
55
from pyof.foundation.basic_types import BinaryData, FixedTypeList, UBInt16
66
from pyof.v0x01.common.header import Header, Type
7-
from pyof.v0x01.controller2switch.common import DescStats, StatsTypes
7+
from pyof.v0x01.controller2switch.common import DescStats, StatsType
88

99
__all__ = ('StatsReply',)
1010

@@ -14,7 +14,7 @@ class StatsReply(GenericMessage):
1414

1515
#: OpenFlow :class:`~pyof.v0x01.common.header.Header`
1616
header = Header(message_type=Type.OFPT_STATS_REPLY)
17-
body_type = UBInt16(enum_ref=StatsTypes)
17+
body_type = UBInt16(enum_ref=StatsType)
1818
flags = UBInt16()
1919
body = BinaryData()
2020

@@ -23,7 +23,7 @@ def __init__(self, xid=None, body_type=None, flags=None, body=b''):
2323
2424
Args:
2525
xid (int): xid to be used on the message header.
26-
body_type (StatsTypes): One of the OFPST_* constants.
26+
body_type (StatsType): One of the OFPST_* constants.
2727
flags (int): OFPSF_REQ_* flags (none yet defined).
2828
body (BinaryData): Body of the request.
2929
"""

pyof/v0x01/controller2switch/stats_request.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from pyof.foundation.basic_types import BinaryData, FixedTypeList, UBInt16
1111
# Local imports
1212
from pyof.v0x01.common.header import Header, Type
13-
from pyof.v0x01.controller2switch.common import StatsTypes
13+
from pyof.v0x01.controller2switch.common import StatsType
1414

1515
__all__ = ('StatsRequest',)
1616

@@ -20,7 +20,7 @@ class StatsRequest(GenericMessage):
2020

2121
#: OpenFlow :class:`~pyof.v0x01.common.header.Header`
2222
header = Header(message_type=Type.OFPT_STATS_REQUEST)
23-
body_type = UBInt16(enum_ref=StatsTypes)
23+
body_type = UBInt16(enum_ref=StatsType)
2424
flags = UBInt16()
2525
body = BinaryData()
2626

@@ -29,7 +29,7 @@ def __init__(self, xid=None, body_type=None, flags=0, body=b''):
2929
3030
Args:
3131
xid (int): xid to be used on the message header.
32-
body_type (StatsTypes): One of the OFPST_* constants.
32+
body_type (StatsType): One of the OFPST_* constants.
3333
flags (int): OFPSF_REQ_* flags (none yet defined).
3434
body (BinaryData): Body of the request.
3535
"""

pyof/v0x04/controller2switch/multipart_request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def __init__(self, port_no=PortNo.OFPP_ANY):
256256
257257
Args:
258258
port_no (:class:`int`, :class:`~pyof.v0x04.common.port.PortNo`):
259-
:attr:`StatsTypes.OFPST_PORT` message must request statistics
259+
:attr:`StatsType.OFPST_PORT` message must request statistics
260260
either for a single port (specified in ``port_no``) or for all
261261
ports (if ``port_no`` == :attr:`.PortNo.OFPP_ANY`).
262262
"""

tests/v0x01/test_controller2switch/test_aggregate_stats_reply.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Test for AggregateStatsReply message."""
2-
from pyof.v0x01.controller2switch.common import AggregateStatsReply, StatsTypes
2+
from pyof.v0x01.controller2switch.common import AggregateStatsReply, StatsType
33
from pyof.v0x01.controller2switch.stats_reply import StatsReply
44
from tests.test_struct import TestStruct
55

@@ -15,6 +15,6 @@ def setUpClass(cls):
1515
super().setUpClass()
1616
super().set_raw_dump_file('v0x01', 'ofpt_aggregate_stats_reply')
1717
super().set_raw_dump_object(StatsReply, xid=17,
18-
body_type=StatsTypes.OFPST_AGGREGATE,
18+
body_type=StatsType.OFPST_AGGREGATE,
1919
flags=0, body=aggregate_stats_reply)
2020
super().set_minimum_size(12)

tests/v0x01/test_controller2switch/test_aggregate_stats_request.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from pyof.v0x01.common.flow_match import Match
33
from pyof.v0x01.common.phy_port import Port
44
from pyof.v0x01.controller2switch.common import (
5-
AggregateStatsRequest, StatsTypes)
5+
AggregateStatsRequest, StatsType)
66
from pyof.v0x01.controller2switch.stats_request import StatsRequest
77
from tests.test_struct import TestStruct
88

@@ -19,7 +19,7 @@ def setUpClass(cls):
1919
super().setUpClass()
2020
super().set_raw_dump_file('v0x01', 'ofpt_aggregate_request')
2121
super().set_raw_dump_object(StatsRequest, xid=17,
22-
body_type=StatsTypes.OFPST_AGGREGATE,
22+
body_type=StatsType.OFPST_AGGREGATE,
2323
flags=0, body=request)
2424
super().set_minimum_size(12)
2525

tests/v0x01/test_controller2switch/test_desc_stats.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Test DescStats message."""
22
from pyof.foundation.constants import DESC_STR_LEN
3-
from pyof.v0x01.controller2switch.common import DescStats, StatsTypes
3+
from pyof.v0x01.controller2switch.common import DescStats, StatsType
44
from pyof.v0x01.controller2switch.stats_reply import StatsReply
55
from tests.test_struct import TestStruct
66

@@ -14,7 +14,7 @@ def setUpClass(cls):
1414
super().setUpClass()
1515
super().set_raw_dump_file('v0x01', 'ofpt_desc_stats_reply')
1616
super().set_raw_dump_object(StatsReply, xid=14,
17-
body_type=StatsTypes.OFPST_DESC,
17+
body_type=StatsType.OFPST_DESC,
1818
flags=0, body=_get_desc_stats())
1919
super().set_minimum_size(12)
2020

tests/v0x01/test_controller2switch/test_flow_stats.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Test FlowStats message."""
22
from pyof.v0x01.common.flow_match import Match
3-
from pyof.v0x01.controller2switch.common import FlowStats, StatsTypes
3+
from pyof.v0x01.controller2switch.common import FlowStats, StatsType
44
from pyof.v0x01.controller2switch.stats_reply import StatsReply
55
from tests.test_struct import TestStruct
66

@@ -14,7 +14,7 @@ def setUpClass(cls):
1414
super().setUpClass()
1515
super().set_raw_dump_file('v0x01', 'ofpt_flow_stats_reply')
1616
super().set_raw_dump_object(StatsReply, xid=12,
17-
body_type=StatsTypes.OFPST_FLOW,
17+
body_type=StatsType.OFPST_FLOW,
1818
flags=0, body=_get_flow_stats())
1919
super().set_minimum_size(12)
2020

tests/v0x01/test_controller2switch/test_flow_stats_request.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Test FlowStatsRequest message."""
22
from pyof.v0x01.common.flow_match import Match
3-
from pyof.v0x01.controller2switch.common import FlowStatsRequest, StatsTypes
3+
from pyof.v0x01.controller2switch.common import FlowStatsRequest, StatsType
44
from pyof.v0x01.controller2switch.stats_request import StatsRequest
55
from tests.test_struct import TestStruct
66

@@ -14,7 +14,7 @@ def setUpClass(cls):
1414
super().setUpClass()
1515
super().set_raw_dump_file('v0x01', 'ofpt_flow_stats_request')
1616
super().set_raw_dump_object(StatsRequest, xid=12,
17-
body_type=StatsTypes.OFPST_FLOW,
17+
body_type=StatsType.OFPST_FLOW,
1818
flags=0, body=_get_flow_stats_request())
1919
super().set_minimum_size(12)
2020

tests/v0x01/test_controller2switch/test_port_stats.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Test for PortStats structure."""
2-
from pyof.v0x01.controller2switch.common import PortStats, StatsTypes
2+
from pyof.v0x01.controller2switch.common import PortStats, StatsType
33
from pyof.v0x01.controller2switch.stats_reply import StatsReply
44
from tests.test_struct import TestStruct
55

@@ -13,7 +13,7 @@ def setUpClass(cls):
1313
super().setUpClass()
1414
super().set_raw_dump_file('v0x01', 'ofpt_port_stats')
1515
super().set_raw_dump_object(StatsReply, xid=13,
16-
body_type=StatsTypes.OFPST_PORT,
16+
body_type=StatsType.OFPST_PORT,
1717
flags=0, body=_get_port_stats())
1818
super().set_minimum_size(12)
1919

0 commit comments

Comments
 (0)