blob: 9c52176bd140da8563c82912018e851f49bbda65 [file] [log] [blame]
George Keishinge7e91712021-09-03 11:28:44 -05001#!/usr/bin/env python3
Anusha Dathatri1cd34b52019-08-13 04:43:12 -05002
3r"""
4See help text for details.
5"""
6
7import sys
8
9save_dir_path = sys.path.pop(0)
10
Patrick Williams20f38712022-12-08 06:18:26 -060011modules = ["gen_arg", "gen_print", "gen_valid", "event_notification"]
Anusha Dathatri1cd34b52019-08-13 04:43:12 -050012for module in modules:
13 exec("from " + module + " import *")
14
15sys.path.insert(0, save_dir_path)
16
17parser = argparse.ArgumentParser(
Patrick Williams20f38712022-12-08 06:18:26 -060018 usage="%(prog)s [OPTIONS]",
Anusha Dathatri1cd34b52019-08-13 04:43:12 -050019 description="%(prog)s will subscribe and receive event notifications when "
Patrick Williams20f38712022-12-08 06:18:26 -060020 + "properties change for the given dbus path.",
Anusha Dathatri1cd34b52019-08-13 04:43:12 -050021 formatter_class=argparse.ArgumentDefaultsHelpFormatter,
Patrick Williams20f38712022-12-08 06:18:26 -060022 prefix_chars="-+",
23)
Anusha Dathatri1cd34b52019-08-13 04:43:12 -050024parser.add_argument(
Patrick Williams20f38712022-12-08 06:18:26 -060025 "--host",
26 default="",
27 help="The host name or IP of the system to subscribe to.",
28)
Anusha Dathatri1cd34b52019-08-13 04:43:12 -050029parser.add_argument(
Patrick Williams20f38712022-12-08 06:18:26 -060030 "--username", default="root", help="The username for the host system."
31)
Anusha Dathatri1cd34b52019-08-13 04:43:12 -050032parser.add_argument(
Patrick Williams20f38712022-12-08 06:18:26 -060033 "--password", default="", help="The password for the host system."
34)
Anusha Dathatri1cd34b52019-08-13 04:43:12 -050035parser.add_argument(
Patrick Williams20f38712022-12-08 06:18:26 -060036 "--dbus_path",
37 default="",
38 help='The path to be monitored (e.g. "/xyz/openbmc_project/sensors").',
39)
Anusha Dathatri1cd34b52019-08-13 04:43:12 -050040parser.add_argument(
Patrick Williams20f38712022-12-08 06:18:26 -060041 "--enable_trace",
Anusha Dathatri1cd34b52019-08-13 04:43:12 -050042 choices=[0, 1],
43 default=0,
Patrick Williams20f38712022-12-08 06:18:26 -060044 help="Indicates that trace needs to be enabled.",
45)
Anusha Dathatri1cd34b52019-08-13 04:43:12 -050046
47
48# Populate stock_list with options we want.
49stock_list = [("test_mode", 0), ("quiet", 0), ("debug", 0)]
50
51
52def main():
53 gen_setup()
54 my_event = event_notification(host, username, password)
55 event_notifications = my_event.subscribe(dbus_path, enable_trace)
56 print_var(event_notifications, fmt=[no_header(), strip_brackets()])
57
58
59main()