diff options
author | Shinpei Muraoka <shinpei.muraoka@gmail.com> | 2016-12-20 11:41:56 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-12-29 22:03:38 +0900 |
commit | d1c275ed6f25ed9e70eba2e4b6a4406d51b5de18 (patch) | |
tree | 42b10f85bb5750fe8da7befa00597499997b1b2a | |
parent | 9b2cb18729052087a16145a1a86ea1cb9006fc4e (diff) |
doc: library_packet_ref: Update references
Signed-off-by: Shinpei Muraoka <shinpei.muraoka@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | doc/source/library_packet_ref.rst | 15 | ||||
-rw-r--r-- | ryu/lib/packet/mpls.py | 2 | ||||
-rw-r--r-- | ryu/lib/packet/vxlan.py | 35 |
3 files changed, 25 insertions, 27 deletions
diff --git a/doc/source/library_packet_ref.rst b/doc/source/library_packet_ref.rst index 87f44a1c..29c68a20 100644 --- a/doc/source/library_packet_ref.rst +++ b/doc/source/library_packet_ref.rst @@ -26,6 +26,9 @@ Protocol Header classes .. automodule:: ryu.lib.packet.ethernet :members: +.. autoclass:: ryu.lib.packet.lldp.lldp + :members: + .. automodule:: ryu.lib.packet.vlan :members: @@ -50,6 +53,9 @@ Protocol Header classes .. automodule:: ryu.lib.packet.icmpv6 :members: +.. automodule:: ryu.lib.packet.vxlan + :members: + .. automodule:: ryu.lib.packet.gre :members: @@ -118,7 +124,8 @@ Protocol Header classes :members: .. autoclass:: ryu.lib.packet.bgp.BGPNotification :members: -.. automodule:: ryu.lib.packet.sctp + +.. automodule:: ryu.lib.packet.bmp :members: .. autoclass:: ryu.lib.packet.bfd.bfd @@ -133,3 +140,9 @@ Protocol Header classes :members: .. autoclass:: ryu.lib.packet.bfd.MeticulousKeyedSHA1 :members: + +.. autoclass:: ryu.lib.packet.ospf.OSPFMessage + :members: + +.. automodule:: ryu.lib.packet.sctp + :members: diff --git a/ryu/lib/packet/mpls.py b/ryu/lib/packet/mpls.py index bba2861c..b1588844 100644 --- a/ryu/lib/packet/mpls.py +++ b/ryu/lib/packet/mpls.py @@ -73,6 +73,7 @@ class mpls(packet_base.PacketBase): def label_from_bin(buf): """ Converts binary representation label to integer. + :param buf: Binary representation of label. :return: MPLS Label and BoS bit. """ @@ -84,6 +85,7 @@ def label_from_bin(buf): def label_to_bin(mpls_label, is_bos=True): """ Converts integer label to binary representation. + :param mpls_label: MPLS Label. :param is_bos: BoS bit. :return: Binary representation of label. diff --git a/ryu/lib/packet/vxlan.py b/ryu/lib/packet/vxlan.py index c7de04b2..5a6e0131 100644 --- a/ryu/lib/packet/vxlan.py +++ b/ryu/lib/packet/vxlan.py @@ -13,32 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -""" -VXLAN packet parser/serializer - -RFC 7348 -VXLAN Header: -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -|R|R|R|R|I|R|R|R| Reserved | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| VXLAN Network Identifier (VNI) | Reserved | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - -- Flags (8 bits): where the I flag MUST be set to 1 for a valid - VXLAN Network ID (VNI). The other 7 bits (designated "R") are - reserved fields and MUST be set to zero on transmission and - ignored on receipt. - -- VXLAN Segment ID/VXLAN Network Identifier (VNI): this is a - 24-bit value used to designate the individual VXLAN overlay - network on which the communicating VMs are situated. VMs in - different VXLAN overlay networks cannot communicate with each - other. - -- Reserved fields (24 bits and 8 bits): MUST be set to zero on - transmission and ignored on receipt. -""" - import struct import logging @@ -72,6 +46,13 @@ class vxlan(packet_base.PacketBase): _PACK_STR = '!II' _MIN_LEN = struct.calcsize(_PACK_STR) + # VXLAN Header: + # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + # |R|R|R|R|I|R|R|R| Reserved | + # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + # | VXLAN Network Identifier (VNI) | Reserved | + # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + def __init__(self, vni): super(vxlan, self).__init__() self.vni = vni @@ -95,6 +76,7 @@ class vxlan(packet_base.PacketBase): def vni_from_bin(buf): """ Converts binary representation VNI to integer. + :param buf: binary representation of VNI. :return: VNI integer. """ @@ -104,6 +86,7 @@ def vni_from_bin(buf): def vni_to_bin(vni): """ Converts integer VNI to binary representation. + :param vni: integer of VNI :return: binary representation of VNI. """ |