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

Commit 7027e83

Browse files
committed
Change ConfigFlags to singular
Change it to match the project defaults. Fix #469
1 parent ba8a9e4 commit 7027e83

8 files changed

Lines changed: 19 additions & 19 deletions

File tree

pyof/v0x01/controller2switch/common.py

Lines changed: 4 additions & 4 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', 'StatsTypes', '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
@@ -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/v0x04/controller2switch/common.py

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

21-
__all__ = ('ConfigFlags', 'ControllerRole', 'Bucket', 'BucketCounter',
21+
__all__ = ('ConfigFlag', 'ControllerRole', 'Bucket', 'BucketCounter',
2222
'ExperimenterMultipartHeader', 'MultipartType',
2323
'TableFeaturePropType', 'Property', 'InstructionsProperty',
2424
'NextTablesProperty', 'ActionsProperty', 'OxmProperty',
@@ -27,7 +27,7 @@
2727
# Enum
2828

2929

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

3333
#: No special handling for fragments.
@@ -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/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.

tests/v0x01/test_controller2switch/test_get_config_reply.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Test GetConfigReply message."""
2-
from pyof.v0x01.controller2switch.common import ConfigFlags
2+
from pyof.v0x01.controller2switch.common import ConfigFlag
33
from pyof.v0x01.controller2switch.get_config_reply import GetConfigReply
44
from tests.test_struct import TestStruct
55

@@ -13,6 +13,6 @@ def setUpClass(cls):
1313
super().setUpClass()
1414
super().set_raw_dump_file('v0x01', 'ofpt_get_config_reply')
1515
super().set_raw_dump_object(GetConfigReply, xid=13,
16-
flags=ConfigFlags.OFPC_FRAG_REASM,
16+
flags=ConfigFlag.OFPC_FRAG_REASM,
1717
miss_send_len=1024)
1818
super().set_minimum_size(12)

tests/v0x01/test_controller2switch/test_set_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Set Config message tests."""
2-
from pyof.v0x01.controller2switch.common import ConfigFlags
2+
from pyof.v0x01.controller2switch.common import ConfigFlag
33
from pyof.v0x01.controller2switch.set_config import SetConfig
44
from tests.test_struct import TestStruct
55

@@ -13,6 +13,6 @@ def setUpClass(cls):
1313
super().setUpClass()
1414
super().set_raw_dump_file('v0x01', 'ofpt_set_config')
1515
super().set_raw_dump_object(SetConfig, xid=3,
16-
flags=ConfigFlags.OFPC_FRAG_NORMAL,
16+
flags=ConfigFlag.OFPC_FRAG_NORMAL,
1717
miss_send_len=128)
1818
super().set_minimum_size(12)

0 commit comments

Comments
 (0)