Code Coverage

Cobertura Coverage Report > osm_nbi >

vnf_instance_topics.py

Trend

Classes100%
 
Lines93%
   
Conditionals100%
 

File Coverage summary

NameClassesLinesConditionals
vnf_instance_topics.py
100%
1/1
93%
25/27
100%
0/0

Coverage Breakdown by Class

NameLinesConditionals
vnf_instance_topics.py
93%
25/27
N/A

Source

osm_nbi/vnf_instance_topics.py
1 # Copyright 2021 K Sai Kiran (Tata Elxsi)
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #    http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12 # implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 1 __author__ = "K Sai Kiran <saikiran.k@tataelxsi.co.in>, Selvi Jayaraman <selvi.j@tataelxsi.co.in>"
17 1 __date__ = "$12-June-2021 8:30:59$"
18
19 1 from osm_nbi.base_topic import BaseTopic
20 1 from .osm_vnfm.vnf_instances import VnfInstances2NsInstances
21 1 from .osm_vnfm.vnf_instance_actions import VnfLcmOp2NsLcmOp
22
23
24 1 class VnfInstances(BaseTopic):
25 1     def __init__(self, db, fs, msg, auth):
26         """
27         Constructor call for vnf instance topic
28         """
29 1         BaseTopic.__init__(self, db, fs, msg, auth)
30 1         self.vnfinstances2nsinstances = VnfInstances2NsInstances(db, fs, msg, auth)
31
32 1     def new(self, rollback, session, indata=None, kwargs=None, headers=None):
33         """
34         Creates new vnf instance
35         :param rollback: list to append the created items at database in case a rollback must be done
36         :param session: contains "username", "admin", "force", "public", "project_id", "set_project"
37         :param indata: params to be used for the vnf instance
38         :param kwargs: used to override the indata descriptor
39         :param headers: http request headers
40         :return: the _id of vnf instance created at database. Or an exception.
41         """
42 1         return self.vnfinstances2nsinstances.new(
43             rollback, session, indata, kwargs, headers
44         )
45
46 1     def list(self, session, filter_q=None, api_req=False):
47         """
48         Get a list of the vnf instances that match a filter
49         :param session: contains the used login username and working project
50         :param filter_q: filter of data to be applied
51         :param api_req: True if this call is serving an external API request. False if serving internal request.
52         :return: The list, it can be empty if no one match the filter.
53         """
54 0         return self.vnfinstances2nsinstances.list(session, filter_q, api_req)
55
56 1     def show(self, session, _id, filter_q=None, api_req=False):
57         """
58         Get complete information on an vnf instance
59         :param session: contains "username", "admin", "force", "public", "project_id", "set_project"
60         :param _id: server internal id
61         :param api_req: True if this call is serving an external API request. False if serving internal request.
62         :return: dictionary, raise exception if not found.
63         """
64 1         return self.vnfinstances2nsinstances.show(session, _id, api_req)
65
66 1     def delete(self, session, _id, dry_run=False, not_send_msg=None):
67         """
68         Delete vnf instance by its internal _id
69         :param session: contains "username", "admin", "force", "public", "project_id", "set_project"
70         :param _id: server internal id
71         :param dry_run: make checking but do not delete
72         :param not_send_msg: To not send message (False) or store content (list) instead
73         :return: operation id (None if there is not operation), raise exception if error or not found, conflict, ...
74         """
75 1         return self.vnfinstances2nsinstances.delete(session, _id, dry_run, not_send_msg)
76
77
78 1 class VnfLcmOpTopic(BaseTopic):
79 1     def __init__(self, db, fs, msg, auth):
80         """
81         Constructor call for vnf lcm op topic
82         """
83 1         BaseTopic.__init__(self, db, fs, msg, auth)
84 1         self.vnflcmop2nslcmop = VnfLcmOp2NsLcmOp(db, fs, msg, auth)
85
86 1     def new(self, rollback, session, indata=None, kwargs=None, headers=None):
87         """
88         Creates new vnf lcm op
89         :param rollback: list to append the created items at database in case a rollback must be done
90         :param session: contains "username", "admin", "force", "public", "project_id", "set_project"
91         :param indata: params to be used for the vnf instance
92         :param kwargs: used to override the indata descriptor
93         :param headers: http request headers
94         :return: the _id of vnf lcm op created at database. Or an exception.
95         """
96 1         return self.vnflcmop2nslcmop.new(rollback, session, indata, kwargs, headers)
97
98 1     def list(self, session, filter_q=None, api_req=False):
99         """
100         Get a list of the vnf lcm op that match a filter
101         :param session: contains the used login username and working project
102         :param filter_q: filter of data to be applied
103         :param api_req: True if this call is serving an external API request. False if serving internal request.
104         :return: The list, it can be empty if no one match the filter.
105         """
106 0         return self.vnflcmop2nslcmop.list(session, filter_q, api_req)
107
108 1     def show(self, session, _id, filter_q=None, api_req=False):
109         """
110         Get complete information on an vnf lcm op
111         :param session: contains "username", "admin", "force", "public", "project_id", "set_project"
112         :param _id: server internal id
113         :param api_req: True if this call is serving an external API request. False if serving internal request.
114         :return: dictionary, raise exception if not found.
115         """
116 1         return self.vnflcmop2nslcmop.show(session, _id, api_req)