Skip to content

Commit

Permalink
Merge branch 'FR-227-add-device-discovery' of github.com:FRINXio/frin…
Browse files Browse the repository at this point in the history
…x-inventory-server into FR-227-add-device-discovery
  • Loading branch information
plehocky committed Jul 9, 2024
2 parents 0c39d29 + 0313a8b commit ad45f0b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/external-api/uniconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ export async function getUniconfigDatastore(
const json = await sendGetRequest(
[
baseURL,
`/data/network-topology:network-topology/network-topology:topology=uniconfig/network-topology:node=${nodeId}/frinx-uniconfig-topology:configuration?content=${DATA_STORE_MAP[datastoreType]}`,
`/data/network-topology:network-topology/network-topology:topology=uniconfig/network-topology:node=${encodeURIComponent(
nodeId,
)}/frinx-uniconfig-topology:configuration?content=${DATA_STORE_MAP[datastoreType]}`,
],
cookie,
);
Expand All @@ -194,7 +196,9 @@ export async function updateUniconfigDataStore(
await sendPutRequest(
[
baseURL,
`/data/network-topology:network-topology/network-topology:topology=uniconfig/network-topology:node=${nodeId}/frinx-uniconfig-topology:configuration`,
`/data/network-topology:network-topology/network-topology:topology=uniconfig/network-topology:node=${encodeURIComponent(
nodeId,
)}/frinx-uniconfig-topology:configuration`,
],
params,
cookie,
Expand Down
10 changes: 6 additions & 4 deletions src/helpers/stream-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ function getDisabledSyncConfig() {
}

export function getMountParamsForStream(mountParameters: JsonValue, streamParameters: JsonValue): JsonValue {
const parsedMountParameters = typeof mountParameters === 'string' ? JSON.parse(mountParameters) : mountParameters;
const parsedStreamParameters = typeof streamParameters === 'string' ? JSON.parse(streamParameters) : streamParameters;
const sanitizedStreamParameters = Array.isArray(parsedStreamParameters)
? parsedStreamParameters
: [parsedStreamParameters];

const decodedMountParams = decodeMountParams(mountParameters);

Expand All @@ -23,7 +25,7 @@ export function getMountParamsForStream(mountParameters: JsonValue, streamParame
return {
cli: {
...cli,
...parsedStreamParameters,
'subscriptions:stream': sanitizedStreamParameters, // eslint-disable-line @typescript-eslint/naming-convention
...getDisabledSyncConfig(),
},
};
Expand All @@ -34,7 +36,7 @@ export function getMountParamsForStream(mountParameters: JsonValue, streamParame
return {
gnmi: {
...gnmi,
...parsedStreamParameters,
'subscriptions:stream': sanitizedStreamParameters, // eslint-disable-line @typescript-eslint/naming-convention
...getDisabledSyncConfig(),
},
};
Expand All @@ -44,7 +46,7 @@ export function getMountParamsForStream(mountParameters: JsonValue, streamParame
return {
netconf: {
...netconf,
...parsedMountParameters,
'subscriptions:stream': sanitizedStreamParameters, // eslint-disable-line @typescript-eslint/naming-convention
...getDisabledSyncConfig(),
},
};
Expand Down

0 comments on commit ad45f0b

Please sign in to comment.