blob: 64bb124fc2e86b454cf5b8ebf2474fc3f2a4b6ab [file] [log] [blame]
Wei-Yu Chen49950b92021-11-08 19:19:18 +08001"""
2Copyright 2020 The Magma Authors.
3
4This source code is licensed under the BSD-style license found in the
5LICENSE file in the root directory of this source tree.
6
7Unless required by applicable law or agreed to in writing, software
8distributed under the License is distributed on an "AS IS" BASIS,
9WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10See the License for the specific language governing permissions and
11limitations under the License.
12"""
13
14from common.sentry import sentry_init
15from common.service import MagmaService
16from eventd.event_validator import EventValidator
17from eventd.rpc_servicer import EventDRpcServicer
18from orc8r.protos.mconfig.mconfigs_pb2 import EventD
19
20
21def main():
22 """ main() for eventd """
23 service = MagmaService('eventd', EventD())
24
25 # Optionally pipe errors to Sentry
26 sentry_init(service_name=service.name)
27
28 event_validator = EventValidator(service.config)
29 eventd_servicer = EventDRpcServicer(service.config, event_validator)
30 eventd_servicer.add_to_server(service.rpc_server)
31
32 # Run the service loop
33 service.run()
34
35 # Cleanup the service
36 service.close()
37
38
39if __name__ == "__main__":
40 main()