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

Commit e83ad15

Browse files
authored
Merge pull request #513 from renanrodrigo/renames
Rename Enums to the default of the project
2 parents 3ed6d67 + 82511d3 commit e83ad15

27 files changed

Lines changed: 95 additions & 95 deletions

pyof/v0x01/controller2switch/common.py

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

1717
# Third-party imports
1818

19-
__all__ = ('ConfigFlags', 'StatsTypes', 'AggregateStatsReply',
19+
__all__ = ('ConfigFlag', 'StatsType', 'AggregateStatsReply',
2020
'AggregateStatsRequest', 'DescStats', 'FlowStats',
2121
'FlowStatsRequest', 'PortStats', 'PortStatsRequest', 'QueueStats',
2222
'QueueStatsRequest', 'TableStats', 'VendorStats',
@@ -25,7 +25,7 @@
2525
# Enums
2626

2727

28-
class ConfigFlags(IntEnum):
28+
class ConfigFlag(IntEnum):
2929
"""Configuration Flags. Handling of IP Fragments."""
3030

3131
#: No special handling for fragments
@@ -37,7 +37,7 @@ class ConfigFlags(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
@@ -70,15 +70,15 @@ class SwitchConfig(GenericMessage):
7070
"""Used as base class for SET_CONFIG and GET_CONFIG_REPLY messages."""
7171

7272
header = Header()
73-
flags = UBInt16(enum_ref=ConfigFlags)
73+
flags = UBInt16(enum_ref=ConfigFlag)
7474
miss_send_len = UBInt16()
7575

7676
def __init__(self, xid=None, flags=None, miss_send_len=None):
7777
"""Create a SwitchConfig with the optional parameters below.
7878
7979
Args:
8080
xid (int): xid to be used on the message header.
81-
flags (ConfigFlags): OFPC_* flags.
81+
flags (ConfigFlag): OFPC_* flags.
8282
miss_send_len (int): UBInt16 max bytes of new flow that the
8383
datapath should send to the controller.
8484
"""

pyof/v0x01/controller2switch/get_config_reply.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(self, xid=None, flags=None, miss_send_len=None):
1818
1919
Args:
2020
xid (int): xid to be used on the message header.
21-
flags (~pyof.v0x01.controller2switch.common.ConfigFlags):
21+
flags (~pyof.v0x01.controller2switch.common.ConfigFlag):
2222
OFPC_* flags.
2323
miss_send_len (int): UBInt16 max bytes of new flow that the
2424
datapath should send to the controller.

pyof/v0x01/controller2switch/set_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def __init__(self, xid=None, flags=None, miss_send_len=None):
1919
2020
Args:
2121
xid (int): xid to be used on the message header.
22-
flags (~pyof.v0x01.controller2switch.common.ConfigFlags):
22+
flags (~pyof.v0x01.controller2switch.common.ConfigFlag):
2323
OFPC_* flags.
2424
miss_send_len (int): UBInt16 max bytes of new flow that the
2525
datapath should send to the controller.

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/common.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
from pyof.v0x04.common.header import Header
1919
from pyof.v0x04.controller2switch.table_mod import Table
2020

21-
__all__ = ('ConfigFlags', 'ControllerRole', 'Bucket', 'BucketCounter',
22-
'ExperimenterMultipartHeader', 'MultipartTypes',
21+
__all__ = ('ConfigFlag', 'ControllerRole', 'Bucket', 'BucketCounter',
22+
'ExperimenterMultipartHeader', 'MultipartType',
2323
'TableFeaturePropType', 'Property', 'InstructionsProperty',
2424
'NextTablesProperty', 'ActionsProperty', 'OxmProperty',
2525
'ListOfProperty', 'TableFeatures')
2626

2727
# Enum
2828

2929

30-
class ConfigFlags(IntEnum):
30+
class ConfigFlag(IntEnum):
3131
"""Handling of IP fragments."""
3232

3333
#: No special handling for fragments.
@@ -104,7 +104,7 @@ def find_class(self):
104104
return OxmProperty
105105

106106

107-
class MultipartTypes(IntEnum):
107+
class MultipartType(IntEnum):
108108
"""Types of Multipart Messages, both Request and Reply."""
109109

110110
#: Description of this OpenFlow switch.
@@ -338,16 +338,16 @@ class SwitchConfig(GenericMessage):
338338

339339
#: OpenFlow :class:`~pyof.v0x04.common.header.Header`
340340
header = Header()
341-
flags = UBInt16(enum_ref=ConfigFlags)
341+
flags = UBInt16(enum_ref=ConfigFlag)
342342
miss_send_len = UBInt16()
343343

344-
def __init__(self, xid=None, flags=ConfigFlags.OFPC_FRAG_NORMAL,
344+
def __init__(self, xid=None, flags=ConfigFlag.OFPC_FRAG_NORMAL,
345345
miss_send_len=ControllerMaxLen.OFPCML_NO_BUFFER):
346346
"""Create a SwitchConfig with the optional parameters below.
347347
348348
Args:
349349
xid (int): xid to be used on the message header.
350-
flags (ConfigFlags): OFPC_* flags.
350+
flags (ConfigFlag): OFPC_* flags.
351351
miss_send_len (int): UBInt16 max bytes of new flow that the
352352
datapath should send to the controller.
353353
"""

pyof/v0x04/controller2switch/get_config_reply.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(self, xid=None, flags=None, miss_send_len=None):
1818
1919
Args:
2020
xid (int): xid to be used on the message header.
21-
flags (~pyof.v0x04.controller2switch.common.ConfigFlags):
21+
flags (~pyof.v0x04.controller2switch.common.ConfigFlag):
2222
OFPC_* flags.
2323
miss_send_len (int): UBInt16 max bytes of new flow that the
2424
datapath should send to the controller.

pyof/v0x04/controller2switch/multipart_reply.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from pyof.v0x04.common.header import Header, Type
1414
from pyof.v0x04.common.port import Port
1515
from pyof.v0x04.controller2switch.common import (
16-
Bucket, BucketCounter, ExperimenterMultipartHeader, MultipartTypes,
16+
Bucket, BucketCounter, ExperimenterMultipartHeader, MultipartType,
1717
TableFeatures)
1818
from pyof.v0x04.controller2switch.meter_mod import (
1919
ListOfMeterBandHeader, MeterBandType, MeterFlags)
@@ -62,7 +62,7 @@ class MultipartReply(GenericMessage):
6262
#: Openflow :class:`~pyof.v0x04.common.header.Header`
6363
header = Header(message_type=Type.OFPT_MULTIPART_REPLY)
6464
#: One of the OFPMP_* constants.
65-
multipart_type = UBInt16(enum_ref=MultipartTypes)
65+
multipart_type = UBInt16(enum_ref=MultipartType)
6666
#: OFPMPF_REPLY_* flags.
6767
flags = UBInt16()
6868
#: Padding
@@ -139,22 +139,22 @@ def _unpack_body(self):
139139
def _get_body_instance(self):
140140
"""Return the body instance."""
141141
exp_header = ExperimenterMultipartHeader
142-
simple_body = {MultipartTypes.OFPMP_DESC: Desc,
143-
MultipartTypes.OFPMP_GROUP_FEATURES: GroupFeatures,
144-
MultipartTypes.OFPMP_METER_FEATURES: MeterFeatures,
145-
MultipartTypes.OFPMP_EXPERIMENTER: exp_header}
146-
147-
array_of_bodies = {MultipartTypes.OFPMP_FLOW: FlowStats,
148-
MultipartTypes.OFPMP_AGGREGATE: AggregateStatsReply,
149-
MultipartTypes.OFPMP_TABLE: TableStats,
150-
MultipartTypes.OFPMP_PORT_STATS: PortStats,
151-
MultipartTypes.OFPMP_QUEUE: QueueStats,
152-
MultipartTypes.OFPMP_GROUP: GroupStats,
153-
MultipartTypes.OFPMP_GROUP_DESC: GroupDescStats,
154-
MultipartTypes.OFPMP_METER: MeterStats,
155-
MultipartTypes.OFPMP_METER_CONFIG: MeterConfig,
156-
MultipartTypes.OFPMP_TABLE_FEATURES: TableFeatures,
157-
MultipartTypes.OFPMP_PORT_DESC: Port}
142+
simple_body = {MultipartType.OFPMP_DESC: Desc,
143+
MultipartType.OFPMP_GROUP_FEATURES: GroupFeatures,
144+
MultipartType.OFPMP_METER_FEATURES: MeterFeatures,
145+
MultipartType.OFPMP_EXPERIMENTER: exp_header}
146+
147+
array_of_bodies = {MultipartType.OFPMP_FLOW: FlowStats,
148+
MultipartType.OFPMP_AGGREGATE: AggregateStatsReply,
149+
MultipartType.OFPMP_TABLE: TableStats,
150+
MultipartType.OFPMP_PORT_STATS: PortStats,
151+
MultipartType.OFPMP_QUEUE: QueueStats,
152+
MultipartType.OFPMP_GROUP: GroupStats,
153+
MultipartType.OFPMP_GROUP_DESC: GroupDescStats,
154+
MultipartType.OFPMP_METER: MeterStats,
155+
MultipartType.OFPMP_METER_CONFIG: MeterConfig,
156+
MultipartType.OFPMP_TABLE_FEATURES: TableFeatures,
157+
MultipartType.OFPMP_PORT_DESC: Port}
158158

159159
if isinstance(self.multipart_type, (int, UBInt16)):
160160
self.multipart_type = self.multipart_type.enum_ref(

pyof/v0x04/controller2switch/multipart_request.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from pyof.v0x04.common.header import Header, Type
1212
from pyof.v0x04.common.port import PortNo
1313
from pyof.v0x04.controller2switch.common import (
14-
ExperimenterMultipartHeader, MultipartTypes, TableFeatures)
14+
ExperimenterMultipartHeader, MultipartType, TableFeatures)
1515
from pyof.v0x04.controller2switch.group_mod import Group
1616
from pyof.v0x04.controller2switch.meter_mod import Meter
1717
from pyof.v0x04.controller2switch.table_mod import Table
@@ -46,7 +46,7 @@ class MultipartRequest(GenericMessage):
4646
#: Openflow :class:`~pyof.v0x04.common.header.Header`
4747
header = Header(message_type=Type.OFPT_MULTIPART_REQUEST)
4848
#: One of the OFPMP_* constants.
49-
multipart_type = UBInt16(enum_ref=MultipartTypes)
49+
multipart_type = UBInt16(enum_ref=MultipartType)
5050
#: OFPMPF_REQ_* flags.
5151
flags = UBInt16(enum_ref=MultipartRequestFlags)
5252
#: Padding
@@ -127,16 +127,16 @@ def _unpack_body(self):
127127
def _get_body_instance(self):
128128
"""Return the body instance."""
129129
simple_body = {
130-
MultipartTypes.OFPMP_FLOW: FlowStatsRequest,
131-
MultipartTypes.OFPMP_AGGREGATE: AggregateStatsRequest,
132-
MultipartTypes.OFPMP_PORT_STATS: PortStatsRequest,
133-
MultipartTypes.OFPMP_QUEUE: QueueStatsRequest,
134-
MultipartTypes.OFPMP_GROUP: GroupStatsRequest,
135-
MultipartTypes.OFPMP_METER: MeterMultipartRequest,
136-
MultipartTypes.OFPMP_EXPERIMENTER: ExperimenterMultipartHeader
130+
MultipartType.OFPMP_FLOW: FlowStatsRequest,
131+
MultipartType.OFPMP_AGGREGATE: AggregateStatsRequest,
132+
MultipartType.OFPMP_PORT_STATS: PortStatsRequest,
133+
MultipartType.OFPMP_QUEUE: QueueStatsRequest,
134+
MultipartType.OFPMP_GROUP: GroupStatsRequest,
135+
MultipartType.OFPMP_METER: MeterMultipartRequest,
136+
MultipartType.OFPMP_EXPERIMENTER: ExperimenterMultipartHeader
137137
}
138138

139-
array_of_bodies = {MultipartTypes.OFPMP_TABLE_FEATURES: TableFeatures}
139+
array_of_bodies = {MultipartType.OFPMP_TABLE_FEATURES: TableFeatures}
140140

141141
if isinstance(self.multipart_type, UBInt16):
142142
self.multipart_type = self.multipart_type.enum_ref(
@@ -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
"""

pyof/v0x04/controller2switch/set_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@
77
# Local imports
88
from pyof.v0x04.common.action import ControllerMaxLen
99
from pyof.v0x04.common.header import Type
10-
from pyof.v0x04.controller2switch.common import ConfigFlags, SwitchConfig
10+
from pyof.v0x04.controller2switch.common import ConfigFlag, SwitchConfig
1111

1212
__all__ = ('SetConfig',)
1313

1414

1515
class SetConfig(SwitchConfig):
1616
"""Set config message."""
1717

18-
def __init__(self, xid=None, flags=ConfigFlags.OFPC_FRAG_NORMAL,
18+
def __init__(self, xid=None, flags=ConfigFlag.OFPC_FRAG_NORMAL,
1919
miss_send_len=ControllerMaxLen.OFPCML_NO_BUFFER):
2020
"""Create a SetConfig with the optional parameters below.
2121
2222
Args:
2323
xid (int): xid to be used on the message header.
24-
flags (:class:`~pyof.v0x01.controller2switch.common.ConfigFlags`):
24+
flags (:class:`~pyof.v0x01.controller2switch.common.ConfigFlag`):
2525
OFPC_* flags.
2626
miss_send_len (int): UBInt16 max bytes of new flow that the
2727
datapath should send to the controller.

0 commit comments

Comments
 (0)