blob: eff5511198478f34a7ad00c49b7dcc081373d79b [file] [log] [blame]
Wei-Yu Chenad55cb82022-02-15 20:07:01 +08001# SPDX-FileCopyrightText: 2020 The Magma Authors.
2# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
3#
4# SPDX-License-Identifier: BSD-3-Clause
Wei-Yu Chen49950b92021-11-08 19:19:18 +08005
6from common.sentry import sentry_init
7from common.service import MagmaService
8from eventd.event_validator import EventValidator
9from eventd.rpc_servicer import EventDRpcServicer
10from orc8r.protos.mconfig.mconfigs_pb2 import EventD
11
12
13def main():
14 """ main() for eventd """
15 service = MagmaService('eventd', EventD())
16
17 # Optionally pipe errors to Sentry
18 sentry_init(service_name=service.name)
19
20 event_validator = EventValidator(service.config)
21 eventd_servicer = EventDRpcServicer(service.config, event_validator)
22 eventd_servicer.add_to_server(service.rpc_server)
23
24 # Run the service loop
25 service.run()
26
27 # Cleanup the service
28 service.close()
29
30
31if __name__ == "__main__":
32 main()