diff options
author | Jordan Augé <jordan.auge+fdio@cisco.com> | 2019-12-02 14:28:22 +0100 |
---|---|---|
committer | Jordan Augé <jordan.auge+fdio@cisco.com> | 2019-12-02 14:28:22 +0100 |
commit | 2d1b0a7436653f6eb9e6d2777802b4ae912183b2 (patch) | |
tree | c67777d2946ba0a8fb86bdfbb5d0c46ea310b050 /ctrl | |
parent | 8bda9d94b95bf32d930655398bfe7e160541afde (diff) |
[HICN-419] Expose facelet id in facelet_list(_json) in facemgr API
Change-Id: Ibce2e82ba125ca2e927cd270a8c45855384cd7fa
Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'ctrl')
-rw-r--r-- | ctrl/facemgr/src/facelet.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ctrl/facemgr/src/facelet.c b/ctrl/facemgr/src/facelet.c index 929005f57..a6231f457 100644 --- a/ctrl/facemgr/src/facelet.c +++ b/ctrl/facemgr/src/facelet.c @@ -998,7 +998,8 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet) assert(facelet); /* Header + key attributes (netdevice + family) */ - rc = snprintf(cur, s + size - cur, "<Facelet %s %s (%s)", + rc = snprintf(cur, s + size - cur, "<Facelet [%d] %s %s (%s)", + facelet->id, facelet_status_str[facelet->status], facelet_get_error(facelet) ? "/!\\" : "", (facelet->family == AF_INET) ? "AF_INET" : @@ -1208,6 +1209,15 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int if (cur >= s + size) return cur - s; + /* id */ + rc = snprintf(cur, s + size - cur, "%*s%s: %d,\n", 4 * (indent+1), "", "\"id\"", + facelet->id); + if (rc < 0) + return rc; + cur += rc; + if (cur >= s + size) + return cur - s; + /* Status */ rc = snprintf(cur, s + size - cur, "%*s%s: \"%s\",\n", 4 * (indent+1), "", "\"status\"", facelet_status_str[facelet->status]); |