mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-30 13:14:46 +00:00
pceplib: Extract fields needed for PcInitiated with Cisco pce. (1/4)
1.- Unknown/non-standard tlv where cisco sends BSID. 2.- Non-standard Vendor Info object where cisco sends color. Co-authored-by: Javier Garcia <javier.garcia@voltanet.io> Signed-off-by: Sebastien Merle <sebastien@netdef.org> Signed-off-by: Javier Garcia <javier.garcia@voltanet.io>
This commit is contained in:
parent
cd551a0fd5
commit
5fe7f5b479
@ -385,11 +385,16 @@ struct pcep_object_lsp {
|
|||||||
bool flag_c;
|
bool flag_c;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define ENTERPRISE_NUMBER_CISCO 9
|
||||||
|
#define ENTERPRISE_COLOR_CISCO 65540
|
||||||
/* RFC 7470 */
|
/* RFC 7470 */
|
||||||
struct pcep_object_vendor_info {
|
struct pcep_object_vendor_info {
|
||||||
struct pcep_object_header header;
|
struct pcep_object_header header;
|
||||||
uint32_t enterprise_number;
|
uint32_t enterprise_number;
|
||||||
uint32_t enterprise_specific_info;
|
uint32_t enterprise_specific_info;
|
||||||
|
uint32_t enterprise_specific_info1; /* cisco sends color for PcInit */
|
||||||
|
uint32_t enterprise_specific_info2;
|
||||||
|
uint32_t enterprise_specific_info3;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* RFC 8282 */
|
/* RFC 8282 */
|
||||||
|
@ -1339,8 +1339,15 @@ pcep_decode_obj_vendor_info(struct pcep_object_header *hdr,
|
|||||||
struct pcep_object_vendor_info *obj =
|
struct pcep_object_vendor_info *obj =
|
||||||
(struct pcep_object_vendor_info *)common_object_create(
|
(struct pcep_object_vendor_info *)common_object_create(
|
||||||
hdr, sizeof(struct pcep_object_vendor_info));
|
hdr, sizeof(struct pcep_object_vendor_info));
|
||||||
|
|
||||||
obj->enterprise_number = ntohl(*((uint32_t *)(obj_buf)));
|
obj->enterprise_number = ntohl(*((uint32_t *)(obj_buf)));
|
||||||
obj->enterprise_specific_info = ntohl(*((uint32_t *)(obj_buf + 4)));
|
obj->enterprise_specific_info = ntohl(*((uint32_t *)(obj_buf + 4)));
|
||||||
|
if (obj->enterprise_number == ENTERPRISE_NUMBER_CISCO
|
||||||
|
&& obj->enterprise_specific_info == ENTERPRISE_COLOR_CISCO)
|
||||||
|
obj->enterprise_specific_info1 =
|
||||||
|
ntohl(*((uint32_t *)(obj_buf + 8)));
|
||||||
|
else
|
||||||
|
obj->enterprise_specific_info1 = 0;
|
||||||
|
|
||||||
return (struct pcep_object_header *)obj;
|
return (struct pcep_object_header *)obj;
|
||||||
}
|
}
|
||||||
|
@ -77,10 +77,12 @@ enum pcep_object_tlv_types {
|
|||||||
PCEP_OBJ_TLV_TYPE_SRPOLICY_CPATH_PREFERENCE =
|
PCEP_OBJ_TLV_TYPE_SRPOLICY_CPATH_PREFERENCE =
|
||||||
63, /*TDB5 draft-barth-pce-segment-routing-policy-cp-04 */
|
63, /*TDB5 draft-barth-pce-segment-routing-policy-cp-04 */
|
||||||
PCEP_OBJ_TLV_TYPE_UNKNOWN = 128,
|
PCEP_OBJ_TLV_TYPE_UNKNOWN = 128,
|
||||||
PCEP_OBJ_TLV_TYPE_ARBITRARY =
|
PCEP_OBJ_TYPE_CISCO_BSID = 65505,
|
||||||
65533 /* Max IANA To write arbitrary data */
|
/* Max IANA To write arbitrary data */
|
||||||
|
PCEP_OBJ_TLV_TYPE_ARBITRARY = 65533
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct pcep_object_tlv_header {
|
struct pcep_object_tlv_header {
|
||||||
enum pcep_object_tlv_types type;
|
enum pcep_object_tlv_types type;
|
||||||
/* Pointer into encoded_message field from the pcep_message */
|
/* Pointer into encoded_message field from the pcep_message */
|
||||||
|
@ -838,7 +838,15 @@ struct pcep_object_tlv_header *pcep_decode_tlv(const uint8_t *tlv_buf)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
tlv_decoder_funcptr tlv_decoder = tlv_decoders[tlv_hdr.type];
|
tlv_decoder_funcptr tlv_decoder = NULL;
|
||||||
|
if (tlv_hdr.type == PCEP_OBJ_TYPE_CISCO_BSID) {
|
||||||
|
pcep_log(LOG_INFO,
|
||||||
|
"%s: Cisco BSID TLV decoder found for TLV type [%d]",
|
||||||
|
__func__, tlv_hdr.type);
|
||||||
|
tlv_decoder = tlv_decoders[PCEP_OBJ_TLV_TYPE_ARBITRARY];
|
||||||
|
} else {
|
||||||
|
tlv_decoder = tlv_decoders[tlv_hdr.type];
|
||||||
|
}
|
||||||
if (tlv_decoder == NULL) {
|
if (tlv_decoder == NULL) {
|
||||||
pcep_log(LOG_INFO, "%s: No TLV decoder found for TLV type [%d]",
|
pcep_log(LOG_INFO, "%s: No TLV decoder found for TLV type [%d]",
|
||||||
__func__, tlv_hdr.type);
|
__func__, tlv_hdr.type);
|
||||||
|
@ -809,8 +809,8 @@ void test_pcep_msg_read_pcep_report_cisco_pcc()
|
|||||||
CU_ASSERT_EQUAL(lsp->header.object_type, PCEP_OBJ_TYPE_LSP);
|
CU_ASSERT_EQUAL(lsp->header.object_type, PCEP_OBJ_TYPE_LSP);
|
||||||
CU_ASSERT_EQUAL(lsp->header.encoded_object_length, 60);
|
CU_ASSERT_EQUAL(lsp->header.encoded_object_length, 60);
|
||||||
CU_ASSERT_PTR_NOT_NULL(lsp->header.tlv_list);
|
CU_ASSERT_PTR_NOT_NULL(lsp->header.tlv_list);
|
||||||
/* The TLV with ID 65505 is not recognized, and its not in the list */
|
/* The TLV with ID 65505 is now recognized, and its in the list */
|
||||||
CU_ASSERT_EQUAL(lsp->header.tlv_list->num_entries, 2);
|
CU_ASSERT_EQUAL(lsp->header.tlv_list->num_entries, 3);
|
||||||
CU_ASSERT_EQUAL(lsp->plsp_id, 524303);
|
CU_ASSERT_EQUAL(lsp->plsp_id, 524303);
|
||||||
CU_ASSERT_EQUAL(lsp->operational_status, PCEP_LSP_OPERATIONAL_DOWN);
|
CU_ASSERT_EQUAL(lsp->operational_status, PCEP_LSP_OPERATIONAL_DOWN);
|
||||||
CU_ASSERT_TRUE(lsp->flag_a);
|
CU_ASSERT_TRUE(lsp->flag_a);
|
||||||
|
Loading…
Reference in New Issue
Block a user