diff options
author | KAPIL SINGAL <ks220y@att.com> | 2020-08-12 14:57:21 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-08-12 14:57:21 +0000 |
commit | 057a0db19bacdd7d963cad39be1163139e7128e2 (patch) | |
tree | 09174e29404680aaf07784695f151224bdeedcda /sdnr/wt/odlux/apps/configurationApp/src/services/restServices.ts | |
parent | 55d8703366e8e02d97e71b2e1350cb746cee8ff6 (diff) | |
parent | 3d02271058d2e59a71e49afdd866462f7b6ab1c6 (diff) |
Merge "Switch odlux from Biermann-RestConf to RFC8040 interface"
Diffstat (limited to 'sdnr/wt/odlux/apps/configurationApp/src/services/restServices.ts')
-rw-r--r-- | sdnr/wt/odlux/apps/configurationApp/src/services/restServices.ts | 20 |
1 files changed, 10 insertions, 10 deletions
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<any>(obj => convertPropertyNames(obj, replaceHyphen)) || null; } public async getMountedNetworkElementByMountId(nodeId: string): Promise<NetworkElementConnection | null> { @@ -34,13 +34,13 @@ class RestService { // const connectedNetworkElement = await requestRest<NetworkElementConnection>(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. |