ldpd: reorganize json support and fix a few issues

* reorganize code to improve maintainability;
* add json output for the l2vpn show commands as well;
* in "show mpls ldp discovery json", nest the adjacencies inside the
  respective interfaces. Also, fix a segfault when trying to show a
  targeted adjacency;
* in "show mpls ldp neighbor", show the address-family of the adjacencies
  of each neighbor. Also, remove "downstreamUnsolicited":true from
  the output;
* in "show mpls ldp interface json", show all interface/address-family
  combinations;

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
Renato Westphal 2017-01-10 18:27:03 -02:00 committed by Renato Westphal
parent e8dbef0420
commit a5d1051217
4 changed files with 649 additions and 2135 deletions

View File

@ -65,10 +65,10 @@ int ldp_vty_l2vpn_pw_nbr_addr(struct vty *, struct vty_arg *[]);
int ldp_vty_l2vpn_pw_nbr_id(struct vty *, struct vty_arg *[]);
int ldp_vty_l2vpn_pw_pwid(struct vty *, struct vty_arg *[]);
int ldp_vty_l2vpn_pw_pwstatus(struct vty *, struct vty_arg *[]);
int ldp_vty_show_binding(struct vty *, struct vty_arg *[], u_char);
int ldp_vty_show_discovery(struct vty *, struct vty_arg *[], u_char);
int ldp_vty_show_interface(struct vty *, struct vty_arg *[], u_char);
int ldp_vty_show_neighbor(struct vty *, struct vty_arg *[], u_char);
int ldp_vty_show_binding(struct vty *, struct vty_arg *[]);
int ldp_vty_show_discovery(struct vty *, struct vty_arg *[]);
int ldp_vty_show_interface(struct vty *, struct vty_arg *[]);
int ldp_vty_show_neighbor(struct vty *, struct vty_arg *[]);
int ldp_vty_show_atom_binding(struct vty *, struct vty_arg *[]);
int ldp_vty_show_atom_vc(struct vty *, struct vty_arg *[]);
int ldp_vty_clear_nbr(struct vty *, struct vty_arg *[]);

View File

@ -272,15 +272,23 @@
<!-- exec mode commands -->
<subtree name="ldp_show_af">
<option name="binding" help="Label Information Base (LIB) information" function="ldp_vty_show_binding"/>
<option name="discovery" help="Discovery Hello Information" function="ldp_vty_show_discovery"/>
<option name="interface" help="interface information" function="ldp_vty_show_interface"/>
<option name="binding" help="Label Information Base (LIB) information">
<option name="json" arg="json" optional="true" help="JavaScript Object Notation" function="ldp_vty_show_binding"/>
</option>
<option name="discovery" help="Discovery Hello Information">
<option name="json" arg="json" optional="true" help="JavaScript Object Notation" function="ldp_vty_show_discovery"/>
</option>
<option name="interface" help="interface information">
<option name="json" arg="json" optional="true" help="JavaScript Object Notation" function="ldp_vty_show_interface"/>
</option>
</subtree>
<tree name="ldp_exec">
<option name="show" help="Show running system information">
<option name="mpls" help="MPLS information">
<option name="ldp" help="Label Distribution Protocol">
<option name="neighbor" help="Neighbor information" function="ldp_vty_show_neighbor"/>
<option name="neighbor" help="Neighbor information">
<option name="json" arg="json" optional="true" help="JavaScript Object Notation" function="ldp_vty_show_neighbor"/>
</option>
<include subtree="ldp_show_af"/>
<select options="address-family" arg="address-family">
<include subtree="ldp_show_af"/>
@ -289,8 +297,12 @@
</option>
<option name="l2vpn" help="Show information about Layer2 VPN">
<option name="atom" help="Show Any Transport over MPLS information">
<option name="binding" help="Show AToM label binding information" function="ldp_vty_show_atom_binding"/>
<option name="vc" help="Show AToM virtual circuit information" function="ldp_vty_show_atom_vc"/>
<option name="binding" help="Show AToM label binding information">
<option name="json" arg="json" optional="true" help="JavaScript Object Notation" function="ldp_vty_show_atom_binding"/>
</option>
<option name="vc" help="Show AToM virtual circuit information">
<option name="json" arg="json" optional="true" help="JavaScript Object Notation" function="ldp_vty_show_atom_vc"/>
</option>
</option>
</option>
<option name="debugging" help="Debugging functions">

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff