blob: cf64a58fb6c43d396347720c7fa025150cf92ce6 [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
16export VOLTHA_BASE_URL=http://localhost:8881/api/v1
17
18or
19
20export VOLTHA_BASE_URL=http://10.100.192.220:8881/api/v1
21""".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