summaryrefslogtreecommitdiffstats
path: root/gui-clamp/ui-react
diff options
context:
space:
mode:
authorbrunomilitzer <bruno.militzer@est.tech>2021-12-17 17:41:57 +0000
committerBruno Militzer <bruno.militzer@est.tech>2022-01-04 15:51:54 +0000
commit4be96f85c65df9384b11d68e87ca9e03e27a083c (patch)
treeaf178c54ace2b5d7457e3547b81cae6f4b6d5ebc /gui-clamp/ui-react
parentacd025f30f0005731c9b2894cb954bd31401ab76 (diff)
Added Jest Unit Tests
Jest Tests for creation of instance properties Jest Tests for deletion of instance properties Included Issue-Id: 3566 Issue-ID: POLICY-3563 Signed-off-by: brunomilitzer <bruno.militzer@est.tech> Change-Id: I227ae8f306df10ee3cc341791471dda9ca79d9d1
Diffstat (limited to 'gui-clamp/ui-react')
-rw-r--r--gui-clamp/ui-react/package.json7
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/ChangeOrderStateModal.test.js2
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstancePropertiesModal.js162
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstancePropertiesModal.test.js26
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationElementItem.test.js18
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationManagementModal.js45
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationManagementModal.test.js129
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/MonitorInstantiation.test.js4
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.test.js2
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstancePropertiesModal.test.js.snap2
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstantiationElementItem.test.js.snap6
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstantiationManagementModal.test.js.snap155
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/instanceProps.json1444
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/monitoringControlLoopList.json74
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/utils/InstantiationUtils.js175
15 files changed, 1984 insertions, 267 deletions
diff --git a/gui-clamp/ui-react/package.json b/gui-clamp/ui-react/package.json
index c3b63c5..3a8ee27 100644
--- a/gui-clamp/ui-react/package.json
+++ b/gui-clamp/ui-react/package.json
@@ -26,11 +26,12 @@
"src/theme"
],
"dependencies": {
+ "@babel/runtime": "7.16.5",
"@fortawesome/fontawesome-free": "5.15.3",
"@json-editor/json-editor": "2.5.4",
- "@material-ui/core": "4.11.4",
+ "@material-ui/core": "4.12.3",
"@material-ui/icons": "4.11.2",
- "@material-ui/lab": "4.0.0-alpha.58",
+ "@material-ui/lab": "4.0.0-alpha.60",
"@material-ui/pickers": "3.3.10",
"bootstrap-css-only": "4.4.1",
"js-yaml": "4.1.0",
@@ -45,9 +46,11 @@
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "7.14.5",
+ "@babel/plugin-transform-runtime": "7.16.5",
"@babel/preset-env": "7.14.7",
"@babel/preset-react": "7.14.5",
"@wojtekmaj/enzyme-adapter-react-17": "0.6.2",
+ "babel-jest": "26.6.0",
"enzyme": "3.11.0",
"enzyme-adapter-react-17-updated": "1.0.2",
"enzyme-to-json": "3.6.2",
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
index 4d288c6..63c6a60 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ChangeOrderStateModal.test.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ChangeOrderStateModal.test.js
@@ -178,7 +178,6 @@ describe('Verify ChangeOrderStateModal', () => {
await expect(changeInstanceOrderStateSpy).toHaveBeenCalled()
expect(logSpy).toHaveBeenNthCalledWith(1,"handleSave called");
expect(logSpy).toHaveBeenNthCalledWith(2,"successAlert called");
- // await expect(logSpy).toHaveBeenCalledTimes(2);
});
});
@@ -218,7 +217,6 @@ describe('Verify ChangeOrderStateModal', () => {
await expect(changeInstanceOrderStateSpy).toHaveBeenCalled()
expect(logSpy).toHaveBeenNthCalledWith(1,"handleSave called");
expect(logSpy).toHaveBeenNthCalledWith(2,"errorAlert called");
- // await expect(logSpy).toHaveBeenCalledTimes(2);
});
});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstancePropertiesModal.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstancePropertiesModal.js
index 7a473e7..ada396c 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstancePropertiesModal.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstancePropertiesModal.js
@@ -22,11 +22,9 @@ import Modal from "react-bootstrap/Modal";
import styled from "styled-components";
import Button from "react-bootstrap/Button";
import ControlLoopService from "../../../api/ControlLoopService";
-import { JSONEditor } from "@json-editor/json-editor";
import Alert from "react-bootstrap/Alert";
import * as PropTypes from "prop-types";
-import Form from "react-bootstrap/Form";
-import Spinner from "react-bootstrap/Spinner";
+import InstantiationUtils from "./utils/InstantiationUtils";
const ModalStyled = styled(Modal)`
@media (min-width: 800px) {
@@ -51,7 +49,6 @@ const AlertStyled = styled(Alert)`
const templateName = "ToscaServiceTemplateSimple";
const templateVersion = "1.0.0";
-let tempJsonEditor = null;
function Fragment(props) {
return null;
@@ -67,7 +64,6 @@ const InstancePropertiesModal = (props) => {
const [serviceTemplateResponseOk, setServiceTemplateResponseOk] = useState(true);
const [instancePropertiesResponseOk, setInstancePropertiesResponseOk] = useState(true);
const [instanceName, setInstanceName] = useState('')
- const [isLoading, setIsLoading] = useState(true);
useEffect(async () => {
const toscaInstanceProperties = await ControlLoopService.getCommonOrInstanceProperties(templateName, templateVersion, false)
@@ -77,171 +73,43 @@ const InstancePropertiesModal = (props) => {
.catch(error => error.message);
if (!toscaInstanceProperties.ok) {
- const errorResponse = await toscaInstanceProperties.json()
- console.log(errorResponse)
+ const errorResponse = await toscaInstanceProperties.json();
+ console.log(errorResponse);
setInstancePropertiesGlobal(errorResponse);
setInstancePropertiesResponseOk(false);
}
if (!toscaTemplateResponse.ok) {
- const errorResponse = await toscaTemplateResponse.json()
- console.log(errorResponse)
- setToscaFullTemplate(errorResponse)
+ const errorResponse = await toscaTemplateResponse.json();
+ console.log(errorResponse);
+ setToscaFullTemplate(errorResponse);
setServiceTemplateResponseOk(false);
}
if (toscaTemplateResponse.ok && toscaInstanceProperties.ok) {
- await parseJsonSchema(toscaTemplateResponse, toscaInstanceProperties);
+ const renderedJsonSchema = await InstantiationUtils.parseJsonSchema(toscaTemplateResponse, toscaInstanceProperties);
+ setToscaFullTemplate(await (renderedJsonSchema).fullTemplate);
+ setJsonEditor(await (renderedJsonSchema).jsonEditor);
}
}, []);
- const parseJsonSchema = async (fullTemplate, initialProperties) => {
-
- const fullJsonSchemaTemplate = await fullTemplate.json();
- setToscaFullTemplate(fullJsonSchemaTemplate);
-
- console.log(fullJsonSchemaTemplate);
-
- const filteredInitialStartValues = {};
-
- const instanceProperties = await initialProperties.json().then(properties => {
- const filteredTemplateObj = {};
- const propertiesTemplateArray = Object.entries(properties);
-
- propertiesTemplateArray.forEach(([key, value]) => {
- const propertiesObj = {
- properties: value.properties
- }
-
- const propValues = {};
- filteredTemplateObj[key] = propertiesObj;
-
- const jsonNodeSchemaKey = fullJsonSchemaTemplate.topology_template.node_templates[key]
-
- Object.entries(propertiesObj.properties).forEach(([pKey, pValue]) => {
- propValues[pKey] = jsonNodeSchemaKey.properties[pKey];
- });
-
- filteredInitialStartValues[key] = propValues;
- });
-
- return filteredTemplateObj;
- });
-
- const propertySchema = makeSchemaForInstanceProperties(instanceProperties);
-
- tempJsonEditor = createJsonEditor(propertySchema, filteredInitialStartValues);
- setJsonEditor(tempJsonEditor);
- }
-
- const makeSchemaForInstanceProperties = (instanceProps) => {
- const instancePropsArray = Object.entries(instanceProps);
-
- const newSchemaObject = {};
-
- newSchemaObject.title = "InstanceProperties";
- newSchemaObject.type = "object";
- newSchemaObject.properties = {};
-
- instancePropsArray.forEach(([key, value]) => {
-
- const propertiesObject = {};
-
- Object.entries(value.properties).forEach(([pKey, pValue]) => {
- propertiesObject[pKey] = {
- type: getType(pValue.type)
- }
- });
-
- newSchemaObject.properties[key] = {
- options: {
- "collapsed": true
- },
- properties: propertiesObject
- }
- });
-
- return newSchemaObject;
- }
-
- const getType = (pType) => {
- switch (pType) {
- case "map":
- return "string";
- case "string":
- return "string";
- case "integer":
- return "integer";
- case "list":
- return "array";
- case "object":
- return "object";
- default:
- return "object";
-
- }
- }
-
- const createJsonEditor = (fullSchema, instanceProperties) => {
- console.log(props.location.instanceName)
- setIsLoading(false)
- JSONEditor.defaults.options.collapse = true;
-
- return new JSONEditor(document.getElementById("editor"),
- {
- schema: fullSchema,
- startval: instanceProperties,
- theme: 'bootstrap4',
- iconlib: 'fontawesome5',
- object_layout: 'normal',
- disable_properties: false,
- disable_edit_json: false,
- 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: true,
- show_errors: 'always',
- display_required_only: false,
- show_opt_in: false,
- prompt_before_delete: true,
- required_by_default: false,
- });
- }
-
const handleClose = () => {
console.log('handleClose called');
setShow(false);
props.history.push('/');
}
- const updateTemplate = (jsonEditorValues) => {
- const nodeTemplates = toscaFullTemplate.topology_template.node_templates;
- const instanceDataProperties = Object.entries(jsonEditorValues);
-
- instanceDataProperties.forEach(([key, value]) => {
- const nodeTemplatesKey = nodeTemplates[key]
- Object.entries(value).forEach(([pKey, pValue]) => {
- nodeTemplatesKey.properties[pKey] = pValue
- });
- });
-
- toscaFullTemplate.topology_template.node_templates = nodeTemplates;
-
- setToscaFullTemplate(toscaFullTemplate);
-
- }
-
const handleSave = async () => {
console.log("handleSave called");
+ setInstanceName(instanceName);
+
console.log("instanceName to be saved is: " + instanceName);
- console.log(JSON.stringify(toscaFullTemplate));
+ console.log(jsonEditor);
- updateTemplate(jsonEditor.getValue());
+ //setToscaFullTemplate(InstantiationUtils.updateTemplate(jsonEditor.getValue(), toscaFullTemplate));
const response = await ControlLoopService.createInstanceProperties(instanceName, toscaFullTemplate)
.catch(error => error.message);
@@ -253,10 +121,6 @@ const InstancePropertiesModal = (props) => {
}
}
- const handleNameChange = (e) => {
- setInstanceName(e.target.value)
- }
-
const successAlert = () => {
console.log("successAlert called");
setAlertMessage(<Alert variant="success">
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstancePropertiesModal.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstancePropertiesModal.test.js
index 141999c..454fcf9 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstancePropertiesModal.test.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstancePropertiesModal.test.js
@@ -23,8 +23,16 @@ import InstancePropertiesModal from "./InstancePropertiesModal";
import toJson from "enzyme-to-json";
import { createMemoryHistory } from "history";
import { act } from "react-dom/test-utils";
+import ControlLoopService from "../../../api/ControlLoopService";
+import instanceProps from "./testFiles/instanceProps.json";
+import fullTemp from "./testFiles/fullTemplate.json";
-describe('Verify MonitoringInstantiation', () => {
+
+let logSpy = jest.spyOn(console, 'log')
+const instanceProperties = JSON.parse(JSON.stringify(instanceProps))
+const fullTemplate = JSON.parse(JSON.stringify(fullTemp))
+
+describe('Verify InstancePropertiesModal', () => {
it("renders without crashing", () => {
shallow(<InstancePropertiesModal />);
@@ -35,7 +43,7 @@ describe('Verify MonitoringInstantiation', () => {
expect(toJson(tree)).toMatchSnapshot();
});
- it('should have submit button element', () => {
+ it('should have save button element', () => {
const container = shallow(<InstancePropertiesModal/>)
expect(container.find('[variant="primary"]').length).toEqual(1);
});
@@ -45,10 +53,8 @@ describe('Verify MonitoringInstantiation', () => {
expect(container.find('[variant="secondary"]').length).toEqual(1);
});
- it('handleCreateUpdateToscaInstanceProperties called when submit button clicked', () => {
- const history = createMemoryHistory();
+ it('handleCreateUpdateToscaInstanceProperties called when save button clicked', () => {
const component = mount(<InstancePropertiesModal />)
- const logSpy = jest.spyOn(console, 'log');
act(() => {
component.find('[variant="primary"]').simulate('click');
@@ -59,11 +65,19 @@ describe('Verify MonitoringInstantiation', () => {
it('handleClose called when close button clicked', () => {
const history = createMemoryHistory();
const component = mount(<InstancePropertiesModal history={ history }/>)
- const logSpy = jest.spyOn(console, 'log');
act(() => {
component.find('[variant="secondary"]').simulate('click');
expect(logSpy).toHaveBeenCalledWith('handleClose called');
});
});
+
+ it('handleSave called when save button clicked', () => {
+ const component = mount(<InstancePropertiesModal />)
+
+ act(() => {
+ component.find('[variant="primary"]').simulate('click');
+ expect(logSpy).toHaveBeenCalledWith('handleSave called');
+ });
+ });
});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationElementItem.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationElementItem.test.js
index 136983a..7b1c1ec 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationElementItem.test.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationElementItem.test.js
@@ -25,9 +25,25 @@ import React from "react";
import InstantiationElementItem from "./InstantiationElementItem";
describe('Verify InstantiationElementItem', () => {
- const container = shallow(<InstantiationElementItem />);
+ const index = 0;
it("renders correctly", () => {
+ const container = shallow(<InstantiationElementItem />);
+ expect(toJson(container)).toMatchSnapshot();
+ });
+
+ it("renders correctly when orderState is uninitialized", () => {
+ const container = shallow(<InstantiationElementItem title={ "UNINITIALISED_TEST" } orderState={ "UNINITIALISED" } index={ index } key={ index }/>);
+ expect(toJson(container)).toMatchSnapshot();
+ });
+
+ it("renders correctly when orderState is passive", () => {
+ const container = shallow(<InstantiationElementItem title={ "PASSIVE_TEST" } orderState={ "PASSIVE" } index={ index } key={ index }/>);
+ expect(toJson(container)).toMatchSnapshot();
+ });
+
+ it("renders correctly when orderState is running", () => {
+ const container = shallow(<InstantiationElementItem title={ "RUNNING_TEST" } orderState={ "RUNNING" } index={ index } key={ index }/>);
expect(toJson(container)).toMatchSnapshot();
});
}); \ No newline at end of file
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationManagementModal.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationManagementModal.js
index 6a435e4..93b504a 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationManagementModal.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationManagementModal.js
@@ -27,6 +27,7 @@ import styled from "styled-components";
import { Link } from "react-router-dom";
import ControlLoopService from "../../../api/ControlLoopService";
import Row from "react-bootstrap/Row";
+import InstantiationUtils from "./utils/InstantiationUtils";
const ModalStyled = styled(Modal)`
background-color: transparent;
@@ -47,6 +48,7 @@ const DivWhiteSpaceStyled = styled.div`
const InstantiationManagementModal = (props) => {
const [show, setShow] = useState(true);
const [instantiationList, setInstantiationList] = useState([]);
+ const [deleteInstantiation, setDeleteInstantiation] = useState(false);
const [alertMessage, setAlertMessage] = useState(null);
useEffect(async () => {
@@ -55,16 +57,7 @@ const InstantiationManagementModal = (props) => {
const instantiationListJson = await response.json();
- const parsedInstantiationList = instantiationListJson['controlLoopList'].map((instance, index) => {
- return {
- index: index,
- name: instance['name'],
- version: instance['version'],
- orderedState: instance['orderedState'],
- currentState: instance['state'],
- disableDelete: instance['state'] !== 'UNINITIALISED'
- }
- });
+ const parsedInstantiationList = InstantiationUtils.parseInstantiationList(instantiationListJson['controlLoopList']);
setInstantiationList(parsedInstantiationList);
}, []);
@@ -77,18 +70,26 @@ const InstantiationManagementModal = (props) => {
return 'White';
}
- const deleteInstantiationHandler = async (instantiation, index) => {
+ const deleteInstantiationHandler = async (index, instantiation) => {
console.log("deleteInstantiationHandler called");
+ setDeleteInstantiation(true);
+
+ if (instantiation.disableDelete) {
+ return;
+ }
const name = instantiation.name;
const version = instantiation.version;
const response = await ControlLoopService.deleteInstantiation(name, version);
+ console.log(response);
+
updateList(index);
if (response.ok) {
successAlert();
+ setDeleteInstantiation(false);
} else {
await errorAlert(response);
}
@@ -96,7 +97,6 @@ const InstantiationManagementModal = (props) => {
const updateList = (index) => {
console.log("updateList called")
- console.log(instantiationList)
const updatedList = [...instantiationList];
updatedList.splice(index, 1);
@@ -104,22 +104,6 @@ const InstantiationManagementModal = (props) => {
setInstantiationList(updatedList);
}
- const renderDeleteButton = (instantiation, index) => {
- if (instantiation.disableDelete) {
- return (
- <Button variant="outline-danger" type="null"
- disabled={ true }
- style={ { cursor: "not-allowed" } }>Delete</Button>
- );
-
- } else {
- return (
- <Button variant="danger" type="null"
- onClick={ async () => deleteInstantiationHandler(instantiation, index) }>Delete</Button>
- );
- }
- }
-
const handleClose = () => {
console.log("handleClose called");
setShow(false);
@@ -200,7 +184,10 @@ const InstantiationManagementModal = (props) => {
</Link>
</td>
<td style={ { textAlign: "center" } }>
- { renderDeleteButton(instantiation, index) }
+ <Button variant={ instantiation.disabled ? "outline-danger" : "danger" } type="null"
+ disabled={ instantiation.disableDelete }
+ style={ instantiation.disableDelete ? { cursor: "not-allowed" } : {} }
+ onClick={(e) => deleteInstantiationHandler(index, instantiation)}>Delete</Button>
</td>
<td style={ { textAlign: "center" } }>
<Link to={ {
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationManagementModal.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationManagementModal.test.js
new file mode 100644
index 0000000..cb41ccc
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationManagementModal.test.js
@@ -0,0 +1,129 @@
+/*
+ * ============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 { mount, shallow } from "enzyme";
+import React from "react";
+import toJson from "enzyme-to-json";
+import InstantiationManagementModal from "./InstantiationManagementModal";
+import { act } from "react-dom/test-utils";
+import { createMemoryHistory } from "history";
+import ControlLoopService from "../../../api/ControlLoopService";
+import clLoopList from "./testFiles/controlLoopList.json";
+import { BrowserRouter } from "react-router-dom";
+
+const logSpy = jest.spyOn(console, 'log')
+const history = createMemoryHistory();
+
+describe('Verify MonitoringInstantiation', () => {
+ const flushPromises = () => new Promise(setImmediate);
+
+ beforeEach(() => {
+ logSpy.mockClear();
+ });
+
+ it("renders without crashing", () => {
+ shallow(<InstantiationManagementModal/>);
+ });
+ it("renders correctly", () => {
+ const tree = shallow(<InstantiationManagementModal />);
+ expect(toJson(tree)).toMatchSnapshot();
+ });
+
+ it('should have a close Button element', () => {
+ const container = shallow(<InstantiationManagementModal />);
+ const button = container.find('[variant="secondary"]').at(2);
+
+ expect(button.text()).toEqual("Close");
+ });
+
+ it('should have a Create Instance Button element', () => {
+ const container = shallow(<InstantiationManagementModal />);
+ const button = container.find('[variant="primary"]').at(0);
+
+ expect(button.text()).toEqual("Create Instance");
+ });
+
+ it('should have a Monitor Instantiations Button element', () => {
+ const container = shallow(<InstantiationManagementModal />);
+ const button = container.find('[variant="secondary"]').at(0);
+
+ expect(button.text()).toEqual("Monitor Instantiations");
+ });
+
+ it('handleClose called when bottom button clicked', () => {
+ const container = shallow(<InstantiationManagementModal history={ history } />);
+ const button = container.find('[variant="secondary"]').at(2);
+
+ act(() => {
+ button.simulate('click');
+ expect(logSpy).toHaveBeenCalledWith('handleClose called');
+ });
+ });
+
+ it('handleClose called when top-right button clicked', () => {
+ const container = shallow(<InstantiationManagementModal history={ history } />);
+
+ act(() => {
+ container.find('[size="xl"]').get(0).props.onHide();
+ expect(logSpy).toHaveBeenCalledWith('handleClose called');
+ });
+ });
+
+ it('clearErrors called when clear error message button clicked', () => {
+ const container = shallow(<InstantiationManagementModal history={ history } />);
+ const button = container.find('[variant="secondary"]').at(1);
+
+ act(() => {
+ button.simulate('click');
+ expect(logSpy).toHaveBeenCalledWith('clearErrors called');
+ });
+ });
+
+ it('Check useEffect is being called', async () => {
+ jest.resetAllMocks();
+ jest.spyOn(ControlLoopService, 'getControlLoopInstantiation')
+ .mockImplementationOnce(async () => {
+ return Promise.resolve({
+ ok: true,
+ status: 200,
+ text: () => "OK",
+ json: () => {
+ return Promise.resolve(clLoopList);
+ }
+ });
+ });
+
+ const component = mount(
+ <BrowserRouter>
+ <InstantiationManagementModal />
+ </BrowserRouter>
+ );
+ 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/MonitorInstantiation.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/MonitorInstantiation.test.js
index ea98073..9bc8c04 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/MonitorInstantiation.test.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/MonitorInstantiation.test.js
@@ -24,9 +24,9 @@ import { act } from "react-dom/test-utils";
import { createMemoryHistory } from "history";
import MonitorInstantiation from "./MonitorInstantiation";
import ControlLoopService from "../../../api/ControlLoopService";
-import clLoopList from "./testFiles/monitoringControlLoopList.json";
+import clLoopList from "./testFiles/controlLoopList.json";
-const logSpy = jest.spyOn(console, 'error')
+const logSpy = jest.spyOn(console, 'log')
const history = createMemoryHistory();
describe('Verify MonitorInstantiation', () => {
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.test.js
index 94d9038..520eea9 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.test.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.test.js
@@ -47,7 +47,7 @@ describe('Verify UploadToscaFile', () => {
}
};
- act(async () => {
+ await act(() => {
component.find('[variant="primary"]').get(0).props.onClick(event);
expect(logSpy).toHaveBeenCalledWith('postServiceTemplateHandler called');
})
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstancePropertiesModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstancePropertiesModal.test.js.snap
index 96b500e..d655b08 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstancePropertiesModal.test.js.snap
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstancePropertiesModal.test.js.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`Verify MonitoringInstantiation renders correctly 1`] = `
+exports[`Verify InstancePropertiesModal renders correctly 1`] = `
<Styled(Modal)
backdrop="static"
keyboard={false}
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstantiationElementItem.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstantiationElementItem.test.js.snap
index 2c5d298..81f5f26 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstantiationElementItem.test.js.snap
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstantiationElementItem.test.js.snap
@@ -1,3 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Verify InstantiationElementItem renders correctly 1`] = `<Fragment />`;
+
+exports[`Verify InstantiationElementItem renders correctly when orderState is passive 1`] = `<Fragment />`;
+
+exports[`Verify InstantiationElementItem renders correctly when orderState is running 1`] = `<Fragment />`;
+
+exports[`Verify InstantiationElementItem renders correctly when orderState is uninitialized 1`] = `<Fragment />`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstantiationManagementModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstantiationManagementModal.test.js.snap
new file mode 100644
index 0000000..76f8780
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/InstantiationManagementModal.test.js.snap
@@ -0,0 +1,155 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Verify MonitoringInstantiation renders correctly 1`] = `
+<Styled(Modal)
+ backdrop="static"
+ keyboard={false}
+ onHide={[Function]}
+ show={true}
+ size="xl"
+>
+ <ModalHeader
+ closeButton={true}
+ closeLabel="Close"
+ >
+ <ModalTitle>
+ Manage Instances
+ </ModalTitle>
+ </ModalHeader>
+ <ModalBody>
+ <Container
+ fluid={false}
+ >
+ <Row
+ noGutters={false}
+ >
+ <Link
+ to={
+ Object {
+ "pathname": "/editControlLoopInstanceProperties",
+ }
+ }
+ >
+ <Button
+ active={false}
+ disabled={false}
+ type="null"
+ variant="primary"
+ >
+ Create Instance
+ </Button>
+ </Link>
+ <styled.div />
+ <Link
+ to={
+ Object {
+ "pathname": "/monitorInstantiation",
+ }
+ }
+ >
+ <Button
+ active={false}
+ disabled={false}
+ type="null"
+ variant="secondary"
+ >
+ Monitor Instantiations
+ </Button>
+ </Link>
+ </Row>
+ </Container>
+ <ForwardRef
+ bordered={true}
+ style={
+ Object {
+ "marginTop": "10px",
+ }
+ }
+ >
+ <thead>
+ <tr>
+ <th>
+ #
+ </th>
+ <th
+ style={
+ Object {
+ "textAlign": "center",
+ }
+ }
+ >
+ Instantiation Name
+ </th>
+ <th
+ style={
+ Object {
+ "textAlign": "center",
+ }
+ }
+ >
+ Edit Instantiation
+ </th>
+ <th
+ style={
+ Object {
+ "textAlign": "center",
+ }
+ }
+ >
+ Delete Instantiation
+ </th>
+ <th
+ style={
+ Object {
+ "textAlign": "center",
+ }
+ }
+ >
+ Change Order State
+ </th>
+ <th
+ style={
+ Object {
+ "textAlign": "center",
+ }
+ }
+ >
+ Instantiation Order State
+ </th>
+ <th
+ style={
+ Object {
+ "textAlign": "center",
+ }
+ }
+ >
+ Instantiation Current State
+ </th>
+ </tr>
+ </thead>
+ <tbody />
+ </ForwardRef>
+ <styled.div />
+ </ModalBody>
+ <ModalFooter>
+ <Button
+ active={false}
+ disabled={false}
+ onClick={[Function]}
+ type="null"
+ variant="secondary"
+ >
+ Clear Error Message
+ </Button>
+ <Button
+ active={false}
+ disabled={false}
+ onClick={[Function]}
+ type="null"
+ variant="secondary"
+ >
+ Close
+ </Button>
+ </ModalFooter>
+</Styled(Modal)>
+`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/instanceProps.json b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/instanceProps.json
new file mode 100644
index 0000000..b8250fd
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/instanceProps.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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ },
+ "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": "false"
+ }
+ }
+ },
+ "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/monitoringControlLoopList.json b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/monitoringControlLoopList.json
deleted file mode 100644
index ee170f8..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/testFiles/monitoringControlLoopList.json
+++ /dev/null
@@ -1,74 +0,0 @@
-{
- "controlLoopList":[
- {
- "name":"PMSH_Instance1",
- "version":"2.3.1",
- "derivedFrom":null,
- "metadata":null,
- "description":"PMSH control loop _Instance1",
- "definition":{
- "name":"org.onap.domain.pmsh.PMSHControlLoopDefinition_Instance1",
- "version":"1.2.3"
- },
- "state":"PASSIVE",
- "orderedState":"PASSIVE",
- "elements":{
- "edb332de-ad83-44a7-9c86-f8158cd0de7f":{
- "id":"edb332de-ad83-44a7-9c86-f8158cd0de7f",
- "definition":{
- "name":"org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement_Instance1",
- "version":"1.2.3"
- },
- "participantType":{
- "name":"org.onap.policy.controlloop.PolicyControlLoopParticipant",
- "version":"2.3.1"
- },
- "participantId":{
- "name":"org.onap.PM_Policy",
- "version":"1.0.0"
- },
- "state":"UNINITIALISED",
- "orderedState":"UNINITIALISED",
- "toscaServiceTemplateFragment":null,
- "description":null,
- "clElementStatistics":null,
- "propertiesMap":{
-
- }
- },
- "68e95fa7-0acf-4635-b454-47a50f299614":{
- "id":"68e95fa7-0acf-4635-b454-47a50f299614",
- "definition":{
- "name":"org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement_Instance1",
- "version":"1.2.3"
- },
- "participantType":{
- "name":"org.onap.policy.controlloop.PolicyControlLoopParticipant",
- "version":"2.3.1"
- },
- "participantId":{
- "name":"org.onap.PM_Policy",
- "version":"1.0.0"
- },
- "state":"UNINITIALISED",
- "orderedState":"UNINITIALISED",
- "toscaServiceTemplateFragment":null,
- "description":null,
- "clElementStatistics":null,
- "propertiesMap":{
-
- }
- }
- },
- "primed":false,
- "type":"org.onap.domain.pmsh.PMSHControlLoopDefinition_Instance1",
- "typeVersion":"1.2.3",
- "key":{
- "name":"PMSH_Instance1",
- "version":"2.3.1"
- },
- "definedName":"PMSH_Instance1",
- "definedVersion":"2.3.1"
- }
- ]
-} \ No newline at end of file
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/utils/InstantiationUtils.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/utils/InstantiationUtils.js
new file mode 100644
index 0000000..fd83432
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/utils/InstantiationUtils.js
@@ -0,0 +1,175 @@
+/*
+ * ============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";
+
+const InstantiationUtils = {
+
+ parseInstantiationList: (controlLoopList) => {
+ const parsedControlLoopList = [];
+
+ controlLoopList.map((instance, index) => {
+
+ const controlLoopObj = {
+ index,
+ name: instance['name'],
+ version: instance['version'],
+ orderedState: instance['orderedState'],
+ currentState: instance['state'],
+ disableDelete: instance['state'] !== 'UNINITIALISED'
+ }
+
+ parsedControlLoopList.push(controlLoopObj);
+ });
+
+ return parsedControlLoopList;
+ },
+
+ makeSchemaForInstanceProperties: (instanceProps) => {
+ const instancePropsArray = Object.entries(instanceProps);
+
+ const newSchemaObject = {};
+
+ newSchemaObject.title = "InstanceProperties";
+ newSchemaObject.type = "object";
+ newSchemaObject.properties = {};
+
+ instancePropsArray.forEach(([key, value]) => {
+
+ const propertiesObject = {};
+
+ Object.entries(value.properties).forEach(([pKey, pValue]) => {
+ propertiesObject[pKey] = {
+ type: InstantiationUtils.getType(pValue.type)
+ }
+ });
+
+ newSchemaObject.properties[key] = {
+ options: {
+ "collapsed": true
+ },
+ properties: propertiesObject
+ }
+ });
+
+ return newSchemaObject;
+ },
+
+ parseJsonSchema: async (template, instanceProperties) => {
+ const fullTemplate = await template.json();
+
+ const filteredInitialValues = {};
+
+ const allInstanceProperties = await instanceProperties.json().then(properties => {
+ const filteredTemplateObj = {};
+ const propertiesTemplateArray = Object.entries(properties);
+
+ propertiesTemplateArray.forEach(([key, value]) => {
+ const propertiesObj = {
+ properties: value.properties
+ }
+
+ const propValues = {};
+ filteredTemplateObj[key] = propertiesObj;
+
+ const jsonNodeSchemaKey = fullTemplate.topology_template.node_templates[key]
+
+ Object.entries(propertiesObj.properties).forEach(([pKey, pValue]) => {
+ propValues[pKey] = jsonNodeSchemaKey.properties[pKey];
+ });
+
+ filteredInitialValues[key] = propValues;
+ });
+
+ return filteredTemplateObj;
+ });
+
+ const propertySchema = InstantiationUtils.makeSchemaForInstanceProperties(allInstanceProperties);
+
+ const jsonEditor = InstantiationUtils.createJsonEditor(propertySchema, filteredInitialValues);
+
+ return {
+ fullTemplate: fullTemplate,
+ jsonEditor: jsonEditor
+ }
+ },
+
+ getType: (pType) => {
+ switch (pType) {
+ case "map":
+ return "string";
+ case "string":
+ return "string";
+ case "integer":
+ return "integer";
+ case "list":
+ return "array";
+ case "object":
+ return "object";
+ default:
+ return "object";
+ }
+ },
+
+ createJsonEditor: (fullSchema, instanceProperties) => {
+ JSONEditor.defaults.options.collapse = true;
+
+ return new JSONEditor(document.getElementById("editor"),
+ {
+ schema: fullSchema,
+ startval: instanceProperties,
+ theme: 'bootstrap4',
+ iconlib: 'fontawesome5',
+ object_layout: 'normal',
+ disable_properties: false,
+ disable_edit_json: false,
+ 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: true,
+ show_errors: 'always',
+ display_required_only: false,
+ show_opt_in: false,
+ prompt_before_delete: true,
+ required_by_default: false,
+ });
+ },
+
+ updateTemplate: (jsonEditorValues, fullTemplate) => {
+ const nodeTemplates = fullTemplate.topology_template.node_templates;
+ const instanceDataProperties = Object.entries(jsonEditorValues);
+
+ instanceDataProperties.forEach(([key, value]) => {
+ const nodeTemplatesKey = nodeTemplates[key]
+ Object.entries(value).forEach(([pKey, pValue]) => {
+ nodeTemplatesKey.properties[pKey] = pValue
+ });
+ });
+
+ fullTemplate.topology_template.node_templates = nodeTemplates;
+
+ return fullTemplate;
+ }
+}
+
+export default InstantiationUtils; \ No newline at end of file