kytos / python-openflow

Low level OpenFlow messages parser used by Kytos SDN Platform
https://kytos.io/
MIT License
46 stars 35 forks source link

Possible OF 1.0 Spec error on ofp_port_state #7

Open diraol opened 8 years ago

diraol commented 8 years ago

On pg.18 of OpenFlow 1.0.0 spec we have the enum ofp_port_state. This is the C++ proposed implementation:

enum ofp_port_state {
    OFPPS_LINK_DOWN = 1 << 0, /* No physical link present. */
    OFPPS_STP_LISTEN = 0 << 8, /* Not learning or relaying frames. */
    OFPPS_STP_LEARN = 1 << 8, /* Learning but not relaying frames. */
    OFPPS_STP_FORWARD = 2 << 8, /* Learning and relaying frames. */
    OFPPS_STP_BLOCK = 3 << 8, /* Not part of spanning tree. */
    OFPPS_STP_MASK = 3 << 8 /* Bit mask for OFPPS_STP_* values. */
}

Its last two options have same values. This appears to be an error, check if it is corrected or compare it with the newer spec versions to understand the expected behaviour.

beraldoleal commented 8 years ago

On openflow future versions (>1.1.0), OFPPS_STP_* will be removed.

For now, please, implement removing the last one: OFPS_STP_MASK.

abaruchi commented 8 years ago

Closing Issue

diraol commented 8 years ago

I'm reopening this issue since I've found a divergence on OpenFlow specs (even on v1.0.0) among different places. On the 1.0.0 Spec PDF we have:

enum ofp_port_state {
    OFPPS_LINK_DOWN = 1 << 0, /* No physical link present. */
    /* The OFPPS_STP_* bits have no effect on switch operation. The
    * controller must adjust OFPPC_NO_RECV, OFPPC_NO_FWD, and
    * OFPPC_NO_PACKET_IN appropriately to fully implement an 802.1D spanning
    * tree. */
    OFPPS_STP_LISTEN = 0 << 8, /* Not learning or relaying frames. */
    OFPPS_STP_LEARN = 1 << 8, /* Learning but not relaying frames. */
    OFPPS_STP_FORWARD = 2 << 8, /* Learning and relaying frames. */
    OFPPS_STP_BLOCK = 3 << 8, /* Not part of spanning tree. */
    OFPPS_STP_MASK = 3 << 8 /* Bit mask for OFPPS_STP_* values. */
};

But, on this page: http://flowgrammable.org/sdn/openflow/message-layer/port/#tab_ofp_1_0

Port_state values are represented as:

   ITEM          VALUE
STPListen      0x00000000
LinkDown       0x00000001
STPLearn       0x00000002
STPForward     0x00000004
STPBlock       0x00000008
STPMask        0x00000010

The values are not coherent between these two places, and the second one, from flowgrammable, is more coherent with the values from OpenFlow 1.1.0 spec and later, even on PDFs. The values on the V1.0.0 spec does not make any sense...

What should we do?

beraldoleal commented 8 years ago

@diraol , Isn't this the same case of wildcards on Match class ?