From 4651d908fe8fa83801a8df4d6e83e4eb25073f46 Mon Sep 17 00:00:00 2001 From: brunomilitzer Date: Fri, 25 Feb 2022 10:38:47 +0000 Subject: Renamed Control Loop to ACM Issue-ID: POLICY-3940 Change-Id: I37d768ac339e4e354a369fcb659bf36da861d7aa Signed-off-by: brunomilitzer --- .../src/components/dialogs/ACM/AccordionHeader.js | 120 ++ .../components/dialogs/ACM/AccordionHeader.test.js | 50 + .../dialogs/ACM/ChangeOrderStateModal.js | 171 ++ .../dialogs/ACM/ChangeOrderStateModal.test.js | 262 +++ .../components/dialogs/ACM/CommissioningModal.js | 160 ++ .../dialogs/ACM/CommissioningModal.test.js | 227 ++ .../components/dialogs/ACM/DeleteToscaTemplate.js | 56 + .../dialogs/ACM/DeleteToscaTemplate.test.js | 54 + .../dialogs/ACM/GetLocalToscaFileForUpload.js | 150 ++ .../dialogs/ACM/GetLocalToscaFileForUpload.test.js | 122 ++ .../src/components/dialogs/ACM/GetToscaTemplate.js | 54 + .../dialogs/ACM/GetToscaTemplate.test.js | 85 + .../dialogs/ACM/InstancePropertiesModal.js | 173 ++ .../dialogs/ACM/InstancePropertiesModal.test.js | 103 + .../dialogs/ACM/InstantiationElementItem.js | 124 ++ .../dialogs/ACM/InstantiationElementItem.test.js | 49 + .../dialogs/ACM/InstantiationElements.js | 41 + .../dialogs/ACM/InstantiationElements.test.js | 33 + .../components/dialogs/ACM/InstantiationItem.js | 52 + .../dialogs/ACM/InstantiationItem.test.js | 53 + .../dialogs/ACM/InstantiationManagementModal.js | 219 ++ .../ACM/InstantiationManagementModal.test.js | 155 ++ .../ACM/InstantiationOrderStateChangeItem.js | 113 + .../ACM/InstantiationOrderStateChangeItem.test.js | 51 + .../components/dialogs/ACM/MonitorInstantiation.js | 85 + .../dialogs/ACM/MonitorInstantiation.test.js | 93 + .../components/dialogs/ACM/ReadAndConvertYaml.js | 132 ++ .../dialogs/ACM/ReadAndConvertYaml.test.js | 252 +++ .../src/components/dialogs/ACM/UploadToscaFile.js | 52 + .../components/dialogs/ACM/UploadToscaFile.test.js | 61 + .../ACM/__snapshots__/AccordionHeader.test.js.snap | 211 ++ .../ChangeOrderStateModal.test.js.snap | 114 + .../__snapshots__/CommissioningModal.test.js.snap | 77 + .../__snapshots__/DeleteToscaTemplate.test.js.snap | 20 + .../GetLocalToscaFileForUpload.test.js.snap | 103 + .../__snapshots__/GetToscaTemplate.test.js.snap | 15 + .../InstancePropertiesModal.test.js.snap | 68 + .../InstantiationElementItem.test.js.snap | 9 + .../InstantiationElements.test.js.snap | 3 + .../__snapshots__/InstantiationItem.test.js.snap | 26 + .../InstantiationManagementModal.test.js.snap | 155 ++ .../InstantiationOrderStateChangeItem.test.js.snap | 27 + .../MonitorInstantiation.test.js.snap | 41 + .../__snapshots__/ReadAndConvertYaml.test.js.snap | 63 + .../ACM/__snapshots__/UploadToscaFile.test.js.snap | 16 + .../components/dialogs/ACM/testFiles/acmList.json | 59 + .../dialogs/ACM/testFiles/commonProps.json | 1444 +++++++++++++ .../dialogs/ACM/testFiles/fullTemplate.json | 2194 ++++++++++++++++++++ .../dialogs/ACM/testFiles/instanceProps.json | 1444 +++++++++++++ .../dialogs/ACM/testFiles/jsonEditorData.json | 50 + .../dialogs/ACM/testFiles/orderedStateJson.json | 9 + .../dialogs/ACM/utils/CommissioningUtils.js | 178 ++ .../dialogs/ACM/utils/CommissioningUtils.test.js | 94 + .../dialogs/ACM/utils/InstantiationUtils.js | 176 ++ .../dialogs/ACM/utils/InstantiationUtils.test.js | 54 + 55 files changed, 10002 insertions(+) create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/AccordionHeader.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/AccordionHeader.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/ChangeOrderStateModal.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/ChangeOrderStateModal.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/CommissioningModal.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/CommissioningModal.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/DeleteToscaTemplate.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/DeleteToscaTemplate.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/GetLocalToscaFileForUpload.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/GetLocalToscaFileForUpload.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/GetToscaTemplate.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/GetToscaTemplate.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/InstancePropertiesModal.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/InstancePropertiesModal.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElementItem.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElementItem.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElements.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElements.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationItem.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationItem.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationManagementModal.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationManagementModal.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationOrderStateChangeItem.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationOrderStateChangeItem.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/MonitorInstantiation.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/MonitorInstantiation.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/ReadAndConvertYaml.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/ReadAndConvertYaml.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/UploadToscaFile.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/UploadToscaFile.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/AccordionHeader.test.js.snap create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/ChangeOrderStateModal.test.js.snap create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/CommissioningModal.test.js.snap create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/DeleteToscaTemplate.test.js.snap create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/GetLocalToscaFileForUpload.test.js.snap create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/GetToscaTemplate.test.js.snap create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstancePropertiesModal.test.js.snap create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationElementItem.test.js.snap create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationElements.test.js.snap create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationItem.test.js.snap create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationManagementModal.test.js.snap create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationOrderStateChangeItem.test.js.snap create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/MonitorInstantiation.test.js.snap create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/ReadAndConvertYaml.test.js.snap create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/UploadToscaFile.test.js.snap create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/acmList.json create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/commonProps.json create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/fullTemplate.json create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/instanceProps.json create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/jsonEditorData.json create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/orderedStateJson.json create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/utils/CommissioningUtils.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/utils/CommissioningUtils.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/utils/InstantiationUtils.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/ACM/utils/InstantiationUtils.test.js (limited to 'gui-clamp/ui-react/src/components/dialogs/ACM') diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/AccordionHeader.js b/gui-clamp/ui-react/src/components/dialogs/ACM/AccordionHeader.js new file mode 100644 index 0000000..a34b5b3 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/AccordionHeader.js @@ -0,0 +1,120 @@ +/* + * ============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 styled from "styled-components"; +import { Accordion, Button } from "react-bootstrap"; + +const UninitialisedHeader = styled.div` + margin: 0; + padding: 0 0 1px 0; + border-bottom: 1px solid #7f7f7f; + background: #cccccc; + font-weight: normal; + border-radius: 0; +` + +const PassiveHeader = styled.div` + margin: 0; + padding: 0 0 1px 0; + border-bottom: 1px solid #7f7f7f; + background: #ffe87c; + font-weight: normal; + border-radius: 0; +` + +const RunningHeader = styled.div` + margin: 0; + padding: 0 0 1px 0; + border-bottom: 1px solid #7f7f7f; + background: #7ec699; + font-weight: normal; + border-radius: 0; +` + +const ToggleButton = styled(Button)` + color: #000000; + text-decoration: none; + + :hover, :active { + color: #000000; + text-decoration: none !important; + } +` + +const AccordionHeader = (props) => { + + const index = props.index; + + console.log("----------------"); + console.log(index); + console.log("----------------"); + + const toggleState = () => { + switch (props.orderedState) { + case 'UNINITIALISED': + return renderUninitialisedOrderedState(); + case 'PASSIVE': + return renderPassiveOrderedState(); + case 'RUNNING': + return renderRunningOrderedState(); + default: + return renderUninitialisedOrderedState(); + } + } + + const renderUninitialisedOrderedState = () => { + + return ( + + + { props.title } + + + ) + } + + const renderPassiveOrderedState = () => { + return ( + + + { props.title } + + + ) + } + + const renderRunningOrderedState = () => { + return ( + + + { props.title } + + + ) + } + + return ( + toggleState() + ); +} + +export default AccordionHeader; \ No newline at end of file diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/AccordionHeader.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/AccordionHeader.test.js new file mode 100644 index 0000000..987f1fc --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/AccordionHeader.test.js @@ -0,0 +1,50 @@ +/* + * ============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 { shallow } from "enzyme"; +import React from "react"; +import AccordionHeader from "./AccordionHeader"; +import toJson from "enzyme-to-json"; + +describe('Verify AccordionHeader', () => { + + const index = 0; + + it("renders correctly", () => { + const container = shallow(); + expect(toJson(container)).toMatchSnapshot(); + }); + + it("renders correctly when orderState is uninitialized", () => { + const container = shallow(); + expect(toJson(container)).toMatchSnapshot(); + }); + + it("renders correctly when orderState is passive", () => { + const container = shallow(); + expect(toJson(container)).toMatchSnapshot(); + }); + + it("renders correctly when orderState is running", () => { + const container = shallow(); + expect(toJson(container)).toMatchSnapshot(); + }); +}); \ No newline at end of file diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/ChangeOrderStateModal.js b/gui-clamp/ui-react/src/components/dialogs/ACM/ChangeOrderStateModal.js new file mode 100644 index 0000000..0c9e8b7 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/ChangeOrderStateModal.js @@ -0,0 +1,171 @@ +/* + * ============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 styled from "styled-components"; +import Modal from "react-bootstrap/Modal"; +import Button from "react-bootstrap/Button"; +import React, { useEffect, useState } from "react"; +import InstantiationOrderStateChangeItem from "./InstantiationOrderStateChangeItem"; +import ACMService from "../../../api/ACMService"; +import { Alert, Container, Dropdown } from "react-bootstrap"; + +const ModalStyled = styled(Modal)` + @media (min-width: 800px) { + .modal-xl { + max-width: 96%; + } + } + background-color: transparent; +` + +const DivWhiteSpaceStyled = styled.div` + overflow: auto; + min-width: 100%; + max-height: 300px; + padding: 5px 5px 0px 5px; + text-align: center; +` + +const AlertStyled = styled(Alert)` + margin-top: 10px; +` + +const ChangeOrderStateModal = (props) => { + const [show, setShow] = useState(true); + const [ACMIdentifierList, setACMIdentifierList] = useState([]); + const [orderedState, setOrderedState] = useState(''); + const [toscaOrderStateObject, setToscaOrderStateObject] = useState({}); + const [instantiationOrderStateError, setInstantiationOrderStateError] = useState(false); + const [instantiationOrderStateMsgError, setInstantiationOrderStateMsgError] = useState({}); + const [alertMessage, setAlertMessage] = useState(null); + + useEffect(async () => { + + const instantiationOrderState = await ACMService.getInstanceOrderState( + props.location.instantiationName, + props.location.instantiationVersion) + .catch(error => error.message); + + const orderStateJson = await instantiationOrderState.json(); + + console.log(orderStateJson); + + if (!instantiationOrderState.ok || orderStateJson['automationCompositionIdentifierList'].length === 0) { + setInstantiationOrderStateError(true); + setInstantiationOrderStateMsgError(orderStateJson); + } else { + setACMIdentifierList(orderStateJson['automationCompositionIdentifierList']); + setOrderedState(orderStateJson['orderedState']); + } + }, []); + + const handleDropSelect = (event) => { + console.log("handleDropDownChange called"); + + const stateChangeObject = { + orderedState: event, + automationCompositionIdentifierList: ACMIdentifierList + } + setToscaOrderStateObject(stateChangeObject); + setOrderedState(event); + } + + const handleSave = async () => { + console.log("handleSave called"); + + const response = await ACMService.changeInstanceOrderState(toscaOrderStateObject) + .catch(error => error.message); + + if (response.ok) { + successAlert(); + } else { + await errorAlert(response); + } + } + + const handleClose = () => { + console.log('handleClose called'); + setShow(false); + props.history.push('/'); + } + + const successAlert = () => { + console.log("successAlert called"); + setAlertMessage( + Order State Changed Success +

Order State Changed was successfully changed

+
+
); + } + + const errorAlert = async (response) => { + console.log("errorAlert called"); + setAlertMessage( + Order State Changed Failure +

An error occurred while trying to change order state

+

Status code: { await response.status } : { response.statusText }

+

Status Text: { await response.text() }

+
+
); + } + + return ( + + + Manage Instantiation + +
+ + + + + Select Order State + + + UNINITIALISED + PASSIVE + RUNNING + + + { + ACMIdentifierList.map((clIdList, index) => ( + + )) + } + + Can't get instantiation ordered state:
{ JSON.stringify(instantiationOrderStateMsgError, null, 2) }
+
+ + { alertMessage } + +
+ + + + +
+ ); +} + +export default ChangeOrderStateModal; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/ChangeOrderStateModal.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/ChangeOrderStateModal.test.js new file mode 100644 index 0000000..598e6e3 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/ChangeOrderStateModal.test.js @@ -0,0 +1,262 @@ +/* + * ============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 acmList from "./testFiles/acmList.json"; +import orderedStateJson from "./testFiles/orderedStateJson.json"; +import ACMService from "../../../api/ACMService"; + +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(); + }) + }); + + it("renders correctly", () => { + act(() => { + const tree = shallow(); + expect(toJson(tree)).toMatchSnapshot(); + }) + }); + + it('should have two Button elements', () => { + act(() => { + const container = shallow() + expect(container.find('Button').length).toEqual(2); + }) + }); + + it('should have one dropdown element', () => { + act(() => { + const container = shallow() + expect(container.find('Dropdown').length).toEqual(1); + }); + }); + + it('handleDropSelect called when dropdown clicked', () => { + const history = createMemoryHistory(); + const component = mount() + + 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() + + 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() + + 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(ACMService, 'getInstanceOrderState') + .mockImplementationOnce(() => { + return Promise.resolve({ + ok: true, + status: 200, + text: () => "OK", + json: () => { + return Promise.resolve(orderedStateJson) + } + }) + } + ) + + const changeInstanceOrderStateSpy = jest.spyOn(ACMService, 'changeInstanceOrderState') + .mockImplementationOnce(() => { + return Promise.resolve({ + ok: true, + status: 200, + text: () => "OK", + json: () => { + return Promise.resolve(acmList) + } + }) + } + ) + + const component = mount() + + 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"); + }); + }); + + it('handleSave called when save button clicked and response is not ok', async () => { + jest.resetAllMocks() + const getInstanceOrderStateSpy = jest.spyOn(ACMService, 'getInstanceOrderState') + .mockImplementationOnce(() => { + return Promise.resolve({ + ok: true, + status: 200, + text: () => "OK", + json: () => { + return Promise.resolve(orderedStateJson) + } + }) + } + ) + + const changeInstanceOrderStateSpy = jest.spyOn(ACMService, 'changeInstanceOrderState') + .mockImplementationOnce(() => { + return Promise.resolve({ + ok: false, + status: 200, + text: () => "OK", + json: () => { + return Promise.resolve(acmList) + } + }) + } + ) + + const component = mount() + + 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"); + }); + }); + + it('Check useEffect is being called', async () => { + jest.resetAllMocks() + jest.spyOn(ACMService, 'getInstanceOrderState') + .mockImplementationOnce(() => { + return Promise.resolve({ + ok: true, + status: 200, + text: () => "OK", + json: () => { + return Promise.resolve(orderedStateJson) + } + }) + } + ) + + jest.spyOn(ACMService, 'changeInstanceOrderState') + .mockImplementationOnce(() => { + return Promise.resolve({ + ok: true, + status: 200, + text: () => "OK", + json: () => { + return Promise.resolve(acmList) + } + }) + } + ) + + const component = mount() + + const useEffect = jest.spyOn(React, "useEffect"); + act(async () => { + await flushPromises() + component.update() + await expect(useEffect).toHaveBeenCalled(); + }) + component.unmount(); + }); +}); diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/CommissioningModal.js b/gui-clamp/ui-react/src/components/dialogs/ACM/CommissioningModal.js new file mode 100644 index 0000000..db71cd9 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/CommissioningModal.js @@ -0,0 +1,160 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2022 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 Modal from "react-bootstrap/Modal"; +import Button from "react-bootstrap/Button"; +import React, { useEffect, useState } from "react"; +import styled from "styled-components"; +import ACMService from "../../../api/ACMService"; +import { Alert } from "react-bootstrap"; +import CommissioningUtils from "./utils/CommissioningUtils"; + +const ModalStyled = styled(Modal)` + @media (min-width: 800px) { + .modal-xl { + max-width: 96%; + } + } + background-color: transparent; +` + +const StyledMessagesDiv = styled.div` + overflow: auto; + min-width: 100%; + max-height: 300px; + padding: 5px 5px 0px 5px; + text-align: center; +` + +const AlertStyled = styled(Alert)` + margin-top: 10px; +` + +const CommissioningModal = (props) => { + const [fullToscaTemplate, setFullToscaTemplate] = useState({}); + const [toscaInitialValues, setToscaInitialValues] = useState({}); + const [commonProperties, setCommonProperties] = useState({}) + const [toscaJsonSchema, setToscaJsonSchema] = useState({}); + const [jsonEditor, setJsonEditor] = useState(null); + const [show, setShow] = useState(true); + const [alertMessages, setAlertMessages] = useState(); + const [commonPropertiesResponseOk, setCommonPropertiesResponseOk] = useState(true); + const [serviceTemplateResponseOk, setServiceTemplateResponseOk] = useState(true); + const name = 'ToscaServiceTemplateSimple'; + const version = '1.0.0'; + + useEffect(async () => { + const toscaTemplateResponse = await ACMService.getToscaTemplate(name, version) + .catch(error => error.message); + const toscaCommonProperties = await ACMService.getCommonOrInstanceProperties(name, version, true) + .catch(error => error.message); + + if (!toscaCommonProperties.ok) { + const errorResponse = await toscaCommonProperties.json() + console.log(errorResponse) + setCommonProperties(errorResponse) + setCommonPropertiesResponseOk(false); + } + + if (!toscaTemplateResponse.ok) { + const errorResponse = await toscaTemplateResponse.json() + console.log(errorResponse) + setFullToscaTemplate(errorResponse) + setServiceTemplateResponseOk(false); + } + + if (toscaTemplateResponse.ok && toscaCommonProperties.ok) { + const renderedEditorObjects = CommissioningUtils.renderJsonEditor(toscaTemplateResponse, toscaCommonProperties) + setFullToscaTemplate((await renderedEditorObjects).fullTemplate) + setToscaJsonSchema((await renderedEditorObjects).propertySchema) + setJsonEditor((await renderedEditorObjects).editorTemp) + setToscaInitialValues((await renderedEditorObjects).toscaInitialValues) + + } + + }, []); + + const handleClose = () => { + console.log('handleClose called'); + setShow(false); + props.history.push('/'); + } + + 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 ACMService.deleteToscaTemplate('ToscaServiceTemplateSimple', "1.0.0") + + const recommissioningResponse = await ACMService.uploadToscaFile(fullToscaTemplate) + + await receiveResponseFromCommissioning(recommissioningResponse) + } + + const receiveResponseFromCommissioning = async (response) => { + console.log("receiveResponseFromCommissioning called") + setAlertMessages(await CommissioningUtils.getAlertMessages(response)); + }; + + return ( + + + Change ACM Common Properties + +
+
+ +
+ Can't get service template:
{ JSON.stringify(fullToscaTemplate, null, 2) }
+ Can't get common properties:
{ JSON.stringify(commonProperties, null, 2) }
+ +
+ + { alertMessages } + + + + + + + + ); +} + +export default CommissioningModal; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/CommissioningModal.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/CommissioningModal.test.js new file mode 100644 index 0000000..e3a50be --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/CommissioningModal.test.js @@ -0,0 +1,227 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2022 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 { 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 ACMService from "../../../api/ACMService"; + +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}" + }) + }) + + afterAll(() => { + global.fetch = unmockedFetch + }) + + beforeEach(() => { + logSpy.mockClear() + }) + + it("renders without crashing", () => { + shallow(); + }); + + it("renders correctly", () => { + const tree = shallow(); + expect(toJson(tree)).toMatchSnapshot(); + }); + + it('should have three Button elements', () => { + const container = shallow() + expect(container.find('Button').length).toEqual(3); + }); + + it('handleClose called when bottom button clicked', () => { + const history = createMemoryHistory(); + const component = mount() + + 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() + + 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() + 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(ACMService, 'getToscaTemplate').mockImplementation(() => Promise.resolve({ + ok: false, + status: 200, + text: () => "OK", + json: () => fullTemplate + })) + + mount() + await act(async () => { + expect(fetchMock).toHaveBeenCalled(); + }); + }); + + it('getCommonProperties gets called in useEffect with error', async() => { + const fetchMock = jest.spyOn(ACMService, 'getToscaTemplate').mockImplementation(() => Promise.resolve({ + ok: false, + status: 200, + text: () => "OK", + json: () => commonProperties + })) + + mount() + 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() + 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() + 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() + act(async () => { + expect(setToscaJsonEditor).toHaveBeenCalledTimes(1); + }); + }); + + it('Check useEffect is being called', async () => { + const useEffect = jest.spyOn(React, "useEffect"); + mount() + await act(async () => { + expect(useEffect).toHaveBeenCalled(); + }) + }); + + it('test handleCommission called on click', async () => { + const deleteToscaTemplateSpy = jest.spyOn(ACMService, 'deleteToscaTemplate').mockImplementation(() => { + Promise.resolve({ + ok: true, + status: 200, + text: () => "OK", + json: () => "{handleCommissioning}" + }) + }) + const uploadToscaTemplateSpy = jest.spyOn(ACMService, 'uploadToscaFile').mockImplementation(() => { + Promise.resolve({ + ok: true, + status: 200, + text: () => "OK", + json: () => "{uploadToscaFile}" + }) + }) + + + const useStateSpy = jest.spyOn(React, 'useState') + + const component = shallow() + 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/ACM/DeleteToscaTemplate.js b/gui-clamp/ui-react/src/components/dialogs/ACM/DeleteToscaTemplate.js new file mode 100644 index 0000000..3dbf7bd --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/DeleteToscaTemplate.js @@ -0,0 +1,56 @@ +/* + * ============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, { useState } from "react"; +import Button from "react-bootstrap/Button"; +import ACMService from "../../../api/ACMService"; + +const DeleteToscaTemplate = props => { + + const deleteTemplateHandler = async () => { + console.log('deleteTemplateHandler called'); + + const response = await ACMService.deleteToscaTemplate(props.templateName, props.templateVersion) + .catch(error => error.message); + + if(!response.ok) { + console.log('deleteTemplateHandler called with error'); + } else { + console.log('deleteTemplateHandler called'); + } + // console.log('Response is ok: ' + response.ok); + + props.onDeleteToscaServiceTemplate(response); + + } + + return ( + + + + ); + + +} + +export default DeleteToscaTemplate; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/DeleteToscaTemplate.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/DeleteToscaTemplate.test.js new file mode 100644 index 0000000..c52bdea --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/DeleteToscaTemplate.test.js @@ -0,0 +1,54 @@ +/* + * ============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 DeleteToscaTemplate from "./DeleteToscaTemplate"; + +describe('Verify DeleteToscaTemplate', () => { + + it("renders without crashing", () => { + shallow(); + }); + + it("renders correctly", () => { + const tree = shallow(); + expect(toJson(tree)).toMatchSnapshot(); + }); + + it('should have a Button element', () => { + const container = shallow() + expect(container.find('Button').length).toEqual(1); + }); + + it('button should call deleteTemplateHandler when clicked', async () => { + const component = mount() + const logSpy = jest.spyOn(console, 'log'); + + component.find('[variant="danger"]').simulate('click'); + expect(logSpy).toHaveBeenCalledWith('deleteTemplateHandler called'); + }); + + it('should have a Button element with specified text', () => { + const container = shallow() + expect(container.find('Button').text()).toBe('Delete Tosca Service Template'); + }); +}); diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/GetLocalToscaFileForUpload.js b/gui-clamp/ui-react/src/components/dialogs/ACM/GetLocalToscaFileForUpload.js new file mode 100644 index 0000000..013dd89 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/GetLocalToscaFileForUpload.js @@ -0,0 +1,150 @@ +/* + * ============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, { useState } from 'react'; +import Button from "react-bootstrap/Button"; +import Modal from 'react-bootstrap/Modal'; +import Form from 'react-bootstrap/Form'; +import Row from 'react-bootstrap/Row'; +import styled from 'styled-components'; +import Alert from 'react-bootstrap/Alert'; +import * as yaml from "js-yaml"; +import UploadToscaFile from "./UploadToscaFile"; + +const ModalStyled = styled(Modal)` + background-color: transparent; +` + +const StyledMessagesDiv = styled.div` + overflow: auto; + min-width: 100%; + max-height: 300px; + padding: 5px 5px 0px 5px; + text-align: center; +` + +const GetLocalToscaFileForUpload = (props) => { + const [selectedFile, setSelectedFile] = useState(); + const [fileIsSelected, setFileIsSelected] = useState(false); + const [toscaJsonObject, setToscaJsonObject] = useState({}); + const [show, setShow] = useState(true); + const [alertMessages, setAlertMessages] = useState(); + + const handleClose = () => { + console.log('handleClose called'); + setShow(false); + props.history.push('/'); + } + + const fileChangeHandler = (event) => { + event.preventDefault(); + console.log('fileChangeHandler called'); + + if (event.currentTarget.files[0] !== undefined) { + console.log('file defined'); + setSelectedFile(event.currentTarget.files[0]); + setFileIsSelected(true); + + const file = event.currentTarget.files[0]; + + setAlertMessages([]); + + const fileReader = new FileReader(); + + fileReader.onload = () => { + const jsonObj = yaml.load(fileReader.result, 'utf8'); + setToscaJsonObject(jsonObj); + } + + fileReader.readAsText(file); + + } else { + return; + } + }; + + const receiveResponseFromUpload = async (response) => { + + if (await response.ok) { + setAlertMessages( + Upload Success +

Tosca Service Template from { selectedFile.name } was Successfully Uploaded

+
+

Type: { selectedFile.type }

Size: { +selectedFile.size / 1000 }Kb

+
); + } + else { + setAlertMessages( + Upload Failure +

Tosca Service Template from { selectedFile.name } failed to upload

+

Status code: { await response.status }: { response.statusText }

+

Response Text: { await response.text() }

+
+

Type: { selectedFile.type }

Size: { +selectedFile.size / 1000 }Kb

+
); + } + }; + + return ( + + + Upload Tosca to Commissioning API + +
+
+ +
+ + + + Only .yaml, .yml and .json files are supported + + + + + + + { alertMessages } + + +
+
+
+ + + +
+ ); +} + +export default GetLocalToscaFileForUpload; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/GetLocalToscaFileForUpload.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/GetLocalToscaFileForUpload.test.js new file mode 100644 index 0000000..9b885c6 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/GetLocalToscaFileForUpload.test.js @@ -0,0 +1,122 @@ +/* + * ============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 { act } from "react-dom/test-utils"; +import GetLocalToscaFileForUpload from './GetLocalToscaFileForUpload'; +import { createMemoryHistory } from 'history'; + + +describe('Verify GetLocalToscaFileForUpload', () => { + const fs = require('fs'); + let testFile = fs.readFileSync('src/components/dialogs/Policy/toscaData.test.json'); + const file = new Blob([testFile], { type: 'file' }); + + beforeEach(() => { + fetch.resetMocks(); + fetch.mockImplementation(() => { + return 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" + }); + } + }); + }); + }) + + it("renders without crashing", () => { + shallow(); + }); + + it("renders correctly", () => { + const tree = shallow(); + expect(toJson(tree)).toMatchSnapshot(); + }); + + it('should have a UploadToscaFile element', () => { + const container = shallow() + expect(container.find('UploadToscaFile').length).toEqual(1); + }); + + it('handleClose called when bottom button clicked', () => { + const history = createMemoryHistory(); + const component = mount() + const logSpy = jest.spyOn(console, 'log'); + + + act(() => { + component.find('[variant="secondary"]').simulate('click'); + expect(logSpy).toHaveBeenCalledWith('handleClose called'); + }); + }); + + it('handleClose called when top-right button clicked', () => { + const history = createMemoryHistory(); + const component = mount() + const logSpy = jest.spyOn(console, 'log'); + + + act(() => { + component.find('[size="lg"]').get(0).props.onHide(); + expect(logSpy).toHaveBeenCalledWith('handleClose called'); + }); + }); + + it('should call fileChangeHandler on change, file undefined', () => { + const component = mount(); + const logSpy = jest.spyOn(console, 'log'); + const event = { + preventDefault() { + }, + currentTarget: { files: [] } + }; + + act(() => { + component.find('[type="file"]').get(0).props.onChange(event); + expect(logSpy).toHaveBeenCalledWith('fileChangeHandler called'); + }); + }); + + it('should call fileChangeHandler on change, file defined', async () => { + const component = mount(); + const logSpy = jest.spyOn(console, 'log'); + const event = { + preventDefault() { + }, + currentTarget: { files: [file] } + }; + + act(async () => { + component.find('[type="file"]').get(0).props.onChange(event); + expect(logSpy).toHaveBeenCalledWith('file defined'); + }); + }); +}); diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/GetToscaTemplate.js b/gui-clamp/ui-react/src/components/dialogs/ACM/GetToscaTemplate.js new file mode 100644 index 0000000..e86c2cf --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/GetToscaTemplate.js @@ -0,0 +1,54 @@ +/* + * ============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, { useState } from "react"; +import Button from "react-bootstrap/Button"; +import ACMService from "../../../api/ACMService"; + +const GetToscaTemplate = (props) => { + + const getTemplateHandler = async () => { + + const response = await ACMService.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); + + } + + return ( + + + + ); + + +} + +export default GetToscaTemplate; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/GetToscaTemplate.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/GetToscaTemplate.test.js new file mode 100644 index 0000000..71fbeec --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/GetToscaTemplate.test.js @@ -0,0 +1,85 @@ +/* + * ============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 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(); + }); + + it("renders correctly", () => { + const tree = shallow(); + expect(toJson(tree)).toMatchSnapshot(); + }); + + it('should have a Button element', () => { + const container = shallow() + expect(container.find('Button').length).toEqual(1); + }); + + 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() + const logSpy = jest.spyOn(console, 'log'); + + 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', () => { + const container = shallow() + expect(container.find('Button').text()).toBe('Pull Tosca Service Template'); + }); +}); diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstancePropertiesModal.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstancePropertiesModal.js new file mode 100644 index 0000000..8d0023b --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/InstancePropertiesModal.js @@ -0,0 +1,173 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2022 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, { useEffect, useState } from "react"; +import Modal from "react-bootstrap/Modal"; +import styled from "styled-components"; +import Button from "react-bootstrap/Button"; +import ACMService from "../../../api/ACMService"; +import Alert from "react-bootstrap/Alert"; +import * as PropTypes from "prop-types"; +import InstantiationUtils from "./utils/InstantiationUtils"; + +const ModalStyled = styled(Modal)` + @media (min-width: 800px) { + .modal-xl { + max-width: 96%; + } + } + background-color: transparent; +` + +const DivWhiteSpaceStyled = styled.div` + overflow: auto; + min-width: 100%; + max-height: 300px; + padding: 5px 5px 0px 5px; + text-align: center; +` + +const AlertStyled = styled(Alert)` + margin-top: 10px; +` + +const templateName = "ToscaServiceTemplateSimple"; +const templateVersion = "1.0.0"; + +function Fragment(props) { + return null; +} + +Fragment.propTypes = { children: PropTypes.node }; +const InstancePropertiesModal = (props) => { + const [show, setShow] = useState(true); + const [toscaFullTemplate, setToscaFullTemplate] = useState({}); + const [jsonEditor, setJsonEditor] = useState(null); + const [alertMessage, setAlertMessage] = useState(null); + const [instancePropertiesGlobal, setInstancePropertiesGlobal] = useState({}); + const [serviceTemplateResponseOk, setServiceTemplateResponseOk] = useState(true); + const [instancePropertiesResponseOk, setInstancePropertiesResponseOk] = useState(true); + const [instanceName, setInstanceName] = useState('') + + useEffect(async () => { + const toscaTemplateResponse = await ACMService.getToscaTemplate(templateName, templateVersion) + .catch(error => error.message); + + const toscaInstanceProperties = await ACMService.getCommonOrInstanceProperties(templateName, templateVersion, false) + .catch(error => error.message); + + if (!toscaInstanceProperties.ok) { + 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); + setServiceTemplateResponseOk(false); + } + + if (toscaTemplateResponse.ok && toscaInstanceProperties.ok) { + const renderedJsonSchema = await InstantiationUtils.parseJsonSchema(toscaTemplateResponse, toscaInstanceProperties); + setToscaFullTemplate(await (renderedJsonSchema).fullTemplate); + setJsonEditor(await (renderedJsonSchema).jsonEditor); + } + + }, []); + + const handleClose = () => { + console.log('handleClose called'); + setShow(false); + props.history.push('/'); + } + + const handleSave = async () => { + console.log("handleSave called"); + + setInstanceName(instanceName); + + console.log("instanceName to be saved is: " + instanceName); + + if (jsonEditor != null) { + setToscaFullTemplate(InstantiationUtils.updateTemplate(jsonEditor.getValue(), toscaFullTemplate)); + } + + const response = await ACMService.createInstanceProperties(instanceName, toscaFullTemplate) + .catch(error => error.message); + + if (response.ok) { + successAlert(); + } else { + await errorAlert(response); + } + } + + const successAlert = () => { + console.log("successAlert called"); + setAlertMessage( + Instantiation Properties Success +

Instance Properties was successfully saved

+
+
); + } + + const errorAlert = async (response) => { + console.log("errorAlert called"); + setAlertMessage( + Instantiation Properties Failure +

An error occurred while trying to save

+

Status code: { await response.status } : { response.statusText }

+

Status Text: { await response.text() }

+
+
); + } + + return ( + + + Create Tosca Instance Properties + +
+ +
+ Can't get service template:
{ JSON.stringify(toscaFullTemplate, null, 2) }
+ Can't get instance properties:
{ JSON.stringify(instancePropertiesGlobal, null, 2) }
+ + + { alertMessage } + +
+ + + + + + ); +} + +export default InstancePropertiesModal; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstancePropertiesModal.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstancePropertiesModal.test.js new file mode 100644 index 0000000..5c617bf --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/InstancePropertiesModal.test.js @@ -0,0 +1,103 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2022 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 InstancePropertiesModal from "./InstancePropertiesModal"; +import toJson from "enzyme-to-json"; +import { createMemoryHistory } from "history"; +import { act } from "react-dom/test-utils"; + +let logSpy = jest.spyOn(console, 'log') + +describe('Verify InstancePropertiesModal', () => { + + const unmockedFetch = global.fetch + beforeAll(() => { + global.fetch = () => + Promise.resolve({ + status: 200, + text: () => "OK", + json: () => "{GlobalFetch}" + }); + }); + + afterAll(() => { + global.fetch = unmockedFetch + }); + + beforeEach(() => { + logSpy.mockClear() + }); + + it("renders without crashing", () => { + shallow(); + }); + + it("renders correctly", () => { + const tree = shallow(); + expect(toJson(tree)).toMatchSnapshot(); + }); + + it('should have save button element', () => { + const container = shallow() + expect(container.find('[variant="primary"]').length).toEqual(1); + }); + + it('should have close button element', () => { + const container = shallow() + expect(container.find('[variant="secondary"]').length).toEqual(1); + }); + + it('handleCreateUpdateToscaInstanceProperties called when save button clicked', () => { + const component = mount() + + act(() => { + component.find('[variant="primary"]').simulate('click'); + expect(logSpy).toHaveBeenCalledWith('handleSave called'); + }); + }); + + it('handleClose called when close button clicked', () => { + const history = createMemoryHistory(); + const component = mount() + + act(() => { + component.find('[variant="secondary"]').simulate('click'); + expect(logSpy).toHaveBeenCalledWith('handleClose called'); + }); + }); + + it('handleSave called when save button clicked', () => { + const component = mount() + + act(() => { + component.find('[variant="primary"]').simulate('click'); + expect(logSpy).toHaveBeenCalledWith('handleSave called'); + }); + }); + + it('Check useEffect is being called', async () => { + const useEffect = jest.spyOn(React, "useEffect"); + mount() + await act(async () => { + expect(useEffect).toHaveBeenCalled(); + }); + }); +}); diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElementItem.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElementItem.js new file mode 100644 index 0000000..0e2c407 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElementItem.js @@ -0,0 +1,124 @@ +/* + * ============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, { useEffect, useState } from "react"; +import styled from "styled-components"; +import { Button } from "react-bootstrap"; + +const UninitialisedBox = styled.div` + margin: 0; + padding: 0 0 1px 0; + border-bottom: 1px solid #7f7f7f; + background: #cccccc; + font-weight: normal; + border-radius: 0; +` +const PassiveBox = styled.div` + margin: 0; + padding: 0 0 1px 0; + border-bottom: 1px solid #7f7f7f; + background: #ffe87c; + font-weight: normal; + border-radius: 0; +` +const RunningBox = styled.div` + margin: 0; + padding: 0 0 1px 0; + border-bottom: 1px solid #7f7f7f; + background: #7ec699; + font-weight: normal; + border-radius: 0; +` +const ButtonStyle = styled(Button)` + margin: 0; + padding: 5px 12px; + width: 100%; + text-align: left; + background: transparent !important; + color: #000000 !important; + text-decoration: none !important; + border: none; + border-radius: 0; + + :hover, :active :focus { + color: #000000 !important; + outline: 0 !important; + box-shadow: none !important; + background: transparent !important; + text-decoration: none !important; + } +` + +const InstantiationElementItem = (props) => { + const [title, setTitle] = useState(""); + + useEffect(() => { + const title = props.title.split("."); + setTitle(title[4]); + }, []); + + const toggleState = () => { + switch (props.orderedState) { + case 'UNINITIALISED': + return renderUninitialisedOrderedState(); + case 'PASSIVE': + return renderPassiveOrderedState(); + case 'RUNNING': + return renderRunningOrderedState(); + } + } + + const renderUninitialisedOrderedState = () => { + return ( + + + + ) + } + + const renderPassiveOrderedState = () => { + return ( + + + + ) + } + + const renderRunningOrderedState = () => { + return ( + + + + ) + } + + return ( + + { toggleState() } + + ); +} + +export default InstantiationElementItem; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElementItem.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElementItem.test.js new file mode 100644 index 0000000..7b1c1ec --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElementItem.test.js @@ -0,0 +1,49 @@ +/* + * ============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 { shallow } from "enzyme"; +import toJson from "enzyme-to-json"; +import React from "react"; +import InstantiationElementItem from "./InstantiationElementItem"; + +describe('Verify InstantiationElementItem', () => { + const index = 0; + + it("renders correctly", () => { + const container = shallow(); + expect(toJson(container)).toMatchSnapshot(); + }); + + it("renders correctly when orderState is uninitialized", () => { + const container = shallow(); + expect(toJson(container)).toMatchSnapshot(); + }); + + it("renders correctly when orderState is passive", () => { + const container = shallow(); + expect(toJson(container)).toMatchSnapshot(); + }); + + it("renders correctly when orderState is running", () => { + const container = shallow(); + expect(toJson(container)).toMatchSnapshot(); + }); +}); \ No newline at end of file diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElements.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElements.js new file mode 100644 index 0000000..d8e6348 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElements.js @@ -0,0 +1,41 @@ +/* + * ============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, { useEffect, useState } from "react"; +import InstantiationElementItem from "./InstantiationElementItem"; + +const InstantiationElements = (props) => { + const [clElements, setClElements] = useState([]); + + useEffect(() => { + setClElements(Object.values(props.elements)); + }, []); + + return ( + + { + clElements.map((clEl, index) => ( + + )) + } + + ); +} + +export default InstantiationElements; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElements.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElements.test.js new file mode 100644 index 0000000..127a886 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationElements.test.js @@ -0,0 +1,33 @@ +/* + * ============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 toJson from "enzyme-to-json"; +import { shallow } from "enzyme"; +import React from "react"; +import InstantiationElements from "./InstantiationElements"; + +describe('Verify InstantiationElements', () => { + const container = shallow(); + + it("renders correctly", () => { + expect(toJson(container)).toMatchSnapshot(); + }); +}); \ No newline at end of file diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationItem.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationItem.js new file mode 100644 index 0000000..7b8e453 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationItem.js @@ -0,0 +1,52 @@ +/* + * ============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 styled from 'styled-components'; + +import { Accordion, Button, Card } from "react-bootstrap"; +import AccordionHeader from "./AccordionHeader"; + +const AccordionBody = styled.div` + margin: 0; + padding: 0; + border: 1px solid #7f7f7f; + border-radius: 0; +` + +const CardBody = styled(Card.Body)` + padding: 0; + margin: 0; +` + +const InstantiationItem = (props) => { + + return ( + + + + + { props.children } + + + + ); +} + +export default InstantiationItem; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationItem.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationItem.test.js new file mode 100644 index 0000000..fe4aaf8 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationItem.test.js @@ -0,0 +1,53 @@ +/* + * ============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 { shallow } from "enzyme"; +import toJson from "enzyme-to-json"; + +import InstantiationItem from "./InstantiationItem"; + +describe('Verify InstantiationItem', () => { + + const index = 0; + const title = "PMSH Instance"; + const orderState = "UNINITIALISED"; + const container = shallow(); + + it("renders without crashing", () => { + shallow(); + }); + + it("renders correctly", () => { + expect(toJson(container)).toMatchSnapshot(); + }); + + it("should contain an Accordion", () => { + const accordion = container.find('Accordion'); + expect(accordion).toHaveLength(1); + }); + + it("should contain an AccordionHeader", () => { + const accordion = container.find('AccordionHeader'); + expect(accordion).toHaveLength(1); + }); + +}); \ No newline at end of file diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationManagementModal.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationManagementModal.js new file mode 100644 index 0000000..78c2685 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationManagementModal.js @@ -0,0 +1,219 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2022 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 Modal from "react-bootstrap/Modal"; +import { Alert, Container, Table } from "react-bootstrap"; +import Button from "react-bootstrap/Button"; +import React, { useEffect, useState } from "react"; +import styled from "styled-components"; +import { Link } from "react-router-dom"; +import ACMService from "../../../api/ACMService"; +import Row from "react-bootstrap/Row"; +import InstantiationUtils from "./utils/InstantiationUtils"; + +const ModalStyled = styled(Modal)` + background-color: transparent; +` + +const HorizontalSpace = styled.div` + padding-right: 2px; + padding-left: 2px; +`; + +const DivWhiteSpaceStyled = styled.div` + overflow: auto; + min-width: 100%; + max-height: 300px; + padding: 5px 5px 0px 5px; + text-align: center; +` +const InstantiationManagementModal = (props) => { + const [show, setShow] = useState(true); + const [instantiationList, setInstantiationList] = useState([]); + const [alertMessage, setAlertMessage] = useState(null); + + useEffect(async () => { + + const response = await ACMService.getACMInstantiation(); + + const instantiationListJson = await response.json(); + + console.log(instantiationListJson); + + const parsedInstantiationList = InstantiationUtils.parseInstantiationList(instantiationListJson['automationCompositionList']); + + setInstantiationList(parsedInstantiationList); + }, []); + + const getBackgroundColor = (index) => { + if (index % 2 === 0) { + return 'Silver'; + } + + return 'White'; + } + + const deleteInstantiationHandler = async (index, instantiation) => { + console.log("deleteInstantiationHandler called"); + + console.log(instantiation); + + if (instantiation.disableDelete) { + return; + } + + const name = instantiation.name; + const version = instantiation.version; + + const response = await ACMService.deleteInstantiation(name, version); + + updateList(index); + + if (response.ok) { + successAlert(); + } else { + await errorAlert(response); + } + } + + const updateList = (index) => { + console.log("updateList called") + + const updatedList = [...instantiationList]; + updatedList.splice(index, 1); + + setInstantiationList(updatedList); + } + + const handleClose = () => { + console.log("handleClose called"); + setShow(false); + props.history.push('/'); + } + + const successAlert = () => { + console.log("successAlert called"); + setAlertMessage( + Deletion of Instantiation Success +

Deletion of Instantiation was successful!

+
+
); + } + + const errorAlert = async (response) => { + console.log("errorAlert called"); + setAlertMessage( + Deletion of Instantiation Failure +

An error occurred while trying to delete instantiation

+

Status code: { await response.status } : { response.statusText }

+

Status Text: { await response.text() }

+
+
); + } + + const clearErrors = () => { + console.log("clearErrors called"); + setAlertMessage(null); + } + + return ( + + + Manage Instances + + + + + + + + + + + + + + + + + + + + + + + + + + + { instantiationList.map((instantiation, index) => { + return ( + + + + + + + + + + ) + }) } + +
#Instantiation NameEdit InstantiationDelete InstantiationChange Order StateInstantiation Order StateInstantiation Current State
{ index + 1 }{ instantiation.name } + + + + + + + + + + { instantiation.orderedState }{ instantiation.currentState }
+ + { alertMessage } + +
+ + + + +
+ ); +} + +export default InstantiationManagementModal; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationManagementModal.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationManagementModal.test.js new file mode 100644 index 0000000..e511ce0 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationManagementModal.test.js @@ -0,0 +1,155 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2022 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 ACMService from "../../../api/ACMService"; +import acmLoopList from "./testFiles/acmList.json"; +import {BrowserRouter} from "react-router-dom"; + +const logSpy = jest.spyOn(console, 'log') +const history = createMemoryHistory(); + +describe('Verify Instantiation Management', () => { + const flushPromises = () => new Promise(setImmediate); + + beforeEach(() => { + logSpy.mockClear(); + }); + + it("renders without crashing", () => { + shallow(); + }); + it("renders correctly", () => { + const tree = shallow(); + expect(toJson(tree)).toMatchSnapshot(); + }); + + it('should have a close Button element', () => { + const container = shallow(); + const button = container.find('[variant="secondary"]').at(2); + + expect(button.text()).toEqual("Close"); + }); + + it('should have a Create Instance Button element', () => { + const container = shallow(); + 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(); + const button = container.find('[variant="secondary"]').at(0); + + expect(button.text()).toEqual("Monitor Instantiations"); + }); + + it('handleClose called when bottom button clicked', () => { + const container = shallow(); + 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(); + + 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(); + 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(ACMService, 'getACMInstantiation') + .mockImplementationOnce(async () => { + return Promise.resolve({ + ok: true, + status: 200, + text: () => "OK", + json: () => { + return Promise.resolve(acmLoopList); + } + }); + }); + + const component = mount( + + + + ); + const useEffect = jest.spyOn(React, "useEffect"); + + await act(async () => { + await flushPromises() + component.update(); + await expect(useEffect).toHaveBeenCalled(); + + }); + component.unmount(); + }); + + it('set state gets called for setInstantiationList useEffect on success', async () => { + const setInstantiationList = jest.fn(); + const setDeleteInstantiation = true; + const history = createMemoryHistory(); + jest + .spyOn(global, 'fetch') + .mockImplementation(() => + Promise.resolve({ + ok: true, + status: 200, + text: () => "OK", + json: () => acmLoopList + }) + ) + + mount( + + + + ); + act(async () => { + expect(setInstantiationList).toHaveBeenCalledTimes(1); + expect(setDeleteInstantiation).toHaveBeenCalledTimes(1); + }); + }); +}); diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationOrderStateChangeItem.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationOrderStateChangeItem.js new file mode 100644 index 0000000..8545943 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationOrderStateChangeItem.js @@ -0,0 +1,113 @@ +/* + * ============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 styled from "styled-components"; + +const UninitialisedBox = styled.div` + margin: 2px -15px; + padding: 8px; + outline: none; + font-size: 16px; + font-weight: normal; + background: #cccccc; + border-radius: 8px; + border: 1px solid #7f7f7f; + + &:focus, &:active, &:after { + outline: none; + border-radius: 8px; + } +` + +const PassiveBox = styled.div` + margin: 2px -15px; + padding: 8px; + outline: none; + font-size: 16px; + font-weight: normal; + background: #ffe87c; + border-radius: 8px; + border: 1px solid #7f7f7f; + + &:focus, &:active, &:after { + outline: none; + border-radius: 8px; + } +` + +const RunningBox = styled.div` + margin: 2px -15px; + padding: 8px; + outline: none; + font-size: 16px; + font-weight: normal; + background: #7ec699; + border-radius: 8px; + border: 1px solid #7f7f7f; + + &:focus, &:active, &:after { + outline: none; + border-radius: 8px; + } +` + +const InstantiationOrderStateChangeItem = (props) => { + + const renderOrderStateItem = () => { + console.log("renderOrderStateItem called"); + switch (props.orderState) { + case 'UNINITIALISED': + console.log("called UNINITIALISED"); + return renderUninitialisedOrderedState(); + case 'PASSIVE': + console.log("called PASSIVE"); + return renderPassiveOrderedState(); + case 'RUNNING': + console.log("called RUNNING"); + return renderRunningOrderedState(); + } + } + + const renderUninitialisedOrderedState = () => { + return ( + { props.title } + ) + } + + const renderPassiveOrderedState = () => { + return ( + { props.title } + ) + } + + const renderRunningOrderedState = () => { + return ( + { props.title } + ) + } + + return ( + + { renderOrderStateItem() } + + ); +} + +export default InstantiationOrderStateChangeItem; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationOrderStateChangeItem.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/InstantiationOrderStateChangeItem.test.js new file mode 100644 index 0000000..3981ea5 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/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(); + }); + + it("renders correctly", () => { + const tree = shallow(); + expect(toJson(tree)).toMatchSnapshot(); + }); + + it("renders correctly when orderState is uninitialized", () => { + const tree = shallow(); + expect(toJson(tree)).toMatchSnapshot(); + }); + + it("renders correctly when orderState is passive", () => { + const tree = shallow(); + expect(toJson(tree)).toMatchSnapshot(); + }); + + it("renders correctly when orderState is running", () => { + const tree = shallow(); + expect(toJson(tree)).toMatchSnapshot(); + }); +}); diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/MonitorInstantiation.js b/gui-clamp/ui-react/src/components/dialogs/ACM/MonitorInstantiation.js new file mode 100644 index 0000000..5699b56 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/MonitorInstantiation.js @@ -0,0 +1,85 @@ +/* + * ============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, { useEffect, useState } from "react"; +import styled from "styled-components"; +import Modal from "react-bootstrap/Modal"; +import Button from "react-bootstrap/Button"; +import InstantiationItem from "./InstantiationItem"; +import ACMService from "../../../api/ACMService"; +import InstantiationElements from "./InstantiationElements"; +import { Alert } from "react-bootstrap"; + +const ModalStyled = styled(Modal)` + background-color: transparent; +` +const AlertStyled = styled(Alert)` + margin-top: 10px; +` + +const MonitorInstantiation = (props) => { + const [show, setShow] = useState(true); + const [acmList, setAcmList] = useState([]); + const [acmInstantiationOk, setAcmInstantiationOk] = useState(true); + const [acmInstantiationError, setACMInstantiationError] = useState({}); + + useEffect(async () => { + const acmInstantiation = await ACMService.getACMInstantiation() + .catch(error => error.message); + + const acmInstantiationJson = await acmInstantiation.json(); + + if (!acmInstantiation.ok || acmInstantiationJson['automationCompositionList'].length === 0) { + setAcmInstantiationOk(false) + setACMInstantiationError(acmInstantiationJson) + } else { + setAcmList(acmInstantiationJson['automationCompositionList']); + } + }, []) + + const handleClose = () => { + console.log('handleClose called'); + setShow(false); + props.history.push('/'); + } + + return ( + + + Tosca Instantiation - Monitoring + + + { + acmList.map((clList, index) => ( + + + + )) + } + Can't get acm instantiation info:
{ JSON.stringify(acmInstantiationError, null, 2) }
+
+ + + +
+ ) +} + +export default MonitorInstantiation; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/MonitorInstantiation.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/MonitorInstantiation.test.js new file mode 100644 index 0000000..5923f10 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/MonitorInstantiation.test.js @@ -0,0 +1,93 @@ +/* + * ============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 { act } from "react-dom/test-utils"; +import { createMemoryHistory } from "history"; +import MonitorInstantiation from "./MonitorInstantiation"; +import ACMService from "../../../api/ACMService"; +import clLoopList from "./testFiles/acmList.json"; + +const logSpy = jest.spyOn(console, 'log') +const history = createMemoryHistory(); + +describe('Verify MonitorInstantiation', () => { + const flushPromises = () => new Promise(setImmediate); + + beforeEach(() => { + logSpy.mockClear(); + }); + + it("renders correctly", () => { + const container = shallow(); + expect(toJson(container)).toMatchSnapshot(); + }); + + it('should have a Button element', () => { + const container = shallow(); + expect(container.find('Button').length).toEqual(1); + }); + + it('handleClose called when bottom button clicked', () => { + const container = shallow(); + const logSpy = jest.spyOn(console, 'log'); + + act(() => { + container.find('[variant="secondary"]').simulate('click'); + expect(logSpy).toHaveBeenCalledWith('handleClose called'); + }); + }); + + it('handleClose called when top-right button clicked', () => { + const container = shallow(); + const logSpy = jest.spyOn(console, 'log'); + + act(() => { + container.find('[size="xl"]').get(0).props.onHide(); + expect(logSpy).toHaveBeenCalledWith('handleClose called'); + }); + }); + + it('Check useEffect is being called', async () => { + jest.resetAllMocks(); + jest.spyOn(ACMService, 'getACMInstantiation') + .mockImplementationOnce(async () => { + return Promise.resolve({ + ok: true, + status: 200, + text: () => "OK", + json: () => { + return Promise.resolve(clLoopList); + } + }); + }); + + const component = mount(); + 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/ACM/ReadAndConvertYaml.js b/gui-clamp/ui-react/src/components/dialogs/ACM/ReadAndConvertYaml.js new file mode 100644 index 0000000..5fc97c4 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/ReadAndConvertYaml.js @@ -0,0 +1,132 @@ +/* + * ============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, { useState } from "react"; +import GetToscaTemplate from "./GetToscaTemplate"; +import Modal from "react-bootstrap/Modal"; +import Button from "react-bootstrap/Button"; +import { Alert } from "react-bootstrap"; + +import styled from 'styled-components'; +import DeleteToscaTemplate from "./DeleteToscaTemplate"; + +const ModalStyled = styled(Modal)` + background-color: transparent; +` + +const AlertStyled = styled(Alert)` + margin-top: 10px; +` + +const PreStyled = styled.pre` + color: #7F0055; + overflow: auto; + max-height: 70vh; + margin-top: 10px; +` + +const ReadAndConvertYaml = (props) => { + const [show, setShow] = useState(true); + const [toscaTemplateData, setToscaTemplateData] = useState(); + const [deleteToscaTemplateData, setDeleteToscaTemplateData] = useState(null); + const [responseOk, setResponseOk] = useState(true); + const [deleteResponseOk, setDeleteResponseOk] = useState(true); + const [showDeleteButton, setShowDeleteButton] = useState(false); + const name = 'ToscaServiceTemplateSimple'; + const version = '1.0.0'; + + const handleClose = () => { + console.log('handleClose called'); + setShow(false); + props.history.push('/'); + } + + const getToscaServiceTemplateHandler = async (toscaServiceTemplateResponse) => { + + if (!toscaServiceTemplateResponse.ok) { + console.log('Response is not ok'); + setResponseOk(false); + const toscaData = await toscaServiceTemplateResponse.json(); + setToscaTemplateData(toscaData); + } else { + setResponseOk(true); + console.log('Response is ok'); + const toscaData = await toscaServiceTemplateResponse.json(); + setToscaTemplateData(toscaData); + setShowDeleteButton(true) + } + } + + const deleteToscaServiceTemplateHandler = async (deleteToscaServiceTemplateResponse) => { + + if (!deleteToscaServiceTemplateResponse.ok) { + setShowDeleteButton(false) + console.log('Delete response not ok'); + setDeleteResponseOk(false); + const deleteToscaData = await deleteToscaServiceTemplateResponse.json(); + console.log(deleteToscaData) + setDeleteToscaTemplateData(deleteToscaData); + } else { + setShowDeleteButton(false) + setDeleteResponseOk(true); + const deleteToscaData = await deleteToscaServiceTemplateResponse.json(); + setDeleteToscaTemplateData(null) + setDeleteToscaTemplateData(deleteToscaData); + setShowDeleteButton(false); + } + } + + return ( + + + View Tosca Template + + + + { responseOk && { JSON.stringify(toscaTemplateData, null, 2) } } + { JSON.stringify(toscaTemplateData, null, 2) } + { showDeleteButton && + + } + { JSON.stringify(deleteToscaTemplateData, null, 2) } +

Delete Successful

{ JSON.stringify(deleteToscaTemplateData, null, 2) }
+
+ + + +
+ ); +} +; + +export default ReadAndConvertYaml; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/ReadAndConvertYaml.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/ReadAndConvertYaml.test.js new file mode 100644 index 0000000..03192a1 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/ReadAndConvertYaml.test.js @@ -0,0 +1,252 @@ +/* + * ============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 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', () => { + + const unmockedFetch = global.fetch + + const flushPromises = () => new Promise(setImmediate); + + beforeAll(() => { + global.fetch = () => + Promise.resolve({ + ok: true, + status: 200, + 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", () => { + shallow(); + }); + + it("renders correctly", () => { + const tree = shallow(); + expect(toJson(tree)).toMatchSnapshot(); + }); + + it('should have a GetToscaTemplate element', () => { + const container = shallow() + expect(container.find('GetToscaTemplate').length).toEqual(1); + }); + + it('should call getToscaServiceTemplateHandler on click', async () => { + const component = mount(); + + 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(); + + 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(); + + await act(async () => { + component.find('GetToscaTemplate').simulate('click'); + 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(); + + + 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() + + + act(() => { + component.find('[variant="secondary"]').simulate('click'); + expect(logSpy).toHaveBeenCalledWith('handleClose called'); + }); + component.unmount() + }); + + it('handleClose called when top-right button clicked', async () => { + const history = createMemoryHistory(); + const component = mount() + const logSpy = jest.spyOn(console, 'log'); + + + 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/ACM/UploadToscaFile.js b/gui-clamp/ui-react/src/components/dialogs/ACM/UploadToscaFile.js new file mode 100644 index 0000000..4357a9f --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/UploadToscaFile.js @@ -0,0 +1,52 @@ +/* + * ============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 Button from "react-bootstrap/Button"; +import React, { useState } from "react"; +import ACMService from "../../../api/ACMService"; + +const UploadToscaFile = (props) => { + + const postServiceTemplateHandler = async (event) => { + event.preventDefault(); + console.log('postServiceTemplateHandler called'); + + const response = await ACMService.uploadToscaFile(props.toscaObject) + .catch(error => error.message); + + // const responseMessage = await response.text(); + + props.onResponseReceived(response); + + } + + return ( + + + + ); + +}; + +export default UploadToscaFile; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/UploadToscaFile.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/UploadToscaFile.test.js new file mode 100644 index 0000000..520eea9 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/UploadToscaFile.test.js @@ -0,0 +1,61 @@ +/* + * ============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 UploadToscaFile from './UploadToscaFile'; +import toJson from "enzyme-to-json"; +import { act } from "react-dom/test-utils"; + +describe('Verify UploadToscaFile', () => { + + it("renders without crashing", () => { + shallow(); + }); + + it("renders correctly", () => { + const tree = shallow(); + expect(toJson(tree)).toMatchSnapshot(); + }); + + it('should have a Button element', () => { + const container = shallow() + expect(container.find('Button').length).toEqual(1); + }); + + it('button should call postServiceTemplateHandler when clicked', async () => { + const component = mount() + const logSpy = jest.spyOn(console, 'log'); + const event = { + preventDefault() { + } + }; + + await act(() => { + component.find('[variant="primary"]').get(0).props.onClick(event); + expect(logSpy).toHaveBeenCalledWith('postServiceTemplateHandler called'); + }) + + }); + + it('should have a Button element with specified text', () => { + const container = shallow() + expect(container.find('Button').text()).toBe('Upload Tosca Service Template'); + }); +}); diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/AccordionHeader.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/AccordionHeader.test.js.snap new file mode 100644 index 0000000..da86eb7 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/AccordionHeader.test.js.snap @@ -0,0 +1,211 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify AccordionHeader renders correctly 1`] = ` + + + +`; + +exports[`Verify AccordionHeader renders correctly when orderState is passive 1`] = ` + + + PASSIVE_TEST + + +`; + +exports[`Verify AccordionHeader renders correctly when orderState is running 1`] = ` + + + RUNNING_TEST + + +`; + +exports[`Verify AccordionHeader renders correctly when orderState is uninitialized 1`] = ` + + + UNINITIALISED_TEST + + +`; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/ChangeOrderStateModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/ChangeOrderStateModal.test.js.snap new file mode 100644 index 0000000..478b886 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/ChangeOrderStateModal.test.js.snap @@ -0,0 +1,114 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify ChangeOrderStateModal renders correctly 1`] = ` + + + + Manage Instantiation + + +
+ + + + + Select Order State + + + + UNINITIALISED + + + PASSIVE + + + RUNNING + + + + + + Can't get instantiation ordered state: +
+ {} +
+
+ +
+ + + + +
+`; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/CommissioningModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/CommissioningModal.test.js.snap new file mode 100644 index 0000000..4ff976a --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/CommissioningModal.test.js.snap @@ -0,0 +1,77 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify CommissioningModal renders correctly 1`] = ` + + + + Change ACM Common Properties + + +
+
+ +
+ + Can't get service template: +
+ {} +
+ + Can't get common properties: +
+ {} +
+ +
+ + + + + + + +`; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/DeleteToscaTemplate.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/DeleteToscaTemplate.test.js.snap new file mode 100644 index 0000000..cd2288e --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/DeleteToscaTemplate.test.js.snap @@ -0,0 +1,20 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify DeleteToscaTemplate renders correctly 1`] = ` + + + +`; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/GetLocalToscaFileForUpload.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/GetLocalToscaFileForUpload.test.js.snap new file mode 100644 index 0000000..84168fd --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/GetLocalToscaFileForUpload.test.js.snap @@ -0,0 +1,103 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify GetLocalToscaFileForUpload renders correctly 1`] = ` + + + + Upload Tosca to Commissioning API + + +
+
+ +
+ + + + Only .yaml, .yml and .json files are supported + + + + + + + + +
+
+
+ + + +
+`; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/GetToscaTemplate.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/GetToscaTemplate.test.js.snap new file mode 100644 index 0000000..873afa7 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/GetToscaTemplate.test.js.snap @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify GetToscaTemplate renders correctly 1`] = ` + + + +`; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstancePropertiesModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstancePropertiesModal.test.js.snap new file mode 100644 index 0000000..d655b08 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstancePropertiesModal.test.js.snap @@ -0,0 +1,68 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify InstancePropertiesModal renders correctly 1`] = ` + + + + Create Tosca Instance Properties + + +
+ +
+ + Can't get service template: +
+ {} +
+ + Can't get instance properties: +
+ {} +
+ + +
+ + + + + +`; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationElementItem.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationElementItem.test.js.snap new file mode 100644 index 0000000..81f5f26 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationElementItem.test.js.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify InstantiationElementItem renders correctly 1`] = ``; + +exports[`Verify InstantiationElementItem renders correctly when orderState is passive 1`] = ``; + +exports[`Verify InstantiationElementItem renders correctly when orderState is running 1`] = ``; + +exports[`Verify InstantiationElementItem renders correctly when orderState is uninitialized 1`] = ``; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationElements.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationElements.test.js.snap new file mode 100644 index 0000000..8fa928e --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationElements.test.js.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify InstantiationElements renders correctly 1`] = ``; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationItem.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationItem.test.js.snap new file mode 100644 index 0000000..a3a230a --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationItem.test.js.snap @@ -0,0 +1,26 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify InstantiationItem renders correctly 1`] = ` + + + + + + + + +`; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationManagementModal.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationManagementModal.test.js.snap new file mode 100644 index 0000000..b800f52 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationManagementModal.test.js.snap @@ -0,0 +1,155 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify Instantiation Management renders correctly 1`] = ` + + + + Manage Instances + + + + + + + + + + + + + + + + + + + # + + + Instantiation Name + + + Edit Instantiation + + + Delete Instantiation + + + Change Order State + + + Instantiation Order State + + + Instantiation Current State + + + + + + + + + + + + +`; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationOrderStateChangeItem.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationOrderStateChangeItem.test.js.snap new file mode 100644 index 0000000..bbf92ca --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/InstantiationOrderStateChangeItem.test.js.snap @@ -0,0 +1,27 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify InstantiationOrderStateChangeItem renders correctly 1`] = ``; + +exports[`Verify InstantiationOrderStateChangeItem renders correctly when orderState is passive 1`] = ` + + + PASSIVE_TEST + + +`; + +exports[`Verify InstantiationOrderStateChangeItem renders correctly when orderState is running 1`] = ` + + + RUNNING_TEST + + +`; + +exports[`Verify InstantiationOrderStateChangeItem renders correctly when orderState is uninitialized 1`] = ` + + + UNINITIALISED_TEST + + +`; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/MonitorInstantiation.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/MonitorInstantiation.test.js.snap new file mode 100644 index 0000000..2b07252 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/MonitorInstantiation.test.js.snap @@ -0,0 +1,41 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify MonitorInstantiation renders correctly 1`] = ` + + + + Tosca Instantiation - Monitoring + + + + + Can't get acm instantiation info: +
+ {} +
+
+ + + +
+`; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/ReadAndConvertYaml.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/ReadAndConvertYaml.test.js.snap new file mode 100644 index 0000000..76739f3 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/ReadAndConvertYaml.test.js.snap @@ -0,0 +1,63 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify ReadAndConvertYaml renders correctly 1`] = ` + + + + View Tosca Template + + + + + + + + + + + null + + +

+ Delete Successful +

+ + null + +
+
+ + + +
+`; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/UploadToscaFile.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/UploadToscaFile.test.js.snap new file mode 100644 index 0000000..a1ae439 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/__snapshots__/UploadToscaFile.test.js.snap @@ -0,0 +1,16 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify UploadToscaFile renders correctly 1`] = ` + + + +`; diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/acmList.json b/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/acmList.json new file mode 100644 index 0000000..f854d90 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/acmList.json @@ -0,0 +1,59 @@ +{ + "automationCompositionList": [ + { + "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/ACM/testFiles/commonProps.json b/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/commonProps.json new file mode 100644 index 0000000..71f98f8 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/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/ACM/testFiles/fullTemplate.json b/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/fullTemplate.json new file mode 100644 index 0000000..8b77554 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/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/ACM/testFiles/instanceProps.json b/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/instanceProps.json new file mode 100644 index 0000000..b8250fd --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/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/ACM/testFiles/jsonEditorData.json b/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/jsonEditorData.json new file mode 100644 index 0000000..c09424f --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/jsonEditorData.json @@ -0,0 +1,50 @@ +{ + "__data": [ + "Object" + ], + "copyClipboard": null, + "editors": [ + "Object" + ], + "element": "
", + "expandRefs": [ + "Function anonymous" + ], + "expandSchema": [ + "Function anonymous" + ], + "iconlib": [ + "n" + ], + "options": [ + "Object" + ], + "ready": true, + "refs": [ + "Object" + ], + "root": [ + "o" + ], + "root_container": "
", + "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/ACM/testFiles/orderedStateJson.json b/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/orderedStateJson.json new file mode 100644 index 0000000..1179fce --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/testFiles/orderedStateJson.json @@ -0,0 +1,9 @@ +{ + "orderedState": "PASSIVE", + "acmIdentifierList": [ + { + "name": "PMSH_Instance1", + "version": "2.3.1" + } + ] +} diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/utils/CommissioningUtils.js b/gui-clamp/ui-react/src/components/dialogs/ACM/utils/CommissioningUtils.js new file mode 100644 index 0000000..2d98598 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/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( + Commissioning Success +

Altered Template was Successfully Uploaded

+
+
); + } + else { + return( + Commissioning Failure +

Updated Template Failed to Upload

+

Status code: { await response.status }: { response.statusText }

+

Response Text: { await response.text() }

+
+
); + } + }, + + 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/ACM/utils/CommissioningUtils.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/utils/CommissioningUtils.test.js new file mode 100644 index 0000000..8304ecb --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/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 = '
'; + + 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-clamp/ui-react/src/components/dialogs/ACM/utils/InstantiationUtils.js b/gui-clamp/ui-react/src/components/dialogs/ACM/utils/InstantiationUtils.js new file mode 100644 index 0000000..aaaa1bd --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/utils/InstantiationUtils.js @@ -0,0 +1,176 @@ +/* + * ============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: (acmList) => { + console.log(acmList); + const parsedAcmList = []; + + acmList.map((instance, index) => { + + const acmObj = { + index, + name: instance['name'], + version: instance['version'], + orderedState: instance['orderedState'], + currentState: instance['state'], + disableDelete: instance['state'] !== 'UNINITIALISED' + } + + parsedAcmList.push(acmObj); + }); + + return parsedAcmList; + }, + + 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 diff --git a/gui-clamp/ui-react/src/components/dialogs/ACM/utils/InstantiationUtils.test.js b/gui-clamp/ui-react/src/components/dialogs/ACM/utils/InstantiationUtils.test.js new file mode 100644 index 0000000..4077ff8 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/ACM/utils/InstantiationUtils.test.js @@ -0,0 +1,54 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2022 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 InstantiationUtils from "./InstantiationUtils"; +import instanceProps from "../testFiles/instanceProps.json"; +import fullTemp from "../testFiles/fullTemplate.json"; + +const instanceProperties = JSON.parse(JSON.stringify(instanceProps)) +const fullTemplate = JSON.parse(JSON.stringify(fullTemp)) + +describe('Verify InstantiationUtils', () => { + + const fullTemplatePromise = { + ok: true, + status: 200, + text: () => "OK", + json: () => { + return Promise.resolve(fullTemplate) + } + } + + const instancePropertiesPromise = { + ok: true, + status: 200, + text: () => "OK", + json: () => { + return Promise.resolve(instanceProperties) + } + } + + it('test parseJsonSchema output is correct', async () => { + // Have to mock "editor" dom element for json editor to work in testing + document.body.innerHTML = '
'; + + await expect((await InstantiationUtils.parseJsonSchema(fullTemplatePromise, instancePropertiesPromise)).jsonEditor).toBeTruthy() + await expect((await InstantiationUtils.parseJsonSchema(fullTemplatePromise, instancePropertiesPromise)).fullTemplate).toBeTruthy() + }) +}); \ No newline at end of file -- cgit 1.2.3-korg