summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2021-04-19 23:57:14 +0200
committerJordan Augé <jordan.auge+fdio@cisco.com>2021-04-19 23:57:14 +0200
commita1a165c48c5422d9b302a6abec51e706f7cda934 (patch)
treebef0fe413a040b23f7cb5cbafeca6959eb8ba8c7
parente92e9e839ca2cf42b56322b2489ccc0d8bf767af (diff)
[HICN-699] facemgr: cleaner logs for face interaction
Change-Id: Ic0c941812f758868498e4d087e237047f91d452b Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
-rw-r--r--ctrl/facemgr/src/api.c15
-rw-r--r--ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c23
2 files changed, 28 insertions, 10 deletions
diff --git a/ctrl/facemgr/src/api.c b/ctrl/facemgr/src/api.c
index 9e029c5b7..dfbd24bcb 100644
--- a/ctrl/facemgr/src/api.c
+++ b/ctrl/facemgr/src/api.c
@@ -34,6 +34,11 @@
#define WITH_PRIORITY_CONTROLLER
/*
+ * Dump facelets (debug)
+ */
+//#define WITH_DUMP
+
+/*
* Allow priority setting before interface is actually created
*/
#define WITH_DEFAULT_PRIORITIES
@@ -1789,7 +1794,9 @@ int
facemgr_on_event(facemgr_t * facemgr, facelet_t * facelet_in)
{
bool remove_facelet = true;
+#if WITH_DUMP
bool dump = true;
+#endif /* WITH_DUMP */
int ret = 0;
int rc;
assert(facelet_in);
@@ -1879,7 +1886,9 @@ facemgr_on_event(facemgr_t * facemgr, facelet_t * facelet_in)
rc = facemgr_process_facelet_get(facemgr, facelet_in);
if (rc == 0)
remove_facelet = false;
+#if WITH_DUMP
dump = false;
+#endif
if (rc == -1) {
ERROR("[facemgr_on_event] Error processing GET event");
goto ERR;
@@ -1987,7 +1996,9 @@ facemgr_on_event(facemgr_t * facemgr, facelet_t * facelet_in)
//DEBUG("[facemgr_on_event] GET EXISTING %s", facelet_old_s);
//DEBUG(" WITH %s", facelet_s);
//ERROR("[facemgr_on_event] GET event for a face that already exists...");
+#ifdef WITH_DUMP
dump = false;
+#endif /* WITH_DUMP */
continue;
case FACELET_EVENT_UPDATE:
@@ -2068,7 +2079,7 @@ ERR:
ret = -1;
DUMP_CACHE:
-#if 1
+#if WITH_DUMP
if (dump) {
DEBUG(" <CACHE>");
facelet_set_dump(facemgr->facelet_cache);
@@ -2076,7 +2087,7 @@ DUMP_CACHE:
DEBUG("</EVENT ret=%d>", ret);
DEBUG("----------------------------------");
}
-#endif
+#endif /* WITH_DUMP */
free(cached_facelets);
diff --git a/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c b/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c
index 74a0cd62b..b6e0e605a 100644
--- a/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c
+++ b/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c
@@ -327,13 +327,12 @@ int hl_on_event(interface_t * interface, facelet_t * facelet)
switch(facelet_get_event(facelet)) {
case FACELET_EVENT_CREATE:
-
- /* Create face */
{
+ /* Create face */
char buf[MAXSZ_FACELET];
facelet_snprintf(buf, MAXSZ_FACELET, facelet);
DEBUG("Create facelet %s", buf);
- }
+
hc_face.face = *face;
rc = hc_face_create(data->s, &hc_face);
if (rc < 0) {
@@ -341,7 +340,8 @@ int hl_on_event(interface_t * interface, facelet_t * facelet)
ret = -FACELET_ERROR_REASON_UNSPECIFIED_ERROR;
goto ERR;
}
- INFO("Created face id=%d", hc_face.id);
+ INFO("Created face id=%d - %s", hc_face.id, buf);
+ }
hicn_route_t ** route_array;
int n = facelet_get_route_array(facelet, &route_array);
@@ -413,7 +413,6 @@ int hl_on_event(interface_t * interface, facelet_t * facelet)
case FACELET_EVENT_DELETE:
/* Removing a face should also remove associated routes */
- /* Create face */
hc_face.face = *face;
rc = hc_face_delete(data->s, &hc_face);
if (rc < 0) {
@@ -421,6 +420,11 @@ int hl_on_event(interface_t * interface, facelet_t * facelet)
ret = -FACELET_ERROR_REASON_UNSPECIFIED_ERROR;
goto ERR;
}
+
+ char buf[MAXSZ_FACELET];
+ facelet_snprintf(buf, MAXSZ_FACELET, facelet);
+ INFO("Deleted face id=%d", hc_face.id);
+
break;
case FACELET_EVENT_UPDATE:
@@ -457,7 +461,8 @@ int hl_on_event(interface_t * interface, facelet_t * facelet)
goto ERR;
}
facelet_set_admin_state_status(facelet, FACELET_ATTR_STATUS_CLEAN);
- INFO("Admin state updated");
+ INFO("Updated face id=%d - admin_state=%s", hc_face.id,
+ face_state_str[admin_state]);
}
#ifdef WITH_POLICY
if (facelet_get_netdevice_type_status(facelet) == FACELET_ATTR_STATUS_DIRTY) {
@@ -517,7 +522,8 @@ int hl_on_event(interface_t * interface, facelet_t * facelet)
goto ERR;
}
facelet_set_netdevice_type_status(facelet, FACELET_ATTR_STATUS_CLEAN);
- INFO("Tags updated");
+ INFO("Updated face id=%d - netdevice_type=%s", hc_face.id,
+ netdevice_type_str[netdevice_type]);
}
if (facelet_get_priority_status(facelet) == FACELET_ATTR_STATUS_DIRTY) {
INFO("Updating priority...");
@@ -549,7 +555,8 @@ int hl_on_event(interface_t * interface, facelet_t * facelet)
goto ERR;
}
facelet_set_priority_status(facelet, FACELET_ATTR_STATUS_CLEAN);
- INFO("Priority updated");
+
+ INFO("Updated face id=%d - priority=%d", hc_face.id, priority);
}
#endif /* WITH_POLICY */
break;