onapsdk package¶
Subpackages¶
- onapsdk.aai package
- Subpackages
- onapsdk.aai.business package
- Submodules
- onapsdk.aai.business.customer module
- onapsdk.aai.business.instance module
- onapsdk.aai.business.line_of_business module
- onapsdk.aai.business.network module
- onapsdk.aai.business.owning_entity module
- onapsdk.aai.business.platform module
- onapsdk.aai.business.pnf module
- onapsdk.aai.business.project module
- onapsdk.aai.business.service module
- onapsdk.aai.business.sp_partner module
- onapsdk.aai.business.vf_module module
- onapsdk.aai.business.vnf module
- Module contents
- onapsdk.aai.cloud_infrastructure package
- onapsdk.aai.business package
- Submodules
- onapsdk.aai.aai_element module
- onapsdk.aai.bulk module
- onapsdk.aai.service_design_and_creation module
- Module contents
- Subpackages
- onapsdk.cds package
- onapsdk.clamp package
- onapsdk.configuration package
- onapsdk.dmaap package
- onapsdk.msb package
- onapsdk.nbi package
- onapsdk.sdc package
- Submodules
- onapsdk.sdc.category_management module
- onapsdk.sdc.component module
- onapsdk.sdc.pnf module
- onapsdk.sdc.properties module
- onapsdk.sdc.sdc_element module
- onapsdk.sdc.sdc_resource module
- onapsdk.sdc.service module
- onapsdk.sdc.vendor module
- onapsdk.sdc.vf module
- onapsdk.sdc.vl module
- onapsdk.sdc.vsp module
- Module contents
- onapsdk.sdnc package
- onapsdk.so package
- onapsdk.utils package
- onapsdk.ves package
- onapsdk.vid package
Submodules¶
onapsdk.constants module¶
Constant package.
onapsdk.exceptions module¶
ONAP Exception module.
-
exception
onapsdk.exceptions.
APIError
(message=None, response_status_code=None)¶ Bases:
onapsdk.exceptions.RequestError
API error occured.
-
exception
onapsdk.exceptions.
ConnectionFailed
¶ Bases:
onapsdk.exceptions.RequestError
Unable to connect.
-
exception
onapsdk.exceptions.
FileError
¶ Bases:
onapsdk.exceptions.ValidationError
Reading in a file failed.
-
exception
onapsdk.exceptions.
InvalidResponse
¶ Bases:
onapsdk.exceptions.RequestError
Unable to decode response.
-
exception
onapsdk.exceptions.
ModuleError
¶ Bases:
onapsdk.exceptions.SDKException
Unable to import module.
-
exception
onapsdk.exceptions.
NoGuiError
¶ Bases:
onapsdk.exceptions.SDKException
No GUI available for this component.
-
exception
onapsdk.exceptions.
ParameterError
¶ Bases:
onapsdk.exceptions.SDKException
Parameter does not satisfy requirements.
-
exception
onapsdk.exceptions.
RelationshipNotFound
(message=None, response_status_code=None)¶ Bases:
onapsdk.exceptions.ResourceNotFound
Required relationship is missing.
-
exception
onapsdk.exceptions.
RequestError
¶ Bases:
onapsdk.exceptions.SDKException
Request error occured.
-
exception
onapsdk.exceptions.
ResourceNotFound
(message=None, response_status_code=None)¶ Bases:
onapsdk.exceptions.APIError
Requested resource does not exist.
-
exception
onapsdk.exceptions.
SettingsError
¶ Bases:
onapsdk.exceptions.SDKException
Some settings are wrong.
-
exception
onapsdk.exceptions.
StatusError
¶ Bases:
onapsdk.exceptions.SDKException
Invalid status.
-
exception
onapsdk.exceptions.
ValidationError
¶ Bases:
onapsdk.exceptions.SDKException
Data validation failed.
onapsdk.onap_service module¶
ONAP Service module.
-
class
onapsdk.onap_service.
OnapService
¶ Bases:
abc.ABC
Mother Class of all ONAP services.
An important attribute when inheriting from this class is _jinja_env. it allows to fetch simply jinja templates where they are. by default jinja engine will look for templates in templates directory of the package. See in Examples to see how to use.
-
server
¶ nickname of the server we send the request. Used in logs strings. For example, ‘SDC’ is the nickame for SDC server.
- Type
-
permanent_headers
¶ optional dictionary of headers which could be set by the user and which are always added into sended request. Unlike the headers, which could be overrided on send_message call these headers are constant.
-
class
PermanentHeadersCollection
(ph_dict=<factory>, ph_call=<factory>)¶ Bases:
object
Collection to store permanent headers.
-
ph_call
: List[Callable]¶
-
-
classmethod
get_guis
()¶ Return the list of GUI and its status.
-
permanent_headers
: onapsdk.onap_service.OnapService.PermanentHeadersCollection = OnapService.PermanentHeadersCollection(ph_dict={}, ph_call=[])¶
-
classmethod
send_message
(method, action, url, **kwargs)¶ Send a message to an ONAP service.
- Parameters
method (str) – which method to use (GET, POST, PUT, PATCH, …)
action (str) – what action are we doing, used in logs strings.
url (str) – the url to use
exception (Exception, optional) – if an error occurs, raise the exception given instead of RequestError
**kwargs – Arbitrary keyword arguments. any arguments used by requests can be used here.
- Raises
RequestError – if other exceptions weren’t caught or didn’t raise, or if there was an ambiguous exception by a request
ResourceNotFound – 404 returned
APIError – returned an error code within 400 and 599, except 404
ConnectionFailed – connection can’t be established
- Return type
Optional
[Response
]- Returns
the request response if OK
-
classmethod
send_message_json
(method, action, url, **kwargs)¶ Send a message to an ONAP service and parse the response as JSON.
- Parameters
method (str) – which method to use (GET, POST, PUT, PATCH, …)
action (str) – what action are we doing, used in logs strings.
url (str) – the url to use
exception (Exception, optional) – if an error occurs, raise the exception given
**kwargs – Arbitrary keyword arguments. any arguments used by requests can be used here.
- Raises
InvalidResponse – if JSON coudn’t be decoded
RequestError – if other exceptions weren’t caught or didn’t raise
APIError/ResourceNotFound – send_message() got an HTTP error code
ConnectionFailed – connection can’t be established
RequestError – send_message() raised an ambiguous exception
- Return type
- Returns
the response body in dict format if OK
-
static
set_header
(header=None)¶ Set the header which will be always send on request.
- The header can be:
dictionary - will be used same dictionary for each request
callable - a method which is going to be called every time on request creation. Could be useful if you need to connect with ONAP through some API gateway and you need to take care about authentication. The callable shouldn’t require any parameters
None - reset headers
-
onapsdk.version module¶
Version module.
Module contents¶
ONAP SDK master package.