Coverage for osm_nbi/tests/pmjob_mocks/response.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.3.1, created at 2024-06-27 02:46 +0000

1# Copyright 2019 Preethika P(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__author__ = "Preethika P,preethika.p@tataelxsi.co.in" 

17 

18"""Excepted results for pmjob functions and prometheus""" 

19 

20 

21show_res = """ 

22--- 

23entries: 

24- objectInstanceId: f48163a6-c807-47bc-9682-f72caef5af85 

25 performanceMetric: osm_users 

26 performanceValue: 

27 performanceValue: 

28 performanceValue: '1' 

29 vduName: test_metric-1-ubuntuvdu1-1 

30 vnfMemberIndex: '1' 

31 timestamp: 1573552141.409 

32- objectInstanceId: f48163a6-c807-47bc-9682-f72caef5af85 

33 performanceMetric: osm_cpu_utilization 

34 performanceValue: 

35 performanceValue: 

36 performanceValue: '0.7622979249' 

37 vduName: test_metric-1-ubuntuvdu1-1 

38 vnfMemberIndex: '1' 

39 timestamp: 1573556383.439 

40- objectInstanceId: f48163a6-c807-47bc-9682-f72caef5af85 

41 performanceMetric: osm_load 

42 performanceValue: 

43 performanceValue: 

44 performanceValue: '0' 

45 vduName: test_metric-1-ubuntuvdu1-1 

46 vnfMemberIndex: '1' 

47 timestamp: 1573552060.035 

48""" 

49prom_res = """ 

50--- 

51- - metric: 

52 __name__: osm_users 

53 instance: mon:8000 

54 job: prometheus 

55 ns_id: f48163a6-c807-47bc-9682-f72caef5af85 

56 vdu_name: test_metric-1-ubuntuvdu1-1 

57 vnf_member_index: '1' 

58 value: 

59 - 1573552141.409 

60 - '1' 

61- - metric: 

62 __name__: osm_load 

63 instance: mon:8000 

64 job: prometheus 

65 ns_id: f48163a6-c807-47bc-9682-f72caef5af85 

66 vdu_name: test_metric-1-ubuntuvdu1-1 

67 vnf_member_index: '1' 

68 value: 

69 - 1573552060.035 

70 - '0' 

71- - metric: 

72 __name__: osm_cpu_utilization 

73 instance: mon:8000 

74 job: prometheus 

75 ns_id: f48163a6-c807-47bc-9682-f72caef5af85 

76 vdu_name: test_metric-1-ubuntuvdu1-1 

77 vnf_member_index: '1' 

78 value: 

79 - 1573556383.439 

80 - '0.7622979249' 

81""" 

82cpu_utilization = """ 

83--- 

84status: success 

85data: 

86 resultType: vector 

87 result: 

88 - metric: 

89 __name__: osm_cpu_utilization 

90 instance: mon:8000 

91 job: prometheus 

92 ns_id: f48163a6-c807-47bc-9682-f72caef5af85 

93 vdu_name: test_metric-1-ubuntuvdu1-1 

94 vnf_member_index: '1' 

95 value: 

96 - 1573556383.439 

97 - '0.7622979249' 

98""" 

99users = """ 

100--- 

101status: success 

102data: 

103 resultType: vector 

104 result: 

105 - metric: 

106 __name__: osm_users 

107 instance: mon:8000 

108 job: prometheus 

109 ns_id: f48163a6-c807-47bc-9682-f72caef5af85 

110 vdu_name: test_metric-1-ubuntuvdu1-1 

111 vnf_member_index: '1' 

112 value: 

113 - 1573552141.409 

114 - '1' 

115""" 

116load = """ 

117--- 

118status: success 

119data: 

120 resultType: vector 

121 result: 

122 - metric: 

123 __name__: osm_load 

124 instance: mon:8000 

125 job: prometheus 

126 ns_id: f48163a6-c807-47bc-9682-f72caef5af85 

127 vdu_name: test_metric-1-ubuntuvdu1-1 

128 vnf_member_index: '1' 

129 value: 

130 - 1573552060.035 

131 - '0' 

132""" 

133empty = """ 

134--- 

135status: success 

136data: 

137 resultType: vector 

138 result: [] 

139"""