Open Kilda Java Documentation
get-flow-rules.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # Copyright 2017 Telstra Open Source
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 
17 import requests
18 from base64 import b64encode
19 
20 url = "http://localhost:8088/api/v1/flows"
21 headers = {
22  'Content-Type': 'application/json',
23  'correlation_id': 'delete-flow-1',
24  'Authorization': 'Basic %s' % b64encode(b"kilda:kilda").decode("ascii")
25 }
26 
27 #
28 # This models one of the first flows used by ATDD.
29 # TODO: would be better to pull from the same data, ensure code bases on synchronized..
30 # at the moment, this is hardcoded here, and ATDD has a separate source.
31 #
32 
33 result = requests.get(url, headers=headers)
34 
35 print result.status_code
36 print result.text
37