3 # ============LICENSE_START=======================================================
4 # ORAN SMO PACKAGE - PYTHONSDK TESTS
5 # ================================================================================
6 # Copyright (C) 2022 AT&T Intellectual Property. All rights
8 # ================================================================================
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
13 # http://www.apache.org/licenses/LICENSE-2.0
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 # ============LICENSE_END============================================
21 # ===================================================================
24 """Onap SDC Category Management module."""
26 from onapsdk.sdc.category_management import ServiceCategory
28 class OranServiceCategory(ServiceCategory):
29 """Onap SDC Category Management module ."""
32 def create(cls, name: str) -> "BaseCategory":
33 """Create category instance.
35 Checks if category with given name exists and if it already
36 exists just returns category with given name.
39 BaseCategory: Created category instance
42 category_obj: "BaseCategory" = cls(name)
43 if category_obj.exists():
45 cls.send_message_json("POST",
46 f"Create {name} {cls.category_name()}",
47 cls._base_create_url(),
48 data=json.dumps({"name": name, "models": ["SDC AID"], "metadataKeys": []}),
49 headers=cls.headers())