bgp: simplify CLUSTER_LIST attribute parser

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
FUJITA Tomonori 2014-08-14 18:37:02 +09:00
parent 1f90cddd20
commit c37692cb10

View File

@ -1722,14 +1722,14 @@ class BGPPathAttributeClusterList(_PathAttribute):
def serialize_value(self):
buf = bytearray()
offset = 0
for cluster_id in self.value:
cluster_id_bin = bytearray()
msg_pack_into(
self._VALUE_PACK_STR,
cluster_id_bin,
0,
buf,
offset,
addrconv.ipv4.text_to_bin(cluster_id))
buf += cluster_id_bin
offset += struct.calcsize(self._VALUE_PACK_STR)
return buf