SDN 下用ODL实现QoS保障(5)-获取拓扑

博主转方向了,此系列不再更新

在postman里面发送如下请求

URL=http://127.0.0.1:8181/restconf/operational/network-topology:network-topology/topology/flow:1
ACTION=GET
其他参数与以前保持一致

返回结果如下:

{
    "topology": [
        {
            "topology-id": "flow:1",
            "node": [
                {
                    "node-id": "openflow:3",
                    "opendaylight-topology-inventory:inventory-node-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:3']",
                    "termination-point": [
                        {
                            "tp-id": "openflow:3:5",
                            "opendaylight-topology-inventory:inventory-node-connector-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:3']/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:3:5']"
                        },
                        {
                            "tp-id": "openflow:3:LOCAL",
                            "opendaylight-topology-inventory:inventory-node-connector-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:3']/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:3:LOCAL']"
                        },
                        {
                            "tp-id": "openflow:3:2",
                            "opendaylight-topology-inventory:inventory-node-connector-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:3']/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:3:2']"
                        },
                        {
                            "tp-id": "openflow:3:1",
                            "opendaylight-topology-inventory:inventory-node-connector-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:3']/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:3:1']"
                        },
                        {
                            "tp-id": "openflow:3:4",
                            "opendaylight-topology-inventory:inventory-node-connector-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:3']/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:3:4']"
                        },
                        {
                            "tp-id": "openflow:3:3",
                            "opendaylight-topology-inventory:inventory-node-connector-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:3']/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:3:3']"
                        }
                    ]
                },
                {
                    "node-id": "openflow:4",
                    "opendaylight-topology-inventory:inventory-node-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:4']"
                },
                {
                    "node-id": "openflow:1",
                    "opendaylight-topology-inventory:inventory-node-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:1']"
                },
                {
                    "node-id": "openflow:2",
                    "opendaylight-topology-inventory:inventory-node-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:2']",
                    "termination-point": [
                        {
                            "tp-id": "openflow:2:1",
                            "opendaylight-topology-inventory:inventory-node-connector-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:2']/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:2:1']"
                        },
                        {
                            "tp-id": "openflow:2:LOCAL",
                            "opendaylight-topology-inventory:inventory-node-connector-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:2']/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:2:LOCAL']"
                        },
                        {
                            "tp-id": "openflow:2:3",
                            "opendaylight-topology-inventory:inventory-node-connector-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:2']/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:2:3']"
                        },
                        {
                            "tp-id": "openflow:2:2",
                            "opendaylight-topology-inventory:inventory-node-connector-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:2']/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:2:2']"
                        },
                        {
                            "tp-id": "openflow:2:5",
                            "opendaylight-topology-inventory:inventory-node-connector-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:2']/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:2:5']"
                        },
                        {
                            "tp-id": "openflow:2:4",
                            "opendaylight-topology-inventory:inventory-node-connector-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:2']/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:2:4']"
                        }
                    ]
                },
                {
                    "node-id": "host:00:00:00:00:00:02",
                    "termination-point": [
                        {
                            "tp-id": "host:00:00:00:00:00:02"
                        }
                    ],
                    "host-tracker-service:attachment-points": [
                        {
                            "tp-id": "openflow:1:2",
                            "corresponding-tp": "host:00:00:00:00:00:02",
                            "active": true
                        }
                    ],
                    "host-tracker-service:id": "00:00:00:00:00:02",
                    "host-tracker-service:addresses": [
                        {
                            "id": 1,
                            "mac": "00:00:00:00:00:02",
                            "last-seen": 1510303270225,
                            "ip": "10.0.0.2",
                            "first-seen": 1510303270225
                        }
                    ]
                },
                {
                    "node-id": "host:00:00:00:00:00:01",
                    "termination-point": [
                        {
                            "tp-id": "host:00:00:00:00:00:01"
                        }
                    ],
                    "host-tracker-service:attachment-points": [
                        {
                            "tp-id": "openflow:1:1",
                            "corresponding-tp": "host:00:00:00:00:00:01",
                            "active": true
                        }
                    ],
                    "host-tracker-service:id": "00:00:00:00:00:01",
                    "host-tracker-service:addresses": [
                        {
                            "id": 0,
                            "mac": "00:00:00:00:00:01",
                            "last-seen": 1510303270184,
                            "ip": "10.0.0.1",
                            "first-seen": 1510303270184
                        }
                    ]
                },
                {
                    "node-id": "host:00:00:00:00:00:06",
                    "termination-point": [
                        {
                            "tp-id": "host:00:00:00:00:00:06"
                        }
                    ],
                    "host-tracker-service:attachment-points": [
                        {
                            "tp-id": "openflow:3:2",
                            "corresponding-tp": "host:00:00:00:00:00:06",
                            "active": true
                        }
                    ],
                    "host-tracker-service:id": "00:00:00:00:00:06",
                    "host-tracker-service:addresses": [
                        {
                            "id": 5,
                            "mac": "00:00:00:00:00:06",
                            "last-seen": 1510303270726,
                            "ip": "10.0.0.6",
                            "first-seen": 1510303270726
                        }
                    ]
                },
                {
                    "node-id": "host:00:00:00:00:00:05",
                    "termination-point": [
                        {
                            "tp-id": "host:00:00:00:00:00:05"
                        }
                    ],
                    "host-tracker-service:attachment-points": [
                        {
                            "tp-id": "openflow:3:1",
                            "corresponding-tp": "host:00:00:00:00:00:05",
                            "active": true
                        }
                    ],
                    "host-tracker-service:id": "00:00:00:00:00:05",
                    "host-tracker-service:addresses": [
                        {
                            "id": 4,
                            "mac": "00:00:00:00:00:05",
                            "last-seen": 1510303270554,
                            "ip": "10.0.0.5",
                            "first-seen": 1510303270554
                        }
                    ]
                },
                {
                    "node-id": "openflow:5",
                    "opendaylight-topology-inventory:inventory-node-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:5']",
                    "termination-point": [
                        {
                            "tp-id": "openflow:5:4",
                            "opendaylight-topology-inventory:inventory-node-connector-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:5']/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:5:4']"
                        },
                        {
                            "tp-id": "openflow:5:LOCAL",
                            "opendaylight-topology-inventory:inventory-node-connector-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:5']/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:5:LOCAL']"
                        },
                        {
                            "tp-id": "openflow:5:3",
                            "opendaylight-topology-inventory:inventory-node-connector-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:5']/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:5:3']"
                        },
                        {
                            "tp-id": "openflow:5:2",
                            "opendaylight-topology-inventory:inventory-node-connector-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:5']/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:5:2']"
                        },
                        {
                            "tp-id": "openflow:5:1",
                            "opendaylight-topology-inventory:inventory-node-connector-ref": "/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:5']/opendaylight-inventory:node-connector[opendaylight-inventory:id='openflow:5:1']"
                        }
                    ]
                },
                {
                    "node-id": "host:00:00:00:00:00:04",
                    "termination-point": [
                        {
                            "tp-id": "host:00:00:00:00:00:04"
                        }
                    ],
                    "host-tracker-service:attachment-points": [
                        {
                            "tp-id": "openflow:2:2",
                            "corresponding-tp": "host:00:00:00:00:00:04",
                            "active": true
                        }
                    ],
                    "host-tracker-service:id": "00:00:00:00:00:04",
                    "host-tracker-service:addresses": [
                        {
                            "id": 3,
                            "mac": "00:00:00:00:00:04",
                            "last-seen": 1510303270415,
                            "ip": "10.0.0.4",
                            "first-seen": 1510303270415
                        }
                    ]
                },
                {
                    "node-id": "host:00:00:00:00:00:03",
                    "termination-point": [
                        {
                            "tp-id": "host:00:00:00:00:00:03"
                        }
                    ],
                    "host-tracker-service:attachment-points": [
                        {
                            "tp-id": "openflow:2:1",
                            "corresponding-tp": "host:00:00:00:00:00:03",
                            "active": true
                        }
                    ],
                    "host-tracker-service:id": "00:00:00:00:00:03",
                    "host-tracker-service:addresses": [
                        {
                            "id": 2,
                            "mac": "00:00:00:00:00:03",
                            "last-seen": 1510303270281,
                            "ip": "10.0.0.3",
                            "first-seen": 1510303270281
                        }
                    ]
                },
                {
                    "node-id": "host:00:00:00:00:00:08",
                    "termination-point": [
                        {
                            "tp-id": "host:00:00:00:00:00:08"
                        }
                    ],
                    "host-tracker-service:attachment-points": [
                        {
                            "tp-id": "openflow:4:2",
                            "corresponding-tp": "host:00:00:00:00:00:08",
                            "active": true
                        }
                    ],
                    "host-tracker-service:id": "00:00:00:00:00:08",
                    "host-tracker-service:addresses": [
                        {
                            "id": 7,
                            "mac": "00:00:00:00:00:08",
                            "last-seen": 1510303271138,
                            "ip": "10.0.0.8",
                            "first-seen": 1510303271138
                        }
                    ]
                },
                {
                    "node-id": "host:00:00:00:00:00:07",
                    "termination-point": [
                        {
                            "tp-id": "host:00:00:00:00:00:07"
                        }
                    ],
                    "host-tracker-service:attachment-points": [
                        {
                            "tp-id": "openflow:4:1",
                            "corresponding-tp": "host:00:00:00:00:00:07",
                            "active": true
                        }
                    ],
                    "host-tracker-service:id": "00:00:00:00:00:07",
                    "host-tracker-service:addresses": [
                        {
                            "id": 6,
                            "mac": "00:00:00:00:00:07",
                            "last-seen": 1510303270916,
                            "ip": "10.0.0.7",
                            "first-seen": 1510303270916
                        }
                    ]
                }
            ],
            "link": [
                {
                    "link-id": "openflow:2:2/host:00:00:00:00:00:04",
                    "destination": {
                        "dest-node": "host:00:00:00:00:00:04",
                        "dest-tp": "host:00:00:00:00:00:04"
                    },
                    "source": {
                        "source-tp": "openflow:2:2",
                        "source-node": "openflow:2"
                    }
                },
                {
                    "link-id": "host:00:00:00:00:00:02/openflow:1:2",
                    "destination": {
                        "dest-node": "openflow:1",
                        "dest-tp": "openflow:1:2"
                    },
                    "source": {
                        "source-tp": "host:00:00:00:00:00:02",
                        "source-node": "host:00:00:00:00:00:02"
                    }
                },
                {
                    "link-id": "openflow:4:1/host:00:00:00:00:00:07",
                    "destination": {
                        "dest-node": "host:00:00:00:00:00:07",
                        "dest-tp": "host:00:00:00:00:00:07"
                    },
                    "source": {
                        "source-tp": "openflow:4:1",
                        "source-node": "openflow:4"
                    }
                },
                {
                    "link-id": "host:00:00:00:00:00:01/openflow:1:1",
                    "destination": {
                        "dest-node": "openflow:1",
                        "dest-tp": "openflow:1:1"
                    },
                    "source": {
                        "source-tp": "host:00:00:00:00:00:01",
                        "source-node": "host:00:00:00:00:00:01"
                    }
                },
                {
                    "link-id": "openflow:4:4",
                    "destination": {
                        "dest-node": "openflow:1",
                        "dest-tp": "openflow:1:4"
                    },
                    "source": {
                        "source-tp": "openflow:4:4",
                        "source-node": "openflow:4"
                    }
                },
                {
                    "link-id": "openflow:3:5",
                    "destination": {
                        "dest-node": "openflow:5",
                        "dest-tp": "openflow:5:3"
                    },
                    "source": {
                        "source-tp": "openflow:3:5",
                        "source-node": "openflow:3"
                    }
                },
                {
                    "link-id": "openflow:5:3",
                    "destination": {
                        "dest-node": "openflow:3",
                        "dest-tp": "openflow:3:5"
                    },
                    "source": {
                        "source-tp": "openflow:5:3",
                        "source-node": "openflow:5"
                    }
                },
                {
                    "link-id": "openflow:5:2",
                    "destination": {
                        "dest-node": "openflow:2",
                        "dest-tp": "openflow:2:5"
                    },
                    "source": {
                        "source-tp": "openflow:5:2",
                        "source-node": "openflow:5"
                    }
                },
                {
                    "link-id": "openflow:2:5",
                    "destination": {
                        "dest-node": "openflow:5",
                        "dest-tp": "openflow:5:2"
                    },
                    "source": {
                        "source-tp": "openflow:2:5",
                        "source-node": "openflow:2"
                    }
                },
                {
                    "link-id": "openflow:3:4",
                    "destination": {
                        "dest-node": "openflow:4",
                        "dest-tp": "openflow:4:3"
                    },
                    "source": {
                        "source-tp": "openflow:3:4",
                        "source-node": "openflow:3"
                    }
                },
                {
                    "link-id": "openflow:4:3",
                    "destination": {
                        "dest-node": "openflow:3",
                        "dest-tp": "openflow:3:4"
                    },
                    "source": {
                        "source-tp": "openflow:4:3",
                        "source-node": "openflow:4"
                    }
                },
                {
                    "link-id": "host:00:00:00:00:00:05/openflow:3:1",
                    "destination": {
                        "dest-node": "openflow:3",
                        "dest-tp": "openflow:3:1"
                    },
                    "source": {
                        "source-tp": "host:00:00:00:00:00:05",
                        "source-node": "host:00:00:00:00:00:05"
                    }
                },
                {
                    "link-id": "openflow:4:5",
                    "destination": {
                        "dest-node": "openflow:5",
                        "dest-tp": "openflow:5:4"
                    },
                    "source": {
                        "source-tp": "openflow:4:5",
                        "source-node": "openflow:4"
                    }
                },
                {
                    "link-id": "openflow:5:4",
                    "destination": {
                        "dest-node": "openflow:4",
                        "dest-tp": "openflow:4:5"
                    },
                    "source": {
                        "source-tp": "openflow:5:4",
                        "source-node": "openflow:5"
                    }
                },
                {
                    "link-id": "openflow:1:3",
                    "destination": {
                        "dest-node": "openflow:2",
                        "dest-tp": "openflow:2:3"
                    },
                    "source": {
                        "source-tp": "openflow:1:3",
                        "source-node": "openflow:1"
                    }
                },
                {
                    "link-id": "openflow:1:1/host:00:00:00:00:00:01",
                    "destination": {
                        "dest-node": "host:00:00:00:00:00:01",
                        "dest-tp": "host:00:00:00:00:00:01"
                    },
                    "source": {
                        "source-tp": "openflow:1:1",
                        "source-node": "openflow:1"
                    }
                },
                {
                    "link-id": "openflow:3:1/host:00:00:00:00:00:05",
                    "destination": {
                        "dest-node": "host:00:00:00:00:00:05",
                        "dest-tp": "host:00:00:00:00:00:05"
                    },
                    "source": {
                        "source-tp": "openflow:3:1",
                        "source-node": "openflow:3"
                    }
                },
                {
                    "link-id": "openflow:1:5",
                    "destination": {
                        "dest-node": "openflow:5",
                        "dest-tp": "openflow:5:1"
                    },
                    "source": {
                        "source-tp": "openflow:1:5",
                        "source-node": "openflow:1"
                    }
                },
                {
                    "link-id": "openflow:5:1",
                    "destination": {
                        "dest-node": "openflow:1",
                        "dest-tp": "openflow:1:5"
                    },
                    "source": {
                        "source-tp": "openflow:5:1",
                        "source-node": "openflow:5"
                    }
                },
                {
                    "link-id": "openflow:3:3",
                    "destination": {
                        "dest-node": "openflow:2",
                        "dest-tp": "openflow:2:4"
                    },
                    "source": {
                        "source-tp": "openflow:3:3",
                        "source-node": "openflow:3"
                    }
                },
                {
                    "link-id": "openflow:2:4",
                    "destination": {
                        "dest-node": "openflow:3",
                        "dest-tp": "openflow:3:3"
                    },
                    "source": {
                        "source-tp": "openflow:2:4",
                        "source-node": "openflow:2"
                    }
                },
                {
                    "link-id": "openflow:1:4",
                    "destination": {
                        "dest-node": "openflow:4",
                        "dest-tp": "openflow:4:4"
                    },
                    "source": {
                        "source-tp": "openflow:1:4",
                        "source-node": "openflow:1"
                    }
                },
                {
                    "link-id": "openflow:2:3",
                    "destination": {
                        "dest-node": "openflow:1",
                        "dest-tp": "openflow:1:3"
                    },
                    "source": {
                        "source-tp": "openflow:2:3",
                        "source-node": "openflow:2"
                    }
                },
                {
                    "link-id": "host:00:00:00:00:00:04/openflow:2:2",
                    "destination": {
                        "dest-node": "openflow:2",
                        "dest-tp": "openflow:2:2"
                    },
                    "source": {
                        "source-tp": "host:00:00:00:00:00:04",
                        "source-node": "host:00:00:00:00:00:04"
                    }
                },
                {
                    "link-id": "host:00:00:00:00:00:03/openflow:2:1",
                    "destination": {
                        "dest-node": "openflow:2",
                        "dest-tp": "openflow:2:1"
                    },
                    "source": {
                        "source-tp": "host:00:00:00:00:00:03",
                        "source-node": "host:00:00:00:00:00:03"
                    }
                },
                {
                    "link-id": "openflow:2:1/host:00:00:00:00:00:03",
                    "destination": {
                        "dest-node": "host:00:00:00:00:00:03",
                        "dest-tp": "host:00:00:00:00:00:03"
                    },
                    "source": {
                        "source-tp": "openflow:2:1",
                        "source-node": "openflow:2"
                    }
                },
                {
                    "link-id": "host:00:00:00:00:00:06/openflow:3:2",
                    "destination": {
                        "dest-node": "openflow:3",
                        "dest-tp": "openflow:3:2"
                    },
                    "source": {
                        "source-tp": "host:00:00:00:00:00:06",
                        "source-node": "host:00:00:00:00:00:06"
                    }
                },
                {
                    "link-id": "host:00:00:00:00:00:07/openflow:4:1",
                    "destination": {
                        "dest-node": "openflow:4",
                        "dest-tp": "openflow:4:1"
                    },
                    "source": {
                        "source-tp": "host:00:00:00:00:00:07",
                        "source-node": "host:00:00:00:00:00:07"
                    }
                },
                {
                    "link-id": "host:00:00:00:00:00:08/openflow:4:2",
                    "destination": {
                        "dest-node": "openflow:4",
                        "dest-tp": "openflow:4:2"
                    },
                    "source": {
                        "source-tp": "host:00:00:00:00:00:08",
                        "source-node": "host:00:00:00:00:00:08"
                    }
                },
                {
                    "link-id": "openflow:4:2/host:00:00:00:00:00:08",
                    "destination": {
                        "dest-node": "host:00:00:00:00:00:08",
                        "dest-tp": "host:00:00:00:00:00:08"
                    },
                    "source": {
                        "source-tp": "openflow:4:2",
                        "source-node": "openflow:4"
                    }
                },
                {
                    "link-id": "openflow:1:2/host:00:00:00:00:00:02",
                    "destination": {
                        "dest-node": "host:00:00:00:00:00:02",
                        "dest-tp": "host:00:00:00:00:00:02"
                    },
                    "source": {
                        "source-tp": "openflow:1:2",
                        "source-node": "openflow:1"
                    }
                },
                {
                    "link-id": "openflow:3:2/host:00:00:00:00:00:06",
                    "destination": {
                        "dest-node": "host:00:00:00:00:00:06",
                        "dest-tp": "host:00:00:00:00:00:06"
                    },
                    "source": {
                        "source-tp": "openflow:3:2",
                        "source-node": "openflow:3"
                    }
                }
            ]
        }
    ]
}

在返回结果的link节点,我们可以看到其中罗列出了主机或者交换机的一个端口与另一个交换机或者主机的端口之间连接关系。
这里写图片描述
用这些数据我们可以轻易的画出,交换机之间的拓扑关系如下图所示。

这里写图片描述

至此,获取拓扑就告一段落了。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值