3 # ============LICENSE_START=======================================================
4 # ORAN SMO PACKAGE - PYTHONSDK TESTS
5 # ================================================================================
6 # Copyright (C) 2021-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 """Oran A1 Simulator module."""
26 from onapsdk.onap_service import OnapService
28 class A1sim(OnapService):
29 """Oran A1 Simulator library."""
32 def check_version(cls, base_url) -> str:
37 base_url: the base url of the ric
43 url = f"{base_url}/counter/interface"
44 version = cls.send_message('GET',
50 def check_status(cls, url) -> str:
55 url: the url of the ric
62 status = cls.send_message('GET',
68 def get_policy_number(cls, url) -> str:
70 Policy numbers for ric.
73 url: the url of the ric
76 the policy numbers for ric
79 url = f"{url}/counter/num_instances"
80 policy_number = cls.send_message('GET',
81 'Get policy numbers for ric',
86 def create_policy_type(cls,
89 policy_type_data) -> None:
91 Create topic in Dmaap.
94 url: the url of the ric
95 policy_type_num: the policy type id
96 policy_type_data: the policy type data in binary format
99 url = f"{url}/policytype?id={policy_type_id}"
100 cls.send_message('PUT',
101 'Create Policy Type',
103 data=policy_type_data,
104 headers={"Accept":"application/json", "Content-Type":"application/json"})