1 # Copyright (C) 2021 Wind River Systems, Inc.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # pylint: disable=unused-argument
16 from __future__ import annotations
17 # from dataclasses import asdict
18 from typing import List, Dict, Callable, Type
20 from o2ims.domain import commands, events
22 from o2dms.domain import commands as o2dms_cmmands
23 from o2dms.domain import events as o2dms_events
24 from o2ims.service.auditor import ocloud_handler, dms_handler, \
25 resourcepool_handler, pserver_handler, pserver_cpu_handler, \
26 pserver_mem_handler, pserver_port_handler, pserver_if_handler
27 from o2dms.service.nfdeployment_handler import publish_nfdeployment_created
28 from o2dms.service.nfdeployment_handler import install_nfdeployment
31 # from . import unit_of_work
34 class InvalidResourceType(Exception):
39 o2dms_events.NfDeploymentCreated: [publish_nfdeployment_created]
44 commands.UpdateOCloud: ocloud_handler.update_ocloud,
45 commands.UpdateDms: dms_handler.update_dms,
46 commands.UpdateResourcePool: resourcepool_handler.update_resourcepool,
47 commands.UpdatePserver: pserver_handler.update_pserver,
48 commands.UpdatePserverCpu: pserver_cpu_handler.update_pserver_cpu,
49 commands.UpdatePserverMem: pserver_mem_handler.update_pserver_mem,
50 commands.UpdatePserverIf: pserver_if_handler.update_pserver_if,
51 commands.UpdatePserverPort: pserver_port_handler.update_pserver_port,
52 o2dms_cmmands.InstallNfDeployment: install_nfdeployment
54 } # type: Dict[Type[commands.Command], Callable]