mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 03:55:20 +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;
|
||||
};
|
||||
|
||||
#define ENTERPRISE_NUMBER_CISCO 9
|
||||
#define ENTERPRISE_COLOR_CISCO 65540
|
||||
/* RFC 7470 */
|
||||
struct pcep_object_vendor_info {
|
||||
struct pcep_object_header header;
|
||||
uint32_t enterprise_number;
|
||||
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 */
|
||||
|
@ -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 *)common_object_create(
|
||||
hdr, sizeof(struct pcep_object_vendor_info));
|
||||
|
||||
obj->enterprise_number = ntohl(*((uint32_t *)(obj_buf)));
|
||||
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;
|
||||
}
|
||||
|
@ -53,16 +53,16 @@ extern "C" {
|
||||
* https://www.iana.org/assignments/pcep/pcep.xhtml */
|
||||
enum pcep_object_tlv_types {
|
||||
PCEP_OBJ_TLV_TYPE_NO_PATH_VECTOR = 1,
|
||||
PCEP_OBJ_TLV_TYPE_OBJECTIVE_FUNCTION_LIST = 4, /* RFC 5541 */
|
||||
PCEP_OBJ_TLV_TYPE_OBJECTIVE_FUNCTION_LIST = 4, /* RFC 5541 */
|
||||
PCEP_OBJ_TLV_TYPE_VENDOR_INFO = 7, /* RFC 7470 */
|
||||
PCEP_OBJ_TLV_TYPE_STATEFUL_PCE_CAPABILITY = 16, /* RFC 8231 */
|
||||
PCEP_OBJ_TLV_TYPE_SYMBOLIC_PATH_NAME = 17, /* RFC 8232 */
|
||||
PCEP_OBJ_TLV_TYPE_IPV4_LSP_IDENTIFIERS = 18, /* RFC 8231 */
|
||||
PCEP_OBJ_TLV_TYPE_IPV6_LSP_IDENTIFIERS = 19, /* RFC 8231 */
|
||||
PCEP_OBJ_TLV_TYPE_SYMBOLIC_PATH_NAME = 17, /* RFC 8232 */
|
||||
PCEP_OBJ_TLV_TYPE_IPV4_LSP_IDENTIFIERS = 18, /* RFC 8231 */
|
||||
PCEP_OBJ_TLV_TYPE_IPV6_LSP_IDENTIFIERS = 19, /* RFC 8231 */
|
||||
PCEP_OBJ_TLV_TYPE_LSP_ERROR_CODE = 20, /* RFC 8232 */
|
||||
PCEP_OBJ_TLV_TYPE_RSVP_ERROR_SPEC = 21, /* RFC 8232 */
|
||||
PCEP_OBJ_TLV_TYPE_LSP_DB_VERSION = 23, /* RFC 8232 */
|
||||
PCEP_OBJ_TLV_TYPE_SPEAKER_ENTITY_ID = 24, /* RFC 8232 */
|
||||
PCEP_OBJ_TLV_TYPE_SPEAKER_ENTITY_ID = 24, /* RFC 8232 */
|
||||
PCEP_OBJ_TLV_TYPE_SR_PCE_CAPABILITY =
|
||||
26, /* draft-ietf-pce-segment-routing-16 */
|
||||
PCEP_OBJ_TLV_TYPE_PATH_SETUP_TYPE = 28, /* RFC 8408 */
|
||||
@ -77,10 +77,12 @@ enum pcep_object_tlv_types {
|
||||
PCEP_OBJ_TLV_TYPE_SRPOLICY_CPATH_PREFERENCE =
|
||||
63, /*TDB5 draft-barth-pce-segment-routing-policy-cp-04 */
|
||||
PCEP_OBJ_TLV_TYPE_UNKNOWN = 128,
|
||||
PCEP_OBJ_TLV_TYPE_ARBITRARY =
|
||||
65533 /* Max IANA To write arbitrary data */
|
||||
PCEP_OBJ_TYPE_CISCO_BSID = 65505,
|
||||
/* Max IANA To write arbitrary data */
|
||||
PCEP_OBJ_TLV_TYPE_ARBITRARY = 65533
|
||||
};
|
||||
|
||||
|
||||
struct pcep_object_tlv_header {
|
||||
enum pcep_object_tlv_types type;
|
||||
/* 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;
|
||||
}
|
||||
|
||||
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) {
|
||||
pcep_log(LOG_INFO, "%s: No TLV decoder found for TLV type [%d]",
|
||||
__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.encoded_object_length, 60);
|
||||
CU_ASSERT_PTR_NOT_NULL(lsp->header.tlv_list);
|
||||
/* The TLV with ID 65505 is not recognized, and its not in the list */
|
||||
CU_ASSERT_EQUAL(lsp->header.tlv_list->num_entries, 2);
|
||||
/* The TLV with ID 65505 is now recognized, and its in the list */
|
||||
CU_ASSERT_EQUAL(lsp->header.tlv_list->num_entries, 3);
|
||||
CU_ASSERT_EQUAL(lsp->plsp_id, 524303);
|
||||
CU_ASSERT_EQUAL(lsp->operational_status, PCEP_LSP_OPERATIONAL_DOWN);
|
||||
CU_ASSERT_TRUE(lsp->flag_a);
|
||||
|
Loading…
Reference in New Issue
Block a user