summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/performanceHistoryApp/src/services/performanceHistoryService.ts
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/odlux/apps/performanceHistoryApp/src/services/performanceHistoryService.ts')
-rw-r--r--sdnr/wt/odlux/apps/performanceHistoryApp/src/services/performanceHistoryService.ts83
1 files changed, 64 insertions, 19 deletions
diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/services/performanceHistoryService.ts b/sdnr/wt/odlux/apps/performanceHistoryApp/src/services/performanceHistoryService.ts
index 0f3c89b83..2b03d1c2e 100644
--- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/services/performanceHistoryService.ts
+++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/services/performanceHistoryService.ts
@@ -18,7 +18,10 @@
import { requestRest } from '../../../../framework/src/services/restService';
import { Result } from '../../../../framework/src/models/elasticSearch';
-import { DistinctLtp, LtpIds } from '../models/availableLtps';
+import { convertPropertyNames, replaceUpperCase } from '../../../../framework/src/utilities/yangHelper';
+import { LtpIds } from '../models/availableLtps';
+import { DeviceListType } from '../models/deviceListType';
+import { Topology, TopologyNode } from '../models/topologyNetconf';
/**
* Represents a web api accessor service for Network elements actions.
@@ -31,33 +34,75 @@ class PerformanceService {
public async getDistinctLtpsFromDatabase(networkElement: string, selectedTimePeriod: string): Promise<LtpIds[] | null> {
let path;
const query = {
- "size": 0,
- "query": {
- "match": {
- "node-name": networkElement
- }
- },
- "aggs": {
- "uuid-interface": {
- "terms": {
- "field": "uuid-interface"
- }
- }
+ "filter": [{
+ "property": "node-name",
+ "filtervalue": networkElement
+ }],
+ "sortorder": [],
+ "pagination": {
+ "size": 20,
+ "page": 1
}
- };
+ }
+
if (selectedTimePeriod === "15min") {
- path = 'database/sdnperformance/historicalperformance15min/_search';
+ path = '/restconf/operations/data-provider:read-pmdata-15m-ltp-list';
} else {
- path = 'database/sdnperformance/historicalperformance24h/_search';
+ path = '/restconf/operations/data-provider:read-pmdata-24h-ltp-list';
}
- const result = await requestRest<Result<DistinctLtp>>(path, { method: "POST", body: JSON.stringify(query) });
- return result && result.aggregations && result.aggregations["uuid-interface"].buckets.map(ne => ({
- key: ne.key
+ const result = await requestRest<Result<string>>(path, { method: "POST", body: JSON.stringify(convertPropertyNames({ input: query }, replaceUpperCase)) });
+ return result && result.output && result.output.data.map(ne => ({ key: ne })) || null;
+ }
+
+
+
+ /**
+ * Gets all devices from the performanceHistory 15min backend.
+ */
+ public async getDeviceListfromPerf15minHistory(): Promise<(DeviceListType)[] | null> {
+ const path = '/restconf/operations/data-provider:read-pmdata-15m-device-list';
+ const query = {
+ "input": {
+ "filter": [],
+ "sortorder": [],
+ "pagination": {
+ "size": 20,
+ "page": 1
+ }
+ }
+ };
+
+ const result = await requestRest<Result<string>>(path, { method: "POST", body: JSON.stringify(query) });
+ return result && result.output && result.output.data && result.output.data.map(ne => ({
+ nodeId: ne
+ })) || null;
+ }
+
+ /**
+ * Gets all devices from the performanceHistory 24h backend.
+ */
+ public async getDeviceListfromPerf24hHistory(): Promise<(DeviceListType)[] | null> {
+ const path = '/restconf/operations/data-provider:read-pmdata-24h-device-list';
+ const query = {
+ "input": {
+ "filter": [],
+ "sortorder": [],
+ "pagination": {
+ "size": 20,
+ "page": 1
+ }
+ }
+ };
+
+ const result = await requestRest<Result<string>>(path, { method: "POST", body: JSON.stringify(query) });
+ return result && result.output && result.output.data && result.output.data.map(ne => ({
+ nodeId: ne
})) || null;
}
}
+
export const PerformanceHistoryService = new PerformanceService();
export default PerformanceHistoryService;