summaryrefslogtreecommitdiffstats
path: root/pceplib
diff options
context:
space:
mode:
Diffstat (limited to 'pceplib')
-rw-r--r--pceplib/pcep_session_logic_counters.c193
-rw-r--r--pceplib/pcep_socket_comm_mock.c2
-rw-r--r--pceplib/pcep_utils_counters.c10
-rw-r--r--pceplib/pcep_utils_counters.h27
-rw-r--r--pceplib/test/pcep_msg_messages_test.c50
-rw-r--r--pceplib/test/pcep_msg_object_error_types_test.c4
-rw-r--r--pceplib/test/pcep_msg_objects_test.c71
-rw-r--r--pceplib/test/pcep_msg_tlvs_test.c63
-rw-r--r--pceplib/test/pcep_msg_tools_test.c24
-rw-r--r--pceplib/test/pcep_pcc_api_test.c24
-rw-r--r--pceplib/test/pcep_utils_counters_test.c50
11 files changed, 264 insertions, 254 deletions
diff --git a/pceplib/pcep_session_logic_counters.c b/pceplib/pcep_session_logic_counters.c
index 6f6f2a0..b12b8ab 100644
--- a/pceplib/pcep_session_logic_counters.c
+++ b/pceplib/pcep_session_logic_counters.c
@@ -36,30 +36,30 @@ void create_session_counters(pcep_session *session)
struct counters_subgroup *rx_msg_subgroup = create_counters_subgroup(
"RX Message counters", COUNTER_SUBGROUP_ID_RX_MSG,
PCEP_TYPE_MAX + 1);
- create_subgroup_counter(rx_msg_subgroup, PCEP_TYPE_OPEN,
- "Message Open");
+ create_subgroup_counter(rx_msg_subgroup, PCEP_TYPE_OPEN, "Message Open",
+ "messageOpen");
create_subgroup_counter(rx_msg_subgroup, PCEP_TYPE_KEEPALIVE,
- "Message KeepAlive");
+ "Message KeepAlive", "messageKeepalive");
create_subgroup_counter(rx_msg_subgroup, PCEP_TYPE_PCREQ,
- "Message PcReq");
+ "Message PcReq", "messagePcReq");
create_subgroup_counter(rx_msg_subgroup, PCEP_TYPE_PCREP,
- "Message PcRep");
+ "Message PcRep", "messagePcRep");
create_subgroup_counter(rx_msg_subgroup, PCEP_TYPE_PCNOTF,
- "Message Notify");
+ "Message Notify", "messageNotify");
create_subgroup_counter(rx_msg_subgroup, PCEP_TYPE_ERROR,
- "Message Error");
+ "Message Error", "messageError");
create_subgroup_counter(rx_msg_subgroup, PCEP_TYPE_CLOSE,
- "Message Close");
+ "Message Close", "messageClose");
create_subgroup_counter(rx_msg_subgroup, PCEP_TYPE_REPORT,
- "Message Report");
+ "Message Report", "messageReport");
create_subgroup_counter(rx_msg_subgroup, PCEP_TYPE_UPDATE,
- "Message Update");
+ "Message Update", "messageUpdate");
create_subgroup_counter(rx_msg_subgroup, PCEP_TYPE_INITIATE,
- "Message Initiate");
+ "Message Initiate", "messageInitiate");
create_subgroup_counter(rx_msg_subgroup, PCEP_TYPE_START_TLS,
- "Message StartTls");
+ "Message StartTls", "messageStartTls");
create_subgroup_counter(rx_msg_subgroup, PCEP_TYPE_MAX,
- "Message Erroneous");
+ "Message Erroneous", "messageErroneous");
struct counters_subgroup *tx_msg_subgroup =
clone_counters_subgroup(rx_msg_subgroup, "TX Message counters",
@@ -74,59 +74,61 @@ void create_session_counters(pcep_session *session)
struct counters_subgroup *rx_obj_subgroup = create_counters_subgroup(
"RX Object counters", COUNTER_SUBGROUP_ID_RX_OBJ, 100);
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_OPEN,
- "Object Open");
- create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_RP,
- "Object RP");
+ "Object Open", "objectOpen");
+ create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_RP, "Object RP",
+ "objectRP");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_NOPATH,
- "Object Nopath");
- create_subgroup_counter(
- rx_obj_subgroup,
- ((PCEP_OBJ_CLASS_ENDPOINTS << 4) | PCEP_OBJ_TYPE_ENDPOINT_IPV4),
- "Object Endpoint IPv4");
- create_subgroup_counter(
- rx_obj_subgroup,
- ((PCEP_OBJ_CLASS_ENDPOINTS << 4) | PCEP_OBJ_TYPE_ENDPOINT_IPV6),
- "Object Endpoint IPv6");
+ "Object Nopath", "objectNopath");
+ create_subgroup_counter(rx_obj_subgroup,
+ ((PCEP_OBJ_CLASS_ENDPOINTS << 4) |
+ PCEP_OBJ_TYPE_ENDPOINT_IPV4),
+ "Object Endpoint IPv4", "objectEndpointIPv4");
+ create_subgroup_counter(rx_obj_subgroup,
+ ((PCEP_OBJ_CLASS_ENDPOINTS << 4) |
+ PCEP_OBJ_TYPE_ENDPOINT_IPV6),
+ "Object Endpoint IPv6", "objectEndpointIPv6");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_BANDWIDTH,
- "Object Bandwidth");
+ "Object Bandwidth", "objectBandwidth");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_METRIC,
- "Object Metric");
+ "Object Metric", "objectMetric");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_ERO,
- "Object ERO");
+ "Object ERO", "objectERO");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_RRO,
- "Object RRO");
+ "Object RRO", "objectRRO");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_LSPA,
- "Object LSPA");
+ "Object LSPA", "objectLSPA");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_IRO,
- "Object IRO");
+ "Object IRO", "objectIRO");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_SVEC,
- "Object SVEC");
+ "Object SVEC", "objectSVEC");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_NOTF,
- "Object Notify");
+ "Object Notify", "objectNotify");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_ERROR,
- "Object Error");
+ "Object Error", "objectError");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_CLOSE,
- "Object Close");
+ "Object Close", "objectClose");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_LSP,
- "Object LSP");
+ "Object LSP", "objectLSP");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_SRP,
- "Object SRP");
+ "Object SRP", "objectSRP");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_VENDOR_INFO,
- "Object Vendor Info");
+ "Object Vendor Info", "objectVendorInfo");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_INTER_LAYER,
- "Object Inter-Layer");
+ "Object Inter-Layer", "objectInterLayer");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_SWITCH_LAYER,
- "Object Switch-Layer");
+ "Object Switch-Layer", "objectSwitchLayer");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_REQ_ADAP_CAP,
- "Object Requested Adap-Cap");
+ "Object Requested Adap-Cap",
+ "objectRequestedAdapCap");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_SERVER_IND,
- "Object Server-Indication");
+ "Object Server-Indication",
+ "objectServerIndication");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_ASSOCIATION,
- "Object Association");
+ "Object Association", "objectAssociation");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_MAX,
- "Object Unknown");
+ "Object Unknown", "objectUnknown");
create_subgroup_counter(rx_obj_subgroup, PCEP_OBJ_CLASS_MAX + 1,
- "Object Erroneous");
+ "Object Erroneous", "objectErroneous");
struct counters_subgroup *tx_obj_subgroup =
clone_counters_subgroup(rx_obj_subgroup, "TX Object counters",
@@ -139,21 +141,22 @@ void create_session_counters(pcep_session *session)
"RX RO Sub-Object counters", COUNTER_SUBGROUP_ID_RX_SUBOBJ,
RO_SUBOBJ_UNKNOWN + 2);
create_subgroup_counter(rx_subobj_subgroup, RO_SUBOBJ_TYPE_IPV4,
- "RO Sub-Object IPv4");
+ "RO Sub-Object IPv4", "ROSubObjectIPv4");
create_subgroup_counter(rx_subobj_subgroup, RO_SUBOBJ_TYPE_IPV6,
- "RO Sub-Object IPv6");
+ "RO Sub-Object IPv6", "ROSubObjectIPv6");
create_subgroup_counter(rx_subobj_subgroup, RO_SUBOBJ_TYPE_LABEL,
- "RO Sub-Object Label");
+ "RO Sub-Object Label", "ROSubObjectLabel");
create_subgroup_counter(rx_subobj_subgroup, RO_SUBOBJ_TYPE_UNNUM,
- "RO Sub-Object Unnum");
+ "RO Sub-Object Unnum", "ROSubObjectUnnum");
create_subgroup_counter(rx_subobj_subgroup, RO_SUBOBJ_TYPE_ASN,
- "RO Sub-Object ASN");
+ "RO Sub-Object ASN", "ROSubObjectASN");
create_subgroup_counter(rx_subobj_subgroup, RO_SUBOBJ_TYPE_SR,
- "RO Sub-Object SR");
+ "RO Sub-Object SR", "ROSubObjectSR");
create_subgroup_counter(rx_subobj_subgroup, RO_SUBOBJ_UNKNOWN,
- "RO Sub-Object Unknown");
+ "RO Sub-Object Unknown", "ROSubObjectUnknown");
create_subgroup_counter(rx_subobj_subgroup, RO_SUBOBJ_UNKNOWN + 1,
- "RO Sub-Object Erroneous");
+ "RO Sub-Object Erroneous",
+ "ROSubObjectErroneous");
struct counters_subgroup *tx_subobj_subgroup = clone_counters_subgroup(
rx_subobj_subgroup, "TX RO Sub-Object counters",
@@ -168,28 +171,36 @@ void create_session_counters(pcep_session *session)
PCEP_SR_SUBOBJ_NAI_UNKNOWN + 1);
create_subgroup_counter(rx_subobj_sr_nai_subgroup,
PCEP_SR_SUBOBJ_NAI_ABSENT,
- "RO Sub-Object SR NAI absent");
+ "RO Sub-Object SR NAI absent",
+ "ROSubObjectSRNAIAbsent");
create_subgroup_counter(rx_subobj_sr_nai_subgroup,
PCEP_SR_SUBOBJ_NAI_IPV4_NODE,
- "RO Sub-Object SR NAI IPv4 Node");
+ "RO Sub-Object SR NAI IPv4 Node",
+ "ROSubObjectSRNAIIPv4Node");
create_subgroup_counter(rx_subobj_sr_nai_subgroup,
PCEP_SR_SUBOBJ_NAI_IPV6_NODE,
- "RO Sub-Object SR NAI IPv6 Node");
+ "RO Sub-Object SR NAI IPv6 Node",
+ "ROSubObjectSRNAIIPv6Node");
create_subgroup_counter(rx_subobj_sr_nai_subgroup,
PCEP_SR_SUBOBJ_NAI_IPV4_ADJACENCY,
- "RO Sub-Object SR NAI IPv4 Adj");
+ "RO Sub-Object SR NAI IPv4 Adj",
+ "ROSubObjectSRNAIIPv4Adj");
create_subgroup_counter(rx_subobj_sr_nai_subgroup,
PCEP_SR_SUBOBJ_NAI_IPV6_ADJACENCY,
- "RO Sub-Object SR NAI IPv6 Adj");
+ "RO Sub-Object SR NAI IPv6 Adj",
+ "ROSubObjectSRNAIIPv6Adj");
create_subgroup_counter(rx_subobj_sr_nai_subgroup,
PCEP_SR_SUBOBJ_NAI_UNNUMBERED_IPV4_ADJACENCY,
- "RO Sub-Object SR NAI Unnumbered IPv4 Adj");
+ "RO Sub-Object SR NAI Unnumbered IPv4 Adj",
+ "ROSubObjectSRNAIUnnumberedIPv4Adj");
create_subgroup_counter(rx_subobj_sr_nai_subgroup,
PCEP_SR_SUBOBJ_NAI_LINK_LOCAL_IPV6_ADJACENCY,
- "RO Sub-Object SR NAI Link Local IPv6 Adj");
+ "RO Sub-Object SR NAI Link Local IPv6 Adj",
+ "ROSubObjectSRNAILinkLocalIPv6Adj");
create_subgroup_counter(rx_subobj_sr_nai_subgroup,
PCEP_SR_SUBOBJ_NAI_UNKNOWN,
- "RO Sub-Object SR NAI Unknown");
+ "RO Sub-Object SR NAI Unknown",
+ "ROSubObjectSRNAIUnknown");
struct counters_subgroup *tx_subobj_sr_nai_subgroup =
clone_counters_subgroup(rx_subobj_sr_nai_subgroup,
@@ -204,56 +215,60 @@ void create_session_counters(pcep_session *session)
PCEP_OBJ_TLV_TYPE_UNKNOWN + 1);
create_subgroup_counter(rx_tlv_subgroup,
PCEP_OBJ_TLV_TYPE_NO_PATH_VECTOR,
- "TLV No Path Vector");
+ "TLV No Path Vector", "TLVNoPathVector");
create_subgroup_counter(rx_tlv_subgroup, PCEP_OBJ_TLV_TYPE_VENDOR_INFO,
- "TLV Vendor Info");
+ "TLV Vendor Info", "TLVVendorInfo");
create_subgroup_counter(rx_tlv_subgroup,
PCEP_OBJ_TLV_TYPE_STATEFUL_PCE_CAPABILITY,
- "TLV Stateful PCE Capability");
+ "TLV Stateful PCE Capability",
+ "TLVStatefulPCCapability");
create_subgroup_counter(rx_tlv_subgroup,
PCEP_OBJ_TLV_TYPE_SYMBOLIC_PATH_NAME,
- "TLV Symbolic Path Name");
+ "TLV Symbolic Path Name", "TLVSymbolicPathName");
create_subgroup_counter(rx_tlv_subgroup,
PCEP_OBJ_TLV_TYPE_IPV4_LSP_IDENTIFIERS,
- "TLV IPv4 LSP Identifier");
+ "TLV IPv4 LSP Identifier",
+ "TLVIPv4LSPIdentifier");
create_subgroup_counter(rx_tlv_subgroup,
PCEP_OBJ_TLV_TYPE_IPV6_LSP_IDENTIFIERS,
- "TLV IPv6 LSP Identifier");
+ "TLV IPv6 LSP Identifier",
+ "TLVIPv6LSPIdentifier");
create_subgroup_counter(rx_tlv_subgroup,
PCEP_OBJ_TLV_TYPE_LSP_ERROR_CODE,
- "TLV LSP Error Code");
+ "TLV LSP Error Code", "TLVLSPErrorCode");
create_subgroup_counter(rx_tlv_subgroup,
PCEP_OBJ_TLV_TYPE_RSVP_ERROR_SPEC,
- "TLV RSVP Error Spec");
+ "TLV RSVP Error Spec", "TLVRSVPErrorSpec");
create_subgroup_counter(rx_tlv_subgroup,
PCEP_OBJ_TLV_TYPE_LSP_DB_VERSION,
- "TLV LSP DB Version");
+ "TLV LSP DB Version", "TLVLSPDBVersion");
create_subgroup_counter(rx_tlv_subgroup,
PCEP_OBJ_TLV_TYPE_SPEAKER_ENTITY_ID,
- "TLV Speaker Entity ID");
+ "TLV Speaker Entity ID", "TLVSpeakerEntityId");
create_subgroup_counter(rx_tlv_subgroup,
PCEP_OBJ_TLV_TYPE_SR_PCE_CAPABILITY,
- "TLV SR PCE Capability");
+ "TLV SR PCE Capability", "TLVSRPCECapability");
create_subgroup_counter(rx_tlv_subgroup,
PCEP_OBJ_TLV_TYPE_PATH_SETUP_TYPE,
- "TLV Path Setup Type");
+ "TLV Path Setup Type", "TLVPathSetupType");
create_subgroup_counter(rx_tlv_subgroup,
PCEP_OBJ_TLV_TYPE_PATH_SETUP_TYPE_CAPABILITY,
- "TLV Path Setup Type Capability");
+ "TLV Path Setup Type Capability",
+ "TLVPathSetupTypeCapability");
create_subgroup_counter(rx_tlv_subgroup,
PCEP_OBJ_TLV_TYPE_SRPOLICY_POL_ID,
- "TLV SR Policy PolId");
+ "TLV SR Policy PolId", "TLVSRPolicyPolId");
create_subgroup_counter(rx_tlv_subgroup,
PCEP_OBJ_TLV_TYPE_SRPOLICY_POL_NAME,
- "TLV SR Policy PolName");
+ "TLV SR Policy PolName", "TLVSRPolicyPolName");
create_subgroup_counter(rx_tlv_subgroup,
PCEP_OBJ_TLV_TYPE_SRPOLICY_CPATH_ID,
- "TLV SR Policy CpathId");
+ "TLV SR Policy CpathId", "TLVSRPolicyCpathId");
create_subgroup_counter(rx_tlv_subgroup,
PCEP_OBJ_TLV_TYPE_SRPOLICY_CPATH_PREFERENCE,
- "TLV SR Policy CpathRef");
+ "TLV SR Policy CpathRef", "TLVSRPolicyCpathRef");
create_subgroup_counter(rx_tlv_subgroup, PCEP_OBJ_TLV_TYPE_UNKNOWN,
- "TLV Unknown");
+ "TLV Unknown", "TLVUnknown");
struct counters_subgroup *tx_tlv_subgroup = clone_counters_subgroup(
rx_tlv_subgroup, "TX TLV counters", COUNTER_SUBGROUP_ID_TX_TLV);
@@ -265,28 +280,32 @@ void create_session_counters(pcep_session *session)
"Events counters", COUNTER_SUBGROUP_ID_EVENT, MAX_COUNTERS);
create_subgroup_counter(events_subgroup,
PCEP_EVENT_COUNTER_ID_PCC_CONNECT,
- "PCC connect");
+ "PCC connect", "PCCConnect");
create_subgroup_counter(events_subgroup,
PCEP_EVENT_COUNTER_ID_PCE_CONNECT,
- "PCE connect");
+ "PCE connect", "PCEConnect");
create_subgroup_counter(events_subgroup,
PCEP_EVENT_COUNTER_ID_PCC_DISCONNECT,
- "PCC disconnect");
+ "PCC disconnect", "PCCDisconnect");
create_subgroup_counter(events_subgroup,
PCEP_EVENT_COUNTER_ID_PCE_DISCONNECT,
- "PCE disconnect");
+ "PCE disconnect", "PCEDisconnect");
create_subgroup_counter(events_subgroup,
PCEP_EVENT_COUNTER_ID_TIMER_KEEPALIVE,
- "Timer KeepAlive expired");
+ "Timer KeepAlive expired",
+ "timerKeepAliveExpired");
create_subgroup_counter(events_subgroup,
PCEP_EVENT_COUNTER_ID_TIMER_DEADTIMER,
- "Timer DeadTimer expired");
+ "Timer DeadTimer expired",
+ "timerDeadTimerExpired");
create_subgroup_counter(events_subgroup,
PCEP_EVENT_COUNTER_ID_TIMER_OPENKEEPWAIT,
- "Timer OpenKeepWait expired");
+ "Timer OpenKeepWait expired",
+ "timerOpenKeepWaitExpired");
create_subgroup_counter(events_subgroup,
PCEP_EVENT_COUNTER_ID_TIMER_OPENKEEPALIVE,
- "Timer OpenKeepAlive expired");
+ "Timer OpenKeepAlive expired",
+ "timerOpenKeepAliveExpired");
/*
* Create the parent counters group
diff --git a/pceplib/pcep_socket_comm_mock.c b/pceplib/pcep_socket_comm_mock.c
index 24755ef..bda9b1f 100644
--- a/pceplib/pcep_socket_comm_mock.c
+++ b/pceplib/pcep_socket_comm_mock.c
@@ -115,7 +115,7 @@ bool initialize_socket_comm_external_infra(
return true;
}
-bool destroy_socket_comm_loop()
+bool destroy_socket_comm_loop(void)
{
mock_socket_metadata.destroy_socket_comm_loop_times_called++;
diff --git a/pceplib/pcep_utils_counters.c b/pceplib/pcep_utils_counters.c
index badef93..1ab341c 100644
--- a/pceplib/pcep_utils_counters.c
+++ b/pceplib/pcep_utils_counters.c
@@ -139,7 +139,8 @@ clone_counters_subgroup(struct counters_subgroup *subgroup,
if (counter != NULL) {
create_subgroup_counter(cloned_subgroup,
counter->counter_id,
- counter->counter_name);
+ counter->counter_name,
+ counter->counter_name_json);
}
}
@@ -180,7 +181,8 @@ bool add_counters_subgroup(struct counters_group *group,
}
bool create_subgroup_counter(struct counters_subgroup *subgroup,
- uint32_t counter_id, const char *counter_name)
+ uint32_t counter_id, const char *counter_name,
+ const char *counter_name_json)
{
if (subgroup == NULL) {
pcep_log(
@@ -212,7 +214,9 @@ bool create_subgroup_counter(struct counters_subgroup *subgroup,
counter->counter_id = counter_id;
strlcpy(counter->counter_name, counter_name,
sizeof(counter->counter_name));
-
+ if (counter_name_json)
+ strlcpy(counter->counter_name_json, counter_name_json,
+ sizeof(counter->counter_name_json));
subgroup->num_counters++;
subgroup->counters[counter->counter_id] = counter;
diff --git a/pceplib/pcep_utils_counters.h b/pceplib/pcep_utils_counters.h
index 755c94e..dfae02f 100644
--- a/pceplib/pcep_utils_counters.h
+++ b/pceplib/pcep_utils_counters.h
@@ -55,18 +55,18 @@ extern "C" {
* *events_subgroup = create_counters_subgroup("events counters", 4);
*
* Use message_id: PCEP_TYPE_OPEN=1
- * create_subgroup_counter(rx_subgroup, 1, "Message Open");
- * create_subgroup_counter(rx_subgroup, 2, "Message KeepAlive");
- * create_subgroup_counter(rx_subgroup, 3, "Message PcReq");
+ * create_subgroup_counter(rx_subgroup, 1, "Message Open", "messageOpen");
+ * create_subgroup_counter(rx_subgroup, 2, "Message KeepAlive", "messageKeepAlive");
+ * create_subgroup_counter(rx_subgroup, 3, "Message PcReq", "messagePcReq");
*
- * create_subgroup_counter(tx_subgroup, 1, "Message Open");
- * create_subgroup_counter(tx_subgroup, 2, "Message KeepAlive");
- * create_subgroup_counter(tx_subgroup, 3, "Message PcReq");
+ * create_subgroup_counter(tx_subgroup, 1, "Message Open", "messageOpen");
+ * create_subgroup_counter(tx_subgroup, 2, "Message KeepAlive", "messageKeepAlive");
+ * create_subgroup_counter(tx_subgroup, 3, "Message PcReq", "messagePcReq");
*
- * create_subgroup_counter(events_subgroup, 1, "PCC Connect");
- * create_subgroup_counter(events_subgroup, 2, "PCE Connect");
- * create_subgroup_counter(events_subgroup, 3, "PCC Disconnect");
- * create_subgroup_counter(events_subgroup, 4, "PCE Disconnect");
+ * create_subgroup_counter(events_subgroup, 1, "PCC Connect", "PCConnect");
+ * create_subgroup_counter(events_subgroup, 2, "PCE Connect", "PCEConnect");
+ * create_subgroup_counter(events_subgroup, 3, "PCC Disconnect", "PCCDisconnect");
+ * create_subgroup_counter(events_subgroup, 4, "PCE Disconnect", "PCEDisconnect");
*
* struct counters_group *cntrs_group = create_counters_group("PCEP Counters",
* 3); add_counters_subgroup(cntrs_group, rx_subgroup);
@@ -81,6 +81,7 @@ extern "C" {
struct counter {
uint16_t counter_id;
char counter_name[MAX_COUNTER_STR_LENGTH];
+ char counter_name_json[MAX_COUNTER_STR_LENGTH];
uint32_t counter_value;
};
@@ -142,13 +143,15 @@ clone_counters_subgroup(struct counters_subgroup *subgroup,
const char *subgroup_name, uint16_t subgroup_id);
/*
- * Create a counter in a subgroup with the given counter_id and counter_name.
+ * Create a counter in a subgroup with the given counter_id and counter_name
+ * and counter_name_json.
* The counter_id is 0-based.
* Return true on success or false if subgroup is NULL, counter_id >=
* MAX_COUNTERS, or if counter_name is NULL.
*/
bool create_subgroup_counter(struct counters_subgroup *subgroup,
- uint32_t counter_id, const char *counter_name);
+ uint32_t counter_id, const char *counter_name,
+ const char *couter_name_json);
/*
* Delete the counters_group and recursively delete all subgroups and their
diff --git a/pceplib/test/pcep_msg_messages_test.c b/pceplib/test/pcep_msg_messages_test.c
index c4eaeaa..e1f5249 100644
--- a/pceplib/test/pcep_msg_messages_test.c
+++ b/pceplib/test/pcep_msg_messages_test.c
@@ -48,17 +48,17 @@ int pcep_messages_test_suite_teardown(void)
return 0;
}
-void pcep_messages_test_setup()
+void pcep_messages_test_setup(void)
{
versioning = create_default_pcep_versioning();
}
-void pcep_messages_test_teardown()
+void pcep_messages_test_teardown(void)
{
destroy_pcep_versioning(versioning);
}
-void test_pcep_msg_create_open()
+void test_pcep_msg_create_open(void)
{
uint8_t keepalive = 30;
uint8_t deadtimer = 60;
@@ -96,8 +96,7 @@ void test_pcep_msg_create_open()
pcep_msg_free_message(message);
}
-
-void test_pcep_msg_create_request()
+void test_pcep_msg_create_request(void)
{
/* First test with NULL objects */
struct pcep_message *message =
@@ -185,13 +184,11 @@ void test_pcep_msg_create_request()
pcep_msg_free_message(message);
}
-
-void test_pcep_msg_create_request_svec()
+void test_pcep_msg_create_request_svec(void)
{
}
-
-void test_pcep_msg_create_reply_nopath()
+void test_pcep_msg_create_reply_nopath(void)
{
struct pcep_object_rp *rp_obj =
pcep_obj_create_rp(0, false, false, false, false, 10, NULL);
@@ -219,8 +216,7 @@ void test_pcep_msg_create_reply_nopath()
pcep_msg_free_message(message);
}
-
-void test_pcep_msg_create_reply()
+void test_pcep_msg_create_reply(void)
{
/* First test with NULL ero and rp objects */
struct pcep_message *message = pcep_msg_create_reply(NULL, NULL);
@@ -268,8 +264,7 @@ void test_pcep_msg_create_reply()
pcep_msg_free_message(message);
}
-
-void test_pcep_msg_create_close()
+void test_pcep_msg_create_close(void)
{
uint8_t reason = PCEP_CLOSE_REASON_UNREC_MSG;
@@ -301,8 +296,7 @@ void test_pcep_msg_create_close()
pcep_msg_free_message(message);
}
-
-void test_pcep_msg_create_error()
+void test_pcep_msg_create_error(void)
{
uint8_t error_type = PCEP_ERRT_RECEPTION_OF_INV_OBJECT;
uint8_t error_value = PCEP_ERRV_KEEPALIVEWAIT_TIMED_OUT;
@@ -337,8 +331,7 @@ void test_pcep_msg_create_error()
pcep_msg_free_message(message);
}
-
-void test_pcep_msg_create_keepalive()
+void test_pcep_msg_create_keepalive(void)
{
struct pcep_message *message = pcep_msg_create_keepalive();
CU_ASSERT_PTR_NOT_NULL(message);
@@ -356,7 +349,7 @@ void test_pcep_msg_create_keepalive()
pcep_msg_free_message(message);
}
-void test_pcep_msg_create_report()
+void test_pcep_msg_create_report(void)
{
double_linked_list *obj_list = dll_initialize();
@@ -387,7 +380,7 @@ void test_pcep_msg_create_report()
pcep_msg_free_message(message);
}
-void test_pcep_msg_create_update()
+void test_pcep_msg_create_update(void)
{
double_linked_list *obj_list = dll_initialize();
double_linked_list *ero_subobj_list = dll_initialize();
@@ -398,10 +391,8 @@ void test_pcep_msg_create_update()
/* Should return NULL if obj_list is empty */
message = pcep_msg_create_update(obj_list);
CU_ASSERT_PTR_NULL(message);
- if (message != NULL) {
+ if (message != NULL)
pcep_msg_free_message(message);
- message = NULL;
- }
struct pcep_object_srp *srp = pcep_obj_create_srp(false, 100, NULL);
struct pcep_object_lsp *lsp =
@@ -417,10 +408,9 @@ void test_pcep_msg_create_update()
CU_ASSERT_PTR_NULL(message);
dll_append(obj_list, ero);
- if (message != NULL) {
+ if (message != NULL)
pcep_msg_free_message(message);
- message = NULL;
- }
+
message = pcep_msg_create_update(obj_list);
CU_ASSERT_PTR_NOT_NULL(message);
pcep_encode_message(message, versioning);
@@ -442,7 +432,7 @@ void test_pcep_msg_create_update()
pcep_msg_free_message(message);
}
-void test_pcep_msg_create_initiate()
+void test_pcep_msg_create_initiate(void)
{
double_linked_list *obj_list = dll_initialize();
double_linked_list *ero_subobj_list = dll_initialize();
@@ -450,10 +440,8 @@ void test_pcep_msg_create_initiate()
/* Should return NULL if obj_list is empty */
struct pcep_message *message = pcep_msg_create_initiate(NULL);
CU_ASSERT_PTR_NULL(message);
- if (message != NULL) {
+ if (message != NULL)
pcep_msg_free_message(message);
- message = NULL;
- }
struct pcep_object_srp *srp = pcep_obj_create_srp(false, 100, NULL);
struct pcep_object_lsp *lsp =
@@ -466,10 +454,8 @@ void test_pcep_msg_create_initiate()
dll_append(obj_list, srp);
message = pcep_msg_create_initiate(obj_list);
CU_ASSERT_PTR_NULL(message);
- if (message != NULL) {
+ if (message != NULL)
pcep_msg_free_message(message);
- message = NULL;
- }
dll_append(obj_list, lsp);
dll_append(obj_list, ero);
diff --git a/pceplib/test/pcep_msg_object_error_types_test.c b/pceplib/test/pcep_msg_object_error_types_test.c
index 3237fec..b7198fb 100644
--- a/pceplib/test/pcep_msg_object_error_types_test.c
+++ b/pceplib/test/pcep_msg_object_error_types_test.c
@@ -44,7 +44,7 @@ void pcep_object_error_types_test_teardown(void)
{
}
-void test_get_error_type_str()
+void test_get_error_type_str(void)
{
const char *error_type_str;
int i = 0;
@@ -57,7 +57,7 @@ void test_get_error_type_str()
CU_ASSERT_PTR_NULL(get_error_type_str(MAX_ERROR_TYPE));
}
-void test_get_error_value_str()
+void test_get_error_value_str(void)
{
const char *error_value_str;
int i = 0, j = 0;
diff --git a/pceplib/test/pcep_msg_objects_test.c b/pceplib/test/pcep_msg_objects_test.c
index 1315fe3..0a1d34d 100644
--- a/pceplib/test/pcep_msg_objects_test.c
+++ b/pceplib/test/pcep_msg_objects_test.c
@@ -49,18 +49,18 @@ int pcep_objects_test_suite_teardown(void)
return 0;
}
-void reset_objects_buffer()
+void reset_objects_buffer(void)
{
memset(object_buf, 0, 2000);
}
-void pcep_objects_test_setup()
+void pcep_objects_test_setup(void)
{
versioning = create_default_pcep_versioning();
reset_objects_buffer();
}
-void pcep_objects_test_teardown()
+void pcep_objects_test_teardown(void)
{
destroy_pcep_versioning(versioning);
}
@@ -123,7 +123,7 @@ static void verify_pcep_obj_header(uint8_t obj_class, uint8_t obj_type,
obj_hdr->encoded_object);
}
-void test_pcep_obj_create_open()
+void test_pcep_obj_create_open(void)
{
uint8_t deadtimer = 60;
uint8_t keepalive = 30;
@@ -147,7 +147,7 @@ void test_pcep_obj_create_open()
pcep_obj_free_object((struct pcep_object_header *)open);
}
-void test_pcep_obj_create_open_with_tlvs()
+void test_pcep_obj_create_open_with_tlvs(void)
{
uint8_t deadtimer = 60;
uint8_t keepalive = 30;
@@ -182,7 +182,7 @@ void test_pcep_obj_create_open_with_tlvs()
pcep_obj_free_object((struct pcep_object_header *)open);
}
-void test_pcep_obj_create_rp()
+void test_pcep_obj_create_rp(void)
{
uint32_t reqid = 15;
uint8_t invalid_priority = 100;
@@ -213,7 +213,7 @@ void test_pcep_obj_create_rp()
pcep_obj_free_object((struct pcep_object_header *)rp);
}
-void test_pcep_obj_create_nopath()
+void test_pcep_obj_create_nopath(void)
{
uint8_t ni = 8;
uint32_t errorcode = 42;
@@ -251,7 +251,8 @@ void test_pcep_obj_create_nopath()
pcep_obj_free_object((struct pcep_object_header *)nopath);
}
-void test_pcep_obj_create_association_ipv4()
+
+void test_pcep_obj_create_association_ipv4(void)
{
uint16_t all_assoc_groups = 0xffff;
@@ -275,7 +276,7 @@ void test_pcep_obj_create_association_ipv4()
pcep_obj_free_object((struct pcep_object_header *)assoc);
}
-void test_pcep_obj_create_association_ipv6()
+void test_pcep_obj_create_association_ipv6(void)
{
uint32_t all_assoc_groups = 0xffff;
struct in6_addr src;
@@ -305,7 +306,7 @@ void test_pcep_obj_create_association_ipv6()
pcep_obj_free_object((struct pcep_object_header *)assoc);
}
-void test_pcep_obj_create_endpoint_ipv4()
+void test_pcep_obj_create_endpoint_ipv4(void)
{
struct in_addr src_ipv4, dst_ipv4;
inet_pton(AF_INET, "192.168.1.2", &src_ipv4);
@@ -334,7 +335,7 @@ void test_pcep_obj_create_endpoint_ipv4()
pcep_obj_free_object((struct pcep_object_header *)ipv4);
}
-void test_pcep_obj_create_endpoint_ipv6()
+void test_pcep_obj_create_endpoint_ipv6(void)
{
struct in6_addr src_ipv6, dst_ipv6;
inet_pton(AF_INET6, "2001:db8::8a2e:370:7334", &src_ipv6);
@@ -368,7 +369,7 @@ void test_pcep_obj_create_endpoint_ipv6()
pcep_obj_free_object((struct pcep_object_header *)ipv6);
}
-void test_pcep_obj_create_bandwidth()
+void test_pcep_obj_create_bandwidth(void)
{
/* 1.8 => binary 1.11001101
* exponent = 127 => 0111 1111
@@ -389,7 +390,7 @@ void test_pcep_obj_create_bandwidth()
pcep_obj_free_object((struct pcep_object_header *)bw);
}
-void test_pcep_obj_create_metric()
+void test_pcep_obj_create_metric(void)
{
uint8_t type = PCEP_METRIC_BORDER_NODE_COUNT;
/* https://en.wikipedia.org/wiki/IEEE_754-1985
@@ -421,7 +422,7 @@ void test_pcep_obj_create_metric()
pcep_obj_free_object((struct pcep_object_header *)metric);
}
-void test_pcep_obj_create_lspa()
+void test_pcep_obj_create_lspa(void)
{
uint32_t exclude_any = 10;
uint32_t include_any = 20;
@@ -448,7 +449,7 @@ void test_pcep_obj_create_lspa()
pcep_obj_free_object((struct pcep_object_header *)lspa);
}
-void test_pcep_obj_create_svec()
+void test_pcep_obj_create_svec(void)
{
struct pcep_object_svec *svec =
pcep_obj_create_svec(true, true, true, NULL);
@@ -479,7 +480,7 @@ void test_pcep_obj_create_svec()
pcep_obj_free_object((struct pcep_object_header *)svec);
}
-void test_pcep_obj_create_error()
+void test_pcep_obj_create_error(void)
{
uint8_t error_type = PCEP_ERRT_SESSION_FAILURE;
uint8_t error_value = PCEP_ERRV_RECVD_INVALID_OPEN_MSG;
@@ -499,7 +500,7 @@ void test_pcep_obj_create_error()
pcep_obj_free_object((struct pcep_object_header *)error);
}
-void test_pcep_obj_create_close()
+void test_pcep_obj_create_close(void)
{
uint8_t reason = PCEP_CLOSE_REASON_DEADTIMER;
@@ -517,7 +518,7 @@ void test_pcep_obj_create_close()
pcep_obj_free_object((struct pcep_object_header *)close);
}
-void test_pcep_obj_create_srp()
+void test_pcep_obj_create_srp(void)
{
bool lsp_remove = true;
uint32_t srp_id_number = 0x89674523;
@@ -538,7 +539,7 @@ void test_pcep_obj_create_srp()
pcep_obj_free_object((struct pcep_object_header *)srp);
}
-void test_pcep_obj_create_lsp()
+void test_pcep_obj_create_lsp(void)
{
uint32_t plsp_id = 0x000fffff;
enum pcep_lsp_operational_status status = PCEP_LSP_OPERATIONAL_ACTIVE;
@@ -579,7 +580,7 @@ void test_pcep_obj_create_lsp()
pcep_obj_free_object((struct pcep_object_header *)lsp);
}
-void test_pcep_obj_create_vendor_info()
+void test_pcep_obj_create_vendor_info(void)
{
uint32_t enterprise_number = 0x01020304;
uint32_t enterprise_specific_info = 0x05060708;
@@ -645,19 +646,19 @@ static void test_pcep_obj_create_object_common(ro_func func_to_test,
pcep_obj_free_object((struct pcep_object_header *)ero);
}
-void test_pcep_obj_create_ero()
+void test_pcep_obj_create_ero(void)
{
test_pcep_obj_create_object_common(
pcep_obj_create_ero, PCEP_OBJ_CLASS_ERO, PCEP_OBJ_TYPE_ERO);
}
-void test_pcep_obj_create_rro()
+void test_pcep_obj_create_rro(void)
{
test_pcep_obj_create_object_common(
pcep_obj_create_rro, PCEP_OBJ_CLASS_RRO, PCEP_OBJ_TYPE_RRO);
}
-void test_pcep_obj_create_iro()
+void test_pcep_obj_create_iro(void)
{
test_pcep_obj_create_object_common(
pcep_obj_create_iro, PCEP_OBJ_CLASS_IRO, PCEP_OBJ_TYPE_IRO);
@@ -731,7 +732,7 @@ verify_pcep_obj_ro_sr_header(struct pcep_object_ro *ro,
}
}
-void test_pcep_obj_create_ro_subobj_ipv4()
+void test_pcep_obj_create_ro_subobj_ipv4(void)
{
struct in_addr ro_ipv4;
inet_pton(AF_INET, "192.168.1.2", &ro_ipv4);
@@ -768,7 +769,7 @@ void test_pcep_obj_create_ro_subobj_ipv4()
pcep_obj_free_object((struct pcep_object_header *)ro);
}
-void test_pcep_obj_create_ro_subobj_ipv6()
+void test_pcep_obj_create_ro_subobj_ipv6(void)
{
struct in6_addr ro_ipv6;
uint8_t prefix_len = 16;
@@ -811,7 +812,7 @@ void test_pcep_obj_create_ro_subobj_ipv6()
pcep_obj_free_object((struct pcep_object_header *)ro);
}
-void test_pcep_obj_create_ro_subobj_unnum()
+void test_pcep_obj_create_ro_subobj_unnum(void)
{
struct in_addr router_id;
uint32_t if_id = 123;
@@ -836,7 +837,7 @@ void test_pcep_obj_create_ro_subobj_unnum()
pcep_obj_free_object((struct pcep_object_header *)ro);
}
-void test_pcep_obj_create_ro_subobj_32label()
+void test_pcep_obj_create_ro_subobj_32label(void)
{
uint8_t class_type = 1;
uint32_t label = 0xeeffaabb;
@@ -856,7 +857,7 @@ void test_pcep_obj_create_ro_subobj_32label()
pcep_obj_free_object((struct pcep_object_header *)ro);
}
-void test_pcep_obj_create_ro_subobj_asn()
+void test_pcep_obj_create_ro_subobj_asn(void)
{
uint16_t asn = 0x0102;
@@ -871,7 +872,7 @@ void test_pcep_obj_create_ro_subobj_asn()
pcep_obj_free_object((struct pcep_object_header *)ro);
}
-void test_pcep_obj_create_ro_subobj_sr_nonai()
+void test_pcep_obj_create_ro_subobj_sr_nonai(void)
{
uint32_t sid = 0x01020304;
@@ -902,7 +903,7 @@ void test_pcep_obj_create_ro_subobj_sr_nonai()
pcep_obj_free_object((struct pcep_object_header *)ro);
}
-void test_pcep_obj_create_ro_subobj_sr_ipv4_node()
+void test_pcep_obj_create_ro_subobj_sr_ipv4_node(void)
{
uint32_t sid = 0x01020304;
struct in_addr ipv4_node_id;
@@ -954,7 +955,7 @@ void test_pcep_obj_create_ro_subobj_sr_ipv4_node()
pcep_obj_free_object((struct pcep_object_header *)ro);
}
-void test_pcep_obj_create_ro_subobj_sr_ipv6_node()
+void test_pcep_obj_create_ro_subobj_sr_ipv6_node(void)
{
uint32_t sid = 0x01020304;
struct in6_addr ipv6_node_id;
@@ -1007,7 +1008,7 @@ void test_pcep_obj_create_ro_subobj_sr_ipv6_node()
pcep_obj_free_object((struct pcep_object_header *)ro);
}
-void test_pcep_obj_create_ro_subobj_sr_ipv4_adj()
+void test_pcep_obj_create_ro_subobj_sr_ipv4_adj(void)
{
struct in_addr local_ipv4;
struct in_addr remote_ipv4;
@@ -1072,7 +1073,7 @@ void test_pcep_obj_create_ro_subobj_sr_ipv4_adj()
pcep_obj_free_object((struct pcep_object_header *)ro);
}
-void test_pcep_obj_create_ro_subobj_sr_ipv6_adj()
+void test_pcep_obj_create_ro_subobj_sr_ipv6_adj(void)
{
uint32_t sid = 0x01020304;
struct in6_addr local_ipv6;
@@ -1147,7 +1148,7 @@ void test_pcep_obj_create_ro_subobj_sr_ipv6_adj()
pcep_obj_free_object((struct pcep_object_header *)ro);
}
-void test_pcep_obj_create_ro_subobj_sr_unnumbered_ipv4_adj()
+void test_pcep_obj_create_ro_subobj_sr_unnumbered_ipv4_adj(void)
{
uint32_t sid = 0x01020304;
uint32_t local_node_id = 0x11223344;
@@ -1208,7 +1209,7 @@ void test_pcep_obj_create_ro_subobj_sr_unnumbered_ipv4_adj()
/* TODO Test draft07 types */
}
-void test_pcep_obj_create_ro_subobj_sr_linklocal_ipv6_adj()
+void test_pcep_obj_create_ro_subobj_sr_linklocal_ipv6_adj(void)
{
uint32_t sid = 0x01020304;
uint32_t local_if_id = 0x11002200;
diff --git a/pceplib/test/pcep_msg_tlvs_test.c b/pceplib/test/pcep_msg_tlvs_test.c
index 3ead269..fc11205 100644
--- a/pceplib/test/pcep_msg_tlvs_test.c
+++ b/pceplib/test/pcep_msg_tlvs_test.c
@@ -55,23 +55,23 @@ int pcep_tlvs_test_suite_teardown(void)
return 0;
}
-void reset_tlv_buffer()
+void reset_tlv_buffer(void)
{
memset(tlv_buf, 0, 2000);
}
-void pcep_tlvs_test_setup()
+void pcep_tlvs_test_setup(void)
{
versioning = create_default_pcep_versioning();
reset_tlv_buffer();
}
-void pcep_tlvs_test_teardown()
+void pcep_tlvs_test_teardown(void)
{
destroy_pcep_versioning(versioning);
}
-void test_pcep_tlv_create_stateful_pce_capability()
+void test_pcep_tlv_create_stateful_pce_capability(void)
{
struct pcep_object_tlv_stateful_pce_capability *tlv =
pcep_tlv_create_stateful_pce_capability(true, true, true, true,
@@ -96,7 +96,7 @@ void test_pcep_tlv_create_stateful_pce_capability()
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_speaker_entity_id()
+void test_pcep_tlv_create_speaker_entity_id(void)
{
struct pcep_object_tlv_speaker_entity_identifier *tlv =
pcep_tlv_create_speaker_entity_id(NULL);
@@ -105,10 +105,8 @@ void test_pcep_tlv_create_speaker_entity_id()
double_linked_list *list = dll_initialize();
tlv = pcep_tlv_create_speaker_entity_id(list);
CU_ASSERT_PTR_NULL(tlv);
- if (tlv != NULL) {
+ if (tlv != NULL)
pceplib_free(PCEPLIB_INFRA, tlv);
- tlv = NULL;
- }
uint32_t *speaker_entity =
pceplib_malloc(PCEPLIB_MESSAGES, sizeof(uint32_t));
@@ -130,7 +128,7 @@ void test_pcep_tlv_create_speaker_entity_id()
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_lsp_db_version()
+void test_pcep_tlv_create_lsp_db_version(void)
{
uint64_t lsp_db_version = 0xf005ba11ba5eba11;
struct pcep_object_tlv_lsp_db_version *tlv =
@@ -148,7 +146,7 @@ void test_pcep_tlv_create_lsp_db_version()
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_path_setup_type()
+void test_pcep_tlv_create_path_setup_type(void)
{
uint8_t pst = 0x89;
@@ -166,7 +164,7 @@ void test_pcep_tlv_create_path_setup_type()
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_path_setup_type_capability()
+void test_pcep_tlv_create_path_setup_type_capability(void)
{
/* The sub_tlv list is optional */
@@ -179,28 +177,22 @@ void test_pcep_tlv_create_path_setup_type_capability()
double_linked_list *pst_list = dll_initialize();
tlv = pcep_tlv_create_path_setup_type_capability(pst_list, NULL);
CU_ASSERT_PTR_NULL(tlv);
- if (tlv != NULL) {
+ if (tlv != NULL)
pcep_obj_free_tlv(&tlv->header);
- tlv = NULL;
- }
/* Should still return NULL if pst_list is NULL */
double_linked_list *sub_tlv_list = dll_initialize();
tlv = pcep_tlv_create_path_setup_type_capability(NULL, sub_tlv_list);
CU_ASSERT_PTR_NULL(tlv);
- if (tlv != NULL) {
+ if (tlv != NULL)
pcep_obj_free_tlv(&tlv->header);
- tlv = NULL;
- }
/* Should still return NULL if pst_list is empty */
tlv = pcep_tlv_create_path_setup_type_capability(pst_list,
sub_tlv_list);
CU_ASSERT_PTR_NULL(tlv);
- if (tlv != NULL) {
+ if (tlv != NULL)
pcep_obj_free_tlv(&tlv->header);
- tlv = NULL;
- }
/* Test only populating the pst list */
uint8_t *pst1 = pceplib_malloc(PCEPLIB_MESSAGES, 1);
@@ -274,7 +266,7 @@ void test_pcep_tlv_create_path_setup_type_capability()
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_sr_pce_capability()
+void test_pcep_tlv_create_sr_pce_capability(void)
{
struct pcep_object_tlv_sr_pce_capability *tlv =
pcep_tlv_create_sr_pce_capability(true, true, 8);
@@ -294,7 +286,7 @@ void test_pcep_tlv_create_sr_pce_capability()
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_symbolic_path_name()
+void test_pcep_tlv_create_symbolic_path_name(void)
{
/* char *symbolic_path_name, uint16_t symbolic_path_name_length); */
char path_name[16] = "Some Path Name";
@@ -336,7 +328,7 @@ void test_pcep_tlv_create_symbolic_path_name()
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_ipv4_lsp_identifiers()
+void test_pcep_tlv_create_ipv4_lsp_identifiers(void)
{
struct in_addr sender_ip, endpoint_ip;
uint16_t lsp_id = 7;
@@ -397,7 +389,7 @@ void test_pcep_tlv_create_ipv4_lsp_identifiers()
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_ipv6_lsp_identifiers()
+void test_pcep_tlv_create_ipv6_lsp_identifiers(void)
{
struct in6_addr sender_ip, endpoint_ip;
uint16_t lsp_id = 3;
@@ -444,7 +436,8 @@ void test_pcep_tlv_create_ipv6_lsp_identifiers()
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_srpag_pol_id_ipv4()
+
+void test_pcep_tlv_create_srpag_pol_id_ipv4(void)
{
uint32_t color = 1;
struct in_addr src;
@@ -474,7 +467,8 @@ void test_pcep_tlv_create_srpag_pol_id_ipv4()
pceplib_free(PCEPLIB_MESSAGES, dec_hdr);
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_srpag_pol_id_ipv6()
+
+void test_pcep_tlv_create_srpag_pol_id_ipv6(void)
{
uint32_t color = 1;
@@ -504,7 +498,7 @@ void test_pcep_tlv_create_srpag_pol_id_ipv6()
pceplib_free(PCEPLIB_MESSAGES, dec_hdr);
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_srpag_pol_name()
+void test_pcep_tlv_create_srpag_pol_name(void)
{
const char *pol_name = "Some Pol Name";
@@ -524,7 +518,7 @@ void test_pcep_tlv_create_srpag_pol_name()
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_srpag_cp_id()
+void test_pcep_tlv_create_srpag_cp_id(void)
{
// draft-ietf-spring-segment-routing-policy-06.pdf#2.3
// 10 PCEP, 20 BGP SR Policy, 30 Via Configuration
@@ -558,7 +552,7 @@ void test_pcep_tlv_create_srpag_cp_id()
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_srpag_cp_pref()
+void test_pcep_tlv_create_srpag_cp_pref(void)
{
uint32_t preference_default = 100;
@@ -587,7 +581,8 @@ void test_pcep_tlv_create_srpag_cp_pref()
pceplib_free(PCEPLIB_MESSAGES, dec_hdr);
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_lsp_error_code()
+
+void test_pcep_tlv_create_lsp_error_code(void)
{
struct pcep_object_tlv_lsp_error_code *tlv =
pcep_tlv_create_lsp_error_code(
@@ -605,7 +600,7 @@ void test_pcep_tlv_create_lsp_error_code()
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_rsvp_ipv4_error_spec()
+void test_pcep_tlv_create_rsvp_ipv4_error_spec(void)
{
struct in_addr error_node_ip;
inet_pton(AF_INET, "192.168.1.1", &error_node_ip);
@@ -629,7 +624,7 @@ void test_pcep_tlv_create_rsvp_ipv4_error_spec()
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_rsvp_ipv6_error_spec()
+void test_pcep_tlv_create_rsvp_ipv6_error_spec(void)
{
struct in6_addr error_node_ip;
inet_pton(AF_INET6, "2001:db8::8a2e:370:7334", &error_node_ip);
@@ -653,7 +648,7 @@ void test_pcep_tlv_create_rsvp_ipv6_error_spec()
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_nopath_vector()
+void test_pcep_tlv_create_nopath_vector(void)
{
uint32_t enterprise_number = 0x01020304;
uint32_t enterprise_specific_info = 0x05060708;
@@ -673,7 +668,7 @@ void test_pcep_tlv_create_nopath_vector()
pcep_obj_free_tlv(&tlv->header);
}
-void test_pcep_tlv_create_arbitrary()
+void test_pcep_tlv_create_arbitrary(void)
{
char data[16] = "Some Data";
uint16_t data_length = 9;
diff --git a/pceplib/test/pcep_msg_tools_test.c b/pceplib/test/pcep_msg_tools_test.c
index 858650e..440cccd 100644
--- a/pceplib/test/pcep_msg_tools_test.c
+++ b/pceplib/test/pcep_msg_tools_test.c
@@ -199,7 +199,7 @@ static bool pcep_obj_has_tlv(struct pcep_object_header *obj_hdr)
return (obj_hdr->tlv_list->num_entries > 0);
}
-void test_pcep_msg_read_pcep_initiate()
+void test_pcep_msg_read_pcep_initiate(void)
{
char filename[BASE_TMPFILE_SIZE];
@@ -303,7 +303,7 @@ void test_pcep_msg_read_pcep_initiate()
}
-void test_pcep_msg_read_pcep_initiate2()
+void test_pcep_msg_read_pcep_initiate2(void)
{
char filename[BASE_TMPFILE_SIZE];
@@ -396,7 +396,7 @@ void test_pcep_msg_read_pcep_initiate2()
unlink(filename);
}
-void test_pcep_msg_read_pcep_open()
+void test_pcep_msg_read_pcep_open(void)
{
char filename[BASE_TMPFILE_SIZE];
@@ -444,7 +444,7 @@ void test_pcep_msg_read_pcep_open()
unlink(filename);
}
-void test_pcep_msg_read_pcep_update()
+void test_pcep_msg_read_pcep_update(void)
{
char filename[BASE_TMPFILE_SIZE];
@@ -530,7 +530,7 @@ void test_pcep_msg_read_pcep_update()
unlink(filename);
}
-void test_pcep_msg_read_pcep_open_initiate()
+void test_pcep_msg_read_pcep_open_initiate(void)
{
char filename[BASE_TMPFILE_SIZE];
@@ -563,7 +563,7 @@ void test_pcep_msg_read_pcep_open_initiate()
unlink(filename);
}
-void test_pcep_msg_read_pcep_open_cisco_pce()
+void test_pcep_msg_read_pcep_open_cisco_pce(void)
{
char filename[BASE_TMPFILE_SIZE];
@@ -630,7 +630,7 @@ void test_pcep_msg_read_pcep_open_cisco_pce()
unlink(filename);
}
-void test_pcep_msg_read_pcep_update_cisco_pce()
+void test_pcep_msg_read_pcep_update_cisco_pce(void)
{
char filename[BASE_TMPFILE_SIZE];
@@ -778,7 +778,7 @@ void test_pcep_msg_read_pcep_update_cisco_pce()
unlink(filename);
}
-void test_pcep_msg_read_pcep_report_cisco_pcc()
+void test_pcep_msg_read_pcep_report_cisco_pcc(void)
{
char filename[BASE_TMPFILE_SIZE];
@@ -943,7 +943,7 @@ void test_pcep_msg_read_pcep_report_cisco_pcc()
unlink(filename);
}
-void test_pcep_msg_read_pcep_initiate_cisco_pcc()
+void test_pcep_msg_read_pcep_initiate_cisco_pcc(void)
{
char filename[BASE_TMPFILE_SIZE];
@@ -1055,7 +1055,7 @@ void test_pcep_msg_read_pcep_initiate_cisco_pcc()
unlink(filename);
}
-void test_validate_message_header()
+void test_validate_message_header(void)
{
uint8_t pcep_message_invalid_version[] = {0x40, 0x01, 0x04, 0x00};
uint8_t pcep_message_invalid_flags[] = {0x22, 0x01, 0x04, 0x00};
@@ -1141,7 +1141,7 @@ struct pcep_message *create_message(uint8_t msg_type, uint8_t obj1_class,
return msg;
}
-void test_validate_message_objects()
+void test_validate_message_objects(void)
{
/* Valid Open message */
struct pcep_message *msg =
@@ -1203,7 +1203,7 @@ void test_validate_message_objects()
pcep_msg_free_message(msg);
}
-void test_validate_message_objects_invalid()
+void test_validate_message_objects_invalid(void)
{
/* unsupported message ID = 0
* {NO_OBJECT, NO_OBJECT, NO_OBJECT, NO_OBJECT} */
diff --git a/pceplib/test/pcep_pcc_api_test.c b/pceplib/test/pcep_pcc_api_test.c
index 904308f..768325a 100644
--- a/pceplib/test/pcep_pcc_api_test.c
+++ b/pceplib/test/pcep_pcc_api_test.c
@@ -34,13 +34,13 @@ extern const char UNKNOWN_EVENT_STR[];
* Test suite setup and teardown called before AND after the test suite.
*/
-int pcep_pcc_api_test_suite_setup()
+int pcep_pcc_api_test_suite_setup(void)
{
pceplib_memory_reset();
return 0;
}
-int pcep_pcc_api_test_suite_teardown()
+int pcep_pcc_api_test_suite_teardown(void)
{
printf("\n");
pceplib_memory_dump();
@@ -51,13 +51,13 @@ int pcep_pcc_api_test_suite_teardown()
* Test case setup and teardown called before AND after each test.
*/
-void pcep_pcc_api_test_setup()
+void pcep_pcc_api_test_setup(void)
{
setup_mock_socket_comm_info();
}
-void pcep_pcc_api_test_teardown()
+void pcep_pcc_api_test_teardown(void)
{
teardown_mock_socket_comm_info();
}
@@ -66,7 +66,7 @@ void pcep_pcc_api_test_teardown()
* Unit test cases
*/
-void test_initialize_pcc()
+void test_initialize_pcc(void)
{
CU_ASSERT_TRUE(initialize_pcc());
/* Give the PCC time to initialize */
@@ -74,7 +74,7 @@ void test_initialize_pcc()
CU_ASSERT_TRUE(destroy_pcc());
}
-void test_connect_pce()
+void test_connect_pce(void)
{
pcep_configuration *config = create_default_pcep_configuration();
struct hostent *host_info = gethostbyname("localhost");
@@ -109,7 +109,7 @@ void test_connect_pce()
destroy_pcc();
}
-void test_connect_pce_ipv6()
+void test_connect_pce_ipv6(void)
{
pcep_configuration *config = create_default_pcep_configuration();
struct in6_addr dest_address;
@@ -147,7 +147,7 @@ void test_connect_pce_ipv6()
destroy_pcc();
}
-void test_connect_pce_with_src_ip()
+void test_connect_pce_with_src_ip(void)
{
pcep_configuration *config = create_default_pcep_configuration();
struct hostent *host_info = gethostbyname("localhost");
@@ -180,7 +180,7 @@ void test_connect_pce_with_src_ip()
destroy_pcc();
}
-void test_disconnect_pce()
+void test_disconnect_pce(void)
{
pcep_configuration *config = create_default_pcep_configuration();
struct hostent *host_info = gethostbyname("localhost");
@@ -225,7 +225,7 @@ void test_disconnect_pce()
}
-void test_send_message()
+void test_send_message(void)
{
pcep_configuration *config = create_default_pcep_configuration();
struct hostent *host_info = gethostbyname("localhost");
@@ -249,7 +249,7 @@ void test_send_message()
destroy_pcc();
}
-void test_event_queue()
+void test_event_queue(void)
{
/* This initializes the event_queue */
CU_ASSERT_TRUE(initialize_pcc());
@@ -278,7 +278,7 @@ void test_event_queue()
CU_ASSERT_TRUE(destroy_pcc());
}
-void test_get_event_type_str()
+void test_get_event_type_str(void)
{
CU_ASSERT_EQUAL(strcmp(get_event_type_str(MESSAGE_RECEIVED),
MESSAGE_RECEIVED_STR),
diff --git a/pceplib/test/pcep_utils_counters_test.c b/pceplib/test/pcep_utils_counters_test.c
index 2cad9a6..7fa2f3c 100644
--- a/pceplib/test/pcep_utils_counters_test.c
+++ b/pceplib/test/pcep_utils_counters_test.c
@@ -22,7 +22,7 @@
#include "pcep_utils_counters_test.h"
-void test_create_counters_group()
+void test_create_counters_group(void)
{
const char group_name[] = "group";
uint16_t num_subgroups = 10;
@@ -45,7 +45,7 @@ void test_create_counters_group()
delete_counters_group(group);
}
-void test_create_counters_subgroup()
+void test_create_counters_subgroup(void)
{
const char subgroup_name[] = "subgroup";
uint16_t subgroup_id = 10;
@@ -77,7 +77,7 @@ void test_create_counters_subgroup()
delete_counters_subgroup(subgroup);
}
-void test_add_counters_subgroup()
+void test_add_counters_subgroup(void)
{
struct counters_group *group = create_counters_group("group", 1);
struct counters_subgroup *subgroup1 =
@@ -102,27 +102,29 @@ void test_add_counters_subgroup()
delete_counters_subgroup(subgroup2);
}
-void test_create_subgroup_counter()
+void test_create_subgroup_counter(void)
{
uint16_t counter_id = 1;
char counter_name[] = "my counter";
+ char counter_name_json[] = "myCounter";
struct counters_subgroup *subgroup =
create_counters_subgroup("subgroup", 1, 2);
- CU_ASSERT_FALSE(
- create_subgroup_counter(NULL, counter_id, counter_name));
+ CU_ASSERT_FALSE(create_subgroup_counter(NULL, counter_id, counter_name,
+ counter_name_json));
CU_ASSERT_FALSE(create_subgroup_counter(subgroup, counter_id + 1,
- counter_name));
- CU_ASSERT_FALSE(create_subgroup_counter(subgroup, counter_id, NULL));
+ counter_name, counter_name_json));
+ CU_ASSERT_FALSE(
+ create_subgroup_counter(subgroup, counter_id, NULL, NULL));
CU_ASSERT_EQUAL(subgroup->num_counters, 0);
- CU_ASSERT_TRUE(
- create_subgroup_counter(subgroup, counter_id, counter_name));
+ CU_ASSERT_TRUE(create_subgroup_counter(subgroup, counter_id,
+ counter_name, counter_name_json));
CU_ASSERT_EQUAL(subgroup->num_counters, 1);
delete_counters_subgroup(subgroup);
}
-void test_delete_counters_group()
+void test_delete_counters_group(void)
{
struct counters_group *group = create_counters_group("group", 1);
@@ -130,7 +132,7 @@ void test_delete_counters_group()
CU_ASSERT_TRUE(delete_counters_group(group));
}
-void test_delete_counters_subgroup()
+void test_delete_counters_subgroup(void)
{
struct counters_subgroup *subgroup =
create_counters_subgroup("subgroup", 1, 1);
@@ -139,14 +141,14 @@ void test_delete_counters_subgroup()
CU_ASSERT_TRUE(delete_counters_subgroup(subgroup));
}
-void test_reset_group_counters()
+void test_reset_group_counters(void)
{
uint16_t subgroup_id = 1;
uint16_t counter_id = 1;
struct counters_group *group = create_counters_group("group", 10);
struct counters_subgroup *subgroup =
create_counters_subgroup("subgroup", subgroup_id, 10);
- create_subgroup_counter(subgroup, counter_id, "counter");
+ create_subgroup_counter(subgroup, counter_id, "counter", "counter");
add_counters_subgroup(group, subgroup);
struct counter *counter = subgroup->counters[counter_id];
@@ -159,12 +161,12 @@ void test_reset_group_counters()
delete_counters_group(group);
}
-void test_reset_subgroup_counters()
+void test_reset_subgroup_counters(void)
{
uint16_t counter_id = 1;
struct counters_subgroup *subgroup =
create_counters_subgroup("subgroup", 1, 10);
- create_subgroup_counter(subgroup, counter_id, "counter");
+ create_subgroup_counter(subgroup, counter_id, "counter", "counter");
struct counter *counter = subgroup->counters[counter_id];
counter->counter_value = 100;
@@ -176,14 +178,14 @@ void test_reset_subgroup_counters()
delete_counters_subgroup(subgroup);
}
-void test_increment_counter()
+void test_increment_counter(void)
{
uint16_t subgroup_id = 1;
uint16_t counter_id = 1;
struct counters_group *group = create_counters_group("group", 10);
struct counters_subgroup *subgroup =
create_counters_subgroup("subgroup", subgroup_id, 10);
- create_subgroup_counter(subgroup, counter_id, "counter");
+ create_subgroup_counter(subgroup, counter_id, "counter", "counter");
add_counters_subgroup(group, subgroup);
struct counter *counter = subgroup->counters[counter_id];
@@ -199,13 +201,13 @@ void test_increment_counter()
delete_counters_group(group);
}
-void test_increment_subgroup_counter()
+void test_increment_subgroup_counter(void)
{
int counter_id = 1;
uint32_t counter_value = 100;
struct counters_subgroup *subgroup =
create_counters_subgroup("subgroup", 1, 10);
- create_subgroup_counter(subgroup, counter_id, "counter");
+ create_subgroup_counter(subgroup, counter_id, "counter", "counter");
struct counter *counter = subgroup->counters[counter_id];
counter->counter_value = counter_value;
@@ -218,14 +220,14 @@ void test_increment_subgroup_counter()
delete_counters_subgroup(subgroup);
}
-void test_dump_counters_group_to_log()
+void test_dump_counters_group_to_log(void)
{
uint16_t subgroup_id = 1;
uint16_t counter_id = 1;
struct counters_group *group = create_counters_group("group", 10);
struct counters_subgroup *subgroup =
create_counters_subgroup("subgroup", subgroup_id, 10);
- create_subgroup_counter(subgroup, counter_id, "counter");
+ create_subgroup_counter(subgroup, counter_id, "counter", "counter");
add_counters_subgroup(group, subgroup);
CU_ASSERT_FALSE(dump_counters_group_to_log(NULL));
@@ -234,13 +236,13 @@ void test_dump_counters_group_to_log()
delete_counters_group(group);
}
-void test_dump_counters_subgroup_to_log()
+void test_dump_counters_subgroup_to_log(void)
{
uint16_t subgroup_id = 1;
uint16_t counter_id = 1;
struct counters_subgroup *subgroup =
create_counters_subgroup("subgroup", subgroup_id, 10);
- create_subgroup_counter(subgroup, counter_id, "counter");
+ create_subgroup_counter(subgroup, counter_id, "counter", "counter");
CU_ASSERT_FALSE(dump_counters_subgroup_to_log(NULL));
CU_ASSERT_TRUE(dump_counters_subgroup_to_log(subgroup));