]> git.puffer.fish Git - mirror/frr.git/commitdiff
Merge pull request #3340 from nitinsoniism/show_evpn_vni_detail
authorDavid Lamparter <equinox@diac24.net>
Tue, 4 Dec 2018 16:29:50 +0000 (17:29 +0100)
committerGitHub <noreply@github.com>
Tue, 4 Dec 2018 16:29:50 +0000 (17:29 +0100)
zebra: Add "show evpn vni detail" command

1  2 
zebra/zebra_vty.c
zebra/zebra_vxlan.c
zebra/zebra_vxlan.h

Simple merge
index a9f82894670ef9cf7341f1348c26c1b05c78eeb3,ee6091a18eae5966192b6cc5e26781d8a2fe71a1..6a664ef1c00e945987698bf373412b8bdc065ae7
@@@ -6689,48 -5478,49 +6741,91 @@@ void zebra_vxlan_print_vnis(struct vty 
        }
  }
  
 +void zebra_vxlan_dup_addr_detection(ZAPI_HANDLER_ARGS)
 +{
 +      struct stream *s;
 +      int time = 0;
 +      uint32_t max_moves = 0;
 +      uint32_t freeze_time = 0;
 +      bool dup_addr_detect = false;
 +      bool freeze = false;
 +
 +      s = msg;
 +      STREAM_GETL(s, dup_addr_detect);
 +      STREAM_GETL(s, time);
 +      STREAM_GETL(s, max_moves);
 +      STREAM_GETL(s, freeze);
 +      STREAM_GETL(s, freeze_time);
 +
 +      /* DAD previous state was enabled, and new state is disable,
 +       * clear all duplicate detected addresses.
 +       */
 +      if (zvrf->dup_addr_detect && !dup_addr_detect)
 +              zebra_vxlan_clear_dup_detect_vni_all(NULL, zvrf);
 +
 +      zvrf->dup_addr_detect = dup_addr_detect;
 +      zvrf->dad_time = time;
 +      zvrf->dad_max_moves = max_moves;
 +      zvrf->dad_freeze = freeze;
 +      zvrf->dad_freeze_time = freeze_time;
 +
 +      if (IS_ZEBRA_DEBUG_VXLAN)
 +              zlog_debug(
 +                      "%s: duplicate detect %s max_moves %u timeout %u freeze %s freeze_time %u",
 +                      __PRETTY_FUNCTION__,
 +                      zvrf->dup_addr_detect ? "enable" : "disable",
 +                      zvrf->dad_max_moves,
 +                      zvrf->dad_time,
 +                      zvrf->dad_freeze ? "enable" : "disable",
 +                      zvrf->dad_freeze_time);
 +
 +stream_failure:
 +      return;
 +}
 +
+ /*
+  * Display VNI hash table in detail(VTY command handler).
+  */
+ void zebra_vxlan_print_vnis_detail(struct vty *vty, struct zebra_vrf *zvrf,
+                                  bool use_json)
+ {
+       json_object *json = NULL;
+       struct zebra_ns *zns = NULL;
+       struct zvni_evpn_show zes;
+       if (!is_evpn_enabled())
+               return;
+       zns = zebra_ns_lookup(NS_DEFAULT);
+       if (!zns)
+               return;
+       if (use_json)
+               json = json_object_new_object();
+       zes.vty = vty;
+       zes.json = json;
+       zes.zvrf = zvrf;
+       /* Display all L2-VNIs */
+       hash_iterate(zvrf->vni_table, (void (*)(struct hash_backet *,
+                                               void *))zvni_print_hash_detail,
+                    &zes);
+       /* Display all L3-VNIs */
+       hash_iterate(zrouter.l3vni_table,
+                    (void (*)(struct hash_backet *,
+                              void *))zl3vni_print_hash_detail,
+                    &zes);
+       if (use_json) {
+               vty_out(vty, "%s\n", json_object_to_json_string_ext(
+                                            json, JSON_C_TO_STRING_PRETTY));
+               json_object_free(json);
+       }
+ }
  /*
   * Handle neighbor delete notification from the kernel (on a VLAN device
   * / L3 interface). This may result in either the neighbor getting deleted
Simple merge