Skip to content
Snippets Groups Projects
Commit eb3c174d authored by Nevadita's avatar Nevadita
Browse files

map-topology: Changed the ouput display for method nodes

parent fe957af3
No related branches found
No related tags found
1 merge request!11Added Ubus method nodes
Pipeline #3205 passed
......@@ -49,6 +49,7 @@ map-topology provides the `topology` UBUS object with following methods :
"status":{}
"dump":{}
"changelog":{}
"nodes":{}
````
### Usage
......@@ -206,6 +207,15 @@ root@iopsys:# ubus call topology changelog
]
}
#To show the topology nodes macaddress -
root@iopsys:# ubus call topology nodes
{
"ieee1905_macaddr": "00:22:07:70:f5:6c",
"neighbors": [
"00:22:07:6e:d8:08",
"00:22:07:6d:3d:8e"
]
}
````
### Testing
......
......@@ -887,6 +887,7 @@ void topologyd_dump_node(struct blob_buf *bb, struct node *p, int is_self)
void topologyd_dump_node_nbr(struct topologyd_private *priv, struct blob_buf *b)
{
char mac_str[18] = { 0x0 };
void *nodes_array, *table;
struct node *p;
int i;
......@@ -894,11 +895,10 @@ void topologyd_dump_node_nbr(struct topologyd_private *priv, struct blob_buf *b)
/* Add details of own node first */
p = &priv->selfnode;
table = blobmsg_open_table(b, "self");
topologyd_dump_node(b, p, 1);
blobmsg_close_table(b, table);
hwaddr_ntoa(p->hwaddr, mac_str);
blobmsg_add_string(b, "ieee1905_macaddr", mac_str);
nodes_array = blobmsg_open_array(b, "nodes");
nodes_array = blobmsg_open_array(b, "neighbors");
for (i = 0; i < NODE_HTABLE_SIZE; i++) {
if (hlist_empty(&priv->topo.node_htable[i]))
continue;
......@@ -908,9 +908,8 @@ void topologyd_dump_node_nbr(struct topologyd_private *priv, struct blob_buf *b)
if (hwaddr_is_zero(p->hwaddr)) // TODO: unlikely..
continue;
table = blobmsg_open_table(b, NULL);
topologyd_dump_node(b, p, 1);
blobmsg_close_table(b, table);
hwaddr_ntoa(p->hwaddr, mac_str);
blobmsg_add_string(b, NULL, mac_str);
}
}
blobmsg_close_array(b, nodes_array);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment