blob: f90adb26a476f6c49c1cfaa7e10bf3e26df8a33f [file] [log] [blame]
Zsolt Harasztia8789e02016-12-14 01:55:43 -08001#!/usr/bin/env python
2import os
3import sys
4
5from scripts.scriptbase import ScriptBase
6
7
8class _(ScriptBase):
9
10 usage = """
11Usage: {} <device-id>
12
13Make sure you have VOLTHA_BASE_URL environment variable
14defined, examples:
15
ubuntuc5c83d72017-07-01 17:57:19 -070016export VOLTHA_BASE_URL=https://localhost:8881/api/v1
Zsolt Harasztia8789e02016-12-14 01:55:43 -080017
18or
19
ubuntuc5c83d72017-07-01 17:57:19 -070020export VOLTHA_BASE_URL=https://10.100.192.220:8881/api/v1
Zsolt Harasztia8789e02016-12-14 01:55:43 -080021""".format(sys.argv[0])
22
23 def main(self):
24
25 if len(sys.argv) != 2:
26 self.err(1)
27
28 device_id = sys.argv[1]
29
30 device = self.fetch_device_info(self.voltha_base_url, device_id)
31 self.print_flows(
32 'Device',
33 device_id,
34 type=device['type'],
35 flows=device['flows']['items'],
36 groups=device['flow_groups']['items']
37 )
38
39
40if __name__ == '__main__':
41 _().main()
42