From a0e4e813dd3ca2c26a9dd1d6feb88c9db2c2461e Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Thu, 9 Jan 2025 14:54:36 +0100 Subject: [PATCH] yanger: Move ietf-ospf implementation to separate module --- src/statd/python/yanger/ietf_ospf.py | 156 ++++++++++++++++++ src/statd/python/yanger/yanger.py | 152 +---------------- .../run/+usr+libexec+statd+ospf-status | 1 + .../run/vtysh_-c_show-ip-ospf-route-json | 1 + 4 files changed, 160 insertions(+), 150 deletions(-) create mode 100644 src/statd/python/yanger/ietf_ospf.py create mode 100644 test/case/cli/system-output/run/+usr+libexec+statd+ospf-status create mode 100644 test/case/cli/system-output/run/vtysh_-c_show-ip-ospf-route-json diff --git a/src/statd/python/yanger/ietf_ospf.py b/src/statd/python/yanger/ietf_ospf.py new file mode 100644 index 00000000..73aae734 --- /dev/null +++ b/src/statd/python/yanger/ietf_ospf.py @@ -0,0 +1,156 @@ +from .common import insert +from .host import HOST + + +def frr_to_ietf_neighbor_state(state): + """Fetch OSPF neighbor state from Frr""" + state = state.split("/")[0] + if state == "TwoWay": + return "2-way" + return state.lower() + + +def add_routes(ospf): + """Fetch OSPF routes from Frr""" + cmd = ['vtysh', '-c', "show ip ospf route json"] + data = HOST.run_json(cmd, default=[]) + if data == []: + return # No OSPF routes available + + routes = [] + for prefix, info in data.items(): + if prefix.find("/") == -1: # Ignore router IDs + continue + + route = {} + route["prefix"] = prefix + + nexthops = [] + routetype = info["routeType"].split(" ") + + if len(routetype) > 1: + if routetype[1] == "E1": + route["route-type"] = "external-1" + elif routetype[1] == "E2": + route["route-type"] = "external-2" + elif routetype[1] == "IA": + route["route-type"] = "inter-area" + elif routetype[0] == "N": + route["route-type"] = "intra-area" + + for hop in info["nexthops"]: + nexthop = {} + if hop["ip"] != " ": + nexthop["next-hop"] = hop["ip"] + else: + nexthop["outgoing-interface"] = hop["directlyAttachedTo"] + nexthops.append(nexthop) + + route["next-hops"] = {} + route["next-hops"]["next-hop"] = nexthops + routes.append(route) + + insert(ospf, "ietf-ospf:local-rib", "ietf-ospf:route", routes) + + +def add_areas(control_protocols): + """Populate OSPF status""" + cmd = ['/usr/libexec/statd/ospf-status'] + data = HOST.run_json(cmd, default={}) + if data == {}: + return # No OSPF data available + + control_protocol = {} + control_protocol["type"] = "infix-routing:ospfv2" + control_protocol["name"] = "default" + control_protocol["ietf-ospf:ospf"] = {} + control_protocol["ietf-ospf:ospf"]["ietf-ospf:areas"] = {} + + + control_protocol["ietf-ospf:ospf"]["ietf-ospf:router-id"] = data.get("routerId") + control_protocol["ietf-ospf:ospf"]["ietf-ospf:address-family"] = "ipv4" + areas = [] + + for area_id, values in data.get("areas", {}).items(): + area = {} + area["ietf-ospf:area-id"] = area_id + area["ietf-ospf:interfaces"] = {} + if values.get("area-type"): + area["ietf-ospf:area-type"] = values["area-type"] + interfaces = [] + for iface in values.get("interfaces", {}): + interface = {} + interface["ietf-ospf:neighbors"] = {} + interface["name"] = iface["name"] + + if iface.get("drId"): + interface["dr-router-id"] = iface["drId"] + if iface.get("drAddress"): + interface["dr-ip-addr"] = iface["drAddress"] + if iface.get("bdrId"): + interface["bdr-router-id"] = iface["bdrId"] + if iface.get("bdrAddress"): + interface["bdr-ip-addr"] = iface["bdrAddress"] + + if iface.get("timerPassiveIface"): + interface["passive"] = True + else: + interface["passive"] = False + + interface["enabled"] = iface["ospfEnabled"] + if iface["networkType"] == "POINTOPOINT": + interface["interface-type"] = "point-to-point" + if iface["networkType"] == "BROADCAST": + interface["interface-type"] = "broadcast" + + if iface.get("state"): + # Wev've never seen "DependUpon", and has no entry in + # the YANG model, but is listed before down in Frr + xlate = { + "DependUpon": "down", + "Down": "down", + "Waiting": "waiting", + "Loopback": "loopback", + "Point-To-Point": "point-to-point", + "DROther": "dr-other", + "Backup": "bdr", + "DR": "dr" + } + val = xlate.get(iface["state"], "unknown") + interface["state"] = val + + neighbors = [] + for neigh in iface["neighbors"]: + neighbor = {} + neighbor["neighbor-router-id"] = neigh["neighborIp"] + neighbor["address"] = neigh["ifaceAddress"] + neighbor["dead-timer"] = neigh["routerDeadIntervalTimerDueMsec"] + neighbor["state"] = frr_to_ietf_neighbor_state(neigh["nbrState"]) + if neigh.get("routerDesignatedId"): + neighbor["dr-router-id"] = neigh["routerDesignatedId"] + if neigh.get("routerDesignatedBackupId"): + neighbor["bdr-router-id"] = neigh["routerDesignatedBackupId"] + neighbors.append(neighbor) + + interface["ietf-ospf:neighbors"] = {} + interface["ietf-ospf:neighbors"]["ietf-ospf:neighbor"] = neighbors + interfaces.append(interface) + + area["ietf-ospf:interfaces"]["ietf-ospf:interface"] = interfaces + areas.append(area) + + add_routes(control_protocol["ietf-ospf:ospf"]) + control_protocol["ietf-ospf:ospf"]["ietf-ospf:areas"]["ietf-ospf:area"] = areas + insert(control_protocols, "control-plane-protocol", [control_protocol]) + + +def operational(): + out = { + "ietf-routing:routing": { + "control-plane-protocols": { + } + } + } + + add_areas(out['ietf-routing:routing']['control-plane-protocols']) + return out diff --git a/src/statd/python/yanger/yanger.py b/src/statd/python/yanger/yanger.py index ab3c2aa0..e8319632 100644 --- a/src/statd/python/yanger/yanger.py +++ b/src/statd/python/yanger/yanger.py @@ -307,148 +307,6 @@ def add_ipv6_route(routes): get_routes(routes, "ipv6", data) -def frr_to_ietf_neighbor_state(state): - """Fetch OSPF neighbor state from Frr""" - state = state.split("/")[0] - if state == "TwoWay": - return "2-way" - return state.lower() - - -def add_ospf_routes(ospf): - """Fetch OSPF routes from Frr""" - cmd = ['vtysh', '-c', "show ip ospf rout json"] - data = run_json_cmd(cmd, "", check=False, default=[]) - if data == []: - return # No OSPF routes available - - routes = [] - for prefix, info in data.items(): - if prefix.find("/") == -1: # Ignore router IDs - continue - - route = {} - route["prefix"] = prefix - - nexthops = [] - routetype = info["routeType"].split(" ") - - if len(routetype) > 1: - if routetype[1] == "E1": - route["route-type"] = "external-1" - elif routetype[1] == "E2": - route["route-type"] = "external-2" - elif routetype[1] == "IA": - route["route-type"] = "inter-area" - elif routetype[0] == "N": - route["route-type"] = "intra-area" - - for hop in info["nexthops"]: - nexthop = {} - if hop["ip"] != " ": - nexthop["next-hop"] = hop["ip"] - else: - nexthop["outgoing-interface"] = hop["directlyAttachedTo"] - nexthops.append(nexthop) - - route["next-hops"] = {} - route["next-hops"]["next-hop"] = nexthops - routes.append(route) - - insert(ospf, "ietf-ospf:local-rib", "ietf-ospf:route", routes) - - -def add_ospf(control_protocols): - """Populate OSPF status""" - cmd = ['/usr/libexec/statd/ospf-status'] - data = run_json_cmd(cmd, "", check=False, default={}) - if data == {}: - return # No OSPF data available - - control_protocol = {} - control_protocol["type"] = "infix-routing:ospfv2" - control_protocol["name"] = "default" - control_protocol["ietf-ospf:ospf"] = {} - control_protocol["ietf-ospf:ospf"]["ietf-ospf:areas"] = {} - - - control_protocol["ietf-ospf:ospf"]["ietf-ospf:router-id"] = data.get("routerId") - control_protocol["ietf-ospf:ospf"]["ietf-ospf:address-family"] = "ipv4" - areas = [] - - for area_id, values in data.get("areas", {}).items(): - area = {} - area["ietf-ospf:area-id"] = area_id - area["ietf-ospf:interfaces"] = {} - if values.get("area-type"): - area["ietf-ospf:area-type"] = values["area-type"] - interfaces = [] - for iface in values.get("interfaces", {}): - interface = {} - interface["ietf-ospf:neighbors"] = {} - interface["name"] = iface["name"] - - if iface.get("drId"): - interface["dr-router-id"] = iface["drId"] - if iface.get("drAddress"): - interface["dr-ip-addr"] = iface["drAddress"] - if iface.get("bdrId"): - interface["bdr-router-id"] = iface["bdrId"] - if iface.get("bdrAddress"): - interface["bdr-ip-addr"] = iface["bdrAddress"] - - if iface.get("timerPassiveIface"): - interface["passive"] = True - else: - interface["passive"] = False - - interface["enabled"] = iface["ospfEnabled"] - if iface["networkType"] == "POINTOPOINT": - interface["interface-type"] = "point-to-point" - if iface["networkType"] == "BROADCAST": - interface["interface-type"] = "broadcast" - - if iface.get("state"): - # Wev've never seen "DependUpon", and has no entry in - # the YANG model, but is listed before down in Frr - xlate = { - "DependUpon": "down", - "Down": "down", - "Waiting": "waiting", - "Loopback": "loopback", - "Point-To-Point": "point-to-point", - "DROther": "dr-other", - "Backup": "bdr", - "DR": "dr" - } - val = xlate.get(iface["state"], "unknown") - interface["state"] = val - - neighbors = [] - for neigh in iface["neighbors"]: - neighbor = {} - neighbor["neighbor-router-id"] = neigh["neighborIp"] - neighbor["address"] = neigh["ifaceAddress"] - neighbor["dead-timer"] = neigh["routerDeadIntervalTimerDueMsec"] - neighbor["state"] = frr_to_ietf_neighbor_state(neigh["nbrState"]) - if neigh.get("routerDesignatedId"): - neighbor["dr-router-id"] = neigh["routerDesignatedId"] - if neigh.get("routerDesignatedBackupId"): - neighbor["bdr-router-id"] = neigh["routerDesignatedBackupId"] - neighbors.append(neighbor) - - interface["ietf-ospf:neighbors"] = {} - interface["ietf-ospf:neighbors"]["ietf-ospf:neighbor"] = neighbors - interfaces.append(interface) - - area["ietf-ospf:interfaces"]["ietf-ospf:interface"] = interfaces - areas.append(area) - - add_ospf_routes(control_protocol["ietf-ospf:ospf"]) - control_protocol["ietf-ospf:ospf"]["ietf-ospf:areas"]["ietf-ospf:area"] = areas - insert(control_protocols, "control-plane-protocol", [control_protocol]) - - def get_bridge_port_pvid(ifname): data = run_json_cmd(['bridge', '-j', 'vlan', 'show', 'dev', ifname], f"bridge-vlan-show-dev-{ifname}.json") @@ -1001,14 +859,8 @@ def main(): add_ipv6_route(ipv6routes) elif args.model == 'ietf-ospf': - yang_data = { - "ietf-routing:routing": { - "control-plane-protocols": { - } - } - } - add_ospf(yang_data['ietf-routing:routing']['control-plane-protocols']) - + from . import ietf_ospf + yang_data = ietf_ospf.operational() elif args.model == 'ietf-hardware': from . import ietf_hardware yang_data = ietf_hardware.operational() diff --git a/test/case/cli/system-output/run/+usr+libexec+statd+ospf-status b/test/case/cli/system-output/run/+usr+libexec+statd+ospf-status new file mode 100644 index 00000000..7f22ea8b --- /dev/null +++ b/test/case/cli/system-output/run/+usr+libexec+statd+ospf-status @@ -0,0 +1 @@ +{"routerId": "10.0.0.1", "tosRoutesOnly": true, "rfc2328Conform": true, "spfScheduleDelayMsecs": 0, "holdtimeMinMsecs": 50, "holdtimeMaxMsecs": 5000, "holdtimeMultplier": 1, "spfLastExecutedMsecs": 17503, "spfLastDurationMsecs": 0, "lsaMinIntervalMsecs": 5000, "lsaMinArrivalMsecs": 1000, "writeMultiplier": 20, "refreshTimerMsecs": 10000, "maximumPaths": 256, "preference": 110, "abrType": "Alternative Cisco", "asbrRouter": "injectingExternalRoutingInformation", "lsaExternalCounter": 1, "lsaExternalChecksum": 23527, "lsaAsopaqueCounter": 0, "lsaAsOpaqueChecksum": 0, "attachedAreaCounter": 3, "areas": {"0.0.0.0": {"backbone": true, "areaIfTotalCounter": 1, "areaIfActiveCounter": 1, "nbrFullAdjacentCounter": 1, "authentication": "authenticationNone", "spfExecutedCounter": 19, "lsaNumber": 24, "lsaRouterNumber": 2, "lsaRouterChecksum": 103244, "lsaNetworkNumber": 1, "lsaNetworkChecksum": 32939, "lsaSummaryNumber": 18, "lsaSummaryChecksum": 593799, "lsaAsbrNumber": 3, "lsaAsbrChecksum": 97451, "lsaNssaNumber": 0, "lsaNssaChecksum": 0, "lsaOpaqueLinkNumber": 0, "lsaOpaqueLinkChecksum": 0, "lsaOpaqueAreaNumber": 0, "lsaOpaqueAreaChecksum": 0, "area-type": "normal-area", "interfaces": [{"ifUp": true, "ifIndex": 6, "mtuBytes": 1500, "bandwidthMbit": 4294967295, "ifFlags": "", "ospfEnabled": true, "interfaceIp": {"10.0.12.1": {"ipAddress": "10.0.12.1", "ipAddressPrefixlen": 30, "ospfIfType": "Broadcast", "localIfUsed": "10.0.12.3", "area": "0.0.0.0", "routerId": "10.0.0.1", "networkType": "BROADCAST", "cost": 1, "transmitDelaySecs": 1, "state": "DR", "priority": 1, "drId": "10.0.0.1", "drAddress": "10.0.12.1", "bdrId": "1.1.1.1", "bdrAddress": "10.0.12.2", "mcastMemberOspfAllRouters": true, "mcastMemberOspfDesignatedRouters": true, "timerMsecs": 1000, "timerDeadSecs": 4, "timerWaitSecs": 4, "timerRetransmitSecs": 5, "timerHelloInMsecs": 565, "nbrCount": 1, "nbrAdjacentCount": 1, "grHelloDelaySecs": 10, "prefixSuppression": false}}, "ipAddress": "10.0.12.1", "ipAddressPrefixlen": 30, "ospfIfType": "Broadcast", "localIfUsed": "10.0.12.3", "area": "0.0.0.0", "routerId": "10.0.0.1", "networkType": "BROADCAST", "cost": 1, "transmitDelaySecs": 1, "state": "DR", "priority": 1, "opaqueCapable": true, "drId": "10.0.0.1", "drAddress": "10.0.12.1", "bdrId": "1.1.1.1", "bdrAddress": "10.0.12.2", "mcastMemberOspfAllRouters": true, "mcastMemberOspfDesignatedRouters": true, "timerMsecs": 1000, "timerDeadSecs": 4, "timerWaitSecs": 4, "timerRetransmitSecs": 5, "timerHelloInMsecs": 565, "nbrCount": 1, "nbrAdjacentCount": 1, "grHelloDelaySecs": 10, "peerBfdInfo": {"detectionMultiplier": 3, "rxMinInterval": 300, "txMinInterval": 300}, "prefixSuppression": false, "name": "e5", "neighbors": [{"ifaceAddress": "10.0.12.2", "areaId": "0.0.0.0", "ifaceName": "e5", "localIfaceAddress": "10.0.12.1", "nbrPriority": 1, "nbrState": "Full/Backup", "role": "Backup", "stateChangeCounter": 5, "lastPrgrsvChangeMsec": 38523, "routerDesignatedId": "10.0.0.1", "routerDesignatedBackupId": "1.1.1.1", "optionsCounter": 2, "optionsList": "*|-|-|-|-|-|E|-", "routerDeadIntervalTimerDueMsec": 3794, "databaseSummaryListCounter": 0, "linkStateRequestListCounter": 0, "linkStateRetransmissionListCounter": 0, "threadInactivityTimer": "on", "threadLinkStateRequestRetransmission": "on", "threadLinkStateUpdateRetransmission": "on", "grHelperStatus": "None", "peerBfdInfo": {"type": "single hop", "detectMultiplier": 3, "rxMinInterval": 300, "txMinInterval": 300, "status": "Up", "lastUpdate": "0:00:00:44"}, "neighborIp": "1.1.1.1"}]}]}, "0.0.0.1": {"nssaNoSummary": true, "shortcuttingMode": "Default", "areaIfTotalCounter": 3, "areaIfActiveCounter": 3, "nssa": true, "abr": true, "nssaTranslatorElected": true, "nbrFullAdjacentCounter": 1, "authentication": "authenticationNone", "virtualAdjacenciesPassingCounter": 0, "spfExecutedCounter": 20, "lsaNumber": 7, "lsaRouterNumber": 3, "lsaRouterChecksum": 184123, "lsaNetworkNumber": 2, "lsaNetworkChecksum": 80372, "lsaSummaryNumber": 2, "lsaSummaryChecksum": 43268, "lsaAsbrNumber": 0, "lsaAsbrChecksum": 0, "lsaNssaNumber": 0, "lsaNssaChecksum": 0, "lsaOpaqueLinkNumber": 0, "lsaOpaqueLinkChecksum": 0, "lsaOpaqueAreaNumber": 0, "lsaOpaqueAreaChecksum": 0, "area-type": "nssa-area", "interfaces": [{"ifUp": true, "ifIndex": 7, "mtuBytes": 1500, "bandwidthMbit": 4294967295, "ifFlags": "", "ospfEnabled": true, "interfaceIp": {"10.0.13.1": {"ipAddress": "10.0.13.1", "ipAddressPrefixlen": 30, "ospfIfType": "Broadcast", "localIfUsed": "10.0.13.3", "area": "0.0.0.1 [NSSA]", "routerId": "10.0.0.1", "networkType": "BROADCAST", "cost": 2000, "transmitDelaySecs": 1, "state": "Backup", "priority": 1, "drId": "10.0.0.3", "drAddress": "10.0.13.2", "bdrId": "10.0.0.1", "bdrAddress": "10.0.13.1", "mcastMemberOspfAllRouters": true, "mcastMemberOspfDesignatedRouters": true, "timerMsecs": 1000, "timerDeadSecs": 4, "timerWaitSecs": 4, "timerRetransmitSecs": 5, "timerHelloInMsecs": 444, "nbrCount": 1, "nbrAdjacentCount": 1, "grHelloDelaySecs": 10, "prefixSuppression": false}}, "ipAddress": "10.0.13.1", "ipAddressPrefixlen": 30, "ospfIfType": "Broadcast", "localIfUsed": "10.0.13.3", "area": "0.0.0.1", "routerId": "10.0.0.1", "networkType": "BROADCAST", "cost": 2000, "transmitDelaySecs": 1, "state": "Backup", "priority": 1, "opaqueCapable": true, "drId": "10.0.0.3", "drAddress": "10.0.13.2", "bdrId": "10.0.0.1", "bdrAddress": "10.0.13.1", "mcastMemberOspfAllRouters": true, "mcastMemberOspfDesignatedRouters": true, "timerMsecs": 1000, "timerDeadSecs": 4, "timerWaitSecs": 4, "timerRetransmitSecs": 5, "timerHelloInMsecs": 444, "nbrCount": 1, "nbrAdjacentCount": 1, "grHelloDelaySecs": 10, "peerBfdInfo": {"detectionMultiplier": 3, "rxMinInterval": 300, "txMinInterval": 300}, "prefixSuppression": false, "name": "e6", "neighbors": [{"ifaceAddress": "10.0.13.2", "areaId": "0.0.0.1", "ifaceName": "e6", "localIfaceAddress": "10.0.13.1", "nbrPriority": 1, "nbrState": "Full/DR", "role": "DR", "stateChangeCounter": 6, "lastPrgrsvChangeMsec": 41758, "routerDesignatedId": "10.0.0.3", "routerDesignatedBackupId": "10.0.0.1", "optionsCounter": 8, "optionsList": "*|-|-|-|N/P|-|-|-", "routerDeadIntervalTimerDueMsec": 3244, "databaseSummaryListCounter": 0, "linkStateRequestListCounter": 0, "linkStateRetransmissionListCounter": 0, "threadInactivityTimer": "on", "threadLinkStateRequestRetransmission": "on", "threadLinkStateUpdateRetransmission": "on", "grHelperStatus": "None", "peerBfdInfo": {"type": "single hop", "detectMultiplier": 3, "rxMinInterval": 300, "txMinInterval": 300, "status": "Up", "lastUpdate": "0:00:00:43"}, "neighborIp": "10.0.0.3"}]}, {"ifUp": true, "ifIndex": 1, "mtuBytes": 65536, "bandwidthMbit": 0, "ifFlags": "", "ospfEnabled": true, "interfaceIp": {"10.0.0.1": {"ipAddress": "10.0.0.1", "ipAddressPrefixlen": 32, "ospfIfType": "Broadcast", "localIfUsed": "10.0.0.1", "area": "0.0.0.1 [NSSA]", "routerId": "10.0.0.1", "networkType": "LOOPBACK", "cost": 0, "transmitDelaySecs": 1, "state": "Loopback", "priority": 1, "timerMsecs": 10000, "timerDeadSecs": 40, "timerWaitSecs": 40, "timerRetransmitSecs": 5, "timerHelloInMsecs": 0, "nbrCount": 0, "nbrAdjacentCount": 0, "grHelloDelaySecs": 10, "prefixSuppression": false}, "11.0.8.1": {"ipAddress": "11.0.8.1", "ipAddressPrefixlen": 24, "ospfIfType": "Broadcast", "localIfUsed": "11.0.8.255", "area": "0.0.0.1 [NSSA]", "routerId": "10.0.0.1", "networkType": "LOOPBACK", "cost": 0, "transmitDelaySecs": 1, "state": "Loopback", "priority": 1, "timerMsecs": 10000, "timerDeadSecs": 40, "timerWaitSecs": 40, "timerRetransmitSecs": 5, "timerHelloInMsecs": 0, "nbrCount": 0, "nbrAdjacentCount": 0, "grHelloDelaySecs": 10, "prefixSuppression": false}}, "ipAddress": "11.0.8.1", "ipAddressPrefixlen": 24, "ospfIfType": "Broadcast", "localIfUsed": "11.0.8.255", "area": "0.0.0.1", "routerId": "10.0.0.1", "networkType": "LOOPBACK", "cost": 0, "transmitDelaySecs": 1, "state": "Loopback", "priority": 1, "opaqueCapable": true, "timerMsecs": 10000, "timerDeadSecs": 40, "timerWaitSecs": 40, "timerRetransmitSecs": 5, "timerHelloInMsecs": 0, "nbrCount": 0, "nbrAdjacentCount": 0, "grHelloDelaySecs": 10, "prefixSuppression": false, "name": "lo", "neighbors": []}]}, "0.0.0.2": {"shortcuttingMode": "Default", "sBitConcensus": true, "areaIfTotalCounter": 0, "areaIfActiveCounter": 0, "nbrFullAdjacentCounter": 0, "authentication": "authenticationNone", "virtualAdjacenciesPassingCounter": 0, "spfExecutedCounter": 19, "lsaNumber": 39, "lsaRouterNumber": 3, "lsaRouterChecksum": 104816, "lsaNetworkNumber": 1, "lsaNetworkChecksum": 9970, "lsaSummaryNumber": 33, "lsaSummaryChecksum": 1065387, "lsaAsbrNumber": 2, "lsaAsbrChecksum": 110374, "lsaNssaNumber": 0, "lsaNssaChecksum": 0, "lsaOpaqueLinkNumber": 0, "lsaOpaqueLinkChecksum": 0, "lsaOpaqueAreaNumber": 0, "lsaOpaqueAreaChecksum": 0}}} diff --git a/test/case/cli/system-output/run/vtysh_-c_show-ip-ospf-route-json b/test/case/cli/system-output/run/vtysh_-c_show-ip-ospf-route-json new file mode 100644 index 00000000..e03c6425 --- /dev/null +++ b/test/case/cli/system-output/run/vtysh_-c_show-ip-ospf-route-json @@ -0,0 +1 @@ +{"10.0.0.1/32":{"routeType":"N","transit":false,"cost":0,"area":"0.0.0.1","nexthops":[{"ip":" ","directlyAttachedTo":"lo"}]},"10.0.0.2/32":{"routeType":"N","transit":false,"cost":1,"area":"0.0.0.0","nexthops":[{"ip":"10.0.12.2","via":"e5","advertisedRouter":"1.1.1.1"}]},"10.0.0.3/32":{"routeType":"N","transit":false,"cost":2000,"area":"0.0.0.1","nexthops":[{"ip":"10.0.13.2","via":"e6","advertisedRouter":"10.0.0.3"}]},"10.0.0.4/32":{"routeType":"N IA","cost":2001,"area":"0.0.0.0","nexthops":[{"ip":"10.0.12.2","via":"e5","advertisedRouter":"1.1.1.1"}]},"10.0.12.0/30":{"routeType":"N","transit":true,"cost":1,"area":"0.0.0.0","nexthops":[{"ip":" ","directlyAttachedTo":"e5"}]},"10.0.13.0/30":{"routeType":"N","transit":true,"cost":2000,"area":"0.0.0.1","nexthops":[{"ip":" ","directlyAttachedTo":"e6"}]},"10.0.23.0/30":{"routeType":"N","transit":true,"cost":2001,"area":"0.0.0.1","nexthops":[{"ip":"10.0.13.2","via":"e6","advertisedRouter":"10.0.0.3"}]},"10.0.24.0/30":{"routeType":"N IA","cost":2001,"area":"0.0.0.0","nexthops":[{"ip":"10.0.12.2","via":"e5","advertisedRouter":"1.1.1.1"}]},"10.0.41.0/30":{"routeType":"N IA","cost":2002,"area":"0.0.0.0","nexthops":[{"ip":"10.0.12.2","via":"e5","advertisedRouter":"1.1.1.1"}]},"11.0.8.1/32":{"routeType":"N","transit":false,"cost":0,"area":"0.0.0.1","nexthops":[{"ip":" ","directlyAttachedTo":"lo"}]},"11.0.9.1/32":{"routeType":"N","transit":false,"cost":1,"area":"0.0.0.0","nexthops":[{"ip":"10.0.12.2","via":"e5","advertisedRouter":"1.1.1.1"}]},"11.0.10.1/32":{"routeType":"N","transit":false,"cost":1,"area":"0.0.0.0","nexthops":[{"ip":"10.0.12.2","via":"e5","advertisedRouter":"1.1.1.1"}]},"11.0.11.1/32":{"routeType":"N","transit":false,"cost":1,"area":"0.0.0.0","nexthops":[{"ip":"10.0.12.2","via":"e5","advertisedRouter":"1.1.1.1"}]},"11.0.12.1/32":{"routeType":"N","transit":false,"cost":1,"area":"0.0.0.0","nexthops":[{"ip":"10.0.12.2","via":"e5","advertisedRouter":"1.1.1.1"}]},"11.0.13.1/32":{"routeType":"N","transit":false,"cost":1,"area":"0.0.0.0","nexthops":[{"ip":"10.0.12.2","via":"e5","advertisedRouter":"1.1.1.1"}]},"11.0.14.1/32":{"routeType":"N","transit":false,"cost":1,"area":"0.0.0.0","nexthops":[{"ip":"10.0.12.2","via":"e5","advertisedRouter":"1.1.1.1"}]},"11.0.15.1/32":{"routeType":"N","transit":false,"cost":1,"area":"0.0.0.0","nexthops":[{"ip":"10.0.12.2","via":"e5","advertisedRouter":"1.1.1.1"}]},"192.168.3.0/24":{"routeType":"N","transit":false,"cost":2001,"area":"0.0.0.1","nexthops":[{"ip":"10.0.13.2","via":"e6","advertisedRouter":"10.0.0.3"}]},"1.1.1.1":{"routeType":"R ","cost":1,"area":"0.0.0.0","routerType":"abr","nexthops":[{"ip":"10.0.12.2","via":"e5"}]},"10.0.0.4":{"routeType":"R ","cost":2001,"area":"0.0.0.0","IA":true,"ia":true,"routerType":"asbr","nexthops":[{"ip":"10.0.12.2","via":"e5"}]},"192.168.4.0/24":{"routeType":"N E2","cost":2001,"type2cost":20,"tag":0,"nexthops":[{"ip":"10.0.12.2","via":"e5","advertisedRouter":"1.1.1.1"}]}}