]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: add mgmt_oper topotest 14492/head
authorChristian Hopps <chopps@labn.net>
Sun, 22 Oct 2023 09:23:43 +0000 (05:23 -0400)
committerChristian Hopps <chopps@labn.net>
Thu, 28 Dec 2023 18:37:18 +0000 (18:37 +0000)
Signed-off-by: Christian Hopps <chopps@labn.net>
30 files changed:
tests/topotests/mgmt_oper/oper-results/result-lib-vrf-default.json [new file with mode: 0644]
tests/topotests/mgmt_oper/oper-results/result-lib-vrf-nokey.json [new file with mode: 0644]
tests/topotests/mgmt_oper/oper-results/result-lib-vrf-red.json [new file with mode: 0644]
tests/topotests/mgmt_oper/oper-results/result-lib-vrf-zebra-ribs.json [new file with mode: 0644]
tests/topotests/mgmt_oper/oper-results/result-lib-vrf-zebra.json [new file with mode: 0644]
tests/topotests/mgmt_oper/oper-results/result-lib.json [new file with mode: 0644]
tests/topotests/mgmt_oper/oper-results/result-ribs-rib-ipv4-unicast.json [new file with mode: 0644]
tests/topotests/mgmt_oper/oper-results/result-ribs-rib-nokeys.json [new file with mode: 0644]
tests/topotests/mgmt_oper/oper.py [new file with mode: 0644]
tests/topotests/mgmt_oper/r1/frr-scale.conf [new file with mode: 0644]
tests/topotests/mgmt_oper/r1/frr-simple.conf [new file with mode: 0644]
tests/topotests/mgmt_oper/r1/frr.conf [new file with mode: 0644]
tests/topotests/mgmt_oper/simple-results/result-empty.json [new file with mode: 0644]
tests/topotests/mgmt_oper/simple-results/result-intf-state-mtu.json [new file with mode: 0644]
tests/topotests/mgmt_oper/simple-results/result-intf-state.json [new file with mode: 0644]
tests/topotests/mgmt_oper/simple-results/result-lib-vrf-default.json [new file with mode: 0644]
tests/topotests/mgmt_oper/simple-results/result-lib-vrf-nokey.json [new file with mode: 0644]
tests/topotests/mgmt_oper/simple-results/result-lib-vrf-red.json [new file with mode: 0644]
tests/topotests/mgmt_oper/simple-results/result-lib-vrf-zebra-ribs.json [new file with mode: 0644]
tests/topotests/mgmt_oper/simple-results/result-lib-vrf-zebra.json [new file with mode: 0644]
tests/topotests/mgmt_oper/simple-results/result-lib.json [new file with mode: 0644]
tests/topotests/mgmt_oper/simple-results/result-ribs-rib-ipv4-unicast.json [new file with mode: 0644]
tests/topotests/mgmt_oper/simple-results/result-ribs-rib-nokeys.json [new file with mode: 0644]
tests/topotests/mgmt_oper/simple-results/result-ribs-rib-route-nokey.json [new file with mode: 0644]
tests/topotests/mgmt_oper/simple-results/result-ribs-rib-route-prefix.json [new file with mode: 0644]
tests/topotests/mgmt_oper/simple-results/result-singleton-metric.json [new file with mode: 0644]
tests/topotests/mgmt_oper/test_oper.py [new file with mode: 0644]
tests/topotests/mgmt_oper/test_querying.py [new file with mode: 0644]
tests/topotests/mgmt_oper/test_scale.py [new file with mode: 0644]
tests/topotests/mgmt_oper/test_simple.py [new file with mode: 0644]

diff --git a/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-default.json b/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-default.json
new file mode 100644 (file)
index 0000000..435d733
--- /dev/null
@@ -0,0 +1,576 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "default",
+        "state": {
+          "id": "rubout",
+          "active": true
+        },
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.0.0.0/8",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "blackhole",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": " ",
+                              "bh-type": "null",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.11.11.11/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "1.1.1.2",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "12.12.12.12/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "2.2.2.2",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2001:1111::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2001:1111::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2001:1111::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2001:1111::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-nokey.json b/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-nokey.json
new file mode 100644 (file)
index 0000000..1a1f648
--- /dev/null
@@ -0,0 +1,1145 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "default",
+        "state": {
+          "id": "rubout",
+          "active": true
+        },
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.0.0.0/8",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "blackhole",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": " ",
+                              "bh-type": "null",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.11.11.11/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "1.1.1.2",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "12.12.12.12/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "2.2.2.2",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2001:1111::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2001:1111::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2001:1111::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2001:1111::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      },
+      {
+        "name": "red",
+        "state": {
+          "id": "rubout",
+          "active": true
+        },
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "3.3.3.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "3.3.3.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "4.4.4.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "4.4.4.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "13.0.0.0/8",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "blackhole",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": " ",
+                              "bh-type": "null",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "13.13.13.13/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "3.3.3.2",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "14.14.14.14/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "4.4.4.2",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "3.3.3.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "3.3.3.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "4.4.4.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "4.4.4.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2003:333::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2003:333::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2004:4444::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2004:4444::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2003:333::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2003:333::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2004:4444::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2004:4444::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-red.json b/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-red.json
new file mode 100644 (file)
index 0000000..cfabd49
--- /dev/null
@@ -0,0 +1,576 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "red",
+        "state": {
+          "id": "rubout",
+          "active": true
+        },
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "3.3.3.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "3.3.3.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "4.4.4.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "4.4.4.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "13.0.0.0/8",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "blackhole",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": " ",
+                              "bh-type": "null",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "13.13.13.13/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "3.3.3.2",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "14.14.14.14/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "4.4.4.2",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "3.3.3.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "3.3.3.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "4.4.4.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "4.4.4.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2003:333::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2003:333::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2004:4444::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2004:4444::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2003:333::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2003:333::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2004:4444::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2004:4444::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-zebra-ribs.json b/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-zebra-ribs.json
new file mode 100644 (file)
index 0000000..2e2b8ec
--- /dev/null
@@ -0,0 +1,572 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "default",
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.0.0.0/8",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "blackhole",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": " ",
+                              "bh-type": "null",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.11.11.11/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "1.1.1.2",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "12.12.12.12/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "2.2.2.2",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2001:1111::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2001:1111::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2001:1111::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2001:1111::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-zebra.json b/tests/topotests/mgmt_oper/oper-results/result-lib-vrf-zebra.json
new file mode 100644 (file)
index 0000000..2e2b8ec
--- /dev/null
@@ -0,0 +1,572 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "default",
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.0.0.0/8",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "blackhole",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": " ",
+                              "bh-type": "null",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.11.11.11/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "1.1.1.2",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "12.12.12.12/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "2.2.2.2",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2001:1111::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2001:1111::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2001:1111::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2001:1111::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/oper-results/result-lib.json b/tests/topotests/mgmt_oper/oper-results/result-lib.json
new file mode 100644 (file)
index 0000000..1a1f648
--- /dev/null
@@ -0,0 +1,1145 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "default",
+        "state": {
+          "id": "rubout",
+          "active": true
+        },
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.0.0.0/8",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "blackhole",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": " ",
+                              "bh-type": "null",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.11.11.11/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "1.1.1.2",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "12.12.12.12/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "2.2.2.2",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2001:1111::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2001:1111::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2001:1111::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2001:1111::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      },
+      {
+        "name": "red",
+        "state": {
+          "id": "rubout",
+          "active": true
+        },
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "3.3.3.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "3.3.3.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "4.4.4.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "4.4.4.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "13.0.0.0/8",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "blackhole",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": " ",
+                              "bh-type": "null",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "13.13.13.13/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "3.3.3.2",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "14.14.14.14/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "4.4.4.2",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "3.3.3.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "3.3.3.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "4.4.4.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "4.4.4.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2003:333::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2003:333::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2004:4444::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2004:4444::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2003:333::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2003:333::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth2",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2004:4444::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2004:4444::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth3",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/oper-results/result-ribs-rib-ipv4-unicast.json b/tests/topotests/mgmt_oper/oper-results/result-ribs-rib-ipv4-unicast.json
new file mode 100644 (file)
index 0000000..956d3a8
--- /dev/null
@@ -0,0 +1,225 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "default",
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.0.0.0/8",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "blackhole",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": " ",
+                              "bh-type": "null",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.11.11.11/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "1.1.1.2",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "12.12.12.12/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "2.2.2.2",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/oper-results/result-ribs-rib-nokeys.json b/tests/topotests/mgmt_oper/oper-results/result-ribs-rib-nokeys.json
new file mode 100644 (file)
index 0000000..2e2b8ec
--- /dev/null
@@ -0,0 +1,572 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "default",
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.0.0.0/8",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "blackhole",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": " ",
+                              "bh-type": "null",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.11.11.11/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "1.1.1.2",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "12.12.12.12/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "2.2.2.2",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2.2.2.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2001:1111::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2001:1111::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  },
+                  {
+                    "prefix": "2001:1111::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2001:1111::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::/64",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "2002:2222::1/128",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/oper.py b/tests/topotests/mgmt_oper/oper.py
new file mode 100644 (file)
index 0000000..e338606
--- /dev/null
@@ -0,0 +1,258 @@
+# -*- coding: utf-8 eval: (blacken-mode 1) -*-
+# SPDX-License-Identifier: ISC
+#
+# October 29 2023, Christian Hopps <chopps@labn.net>
+#
+# Copyright (c) 2023, LabN Consulting, L.L.C.
+#
+
+import datetime
+import ipaddress
+import json
+import logging
+import math
+import os
+import pprint
+import re
+
+from lib.common_config import retry, step
+from lib.topolog import logger
+from lib.topotest import json_cmp as tt_json_cmp
+
+try:
+    from deepdiff import DeepDiff as dd_json_cmp
+except ImportError:
+    dd_json_cmp = None
+
+
+def json_cmp(got, expect, exact_match):
+    if dd_json_cmp:
+        if exact_match:
+            deep_diff = dd_json_cmp(expect, got)
+            # Convert DeepDiff completely into dicts or lists at all levels
+            json_diff = json.loads(deep_diff.to_json())
+        else:
+            json_diff = dd_json_cmp(expect, got, ignore_order=True)
+            # Convert DeepDiff completely into dicts or lists at all levels
+            # json_diff = json.loads(deep_diff.to_json())
+            # Remove new fields in json object from diff
+            if json_diff.get("dictionary_item_added") is not None:
+                del json_diff["dictionary_item_added"]
+            # Remove new json objects in json array from diff
+            if (new_items := json_diff.get("iterable_item_added")) is not None:
+                new_item_paths = list(new_items.keys())
+                for path in new_item_paths:
+                    if type(new_items[path]) is dict:
+                        del new_items[path]
+                if len(new_items) == 0:
+                    del json_diff["iterable_item_added"]
+        if not json_diff:
+            json_diff = None
+    else:
+        json_diff = tt_json_cmp(got, expect, exact_match)
+        json_diff = str(json_diff)
+    return json_diff
+
+
+def enable_debug(router):
+    router.vtysh_cmd("debug northbound callbacks configuration")
+
+
+def disable_debug(router):
+    router.vtysh_cmd("no debug northbound callbacks configuration")
+
+
+def do_oper_test(tgen, query_results):
+    r1 = tgen.gears["r1"].net
+
+    qcmd = (
+        r"vtysh -c 'show mgmt get-data {}' "
+        r"""| sed -e 's/"phy-address": ".*"/"phy-address": "rubout"/'"""
+        r"""| sed -e 's/"uptime": ".*"/"uptime": "rubout"/'"""
+        r"""| sed -e 's/"vrf": "[0-9]*"/"vrf": "rubout"/'"""
+        r"""| sed -e 's/"if-index": [0-9][0-9]*/"if-index": "rubout"/'"""
+        r"""| sed -e 's/"id": [0-9][0-9]*/"id": "rubout"/'"""
+    )
+
+    doreset = True
+    dd_json_cmp = None
+    for qr in query_results:
+        step(f"Perform query '{qr[0]}'", reset=doreset)
+        if doreset:
+            doreset = False
+        expected = open(qr[1], encoding="ascii").read()
+        output = r1.cmd_nostatus(qcmd.format(qr[0]))
+
+        try:
+            ojson = json.loads(output)
+        except json.decoder.JSONDecodeError as error:
+            logging.error("Error decoding json: %s\noutput:\n%s", error, output)
+            raise
+
+        try:
+            ejson = json.loads(expected)
+        except json.decoder.JSONDecodeError as error:
+            logging.error(
+                "Error decoding json exp result: %s\noutput:\n%s", error, expected
+            )
+            raise
+
+        if dd_json_cmp:
+            cmpout = json_cmp(ojson, ejson, exact_match=True)
+            if cmpout:
+                logging.warning(
+                    "-------DIFF---------\n%s\n---------DIFF----------",
+                    pprint.pformat(cmpout),
+                )
+        else:
+            cmpout = tt_json_cmp(ojson, ejson, exact=True)
+            if cmpout:
+                logging.warning(
+                    "-------EXPECT--------\n%s\n------END-EXPECT------",
+                    json.dumps(ejson, indent=4),
+                )
+                logging.warning(
+                    "--------GOT----------\n%s\n-------END-GOT--------",
+                    json.dumps(ojson, indent=4),
+                )
+
+        assert cmpout is None
+
+
+def get_ip_networks(super_prefix, count):
+    count_log2 = math.log(count, 2)
+    if count_log2 != int(count_log2):
+        count_log2 = int(count_log2) + 1
+    else:
+        count_log2 = int(count_log2)
+    network = ipaddress.ip_network(super_prefix)
+    return tuple(network.subnets(count_log2))[0:count]
+
+
+@retry(retry_timeout=30, initial_wait=0.1)
+def check_kernel(r1, super_prefix, count, add, is_blackhole, vrf, matchvia):
+    network = ipaddress.ip_network(super_prefix)
+    vrfstr = f" vrf {vrf}" if vrf else ""
+    if network.version == 6:
+        kernel = r1.cmd_raises(f"ip -6 route show{vrfstr}")
+    else:
+        kernel = r1.cmd_raises(f"ip -4 route show{vrfstr}")
+
+    # logger.debug("checking kernel routing table%s:\n%s", vrfstr, kernel)
+
+    for i, net in enumerate(get_ip_networks(super_prefix, count)):
+        if not add:
+            assert str(net) not in kernel
+            continue
+
+        if is_blackhole:
+            route = f"blackhole {str(net)} proto (static|196) metric 20"
+        else:
+            route = (
+                f"{str(net)}(?: nhid [0-9]+)? {matchvia} "
+                "proto (static|196) metric 20"
+            )
+        assert re.search(route, kernel), f"Failed to find \n'{route}'\n in \n'{kernel}'"
+
+
+def addrgen(a, count, step=1):
+    for _ in range(0, count, step):
+        yield a
+        a += step
+
+
+@retry(retry_timeout=30, initial_wait=0.1)
+def check_kernel_32(r1, start_addr, count, vrf, step=1):
+    start = ipaddress.ip_address(start_addr)
+    vrfstr = f" vrf {vrf}" if vrf else ""
+    if start.version == 6:
+        kernel = r1.cmd_raises(f"ip -6 route show{vrfstr}")
+    else:
+        kernel = r1.cmd_raises(f"ip -4 route show{vrfstr}")
+
+    nentries = len(re.findall("\n", kernel))
+    logging.info("checking kernel routing table%s: (%s entries)", vrfstr, nentries)
+
+    for addr in addrgen(start, count, step):
+        assert str(addr) in kernel, f"Failed to find '{addr}' in {nentries} entries"
+
+
+def do_config(
+    r1,
+    count,
+    add=True,
+    do_ipv6=False,
+    via=None,
+    vrf=None,
+    use_cli=False,
+):
+    optype = "adding" if add else "removing"
+    iptype = "IPv6" if do_ipv6 else "IPv4"
+
+    #
+    # Set the route details
+    #
+
+    if vrf:
+        super_prefix = "2111::/48" if do_ipv6 else "111.0.0.0/8"
+    else:
+        super_prefix = "2055::/48" if do_ipv6 else "55.0.0.0/8"
+
+    matchvia = ""
+    if via == "blackhole":
+        pass
+    elif via:
+        matchvia = f"dev {via}"
+    else:
+        if vrf:
+            via = "2102::2" if do_ipv6 else "3.3.3.2"
+            matchvia = f"via {via} dev r1-eth1"
+        else:
+            via = "2101::2" if do_ipv6 else "1.1.1.2"
+            matchvia = f"via {via} dev r1-eth0"
+
+    vrfdbg = " in vrf {}".format(vrf) if vrf else ""
+    logger.debug("{} {} static {} routes{}".format(optype, count, iptype, vrfdbg))
+
+    #
+    # Generate config file in a retrievable place
+    #
+
+    config_file = os.path.join(
+        r1.logdir, r1.name, "{}-routes-{}.conf".format(iptype.lower(), optype)
+    )
+    with open(config_file, "w") as f:
+        if use_cli:
+            f.write("configure terminal\n")
+        if vrf:
+            f.write("vrf {}\n".format(vrf))
+
+        for i, net in enumerate(get_ip_networks(super_prefix, count)):
+            if add:
+                f.write("ip route {} {}\n".format(net, via))
+            else:
+                f.write("no ip route {} {}\n".format(net, via))
+
+    #
+    # Load config file.
+    #
+
+    if use_cli:
+        load_command = 'vtysh < "{}"'.format(config_file)
+    else:
+        load_command = 'vtysh -f "{}"'.format(config_file)
+    tstamp = datetime.datetime.now()
+    output = r1.cmd_raises(load_command)
+    delta = (datetime.datetime.now() - tstamp).total_seconds()
+
+    #
+    # Verify the results are in the kernel
+    #
+    check_kernel(r1, super_prefix, count, add, via == "blackhole", vrf, matchvia)
+
+    optyped = "added" if add else "removed"
+    logger.debug(
+        "{} {} {} static routes under {}{} in {}s".format(
+            optyped, count, iptype.lower(), super_prefix, vrfdbg, delta
+        )
+    )
diff --git a/tests/topotests/mgmt_oper/r1/frr-scale.conf b/tests/topotests/mgmt_oper/r1/frr-scale.conf
new file mode 100644 (file)
index 0000000..237d013
--- /dev/null
@@ -0,0 +1,25 @@
+log timestamp precision 6
+log file frr.log
+
+no debug memstats-at-exit
+
+! debug northbound libyang
+! debug northbound callbacks
+
+debug northbound notifications
+debug northbound events
+
+debug mgmt backend datastore frontend transaction
+debug mgmt client frontend
+debug mgmt client backend
+
+interface r1-eth0
+  ip address 1.1.1.1/24
+exit
+
+interface r1-eth1 vrf red
+  ip address 3.3.3.1/24
+exit
+
+ip route 11.11.11.11/32 1.1.1.2
+ip route 13.13.13.13/32 3.3.3.2 vrf red
\ No newline at end of file
diff --git a/tests/topotests/mgmt_oper/r1/frr-simple.conf b/tests/topotests/mgmt_oper/r1/frr-simple.conf
new file mode 100644 (file)
index 0000000..cf8ba16
--- /dev/null
@@ -0,0 +1,23 @@
+log timestamp precision 6
+log file frr.log
+
+no debug memstats-at-exit
+
+debug northbound notifications
+debug northbound libyang
+debug northbound events
+debug northbound callbacks
+
+debug mgmt backend datastore frontend transaction
+debug mgmt client frontend
+debug mgmt client backend
+
+interface r1-eth0
+  ip address 1.1.1.1/24
+exit
+
+interface r1-eth1 vrf red
+  ip address 3.3.3.1/24
+exit
+ip route 11.11.11.11/32 1.1.1.2
+!ip route 13.13.13.13/32 3.3.3.2 vrf red
\ No newline at end of file
diff --git a/tests/topotests/mgmt_oper/r1/frr.conf b/tests/topotests/mgmt_oper/r1/frr.conf
new file mode 100644 (file)
index 0000000..72a67bf
--- /dev/null
@@ -0,0 +1,41 @@
+log timestamp precision 6
+log file frr.log
+
+no debug memstats-at-exit
+
+debug northbound notifications
+debug northbound libyang
+debug northbound events
+debug northbound callbacks
+
+debug mgmt backend datastore frontend transaction
+debug mgmt client frontend
+debug mgmt client backend
+
+interface r1-eth0
+  ip address 1.1.1.1/24
+  ipv6 address 2001:1111::1/64
+exit
+
+interface r1-eth1
+  ip address 2.2.2.1/24
+  ipv6 address 2002:2222::1/64
+exit
+
+interface r1-eth2 vrf red
+  ip address 3.3.3.1/24
+  ipv6 address 2003:333::1/64
+exit
+
+interface r1-eth3 vrf red
+  ip address 4.4.4.1/24
+  ipv6 address 2004:4444::1/64
+exit
+
+ip route 11.0.0.0/8 Null0
+ip route 11.11.11.11/32 1.1.1.2
+ip route 12.12.12.12/32 2.2.2.2
+
+ip route 13.0.0.0/8 Null0 vrf red
+ip route 13.13.13.13/32 3.3.3.2 vrf red
+ip route 14.14.14.14/32 4.4.4.2 vrf red
\ No newline at end of file
diff --git a/tests/topotests/mgmt_oper/simple-results/result-empty.json b/tests/topotests/mgmt_oper/simple-results/result-empty.json
new file mode 100644 (file)
index 0000000..2c63c08
--- /dev/null
@@ -0,0 +1,2 @@
+{
+}
diff --git a/tests/topotests/mgmt_oper/simple-results/result-intf-state-mtu.json b/tests/topotests/mgmt_oper/simple-results/result-intf-state-mtu.json
new file mode 100644 (file)
index 0000000..6035971
--- /dev/null
@@ -0,0 +1,12 @@
+{
+  "frr-interface:lib": {
+    "interface": [
+      {
+        "name": "r1-eth0",
+        "state": {
+          "mtu": 1500
+        }
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/mgmt_oper/simple-results/result-intf-state.json b/tests/topotests/mgmt_oper/simple-results/result-intf-state.json
new file mode 100644 (file)
index 0000000..981df02
--- /dev/null
@@ -0,0 +1,17 @@
+{
+  "frr-interface:lib": {
+    "interface": [
+      {
+        "name": "r1-eth0",
+        "state": {
+          "if-index": "rubout",
+          "mtu": 1500,
+          "mtu6": 1500,
+          "speed": 10000,
+          "metric": 0,
+          "phy-address": "rubout"
+        }
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-default.json b/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-default.json
new file mode 100644 (file)
index 0000000..cea4bf5
--- /dev/null
@@ -0,0 +1,193 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "default",
+        "state": {
+          "id": "rubout",
+          "active": true
+        },
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.11.11.11/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "1.1.1.2",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-nokey.json b/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-nokey.json
new file mode 100644 (file)
index 0000000..75414ca
--- /dev/null
@@ -0,0 +1,350 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "default",
+        "state": {
+          "id": "rubout",
+          "active": true
+        },
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.11.11.11/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "1.1.1.2",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      },
+      {
+        "name": "red",
+        "state": {
+          "id": "rubout",
+          "active": true
+        },
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "3.3.3.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "3.3.3.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "3.3.3.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "3.3.3.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-red.json b/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-red.json
new file mode 100644 (file)
index 0000000..0538231
--- /dev/null
@@ -0,0 +1,164 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "red",
+        "state": {
+          "id": "rubout",
+          "active": true
+        },
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "3.3.3.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "3.3.3.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "3.3.3.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "3.3.3.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-zebra-ribs.json b/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-zebra-ribs.json
new file mode 100644 (file)
index 0000000..4f40820
--- /dev/null
@@ -0,0 +1,189 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "default",
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.11.11.11/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "1.1.1.2",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-zebra.json b/tests/topotests/mgmt_oper/simple-results/result-lib-vrf-zebra.json
new file mode 100644 (file)
index 0000000..4f40820
--- /dev/null
@@ -0,0 +1,189 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "default",
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.11.11.11/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "1.1.1.2",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/simple-results/result-lib.json b/tests/topotests/mgmt_oper/simple-results/result-lib.json
new file mode 100644 (file)
index 0000000..75414ca
--- /dev/null
@@ -0,0 +1,350 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "default",
+        "state": {
+          "id": "rubout",
+          "active": true
+        },
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.11.11.11/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "1.1.1.2",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      },
+      {
+        "name": "red",
+        "state": {
+          "id": "rubout",
+          "active": true
+        },
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "3.3.3.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "3.3.3.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "3.3.3.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "3.3.3.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth1",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 10,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/simple-results/result-ribs-rib-ipv4-unicast.json b/tests/topotests/mgmt_oper/simple-results/result-ribs-rib-ipv4-unicast.json
new file mode 100644 (file)
index 0000000..7ce60c3
--- /dev/null
@@ -0,0 +1,110 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "default",
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.11.11.11/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "1.1.1.2",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/simple-results/result-ribs-rib-nokeys.json b/tests/topotests/mgmt_oper/simple-results/result-ribs-rib-nokeys.json
new file mode 100644 (file)
index 0000000..4f40820
--- /dev/null
@@ -0,0 +1,189 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "default",
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.11.11.11/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "1.1.1.2",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv4-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "internal-flags": 8,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              },
+              {
+                "afi-safi-name": "frr-routing:ipv6-multicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "::/0"
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/simple-results/result-ribs-rib-route-nokey.json b/tests/topotests/mgmt_oper/simple-results/result-ribs-rib-route-nokey.json
new file mode 100644 (file)
index 0000000..7ce60c3
--- /dev/null
@@ -0,0 +1,110 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "default",
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "0.0.0.0/0"
+                  },
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "1.1.1.1/32",
+                    "route-entry": [
+                      {
+                        "protocol": "local",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "prefix": "11.11.11.11/32",
+                    "route-entry": [
+                      {
+                        "protocol": "static",
+                        "distance": 1,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 73,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ip4-ifindex",
+                              "vrf": "rubout",
+                              "gateway": "1.1.1.2",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null],
+                              "weight": 1
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/simple-results/result-ribs-rib-route-prefix.json b/tests/topotests/mgmt_oper/simple-results/result-ribs-rib-route-prefix.json
new file mode 100644 (file)
index 0000000..833d418
--- /dev/null
@@ -0,0 +1,50 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "default",
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "distance": 0,
+                        "metric": 0,
+                        "selected": [null],
+                        "installed": [null],
+                        "internal-flags": 8,
+                        "internal-status": 16,
+                        "uptime": "rubout",
+                        "nexthop-group": {
+                          "id": "rubout",
+                          "nexthop": [
+                            {
+                              "nh-type": "ifindex",
+                              "vrf": "rubout",
+                              "gateway": "",
+                              "interface": "r1-eth0",
+                              "active": [null],
+                              "fib": [null]
+                            }
+                          ]
+                        }
+                      }
+                    ]
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
+
diff --git a/tests/topotests/mgmt_oper/simple-results/result-singleton-metric.json b/tests/topotests/mgmt_oper/simple-results/result-singleton-metric.json
new file mode 100644 (file)
index 0000000..b3a7df5
--- /dev/null
@@ -0,0 +1,30 @@
+{
+  "frr-vrf:lib": {
+    "vrf": [
+      {
+        "name": "default",
+        "frr-zebra:zebra": {
+          "ribs": {
+            "rib": [
+              {
+                "afi-safi-name": "frr-routing:ipv4-unicast",
+                "table-id": 254,
+                "route": [
+                  {
+                    "prefix": "1.1.1.0/24",
+                    "route-entry": [
+                      {
+                        "protocol": "connected",
+                        "metric": 0
+                      }
+                    ]
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/mgmt_oper/test_oper.py b/tests/topotests/mgmt_oper/test_oper.py
new file mode 100644 (file)
index 0000000..e8d5cfb
--- /dev/null
@@ -0,0 +1,123 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 eval: (blacken-mode 1) -*-
+# SPDX-License-Identifier: ISC
+#
+# Copyright (c) 2021, LabN Consulting, L.L.C.
+# Copyright (c) 2019-2020 by
+# Donatas Abraitis <donatas.abraitis@gmail.com>
+#
+"""
+Test static route functionality
+"""
+
+import ipaddress
+import math
+import time
+
+import pytest
+from lib.topogen import Topogen
+from oper import check_kernel_32, do_oper_test
+
+try:
+    from deepdiff import DeepDiff as dd_json_cmp
+except ImportError:
+    dd_json_cmp = None
+
+pytestmark = [pytest.mark.staticd]
+
+
+@pytest.fixture(scope="module")
+def tgen(request):
+    "Setup/Teardown the environment and provide tgen argument to tests"
+
+    topodef = {"s1": ("r1",), "s2": ("r1",), "s3": ("r1",), "s4": ("r1",)}
+
+    tgen = Topogen(topodef, request.module.__name__)
+    tgen.start_topology()
+
+    router_list = tgen.routers()
+    for rname, router in router_list.items():
+        # Setup VRF red
+        router.net.add_l3vrf("red", 10)
+        router.net.add_loop("lo-red")
+        router.net.attach_iface_to_l3vrf("lo-red", "red")
+        router.net.attach_iface_to_l3vrf(rname + "-eth2", "red")
+        router.net.attach_iface_to_l3vrf(rname + "-eth3", "red")
+        router.load_frr_config("frr.conf")
+
+    tgen.start_router()
+    yield tgen
+    tgen.stop_topology()
+
+
+def get_ip_networks(super_prefix, count):
+    count_log2 = math.log(count, 2)
+    if count_log2 != int(count_log2):
+        count_log2 = int(count_log2) + 1
+    else:
+        count_log2 = int(count_log2)
+    network = ipaddress.ip_network(super_prefix)
+    return tuple(network.subnets(count_log2))[0:count]
+
+
+def test_oper(tgen):
+    if tgen.routers_have_failure():
+        pytest.skip(tgen.errors)
+
+    query_results = [
+        ("/frr-vrf:lib", "oper-results/result-lib.json"),
+        ("/frr-vrf:lib/vrf", "oper-results/result-lib-vrf-nokey.json"),
+        (
+            '/frr-vrf:lib/vrf[name="default"]',
+            "oper-results/result-lib-vrf-default.json",
+        ),
+        (
+            '/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra',
+            "oper-results/result-lib-vrf-zebra.json",
+        ),
+        (
+            '/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs',
+            "oper-results/result-lib-vrf-zebra-ribs.json",
+        ),
+        (
+            '/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/rib',
+            "oper-results/result-ribs-rib-nokeys.json",
+        ),
+        (
+            '/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
+            'rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]',
+            "oper-results/result-ribs-rib-ipv4-unicast.json",
+        ),
+    ]
+
+    r1 = tgen.gears["r1"].net
+    check_kernel_32(r1, "11.11.11.11", 1, "")
+    check_kernel_32(r1, "12.12.12.12", 1, "")
+    check_kernel_32(r1, "13.13.13.13", 1, "red")
+    check_kernel_32(r1, "14.14.14.14", 1, "red")
+    time.sleep(2)
+    do_oper_test(tgen, query_results)
+
+
+to_gen_new_results = """
+scriptdir=~chopps/w/frr/tests/topotests/mgmt_oper
+resdir=${scriptdir}/oper-results
+vtysh -c 'show mgmt get-data /frr-vrf:lib'      > ${resdir}/result-lib.json
+vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf'  > ${resdir}/result-lib-vrf-nokey.json
+vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]'  > ${resdir}/result-lib-vrf-default.json
+vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="red"]'      > ${resdir}/result-lib-vrf-red.json
+vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra'          > ${resdir}/result-lib-vrf-zebra.json
+vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs'     > ${resdir}/result-lib-vrf-zebra-ribs.json
+vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/rib' > ${resdir}/result-ribs-rib-nokeys.json
+vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]' > ${resdir}/result-ribs-rib-ipv4-unicast.json
+vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/route' > ${resdir}/result-ribs-rib-route-nokey.json
+
+for f in ${resdir}/result-*; do
+   sed -i -e 's/"uptime": ".*"/"uptime": "rubout"/;s/"id": [0-9][0-9]*/"id": "rubout"/' $f
+   sed -i -e 's/"if-index": [0-9][0-9]*/"if-index": "rubout"/' $f
+   sed -i -e 's,"vrf": "[0-9]*","vrf": "rubout",' $f
+done
+"""  # noqa: 501
+# should not differ
+# diff result-lib.json result-lib-vrf-nokey.json
+# diff result-lib-vrf-zebra.json result-lib-vrf-zebra-ribs.json
diff --git a/tests/topotests/mgmt_oper/test_querying.py b/tests/topotests/mgmt_oper/test_querying.py
new file mode 100644 (file)
index 0000000..e53ea52
--- /dev/null
@@ -0,0 +1,103 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 eval: (blacken-mode 1) -*-
+# SPDX-License-Identifier: ISC
+#
+# Copyright (c) 2021, LabN Consulting, L.L.C.
+# Copyright (c) 2019-2020 by
+# Donatas Abraitis <donatas.abraitis@gmail.com>
+#
+# noqa: E501
+#
+"""
+Test various query types
+"""
+import json
+import logging
+
+import pytest
+from lib.common_config import step
+from lib.topogen import Topogen
+from oper import check_kernel_32
+
+pytestmark = [pytest.mark.staticd]
+
+
+@pytest.fixture(scope="module")
+def tgen(request):
+    "Setup/Teardown the environment and provide tgen argument to tests"
+
+    topodef = {"s1": ("r1",), "s2": ("r1",)}
+
+    tgen = Topogen(topodef, request.module.__name__)
+    tgen.start_topology()
+
+    router_list = tgen.routers()
+    for rname, router in router_list.items():
+        # Setup VRF red
+        router.net.add_l3vrf("red", 10)
+        router.net.add_loop("lo-red")
+        router.net.attach_iface_to_l3vrf("lo-red", "red")
+        router.net.attach_iface_to_l3vrf(rname + "-eth1", "red")
+        router.load_frr_config("frr-simple.conf")
+
+    tgen.start_router()
+    yield tgen
+    tgen.stop_topology()
+
+
+def test_oper_simple(tgen):
+    """This test is useful for doing manual testing"""
+    if tgen.routers_have_failure():
+        pytest.skip(tgen.errors)
+
+    query_results = [
+        # Specific list entry after non-specific lists
+        '/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
+        'rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/'
+        'route/route-entry[protocol="connected"]',
+        # crashes: All specific until the end, then walk
+        '/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
+        'rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/'
+        'route[prefix="1.1.1.0/24"]/route-entry[protocol="connected"]',
+        # Does nothing: Root level query
+        "//metric",
+        # specific leaf after non-specific lists
+        '/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
+        'rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/'
+        "route/route-entry/metric",
+        # All specific until the end generic.
+        '/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
+        'rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/'
+        'route[prefix="1.1.1.0/24"]/route-entry',
+        # All specific until the penultimate generic with a specific leaf child.
+        '/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
+        'rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/'
+        'route[prefix="1.1.1.0/24"]/route-entry/metric',
+        # All generic until the end (middle) specific with unspecified
+        # children below to walk.
+        '/frr-vrf:lib/vrf/frr-zebra:zebra/ribs/rib/route[prefix="1.1.1.0/24"]',
+        # All generic until the end which is a specific leaf.
+        "/frr-vrf:lib/vrf/frr-zebra:zebra/ribs/rib/route/route-entry/metric",
+    ]
+    # query_results = [
+    #     '/frr-interface:lib/frr-interface:interface/frr-zebra:zebra/ip-addrs[frr-rt:address-family="frr-rt:ipv4"][prefix="1.1.1.1/24"]'
+    # ]
+
+    r1 = tgen.gears["r1"].net
+    check_kernel_32(r1, "11.11.11.11", 1, "")
+
+    step("Oper test start", reset=True)
+
+    for qr in query_results:
+        step(f"Perform query '{qr}'")
+        try:
+            output = r1.cmd_nostatus(f"vtysh -c 'show mgmt get-data {qr}'")
+        except Exception as error:
+            logging.error("Error sending query: %s: %s", qr, error)
+            continue
+
+        try:
+            ojson = json.loads(output)
+            logging.info("'%s': generates:\n%s", qr, ojson)
+        except json.decoder.JSONDecodeError as error:
+            logging.error("Error decoding json: %s\noutput:\n%s", error, output)
diff --git a/tests/topotests/mgmt_oper/test_scale.py b/tests/topotests/mgmt_oper/test_scale.py
new file mode 100644 (file)
index 0000000..d7a0e25
--- /dev/null
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 eval: (blacken-mode 1) -*-
+# SPDX-License-Identifier: ISC
+#
+# Copyright (c) 2021, LabN Consulting, L.L.C.
+# Copyright (c) 2019-2020 by
+# Donatas Abraitis <donatas.abraitis@gmail.com>
+#
+# noqa: E501
+#
+"""
+Test static route functionality
+"""
+import logging
+import time
+
+import pytest
+from lib.common_config import step
+from lib.topogen import Topogen, TopoRouter
+from oper import check_kernel_32
+
+pytestmark = [pytest.mark.staticd]
+
+
+@pytest.fixture(scope="module")
+def tgen(request):
+    "Setup/Teardown the environment and provide tgen argument to tests"
+
+    topodef = {"s1": ("r1",), "s2": ("r1",)}
+
+    tgen = Topogen(topodef, request.module.__name__)
+    tgen.start_topology()
+
+    router_list = tgen.routers()
+    for rname, router in router_list.items():
+        # Setup VRF red
+        router.net.add_l3vrf("red", 10)
+        router.net.add_loop("lo-red")
+        router.net.attach_iface_to_l3vrf("lo-red", "red")
+        router.net.attach_iface_to_l3vrf(rname + "-eth1", "red")
+        router.load_frr_config("frr-scale.conf")
+        router.load_config(TopoRouter.RD_SHARP, "")
+
+    tgen.start_router()
+    yield tgen
+    tgen.stop_topology()
+
+
+def test_oper_simple(tgen):
+    if tgen.routers_have_failure():
+        pytest.skip(tgen.errors)
+
+    r1 = tgen.gears["r1"].net
+
+    time.sleep(2)
+    count = 20 * 1000
+
+    vrf = None  # "red"
+    check_kernel_32(r1, "11.11.11.11", 1, vrf)
+
+    step("Found 11.11.11.11 in kernel adding sharpd routes")
+    r1.cmd_raises(f"vtysh -c 'sharp install routes 20.0.0.0 nexthop 1.1.1.2 {count}'")
+    check_kernel_32(r1, "20.0.0.0", count, vrf, 1000)
+
+    step(f"All {count} routes installed in kernel, continuing")
+    output = r1.cmd_raises("vtysh -c 'show mgmt get-data /frr-vrf:lib'")
+    step("Got output: output")
diff --git a/tests/topotests/mgmt_oper/test_simple.py b/tests/topotests/mgmt_oper/test_simple.py
new file mode 100644 (file)
index 0000000..f3d64e1
--- /dev/null
@@ -0,0 +1,140 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 eval: (blacken-mode 1) -*-
+# SPDX-License-Identifier: ISC
+#
+# Copyright (c) 2021, LabN Consulting, L.L.C.
+# Copyright (c) 2019-2020 by
+# Donatas Abraitis <donatas.abraitis@gmail.com>
+#
+# noqa: E501
+#
+"""
+Test static route functionality
+"""
+import pytest
+from lib.topogen import Topogen
+from oper import check_kernel_32, do_oper_test
+
+pytestmark = [pytest.mark.staticd]
+
+
+@pytest.fixture(scope="module")
+def tgen(request):
+    "Setup/Teardown the environment and provide tgen argument to tests"
+
+    topodef = {"s1": ("r1",), "s2": ("r1",)}
+
+    tgen = Topogen(topodef, request.module.__name__)
+    tgen.start_topology()
+
+    router_list = tgen.routers()
+    for rname, router in router_list.items():
+        # Setup VRF red
+        router.net.add_l3vrf("red", 10)
+        router.net.add_loop("lo-red")
+        router.net.attach_iface_to_l3vrf("lo-red", "red")
+        router.net.attach_iface_to_l3vrf(rname + "-eth1", "red")
+        router.load_frr_config("frr-simple.conf")
+
+    tgen.start_router()
+    yield tgen
+    tgen.stop_topology()
+
+
+def test_oper_simple(tgen):
+    if tgen.routers_have_failure():
+        pytest.skip(tgen.errors)
+
+    query_results = [
+        ("/frr-vrf:lib", "simple-results/result-lib.json"),
+        ("/frr-vrf:lib/vrf", "simple-results/result-lib-vrf-nokey.json"),
+        (
+            '/frr-vrf:lib/vrf[name="default"]',
+            "simple-results/result-lib-vrf-default.json",
+        ),
+        ('/frr-vrf:lib/vrf[name="red"]', "simple-results/result-lib-vrf-red.json"),
+        (
+            '/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra',
+            "simple-results/result-lib-vrf-zebra.json",
+        ),
+        (
+            '/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs',
+            "simple-results/result-lib-vrf-zebra-ribs.json",
+        ),
+        (
+            '/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/rib',
+            "simple-results/result-ribs-rib-nokeys.json",
+        ),
+        (
+            '/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
+            'rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]',
+            "simple-results/result-ribs-rib-ipv4-unicast.json",
+        ),
+        (
+            '/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
+            'rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/route',
+            "simple-results/result-ribs-rib-route-nokey.json",
+        ),
+        # Missing entry
+        (
+            '/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
+            'rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/'
+            'route[prefix="1.1.0.0/24"]',
+            "simple-results/result-empty.json",
+        ),
+        (
+            '/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
+            'rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/'
+            'route[prefix="1.1.1.0/24"]',
+            "simple-results/result-ribs-rib-route-prefix.json",
+        ),
+        # Leaf reference
+        (
+            '/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
+            'rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/'
+            'route[prefix="1.1.1.0/24"]/route-entry[protocol="connected"]/metric',
+            "simple-results/result-singleton-metric.json",
+        ),
+        # Interface state
+        (
+            '/frr-interface:lib/interface[name="r1-eth0"]/state',
+            "simple-results/result-intf-state.json",
+        ),
+        (
+            '/frr-interface:lib/interface[name="r1-eth0"]/state/mtu',
+            "simple-results/result-intf-state-mtu.json",
+        ),
+    ]
+
+    r1 = tgen.gears["r1"].net
+    check_kernel_32(r1, "11.11.11.11", 1, "")
+    do_oper_test(tgen, query_results)
+
+
+to_gen_new_results = """
+scriptdir=~chopps/w/frr/tests/topotests/mgmt_oper
+resdir=${scriptdir}/simple-results
+vtysh -c 'show mgmt get-data /frr-vrf:lib'      > ${resdir}/result-lib.json
+vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf'  > ${resdir}/result-lib-vrf-nokey.json
+vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]'  > ${resdir}/result-lib-vrf-default.json
+vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="red"]'      > ${resdir}/result-lib-vrf-red.json
+vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra'          > ${resdir}/result-lib-vrf-zebra.json
+vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs'     > ${resdir}/result-lib-vrf-zebra-ribs.json
+vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/rib' > ${resdir}/result-ribs-rib-nokeys.json
+vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]' > ${resdir}/result-ribs-rib-ipv4-unicast.json
+vtysh -c 'show mgmt get-data /frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/route' > ${resdir}/result-ribs-rib-route-nokey.json
+
+vtysh -c 'show mgmt get-data /frr-interface:lib/interface[name="r1-eth0"]/state' > ${resdir}/result-intf-state.json
+vtysh -c 'show mgmt get-data /frr-interface:lib/interface[name="r1-eth0"]/state/mtu' > ${resdir}/result-intf-state-mtu.json
+
+for f in ${resdir}/result-*; do
+   sed -i -e 's/"uptime": ".*"/"uptime": "rubout"/;s/"id": [0-9][0-9]*/"id": "rubout"/' $f
+   sed -i -e 's/"phy-address": ".*"/"phy-address": "rubout"/' $f
+   sed -i -e 's/"if-index": [0-9][0-9]*/"if-index": "rubout"/' $f
+   sed -i -e 's,"vrf": "[0-9]*","vrf": "rubout",' $f
+done
+"""  # noqa: 501
+
+# Example commands:
+# show mgmt get-data /frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/route[prefix="1.1.0.0/24"] # noqa: E501
+# show mgmt get-data /frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/route[prefix="1.1.1.0/24"] # noqa: E501