REST API services in Floodlight (Topology)

Introduction

  1. Topology這邊則是維護整個網路拓樸的資訊,包含LinkCluster以及routing path
  2. Topology的所有資訊都是建立於LinkDiscovery所發送的LLDPBDDP,再搭配演算法去得到整個網路拓樸的情況。
  3. 每個Cluster都會包含一個以上的Switch,同一個Cluster內的Switch可以組成一個Strongly Connected Components (SCC)。

API

  • /wm/topology/links/json : 回傳所有Links,盡可能回傳BIDRECTONAL
    1. Method: GET
    2. Parameter: 無,
      1. Code:
        • TopologyWebRoutable.java
        • LinksResource.java
      2. Example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[
{
"direction": "bidirectional",
"dst-port": 1,
"dst-switch": "00:00:00:00:00:00:00:04",
"src-port": 3,
"src-switch": "00:00:00:00:00:00:00:01",
"type": "internal"
},
{
"direction": "bidirectional",
"dst-port": 1,
"dst-switch": "00:00:00:00:00:00:00:05",
"src-port": 4,
"src-switch": "00:00:00:00:00:00:00:01",
"type": "internal"
},
{
"direction": "bidirectional",
"dst-port": 1,
"dst-switch": "00:00:00:00:00:00:00:02",
"src-port": 1,
"src-switch": "00:00:00:00:00:00:00:01",
"type": "internal"
},
{
"direction": "bidirectional",
"dst-port": 1,
"dst-switch": "00:00:00:00:00:00:00:03",
"src-port": 2,
"src-switch": "00:00:00:00:00:00:00:01",
"type": "internal"
}
]
  • /wm/topology/directed-links/json : 回傳所有Type是 DIRECT_LINK或是TUNNEL的Link,都以UNIDIRECTIONAL的方式呈現
    1. Method: GET
    2. Parameter: 沒有參數,就回傳所有符合條件的Links
    3. Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
[
{
"direction": "unidirectional",
"dst-port": 1,
"dst-switch": "00:00:00:00:00:00:00:05",
"src-port": 4,
"src-switch": "00:00:00:00:00:00:00:01",
"type": "internal"
},
{
"direction": "unidirectional",
"dst-port": 3,
"dst-switch": "00:00:00:00:00:00:00:01",
"src-port": 1,
"src-switch": "00:00:00:00:00:00:00:04",
"type": "internal"
},
{
"direction": "unidirectional",
"dst-port": 1,
"dst-switch": "00:00:00:00:00:00:00:01",
"src-port": 1,
"src-switch": "00:00:00:00:00:00:00:02",
"type": "internal"
},
{
"direction": "unidirectional",
"dst-port": 1,
"dst-switch": "00:00:00:00:00:00:00:03",
"src-port": 2,
"src-switch": "00:00:00:00:00:00:00:01",
"type": "internal"
},
{
"direction": "unidirectional",
"dst-port": 2,
"dst-switch": "00:00:00:00:00:00:00:01",
"src-port": 1,
"src-switch": "00:00:00:00:00:00:00:03",
"type": "internal"
},
{
"direction": "unidirectional",
"dst-port": 4,
"dst-switch": "00:00:00:00:00:00:00:01",
"src-port": 1,
"src-switch": "00:00:00:00:00:00:00:05",
"type": "internal"
},
{
"direction": "unidirectional",
"dst-port": 1,
"dst-switch": "00:00:00:00:00:00:00:04",
"src-port": 3,
"src-switch": "00:00:00:00:00:00:00:01",
"type": "internal"
},
{
"direction": "unidirectional",
"dst-port": 1,
"dst-switch": "00:00:00:00:00:00:00:02",
"src-port": 1,
"src-switch": "00:00:00:00:00:00:00:01",
"type": "internal"
}
]
  • /wm/topology/external-links/json : 回傳透過BDDP所發現的Links。External-Links可以用來找出在網路環境中,不受controoler控制的switch的links。使用情境請參考這篇
    1. Method: GET
    2. Parameter: 沒有參數,就回傳所有符合條件的Links
    3. Code:
      • TopologyWebRoutable.java
        • ExternalLinksResource.java
      1. Example:
1
2
3
4
5
6
7
8
9
10
[
{
"src-switch": "00:00:00:00:00:00:00:02",
"src-port": 3,
"dst-switch": "00:00:00:00:00:00:00:03",
"dst-port": 3,
"type": "external",
"direction": "bidirectional"
}
]
  • /wm/topology/tunnellinks/json : 回傳所有的tunnelLink,我還沒有嘗試過有tunnel的網路拓墣,所以此API也不是很了解,只能從code去看。
    1. Method: GET
    2. Parameter: 沒有參數,就回傳所有tunnelLinks,每條link都會以NodePortTuple的形式呈現,該型態包含了switch的DPID以及對應的Port
    3. Code:
  • /wm/topology/switchclusters/json : 回傳Controller底下的所有cluster,每個cluster是由一群switches所組成的SCC。
    1. Method: GET
    2. Parameter: 沒有參數,就回傳所有的cluster
    3. Code:
      • SwitchClustersResource.java
        • TopologyWebRoutable.java
      1. Example:
1
2
3
4
5
6
7
8
9
{
"00:00:00:00:00:00:00:01": [
"00:00:00:00:00:00:00:01",
"00:00:00:00:00:00:00:02",
"00:00:00:00:00:00:00:03",
"00:00:00:00:00:00:00:04",
"00:00:00:00:00:00:00:05"
]
}

由此範例可以看到目前網路拓墣中有一個cluster,包含了五個switches。cluster的識別碼就由最小的switch DPID來決定。由於是SCC的關係,這五個switches都有辦法傳送封包到彼此。

  • /wm/topology/broadcastdomainports/json : 回傳所有的broadcast domain ports,此port跟externel link有關係。返回值代表某switch上的某port所連接到的是一個不受controller所控制的switch。所以未來若是有收到廣播封包的話,這邊的要收起來。
    1. Method: GET
    2. Parameter: 沒有參數,就回傳所有符合條件的NodePortTuple
    3. Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[
{
"port": 1,
"switch": "00:00:00:00:00:00:00:05"
},
{
"port": 1,
"switch": "00:00:00:00:00:00:00:04"
},
{
"port": 1,
"switch": "00:00:00:00:00:00:00:03"
},
{
"port": 1,
"switch": "00:00:00:00:00:00:00:02"
}
]
  • /wm/topology/enabledports/json : 回傳所有Switch上面的所有Ports。
    1. Method: GET
    2. Parameter: 沒有參數
    3. Code:
      • EnabledPortsResource.java
        • TopologyWebRoutable.java
      1. Example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
[
{
"port": 1,
"switch": "00:00:00:00:00:00:00:02"
},
{
"port": 2,
"switch": "00:00:00:00:00:00:00:02"
},
{
"port": 65534,
"switch": "00:00:00:00:00:00:00:02"
},
{
"port": 1,
"switch": "00:00:00:00:00:00:00:03"
},
{
"port": 2,
"switch": "00:00:00:00:00:00:00:03"
},
{
"port": 65534,
"switch": "00:00:00:00:00:00:00:03"
},
{
"port": 1,
"switch": "00:00:00:00:00:00:00:04"
},
{
"port": 2,
"switch": "00:00:00:00:00:00:00:04"
},
{
"port": 65534,
"switch": "00:00:00:00:00:00:00:04"
},
{
"port": 1,
"switch": "00:00:00:00:00:00:00:05"
},
{
"port": 2,
"switch": "00:00:00:00:00:00:00:05"
},
{
"port": 65534,
"switch": "00:00:00:00:00:00:00:05"
}
]
  • /wm/topology/blockedports/json : 此API我還沒有測試成功,看CODE也沒有發現情況的port會被加入到blockedports,會再寄信詢問。
    1. Method: GET
    2. Parameter: 沒有參數,就回傳所有符合條件的Links
    3. Code:
  • /mw/topology/route/{src-dpid}/{src-port}/{dst-dpid}/{dst-port/json : 一個用來找出最短路徑的REST API
    1. Method: GET
    2. Parameter:
      • src-dpid: source switch dpid
        • src-port: source port of the source switch
        • dst-dpid: destination switch dpid
        • dst-port: destination port of the destination switch
    3. Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
[
{
"port": 2,
"switch": "00:00:00:00:00:00:00:04"
},
{
"port": 3,
"switch": "00:00:00:00:00:00:00:04"
},
{
"port": 2,
"switch": "00:00:00:00:00:00:00:02"
},
{
"port": 3,
"switch": "00:00:00:00:00:00:00:02"
},
{
"port": 1,
"switch": "00:00:00:00:00:00:00:01"
},
{
"port": 2,
"switch": "00:00:00:00:00:00:00:01"
},
{
"port": 3,
"switch": "00:00:00:00:00:00:00:05"
},
{
"port": 2,
"switch": "00:00:00:00:00:00:00:05"
},
{
"port": 3,
"switch": "00:00:00:00:00:00:00:07"
},
{
"port": 2,
"switch": "00:00:00:00:00:00:00:07"
}
]

以一個 –topo tree,3的範例來說,若想要從switch4的port2到switch7的port2,可以得到上述結果的走法。