Wei-Yu Chen | ad55cb8 | 2022-02-15 20:07:01 +0800 | [diff] [blame^] | 1 | # 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 Chen | 49950b9 | 2021-11-08 19:19:18 +0800 | [diff] [blame] | 5 | |
| 6 | from common.sentry import sentry_init |
| 7 | from common.service import MagmaService |
| 8 | from eventd.event_validator import EventValidator |
| 9 | from eventd.rpc_servicer import EventDRpcServicer |
| 10 | from orc8r.protos.mconfig.mconfigs_pb2 import EventD |
| 11 | |
| 12 | |
| 13 | def 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 | |
| 31 | if __name__ == "__main__": |
| 32 | main() |