5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
20 import hw_detector.hw_detect_lib as hw
21 from hw_detector.hw_exception import HWException
24 pp = pprint.PrettyPrinter(indent=4)
28 data = hw.get_local_hw_data()
31 def remote_dump(args):
36 data = hw.get_hw_data(ip, user, passw, False)
37 except HWException as e:
38 data = "Detect failed: {}".format(str(e))
42 parser = argparse.ArgumentParser(description='HW detector cli')
43 subparsers = parser.add_subparsers()
44 local_group = subparsers.add_parser('local')
45 remote_group = subparsers.add_parser('remote')
47 remote_group.add_argument('--ip', type=str, required=True, help='IP')
48 remote_group.add_argument('--user', type=str, required=True, help='User')
49 remote_group.add_argument('--passwd', type=str, required=True, help='Password')
51 local_group.set_defaults(func=local_dump)
52 remote_group.set_defaults(func=remote_dump)
54 args = parser.parse_args(sys.argv[1:])
56 if __name__ == '__main__':