On Fri, 18 May 2018 06:32:17 +0900,
Marcin Chron wrote:
> 
> 
> 
> This patch removes 'Subtype' byte from SystemCapabilities TLV.
> There was an inconsistency in offical IEEE document which was corrected
> in 802.1AB-2009/Cor 1-2013.
> 
> Signed-off-by: Marcin Chron <marcin_mi...@o2.pl>
> ---
>  ryu/lib/packet/lldp.py             | 15 ++++++---------
>  ryu/tests/unit/packet/test_lldp.py |  4 +---
>  2 files changed, 7 insertions(+), 12 deletions(-)

> diff --git a/ryu/tests/unit/packet/test_lldp.py 
> b/ryu/tests/unit/packet/test_lldp.py
> index d8d261c..a5c96bd 100644
> --- a/ryu/tests/unit/packet/test_lldp.py
> +++ b/ryu/tests/unit/packet/test_lldp.py
> @@ -227,8 +227,7 @@ class TestLLDPOptionalTLV(unittest.TestCase):
>                      + b'\x73\x74\x65\x72\x20\x30\x35\x2f' \
>                      + b'\x32\x37\x2f\x30\x35\x20\x30\x34' \
>                      + b'\x3a\x35\x33\x3a\x31\x31\x00\x0e' \
> -                    + b'\x05\x01\x00\x14\x00\x14\x10\x0e' \
> -                    + b'\x07' \
> +                    + b'\x04\x00\x14\x00\x14\x10\x0e\x07' \
>                      + b'\x06\x00\x01\x30\xf9\xad\xa0\x02' \
>                      + b'\x00\x00\x03\xe9\x00\xfe\x07\x00' \
>                      + b'\x12\x0f\x02\x07\x01\x00\xfe\x09' \
> @@ -274,7 +273,6 @@ class TestLLDPOptionalTLV(unittest.TestCase):
>  
>          # SystemCapabilities
>          eq_(tlvs[6].tlv_type, lldp.LLDP_TLV_SYSTEM_CAPABILITIES)
> -        eq_(tlvs[6].subtype, lldp.ChassisID.SUB_CHASSIS_COMPONENT)
>          eq_(tlvs[6].system_cap & lldp.SystemCapabilities.CAP_MAC_BRIDGE,
>              lldp.SystemCapabilities.CAP_MAC_BRIDGE)
>          eq_(tlvs[6].enabled_cap & lldp.SystemCapabilities.CAP_MAC_BRIDGE,
> -- 

The test does pass but you left some
SystemCapabilities.subtype. I guess this change needs to be included.
Otherwise looks fine to me.

diff --git a/ryu/tests/unit/packet/test_lldp.py 
b/ryu/tests/unit/packet/test_lldp.py
index a5c96bda..35c4f58e 100644
--- a/ryu/tests/unit/packet/test_lldp.py
+++ b/ryu/tests/unit/packet/test_lldp.py
@@ -320,7 +320,6 @@ class TestLLDPOptionalTLV(unittest.TestCase):
             system_description=b'Summit300-48 - Version 7.4e.1 (Build 5) '
                                + b'by Release_Master 05/27/05 04:53:11\x00')
         tlv_system_capabilities = lldp.SystemCapabilities(
-            subtype=lldp.ChassisID.SUB_CHASSIS_COMPONENT,
             system_cap=0x14,
             enabled_cap=0x14)
         tlv_management_address = lldp.ManagementAddress(
@@ -358,7 +357,6 @@ class TestLLDPOptionalTLV(unittest.TestCase):
             system_description=b'Summit300-48 - Version 7.4e.1 (Build 5) '
                                + b'by Release_Master 05/27/05 04:53:11\x00')
         sys_cap = lldp.SystemCapabilities(
-            subtype=lldp.ChassisID.SUB_CHASSIS_COMPONENT,
             system_cap=0x14,
             enabled_cap=0x14)
         man_addr = lldp.ManagementAddress(
@@ -432,8 +430,7 @@ class TestLLDPOptionalTLV(unittest.TestCase):
                                        _sys_desc_str)
 
         # SystemCapabilities string
-        sys_cap_values = {'subtype': lldp.ChassisID.SUB_CHASSIS_COMPONENT,
-                          'system_cap': 0x14,
+        sys_cap_values = {'system_cap': 0x14,
                           'enabled_cap': 0x14,
                           'len': sys_cap.len,
                           'typelen': sys_cap.typelen}
@@ -513,7 +510,6 @@ class TestLLDPOptionalTLV(unittest.TestCase):
             system_description=b'Summit300-48 - Version 7.4e.1 (Build 5) '
                                + b'by Release_Master 05/27/05 04:53:11\x00')
         sys_cap = lldp.SystemCapabilities(
-            subtype=lldp.ChassisID.SUB_CHASSIS_COMPONENT,
             system_cap=0x14,
             enabled_cap=0x14)
         man_addr = lldp.ManagementAddress(

> Please forgive me for the first version of patch. This is my very first
> contribution to any public project and I have no idea what I am doing.
> I hope now the change will be acceptable.

Never mind. Whitespace issues are very common. :)

--
IWAMOTO Toshihiro

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to