blob: 6da30994bc96cee76547375105619665fae0d5bf [file] [log] [blame]
Zsolt Harasztia8789e02016-12-14 01:55:43 -08001#!/usr/bin/env python
Zack Williams41513bf2018-07-07 20:08:35 -07002# Copyright 2017-present Open Networking Foundation
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.
Zsolt Harasztia8789e02016-12-14 01:55:43 -080015import os
16import sys
17
18from scripts.scriptbase import ScriptBase
19
20
21class _(ScriptBase):
22
23 usage = """
24Usage: {} <logical-device-id>
25
26Make sure you have VOLTHA_BASE_URL environment variable
27defined, examples:
28
29export VOLTHA_BASE_URL=http://localhost:8881/api/v1
30
31or
32
33export VOLTHA_BASE_URL=http://10.100.192.220:8881/api/v1
34""".format(sys.argv[0])
35
36 def main(self):
37
38 if len(sys.argv) != 2:
39 self.err(1)
40
41 logical_device_id = sys.argv[1]
42
43 logical_device = self.fetch_logical_device_info(
44 self.voltha_base_url, logical_device_id)
45 self.print_flows(
46 'Logical device',
47 logical_device_id,
48 type='n/a',
49 flows=logical_device['flows']['items'],
50 groups=logical_device['flow_groups']['items']
51 )
52
53
54if __name__ == '__main__':
55 _().main()
56