From 3d02271058d2e59a71e49afdd866462f7b6ab1c6 Mon Sep 17 00:00:00 2001 From: Aijana Schumann Date: Wed, 12 Aug 2020 12:28:06 +0200 Subject: Switch odlux from Biermann-RestConf to RFC8040 interface Switched rest-calls in odlux to use RFC8040 interface Issue-ID: CCSDK-2565 Signed-off-by: Aijana Schumann Change-Id: Ia59dd02bc6456bad648083146c0256f204e134d1 --- .../configurationApp/src/services/restServices.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'sdnr/wt/odlux/apps/configurationApp/src/services') diff --git a/sdnr/wt/odlux/apps/configurationApp/src/services/restServices.ts b/sdnr/wt/odlux/apps/configurationApp/src/services/restServices.ts index b260f1ffb..eb2c67c26 100644 --- a/sdnr/wt/odlux/apps/configurationApp/src/services/restServices.ts +++ b/sdnr/wt/odlux/apps/configurationApp/src/services/restServices.ts @@ -23,10 +23,10 @@ import { NetworkElementConnection } from "../models/networkElementConnection"; class RestService { public async getCapabilitiesByMoutId(nodeId: string): Promise<{ "capabilityOrigin": string, "capability": string }[] | null> { - const path = `/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/${nodeId}`; - const capabilitiesResult = await requestRest<{ node: { "node-id": string, "netconf-node-topology:available-capabilities": { "available-capability": { "capabilityOrigin": string, "capability": string }[] }}[] }>(path, { method: "GET" }); - return capabilitiesResult && capabilitiesResult.node && capabilitiesResult.node.length > 0 && - capabilitiesResult.node[0]["netconf-node-topology:available-capabilities"]["available-capability"].map(obj => convertPropertyNames(obj, replaceHyphen)) || null; + 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(obj => convertPropertyNames(obj, replaceHyphen)) || null; } public async getMountedNetworkElementByMountId(nodeId: string): Promise { @@ -34,13 +34,13 @@ class RestService { // const connectedNetworkElement = await requestRest(path, { method: "GET" }); // return connectedNetworkElement || null; - const path = "/restconf/operations/data-provider:read-network-element-connection-list"; - const body = { "input": { "filter": [{ "property": "node-id", "filtervalue": nodeId }], "sortorder": [], "pagination": { "size": 1, "page": 1 } } }; - const networkElementResult = await requestRest<{ output: { data: NetworkElementConnection[] } }>(path, { method: "POST", body: JSON.stringify(body) }); - return networkElementResult && networkElementResult.output && networkElementResult.output.data && - networkElementResult.output.data.map(obj => convertPropertyNames(obj, replaceHyphen))[0] || null; + const path = "/rests/operations/data-provider:read-network-element-connection-list"; + const body = { "data-provider:input": { "filter": [{ "property": "node-id", "filtervalue": nodeId }], "sortorder": [], "pagination": { "size": 1, "page": 1 } } }; + const networkElementResult = await requestRest<{ "data-provider:output": { data: NetworkElementConnection[] } }>(path, { method: "POST", body: JSON.stringify(body) }); + return networkElementResult && networkElementResult["data-provider:output"] && networkElementResult["data-provider:output"].data && + networkElementResult["data-provider:output"].data.map(obj => convertPropertyNames(obj, replaceHyphen))[0] || null; } - + /** Reads the config data by restconf path. * @param path The restconf path to be used for read. * @returns The data. -- cgit 1.2.3-korg