aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gui-clamp/pom.xml3
-rw-r--r--gui-clamp/ui-react/package.json19
-rw-r--r--gui-clamp/ui-react/src/api/ControlLoopService.js33
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/ChangeOrderStateModal.test.js263
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/CommissioningModal.js172
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/CommissioningModal.test.js173
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/DeleteToscaTemplate.js7
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/DeleteToscaTemplate.test.js1
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.js9
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.test.js40
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationOrderStateChangeItem.test.js51
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml.js1
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml.test.js203
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/ChangeOrderStateModal.test.js.snap114
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/CommissioningModal.test.js.snap2
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstantiationOrderStateChangeItem.test.js.snap27
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/commonProps.json1444
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/controlLoopList.json59
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/fullTemplate.json2194
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/jsonEditorData.json50
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/orderedStateJson.json9
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/utils/CommissioningUtils.js178
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/utils/CommissioningUtils.test.js94
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextAlbumEditForm.js2
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaEditForm.js1
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPageControl.js97
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextAlbumEditForm.test.js93
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextSchemaEditForm.test.js94
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextSchemaTab.test.js29
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexEventEditForm.test.js67
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexFiles.test.js20
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexPageControl.test.js116
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexPolicyEditForm_State.test.js39
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/contextMenu.test.js118
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/showhideTextArea.test.js48
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/contextMenu.js4
36 files changed, 5580 insertions, 294 deletions
diff --git a/gui-clamp/pom.xml b/gui-clamp/pom.xml
index d9cd62c..01978fb 100644
--- a/gui-clamp/pom.xml
+++ b/gui-clamp/pom.xml
@@ -33,6 +33,9 @@
<ui.react.src>ui-react</ui.react.src>
<ui.react.lib.src>ui-react-lib</ui.react.lib.src>
<npm.publish.url>https://nexus3.onap.org/repository/npm.snapshot/</npm.publish.url>
+ <sonar.nodejs.executable>${project.build.directory}/ui-react/node/node</sonar.nodejs.executable>
+ <sonar.sources>${project.basedir}/ui-react/src</sonar.sources>
+ <sonar.exclusions>**/*.test.js</sonar.exclusions>
</properties>
<build>
<plugins>
diff --git a/gui-clamp/ui-react/package.json b/gui-clamp/ui-react/package.json
index 13d830e..c3b63c5 100644
--- a/gui-clamp/ui-react/package.json
+++ b/gui-clamp/ui-react/package.json
@@ -54,7 +54,8 @@
"history": "5.0.0",
"jest": "26.6.0",
"jest-canvas-mock": "2.3.1",
- "jest-fetch-mock": "3.0.3"
+ "jest-fetch-mock": "3.0.3",
+ "jest-sonar-reporter": "2.0.0"
},
"browserslist": [
">0.2%",
@@ -64,10 +65,12 @@
],
"jest": {
"verbose": true,
- "coverageDirectory": "${project.build.directory}/${ui.react.src}/coverage",
+ "collectCoverage": true,
+ "coverageDirectory": "${project.build.directory}/code-coverage",
"collectCoverageFrom": [
"**/*.{js,jsx}"
],
+ "testResultsProcessor": "jest-sonar-reporter",
"rootDir": "${project.build.directory}/${ui.react.src}",
"coverageReporters": [
"lcov"
@@ -83,6 +86,12 @@
"enzyme-to-json/serializer"
]
},
+ "jestSonar": {
+ "reportPath": "../../target/reports",
+ "reportFile": "test-reporter.xml",
+ "indent": 4,
+ "sonar56x": true
+ },
"babel": {
"presets": [
"@babel/preset-env",
@@ -97,6 +106,12 @@
],
[
"@babel/plugin-transform-runtime"
+ ],
+ [
+ "@babel/plugin-proposal-private-methods",
+ {
+ "loose": true
+ }
]
]
}
diff --git a/gui-clamp/ui-react/src/api/ControlLoopService.js b/gui-clamp/ui-react/src/api/ControlLoopService.js
index b3d987c..011d5ae 100644
--- a/gui-clamp/ui-react/src/api/ControlLoopService.js
+++ b/gui-clamp/ui-react/src/api/ControlLoopService.js
@@ -132,18 +132,6 @@ export default class ControlLoopService {
return data;
}
- static async getToscaControlLoopDefinitions() {
-
- const response = await fetch(window.location.pathname +
- 'restservices/clds/v2/toscaControlLoop/getElementDefinitions');
-
- this.checkResponseForError(response);
-
- const data = await response;
-
- return data;
- }
-
static async getCommonOrInstanceProperties(name, version, isCommon) {
const params = {
name: name,
@@ -157,25 +145,4 @@ export default class ControlLoopService {
return response;
}
- static async getToscaServiceTemplateSchema(section) {
-
- const params = {
- section: section
- }
-
- const response = await fetch(window.location.pathname +
- 'restservices/clds/v2/toscaControlLoop/getJsonSchema' + '?' + (new URLSearchParams(params)));
-
- this.checkResponseForError(response);
-
- return response;
- }
-
- static checkResponseForError(response) {
- if (!response.ok) {
- const message = `An error has occurred: ${ response.status }`;
- throw new Error(message);
- }
- }
-
}
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ChangeOrderStateModal.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ChangeOrderStateModal.test.js
new file mode 100644
index 0000000..4d288c6
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ChangeOrderStateModal.test.js
@@ -0,0 +1,263 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+import React from 'react';
+import { mount, shallow } from 'enzyme';
+import toJson from "enzyme-to-json";
+import ChangeOrderStateModal from "./ChangeOrderStateModal";
+import { createMemoryHistory } from "history";
+import { act } from "react-dom/test-utils";
+import clLoopList from "./testFiles/controlLoopList.json";
+import orderedStateJson from "./testFiles/orderedStateJson.json";
+import ControlLoopService from "../../../api/ControlLoopService";
+
+let logSpy = jest.spyOn(console, 'log')
+const oldWindowLocation = window.location
+describe('Verify ChangeOrderStateModal', () => {
+ const flushPromises = () => new Promise(setImmediate);
+
+ beforeEach(() => {
+ logSpy.mockClear()
+ })
+
+ afterAll(() => {
+ window.location = oldWindowLocation
+ })
+
+ beforeAll(() => {
+ jest
+ .spyOn(global, 'fetch')
+ .mockImplementation(() => {
+ return {
+ ok: true,
+ status: 200,
+ text: () => "OK",
+ json: () => {
+ return Promise.resolve(orderedStateJson)
+ }
+ }
+ }
+ )
+
+
+ delete window.location
+
+ // create a new `window.location` object that's *almost*
+ // like the real thing
+ window.location = Object.defineProperties(
+ // start with an empty object on which to define properties
+ {},
+ {
+ // grab all of the property descriptors for the
+ // `jsdom` `Location` object
+ ...Object.getOwnPropertyDescriptors(oldWindowLocation),
+ instantiationName: {
+ configurable: true,
+ value: "PMSH_Instance1",
+ },
+ instantiationVersion: {
+ configurable: true,
+ value: "2.3.1",
+ }
+ },
+ )
+ })
+
+ it("renders without crashing", () => {
+ act(() => {
+ shallow(<ChangeOrderStateModal location={window.location}/>);
+ })
+ });
+
+ it("renders correctly", () => {
+ act(() => {
+ const tree = shallow(<ChangeOrderStateModal location={window.location}/>);
+ expect(toJson(tree)).toMatchSnapshot();
+ })
+ });
+
+ it('should have two Button elements', () => {
+ act(() => {
+ const container = shallow(<ChangeOrderStateModal location={window.location}/>)
+ expect(container.find('Button').length).toEqual(2);
+ })
+ });
+
+ it('should have one dropdown element', () => {
+ act(() => {
+ const container = shallow(<ChangeOrderStateModal location={ window.location }/>)
+ expect(container.find('Dropdown').length).toEqual(1);
+ });
+ });
+
+ it('handleDropSelect called when dropdown clicked', () => {
+ const history = createMemoryHistory();
+ const component = mount(<ChangeOrderStateModal history={ history } location={window.location}/>)
+
+ act(() => {
+ component.find('Dropdown').get(0).props.onSelect();
+ expect(logSpy).toHaveBeenCalledWith('handleDropDownChange called');
+ });
+
+ component.unmount();
+ });
+
+ it('handleClose called when bottom button clicked', () => {
+ const history = createMemoryHistory();
+ const component = mount(<ChangeOrderStateModal history={ history } location={window.location}/>)
+
+ act(() => {
+ component.find('[variant="secondary"]').simulate('click');
+ expect(logSpy).toHaveBeenCalledWith('handleClose called');
+ });
+
+ component.unmount();
+ });
+
+ it('handleClose called when top-right button clicked', () => {
+ const history = createMemoryHistory();
+ const component = mount(<ChangeOrderStateModal history={ history } location={window.location}/>)
+
+ act(() => {
+ component.find('[size="sm"]').get(0).props.onHide();
+ expect(logSpy).toHaveBeenCalledWith('handleClose called');
+ });
+
+ component.unmount();
+ });
+
+ it('handleSave called when save button clicked and response is ok', async () => {
+ jest.resetAllMocks()
+ const getInstanceOrderStateSpy = jest.spyOn(ControlLoopService, 'getInstanceOrderState')
+ .mockImplementationOnce(() => {
+ return Promise.resolve({
+ ok: true,
+ status: 200,
+ text: () => "OK",
+ json: () => {
+ return Promise.resolve(orderedStateJson)
+ }
+ })
+ }
+ )
+
+ const changeInstanceOrderStateSpy = jest.spyOn(ControlLoopService, 'changeInstanceOrderState')
+ .mockImplementationOnce(() => {
+ return Promise.resolve({
+ ok: true,
+ status: 200,
+ text: () => "OK",
+ json: () => {
+ return Promise.resolve(clLoopList)
+ }
+ })
+ }
+ )
+
+ const component = mount(<ChangeOrderStateModal location={window.location}/>)
+
+ await act( async () => {
+ component.find('[variant="primary"]').simulate('click');
+ await expect(getInstanceOrderStateSpy).toHaveBeenCalled()
+ await expect(changeInstanceOrderStateSpy).toHaveBeenCalled()
+ expect(logSpy).toHaveBeenNthCalledWith(1,"handleSave called");
+ expect(logSpy).toHaveBeenNthCalledWith(2,"successAlert called");
+ // await expect(logSpy).toHaveBeenCalledTimes(2);
+ });
+ });
+
+ it('handleSave called when save button clicked and response is not ok', async () => {
+ jest.resetAllMocks()
+ const getInstanceOrderStateSpy = jest.spyOn(ControlLoopService, 'getInstanceOrderState')
+ .mockImplementationOnce(() => {
+ return Promise.resolve({
+ ok: true,
+ status: 200,
+ text: () => "OK",
+ json: () => {
+ return Promise.resolve(orderedStateJson)
+ }
+ })
+ }
+ )
+
+ const changeInstanceOrderStateSpy = jest.spyOn(ControlLoopService, 'changeInstanceOrderState')
+ .mockImplementationOnce(() => {
+ return Promise.resolve({
+ ok: false,
+ status: 200,
+ text: () => "OK",
+ json: () => {
+ return Promise.resolve(clLoopList)
+ }
+ })
+ }
+ )
+
+ const component = mount(<ChangeOrderStateModal location={window.location}/>)
+
+ await act( async () => {
+ component.find('[variant="primary"]').simulate('click');
+ await expect(getInstanceOrderStateSpy).toHaveBeenCalled()
+ await expect(changeInstanceOrderStateSpy).toHaveBeenCalled()
+ expect(logSpy).toHaveBeenNthCalledWith(1,"handleSave called");
+ expect(logSpy).toHaveBeenNthCalledWith(2,"errorAlert called");
+ // await expect(logSpy).toHaveBeenCalledTimes(2);
+ });
+ });
+
+ it('Check useEffect is being called', async () => {
+ jest.resetAllMocks()
+ jest.spyOn(ControlLoopService, 'getInstanceOrderState')
+ .mockImplementationOnce(() => {
+ return Promise.resolve({
+ ok: true,
+ status: 200,
+ text: () => "OK",
+ json: () => {
+ return Promise.resolve(orderedStateJson)
+ }
+ })
+ }
+ )
+
+ jest.spyOn(ControlLoopService, 'changeInstanceOrderState')
+ .mockImplementationOnce(() => {
+ return Promise.resolve({
+ ok: true,
+ status: 200,
+ text: () => "OK",
+ json: () => {
+ return Promise.resolve(clLoopList)
+ }
+ })
+ }
+ )
+
+ const component = mount(<ChangeOrderStateModal location={window.location}/>)
+
+ const useEffect = jest.spyOn(React, "useEffect");
+ await act(async () => {
+ await flushPromises()
+ component.update()
+ await expect(useEffect).toHaveBeenCalled();
+ })
+ component.unmount();
+ });
+});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/CommissioningModal.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/CommissioningModal.js
index fc150ef..b3b76c1 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/CommissioningModal.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/CommissioningModal.js
@@ -21,9 +21,9 @@ import Modal from "react-bootstrap/Modal";
import Button from "react-bootstrap/Button";
import React, { useEffect, useState } from "react";
import styled from "styled-components";
-import { JSONEditor } from "@json-editor/json-editor";
import ControlLoopService from "../../../api/ControlLoopService";
import { Alert } from "react-bootstrap";
+import CommissioningUtils from "./utils/CommissioningUtils";
const ModalStyled = styled(Modal)`
@media (min-width: 800px) {
@@ -81,7 +81,12 @@ const CommissioningModal = (props) => {
}
if (toscaTemplateResponse.ok && toscaCommonProperties.ok) {
- await renderJsonEditor(toscaTemplateResponse, toscaCommonProperties)
+ const renderedEditorObjects = CommissioningUtils.renderJsonEditor(toscaTemplateResponse, toscaCommonProperties)
+ setFullToscaTemplate((await renderedEditorObjects).fullTemplate)
+ setToscaJsonSchema((await renderedEditorObjects).propertySchema)
+ setJsonEditor((await renderedEditorObjects).editorTemp)
+ setToscaInitialValues((await renderedEditorObjects).toscaInitialValues)
+
}
}, []);
@@ -92,176 +97,31 @@ const CommissioningModal = (props) => {
props.history.push('/');
}
- const handleSave = () => {
- updateTemplate(jsonEditor.getValue())
+ const handleSave = async () => {
+ console.log("handleSave called")
+ if (jsonEditor != null) {
+ setFullToscaTemplate(await CommissioningUtils.updateTemplate(jsonEditor.getValue(), fullToscaTemplate))
+ }
}
const handleCommission = async () => {
+ console.log("handleCommission called")
+
await ControlLoopService.deleteToscaTemplate('ToscaServiceTemplateSimple', "1.0.0")
- .catch(error => error.message)
const recommissioningResponse = await ControlLoopService.uploadToscaFile(fullToscaTemplate)
- .catch(error => error.message)
await receiveResponseFromCommissioning(recommissioningResponse)
}
const receiveResponseFromCommissioning = async (response) => {
-
- if (await response.ok) {
- setAlertMessages(<Alert variant="success">
- <Alert.Heading>Commissioning Success</Alert.Heading>
- <p>Altered Template was Successfully Uploaded</p>
- <hr/>
- </Alert>);
- }
- else {
- setAlertMessages(<Alert variant="danger">
- <Alert.Heading>Commissioning Failure</Alert.Heading>
- <p>Updated Template Failed to Upload</p>
- <p>Status code: { await response.status }: { response.statusText }</p>
- <p>Response Text: { await response.text() }</p>
- <hr/>
- </Alert>);
- }
+ console.log("receiveResponseFromCommissioning called")
+ setAlertMessages(await CommissioningUtils.getAlertMessages(response));
};
- const renderJsonEditor = async (template, commonProps) => {
-
- const fullTemplate = await template.json()
-
- setFullToscaTemplate(fullTemplate)
- const allNodeTemplates = fullTemplate.topology_template.node_templates
- const shortenedNodeTemplatesObjectStartValues = {}
- // Get the common properties to construct a schema
- // Get valid start values at the same time
- const commonNodeTemplatesJson = await commonProps.json().then(data => {
- const nodeTemplatesArray = Object.entries(data)
- const shortenedNodeTemplatesObject = {}
- nodeTemplatesArray.forEach(([key, temp]) => {
- const currentNodeTemplate = allNodeTemplates[key]
- const propertiesObject = {
- properties: temp.properties
- }
-
- shortenedNodeTemplatesObject[key] = propertiesObject
-
- const propertiesStartValues = {}
-
- // Get all the existing start values to populate the properties in the schema
- Object.entries(propertiesObject.properties).forEach(([propKey, prop]) => {
- propertiesStartValues[propKey] = currentNodeTemplate.properties[propKey]
- })
-
- shortenedNodeTemplatesObjectStartValues[key] = propertiesStartValues
-
- })
-
- setToscaInitialValues(shortenedNodeTemplatesObjectStartValues)
- return shortenedNodeTemplatesObject;
- })
-
- const propertySchema = makeSchemaForCommonProperties(commonNodeTemplatesJson)
- setToscaJsonSchema(propertySchema)
-
- editorTemp = createJsonEditor(propertySchema, shortenedNodeTemplatesObjectStartValues);
- setJsonEditor(editorTemp)
- }
-
- const updateTemplate = (userAddedCommonPropValues) => {
- const nodeTemplates = fullToscaTemplate.topology_template.node_templates
- const commonPropertyDataEntries = Object.entries(userAddedCommonPropValues)
-
- // This replaces the values for properties in the full tosca template
- // that will be sent up to the api with the entries the user provided.
- commonPropertyDataEntries.forEach(([templateKey, values]) => {
- Object.entries(values).forEach(([propKey, propVal]) => {
- nodeTemplates[templateKey].properties[propKey] = propVal
- })
- })
-
- fullToscaTemplate.topology_template.node_templates = nodeTemplates
-
- setFullToscaTemplate(fullToscaTemplate)
- alert('Changes saved. Commission When Ready...')
- }
-
- const makeSchemaForCommonProperties = (commonProps) => {
- const commonPropsArr = Object.entries(commonProps)
-
- const newSchemaObject = {}
-
- newSchemaObject.title = "CommonProperties"
- newSchemaObject.type = "object"
- newSchemaObject.properties = {}
-
- commonPropsArr.forEach(([templateKey, template]) => {
-
- const propertiesObject = {}
- Object.entries(template.properties).forEach(([propKey, prop]) => {
-
- propertiesObject[propKey] = {
- type: getType(prop.type)
- }
-
- })
- newSchemaObject.properties[templateKey] = {
- options: {
- "collapsed": true
- },
- properties: propertiesObject
- }
- })
-
- return newSchemaObject
-
- }
-
- const getType = (propertyType) => {
- switch (propertyType)
- {
- case "string":
- return "string"
- case "integer":
- return "integer"
- case "list":
- return "array"
- case "object":
- return "object"
- default:
- return "object"
- }
- }
-
- const createJsonEditor = (toscaModel, editorData) => {
- JSONEditor.defaults.options.collapse = false;
-
- return new JSONEditor(document.getElementById("editor"),
- {
- schema: toscaModel,
- startval: editorData,
- theme: 'bootstrap4',
- iconlib: 'fontawesome5',
- object_layout: 'normal',
- disable_properties: false,
- disable_edit_json: true,
- disable_array_reorder: true,
- disable_array_delete_last_row: true,
- disable_array_delete_all_rows: false,
- array_controls_top: true,
- keep_oneof_values: false,
- collapsed: false,
- show_errors: 'always',
- display_required_only: false,
- show_opt_in: false,
- prompt_before_delete: true,
- required_by_default: false,
- })
- }
-
return (
<ModalStyled size="xl"
show={ show }
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/CommissioningModal.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/CommissioningModal.test.js
index 054450c..5ace94d 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/CommissioningModal.test.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/CommissioningModal.test.js
@@ -17,16 +17,38 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
import React from 'react';
import { mount, shallow } from 'enzyme';
-import ReadAndConvertYaml from './ReadAndConvertYaml';
import toJson from "enzyme-to-json";
import { act } from "react-dom/test-utils";
import { createMemoryHistory } from "history";
import CommissioningModal from "./CommissioningModal";
+import commonProps from "./testFiles/commonProps.json";
+import fullTemp from "./testFiles/fullTemplate.json";
+import ControlLoopService from "../../../api/ControlLoopService";
+
+let logSpy = jest.spyOn(console, 'log')
+const commonProperties = JSON.parse(JSON.stringify(commonProps))
+const fullTemplate = JSON.parse(JSON.stringify(fullTemp))
+describe('Verify CommissioningModal', () => {
+
+ const unmockedFetch = global.fetch
+ beforeAll(() => {
+ global.fetch = () =>
+ Promise.resolve({
+ status: 200,
+ text: () => "OK",
+ json: () => "{GlobalFetch}"
+ })
+ })
-describe('Verify ReadAndConvertYaml', () => {
+ afterAll(() => {
+ global.fetch = unmockedFetch
+ })
+
+ beforeEach(() => {
+ logSpy.mockClear()
+ })
it("renders without crashing", () => {
shallow(<CommissioningModal/>);
@@ -45,25 +67,164 @@ describe('Verify ReadAndConvertYaml', () => {
it('handleClose called when bottom button clicked', () => {
const history = createMemoryHistory();
const component = mount(<CommissioningModal history={ history }/>)
- const logSpy = jest.spyOn(console, 'log');
+ // const logSpy = jest.spyOn(console, 'log');
act(() => {
component.find('[variant="secondary"]').simulate('click');
expect(logSpy).toHaveBeenCalledWith('handleClose called');
});
+
+ component.unmount();
});
it('handleClose called when top-right button clicked', () => {
const history = createMemoryHistory();
const component = mount(<CommissioningModal history={ history }/>)
- const logSpy = jest.spyOn(console, 'log');
-
act(() => {
component.find('[size="xl"]').get(0).props.onHide();
expect(logSpy).toHaveBeenCalledWith('handleClose called');
});
+
+ component.unmount();
+ });
+
+ it('handleSave called when save button clicked', () => {
+ const component = shallow(<CommissioningModal/>)
+ act(() => {
+ component.find('[variant="primary"]').simulate('click');
+ expect(logSpy).toHaveBeenCalledWith("handleSave called");
+ });
+ });
+
+ it('getToscaTemplate gets called in useEffect with error', async() => {
+ const fetchMock = jest.spyOn(ControlLoopService, 'getToscaTemplate').mockImplementation(() => Promise.resolve({
+ ok: false,
+ status: 200,
+ text: () => "OK",
+ json: () => fullTemplate
+ }))
+
+ mount(<CommissioningModal/>)
+ await act(async () => {
+ expect(fetchMock).toHaveBeenCalled();
+ });
});
+ it('getCommonProperties gets called in useEffect with error', async() => {
+ const fetchMock = jest.spyOn(ControlLoopService, 'getToscaTemplate').mockImplementation(() => Promise.resolve({
+ ok: false,
+ status: 200,
+ text: () => "OK",
+ json: () => commonProperties
+ }))
+
+ mount(<CommissioningModal/>)
+ await act(async () => {
+ expect(fetchMock).toHaveBeenCalled();
+ });
+ });
+
+ it('useState gets called in useEffect with error', async() => {
+ const useStateSpy = jest.spyOn(React, 'useState')
+ jest
+ .spyOn(global, 'fetch')
+ .mockImplementation(() =>
+ Promise.resolve({
+ ok: false,
+ status: 200,
+ text: () => "OK",
+ json: () => "{useState}"
+ })
+ )
+
+ mount(<CommissioningModal/>)
+ await act(async () => {
+ expect(useStateSpy).toHaveBeenCalledTimes(6);
+ });
+ });
+
+ it('set state gets called for setFullToscaTemplate', () => {
+ const setFullToscaTemplate = jest.fn();
+ const history = createMemoryHistory();
+ jest
+ .spyOn(global, 'fetch')
+ .mockImplementation(() =>
+ Promise.resolve({
+ ok: true,
+ status: 200,
+ text: () => "OK",
+ json: () => fullTemplate
+ })
+ )
+
+ mount(<CommissioningModal history={ history }/>)
+ act(async () => {
+ // expect(renderJsonEditor).toHaveBeenCalled();
+ expect(setFullToscaTemplate).toHaveBeenCalledTimes(1);
+ });
+ });
+
+ it('set state gets called for setToscaJsonSchema useEffect on success', () => {
+ const setToscaJsonEditor = jest.fn();
+ const history = createMemoryHistory();
+ jest
+ .spyOn(global, 'fetch')
+ .mockImplementation(() =>
+ Promise.resolve({
+ ok: true,
+ status: 200,
+ text: () => "OK",
+ json: () => fullTemplate
+ })
+ )
+
+ mount(<CommissioningModal history={ history }/>)
+ act(async () => {
+ // expect(renderJsonEditor).toHaveBeenCalled();
+ expect(setToscaJsonEditor).toHaveBeenCalledTimes(1);
+ });
+ });
+
+ it('Check useEffect is being called', async () => {
+ const useEffect = jest.spyOn(React, "useEffect");
+ mount(<CommissioningModal/>)
+ await act(async () => {
+ expect(useEffect).toHaveBeenCalled();
+ })
+ });
+
+ it('test handleCommission called on click', async () => {
+ const deleteToscaTemplateSpy = jest.spyOn(ControlLoopService, 'deleteToscaTemplate').mockImplementation(() => {
+ Promise.resolve({
+ ok: true,
+ status: 200,
+ text: () => "OK",
+ json: () => "{handleCommissioning}"
+ })
+ })
+ const uploadToscaTemplateSpy = jest.spyOn(ControlLoopService, 'uploadToscaFile').mockImplementation(() => {
+ Promise.resolve({
+ ok: true,
+ status: 200,
+ text: () => "OK",
+ json: () => "{uploadToscaFile}"
+ })
+ })
+
+
+ const useStateSpy = jest.spyOn(React, 'useState')
+
+ const component = shallow(<CommissioningModal/>)
+ component.find('[variant="success mr-auto"]').simulate('click');
+
+ await act( async () => {
+ expect(logSpy).toHaveBeenCalledWith("handleCommission called")
+ expect(await deleteToscaTemplateSpy).toHaveBeenCalled()
+ expect(await uploadToscaTemplateSpy).toHaveBeenCalled()
+ expect(logSpy).toHaveBeenCalledWith("receiveResponseFromCommissioning called")
+ expect(useStateSpy).toHaveBeenCalled()
+ })
+ })
});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/DeleteToscaTemplate.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/DeleteToscaTemplate.js
index 7968fe2..c2703cc 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/DeleteToscaTemplate.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/DeleteToscaTemplate.js
@@ -30,7 +30,12 @@ const DeleteToscaTemplate = props => {
const response = await ControlLoopService.deleteToscaTemplate(props.templateName, props.templateVersion)
.catch(error => error.message);
- console.log('Response is ok: ' + response.ok);
+ if(!response.ok) {
+ console.log('deleteTemplateHandler called with error');
+ } else {
+ console.log('deleteTemplateHandler called');
+ }
+ // console.log('Response is ok: ' + response.ok);
props.onDeleteToscaServiceTemplate(response);
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/DeleteToscaTemplate.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/DeleteToscaTemplate.test.js
index e4d437a..c52bdea 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/DeleteToscaTemplate.test.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/DeleteToscaTemplate.test.js
@@ -20,7 +20,6 @@
import React from 'react';
import { mount, shallow } from 'enzyme';
-import GetToscaTemplate from './GetToscaTemplate';
import toJson from "enzyme-to-json";
import DeleteToscaTemplate from "./DeleteToscaTemplate";
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.js
index ba78b80..70c1f41 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.js
@@ -24,11 +24,18 @@ import ControlLoopService from "../../../api/ControlLoopService";
const GetToscaTemplate = (props) => {
const getTemplateHandler = async () => {
- console.log('getTemplateHandler called')
const response = await ControlLoopService.getToscaTemplate(props.templateName, props.templateVersion)
.catch(error => error.message);
+ if(!response.ok) {
+ console.log('getToscaServiceTemplateHandler called with error')
+
+ } else
+ {
+ console.log('getToscaServiceTemplateHandler called')
+ }
+
props.onGetToscaServiceTemplate(response);
}
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.test.js
index 38da005..71fbeec 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.test.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.test.js
@@ -21,9 +21,12 @@ import React from 'react';
import { mount, shallow } from 'enzyme';
import GetToscaTemplate from './GetToscaTemplate';
import toJson from "enzyme-to-json";
+import { act } from "react-dom/test-utils";
describe('Verify GetToscaTemplate', () => {
+ const flushPromises = () => new Promise(setImmediate);
+
it("renders without crashing", () => {
shallow(<GetToscaTemplate/>);
});
@@ -38,12 +41,41 @@ describe('Verify GetToscaTemplate', () => {
expect(container.find('Button').length).toEqual(1);
});
- it('button should call getTemplateHandler when clicked', async () => {
- const component = mount(<GetToscaTemplate/>)
+ it('button should call getTemplateHandler when clicked when response is error', async () => {
+
+ const onGetToscaServiceTemplate = jest.fn()
+ jest
+ .spyOn(global, 'fetch')
+ .mockImplementationOnce(async () =>
+ Promise.resolve({
+ ok: false,
+ status: 200,
+ json: () => {
+ return Promise.resolve({
+ "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
+ "data_types": {},
+ "policy_types": {},
+ "topology_template": {},
+ "name": "ToscaServiceTemplateSimple",
+ "version": "1.0.0",
+ "metadata": {},
+ "id": "0.19518677404255147"
+ })
+ }
+ }
+ )
+ )
+
+ const component = mount(<GetToscaTemplate onGetToscaServiceTemplate={onGetToscaServiceTemplate}/>)
const logSpy = jest.spyOn(console, 'log');
- component.find('[variant="primary"]').simulate('click');
- expect(logSpy).toHaveBeenCalledWith('getTemplateHandler called');
+ await act(async () => {
+ component.find('[variant="primary"]').simulate('click');
+ await flushPromises()
+ component.update()
+ expect(logSpy).toHaveBeenCalledWith('getToscaServiceTemplateHandler called with error');
+ });
+ component.unmount();
});
it('should have a Button element with specified text', () => {
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationOrderStateChangeItem.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationOrderStateChangeItem.test.js
new file mode 100644
index 0000000..3981ea5
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationOrderStateChangeItem.test.js
@@ -0,0 +1,51 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+import React from 'react';
+import { mount, shallow } from 'enzyme';
+import toJson from "enzyme-to-json";
+import InstantiationOrderStateChangeItem from "./InstantiationOrderStateChangeItem";
+import CommissioningUtils from "./utils/CommissioningUtils";
+
+describe('Verify InstantiationOrderStateChangeItem', () => {
+
+ it("renders without crashing", () => {
+ shallow(<InstantiationOrderStateChangeItem/>);
+ });
+
+ it("renders correctly", () => {
+ const tree = shallow(<InstantiationOrderStateChangeItem/>);
+ expect(toJson(tree)).toMatchSnapshot();
+ });
+
+ it("renders correctly when orderState is uninitialized", () => {
+ const tree = shallow(<InstantiationOrderStateChangeItem orderState="UNINITIALISED" title="UNINITIALISED_TEST"/>);
+ expect(toJson(tree)).toMatchSnapshot();
+ });
+
+ it("renders correctly when orderState is passive", () => {
+ const tree = shallow(<InstantiationOrderStateChangeItem orderState="PASSIVE" title="PASSIVE_TEST"/>);
+ expect(toJson(tree)).toMatchSnapshot();
+ });
+
+ it("renders correctly when orderState is running", () => {
+ const tree = shallow(<InstantiationOrderStateChangeItem orderState="RUNNING" title="RUNNING_TEST"/>);
+ expect(toJson(tree)).toMatchSnapshot();
+ });
+});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml.js
index 0eff5fe..5fc97c4 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml.js
@@ -66,6 +66,7 @@ const ReadAndConvertYaml = (props) => {
setToscaTemplateData(toscaData);
} else {
setResponseOk(true);
+ console.log('Response is ok');
const toscaData = await toscaServiceTemplateResponse.json();
setToscaTemplateData(toscaData);
setShowDeleteButton(true)
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml.test.js
index 90d7185..03192a1 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml.test.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml.test.js
@@ -20,32 +20,43 @@
import React from 'react';
import { mount, shallow } from 'enzyme';
import ReadAndConvertYaml from './ReadAndConvertYaml';
+import GetToscaTemplate from "./GetToscaTemplate";
import toJson from "enzyme-to-json";
import { act } from "react-dom/test-utils";
import { createMemoryHistory } from "history";
+let logSpy = jest.spyOn(console, 'log')
describe('Verify ReadAndConvertYaml', () => {
- beforeEach(() => {
- fetch.resetMocks();
- fetch.mockImplementation(() => {
- return Promise.resolve({
+ const unmockedFetch = global.fetch
+
+ const flushPromises = () => new Promise(setImmediate);
+
+ beforeAll(() => {
+ global.fetch = () =>
+ Promise.resolve({
ok: true,
status: 200,
- json: () => {
- return Promise.resolve({
- "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
- "data_types": {},
- "policy_types": {},
- "topology_template": {},
- "name": "ToscaServiceTemplateSimple",
- "version": "1.0.0",
- "metadata": {},
- "id": "0.19518677404255147"
- });
- }
- });
- });
+ text: () => "OK",
+ json: () => Promise.resolve({
+ "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
+ "data_types": {},
+ "policy_types": {},
+ "topology_template": {},
+ "name": "ToscaServiceTemplateSimple",
+ "version": "1.0.0",
+ "metadata": {},
+ "id": "0.19518677404255147"
+ })
+ })
+ })
+
+ beforeEach(() => {
+ logSpy.mockClear()
+ })
+
+ afterAll(() => {
+ global.fetch = unmockedFetch
})
it("renders without crashing", () => {
@@ -64,36 +75,178 @@ describe('Verify ReadAndConvertYaml', () => {
it('should call getToscaServiceTemplateHandler on click', async () => {
const component = mount(<ReadAndConvertYaml/>);
- const logSpy = jest.spyOn(console, 'log');
- act(async () => {
+ await act(async () => {
+ component.find('GetToscaTemplate').simulate('click');
+ await flushPromises()
+ component.update()
+ await expect(logSpy).toHaveBeenCalledWith('getToscaServiceTemplateHandler called');
+ });
+ component.unmount()
+ });
+
+ it('should make unsuccessful call getToscaServiceTemplateHandler on click', async () => {
+ jest
+ .spyOn(global, 'fetch')
+ .mockImplementationOnce(async () =>
+ Promise.resolve({
+ ok: false,
+ status: 200,
+ json: () => {
+ return Promise.resolve({
+ "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
+ "data_types": {},
+ "policy_types": {},
+ "topology_template": {},
+ "name": "ToscaServiceTemplateSimple",
+ "version": "1.0.0",
+ "metadata": {},
+ "id": "0.19518677404255147"
+ })
+ }
+ }
+ )
+ )
+ const component = mount(<ReadAndConvertYaml/>);
+
+ await act(async () => {
+ component.find('GetToscaTemplate').simulate('click');
+ await flushPromises()
+ component.update()
+ expect(logSpy).toHaveBeenCalledWith('getToscaServiceTemplateHandler called with error');
+ });
+ component.unmount();
+ });
+
+ it('should make unsuccessful call deleteToscaServiceTemplateHandler on click', async () => {
+ jest
+ .spyOn(global, 'fetch')
+ .mockImplementationOnce(() =>
+ Promise.resolve({
+ ok: true,
+ status: 200,
+ json: () => {
+ return Promise.resolve({
+ "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
+ "data_types": {},
+ "policy_types": {},
+ "topology_template": {},
+ "name": "ToscaServiceTemplateSimple",
+ "version": "1.0.0",
+ "metadata": {},
+ "id": "0.19518677404255147"
+ })
+ }
+ }
+ )
+ )
+ const component = mount(<ReadAndConvertYaml/>);
+
+ await act(async () => {
component.find('GetToscaTemplate').simulate('click');
- expect(logSpy).toHaveBeenCalledWith('getToscaServiceTemplateHandler called');
+ await flushPromises()
+ component.update()
+ component.find('DeleteToscaTemplate').simulate('click');
+ await flushPromises()
+ component.update()
+ expect(logSpy).toHaveBeenCalledWith('deleteTemplateHandler called');
});
+
+ component.unmount()
+ });
+
+ it('should make unsuccessful call deleteToscaServiceTemplateHandler on click', async () => {
+ const realUseState = React.useState
+ const stubInitialState = [true]
+
+ const useStateSpy = jest.spyOn(React, 'useState')
+ useStateSpy.mockImplementationOnce(() => realUseState(stubInitialState));
+
+ jest
+ .spyOn(global, 'fetch')
+ .mockImplementationOnce(() =>
+ Promise.resolve({
+ ok: true,
+ status: 200,
+ json: () => {
+ return Promise.resolve({
+ "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
+ "data_types": {},
+ "policy_types": {},
+ "topology_template": {},
+ "name": "ToscaServiceTemplateSimple",
+ "version": "1.0.0",
+ "metadata": {},
+ "id": "0.19518677404255147"
+ })
+ }
+ }
+ )
+ )
+ const component = mount(<ReadAndConvertYaml/>);
+
+
+ await act(async () => {
+ component.find('GetToscaTemplate').simulate('click');
+ await flushPromises()
+ component.update()
+ });
+
+ jest
+ .spyOn(global, 'fetch')
+ .mockImplementationOnce(() =>
+ Promise.resolve({
+ ok: false,
+ status: 200,
+ json: () => {
+ return Promise.resolve({
+ "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
+ "data_types": {},
+ "policy_types": {},
+ "topology_template": {},
+ "name": "ToscaServiceTemplateSimple",
+ "version": "1.0.0",
+ "metadata": {},
+ "id": "0.19518677404255147"
+ })
+ }
+ }
+ )
+ )
+
+ await act(async () => {
+ component.find('DeleteToscaTemplate').simulate('click');
+ await flushPromises()
+ component.update()
+ expect(logSpy).toHaveBeenCalledWith('deleteTemplateHandler called with error');
+ });
+ component.unmount()
});
it('handleClose called when bottom button clicked', () => {
const history = createMemoryHistory();
const component = mount(<ReadAndConvertYaml history={ history }/>)
- const logSpy = jest.spyOn(console, 'log');
act(() => {
component.find('[variant="secondary"]').simulate('click');
expect(logSpy).toHaveBeenCalledWith('handleClose called');
});
+ component.unmount()
});
- it('handleClose called when top-right button clicked', () => {
+ it('handleClose called when top-right button clicked', async () => {
const history = createMemoryHistory();
const component = mount(<ReadAndConvertYaml history={ history }/>)
const logSpy = jest.spyOn(console, 'log');
- act(() => {
+ await act(async () => {
component.find('[size="xl"]').get(0).props.onHide();
+ await flushPromises()
+ component.update()
expect(logSpy).toHaveBeenCalledWith('handleClose called');
});
+ component.unmount()
});
-
});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/ChangeOrderStateModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/ChangeOrderStateModal.test.js.snap
new file mode 100644
index 0000000..478b886
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/ChangeOrderStateModal.test.js.snap
@@ -0,0 +1,114 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Verify ChangeOrderStateModal renders correctly 1`] = `
+<Styled(Modal)
+ backdrop="static"
+ keyboard={false}
+ onHide={[Function]}
+ show={true}
+ size="sm"
+>
+ <ModalHeader
+ closeButton={true}
+ closeLabel="Close"
+ >
+ <ModalTitle>
+ Manage Instantiation
+ </ModalTitle>
+ </ModalHeader>
+ <div
+ style={
+ Object {
+ "padding": "5px 5px 0 5px",
+ }
+ }
+ >
+ <ModalBody>
+ <Container
+ fluid={false}
+ >
+ <Dropdown
+ navbar={false}
+ onSelect={[Function]}
+ >
+ <DropdownToggle
+ id="dropdown-basic"
+ variant="dark"
+ >
+ Select Order State
+ </DropdownToggle>
+ <DropdownMenu
+ align="left"
+ alignRight={false}
+ flip={true}
+ >
+ <DropdownItem
+ as={
+ Object {
+ "$$typeof": Symbol(react.forward_ref),
+ "render": [Function],
+ }
+ }
+ disabled={false}
+ eventKey="UNINITIALISED"
+ >
+ UNINITIALISED
+ </DropdownItem>
+ <DropdownItem
+ as={
+ Object {
+ "$$typeof": Symbol(react.forward_ref),
+ "render": [Function],
+ }
+ }
+ disabled={false}
+ eventKey="PASSIVE"
+ >
+ PASSIVE
+ </DropdownItem>
+ <DropdownItem
+ as={
+ Object {
+ "$$typeof": Symbol(react.forward_ref),
+ "render": [Function],
+ }
+ }
+ disabled={false}
+ eventKey="RUNNING"
+ >
+ RUNNING
+ </DropdownItem>
+ </DropdownMenu>
+ </Dropdown>
+ </Container>
+ <Styled(Alert)
+ show={false}
+ variant="danger"
+ >
+ Can't get instantiation ordered state:
+ <br />
+ {}
+ </Styled(Alert)>
+ </ModalBody>
+ <styled.div />
+ </div>
+ <ModalFooter>
+ <Button
+ active={false}
+ disabled={false}
+ onClick={[Function]}
+ variant="primary"
+ >
+ Save
+ </Button>
+ <Button
+ active={false}
+ disabled={false}
+ onClick={[Function]}
+ variant="secondary"
+ >
+ Close
+ </Button>
+ </ModalFooter>
+</Styled(Modal)>
+`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/CommissioningModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/CommissioningModal.test.js.snap
index 8c26ff6..5ed3f3e 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/CommissioningModal.test.js.snap
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/CommissioningModal.test.js.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`Verify ReadAndConvertYaml renders correctly 1`] = `
+exports[`Verify CommissioningModal renders correctly 1`] = `
<Styled(Modal)
backdrop="static"
keyboard={false}
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstantiationOrderStateChangeItem.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstantiationOrderStateChangeItem.test.js.snap
new file mode 100644
index 0000000..bbf92ca
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstantiationOrderStateChangeItem.test.js.snap
@@ -0,0 +1,27 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Verify InstantiationOrderStateChangeItem renders correctly 1`] = `<Fragment />`;
+
+exports[`Verify InstantiationOrderStateChangeItem renders correctly when orderState is passive 1`] = `
+<Fragment>
+ <styled.div>
+ PASSIVE_TEST
+ </styled.div>
+</Fragment>
+`;
+
+exports[`Verify InstantiationOrderStateChangeItem renders correctly when orderState is running 1`] = `
+<Fragment>
+ <styled.div>
+ RUNNING_TEST
+ </styled.div>
+</Fragment>
+`;
+
+exports[`Verify InstantiationOrderStateChangeItem renders correctly when orderState is uninitialized 1`] = `
+<Fragment>
+ <styled.div>
+ UNINITIALISED_TEST
+ </styled.div>
+</Fragment>
+`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/commonProps.json b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/commonProps.json
new file mode 100644
index 0000000..71f98f8
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/commonProps.json
@@ -0,0 +1,1444 @@
+{
+ "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement": {
+ "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
+ "version": "1.2.3",
+ "derivedFrom": null,
+ "metadata": {},
+ "description": "Control loop element for the http requests of PMSH microservice",
+ "type": "org.onap.policy.clamp.controlloop.HttpControlLoopElement",
+ "typeVersion": "1.0.1",
+ "properties": {
+ "provider": {
+ "name": "provider",
+ "type": "string",
+ "typeVersion": "0.0.0",
+ "description": "Specifies the organization that provides the control loop element",
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "passiveToUninitializedTimeout": {
+ "name": "passiveToUninitializedTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "participant_id": {
+ "name": "participant_id",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "typeVersion": "0.0.0",
+ "description": null,
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "participantType": {
+ "name": "participantType",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "typeVersion": "0.0.0",
+ "description": "The identity of the participant type that hosts this type of Control Loop Element",
+ "defaultValue": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "uninitializedToPassiveTimeout": {
+ "name": "uninitializedToPassiveTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "startPhase": {
+ "name": "startPhase",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "runningToPassiveTimeout": {
+ "name": "runningToPassiveTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from running to passive",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "passiveToRunningTimeout": {
+ "name": "passiveToRunningTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from passive to running",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ }
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
+ "version": "1.2.3"
+ },
+ "typeIdentifier": {
+ "name": "org.onap.policy.clamp.controlloop.HttpControlLoopElement",
+ "version": "1.0.1"
+ },
+ "key": {
+ "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
+ "version": "1.2.3"
+ },
+ "definedName": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
+ "definedVersion": "1.2.3"
+ },
+ "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement": {
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "version": "1.2.3",
+ "derivedFrom": null,
+ "metadata": {},
+ "description": "Control loop element for the operational policy for Performance Management Subscription Handling",
+ "type": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
+ "typeVersion": "1.0.0",
+ "properties": {
+ "provider": {
+ "name": "provider",
+ "type": "string",
+ "typeVersion": "0.0.0",
+ "description": "Specifies the organization that provides the control loop element",
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "passiveToUninitializedTimeout": {
+ "name": "passiveToUninitializedTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "participant_id": {
+ "name": "participant_id",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "typeVersion": "0.0.0",
+ "description": null,
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "participantType": {
+ "name": "participantType",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "typeVersion": "0.0.0",
+ "description": "The identity of the participant type that hosts this type of Control Loop Element",
+ "defaultValue": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "uninitializedToPassiveTimeout": {
+ "name": "uninitializedToPassiveTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "startPhase": {
+ "name": "startPhase",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "runningToPassiveTimeout": {
+ "name": "runningToPassiveTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from running to passive",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "passiveToRunningTimeout": {
+ "name": "passiveToRunningTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from passive to running",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ }
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "typeIdentifier": {
+ "name": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
+ "version": "1.0.0"
+ },
+ "key": {
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "definedName": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "definedVersion": "1.2.3"
+ },
+ "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement": {
+ "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
+ "version": "1.2.3",
+ "derivedFrom": null,
+ "metadata": {},
+ "description": "Control loop element for the K8S microservice for local chart",
+ "type": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
+ "typeVersion": "1.0.0",
+ "properties": {
+ "provider": {
+ "name": "provider",
+ "type": "string",
+ "typeVersion": "0.0.0",
+ "description": "Specifies the organization that provides the control loop element",
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "passiveToUninitializedTimeout": {
+ "name": "passiveToUninitializedTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "participant_id": {
+ "name": "participant_id",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "typeVersion": "0.0.0",
+ "description": null,
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "participantType": {
+ "name": "participantType",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "typeVersion": "0.0.0",
+ "description": "The identity of the participant type that hosts this type of Control Loop Element",
+ "defaultValue": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "uninitializedToPassiveTimeout": {
+ "name": "uninitializedToPassiveTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "startPhase": {
+ "name": "startPhase",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "runningToPassiveTimeout": {
+ "name": "runningToPassiveTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from running to passive",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "passiveToRunningTimeout": {
+ "name": "passiveToRunningTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from passive to running",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ }
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
+ "version": "1.2.3"
+ },
+ "typeIdentifier": {
+ "name": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
+ "version": "1.0.0"
+ },
+ "key": {
+ "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
+ "version": "1.2.3"
+ },
+ "definedName": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
+ "definedVersion": "1.2.3"
+ },
+ "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement": {
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "version": "1.2.3",
+ "derivedFrom": null,
+ "metadata": {},
+ "description": "Control loop element for the monitoring policy for Performance Management Subscription Handling",
+ "type": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
+ "typeVersion": "1.0.0",
+ "properties": {
+ "provider": {
+ "name": "provider",
+ "type": "string",
+ "typeVersion": "0.0.0",
+ "description": "Specifies the organization that provides the control loop element",
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "passiveToUninitializedTimeout": {
+ "name": "passiveToUninitializedTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "participant_id": {
+ "name": "participant_id",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "typeVersion": "0.0.0",
+ "description": null,
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "participantType": {
+ "name": "participantType",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "typeVersion": "0.0.0",
+ "description": "The identity of the participant type that hosts this type of Control Loop Element",
+ "defaultValue": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "uninitializedToPassiveTimeout": {
+ "name": "uninitializedToPassiveTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "startPhase": {
+ "name": "startPhase",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "runningToPassiveTimeout": {
+ "name": "runningToPassiveTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from running to passive",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "passiveToRunningTimeout": {
+ "name": "passiveToRunningTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from passive to running",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ }
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "typeIdentifier": {
+ "name": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
+ "version": "1.0.0"
+ },
+ "key": {
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "definedName": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "definedVersion": "1.2.3"
+ },
+ "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement": {
+ "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
+ "version": "1.2.3",
+ "derivedFrom": null,
+ "metadata": {},
+ "description": "Control loop for Performance Management Subscription Handling",
+ "type": "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement",
+ "typeVersion": "1.0.0",
+ "properties": {
+ "provider": {
+ "name": "provider",
+ "type": "string",
+ "typeVersion": "0.0.0",
+ "description": "Specifies the organization that provides the control loop element",
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "passiveToUninitializedTimeout": {
+ "name": "passiveToUninitializedTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "participant_id": {
+ "name": "participant_id",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "typeVersion": "0.0.0",
+ "description": null,
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "participantType": {
+ "name": "participantType",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "typeVersion": "0.0.0",
+ "description": "The identity of the participant type that hosts this type of Control Loop Element",
+ "defaultValue": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "uninitializedToPassiveTimeout": {
+ "name": "uninitializedToPassiveTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "startPhase": {
+ "name": "startPhase",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "runningToPassiveTimeout": {
+ "name": "runningToPassiveTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from running to passive",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "passiveToRunningTimeout": {
+ "name": "passiveToRunningTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from passive to running",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ }
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "typeIdentifier": {
+ "name": "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement",
+ "version": "1.0.0"
+ },
+ "key": {
+ "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "definedName": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
+ "definedVersion": "1.2.3"
+ },
+ "org.onap.domain.sample.GenericK8s_ControlLoopDefinition": {
+ "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
+ "version": "1.2.3",
+ "derivedFrom": null,
+ "metadata": {},
+ "description": "Control loop for Hello World",
+ "type": "org.onap.policy.clamp.controlloop.ControlLoop",
+ "typeVersion": "1.0.0",
+ "properties": {
+ "provider": {
+ "name": "provider",
+ "type": "string",
+ "typeVersion": "0.0.0",
+ "description": "Specifies the organization that provides the control loop element",
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "elements": {
+ "name": "elements",
+ "type": "list",
+ "typeVersion": "0.0.0",
+ "description": "Specifies a list of control loop element definitions that make up this control loop definition",
+ "defaultValue": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": {
+ "name": null,
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "typeVersion": "0.0.0",
+ "description": null,
+ "constraints": null
+ },
+ "metadata": {
+ "common": "true"
+ }
+ }
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
+ "version": "1.2.3"
+ },
+ "typeIdentifier": {
+ "name": "org.onap.policy.clamp.controlloop.ControlLoop",
+ "version": "1.0.0"
+ },
+ "key": {
+ "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
+ "version": "1.2.3"
+ },
+ "definedName": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
+ "definedVersion": "1.2.3"
+ },
+ "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement": {
+ "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
+ "version": "1.2.3",
+ "derivedFrom": null,
+ "metadata": {},
+ "description": "Control loop element for the K8S microservice for PMSH",
+ "type": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
+ "typeVersion": "1.0.0",
+ "properties": {
+ "provider": {
+ "name": "provider",
+ "type": "string",
+ "typeVersion": "0.0.0",
+ "description": "Specifies the organization that provides the control loop element",
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "passiveToUninitializedTimeout": {
+ "name": "passiveToUninitializedTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "participant_id": {
+ "name": "participant_id",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "typeVersion": "0.0.0",
+ "description": null,
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "participantType": {
+ "name": "participantType",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "typeVersion": "0.0.0",
+ "description": "The identity of the participant type that hosts this type of Control Loop Element",
+ "defaultValue": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "uninitializedToPassiveTimeout": {
+ "name": "uninitializedToPassiveTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "startPhase": {
+ "name": "startPhase",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "runningToPassiveTimeout": {
+ "name": "runningToPassiveTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from running to passive",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "passiveToRunningTimeout": {
+ "name": "passiveToRunningTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from passive to running",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ }
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
+ "version": "1.2.3"
+ },
+ "typeIdentifier": {
+ "name": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
+ "version": "1.0.0"
+ },
+ "key": {
+ "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
+ "version": "1.2.3"
+ },
+ "definedName": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
+ "definedVersion": "1.2.3"
+ },
+ "org.onap.domain.pmsh.DerivedPolicyControlLoopElement": {
+ "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
+ "version": "1.2.3",
+ "derivedFrom": null,
+ "metadata": {},
+ "description": "Control loop for Performance Management Subscription Handling",
+ "type": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
+ "typeVersion": "1.0.0",
+ "properties": {
+ "provider": {
+ "name": "provider",
+ "type": "string",
+ "typeVersion": "0.0.0",
+ "description": "Specifies the organization that provides the control loop element",
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "passiveToUninitializedTimeout": {
+ "name": "passiveToUninitializedTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "participant_id": {
+ "name": "participant_id",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "typeVersion": "0.0.0",
+ "description": null,
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "participantType": {
+ "name": "participantType",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "typeVersion": "0.0.0",
+ "description": "The identity of the participant type that hosts this type of Control Loop Element",
+ "defaultValue": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "uninitializedToPassiveTimeout": {
+ "name": "uninitializedToPassiveTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "startPhase": {
+ "name": "startPhase",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
+ "defaultValue": null,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "runningToPassiveTimeout": {
+ "name": "runningToPassiveTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from running to passive",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "passiveToRunningTimeout": {
+ "name": "passiveToRunningTimeout",
+ "type": "integer",
+ "typeVersion": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from passive to running",
+ "defaultValue": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "validValues": null,
+ "equal": null,
+ "greaterThan": null,
+ "greaterOrEqual": "0",
+ "lessThan": null,
+ "lessOrEqual": null,
+ "rangeValues": null
+ }
+ ],
+ "keySchema": null,
+ "entrySchema": null,
+ "metadata": {
+ "common": "true"
+ }
+ }
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "typeIdentifier": {
+ "name": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
+ "version": "1.0.0"
+ },
+ "key": {
+ "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "definedName": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
+ "definedVersion": "1.2.3"
+ }
+}
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/controlLoopList.json b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/controlLoopList.json
new file mode 100644
index 0000000..d549879
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/controlLoopList.json
@@ -0,0 +1,59 @@
+{
+ "controlLoopList": [
+ {
+ "name": "PMSHInstance0",
+ "version": "1.0.1",
+ "definition": {
+ "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "version": "1.2.3"
+ },
+ "state": "UNINITIALISED",
+ "orderedState": "UNINITIALISED",
+ "description": "PMSH control loop instance 0",
+ "elements": {
+ "709c62b3-8918-41b9-a747-d21eb79c6c20": {
+ "id": "709c62b3-8918-41b9-a747-d21eb79c6c20",
+ "definition": {
+ "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice",
+ "version": "1.2.3"
+ },
+ "participantType": {
+ "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
+ "version": "2.3.4"
+ },
+ "state": "UNINITIALISED",
+ "orderedState": "UNINITIALISED",
+ "description": "DCAE Control Loop Element for the PMSH instance 0 control loop"
+ },
+ "709c62b3-8918-41b9-a747-d21eb79c6c21": {
+ "id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
+ "definition": {
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "participantType": {
+ "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "version": "2.3.1"
+ },
+ "state": "UNINITIALISED",
+ "orderedState": "UNINITIALISED",
+ "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop"
+ },
+ "709c62b3-8918-41b9-a747-d21eb79c6c22": {
+ "id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
+ "definition": {
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "participantType": {
+ "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "version": "2.3.1"
+ },
+ "state": "UNINITIALISED",
+ "orderedState": "UNINITIALISED",
+ "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop"
+ }
+ }
+ }
+ ]
+}
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/fullTemplate.json b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/fullTemplate.json
new file mode 100644
index 0000000..8b77554
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/fullTemplate.json
@@ -0,0 +1,2194 @@
+{
+ "policy_types": {
+ "onap.policies.Monitoring": {
+ "name": "onap.policies.Monitoring",
+ "version": "1.0.0",
+ "derived_from": "tosca.policies.Root",
+ "metadata": {},
+ "description": "a base policy type for all policies that govern monitoring provisioning",
+ "properties": {},
+ "key": {
+ "name": "onap.policies.Monitoring",
+ "version": "1.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "onap.policies.Monitoring",
+ "defined_version": "1.0.0"
+ },
+ "onap.policies.Sirisha": {
+ "name": "onap.policies.Sirisha",
+ "version": "1.0.0",
+ "derived_from": "tosca.policies.Root",
+ "metadata": {},
+ "description": "a base policy type for all policies that govern monitoring provisioning",
+ "properties": {},
+ "key": {
+ "name": "onap.policies.Sirisha",
+ "version": "1.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "onap.policies.Sirisha",
+ "defined_version": "1.0.0"
+ },
+ "onap.policies.controlloop.operational.Common": {
+ "name": "onap.policies.controlloop.operational.Common",
+ "version": "1.0.0",
+ "derived_from": "tosca.policies.Root",
+ "metadata": {},
+ "description": "Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant\nPolicy Types. This does NOT support the legacy Policy YAML policy type.\n",
+ "properties": {
+ "abatement": {
+ "name": "abatement",
+ "type": "boolean",
+ "type_version": "0.0.0",
+ "description": "Whether an abatement event message will be expected for the control loop from DCAE.",
+ "default_value": false,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "operations": {
+ "name": "operations",
+ "type": "list",
+ "type_version": "0.0.0",
+ "description": "List of operations to be performed when Control Loop is triggered.",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": {
+ "name": null,
+ "type": "onap.datatype.controlloop.Operation",
+ "type_version": "0.0.0",
+ "description": null,
+ "constraints": null
+ },
+ "metadata": null
+ },
+ "trigger": {
+ "name": "trigger",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "Initial operation to execute upon receiving an Onset event message for the Control Loop.",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "timeout": {
+ "name": "timeout",
+ "type": "integer",
+ "type_version": "0.0.0",
+ "description": "Overall timeout for executing all the operations. This timeout should equal or exceed the total\ntimeout for each operation listed.\n",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "id": {
+ "name": "id",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "The unique control loop id.",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ }
+ },
+ "key": {
+ "name": "onap.policies.controlloop.operational.Common",
+ "version": "1.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "onap.policies.controlloop.operational.Common",
+ "defined_version": "1.0.0"
+ },
+ "onap.policies.controlloop.operational.common.Apex": {
+ "name": "onap.policies.controlloop.operational.common.Apex",
+ "version": "1.0.0",
+ "derived_from": "onap.policies.controlloop.operational.Common",
+ "metadata": {},
+ "description": "Operational policies for Apex PDP",
+ "properties": {
+ "engineServiceParameters": {
+ "name": "engineServiceParameters",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "The engine parameters like name, instanceCount, policy implementation, parameters etc.",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "eventOutputParameters": {
+ "name": "eventOutputParameters",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "The event output parameters.",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "javaProperties": {
+ "name": "javaProperties",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "Name/value pairs of properties to be set for APEX if needed.",
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "eventInputParameters": {
+ "name": "eventInputParameters",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "The event input parameters.",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ }
+ },
+ "key": {
+ "name": "onap.policies.controlloop.operational.common.Apex",
+ "version": "1.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "onap.policies.controlloop.operational.common.Apex",
+ "defined_version": "1.0.0"
+ },
+ "onap.policies.monitoring.dcae-pm-subscription-handler": {
+ "name": "onap.policies.monitoring.dcae-pm-subscription-handler",
+ "version": "1.0.0",
+ "derived_from": "onap.policies.Monitoring",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "pmsh_policy": {
+ "name": "pmsh_policy",
+ "type": "onap.datatypes.monitoring.subscription",
+ "type_version": "0.0.0",
+ "description": "PMSH Policy JSON",
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {}
+ }
+ },
+ "key": {
+ "name": "onap.policies.monitoring.dcae-pm-subscription-handler",
+ "version": "1.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "onap.policies.monitoring.dcae-pm-subscription-handler",
+ "defined_version": "1.0.0"
+ }
+ },
+ "node_types": {
+ "org.onap.policy.clamp.controlloop.CDSControlLoopElement": {
+ "name": "org.onap.policy.clamp.controlloop.CDSControlLoopElement",
+ "version": "1.0.1",
+ "derived_from": "org.onap.policy.clamp.controlloop.ControlLoopElement",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "cds_blueprint_id": {
+ "name": "cds_blueprint_id",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "type_version": "0.0.0",
+ "description": null,
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ }
+ },
+ "requirements": null,
+ "key": {
+ "name": "org.onap.policy.clamp.controlloop.CDSControlLoopElement",
+ "version": "1.0.1"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "org.onap.policy.clamp.controlloop.CDSControlLoopElement",
+ "defined_version": "1.0.1"
+ },
+ "org.onap.policy.clamp.controlloop.ControlLoop": {
+ "name": "org.onap.policy.clamp.controlloop.ControlLoop",
+ "version": "1.0.1",
+ "derived_from": "tosca.nodetypes.Root",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "elements": {
+ "name": "elements",
+ "type": "list",
+ "type_version": "0.0.0",
+ "description": "Specifies a list of control loop element definitions that make up this control loop definition",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": {
+ "name": null,
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "type_version": "0.0.0",
+ "description": null,
+ "constraints": null
+ },
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "provider": {
+ "name": "provider",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "Specifies the organization that provides the control loop element",
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {
+ "common": "true"
+ }
+ }
+ },
+ "requirements": null,
+ "key": {
+ "name": "org.onap.policy.clamp.controlloop.ControlLoop",
+ "version": "1.0.1"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "org.onap.policy.clamp.controlloop.ControlLoop",
+ "defined_version": "1.0.1"
+ },
+ "org.onap.policy.clamp.controlloop.ControlLoopElement": {
+ "name": "org.onap.policy.clamp.controlloop.ControlLoopElement",
+ "version": "1.0.1",
+ "derived_from": "tosca.nodetypes.Root",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "runningToPassiveTimeout": {
+ "name": "runningToPassiveTimeout",
+ "type": "integer",
+ "type_version": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from running to passive",
+ "default_value": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "valid_values": null,
+ "equal": null,
+ "greater_than": null,
+ "greater_or_equal": "0",
+ "less_than": null,
+ "less_or_equal": null,
+ "range_values": null
+ }
+ ],
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "participantType": {
+ "name": "participantType",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "type_version": "0.0.0",
+ "description": "The identity of the participant type that hosts this type of Control Loop Element",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "provider": {
+ "name": "provider",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "Specifies the organization that provides the control loop element",
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "startPhase": {
+ "name": "startPhase",
+ "type": "integer",
+ "type_version": "0.0.0",
+ "description": "A value indicating the start phase in which this control loop element will be started, the first start phase is zero. Control Loop Elements are started in their start_phase order and stopped in reverse start phase order. Control Loop Elements with the same start phase are started and stopped simultaneously",
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "valid_values": null,
+ "equal": null,
+ "greater_than": null,
+ "greater_or_equal": "0",
+ "less_than": null,
+ "less_or_equal": null,
+ "range_values": null
+ }
+ ],
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "passiveToUninitializedTimeout": {
+ "name": "passiveToUninitializedTimeout",
+ "type": "integer",
+ "type_version": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from passive to uninitialized",
+ "default_value": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "valid_values": null,
+ "equal": null,
+ "greater_than": null,
+ "greater_or_equal": "0",
+ "less_than": null,
+ "less_or_equal": null,
+ "range_values": null
+ }
+ ],
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "uninitializedToPassiveTimeout": {
+ "name": "uninitializedToPassiveTimeout",
+ "type": "integer",
+ "type_version": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from uninitialized to passive",
+ "default_value": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "valid_values": null,
+ "equal": null,
+ "greater_than": null,
+ "greater_or_equal": "0",
+ "less_than": null,
+ "less_or_equal": null,
+ "range_values": null
+ }
+ ],
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "participant_id": {
+ "name": "participant_id",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "type_version": "0.0.0",
+ "description": null,
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {
+ "common": "true"
+ }
+ },
+ "passiveToRunningTimeout": {
+ "name": "passiveToRunningTimeout",
+ "type": "integer",
+ "type_version": "0.0.0",
+ "description": "The maximum time in seconds to wait for a state chage from passive to running",
+ "default_value": 60.0,
+ "required": false,
+ "status": null,
+ "constraints": [
+ {
+ "valid_values": null,
+ "equal": null,
+ "greater_than": null,
+ "greater_or_equal": "0",
+ "less_than": null,
+ "less_or_equal": null,
+ "range_values": null
+ }
+ ],
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {
+ "common": "true"
+ }
+ }
+ },
+ "requirements": null,
+ "key": {
+ "name": "org.onap.policy.clamp.controlloop.ControlLoopElement",
+ "version": "1.0.1"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "org.onap.policy.clamp.controlloop.ControlLoopElement",
+ "defined_version": "1.0.1"
+ },
+ "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement": {
+ "name": "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement",
+ "version": "1.0.1",
+ "derived_from": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "policy_id": {
+ "name": "policy_id",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "type_version": "0.0.0",
+ "description": null,
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "policy_type_id": {
+ "name": "policy_type_id",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "type_version": "0.0.0",
+ "description": null,
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ }
+ },
+ "requirements": null,
+ "key": {
+ "name": "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement",
+ "version": "1.0.1"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement",
+ "defined_version": "1.0.1"
+ },
+ "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement": {
+ "name": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
+ "version": "1.0.1",
+ "derived_from": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "policy_id": {
+ "name": "policy_id",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "type_version": "0.0.0",
+ "description": null,
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "policy_type_id": {
+ "name": "policy_type_id",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "type_version": "0.0.0",
+ "description": null,
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ }
+ },
+ "requirements": null,
+ "key": {
+ "name": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
+ "version": "1.0.1"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
+ "defined_version": "1.0.1"
+ },
+ "org.onap.policy.clamp.controlloop.HttpControlLoopElement": {
+ "name": "org.onap.policy.clamp.controlloop.HttpControlLoopElement",
+ "version": "1.0.1",
+ "derived_from": "org.onap.policy.clamp.controlloop.ControlLoopElement",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "httpHeaders": {
+ "name": "httpHeaders",
+ "type": "map",
+ "type_version": "0.0.0",
+ "description": "HTTP headers to send on REST requests",
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": {
+ "name": null,
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": null,
+ "constraints": null
+ },
+ "metadata": null
+ },
+ "baseUrl": {
+ "name": "baseUrl",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "The base URL to be prepended to each path, identifies the host for the REST endpoints.",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "configurationEntities": {
+ "name": "configurationEntities",
+ "type": "map",
+ "type_version": "0.0.0",
+ "description": "The connfiguration entities the Control Loop Element is managing and their associated REST requests",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": {
+ "name": null,
+ "type": "org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.ConfigurationEntity",
+ "type_version": "0.0.0",
+ "description": null,
+ "constraints": null
+ },
+ "metadata": null
+ }
+ },
+ "requirements": null,
+ "key": {
+ "name": "org.onap.policy.clamp.controlloop.HttpControlLoopElement",
+ "version": "1.0.1"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "org.onap.policy.clamp.controlloop.HttpControlLoopElement",
+ "defined_version": "1.0.1"
+ },
+ "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement": {
+ "name": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
+ "version": "1.0.1",
+ "derived_from": "org.onap.policy.clamp.controlloop.ControlLoopElement",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "values": {
+ "name": "values",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": null,
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "templates": {
+ "name": "templates",
+ "type": "list",
+ "type_version": "0.0.0",
+ "description": null,
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "chart": {
+ "name": "chart",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": null,
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "requirements": {
+ "name": "requirements",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": null,
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "configs": {
+ "name": "configs",
+ "type": "list",
+ "type_version": "0.0.0",
+ "description": null,
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ }
+ },
+ "requirements": null,
+ "key": {
+ "name": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
+ "version": "1.0.1"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
+ "defined_version": "1.0.1"
+ },
+ "org.onap.policy.clamp.controlloop.Participant": {
+ "name": "org.onap.policy.clamp.controlloop.Participant",
+ "version": "1.0.1",
+ "derived_from": "tosca.nodetypes.Root",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "provider": {
+ "name": "provider",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": null,
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ }
+ },
+ "requirements": null,
+ "key": {
+ "name": "org.onap.policy.clamp.controlloop.Participant",
+ "version": "1.0.1"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "org.onap.policy.clamp.controlloop.Participant",
+ "defined_version": "1.0.1"
+ },
+ "org.onap.policy.clamp.controlloop.PolicyControlLoopElement": {
+ "name": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
+ "version": "1.0.1",
+ "derived_from": "org.onap.policy.clamp.controlloop.ControlLoopElement",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "policy_id": {
+ "name": "policy_id",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "type_version": "0.0.0",
+ "description": null,
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "policy_type_id": {
+ "name": "policy_type_id",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "type_version": "0.0.0",
+ "description": null,
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ }
+ },
+ "requirements": null,
+ "key": {
+ "name": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
+ "version": "1.0.1"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
+ "defined_version": "1.0.1"
+ }
+ },
+ "topology_template": {
+ "description": null,
+ "inputs": {
+ "pmsh_operational_policy": {
+ "name": "pmsh_operational_policy",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "type_version": "0.0.0",
+ "value": null
+ },
+ "pmsh_monitoring_policy": {
+ "name": "pmsh_monitoring_policy",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "type_version": "0.0.0",
+ "value": null
+ }
+ },
+ "node_templates": {
+ "org.onap.controlloop.HttpControlLoopParticipant": {
+ "name": "org.onap.controlloop.HttpControlLoopParticipant",
+ "version": "2.3.4",
+ "derived_from": null,
+ "metadata": {},
+ "description": "Participant for Http requests",
+ "type": "org.onap.policy.clamp.controlloop.Participant",
+ "type_version": "1.0.1",
+ "properties": {
+ "provider": "ONAP"
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.controlloop.HttpControlLoopParticipant",
+ "version": "2.3.4"
+ },
+ "type_identifier": {
+ "name": "org.onap.policy.clamp.controlloop.Participant",
+ "version": "1.0.1"
+ },
+ "key": {
+ "name": "org.onap.controlloop.HttpControlLoopParticipant",
+ "version": "2.3.4"
+ },
+ "defined_name": "org.onap.controlloop.HttpControlLoopParticipant",
+ "defined_version": "2.3.4"
+ },
+ "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement": {
+ "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
+ "version": "1.2.3",
+ "derived_from": null,
+ "metadata": {},
+ "description": "Control loop element for the http requests of PMSH microservice",
+ "type": "org.onap.policy.clamp.controlloop.HttpControlLoopElement",
+ "type_version": "1.0.1",
+ "properties": {
+ "participantType": {
+ "name": "org.onap.k8s.controlloop.HttpControlLoopParticipant",
+ "version": "2.3.4"
+ },
+ "configurationEntities": [
+ {
+ "configurationEntityId": {
+ "name": "entity1",
+ "version": "1.0.1"
+ },
+ "restSequence": [
+ {
+ "restRequestId": {
+ "name": "request1",
+ "version": "1.0.1"
+ },
+ "httpMethod": "PUT",
+ "path": "v1/kv/dcae-pmsh2",
+ "body": "{ \"control_loop_name\":\"pmsh-control-loop\", \"operational_policy_name\":\"pmsh-operational-policy\", \"aaf_password\":\"demo123456!\", \"aaf_identity\":\"dcae@dcae.onap.org\", \"cert_path\":\"/opt/app/pmsh/etc/certs/cert.pem\", \"key_path\":\"/opt/app/pmsh/etc/certs/key.pem\", \"ca_cert_path\":\"/opt/app/pmsh/etc/certs/cacert.pem\", \"enable_tls\":\"true\", \"pmsh_policy\":{ \"subscription\":{ \"subscriptionName\":\"ExtraPM-All-gNB-R2B\", \"administrativeState\":\"UNLOCKED\", \"fileBasedGP\":15, \"fileLocation\":\"\/pm\/pm.xml\", \"nfFilter\":{ \"nfNames\":[ \"^pnf.*\", \"^vnf.*\" ], \"modelInvariantIDs\":[ ], \"modelVersionIDs\":[ ], \"modelNames\":[ ] }, \"measurementGroups\":[ { \"measurementGroup\":{ \"measurementTypes\":[ { \"measurementType\":\"countera\" }, { \"measurementType\":\"counterb\" } ], \"managedObjectDNsBasic\":[ { \"DN\":\"dna\" }, { \"DN\":\"dnb\" } ] } }, { \"measurementGroup\":{ \"measurementTypes\":[ { \"measurementType\":\"counterc\" }, { \"measurementType\":\"counterd\" } ], \"managedObjectDNsBasic\":[ { \"DN\":\"dnc\" }, { \"DN\":\"dnd\" } ] } } ] } }, \"streams_subscribes\":{ \"aai_subscriber\":{ \"type\":\"message_router\", \"dmaap_info\":{ \"topic_url\":\"https://10.152.183.151:3905/events/AAI_EVENT\", \"client_role\":\"org.onap.dcae.aaiSub\", \"location\":\"san-francisco\", \"client_id\":\"1575976809466\" } }, \"policy_pm_subscriber\":{ \"type\":\"message_router\", \"dmaap_info\":{ \"topic_url\":\"https://10.152.183.151:3905/events/org.onap.dmaap.mr.PM_SUBSCRIPTIONS\", \"client_role\":\"org.onap.dcae.pmSubscriber\", \"location\":\"san-francisco\", \"client_id\":\"1575876809456\" } } }, \"streams_publishes\":{ \"policy_pm_publisher\":{ \"type\":\"message_router\", \"dmaap_info\":{ \"topic_url\":\"https://10.152.183.151:3905/events/org.onap.dmaap.mr.PM_SUBSCRIPTIONS\", \"client_role\":\"org.onap.dcae.pmPublisher\", \"location\":\"san-francisco\", \"client_id\":\"1475976809466\" } }, \"other_publisher\":{ \"type\":\"message_router\", \"dmaap_info\":{ \"topic_url\":\"https://10.152.183.151:3905/events/org.onap.dmaap.mr.SOME_OTHER_TOPIC\", \"client_role\":\"org.onap.dcae.pmControlPub\", \"location\":\"san-francisco\", \"client_id\":\"1875976809466\" } } } }",
+ "expectedResponse": 200
+ }
+ ]
+ }
+ ],
+ "provider": "ONAP",
+ "startPhase": 1,
+ "uninitializedToPassiveTimeout": 180,
+ "httpHeaders": {
+ "Content-Type": "application/json"
+ },
+ "participant_id": {
+ "name": "HttpParticipant0",
+ "version": "1.0.0"
+ },
+ "baseUrl": "http://10.152.183.51:8500"
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
+ "version": "1.2.3"
+ },
+ "type_identifier": {
+ "name": "org.onap.policy.clamp.controlloop.HttpControlLoopElement",
+ "version": "1.0.1"
+ },
+ "key": {
+ "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
+ "version": "1.2.3"
+ },
+ "defined_name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
+ "defined_version": "1.2.3"
+ },
+ "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement": {
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "version": "1.2.3",
+ "derived_from": null,
+ "metadata": {},
+ "description": "Control loop element for the operational policy for Performance Management Subscription Handling",
+ "type": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
+ "type_version": "1.0.0",
+ "properties": {
+ "participant_id": {
+ "name": "org.onap.PM_Policy",
+ "version": "1.0.0"
+ },
+ "policy_type_id": {
+ "name": "onap.policies.operational.pm-subscription-handler",
+ "version": "1.0.0"
+ },
+ "participantType": {
+ "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "version": "2.3.1"
+ },
+ "provider": "Ericsson",
+ "policy_id": {
+ "get_input": "pmsh_operational_policy"
+ }
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "type_identifier": {
+ "name": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
+ "version": "1.0.0"
+ },
+ "key": {
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "defined_name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "defined_version": "1.2.3"
+ },
+ "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement": {
+ "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
+ "version": "1.2.3",
+ "derived_from": null,
+ "metadata": {},
+ "description": "Control loop element for the K8S microservice for local chart",
+ "type": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
+ "type_version": "1.0.0",
+ "properties": {
+ "participant_id": {
+ "name": "K8sParticipant0",
+ "version": "1.0.0"
+ },
+ "provider": "ONAP",
+ "chart": {
+ "chartId": {
+ "name": "nginx-ingress",
+ "version": "0.9.1"
+ },
+ "releaseName": "nginxms",
+ "namespace": "test"
+ },
+ "participantType": {
+ "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
+ "version": "2.3.4"
+ }
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
+ "version": "1.2.3"
+ },
+ "type_identifier": {
+ "name": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
+ "version": "1.0.0"
+ },
+ "key": {
+ "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
+ "version": "1.2.3"
+ },
+ "defined_name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
+ "defined_version": "1.2.3"
+ },
+ "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement": {
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "version": "1.2.3",
+ "derived_from": null,
+ "metadata": {},
+ "description": "Control loop element for the monitoring policy for Performance Management Subscription Handling",
+ "type": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
+ "type_version": "1.0.0",
+ "properties": {
+ "participant_id": {
+ "name": "org.onap.PM_Policy",
+ "version": "1.0.0"
+ },
+ "policy_type_id": {
+ "name": "onap.policies.monitoring.pm-subscription-handler",
+ "version": "1.0.0"
+ },
+ "participantType": {
+ "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "version": "2.3.1"
+ },
+ "provider": "Ericsson",
+ "policy_id": {
+ "get_input": "pmsh_monitoring_policy"
+ }
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "type_identifier": {
+ "name": "org.onap.policy.clamp.controlloop.PolicyControlLoopElement",
+ "version": "1.0.0"
+ },
+ "key": {
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "defined_name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "defined_version": "1.2.3"
+ },
+ "org.onap.k8s.controlloop.K8SControlLoopParticipant": {
+ "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
+ "version": "2.3.4",
+ "derived_from": null,
+ "metadata": {},
+ "description": "Participant for K8S",
+ "type": "org.onap.policy.clamp.controlloop.Participant",
+ "type_version": "1.0.1",
+ "properties": {
+ "provider": "ONAP"
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
+ "version": "2.3.4"
+ },
+ "type_identifier": {
+ "name": "org.onap.policy.clamp.controlloop.Participant",
+ "version": "1.0.1"
+ },
+ "key": {
+ "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
+ "version": "2.3.4"
+ },
+ "defined_name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
+ "defined_version": "2.3.4"
+ },
+ "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement": {
+ "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
+ "version": "1.2.3",
+ "derived_from": null,
+ "metadata": {},
+ "description": "Control loop for Performance Management Subscription Handling",
+ "type": "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement",
+ "type_version": "1.0.0",
+ "properties": {
+ "participant_id": {
+ "name": "org.onap.PM_Policy",
+ "version": "1.0.0"
+ },
+ "provider": "Ericsson",
+ "participantType": {
+ "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "version": "2.3.1"
+ }
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "type_identifier": {
+ "name": "org.onap.policy.clamp.controlloop.DerivedDerivedPolicyControlLoopElement",
+ "version": "1.0.0"
+ },
+ "key": {
+ "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "defined_name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
+ "defined_version": "1.2.3"
+ },
+ "org.onap.domain.sample.GenericK8s_ControlLoopDefinition": {
+ "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
+ "version": "1.2.3",
+ "derived_from": null,
+ "metadata": {},
+ "description": "Control loop for Hello World",
+ "type": "org.onap.policy.clamp.controlloop.ControlLoop",
+ "type_version": "1.0.0",
+ "properties": {
+ "elements": [
+ {
+ "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
+ "version": "1.2.3"
+ },
+ {
+ "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
+ "version": "1.2.3"
+ },
+ {
+ "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
+ "version": "1.2.3"
+ },
+ {
+ "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ {
+ "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ {
+ "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ {
+ "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
+ "version": "1.2.3"
+ }
+ ],
+ "provider": "ONAP"
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
+ "version": "1.2.3"
+ },
+ "type_identifier": {
+ "name": "org.onap.policy.clamp.controlloop.ControlLoop",
+ "version": "1.0.0"
+ },
+ "key": {
+ "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
+ "version": "1.2.3"
+ },
+ "defined_name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
+ "defined_version": "1.2.3"
+ },
+ "org.onap.policy.controlloop.PolicyControlLoopParticipant": {
+ "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "version": "2.3.1",
+ "derived_from": null,
+ "metadata": {},
+ "description": "Participant for DCAE microservices",
+ "type": "org.onap.policy.clamp.controlloop.Participant",
+ "type_version": "1.0.1",
+ "properties": {
+ "provider": "ONAP"
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "version": "2.3.1"
+ },
+ "type_identifier": {
+ "name": "org.onap.policy.clamp.controlloop.Participant",
+ "version": "1.0.1"
+ },
+ "key": {
+ "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "version": "2.3.1"
+ },
+ "defined_name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "defined_version": "2.3.1"
+ },
+ "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement": {
+ "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
+ "version": "1.2.3",
+ "derived_from": null,
+ "metadata": {},
+ "description": "Control loop element for the K8S microservice for PMSH",
+ "type": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
+ "type_version": "1.0.0",
+ "properties": {
+ "participant_id": {
+ "name": "K8sParticipant0",
+ "version": "1.0.0"
+ },
+ "provider": "ONAP",
+ "chart": {
+ "chartId": {
+ "name": "dcae-pmsh",
+ "version": "8.0.0"
+ },
+ "namespace": "onap",
+ "releaseName": "pmshms",
+ "repository": {
+ "repoName": "chartmuseum",
+ "protocol": "http",
+ "address": "10.152.183.120",
+ "port": 80,
+ "userName": "onapinitializer",
+ "password": "demo123456!"
+ },
+ "overrideParams": {
+ "global.masterPassword": "test"
+ }
+ },
+ "participantType": {
+ "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
+ "version": "2.3.4"
+ }
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
+ "version": "1.2.3"
+ },
+ "type_identifier": {
+ "name": "org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement",
+ "version": "1.0.0"
+ },
+ "key": {
+ "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
+ "version": "1.2.3"
+ },
+ "defined_name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
+ "defined_version": "1.2.3"
+ },
+ "org.onap.domain.pmsh.DerivedPolicyControlLoopElement": {
+ "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
+ "version": "1.2.3",
+ "derived_from": null,
+ "metadata": {},
+ "description": "Control loop for Performance Management Subscription Handling",
+ "type": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
+ "type_version": "1.0.0",
+ "properties": {
+ "participant_id": {
+ "name": "org.onap.PM_Policy",
+ "version": "1.0.0"
+ },
+ "provider": "Ericsson",
+ "participantType": {
+ "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+ "version": "2.3.1"
+ }
+ },
+ "requirements": null,
+ "capabilities": null,
+ "identifier": {
+ "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "type_identifier": {
+ "name": "org.onap.policy.clamp.controlloop.DerivedPolicyControlLoopElement",
+ "version": "1.0.0"
+ },
+ "key": {
+ "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
+ "version": "1.2.3"
+ },
+ "defined_name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
+ "defined_version": "1.2.3"
+ }
+ },
+ "policies": null,
+ "policies_as_map": {}
+ },
+ "tosca_definitions_version": "tosca_simple_yaml_1_3",
+ "data_types": {
+ "onap.datatype.controlloop.Actor": {
+ "name": "onap.datatype.controlloop.Actor",
+ "version": "0.0.0",
+ "derived_from": "tosca.datatypes.Root",
+ "metadata": {},
+ "description": "An actor/operation/target definition",
+ "properties": {
+ "payload": {
+ "name": "payload",
+ "type": "map",
+ "type_version": "0.0.0",
+ "description": "Name/value pairs of payload information passed by Policy to the actor",
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": {
+ "name": null,
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": null,
+ "constraints": null
+ },
+ "metadata": {
+ "clamp_possible_values": "ClampExecution:CDS/payload"
+ }
+ },
+ "target": {
+ "name": "target",
+ "type": "onap.datatype.controlloop.Target",
+ "type_version": "0.0.0",
+ "description": "The resource the operation should be performed on.",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "actor": {
+ "name": "actor",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "The actor performing the operation.",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {
+ "clamp_possible_values": "Dictionary:DefaultActors,ClampExecution:CDS/actor"
+ }
+ },
+ "operation": {
+ "name": "operation",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "The operation the actor is performing.",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {
+ "clamp_possible_values": "Dictionary:DefaultOperations,ClampExecution:CDS/operation"
+ }
+ }
+ },
+ "constraints": [],
+ "key": {
+ "name": "onap.datatype.controlloop.Actor",
+ "version": "0.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "onap.datatype.controlloop.Actor",
+ "defined_version": null
+ },
+ "onap.datatype.controlloop.Operation": {
+ "name": "onap.datatype.controlloop.Operation",
+ "version": "0.0.0",
+ "derived_from": "tosca.datatypes.Root",
+ "metadata": {},
+ "description": "An operation supported by an actor",
+ "properties": {
+ "failure_retries": {
+ "name": "failure_retries",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "Points to the operation to invoke when the current operation has exceeded its max retries.",
+ "default_value": "final_failure_retries",
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "id": {
+ "name": "id",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "Unique identifier for the operation",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "failure_timeout": {
+ "name": "failure_timeout",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "Points to the operation to invoke when the time out for the operation occurs.",
+ "default_value": "final_failure_timeout",
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "failure": {
+ "name": "failure",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "Points to the operation to invoke on Actor operation failure.",
+ "default_value": "final_failure",
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "operation": {
+ "name": "operation",
+ "type": "onap.datatype.controlloop.Actor",
+ "type_version": "0.0.0",
+ "description": "The definition of the operation to be performed.",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "failure_guard": {
+ "name": "failure_guard",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "Points to the operation to invoke when the current operation is blocked due to guard policy enforcement.",
+ "default_value": "final_failure_guard",
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "retries": {
+ "name": "retries",
+ "type": "integer",
+ "type_version": "0.0.0",
+ "description": "The number of retries the actor should attempt to perform the operation.",
+ "default_value": 0.0,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "timeout": {
+ "name": "timeout",
+ "type": "integer",
+ "type_version": "0.0.0",
+ "description": "The amount of time for the actor to perform the operation.",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "failure_exception": {
+ "name": "failure_exception",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "Points to the operation to invoke when the current operation causes an exception.",
+ "default_value": "final_failure_exception",
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "description": {
+ "name": "description",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "A user-friendly description of the intent for the operation",
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "success": {
+ "name": "success",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "Points to the operation to invoke on success. A value of \"final_success\" indicates and end to the operation.",
+ "default_value": "final_success",
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ }
+ },
+ "constraints": [],
+ "key": {
+ "name": "onap.datatype.controlloop.Operation",
+ "version": "0.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "onap.datatype.controlloop.Operation",
+ "defined_version": null
+ },
+ "onap.datatype.controlloop.Target": {
+ "name": "onap.datatype.controlloop.Target",
+ "version": "0.0.0",
+ "derived_from": "tosca.datatypes.Root",
+ "metadata": {},
+ "description": "Definition for a entity in A&AI to perform a control loop operation on",
+ "properties": {
+ "entityIds": {
+ "name": "entityIds",
+ "type": "map",
+ "type_version": "0.0.0",
+ "description": "Map of values that identify the resource. If none are provided, it is assumed that the\nentity that generated the ONSET event will be the target.\n",
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": {
+ "name": null,
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": null,
+ "constraints": null
+ },
+ "metadata": {
+ "clamp_possible_values": "ClampExecution:CSAR_RESOURCES"
+ }
+ },
+ "targetType": {
+ "name": "targetType",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "Category for the target type",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [
+ {
+ "valid_values": [
+ "VNF",
+ "VM",
+ "VFMODULE",
+ "PNF"
+ ],
+ "equal": null,
+ "greater_than": null,
+ "greater_or_equal": null,
+ "less_than": null,
+ "less_or_equal": null,
+ "range_values": null
+ }
+ ],
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ }
+ },
+ "constraints": [],
+ "key": {
+ "name": "onap.datatype.controlloop.Target",
+ "version": "0.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "onap.datatype.controlloop.Target",
+ "defined_version": null
+ },
+ "onap.datatypes.ToscaConceptIdentifier": {
+ "name": "onap.datatypes.ToscaConceptIdentifier",
+ "version": "0.0.0",
+ "derived_from": "tosca.datatypes.Root",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "version": {
+ "name": "version",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": null,
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "name": {
+ "name": "name",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": null,
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ }
+ },
+ "constraints": [],
+ "key": {
+ "name": "onap.datatypes.ToscaConceptIdentifier",
+ "version": "0.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "onap.datatypes.ToscaConceptIdentifier",
+ "defined_version": null
+ },
+ "onap.datatypes.monitoring.managedObjectDNsBasic": {
+ "name": "onap.datatypes.monitoring.managedObjectDNsBasic",
+ "version": "0.0.0",
+ "derived_from": "tosca.datatypes.Root",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "DN": {
+ "name": "DN",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "Managed object distinguished name",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {}
+ }
+ },
+ "constraints": [],
+ "key": {
+ "name": "onap.datatypes.monitoring.managedObjectDNsBasic",
+ "version": "0.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "onap.datatypes.monitoring.managedObjectDNsBasic",
+ "defined_version": null
+ },
+ "onap.datatypes.monitoring.managedObjectDNsBasics": {
+ "name": "onap.datatypes.monitoring.managedObjectDNsBasics",
+ "version": "0.0.0",
+ "derived_from": "tosca.datatypes.Root",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "managedObjectDNsBasic": {
+ "name": "managedObjectDNsBasic",
+ "type": "map",
+ "type_version": "0.0.0",
+ "description": "Managed object distinguished name object",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": {
+ "name": null,
+ "type": "onap.datatypes.monitoring.managedObjectDNsBasic",
+ "type_version": "0.0.0",
+ "description": null,
+ "constraints": []
+ },
+ "metadata": {}
+ }
+ },
+ "constraints": [],
+ "key": {
+ "name": "onap.datatypes.monitoring.managedObjectDNsBasics",
+ "version": "0.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "onap.datatypes.monitoring.managedObjectDNsBasics",
+ "defined_version": null
+ },
+ "onap.datatypes.monitoring.measurementGroup": {
+ "name": "onap.datatypes.monitoring.measurementGroup",
+ "version": "0.0.0",
+ "derived_from": "tosca.datatypes.Root",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "measurementTypes": {
+ "name": "measurementTypes",
+ "type": "list",
+ "type_version": "0.0.0",
+ "description": "List of measurement types",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": {
+ "name": null,
+ "type": "onap.datatypes.monitoring.measurementTypes",
+ "type_version": "0.0.0",
+ "description": null,
+ "constraints": []
+ },
+ "metadata": {}
+ },
+ "managedObjectDNsBasic": {
+ "name": "managedObjectDNsBasic",
+ "type": "list",
+ "type_version": "0.0.0",
+ "description": "List of managed object distinguished names",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": {
+ "name": null,
+ "type": "onap.datatypes.monitoring.managedObjectDNsBasics",
+ "type_version": "0.0.0",
+ "description": null,
+ "constraints": []
+ },
+ "metadata": {}
+ }
+ },
+ "constraints": [],
+ "key": {
+ "name": "onap.datatypes.monitoring.measurementGroup",
+ "version": "0.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "onap.datatypes.monitoring.measurementGroup",
+ "defined_version": null
+ },
+ "onap.datatypes.monitoring.measurementGroups": {
+ "name": "onap.datatypes.monitoring.measurementGroups",
+ "version": "0.0.0",
+ "derived_from": "tosca.datatypes.Root",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "measurementGroup": {
+ "name": "measurementGroup",
+ "type": "map",
+ "type_version": "0.0.0",
+ "description": "Measurement Group",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": {
+ "name": null,
+ "type": "onap.datatypes.monitoring.measurementGroup",
+ "type_version": "0.0.0",
+ "description": null,
+ "constraints": []
+ },
+ "metadata": {}
+ }
+ },
+ "constraints": [],
+ "key": {
+ "name": "onap.datatypes.monitoring.measurementGroups",
+ "version": "0.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "onap.datatypes.monitoring.measurementGroups",
+ "defined_version": null
+ },
+ "onap.datatypes.monitoring.measurementType": {
+ "name": "onap.datatypes.monitoring.measurementType",
+ "version": "0.0.0",
+ "derived_from": "tosca.datatypes.Root",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "measurementType": {
+ "name": "measurementType",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "Measurement type",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {}
+ }
+ },
+ "constraints": [],
+ "key": {
+ "name": "onap.datatypes.monitoring.measurementType",
+ "version": "0.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "onap.datatypes.monitoring.measurementType",
+ "defined_version": null
+ },
+ "onap.datatypes.monitoring.measurementTypes": {
+ "name": "onap.datatypes.monitoring.measurementTypes",
+ "version": "0.0.0",
+ "derived_from": "tosca.datatypes.Root",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "measurementType": {
+ "name": "measurementType",
+ "type": "map",
+ "type_version": "0.0.0",
+ "description": "Measurement type object",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": {
+ "name": null,
+ "type": "onap.datatypes.monitoring.measurementType",
+ "type_version": "0.0.0",
+ "description": null,
+ "constraints": []
+ },
+ "metadata": {}
+ }
+ },
+ "constraints": [],
+ "key": {
+ "name": "onap.datatypes.monitoring.measurementTypes",
+ "version": "0.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "onap.datatypes.monitoring.measurementTypes",
+ "defined_version": null
+ },
+ "onap.datatypes.monitoring.nfFilter": {
+ "name": "onap.datatypes.monitoring.nfFilter",
+ "version": "0.0.0",
+ "derived_from": "tosca.datatypes.Root",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "modelVersionIDs": {
+ "name": "modelVersionIDs",
+ "type": "list",
+ "type_version": "0.0.0",
+ "description": "List of model version IDs",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": {
+ "name": null,
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": null,
+ "constraints": []
+ },
+ "metadata": {}
+ },
+ "modelInvariantIDs": {
+ "name": "modelInvariantIDs",
+ "type": "list",
+ "type_version": "0.0.0",
+ "description": "List of model invariant IDs",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": {
+ "name": null,
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": null,
+ "constraints": []
+ },
+ "metadata": {}
+ },
+ "modelNames": {
+ "name": "modelNames",
+ "type": "list",
+ "type_version": "0.0.0",
+ "description": "List of model names",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": {
+ "name": null,
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": null,
+ "constraints": []
+ },
+ "metadata": {}
+ },
+ "nfNames": {
+ "name": "nfNames",
+ "type": "list",
+ "type_version": "0.0.0",
+ "description": "List of network functions",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": {
+ "name": null,
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": null,
+ "constraints": []
+ },
+ "metadata": {}
+ }
+ },
+ "constraints": [],
+ "key": {
+ "name": "onap.datatypes.monitoring.nfFilter",
+ "version": "0.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "onap.datatypes.monitoring.nfFilter",
+ "defined_version": null
+ },
+ "onap.datatypes.monitoring.subscription": {
+ "name": "onap.datatypes.monitoring.subscription",
+ "version": "0.0.0",
+ "derived_from": "tosca.datatypes.Root",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "measurementGroups": {
+ "name": "measurementGroups",
+ "type": "list",
+ "type_version": "0.0.0",
+ "description": "Measurement Groups",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": {
+ "name": null,
+ "type": "onap.datatypes.monitoring.measurementGroups",
+ "type_version": "0.0.0",
+ "description": null,
+ "constraints": []
+ },
+ "metadata": {}
+ },
+ "fileBasedGP": {
+ "name": "fileBasedGP",
+ "type": "integer",
+ "type_version": "0.0.0",
+ "description": "File based granularity period",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {}
+ },
+ "fileLocation": {
+ "name": "fileLocation",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "ROP file location",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {}
+ },
+ "subscriptionName": {
+ "name": "subscriptionName",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "Name of the subscription",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {}
+ },
+ "administrativeState": {
+ "name": "administrativeState",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "State of the subscription",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [
+ {
+ "valid_values": [
+ "LOCKED",
+ "UNLOCKED"
+ ],
+ "equal": null,
+ "greater_than": null,
+ "greater_or_equal": null,
+ "less_than": null,
+ "less_or_equal": null,
+ "range_values": null
+ }
+ ],
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": {}
+ },
+ "nfFilter": {
+ "name": "nfFilter",
+ "type": "map",
+ "type_version": "0.0.0",
+ "description": "Network function filter",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": {
+ "name": null,
+ "type": "onap.datatypes.monitoring.nfFilter",
+ "type_version": "0.0.0",
+ "description": null,
+ "constraints": []
+ },
+ "metadata": {}
+ }
+ },
+ "constraints": [],
+ "key": {
+ "name": "onap.datatypes.monitoring.subscription",
+ "version": "0.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "onap.datatypes.monitoring.subscription",
+ "defined_version": null
+ },
+ "org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.RestRequest": {
+ "name": "org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.RestRequest",
+ "version": "1.0.0",
+ "derived_from": "tosca.datatypes.Root",
+ "metadata": {},
+ "description": null,
+ "properties": {
+ "body": {
+ "name": "body",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "The body of the REST request for PUT and POST requests",
+ "default_value": null,
+ "required": false,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "expectedResponse": {
+ "name": "expectedResponse",
+ "type": "integer",
+ "type_version": "0.0.0",
+ "description": "THe expected HTTP status code for the REST request",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [],
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "httpMethod": {
+ "name": "httpMethod",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "The REST method to use",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": [
+ {
+ "valid_values": [
+ "POST",
+ "PUT",
+ "GET",
+ "DELETE"
+ ],
+ "equal": null,
+ "greater_than": null,
+ "greater_or_equal": null,
+ "less_than": null,
+ "less_or_equal": null,
+ "range_values": null
+ }
+ ],
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "restRequestId": {
+ "name": "restRequestId",
+ "type": "onap.datatypes.ToscaConceptIdentifier",
+ "type_version": "0.0.0",
+ "description": "The name and version of a REST request to be sent to a REST endpoint",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ },
+ "path": {
+ "name": "path",
+ "type": "string",
+ "type_version": "0.0.0",
+ "description": "The path of the REST request relative to the base URL",
+ "default_value": null,
+ "required": true,
+ "status": null,
+ "constraints": null,
+ "key_schema": null,
+ "entry_schema": null,
+ "metadata": null
+ }
+ },
+ "constraints": [],
+ "key": {
+ "name": "org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.RestRequest",
+ "version": "1.0.0"
+ },
+ "type": null,
+ "type_version": null,
+ "defined_name": "org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.RestRequest",
+ "defined_version": "1.0.0"
+ }
+ }
+}
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/jsonEditorData.json b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/jsonEditorData.json
new file mode 100644
index 0000000..c09424f
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/jsonEditorData.json
@@ -0,0 +1,50 @@
+{
+ "__data": [
+ "Object"
+ ],
+ "copyClipboard": null,
+ "editors": [
+ "Object"
+ ],
+ "element": "<div … />",
+ "expandRefs": [
+ "Function anonymous"
+ ],
+ "expandSchema": [
+ "Function anonymous"
+ ],
+ "iconlib": [
+ "n"
+ ],
+ "options": [
+ "Object"
+ ],
+ "ready": true,
+ "refs": [
+ "Object"
+ ],
+ "root": [
+ "o"
+ ],
+ "root_container": "<div … />",
+ "schema": [
+ "Object"
+ ],
+ "template": "undefined",
+ "theme": [
+ "o"
+ ],
+ "translate": [
+ "Function translate"
+ ],
+ "translateProperty": [
+ "Function translateProperty"
+ ],
+ "uuid": 0,
+ "validation_results": [
+ "Array"
+ ],
+ "validator": [
+ "t"
+ ]
+}
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/orderedStateJson.json b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/orderedStateJson.json
new file mode 100644
index 0000000..91c892d
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/orderedStateJson.json
@@ -0,0 +1,9 @@
+{
+ "orderedState": "PASSIVE",
+ "controlLoopIdentifierList": [
+ {
+ "name": "PMSH_Instance1",
+ "version": "2.3.1"
+ }
+ ]
+}
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/utils/CommissioningUtils.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/utils/CommissioningUtils.js
new file mode 100644
index 0000000..2d98598
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/utils/CommissioningUtils.js
@@ -0,0 +1,178 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+import { JSONEditor } from "@json-editor/json-editor";
+import { Alert } from "react-bootstrap";
+import React from "react";
+
+const CommissioningUtils = {
+ makeSchemaForCommonProperties: (commonProps) => {
+ const commonPropsArr = Object.entries(commonProps)
+
+ const newSchemaObject = {}
+
+ newSchemaObject.title = "CommonProperties"
+ newSchemaObject.type = "object"
+ newSchemaObject.properties = {}
+
+ commonPropsArr.forEach(([templateKey, template]) => {
+
+ const propertiesObject = {}
+ Object.entries(template.properties).forEach(([propKey, prop]) => {
+
+ propertiesObject[propKey] = {
+ type: CommissioningUtils.getType(prop.type)
+ }
+
+ })
+ newSchemaObject.properties[templateKey] = {
+ options: {
+ "collapsed": true
+ },
+ properties: propertiesObject
+ }
+ })
+
+ return newSchemaObject
+ },
+ getType: (propertyType) => {
+ switch (propertyType)
+ {
+ case "string":
+ return "string"
+ case "integer":
+ return "integer"
+ case "list":
+ return "array"
+ case "object":
+ return "object"
+ default:
+ return "object"
+ }
+ },
+ createJsonEditor: (toscaModel, editorData) => {
+ JSONEditor.defaults.options.collapse = false;
+
+ return new JSONEditor(document.getElementById("editor"),
+ {
+ schema: toscaModel,
+ startval: editorData,
+ theme: 'bootstrap4',
+ iconlib: 'fontawesome5',
+ object_layout: 'normal',
+ disable_properties: false,
+ disable_edit_json: true,
+ disable_array_reorder: true,
+ disable_array_delete_last_row: true,
+ disable_array_delete_all_rows: false,
+ array_controls_top: true,
+ keep_oneof_values: false,
+ collapsed: false,
+ show_errors: 'always',
+ display_required_only: false,
+ show_opt_in: false,
+ prompt_before_delete: true,
+ required_by_default: false,
+ })
+ },
+ renderJsonEditor: async (template, commonProps) => {
+
+ const fullTemplate = await template.json()
+
+ let toscaInitialValues
+ const allNodeTemplates = fullTemplate.topology_template.node_templates
+ const shortenedNodeTemplatesObjectStartValues = {}
+ // Get the common properties to construct a schema
+ // Get valid start values at the same time
+ const commonNodeTemplatesJson = await commonProps.json().then(data => {
+ const nodeTemplatesArray = Object.entries(data)
+ const shortenedNodeTemplatesObject = {}
+ nodeTemplatesArray.forEach(([key, temp]) => {
+ const currentNodeTemplate = allNodeTemplates[key]
+ const propertiesObject = {
+ properties: temp.properties
+ }
+
+ shortenedNodeTemplatesObject[key] = propertiesObject
+
+ const propertiesStartValues = {}
+
+ // Get all the existing start values to populate the properties in the schema
+ Object.entries(propertiesObject.properties).forEach(([propKey, prop]) => {
+ propertiesStartValues[propKey] = currentNodeTemplate.properties[propKey]
+ })
+
+ shortenedNodeTemplatesObjectStartValues[key] = propertiesStartValues
+
+ })
+
+ toscaInitialValues = shortenedNodeTemplatesObjectStartValues;
+ return shortenedNodeTemplatesObject;
+ })
+
+ const propertySchema = CommissioningUtils.makeSchemaForCommonProperties(commonNodeTemplatesJson);
+
+ const editorTemp = CommissioningUtils.createJsonEditor(propertySchema, shortenedNodeTemplatesObjectStartValues);
+
+ return {
+ fullTemplate: fullTemplate,
+ propertySchema: propertySchema,
+ editorTemp: editorTemp,
+ toscaInitialValues: toscaInitialValues
+ }
+ },
+ getAlertMessages: async (response) => {
+ if (response.ok) {
+ return(<Alert variant="success">
+ <Alert.Heading>Commissioning Success</Alert.Heading>
+ <p>Altered Template was Successfully Uploaded</p>
+ <hr/>
+ </Alert>);
+ }
+ else {
+ return(<Alert variant="danger">
+ <Alert.Heading>Commissioning Failure</Alert.Heading>
+ <p>Updated Template Failed to Upload</p>
+ <p>Status code: { await response.status }: { response.statusText }</p>
+ <p>Response Text: { await response.text() }</p>
+ <hr/>
+ </Alert>);
+ }
+ },
+
+ updateTemplate: async (userAddedCommonPropValues, fullToscaTemplate) => {
+ const nodeTemplates = fullToscaTemplate.topology_template.node_templates
+ const commonPropertyDataEntries = Object.entries(userAddedCommonPropValues)
+
+ // This replaces the values for properties in the full tosca template
+ // that will be sent up to the api with the entries the user provided.
+ commonPropertyDataEntries.forEach(([templateKey, values]) => {
+ Object.entries(values).forEach(([propKey, propVal]) => {
+ nodeTemplates[templateKey].properties[propKey] = propVal
+ })
+ })
+
+ fullToscaTemplate.topology_template.node_templates = nodeTemplates
+
+ alert('Changes saved. Commission When Ready...')
+ return fullToscaTemplate
+ }
+}
+
+export default CommissioningUtils;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/utils/CommissioningUtils.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/utils/CommissioningUtils.test.js
new file mode 100644
index 0000000..8304ecb
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/utils/CommissioningUtils.test.js
@@ -0,0 +1,94 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+import commonProps from "../testFiles/commonProps.json";
+import fullTemp from "../testFiles/fullTemplate.json";
+import CommissioningUtils from "./CommissioningUtils";
+import React from "react";
+
+const commonProperties = JSON.parse(JSON.stringify(commonProps))
+const fullTemplate = JSON.parse(JSON.stringify(fullTemp))
+
+describe('Verify CommissioningUtils', () => {
+
+ const fullTemplatePromise = {
+ ok: true,
+ status: 200,
+ text: () => "OK",
+ json: () => {
+ return Promise.resolve(fullTemplate)
+ }
+ }
+
+ const commonPropertiesPromise = {
+ ok: true,
+ status: 200,
+ text: () => "OK",
+ json: () => {
+ return Promise.resolve(commonProperties)
+ }
+ }
+
+ it('test renderJsonEditor output is correct', async () => {
+ // Have to mock "editor" dom element for json editor to work in testing
+ document.body.innerHTML = '<div id="editor"></div>';
+
+ await expect((await CommissioningUtils.renderJsonEditor(fullTemplatePromise, commonPropertiesPromise)).editorTemp).toBeTruthy()
+ await expect((await CommissioningUtils.renderJsonEditor(fullTemplatePromise, commonPropertiesPromise)).fullTemplate).toBeTruthy()
+ await expect((await CommissioningUtils.renderJsonEditor(fullTemplatePromise, commonPropertiesPromise)).propertySchema).toBeTruthy()
+ await expect((await CommissioningUtils.renderJsonEditor(fullTemplatePromise, commonPropertiesPromise)).toscaInitialValues).toBeTruthy()
+ })
+
+ it('test the getType method object type', () => {
+ expect(CommissioningUtils.getType("object")).toBe("object")
+ })
+
+ it('test getAlertMessages with response ok', async () => {
+ const response = {
+ ok: true,
+ status: 200,
+ text: () => {
+ return Promise.resolve("OK")
+ },
+ json: () => {
+ return Promise.resolve("{}")
+ }
+ }
+
+ await expect(JSON.stringify(await CommissioningUtils.getAlertMessages(response))).toContain("Commissioning Success")
+ })
+
+ it('test getAlertMessages with response not ok', async () => {
+ const response = {
+ ok: false,
+ status: 200,
+ text: () => {
+ return Promise.resolve("Error")
+ },
+ json: () => {
+ return Promise.resolve("{}")
+ }
+ }
+
+ await expect(JSON.stringify(await CommissioningUtils.getAlertMessages(response))).toContain("Commissioning Failure")
+ })
+
+
+ }
+)
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextAlbumEditForm.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextAlbumEditForm.js
index b6d0fe6..9534a99 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextAlbumEditForm.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextAlbumEditForm.js
@@ -19,7 +19,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
+import {keyInformationTab_reset} from "./ApexKeyInformationTab";
const {ajax_delete, ajax_getWithKeyInfo, ajax_get} = require("./ApexAjax");
const {contextAlbumTab_reset} = require("./ApexContextAlbumTab");
const {apexUtils_removeElement, apexUtils_emptyElement, scrollToTop, apexUtils_areYouSure} = require("./ApexUtils");
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaEditForm.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaEditForm.js
index 48b2c33..06c4402 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaEditForm.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaEditForm.js
@@ -26,6 +26,7 @@ import {
formUtils_generateUUID
} from "./ApexFormUtils";
import {contextSchemaTab_reset} from "./ApexContextSchemaTab";
+import {keyInformationTab_reset} from "./ApexKeyInformationTab";
function editContextSchemaForm_createContextSchema(formParent) {
return editContextSchemaForm_activate(formParent, "CREATE", null);
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPageControl.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPageControl.js
index f2acf87..7b1b884 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPageControl.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPageControl.js
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020-2021 Nordix Foundation.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -63,17 +63,23 @@ function pageControl_modelMode(name, version, fileName) {
direction : "left"
}, 200);
- $("#mainTabs").tabs({
- classes : {
- "ui-tabs-tab" : "ui-tabs-tab-custom",
- "ui-tabs-active" : "ui-tabs-active-custom",
- "ui-tabs-anchor" : "ui-tabs-anchor-custom"
- },
- disabled : false,
- activate : function(event, ui) {
- localStorage.setItem("apex_tab_index", ui.newTab.index());
- }
- });
+ try{
+ $("#mainTabs").tabs({
+ classes : {
+ "ui-tabs-tab" : "ui-tabs-tab-custom",
+ "ui-tabs-active" : "ui-tabs-active-custom",
+ "ui-tabs-anchor" : "ui-tabs-anchor-custom"
+ },
+ disabled : false,
+ activate : function(event, ui) {
+ localStorage.setItem("apex_tab_index", ui.newTab.index());
+ }
+ });
+ }
+ catch(err){
+ console.error('TypeError! Failed to get tabs function');
+ }
+
contextSchemaTab_activate();
eventTab_activate();
@@ -116,15 +122,19 @@ function pageControl_noModelMode() {
taskTab_deactivate();
policyTab_deactivate();
keyInformationTab_deactivate();
-
- $("#mainTabs").tabs({
- classes : {
- "ui-tabs-tab" : "ui-tabs-tab-custom",
- "ui-tabs-active" : "ui-tabs-active-custom",
- "ui-tabs-anchor" : "ui-tabs-anchor-custom"
- },
- disabled : [ 0, 1, 2, 3, 4, 5 ]
- });
+ try{
+ $("#mainTabs").tabs({
+ classes : {
+ "ui-tabs-tab" : "ui-tabs-tab-custom",
+ "ui-tabs-active" : "ui-tabs-active-custom",
+ "ui-tabs-anchor" : "ui-tabs-anchor-custom"
+ },
+ disabled : [ 0, 1, 2, 3, 4, 5 ]
+ });
+ }
+ catch(err){
+ console.error('TypeError! Failed to get tabs function');
+ }
showPlaceholder(true);
}
@@ -145,16 +155,19 @@ function pageControl_busyMode() {
$("#menuConceptsTasks").addClass("disabled");
$("#menuConceptsPolicies").addClass("disabled");
$("#menuConceptsKeyInformation").addClass("disabled");
-
- $("#mainTabs").tabs({
- classes : {
- "ui-tabs-tab" : "ui-tabs-tab-custom",
- "ui-tabs-active" : "ui-tabs-active-custom",
- "ui-tabs-anchor" : "ui-tabs-anchor-custom"
- },
- disabled : false
- });
-
+ try{
+ $("#mainTabs").tabs({
+ classes : {
+ "ui-tabs-tab" : "ui-tabs-tab-custom",
+ "ui-tabs-active" : "ui-tabs-active-custom",
+ "ui-tabs-anchor" : "ui-tabs-anchor-custom"
+ },
+ disabled : false
+ });
+ }
+ catch(err){
+ console.error('TypeError! Failed to get tabs function');
+ }
contextSchemaTab_activate();
eventTab_activate();
contextAlbumTab_activate();
@@ -188,15 +201,19 @@ function pageControl_readyMode() {
taskTab_deactivate();
policyTab_deactivate();
keyInformationTab_deactivate();
-
- $("#mainTabs").tabs({
- classes : {
- "ui-tabs-tab" : "ui-tabs-tab-custom",
- "ui-tabs-active" : "ui-tabs-active-custom",
- "ui-tabs-anchor" : "ui-tabs-anchor-custom"
- },
- disabled : [ 0, 1, 2, 3, 4, 5 ]
- });
+ try{
+ $("#mainTabs").tabs({
+ classes : {
+ "ui-tabs-tab" : "ui-tabs-tab-custom",
+ "ui-tabs-active" : "ui-tabs-active-custom",
+ "ui-tabs-anchor" : "ui-tabs-anchor-custom"
+ },
+ disabled : [ 0, 1, 2, 3, 4, 5 ]
+ });
+ }
+ catch(err){
+ console.error('TypeError! Failed to get tabs function');
+ }
showPlaceholder(true);
}
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextAlbumEditForm.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextAlbumEditForm.test.js
index 728accd..a1aed28 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextAlbumEditForm.test.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextAlbumEditForm.test.js
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation
+ * Copyright (C) 2020-2021 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,21 @@
*/
const mod = require('../ApexContextAlbumEditForm');
+const apexUtils = require('../ApexUtils');
+const contextAlbumTab_reset = require('../ApexContextAlbumTab');
+const keyInformationTab_reset = require('../ApexKeyInformationTab');
+const formUtils_generateDescription = require('../ApexFormUtils');
+
+let data = {
+ messages: {
+ message: [
+ '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"}},' +
+ '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"},"itemSchema":{}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' +
+ '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}'
+ ]
+ },
+ ok: true
+};
test('Test mock_editContextAlbumForm_activate', () => {
const mock_editContextAlbumForm_activate = jest.fn(mod.editContextAlbumForm_activate);
@@ -41,4 +56,80 @@ test('Test mock_editContextAlbumForm_activate', () => {
mock_editContextAlbumForm_activate('parentTest', 'CREATE', contextAlbum, contextSchema);
expect(mock_editContextAlbumForm_activate).toHaveBeenCalledTimes(1);
+});
+
+test('Test Create Context Album', () => {
+ const jqXHR = { status: 200, responseText: "" };
+ $.ajax = jest.fn().mockImplementation((args) => {
+ args.success(data, null, jqXHR);
+ });
+ const mock_activate = jest.fn(mod.editContextAlbumForm_createContextAlbum);
+ mock_activate('parentTest');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test Delete Context Album', () => {
+ global.confirm = () => true
+ global.window.restRootURL = () => 'http://localhost'
+ const jqXHR = { status: 200, responseText: "" };
+ $.ajax = jest.fn().mockImplementation((args) => {
+ args.success(data, null, jqXHR);
+ });
+ jest.spyOn(keyInformationTab_reset, 'keyInformationTab_reset').mockReturnValueOnce(null);
+ jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValueOnce(null);
+ jest.spyOn(contextAlbumTab_reset, 'contextAlbumTab_reset').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.editContextAlbumForm_deleteContextAlbum);
+ mock_activate('parentTest', 'name', 'version');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test View Context Album', () => {
+ global.window.restRootURL = () => 'http://localhost'
+ const jqXHR = { status: 200, responseText: "" };
+ $.ajax = jest.fn().mockImplementation((args) => {
+ args.success(data, null, jqXHR);
+ });
+ const mock_activate = jest.fn(mod.editContextAlbumForm_viewContextAlbum);
+ mock_activate('parentTest', 'name', 'version');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test Edit Context Album', () => {
+ global.window.restRootURL = () => 'http://localhost'
+ const jqXHR = { status: 200, responseText: "" };
+ $.ajax = jest.fn().mockImplementation((args) => {
+ args.success(data, null, jqXHR);
+ });
+ const mock_activate = jest.fn(mod.editContextAlbumForm_editContextAlbum);
+ mock_activate('parentTest', 'name', 'version');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test Submit Pressed', () => {
+ jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValueOnce(null);
+ jest.spyOn(contextAlbumTab_reset, 'contextAlbumTab_reset').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.editContextAlbumForm_submitPressed);
+ mock_activate();
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test Generate UUID Pressed', () => {
+ let documentSpy = jest.spyOn(document, 'getElementById');
+ let elementMock = document.createElement("editContextAlbumFormUuidInput");
+ elementMock.value = 'one'
+ documentSpy.mockReturnValue(elementMock);
+ const mock_activate = jest.fn(mod.editContextAlbumForm_generateUUIDPressed);
+ mock_activate();
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test Generate Description Pressed', () => {
+ jest.spyOn(formUtils_generateDescription, 'formUtils_generateDescription').mockReturnValueOnce(null);
+ let documentSpy = jest.spyOn(document, 'getElementById');
+ let elementMock = document.createElement("editContextAlbumFormDescriptionTextArea");
+ elementMock.value = 'one'
+ documentSpy.mockReturnValue(elementMock);
+ const mock_activate = jest.fn(mod.editContextAlbumForm_generateDescriptionPressed);
+ mock_activate();
+ expect(mock_activate).toBeCalled();
}); \ No newline at end of file
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextSchemaEditForm.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextSchemaEditForm.test.js
index 69505bb..87b4f82 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextSchemaEditForm.test.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextSchemaEditForm.test.js
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation.
+ * Copyright (C) 2020-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,18 +19,92 @@
*/
const mod = require('../ApexContextSchemaEditForm');
+const apexUtils = require('../ApexUtils');
+const apexContextSchemaTab = require('../ApexContextSchemaTab');
+const keyInformationTab_reset = require('../ApexKeyInformationTab');
+const apexAjax = require('../ApexAjax');
+const formUtils_generateDescription = require('../ApexFormUtils');
-test('Test editContextSchemaForm_createContextSchema', () => {
- const contextSchema = {
- name: 'testName',
- version: '0.0.1',
- schemaFlavour: 'testFlav',
- schemaDefinition: 'testDef',
- uuid: 'testUUID',
- description: 'testDesc'
- }
+let data = {
+ messages: {
+ message: []
+ },
+ ok: true
+};
+const contextSchema = {
+ name: 'testName',
+ version: '0.0.1',
+ schemaFlavour: 'testFlav',
+ schemaDefinition: 'testDef',
+ uuid: 'testUUID',
+ description: 'testDesc'
+}
+test('Test editContextSchemaForm_createContextSchema', () => {
const mock_editContextSchemaForm_createContextSchema = jest.fn(mod.editContextSchemaForm_createContextSchema);
mock_editContextSchemaForm_createContextSchema('parentTest', 'CREATE', contextSchema);
expect(mock_editContextSchemaForm_createContextSchema).toBeCalled();
+});
+
+test('Test Delete Context Schema', () => {
+ global.confirm = () => true
+ const jqXHR = { status: 200, responseText: "" };
+ $.ajax = jest.fn().mockImplementation((args) => {
+ args.success(data, null, jqXHR);
+ });
+ jest.spyOn(keyInformationTab_reset, 'keyInformationTab_reset').mockReturnValueOnce(null);
+ jest.spyOn(apexContextSchemaTab, 'contextSchemaTab_reset').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.editContextSchemaForm_deleteContextSchema);
+ mock_activate('parent', 'name', 'version');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test View Context Schema', () => {
+ jest.spyOn(apexAjax, 'ajax_getWithKeyInfo').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.editContextSchemaForm_viewContextSchema);
+ mock_activate('parent', 'name', 'version');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test Activate Context Schema', () => {
+ const mock_activate = jest.fn(mod.editContextSchemaForm_activate);
+ mock_activate('parent', 'operation', contextSchema);
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test Generate UUID Pressed', () => {
+ let documentSpy = jest.spyOn(document, 'getElementById');
+ let elementMock = document.createElement("editContextSchemaFormUuidInput");
+ elementMock.value = 'one'
+ documentSpy.mockReturnValue(elementMock);
+ const mock_activate = jest.fn(mod.editContextSchemaForm_generateUUIDPressed);
+ mock_activate();
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test Generate Description Pressed', () => {
+ jest.spyOn(formUtils_generateDescription, 'formUtils_generateDescription').mockReturnValueOnce(null);
+ let documentSpy = jest.spyOn(document, 'getElementById');
+ let elementMock = document.createElement("editContextSchemaFormDescriptionTextArea");
+ elementMock.value = 'one'
+ documentSpy.mockReturnValue(elementMock);
+ const mock_activate = jest.fn(mod.editContextSchemaForm_generateDescriptionPressed);
+ mock_activate();
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test Cancel Pressed', () => {
+ jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValueOnce(null);
+ jest.spyOn(apexContextSchemaTab, 'contextSchemaTab_reset').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.editContextSchemaForm_cancelPressed);
+ mock_activate();
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test Submit Pressed', () => {
+ jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValueOnce(null);
+ jest.spyOn(apexContextSchemaTab, 'contextSchemaTab_reset').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.editContextSchemaForm_submitPressed);
+ mock_activate();
+ expect(mock_activate).toBeCalled();
}); \ No newline at end of file
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextSchemaTab.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextSchemaTab.test.js
index 552eb85..3883bd5 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextSchemaTab.test.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexContextSchemaTab.test.js
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation.
+ * Copyright (C) 2020-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,14 +20,35 @@
const mod = require('../ApexContextSchemaTab');
+let data = {
+ messages: {
+ message: [
+ '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"}},' +
+ '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' +
+ '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}'
+ ]
+ },
+ ok: true
+};
+
test('Test activateContextSchema', () => {
+ const jqXHR = { status: 200, responseText: "" };
+ $.ajax = jest.fn().mockImplementation((args) => {
+ args.success(data, null, jqXHR);
+ });
const mock_activate = jest.fn(mod.contextSchemaTab_activate);
mock_activate();
expect(mock_activate).toBeCalled();
});
test('Test deactivate', () => {
- const mock_deactivate = jest.fn(mod.contextSchemaTab_deactivate);
- mock_deactivate();
- expect(mock_deactivate).toBeCalledWith();
+ const mock_deactivate = jest.fn(mod.contextSchemaTab_deactivate);
+ mock_deactivate();
+ expect(mock_deactivate).toBeCalledWith();
+});
+
+test('Test reset', () => {
+ const mock_deactivate = jest.fn(mod.contextSchemaTab_reset);
+ mock_deactivate();
+ expect(mock_deactivate).toBeCalledWith();
}); \ No newline at end of file
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexEventEditForm.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexEventEditForm.test.js
index 6363ae6..a203f06 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexEventEditForm.test.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexEventEditForm.test.js
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation.
+ * Copyright (C) 2020-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,21 @@
*/
const mod = require('../ApexEventEditForm');
+const eventTab_reset = require('../ApexEventTab');
+const apexUtils = require('../ApexUtils');
+const keyInformationTab_reset = require('../ApexKeyInformationTab');
+
+let data = {
+ messages: {
+ message: [
+ '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"}},' +
+ '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' +
+ '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}'
+ ]
+ },
+ ok: true
+};
+
const contextSchema = {
name: 'testName',
version: '0.0.1',
@@ -70,4 +85,54 @@ test('Test Activate !=Create/Edit', () => {
const mock_activate = jest.fn(mod.editEventForm_activate);
mock_activate(null, 'TEST', event, contextSchema);
expect(mock_activate).toBeCalled();
+});
+
+test('Test Delete Event', () => {
+ global.confirm = () => true
+ global.window.restRootURL = () => 'http://localhost'
+ const jqXHR = { status: 200, responseText: "" };
+ $.ajax = jest.fn().mockImplementation((args) => {
+ args.success(data, null, jqXHR);
+ });
+ jest.spyOn(keyInformationTab_reset, 'keyInformationTab_reset').mockReturnValueOnce(null);
+ jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValueOnce(null);
+ jest.spyOn(eventTab_reset, 'eventTab_reset').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.editEventForm_deleteEvent);
+ mock_activate('parentTest', 'name', 'version');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test Event Edit Form Inner', () => {
+ global.window.restRootURL = () => 'http://localhost'
+ const jqXHR = { status: 200, responseText: "" };
+ $.ajax = jest.fn().mockImplementation((args) => {
+ args.success(data, null, jqXHR);
+ });
+ jest.spyOn(apexUtils, 'apexUtils_removeElement').mockReturnValueOnce(null);
+ jest.spyOn(apexUtils, 'apexUtils_emptyElement').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.editEventForm_editEvent_inner);
+ mock_activate('parentTest', 'name', 'version', 'edit');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test View Event', () => {
+ const mock_activate = jest.fn(mod.editEventForm_viewEvent);
+ mock_activate('parentTest', 'name', 'version');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test Edit Event', () => {
+ const mock_activate = jest.fn(mod.editEventForm_editEvent);
+ mock_activate('parentTest', 'name', 'version');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test Create Event', () => {
+ const jqXHR = { status: 200, responseText: "" };
+ $.ajax = jest.fn().mockImplementation((args) => {
+ args.success(data, null, jqXHR);
+ });
+ const mock_activate = jest.fn(mod.editEventForm_createEvent);
+ mock_activate('parentTest');
+ expect(mock_activate).toBeCalled();
}); \ No newline at end of file
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexFiles.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexFiles.test.js
index 6fcaa4d..f5be3cc 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexFiles.test.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexFiles.test.js
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation
+ * Copyright (C) 2020-2021 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,18 @@
*/
const mod = require('../ApexFiles');
+const resultForm_activate = require('../ApexResultForm');
+
+let data = {
+ messages: {
+ message: [
+ '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"}},' +
+ '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"},"itemSchema":{}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' +
+ '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}'
+ ]
+ },
+ ok: true
+ };
test('test files_open', () => {
const open = jest.fn(mod.files_fileOpen);
@@ -33,6 +45,12 @@ test('test files_download', () => {
});
test('Test files_upload', () => {
+ global.window.restRootURL = () => 'http://localhost'
+ const jqXHR = { status: 200, responseText: "" };
+ $.ajax = jest.fn().mockImplementation((args) => {
+ args.success(data, null, jqXHR);
+ });
+ jest.spyOn(resultForm_activate, 'resultForm_activate').mockReturnValueOnce(null);
const upload = jest.fn(mod.files_fileUpload);
upload();
expect(upload).toBeCalled();
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexPageControl.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexPageControl.test.js
new file mode 100644
index 0000000..b414bb1
--- /dev/null
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexPageControl.test.js
@@ -0,0 +1,116 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+const mod = require('../ApexPageControl');
+const apexContextSchemaTab = require('../ApexContextSchemaTab');
+const apexEventTab = require('../ApexEventTab');
+const apexAlbumTab = require('../ApexContextAlbumTab');
+const apexTaskTab = require('../ApexTaskTab');
+const apexPolicyTab = require('../ApexPolicyTab');
+const keyInformationTab = require('../ApexKeyInformationTab');
+
+test('Test showPlaceholder show', () => {
+ const mock_activate = jest.fn(mod.showPlaceholder);
+ mock_activate('show');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test showPlaceholder hide', () => {
+ const mock_activate = jest.fn(mod.showPlaceholder);
+ mock_activate('');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test pageControl_status', () => {
+ let data = {
+ messages: {
+ message: []
+ },
+ ok: true
+ };
+ const mock_activate = jest.fn(mod.pageControl_status);
+ mock_activate(data);
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test pageControl_status when data is not present', () => {
+ let data = {
+ messages: {
+ message: []
+ }
+ };
+ const mock_activate = jest.fn(mod.pageControl_status);
+ mock_activate(data);
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test pageControl_restError', () => {
+ const mock_activate = jest.fn(mod.pageControl_restError);
+ mock_activate('', '', '', '');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test pageControl_modelMode', () => {
+ jest.spyOn(apexContextSchemaTab, 'contextSchemaTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(apexEventTab, 'eventTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(apexAlbumTab, 'contextAlbumTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(apexTaskTab, 'taskTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(apexPolicyTab, 'policyTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(keyInformationTab, 'keyInformationTab_activate').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.pageControl_modelMode);
+ mock_activate('name', 'version', 'fileName');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test pageControl_noModelMode', () => {
+ jest.spyOn(apexContextSchemaTab, 'contextSchemaTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(apexEventTab, 'eventTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(apexAlbumTab, 'contextAlbumTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(apexTaskTab, 'taskTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(apexPolicyTab, 'policyTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(keyInformationTab, 'keyInformationTab_activate').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.pageControl_noModelMode);
+ mock_activate();
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test pageControl_busyMode', () => {
+ jest.spyOn(apexContextSchemaTab, 'contextSchemaTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(apexEventTab, 'eventTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(apexAlbumTab, 'contextAlbumTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(apexTaskTab, 'taskTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(apexPolicyTab, 'policyTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(keyInformationTab, 'keyInformationTab_activate').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.pageControl_busyMode);
+ mock_activate();
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test pageControl_readyMode', () => {
+ jest.spyOn(apexContextSchemaTab, 'contextSchemaTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(apexEventTab, 'eventTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(apexAlbumTab, 'contextAlbumTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(apexTaskTab, 'taskTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(apexPolicyTab, 'policyTab_activate').mockReturnValueOnce(null);
+ jest.spyOn(keyInformationTab, 'keyInformationTab_activate').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.pageControl_readyMode);
+ mock_activate();
+ expect(mock_activate).toBeCalled();
+}); \ No newline at end of file
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexPolicyEditForm_State.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexPolicyEditForm_State.test.js
index 1f1767a..8dd9fc4 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexPolicyEditForm_State.test.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexPolicyEditForm_State.test.js
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation
+ * Copyright (C) 2020-2021 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -117,6 +117,37 @@ test('Test editPolicyForm_State_addPolicyTask', () => {
});
-test.todo('Test editPolicyForm_State_getDirectOutputMappingOptions');
-test.todo('Test editPolicyForm_State_getStateBean');
-test.todo('Test editPolicyForm_State_getLogicOutputMappingOptions'); \ No newline at end of file
+test('Test editPolicyForm_State_getDirectOutputMappingOptions', () => {
+ let documentSpy = jest.spyOn(document, 'getElementById');
+ let elementMock = document.createElement("editPolicyFormDirOutputsTable_stateName");
+ elementMock.rows = '1'
+ documentSpy.mockReturnValue(elementMock);
+ const mock_activate = jest.fn(mod.editPolicyForm_State_getDirectOutputMappingOptions);
+ mock_activate('stateName');
+ expect(mock_activate).toBeCalled();
+
+});
+
+test('Test editPolicyForm_State_getStateBean', () => {
+ let documentSpy = jest.spyOn(document, 'getElementById');
+ let elementMock = document.createElement("editPolicyFormDirOutputsTable_stateName");
+ elementMock.rows = '1'
+ documentSpy.mockReturnValue(elementMock);
+ const mock_activate = jest.fn(mod.editPolicyForm_State_getStateBean);
+ mock_activate('stateName');
+ expect(mock_activate).toBeCalled();
+
+});
+
+test('Test editPolicyForm_State_getStateBean StateName is Null', () => {
+ const mock_activate = jest.fn(mod.editPolicyForm_State_getStateBean);
+ mock_activate(null);
+ expect(mock_activate).toBeCalled();
+
+});
+
+test('Test editPolicyForm_State_getLogicOutputMappingOptions', () => {
+ const mock_activate = jest.fn(mod.editPolicyForm_State_getLogicOutputMappingOptions);
+ mock_activate(null);
+ expect(mock_activate).toBeCalled();
+}); \ No newline at end of file
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/contextMenu.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/contextMenu.test.js
new file mode 100644
index 0000000..d804b6d
--- /dev/null
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/contextMenu.test.js
@@ -0,0 +1,118 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+const mod = require('../contextMenu');
+const apexContextEdit = require('../ApexContextSchemaEditForm');
+const apexEventEdit = require('../ApexEventEditForm');
+const apexTaskEdit = require('../ApexTaskEditForm');
+const apexPolicyEdit = require('../ApexPolicyEditForm');
+const apexContextAlbumEdit = require('../ApexContextAlbumEditForm');
+
+test('Test rightClickMenu', () => {
+ let documentSpy = jest.spyOn(document, 'getElementById');
+ let elementMock = document.createElement("rightClickMenu");
+ documentSpy.mockReturnValue(elementMock);
+ const event = new MouseEvent('click');
+ const mock_activate = jest.fn(mod.rightClickMenu);
+ mock_activate(event, 'type', 'name', 'version');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test rightClickMenuCreate when Type is CONTEXTSCHEMA', () => {
+ global.confirm = () => true
+ jest.spyOn(apexContextEdit, 'editContextSchemaForm_createContextSchema').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.rightClickMenuCreate);
+ mock_activate('parent', 'CONTEXTSCHEMA');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test rightClickMenuCreate when Type is EVENT or TASK or POLICY or CONTEXTALBUM or EMPTY', () => {
+ global.confirm = () => true
+ jest.spyOn(apexEventEdit, 'editEventForm_createEvent').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.rightClickMenuCreate);
+ mock_activate('parent', 'EVENT');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', 'TASK');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', 'POLICY');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', 'CONTEXTALBUM');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', '');
+ expect(mock_activate).toBeCalled();
+
+});
+
+test('Test rightClickMenuView when Type is CONTEXTSCHEMA or EVENT or TASK or POLICY or CONTEXTALBUM or EMPTY', () => {
+ global.confirm = () => true
+ jest.spyOn(apexContextEdit, 'editContextSchemaForm_viewContextSchema').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.rightClickMenuView);
+ mock_activate('parent', 'CONTEXTSCHEMA');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', 'EVENT');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', 'TASK');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', 'POLICY');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', 'CONTEXTALBUM');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', '');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test rightClickMenuEdit when Type is CONTEXTSCHEMA or EVENT or TASK or POLICY or CONTEXTALBUM or EMPTY', () => {
+ global.confirm = () => true
+ jest.spyOn(apexContextEdit, 'editContextSchemaForm_viewContextSchema').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.rightClickMenuEdit);
+ mock_activate('parent', 'CONTEXTSCHEMA');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', 'EVENT');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', 'TASK');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', 'POLICY');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', 'CONTEXTALBUM');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', '');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test rightClickMenuDelete when Type is CONTEXTSCHEMA or EVENT or TASK or POLICY or CONTEXTALBUM or EMPTY', () => {
+ jest.spyOn(apexContextEdit, 'editContextSchemaForm_deleteContextSchema').mockReturnValueOnce(null);
+ jest.spyOn(apexEventEdit, 'editEventForm_deleteEvent').mockReturnValueOnce(null);
+ jest.spyOn(apexTaskEdit, 'editTaskForm_deleteTask').mockReturnValueOnce(null);
+ jest.spyOn(apexPolicyEdit, 'editPolicyForm_deletePolicy').mockReturnValueOnce(null);
+ jest.spyOn(apexContextAlbumEdit, 'editContextAlbumForm_deleteContextAlbum').mockReturnValueOnce(null);
+ const mock_activate = jest.fn(mod.rightClickMenuDelete);
+ mock_activate('parent', 'CONTEXTSCHEMA');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', 'EVENT');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', 'TASK');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', 'POLICY');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', 'CONTEXTALBUM');
+ expect(mock_activate).toBeCalled();
+ mock_activate('parent', '');
+ expect(mock_activate).toBeCalled();
+}); \ No newline at end of file
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/showhideTextArea.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/showhideTextArea.test.js
new file mode 100644
index 0000000..3a72037
--- /dev/null
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/showhideTextArea.test.js
@@ -0,0 +1,48 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+const mod = require('../showhideTextarea');
+
+test('Test showHideTextarea_display_hide', () => {
+ let documentSpy = jest.spyOn(document, 'getElementById');
+ let element_text = document.createElement("text_textarea");
+ let element_showHide = document.createElement("text_showhide");
+ documentSpy.mockReturnValue(element_text);
+ documentSpy.mockReturnValue(element_showHide);
+ const mock_activate = jest.fn(mod.showHideTextarea_display_hide);
+ mock_activate('text');
+ expect(mock_activate).toBeCalled();
+});
+
+test('Test showHideTextarea_display_show', () => {
+ let documentSpy = jest.spyOn(document, 'getElementById');
+ let element_text = document.createElement("text_textarea");
+ let element_showHide = document.createElement("text_showhide");
+ documentSpy.mockReturnValue(element_text);
+ documentSpy.mockReturnValue(element_showHide);
+ const mock_activate = jest.fn(mod.showHideTextarea_display_show);
+ mock_activate('text');
+ expect(mock_activate).toBeCalled();
+});
+
+
+
+
+
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/contextMenu.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/contextMenu.js
index 1235cf1..8cd6a80 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/contextMenu.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/contextMenu.js
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -231,5 +231,5 @@ function mouseY(evt) {
}
export {
- rightClickMenu_scopePreserver
+ rightClickMenu_scopePreserver,rightClickMenu,rightClickMenuCreate,rightClickMenuView,rightClickMenuEdit,rightClickMenuDelete
}