summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/performanceHistoryApp/src/services
diff options
context:
space:
mode:
authorHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>2019-06-07 17:55:16 +0200
committerHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>2019-06-07 17:58:18 +0200
commit47fc603b864b52a70157515f29ec741dd9192f3a (patch)
tree12e8cb752efc4b2c92e35325780ac4242b5d791d /sdnr/wt/odlux/apps/performanceHistoryApp/src/services
parentd93e6a996e60fb6abce9a870cef6b2d57bfa70fd (diff)
SDNR align ODLUX
Add missing chart view to UX Performance app Issue-ID: SDNC-790 Signed-off-by: Herbert Eiselt <herbert.eiselt@highstreet-technologies.com> Change-Id: I6f5af1e01d2246927b8d05f826f629c7dd5f59a5 Signed-off-by: Herbert Eiselt <herbert.eiselt@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/odlux/apps/performanceHistoryApp/src/services')
-rw-r--r--sdnr/wt/odlux/apps/performanceHistoryApp/src/services/performanceHistoryService.ts46
-rw-r--r--sdnr/wt/odlux/apps/performanceHistoryApp/src/services/performanceHistoryService.tsx93
2 files changed, 46 insertions, 93 deletions
diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/services/performanceHistoryService.ts b/sdnr/wt/odlux/apps/performanceHistoryApp/src/services/performanceHistoryService.ts
new file mode 100644
index 000000000..d0b8346cd
--- /dev/null
+++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/services/performanceHistoryService.ts
@@ -0,0 +1,46 @@
+import { requestRest } from '../../../../framework/src/services/restService';
+import { Result } from '../../../../framework/src/models/elasticSearch';
+
+import { DistinctLtp, LtpIds } from '../models/availableLtps';
+
+/**
+ * Represents a web api accessor service for Network elements actions.
+ */
+class PerformanceService {
+
+ /**
+ * Get distinct ltps based on the selected network element and time period from the historicalperformance15min database table.
+ */
+ 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"
+ }
+ }
+ }
+ };
+
+ if (selectedTimePeriod === "15min") {
+ path = 'database/sdnperformance/historicalperformance15min/_search';
+ } else {
+ path = 'database/sdnperformance/historicalperformance24h/_search';
+ }
+
+ 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
+ })) || null;
+ }
+}
+
+export const PerformanceHistoryService = new PerformanceService();
+export default PerformanceHistoryService;
diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/services/performanceHistoryService.tsx b/sdnr/wt/odlux/apps/performanceHistoryApp/src/services/performanceHistoryService.tsx
deleted file mode 100644
index a1cdcffcc..000000000
--- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/services/performanceHistoryService.tsx
+++ /dev/null
@@ -1,93 +0,0 @@
-import { requestRest } from '../../../../framework/src/services/restService';
-import { Result } from '../../../../framework/src/models/elasticSearch';
-
-import { ConnectedNetworkElements } from '../models/connectedNetworkElements';
-import { DistinctLtp, Ltp } from '../models/availableLtps';
-import { Topology, TopologyNode } from '../models/topologyNetConf';
-
-/**
- * Represents a web api accessor service for Network elements actions.
- */
-class PerformanceService {
-
- private static networkElementTopology = (mountPoint: TopologyNode) => {
- const mountId = mountPoint["node-id"];
- return {
- mountId: mountId,
- }
- }
-
- /**
- * Get all connected network elements from restconf.
- */
- public async getConnectedNetworkElementsList(): Promise<ConnectedNetworkElements[] | null> {
- const path = "restconf/operational/network-topology:network-topology/topology/topology-netconf";
- const topologyRequestPomise = requestRest<{ topology: Topology[] | null }>(path, { method: "GET" }, true);
- const [netconfResponse] = await Promise.all([topologyRequestPomise]);
- const topologyNetconf = netconfResponse && netconfResponse.topology && netconfResponse.topology.find(topology => topology["topology-id"] === "topology-netconf");
- let mountPoints = topologyNetconf && topologyNetconf.node && topologyNetconf.node.filter(
- mountPoint => mountPoint["netconf-node-topology:connection-status"] == "connected").map(mountedElement => {
- return PerformanceService.networkElementTopology(mountedElement);
- });
- return mountPoints || [];
- }
-
- /**
- * Get distinct ltps based on the selected network element and time period from the historicalperformance15min database table.
- */
- public async getDistinctLtpsFrom15minDatabase(networkElement: string): Promise<Ltp[] | null> {
- const path = 'database/sdnperformance/historicalperformance15min/_search';
- const query = {
- "size": 0,
- "query": {
- "match": {
- "node-name": networkElement
- }
- },
- "aggs": {
- "uuid-interface": {
- "terms": {
- "field": "uuid-interface"
- }
- }
- }
- };
- const result = await requestRest<Result<DistinctLtp>>(path, { method: "POST", body: JSON.stringify(query) });
- if(result && result.aggregations) {
- }
- return result && result.aggregations && result.aggregations["uuid-interface"].buckets.map(ne=>({
- key:ne.key
- }))|| null;
- }
-
- /**
- * Get distinct ltps based on the selected network element and time period from the historicalperformance24h database table.
- */
- public async getDistinctLtpsFrom24hoursDatabase(networkElement: string): Promise<Ltp[] | null> {
- const path = 'database/sdnperformance/historicalperformance24h/_search';
- const query = {
- "size": 0,
- "query": {
- "match": {
- "node-name": networkElement
- }
- },
- "aggs": {
- "uuid-interface": {
- "terms": {
- "field": "uuid-interface"
- }
- }
- }
- };
- const result = await requestRest<Result<DistinctLtp>>(path, { method: "POST", body: JSON.stringify(query) });
- if(result && result.aggregations) {
- }
- return result && result.aggregations && result.aggregations["uuid-interface"].buckets.map(ne=>({
- key:ne.key
- }))|| null;
- }
-}
-
-export const PerformanceHistoryService = new PerformanceService();
-export default PerformanceHistoryService;