bridge: json support for fdb and vlan show
Subsystems (3)
v4 cover bridge: json support for fdb and vlan show
From: Roopa Prabhu <[email protected]>
This patch series adds json support for a few bridge show commands. We plan to follow up with json support for additional commands soon.
Anuradha Karuppiah (3):
json_writer: Removed automatic json-object type from the constructor
bridge: add json support for bridge fdb show
bridge: add json schema for bridge fdb show
Roopa Prabhu (2):
bridge: add json support for bridge vlan show
bridge: update man page
v2 - change vlan flags to an array as suggested by toshiaki
v3 - no change. resubmitting as requested by stephen
v4 - removed json type from constructor as recommended by stephen
bridge/br_common.h | 1 + bridge/bridge.c | 5 +- bridge/fdb.c | 210 +++++++++++++++++++++++++++++++++--------- bridge/vlan.c | 109 +++++++++++++++++++--- lib/json_writer.c | 6 +- man/man8/bridge.8 | 9 +- misc/ifstat.c | 7 ++ misc/nstat.c | 6 ++ schema/bridge_fdb_schema.json | 62 +++++++++++++ 9 files changed, 352 insertions(+), 63 deletions(-) create mode 100644 schema/bridge_fdb_schema.json
Signature · 1 line
1.9.1
PATCH v4 1/5 json_writer: Removed automatic json-object type from the constructor
From: Anuradha Karuppiah <[email protected]>
Top level can be any json type and can be created using jsonw_start_object/jsonw_end_object etc.
--- lib/json_writer.c | 8 ++++---- misc/ifstat.c | 7 +++++++ misc/nstat.c | 6 ++++++ 3 files changed, 17 insertions(+), 4 deletions(-)
lib/json_writer.c +4 -4
@@ -33,7 +33,7 @@ struct json_writer {static void jsonw_indent (json_writer_t *self) {unsigned i; -for (i =0 ; i <= self->depth; ++i) +for (i =0 ; i < self->depth; ++i)fputs (" " , self->out); }
@@ -102,7 +102,6 @@ json_writer_t *jsonw_new(FILE *f) self->depth =0 ; self->pretty = false; self->sep ='\0' ; -putc ('{' , self->out); }return self; }
@@ -113,8 +112,7 @@ void jsonw_destroy(json_writer_t **self_p)json_writer_t *self = *self_p;assert (self->depth ==0 ); -jsonw_eol (self); -fputs ("}\n" , self->out); +fputs ("\n" , self->out);fflush (self->out);free (self); *self_p =NULL ;
@@ -269,6 +267,7 @@ int main(int argc, char **argv) {json_writer_t *wr =jsonw_new (stdout); +jsonw_start_object (wr);jsonw_pretty (wr, true);jsonw_name (wr,"Vyatta" );jsonw_start_object (wr);
@@ -305,6 +304,7 @@ int main(int argc, char **argv)jsonw_end_object (wr); +jsonw_end_object (wr);jsonw_destroy (&wr);return 0 ; }
misc/ifstat.c +7 -0
@@ -245,6 +245,7 @@ static void dump_raw_db(FILE *fp, int to_hist) h = hist_db;if (jw) { +jsonw_start_object (jw);jsonw_pretty (jw, pretty);jsonw_name (jw, info_source);jsonw_start_object (jw);
@@ -288,6 +289,8 @@ static void dump_raw_db(FILE *fp, int to_hist) }if (jw) {jsonw_end_object (jw); + +jsonw_end_object (jw);jsonw_destroy (&jw); } }
@@ -451,6 +454,7 @@ static void dump_kern_db(FILE *fp)struct ifstat_ent *n;if (jw) { +jsonw_start_object (jw);jsonw_pretty (jw, pretty);jsonw_name (jw, info_source);jsonw_start_object (jw);
@@ -477,6 +481,7 @@ static void dump_incr_db(FILE *fp) h = hist_db;if (jw) { +jsonw_start_object (jw);jsonw_pretty (jw, pretty);jsonw_name (jw, info_source);jsonw_start_object (jw);
@@ -509,6 +514,8 @@ static void dump_incr_db(FILE *fp)if (jw) {jsonw_end_object (jw); + +jsonw_end_object (jw);jsonw_destroy (&jw); } }
misc/nstat.c +6 -0
@@ -284,6 +284,7 @@ static void dump_kern_db(FILE *fp, int to_hist) h = hist_db;if (jw) { +jsonw_start_object (jw);jsonw_pretty (jw, pretty);jsonw_name (jw, info_source);jsonw_start_object (jw);
@@ -317,6 +318,8 @@ static void dump_kern_db(FILE *fp, int to_hist)if (jw) {jsonw_end_object (jw); + +jsonw_end_object (jw);jsonw_destroy (&jw); } }
@@ -328,6 +331,7 @@ static void dump_incr_db(FILE *fp) h = hist_db;if (jw) { +jsonw_start_object (jw);jsonw_pretty (jw, pretty);jsonw_name (jw, info_source);jsonw_start_object (jw);
@@ -364,6 +368,8 @@ static void dump_incr_db(FILE *fp)if (jw) {jsonw_end_object (jw); + +jsonw_end_object (jw);jsonw_destroy (&jw); } }
Signature · 1 line
1.9.1
PATCH v4 2/5 bridge: add json support for bridge vlan show
In reply to Roopa PrabhuFrom: Roopa Prabhu <[email protected]>
$bridge -c vlan show
port vlan ids
swp1 1 PVID Egress Untagged
10-13
swp2 1 PVID Egress Untagged
10-13
br0 1 PVID Egress Untagged
$bridge -json vlan show
{
"swp1": [{
"vlan": 1,
"flags": ["PVID","Egress Untagged"
]
},{
"vlan": 10
},{
"vlan": 11
},{
"vlan": 12
},{
"vlan": 13
}
],
"swp2": [{
"vlan": 1,
"flags": ["PVID","Egress Untagged"
]
},{
"vlan": 10
},{
"vlan": 11
},{
"vlan": 12
},{
"vlan": 13
}
],
"br0": [{
"vlan": 1,
"flags": ["PVID","Egress Untagged"
]
}
]
}$bridge -c -json vlan show
{
"swp1": [{
"vlan": 1,
"flags": ["PVID","Egress Untagged"
]
},{
"vlan": 10,
"vlanEnd": 13
}
],
"swp2": [{
"vlan": 1,
"flags": ["PVID","Egress Untagged"
]
},{
"vlan": 10,
"vlanEnd": 13
}
],
"br0": [{
"vlan": 1,
"flags": ["PVID","Egress Untagged"
]
}
]
}--- bridge/br_common.h | 1 + bridge/bridge.c | 5 ++- bridge/vlan.c | 109 ++++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 100 insertions(+), 15 deletions(-)
bridge/br_common.h +1 -0
@@ -23,4 +23,5 @@ extern int show_stats;extern int show_details;extern int timestamp;extern int compress_vlans; +extern int json_output;extern struct rtnl_handle rth;
bridge/bridge.c +4 -1
@@ -23,6 +23,7 @@ int oneline;int show_stats;int show_details;int compress_vlans; +int json_output;int timestamp;char *batch_file;int force;
@@ -38,7 +39,7 @@ static void usage(void)"where OBJECT := { link | fdb | mdb | vlan | monitor }\n" " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] |\n" " -o[neline] | -t[imestamp] | -n[etns] name |\n" -" -c[ompressvlans] }\n"); +" -c[ompressvlans] -j{son} }\n");exit (-1 ); }
@@ -173,6 +174,8 @@ main(int argc, char **argv) ++compress_vlans; }else if (matches (opt,"-force" ) ==0 ) { ++force; + }else if (matches (opt,"-json" ) ==0 ) { + ++json_output; }else if (matches (opt,"-batch" ) ==0 ) { argc--; argv++;
bridge/vlan.c +95 -14
158 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 4/5 bridge: add json schema for bridge fdb show
In reply to Roopa PrabhuFrom: Anuradha Karuppiah <[email protected]>
Storing the schema file for the json format will be useful for doc purposes as optional paramaters are typically suppressed in the json sample outputs.
--- schema/bridge_fdb_schema.json | 62 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 schema/bridge_fdb_schema.json
schema/bridge_fdb_schema.json new file +62 -0
@@ -0,0 +1,62 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description": "bridge fdb show", + "type": "array", + "items": { + "type": "object", + "properties": { + "dev": { + "type": "string" + }, + "dst": { + "description" : "host name or ip address", + "type": "string" + }, + "flags": { + "type": "array", + "items": { + "enum": ["self", "master", "router", "offload"] + }, + "uniqueItems": true + }, + "linkNetNsId": { + "type": "integer" + }, + "mac": { + "type": "string" + }, + "master": { + "type": "string" + }, + "opCode": { + "description" : "used to indicate fdb entry del", + "enum": ["deleted"] + }, + "port": { + "type": "integer" + }, + "state": { + "description" : "permanent, static, stale, state=#x", + "type": "string" + }, + "updated": { + "type": "integer" + }, + "used": { + "type": "integer" + }, + "viaIf": { + "type": "string" + }, + "viaIfIndex": { + "type": "integer" + }, + "vlan": { + "type": "integer" + }, + "vni": { + "type": "integer" + } + } + } +}
Signature · 1 line
1.9.1
PATCH v4 5/5 bridge: update man page
In reply to Roopa PrabhuFrom: Roopa Prabhu <[email protected]>
--- man/man8/bridge.8 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
man/man8/bridge.8 +7 -2
@@ -20,8 +20,9 @@ bridge \- show / manipulate bridge addresses and devices .IR OPTIONS " := { " \fB\-V\fR[\fIersion\fR] | \fB\-s\fR[\fItatistics\fR] | -\fB\-n\fR[\fIetns\fR] name } -\fB\-b\fR[\fIatch\fR] filename } +\fB\-n\fR[\fIetns\fR] name | +\fB\-b\fR[\fIatch\fR] filename | +\fB\-j\fR[\fIson\fR] } .ti -8 .BR "bridge link set"
@@ -153,6 +154,10 @@ Don't terminate bridge command on errors in batch mode. If there were any errors during execution of the commands, the application return code will be non zero. +.TP +.BR "\-json" +Display results in JSON format. Currently available for vlan and fdb. + .SH BRIDGE - COMMAND SYNTAX .SS
Signature · 1 line
1.9.1
Quoted 4 lines · Wed, Jun 22, 2016 at 03:45:50PM CEST, [email protected] wrote:
From: Roopa Prabhu <[email protected]>
This patch series adds json support for a few bridge show commands. We plan to follow up with json support for additional commands soon.
I'm just curious, what is you use case for this? Apps can use rtnetlink socket directly.
Quoted 31 lines
Anuradha Karuppiah (3):
json_writer: Removed automatic json-object type from the constructor
bridge: add json support for bridge fdb show
bridge: add json schema for bridge fdb showRoopa Prabhu (2):
bridge: add json support for bridge vlan show
bridge: update man pagev2 - change vlan flags to an array as suggested by toshiaki
v3 - no change. resubmitting as requested by stephen
v4 - removed json type from constructor as recommended by stephen
bridge/br_common.h | 1 + bridge/bridge.c | 5 +- bridge/fdb.c | 210 +++++++++++++++++++++++++++++++++--------- bridge/vlan.c | 109 +++++++++++++++++++--- lib/json_writer.c | 6 +- man/man8/bridge.8 | 9 +- misc/ifstat.c | 7 ++ misc/nstat.c | 6 ++ schema/bridge_fdb_schema.json | 62 +++++++++++++ 9 files changed, 352 insertions(+), 63 deletions(-)create mode 100644
schema/bridge_fdb_schema.jsonSignature · 1 line
1.9.1
PATCH v4 3/5 bridge: add json support for bridge fdb show
In reply to Roopa PrabhuFrom: Anuradha Karuppiah <[email protected]>
Sample output:
$bridge -j fdb show
[{
"mac": "44:38:39:00:69:88",
"dev": "swp2s0",
"vlan": 2,
"master": "br0",
"state": "permanent"
},{
"mac": "00:02:00:00:00:01",
"dev": "swp2s0",
"vlan": 2,
"master": "br0"
},{
"mac": "00:02:00:00:00:02",
"dev": "swp2s1",
"vlan": 2,
"master": "br0"
},{
"mac": "44:38:39:00:69:89",
"dev": "swp2s1",
"master": "br0",
"state": "permanent"
},{
"mac": "44:38:39:00:69:89",
"dev": "swp2s1",
"vlan": 2,
"master": "br0",
"state": "permanent"
},{
"mac": "44:38:39:00:69:88",
"dev": "br0",
"master": "br0",
"state": "permanent"
}]
--- bridge/fdb.c | 210 +++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 167 insertions(+), 43 deletions(-)
bridge/fdb.c +167 -43
@@ -21,6 +21,8 @@#include <linux/neighbour.h> #include <string.h> #include <limits.h> +#include <json_writer.h> +#include <stdbool.h> #include "libnetlink.h" #include "br_common.h"
@@ -29,6 +31,8 @@static unsigned int filter_index, filter_vlan; +json_writer_t *jw_global; +static void usage (void ) { fprintf(stderr, "Usage: bridge fdb { add | append | del | replace } ADDR dev DEV\n"
@@ -59,6 +63,15 @@ static const char *state_n2a(unsigned int s)return buf; } +static void start_json_fdb_flags_array (bool *fdb_flags) +{ +if (*fdb_flags) +return ; +jsonw_name (jw_global,"flags" ); +jsonw_start_array (jw_global); + *fdb_flags = true; +} +int print_fdb (const struct sockaddr_nl *who,struct nlmsghdr *n,void *arg) {FILE *fp = arg;
@@ -66,11 +79,12 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)int len = n->nlmsg_len;struct rtattr *tb[NDA_MAX +1 ];__u16 vid =0 ; +bool fdb_flags = false; +const char *state_s;if (n->nlmsg_type !=RTM_NEWNEIGH && n->nlmsg_type !=RTM_DELNEIGH ) {fprintf (stderr,"Not RTM_NEWNEIGH: %08x %08x %08x\n" , n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags); -return 0 ; }
@@ -86,6 +100,11 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)if (filter_index && filter_index != r->ndm_ifindex)return 0 ; +if (jw_global) { +jsonw_pretty (jw_global,1 ); +jsonw_start_object (jw_global); + } +parse_rtattr (tb,NDA_MAX ,NDA_RTA (r), n->nlmsg_len -NLMSG_LENGTH (sizeof (*r)));
@@ -95,40 +114,75 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)if (filter_vlan && filter_vlan != vid)return 0 ; -if (n->nlmsg_type ==RTM_DELNEIGH ) -fprintf (fp,"Deleted " ); +if (n->nlmsg_type ==RTM_DELNEIGH ) { +if (jw_global) +jsonw_string_field (jw_global,"opCode" ,"deleted" ); +else +fprintf (fp,"Deleted " ); + }if (tb[NDA_LLADDR ]) {SPRINT_BUF (b1); -fprintf (fp,"%s " , -ll_addr_n2a (RTA_DATA (tb[NDA_LLADDR ]), -RTA_PAYLOAD (tb[NDA_LLADDR ]), -ll_index_to_type (r->ndm_ifindex), - b1,sizeof (b1))); +ll_addr_n2a (RTA_DATA (tb[NDA_LLADDR ]), +RTA_PAYLOAD (tb[NDA_LLADDR ]), +ll_index_to_type (r->ndm_ifindex), + b1,sizeof (b1)); +if (jw_global) +jsonw_string_field (jw_global,"mac" , b1); +else +fprintf (fp,"%s " , b1); } -if (!filter_index && r->ndm_ifindex) -fprintf (fp,"dev %s " ,ll_index_to_name (r->ndm_ifindex)); +if (!filter_index && r->ndm_ifindex) { +if (jw_global) +jsonw_string_field (jw_global,"dev" , +ll_index_to_name (r->ndm_ifindex)); +else +fprintf (fp,"dev %s " , +ll_index_to_name (r->ndm_ifindex)); + }if (tb[NDA_DST ]) {int family =AF_INET ; +const char *abuf_s;if (RTA_PAYLOAD (tb[NDA_DST ]) ==sizeof (struct in6_addr )) family =AF_INET6 ; -fprintf (fp,"dst %s " , -format_host (family, -RTA_PAYLOAD (tb[NDA_DST ]), -RTA_DATA (tb[NDA_DST ]))); + abuf_s =format_host (family, +RTA_PAYLOAD (tb[NDA_DST ]), +RTA_DATA (tb[NDA_DST ])); +if (jw_global) +jsonw_string_field (jw_global,"dst" , abuf_s); +else +fprintf (fp,"dst %s " , abuf_s); + } + +if (vid) { +if (jw_global) +jsonw_uint_field (jw_global,"vlan" , vid); +else +fprintf (fp,"vlan %hu " , vid); + } + +if (tb[NDA_PORT ]) { +if (jw_global) +jsonw_uint_field (jw_global,"port" , +ntohs (rta_getattr_u16 (tb[NDA_PORT ]))); +else +fprintf (fp,"port %d " , +ntohs (rta_getattr_u16 (tb[NDA_PORT ]))); } -if (vid) -fprintf (fp,"vlan %hu " , vid); +if (tb[NDA_VNI ]) { +if (jw_global) +jsonw_uint_field (jw_global,"vni" , +rta_getattr_u32 (tb[NDA_VNI ])); +else +fprintf (fp,"vni %d " , +rta_getattr_u32 (tb[NDA_VNI ])); + } -if (tb[NDA_PORT ]) -fprintf (fp,"port %d " ,ntohs (rta_getattr_u16 (tb[NDA_PORT ]))); -if (tb[NDA_VNI ]) -fprintf (fp,"vni %d " ,rta_getattr_u32 (tb[NDA_VNI ]));if (tb[NDA_IFINDEX ]) {unsigned int ifindex =rta_getattr_u32 (tb[NDA_IFINDEX ]);
@@ -136,37 +190,95 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)char ifname[IF_NAMESIZE ];if (!tb[NDA_LINK_NETNSID ] && -if_indextoname (ifindex, ifname)) -fprintf (fp,"via %s " , ifname); -else -fprintf (fp,"via ifindex %u " , ifindex); +if_indextoname (ifindex, ifname)) { +if (jw_global) +jsonw_string_field (jw_global,"viaIf" , + ifname); +else +fprintf (fp,"via %s " , ifname); + }else { +if (jw_global) +jsonw_uint_field (jw_global,"viaIfIndex" , + ifindex); +else +fprintf (fp,"via ifindex %u " , ifindex); + } } } -if (tb[NDA_LINK_NETNSID ]) -fprintf (fp,"link-netnsid %d " , -rta_getattr_u32 (tb[NDA_LINK_NETNSID ])); + +if (tb[NDA_LINK_NETNSID ]) { +if (jw_global) +jsonw_uint_field (jw_global,"linkNetNsId" , +rta_getattr_u32 (tb[NDA_LINK_NETNSID ])); +else +fprintf (fp,"link-netnsid %d " , +rta_getattr_u32 (tb[NDA_LINK_NETNSID ])); + }if (show_stats && tb[NDA_CACHEINFO ]) {struct nda_cacheinfo *ci =RTA_DATA (tb[NDA_CACHEINFO ]);int hz =get_user_hz (); -fprintf (fp,"used %d/%d " , ci->ndm_used/hz, - ci->ndm_updated/hz); +if (jw_global) { +jsonw_uint_field (jw_global,"used" , + ci->ndm_used/hz); +jsonw_uint_field (jw_global,"updated" , + ci->ndm_updated/hz); + }else { +fprintf (fp,"used %d/%d " , ci->ndm_used/hz, + ci->ndm_updated/hz); + } + } + +if (jw_global) { +if (r->ndm_flags &NTF_SELF ) { +start_json_fdb_flags_array (&fdb_flags); +jsonw_string (jw_global,"self" ); + } +if (r->ndm_flags &NTF_ROUTER ) { +start_json_fdb_flags_array (&fdb_flags); +jsonw_string (jw_global,"router" ); + } +if (r->ndm_flags &NTF_EXT_LEARNED ) { +start_json_fdb_flags_array (&fdb_flags); +jsonw_string (jw_global,"offload" ); + } +if (r->ndm_flags &NTF_MASTER ) +jsonw_string (jw_global,"master" ); +if (fdb_flags) +jsonw_end_array (jw_global); + +if (tb[NDA_MASTER ]) +jsonw_string_field (jw_global, +"master" , +ll_index_to_name (rta_getattr_u32 (tb[NDA_MASTER ]))); + + }else { +if (r->ndm_flags &NTF_SELF ) +fprintf (fp,"self " ); +if (r->ndm_flags &NTF_ROUTER ) +fprintf (fp,"router " ); +if (r->ndm_flags &NTF_EXT_LEARNED ) +fprintf (fp,"offload " ); +if (tb[NDA_MASTER ]) { +fprintf (fp,"master %s " , +ll_index_to_name (rta_getattr_u32 (tb[NDA_MASTER ]))); + }else if (r->ndm_flags &NTF_MASTER ) { +fprintf (fp,"master " ); + } + } + + state_s =state_n2a (r->ndm_state); +if (jw_global) { +if (state_s[0 ]) +jsonw_string_field (jw_global,"state" , state_s); + +jsonw_end_object (jw_global); + }else { +fprintf (fp,"%s\n" , state_s); + +fflush (fp); } -if (r->ndm_flags &NTF_SELF ) -fprintf (fp,"self " ); -if (tb[NDA_MASTER ]) -fprintf (fp,"master %s " , -ll_index_to_name (rta_getattr_u32 (tb[NDA_MASTER ]))); -else if (r->ndm_flags &NTF_MASTER ) -fprintf (fp,"master " ); -if (r->ndm_flags &NTF_ROUTER ) -fprintf (fp,"router " ); -if (r->ndm_flags &NTF_EXT_LEARNED ) -fprintf (fp,"offload " ); - -fprintf (fp,"%s\n" ,state_n2a (r->ndm_state)); -fflush (fp);return 0 ; }
@@ -233,10 +345,22 @@ static int fdb_show(int argc, char **argv)exit (1 ); } +if (json_output) { + jw_global =jsonw_new (stdout); +if (!jw_global) { +fprintf (stderr,"Error allocation json object\n" ); +exit (1 ); + } +jsonw_start_array (jw_global); + }if (rtnl_dump_filter (&rth, print_fdb, stdout) <0 ) {fprintf (stderr,"Dump terminated\n" );exit (1 ); } +if (jw_global) { +jsonw_end_array (jw_global); +jsonw_destroy (&jw_global); + }return 0 ; }
Signature · 1 line
1.9.1
Quoted 8 lines · Jiri Pirko
Quoted 4 lines · Wed, Jun 22, 2016 at 03:45:50PM CEST, [email protected] wrote:
From: Roopa Prabhu <[email protected]>
This patch series adds json support for a few bridge show commands. We plan to follow up with json support for additional commands soon.
I'm just curious, what is you use case for this? Apps can use rtnetlink socket directly.
most important use case is for automation/orchestration tools. They use existing linux tools to query and configure. Iproute2 output is not machine
readable today ...and json is industry standard.
Quoted 8 lines · On Wed, 22 Jun 2016 16:53:44 +0200 Jiri Pirko <[email protected]> wrote:
Quoted 4 lines · Wed, Jun 22, 2016 at 03:45:50PM CEST, [email protected] wrote:
From: Roopa Prabhu <[email protected]>
This patch series adds json support for a few bridge show commands. We plan to follow up with json support for additional commands soon.
I'm just curious, what is you use case for this? Apps can use rtnetlink socket directly.
Try using netlink in perl or python, it is quite difficult.
Quoted 6 lines · Stephen Hemminger
Quoted 3 lines · On Wed, 22 Jun 2016 16:53:44 +0200 Jiri Pirko <[email protected]> wrote:
Quoted 2 lines · Wed, Jun 22, 2016 at 03:45:50PM CEST, [email protected] wrote:
From: Roopa Prabhu <[email protected]>
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
This patch series adds json support for a few bridge show commands. We plan to follow up with json support for additional commands soon.
I'm just curious, what is you use case for this? Apps can use rtnetlink socket directly.
Try using netlink in perl or python, it is quite difficult.
yep, ++
Quoted 6 lines · Wed, Jun 22, 2016 at 08:10:47PM CEST, [email protected] wrote:
Quoted 3 lines · On Wed, 22 Jun 2016 16:53:44 +0200 Jiri Pirko <[email protected]> wrote:
Quoted 2 lines · Wed, Jun 22, 2016 at 03:45:50PM CEST, [email protected] wrote:
From: Roopa Prabhu <[email protected]>
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
This patch series adds json support for a few bridge show commands. We plan to follow up with json support for additional commands soon.
I'm just curious, what is you use case for this? Apps can use rtnetlink socket directly.
Try using netlink in perl or python, it is quite difficult.
pyroute2? Quite easy...
Quoted 10 lines · Jiri Pirko
Quoted 9 lines · Wed, Jun 22, 2016 at 08:10:47PM CEST, [email protected] wrote:
Quoted 6 lines · On Wed, 22 Jun 2016 16:53:44 +0200 Jiri Pirko <[email protected]> wrote:
Quoted 4 lines · Wed, Jun 22, 2016 at 03:45:50PM CEST, [email protected] wrote:
From: Roopa Prabhu <[email protected]>
This patch series adds json support for a few bridge show commands. We plan to follow up with json support for additional commands soon.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
I'm just curious, what is you use case for this? Apps can use rtnetlink socket directly.
Try using netlink in perl or python, it is quite difficult.
pyroute2? Quite easy...
none of the implementations out there are complete nor can compete with iproute2.
iproute2 is maintained by netdev community and always is up-todate with the latest
networking api.
Nothing against pyroute2 but we wrote our own for other reasons and we carry additional burden of maintaining it and keeping it up-todate for every networking api..
that gets added to iproute2 (and the implementation of netlink is often very easy in C).
Also, for external automation and orchestration tools (to whom this patch-set is addressed),
there is no reason for them to write and maintain their own tools using netlink when they
can use iproute2 directly to create a link or query its properties.
Hi all,
Quoted 5 lines
Also, for external automation and orchestration tools (to whom this patch-set is addressed),
there is no reason for them to write and maintain their own tools using netlink when they
can use iproute2 directly to create a link or query its properties.
+1 for this, seems very reasonable,
Just want to remind us all, in recent netdev 1.1 conference in Seville (Feb 2016), Damascene Joachimpillai (DJ) from Verizon gave a talk ("Linux Networking and Data Center Operations Challenges"); IIRC, he mentioned that he misses a REST API to the Linux Kernel networking stack control plane. And it seems that Rest API and JSON (and maybe other APIs, like python based APIs) are natural candidates for such an interface nowadays.
Regards,
Rami Rosen
http://ramirose.wix.com/ramirosen