aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/configurationApp/src/services/restServices.ts
diff options
context:
space:
mode:
authorAijana Schumann <aijana.schumann@highstreet-technologies.com>2020-12-04 17:40:42 +0100
committerAijana S <aijana.schumann@highstreet-technologies.com>2020-12-07 14:52:03 +0000
commite3ad1d3884cb4c801679e3390088ce17c997f9d1 (patch)
treef9327486345ca79303916c30a8e79f696cbfdd80 /sdnr/wt/odlux/apps/configurationApp/src/services/restServices.ts
parent57c041563b4419b9cb3868507a508e24c5eee04d (diff)
Update ConfigurationApp
Add grouping per yang module Issue-ID: CCSDK-3023 Signed-off-by: Aijana Schumann <aijana.schumann@highstreet-technologies.com> Change-Id: I7fd15d0a7dc982c6d824e679b5a0d1eeaaa2e7a8
Diffstat (limited to 'sdnr/wt/odlux/apps/configurationApp/src/services/restServices.ts')
-rw-r--r--sdnr/wt/odlux/apps/configurationApp/src/services/restServices.ts46
1 files changed, 42 insertions, 4 deletions
diff --git a/sdnr/wt/odlux/apps/configurationApp/src/services/restServices.ts b/sdnr/wt/odlux/apps/configurationApp/src/services/restServices.ts
index eb2c67c26..239a8e448 100644
--- a/sdnr/wt/odlux/apps/configurationApp/src/services/restServices.ts
+++ b/sdnr/wt/odlux/apps/configurationApp/src/services/restServices.ts
@@ -21,12 +21,50 @@ import { convertPropertyNames, replaceHyphen } from "../../../../framework/src/u
import { NetworkElementConnection } from "../models/networkElementConnection";
+type CapabilityResponse = {
+ "network-topology:node": {
+ "node-id": string,
+ "netconf-node-topology:available-capabilities": {
+ "available-capability": {
+ "capability-origin": string,
+ "capability": string,
+ }[]
+ },
+ "netconf-node-topology:unavailable-capabilities": {
+ "unavailable-capability": {
+ "capability": string,
+ "failure-reason": string,
+ }[]
+ }
+ }[]
+}
+
+type CapabilityAnswer = {
+ avaliableCapabilities: {
+ capabilityOrigin: string,
+ capability: string
+ }[] | null ,
+ unavaliableCapabilities: {
+ failureReason: string,
+ capability: string
+ }[] | null ,
+}
+
class RestService {
- public async getCapabilitiesByMoutId(nodeId: string): Promise<{ "capabilityOrigin": string, "capability": string }[] | null> {
+ public async getCapabilitiesByMoutId(nodeId: string): Promise<CapabilityAnswer> {
const path = `/rests/data/network-topology:network-topology/topology=topology-netconf/node=${nodeId}`;
- const capabilitiesResult = await requestRest<{"network-topology:node": {"node-id": string, "netconf-node-topology:available-capabilities": { "available-capability": { "capability-origin": string, "capability": string }[] }}[] }>(path, { method: "GET" });
- return capabilitiesResult && capabilitiesResult["network-topology:node"] && capabilitiesResult["network-topology:node"].length > 0 &&
- capabilitiesResult["network-topology:node"][0]["netconf-node-topology:available-capabilities"]["available-capability"].map<any>(obj => convertPropertyNames(obj, replaceHyphen)) || null;
+ const capabilitiesResult = await requestRest<CapabilityResponse>(path, { method: "GET" });
+ const avaliableCapabilities = capabilitiesResult && capabilitiesResult["network-topology:node"] && capabilitiesResult["network-topology:node"].length > 0 &&
+ capabilitiesResult["network-topology:node"][0]["netconf-node-topology:available-capabilities"] &&
+ capabilitiesResult["network-topology:node"][0]["netconf-node-topology:available-capabilities"]["available-capability"] &&
+ capabilitiesResult["network-topology:node"][0]["netconf-node-topology:available-capabilities"]["available-capability"].map<any>(obj => convertPropertyNames(obj, replaceHyphen)) || [];
+
+ const unavaliableCapabilities = capabilitiesResult && capabilitiesResult["network-topology:node"] && capabilitiesResult["network-topology:node"].length > 0 &&
+ capabilitiesResult["network-topology:node"][0]["netconf-node-topology:unavailable-capabilities"] &&
+ capabilitiesResult["network-topology:node"][0]["netconf-node-topology:unavailable-capabilities"]["unavailable-capability"] &&
+ capabilitiesResult["network-topology:node"][0]["netconf-node-topology:unavailable-capabilities"]["unavailable-capability"].map<any>(obj => convertPropertyNames(obj, replaceHyphen)) || []
+
+ return { avaliableCapabilities, unavaliableCapabilities };
}
public async getMountedNetworkElementByMountId(nodeId: string): Promise<NetworkElementConnection | null> {