X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=smo-install%2Ftest%2Fpythonsdk%2Fsrc%2Foransdk%2Fa1sim%2Fa1sim.py;h=f5c6239b54239a7795cb90b1e5497bfc6e9006ed;hb=285d9a5c96b23594b419d95c71c5d6a2cf52052e;hp=19bbe6b1fb6433bf6587bb67aa3728f45f368d58;hpb=0fd7875b5673d8d9b56c73adff2c8368d95e825b;p=it%2Fdep.git diff --git a/smo-install/test/pythonsdk/src/oransdk/a1sim/a1sim.py b/smo-install/test/pythonsdk/src/oransdk/a1sim/a1sim.py index 19bbe6b1..f5c6239b 100644 --- a/smo-install/test/pythonsdk/src/oransdk/a1sim/a1sim.py +++ b/smo-install/test/pythonsdk/src/oransdk/a1sim/a1sim.py @@ -6,18 +6,79 @@ from onapsdk.onap_service import OnapService class A1sim(OnapService): + """Oran A1 Simulator library.""" @classmethod - def check_version(cls, url) -> str: + def check_version(cls, base_url) -> str: """ Return ric version. + Args: + base_url: the base url of the ric + Returns: the ric version """ - url = f"{url}/counter/interface" + url = f"{base_url}/counter/interface" version = cls.send_message('GET', 'Get ric version', - url) + url) return version + + @classmethod + def check_status(cls, url) -> str: + """ + Return ric status. + + Args: + url: the url of the ric + + Returns: + the ric status + + """ + url = f"{url}" + status = cls.send_message('GET', + 'Get ric status', + url) + return status + + @classmethod + def get_policy_number(cls, url) -> str: + """ + Policy numbers for ric. + + Args: + url: the url of the ric + + Returns: + the policy numbers for ric + + """ + url = f"{url}/counter/num_instances" + policy_number = cls.send_message('GET', + 'Get policy numbers for ric', + url) + return policy_number + + @classmethod + def create_policy_type(cls, + url, + policy_type_id, + policy_type_data) -> None: + """ + Create topic in Dmaap. + + Args: + url: the url of the ric + policy_type_num: the policy type id + policy_type_data: the policy type data in binary format + + """ + url = f"{url}/policytype?id={policy_type_id}" + cls.send_message('PUT', + 'Create Policy Type', + url, + data=policy_type_data, + headers={"Accept":"application/json", "Content-Type":"application/json"})