]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: implement zif-type oper state leaf
authorIgor Ryzhov <iryzhov@nfware.com>
Tue, 20 Feb 2024 15:50:26 +0000 (17:50 +0200)
committerIgor Ryzhov <iryzhov@nfware.com>
Tue, 20 Feb 2024 16:06:49 +0000 (18:06 +0200)
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
tests/topotests/mgmt_oper/simple-results/result-intf-eth0-exact.json
tests/topotests/mgmt_oper/simple-results/result-intf-eth0-with-config.json
yang/frr-zebra.yang
zebra/zebra_nb_state.c

index f04e3a55e1b2b321f4829dcf39688a869faef48d..04591b6e2984f3509bd7681d80297c7c30e64bef 100644 (file)
@@ -14,7 +14,8 @@
       "frr-zebra:zebra": {
         "state": {
           "up-count": 0,
-          "down-count": 0
+          "down-count": 0,
+          "zif-type": "zif-veth"
         }
       }
     }
index 84ad82c05843685cc9012bf6f6bde5c75e6e3447..c770db49b17dfba3ed769fa05fdc526023e20b64 100644 (file)
@@ -25,7 +25,8 @@
                                        },
                                        "state": {
                                                "up-count": 0,
-                                               "down-count": 0
+                                               "down-count": 0,
+                                               "zif-type": "zif-veth"
                                        }
                                }
                        }
index 6c2a7bde7a4f6bd9532fbb0f4adc81dcf4b4756d..f1a69068c3bc83b0c0eb61c38da312c2b81886ea 100644 (file)
@@ -145,12 +145,6 @@ module frr-zebra {
       "Zebra interface type bond.";
   }
 
-  identity zif-bond-slave {
-    base zebra-interface-type;
-    description
-      "Zebra interface type bond slave.";
-  }
-
   identity zif-macvlan {
     base zebra-interface-type;
     description
index 8f81abc171f3aea5b3bc1f4f334f8f8e6f789d5e..464c0be707022776611038db0b0d9a48a70e2a58 100644 (file)
@@ -49,8 +49,46 @@ lib_interface_zebra_state_down_count_get_elem(struct nb_cb_get_elem_args *args)
 struct yang_data *
 lib_interface_zebra_state_zif_type_get_elem(struct nb_cb_get_elem_args *args)
 {
-       /* TODO: implement me. */
-       return NULL;
+       const struct interface *ifp = args->list_entry;
+       struct zebra_if *zebra_if;
+       const char *type = NULL;
+
+       zebra_if = ifp->info;
+
+       switch (zebra_if->zif_type) {
+       case ZEBRA_IF_OTHER:
+               type = "frr-zebra:zif-other";
+               break;
+       case ZEBRA_IF_VXLAN:
+               type = "frr-zebra:zif-vxlan";
+               break;
+       case ZEBRA_IF_VRF:
+               type = "frr-zebra:zif-vrf";
+               break;
+       case ZEBRA_IF_BRIDGE:
+               type = "frr-zebra:zif-bridge";
+               break;
+       case ZEBRA_IF_VLAN:
+               type = "frr-zebra:zif-vlan";
+               break;
+       case ZEBRA_IF_MACVLAN:
+               type = "frr-zebra:zif-macvlan";
+               break;
+       case ZEBRA_IF_VETH:
+               type = "frr-zebra:zif-veth";
+               break;
+       case ZEBRA_IF_BOND:
+               type = "frr-zebra:zif-bond";
+               break;
+       case ZEBRA_IF_GRE:
+               type = "frr-zebra:zif-gre";
+               break;
+       }
+
+       if (!type)
+               return NULL;
+
+       return yang_data_new_string(args->xpath, type);
 }
 
 /*