2 ========================LICENSE_START=================================
5 Copyright (C) 2023: Nordix Foundation
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 ========================LICENSE_END===================================
20 const isObject = (value) => typeof value === "object" && value !== null
22 function checkValue(value){
23 return (isObject(value) ? value : "");
26 function printResources(resources) {
27 let res = Object.values(checkValue(resources));
28 let out = `<p class="lead">Resources:</p><ul>`;
32 <strong>CommType:</strong> ${r.commType}
33 <strong>CustOpName:</strong> ${r.custOpName}
34 <strong>ResourceName:</strong> ${r.resourceName}
35 <strong>Uri:</strong> ${r.uri}
36 <strong>Description:</strong> ${r.description}
37 <strong>Operations:</strong> ${Object.values(checkValue(r.operations))}
45 function printCustomOperations(custOperations) {
46 let operations = Object.values(checkValue(custOperations));
47 let out = `<p class="lead"> Custom Operations:</p><ul>`;
48 operations.forEach((o) => {
51 <strong>CommType:</strong> ${o.commType}
52 <strong>CustOpName:</strong> ${o.custOpName}
53 <strong>Description:</strong> ${o.description}
54 <strong>Operations:</strong> ${Object.values(checkValue(o.operations))}
62 function printVersions(versions) {
63 let vers = Object.values(checkValue(versions));
64 let out = `<p class="lead">Versions:</p><ul>`;
68 <strong>ApiVersion:</strong> ${v.apiVersion}
69 ${printCustomOperations(v.custOperations)}
70 ${printResources(v.resources)}
78 function printInterfaceDescription(description) {
79 let interfaceDescriptions = Object.values(checkValue(description));
80 let out = `<p class="lead">Interface Description:</p><ul>`;
81 interfaceDescriptions.forEach((d) => {
84 <strong>Ipv4Addr:</strong> ${d.ipv4Addr}
85 <strong>Ipv6Addr:</strong> ${d.ipv6Addr}
86 <strong>Port:</strong> ${d.port}
87 <strong>SecurityMethods:</strong> ${Object.values(checkValue(d.securityMethods))}
95 function printAefProfiles(aefProfiles){
98 aefProfiles.forEach((aef) => {
100 <tr data-bs-toggle="collapse" data-bs-target="#r${index}">
101 <td>${aef.aefId}</td>
102 <td>${aef.aefLocation}</td>
103 <td>${aef.domainName}</td>
104 <td>${aef.protocol}</td>
105 <td>${Object.values(checkValue(aef.securityMethods))}</td>
107 <tr class="collapse accordion-collapse" id="r${index}" data-bs-parent=".table">
110 ${printInterfaceDescription(aef.interfaceDescriptions)}
111 ${printVersions(aef.versions)}