55structs. You can realize that when you see a message class definition.
66
77A **struct** here is a group of basic attributes and/or struct attributes (i.e.
8- :class:`~.common.header.Header`). A **message** here is like a struct, but all
9- messages have a header attribute (i.e.
10- :class:`~.asynchronous.packet_in.PacketIn`).
8+ :class:`~pyof.v0x01.common.header.Header`). A **message** here is like a
9+ struct, but all messages have a header attribute (i.e.
10+ :class:`~pyof.v0x01.asynchronous.packet_in.PacketIn`).
11+
1112
1213The main classes of this module are :class:`GenericStruct`,
1314:class:`GenericMessage`, :class:`GenericBitMask` and :class:`GenericType`.
@@ -50,7 +51,7 @@ def __init__(self, value=None, enum_ref=None):
5051
5152 Args:
5253 value: The type's value.
53- enum_ref (:class:` type` ): If :attr:`value` is from an Enum, specify
54+ enum_ref (type): If :attr:`value` is from an Enum, specify
5455 its type.
5556 """
5657 self ._value = value
@@ -219,10 +220,10 @@ def is_valid(self):
219220 return False
220221
221222 def isenum (self ):
222- """Test whether it is an :class:`~Enum`.
223+ """Test whether it is an :class:`~enum. Enum`.
223224
224225 Returns:
225- bool: Whether it is an :class:`~Enum`.
226+ bool: Whether it is an :class:`~enum. Enum`.
226227 """
227228 return self .enum_ref and issubclass (self .enum_ref , (Enum , IntEnum ))
228229
@@ -346,8 +347,8 @@ def get_pyof_version(module_fullname):
346347 (e.g.: pyof.v0x01.common.header)
347348
348349 Returns:
349- version ( str) : The module version, on the format 'v0x0?' if any. Or
350- None (None): If there isn't a version on the fullname.
350+ str: The module version, on the format 'v0x0?' if any. Or None
351+ if there isn't a version on the fullname.
351352 """
352353 ver_module_re = re .compile (r'(pyof\.)(v0x\d+)(\..*)' )
353354 matched = ver_module_re .match (module_fullname )
@@ -366,15 +367,16 @@ def replace_pyof_version(module_fullname, version):
366367
367368 Args:
368369 module_fullname (str): The fullname of the module
369- (e.g.: pyof.v0x01.common.header)
370+ (e.g.: pyof.v0x01.common.header)
370371 version (str): The version to be 'inserted' on the module fullname.
371372
372373 Returns:
373- None (None): if the requested version is the same as the one of the
374- module_fullname or if the module_fullname is not a 'OF version'
375- specific module.
376- new_module_fullname (str): The new module fullname, with the
377- replaced version, on the format "pyof.v0x01.common.header".
374+ str: module fullname
375+ The new module fullname, with the replaced version,
376+ on the format "pyof.v0x01.common.header". If the requested
377+ version is the same as the one of the module_fullname or if
378+ the module_fullname is not a 'OF version' specific module,
379+ returns None.
378380 """
379381 module_version = MetaStruct .get_pyof_version (module_fullname )
380382 if not module_version or module_version == version :
@@ -413,7 +415,7 @@ def get_pyof_obj_new_version(name, obj, new_version):
413415 'obj'.
414416
415417 Return:
416- (name , obj): A tuple in which the first item is the name of the
418+ (str , obj): A tuple in which the first item is the name of the
417419 class attribute (the same that was passed), and the second item
418420 is a instance of the passed class attribute. If the class
419421 attribute is not a pyof versioned attribute, then the same
@@ -655,8 +657,9 @@ def is_valid(self):
655657
656658 This method will check whether all struct attributes have a proper
657659 value according to the OpenFlow specification. For instance, if you
658- have a struct with an attribute of type :class:`UBInt8()`
659- and you assign a string value to it, this method will return False.
660+ have a struct with an attribute of type
661+ :class:`~pyof.foundation.basic_types.UBInt8` and you assign a string
662+ value to it, this method will return False.
660663
661664 Returns:
662665 bool: Whether the struct is valid.
0 commit comments