Open Kilda Java Documentation
push_flows.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
3
"""
4
push_flows.py facilitates testing the feature through the NB API.
5
6
This will create some Switches if they don't exist, flows between them, and possibly isls with the
7
available_bandwidth adjusted (possibly negative since I won't know what it is).
8
9
The path will hit 2 places:
10
(1) NB -> TER -> NEO4J
11
(2) NB -> kafka -> FLOW TOPOLOGY
12
13
"""
14
import
requests
15
from
base64
import
b64encode
16
17
url =
"http://localhost:80/api/v1/push/flows"
18
19
headers = {
20
'Content-Type'
:
'application/json'
,
21
'Authorization'
:
'Basic %s'
% b64encode(b
"kilda:kilda"
).decode(
"ascii"
)
22
}
23
24
j_data = [{
25
"flow_id"
:
"fat-flow-1"
,
26
"src_node"
:
"de:ad:be:ef:01:11:22:01-p.3-v.45"
,
27
"dst_node"
:
"de:ad:be:ef:01:11:22:01-p.1-v.23"
,
28
"max_bandwidth"
: 1000,
29
"forward_path"
: [{
30
"switch_name"
:
"my.big.switch"
,
31
"switch_id"
:
"de:ad:be:ef:01:11:22:01"
,
32
"cookie"
:
"0x10400000005dc8f"
,
33
"cookie_int"
: 73183493945154703
34
}],
35
"reverse_path"
: [{
36
"switch_name"
:
"my.big.switch"
,
37
"switch_id"
:
"de:ad:be:ef:01:11:22:01"
,
38
"cookie"
:
"0x18400000005dc8f"
,
39
"cookie_int"
: 109212290964118671
40
}]
41
}]
42
43
44
result = requests.put(url, json=j_data, headers=headers)
45
46
print(result.status_code)
47
print(result.text)
48
open-kilda-develop
services
topology-engine-rest
app
app
tests
push_flows.py
Generated by
1.8.14