X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=smo-install%2Ftest%2Fpythonsdk%2Fsrc%2Foransdk%2Fsdnc%2Fsdnc.py;fp=smo-install%2Ftest%2Fpythonsdk%2Fsrc%2Foransdk%2Fsdnc%2Fsdnc.py;h=2353882cdc7146a129cc761a8cffae57786e876f;hb=285d9a5c96b23594b419d95c71c5d6a2cf52052e;hp=0000000000000000000000000000000000000000;hpb=0fd7875b5673d8d9b56c73adff2c8368d95e825b;p=it%2Fdep.git diff --git a/smo-install/test/pythonsdk/src/oransdk/sdnc/sdnc.py b/smo-install/test/pythonsdk/src/oransdk/sdnc/sdnc.py new file mode 100644 index 00000000..2353882c --- /dev/null +++ b/smo-install/test/pythonsdk/src/oransdk/sdnc/sdnc.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# SPDX-License-Identifier: Apache-2.0 +"""Onap Sdnc module.""" + +from typing import Dict +from oransdk.configuration import settings +from onapsdk.sdnc.sdnc_element import SdncElement + +class OranSdnc(SdncElement): + """SDNC library.""" + + base_url = settings.SDNC_URL + + @classmethod + def get_status(cls) -> str: + """ + Get status of SDNC component. + + Returns: + the status of the SDNC component + + """ + url = f"{cls.base_url}/apidoc/explorer/" + status = cls.send_message('GET', + 'Get status of SDNC component', + url) + return status + + @classmethod + def get_odu_oru_status(cls, + odu_node, + oru_node, + basic_auth: Dict[str, str]) -> dict: + """ + Get status of SDNC component. + + Args: + basic_auth: (Dict[str, str]) for example:{ 'username': 'bob', 'password': 'secret' } + + Returns: + the status of the SDNC component + + """ + url = f"{cls.base_url}/rests/data/network-topology:network-topology/"\ + + f"topology=topology-netconf/node={odu_node}/yang-ext:mount/"\ + + f"o-ran-sc-du-hello-world:network-function/du-to-ru-connection={oru_node}" + status = cls.send_message_json('GET', + 'Get status of Odu Oru connectivity', + url, + basic_auth=basic_auth) + return status