export { default as PolicyDeploymentEditor } from '../ui-react/src/components/dialogs/Policy/PolicyDeploymentEditor';
export { default as PoliciesTreeViewer } from '../ui-react/src/components/dialogs/Policy/PoliciesTreeViewer';
export { default as PolicyToscaFileSelector } from '../ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector';
-export { default as MonitorInstantiation } from '../ui-react/src/components/dialogs/ControlLoop/MonitorInstantiation';
-export { default as InstantiationItem } from '../ui-react/src/components/dialogs/ControlLoop/InstantiationItem';
-export { default as InstantiationElements } from '../ui-react/src/components/dialogs/ControlLoop/InstantiationElements';
-export { default as InstantiationElementItem } from '../ui-react/src/components/dialogs/ControlLoop/InstantiationElementItem';
-export { default as InstancePropertiesModal } from '../ui-react/src/components/dialogs/ControlLoop/InstancePropertiesModal';
-export { default as InstantiationManagementModal } from '../ui-react/src/components/dialogs/ControlLoop/InstantiationManagementModal';
-export { default as ChangeOrderStateModal } from '../ui-react/src/components/dialogs/ControlLoop/ChangeOrderStateModal';
-export { default as InstantiationOrderStateChangeItem } from '../ui-react/src/components/dialogs/ControlLoop/InstantiationOrderStateChangeItem';
-export { default as ControlLoopService } from '../ui-react/src/api/ControlLoopService';
-export { default as GetLocalToscaFileForUpload } from '../ui-react/src/components/dialogs/ControlLoop/GetLocalToscaFileForUpload';
-export { default as ReadAndConvertYaml } from '../ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml';
-export { default as UploadToscaFile } from '../ui-react/src/components/dialogs/ControlLoop/UploadToscaFile';
-export { default as GetToscaTemplate } from '../ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate';
+export { default as MonitorInstantiation } from '../ui-react/src/components/dialogs/ACM/MonitorInstantiation';
+export { default as InstantiationItem } from '../ui-react/src/components/dialogs/ACM/InstantiationItem';
+export { default as InstantiationElements } from '../ui-react/src/components/dialogs/ACM/InstantiationElements';
+export { default as InstantiationElementItem } from '../ui-react/src/components/dialogs/ACM/InstantiationElementItem';
+export { default as InstancePropertiesModal } from '../ui-react/src/components/dialogs/ACM/InstancePropertiesModal';
+export { default as InstantiationManagementModal } from '../ui-react/src/components/dialogs/ACM/InstantiationManagementModal';
+export { default as ChangeOrderStateModal } from '../ui-react/src/components/dialogs/ACM/ChangeOrderStateModal';
+export { default as InstantiationOrderStateChangeItem } from '../ui-react/src/components/dialogs/ACM/InstantiationOrderStateChangeItem';
+export { default as ACMService } from '../ui-react/src/api/ACMService';
+export { default as GetLocalToscaFileForUpload } from '../ui-react/src/components/dialogs/ACM/GetLocalToscaFileForUpload';
+export { default as ReadAndConvertYaml } from '../ui-react/src/components/dialogs/ACM/ReadAndConvertYaml';
+export { default as UploadToscaFile } from '../ui-react/src/components/dialogs/ACM/UploadToscaFile';
+export { default as GetToscaTemplate } from '../ui-react/src/components/dialogs/ACM/GetToscaTemplate';
import Spinner from 'react-bootstrap/Spinner';
import { Link } from 'react-router-dom';
-import ReadAndConvertYaml from "./components/dialogs/ControlLoop/ReadAndConvertYaml";
-import MonitorInstantiation from "./components/dialogs/ControlLoop/MonitorInstantiation";
-import GetLocalToscaFileForUpload from "./components/dialogs/ControlLoop/GetLocalToscaFileForUpload";
-import CommissioningModal from "./components/dialogs/ControlLoop/CommissioningModal";
-import InstancePropertiesModal from "./components/dialogs/ControlLoop/InstancePropertiesModal";
-import ChangeOrderStateModal from "./components/dialogs/ControlLoop/ChangeOrderStateModal";
-import InstantiationManagementModal from "./components/dialogs/ControlLoop/InstantiationManagementModal";
+import ReadAndConvertYaml from "./components/dialogs/ACM/ReadAndConvertYaml";
+import MonitorInstantiation from "./components/dialogs/ACM/MonitorInstantiation";
+import GetLocalToscaFileForUpload from "./components/dialogs/ACM/GetLocalToscaFileForUpload";
+import CommissioningModal from "./components/dialogs/ACM/CommissioningModal";
+import InstancePropertiesModal from "./components/dialogs/ACM/InstancePropertiesModal";
+import ChangeOrderStateModal from "./components/dialogs/ACM/ChangeOrderStateModal";
+import InstantiationManagementModal from "./components/dialogs/ACM/InstantiationManagementModal";
const StyledMainDiv = styled.div`
background-color: ${ props => props.theme.backgroundColor };
/>
<Route path="/monitorInstantiation" render={ (routeProps) => (<MonitorInstantiation { ...routeProps } />) }/>
<Route path="/instantiationManagement" render={ (routeProps) => (<InstantiationManagementModal { ...routeProps } />) }/>
- <Route path="/editControlLoopInstanceProperties" render={ (routeProps) => (<InstancePropertiesModal { ...routeProps } />) }/>
+ <Route path="/editACMInstanceProperties" render={ (routeProps) => (<InstancePropertiesModal { ...routeProps } />) }/>
<Route path="/changeOrderState" render={ (routeProps) => (<ChangeOrderStateModal { ...routeProps } />) }/>
</React.Fragment>
);
render={[Function]}
/>
<Route
- path="/editControlLoopInstanceProperties"
+ path="/editACMInstanceProperties"
render={[Function]}
/>
<Route
render={[Function]}
/>
<Route
- path="/editControlLoopInstanceProperties"
+ path="/editACMInstanceProperties"
render={[Function]}
/>
<Route
* ============LICENSE_END=========================================================
*/
-export default class ControlLoopService {
+export default class ACMService {
- static async getControlLoopInstantiation() {
+ static async getACMInstantiation() {
const response = await fetch(window.location.pathname +
- 'restservices/clds/v2/toscaControlLoop/getToscaInstantiation');
+ 'restservices/clds/v2/acm/getToscaInstantiation');
return response
}
static async createInstanceProperties(instanceName, instancePropertiesTemplate) {
const response = await fetch(window.location.pathname +
- 'restservices/clds/v2/toscaControlLoop/postToscaInstanceProperties', {
+ 'restservices/clds/v2/acm/postToscaInstanceProperties', {
method: 'POST',
headers: {
"Content-Type": "application/json"
}
const response = await fetch(window.location.pathname +
- 'restservices/clds/v2/toscaControlLoop/deleteToscaInstanceProperties?' + (new URLSearchParams(params)), {
+ 'restservices/clds/v2/acm/deleteToscaInstanceProperties?' + (new URLSearchParams(params)), {
method: 'DELETE',
credentials: 'same-origin',
});
version: version
}
const response = await fetch(window.location.pathname +
- 'restservices/clds/v2/toscaControlLoop/getInstantiationOrderState'+ '?' + (new URLSearchParams(params)));
+ 'restservices/clds/v2/acm/getInstantiationOrderState'+ '?' + (new URLSearchParams(params)));
const data = await response;
static async changeInstanceOrderState(toscaObject) {
const response = await fetch(window.location.pathname +
- 'restservices/clds/v2/toscaControlLoop/putToscaInstantiationStateChange', {
+ 'restservices/clds/v2/acm/putToscaInstantiationStateChange', {
method: 'PUT',
headers: {
"Content-Type": "application/json"
}
const response = await fetch(window.location.pathname +
- 'restservices/clds/v2/toscaControlLoop/getToscaTemplate' + '?' + (new URLSearchParams(params)));
+ 'restservices/clds/v2/acm/getToscaTemplate' + '?' + (new URLSearchParams(params)));
const data = await response;
static async uploadToscaFile(toscaObject) {
const response = await fetch(window.location.pathname +
- 'restservices/clds/v2/toscaControlLoop/commissionToscaTemplate', {
+ 'restservices/clds/v2/acm/commissionToscaTemplate', {
method: 'POST',
headers: {
"Content-Type": "application/json"
}
const response = await fetch(window.location.pathname +
- 'restservices/clds/v2/toscaControlLoop/decommissionToscaTemplate' + '?' + (new URLSearchParams(params)),
+ 'restservices/clds/v2/acm/decommissionToscaTemplate' + '?' + (new URLSearchParams(params)),
{
method: 'DELETE'
});
}
const response = await fetch(window.location.pathname +
- 'restservices/clds/v2/toscaControlLoop/getCommonOrInstanceProperties' + '?' + (new URLSearchParams(params)));
+ 'restservices/clds/v2/acm/getCommonOrInstanceProperties' + '?' + (new URLSearchParams(params)));
return response;
}
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-import ControlLoopService from "./ControlLoopService";
+import ACMService from "./ACMService";
-describe("Verify GetControlLoopInstantiation", () => {
+describe("Verify GetACMInstantiation", () => {
let response;
let name = "name";
let template = "template";
})
);
beforeEach(async () => {
- response = await ControlLoopService.getControlLoopInstantiation(name, template);
+ response = await ACMService.getACMInstantiation(name, template);
});
- it("Test getControlLoopInstantiation", () => {
+ it("Test getACMInstantiation", () => {
expect(response.status).toEqual("Success");
});
});
})
);
beforeEach(async () => {
- response = await ControlLoopService.deleteInstantiation(name, version);
+ response = await ACMService.deleteInstantiation(name, version);
});
it("Test deleteInstantiation", () => {
expect(response.status).toEqual("Success");
"name": "OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca",
"configurationsJson": {
"operational_policy": {
- "controlLoop": {},
+ "acm": {},
"policies": []
}
},
"name": "OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca",
"configurationsJson": {
"operational_policy": {
- "controlLoop": {},
+ "acm": {},
"policies": []
}
},
"name": "OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca",
"configurationsJson": {
"operational_policy": {
- "controlLoop": {},
+ "acm": {},
"policies": []
}
},
it('getOperationalPolicyPropertiesForName', () => {
const opPolicyJson = {
"operational_policy": {
- "controlLoop": {},
+ "acm": {},
"policies": []
}};
expect(loopCache.getOperationalPolicyPropertiesForName("OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(opPolicyJson);
it('updateOperationalPolicyProperties', () => {
const newOpPolicy = {
"operational_policy": {
- "controlLoop": {},
+ "acm": {},
"policies": []
}
};
"name": "OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca",
"configurationsJson": {
"operational_policy": {
- "controlLoop": {},
+ "acm": {},
"policies": []
}
},
import Button from "react-bootstrap/Button";
import React, { useEffect, useState } from "react";
import InstantiationOrderStateChangeItem from "./InstantiationOrderStateChangeItem";
-import ControlLoopService from "../../../api/ControlLoopService";
+import ACMService from "../../../api/ACMService";
import { Alert, Container, Dropdown } from "react-bootstrap";
const ModalStyled = styled(Modal)`
const ChangeOrderStateModal = (props) => {
const [show, setShow] = useState(true);
- const [controlLoopIdentifierList, setControlLoopIdentifierList] = useState([]);
+ const [ACMIdentifierList, setACMIdentifierList] = useState([]);
const [orderedState, setOrderedState] = useState('');
const [toscaOrderStateObject, setToscaOrderStateObject] = useState({});
const [instantiationOrderStateError, setInstantiationOrderStateError] = useState(false);
useEffect(async () => {
- const instantiationOrderState = await ControlLoopService.getInstanceOrderState(
+ const instantiationOrderState = await ACMService.getInstanceOrderState(
props.location.instantiationName,
props.location.instantiationVersion)
.catch(error => error.message);
console.log(orderStateJson);
- if (!instantiationOrderState.ok || orderStateJson['controlLoopIdentifierList'].length === 0) {
+ if (!instantiationOrderState.ok || orderStateJson['automationCompositionIdentifierList'].length === 0) {
setInstantiationOrderStateError(true);
setInstantiationOrderStateMsgError(orderStateJson);
} else {
- setControlLoopIdentifierList(orderStateJson['controlLoopIdentifierList']);
+ setACMIdentifierList(orderStateJson['automationCompositionIdentifierList']);
setOrderedState(orderStateJson['orderedState']);
}
}, []);
const stateChangeObject = {
orderedState: event,
- controlLoopIdentifierList: controlLoopIdentifierList
+ automationCompositionIdentifierList: ACMIdentifierList
}
setToscaOrderStateObject(stateChangeObject);
setOrderedState(event);
const handleSave = async () => {
console.log("handleSave called");
- const response = await ControlLoopService.changeInstanceOrderState(toscaOrderStateObject)
+ const response = await ACMService.changeInstanceOrderState(toscaOrderStateObject)
.catch(error => error.message);
if (response.ok) {
</Dropdown.Menu>
</Dropdown>
{
- controlLoopIdentifierList.map((clIdList, index) => (
+ ACMIdentifierList.map((clIdList, index) => (
<InstantiationOrderStateChangeItem title={ clIdList.name } orderState={ orderedState } index={ index } key={ index }/>
))
}
import ChangeOrderStateModal from "./ChangeOrderStateModal";
import { createMemoryHistory } from "history";
import { act } from "react-dom/test-utils";
-import clLoopList from "./testFiles/controlLoopList.json";
+import acmList from "./testFiles/acmList.json";
import orderedStateJson from "./testFiles/orderedStateJson.json";
-import ControlLoopService from "../../../api/ControlLoopService";
+import ACMService from "../../../api/ACMService";
let logSpy = jest.spyOn(console, 'log')
const oldWindowLocation = window.location
+
describe('Verify ChangeOrderStateModal', () => {
const flushPromises = () => new Promise(setImmediate);
it('handleSave called when save button clicked and response is ok', async () => {
jest.resetAllMocks()
- const getInstanceOrderStateSpy = jest.spyOn(ControlLoopService, 'getInstanceOrderState')
+ const getInstanceOrderStateSpy = jest.spyOn(ACMService, 'getInstanceOrderState')
.mockImplementationOnce(() => {
return Promise.resolve({
ok: true,
}
)
- const changeInstanceOrderStateSpy = jest.spyOn(ControlLoopService, 'changeInstanceOrderState')
+ const changeInstanceOrderStateSpy = jest.spyOn(ACMService, 'changeInstanceOrderState')
.mockImplementationOnce(() => {
return Promise.resolve({
ok: true,
status: 200,
text: () => "OK",
json: () => {
- return Promise.resolve(clLoopList)
+ return Promise.resolve(acmList)
}
})
}
const component = mount(<ChangeOrderStateModal location={window.location}/>)
- await act( async () => {
+ act( async () => {
component.find('[variant="primary"]').simulate('click');
await expect(getInstanceOrderStateSpy).toHaveBeenCalled()
await expect(changeInstanceOrderStateSpy).toHaveBeenCalled()
it('handleSave called when save button clicked and response is not ok', async () => {
jest.resetAllMocks()
- const getInstanceOrderStateSpy = jest.spyOn(ControlLoopService, 'getInstanceOrderState')
+ const getInstanceOrderStateSpy = jest.spyOn(ACMService, 'getInstanceOrderState')
.mockImplementationOnce(() => {
return Promise.resolve({
ok: true,
}
)
- const changeInstanceOrderStateSpy = jest.spyOn(ControlLoopService, 'changeInstanceOrderState')
+ const changeInstanceOrderStateSpy = jest.spyOn(ACMService, 'changeInstanceOrderState')
.mockImplementationOnce(() => {
return Promise.resolve({
ok: false,
status: 200,
text: () => "OK",
json: () => {
- return Promise.resolve(clLoopList)
+ return Promise.resolve(acmList)
}
})
}
it('Check useEffect is being called', async () => {
jest.resetAllMocks()
- jest.spyOn(ControlLoopService, 'getInstanceOrderState')
+ jest.spyOn(ACMService, 'getInstanceOrderState')
.mockImplementationOnce(() => {
return Promise.resolve({
ok: true,
}
)
- jest.spyOn(ControlLoopService, 'changeInstanceOrderState')
+ jest.spyOn(ACMService, 'changeInstanceOrderState')
.mockImplementationOnce(() => {
return Promise.resolve({
ok: true,
status: 200,
text: () => "OK",
json: () => {
- return Promise.resolve(clLoopList)
+ return Promise.resolve(acmList)
}
})
}
const component = mount(<ChangeOrderStateModal location={window.location}/>)
const useEffect = jest.spyOn(React, "useEffect");
- await act(async () => {
+ act(async () => {
await flushPromises()
component.update()
await expect(useEffect).toHaveBeenCalled();
import Button from "react-bootstrap/Button";
import React, { useEffect, useState } from "react";
import styled from "styled-components";
-import ControlLoopService from "../../../api/ControlLoopService";
+import ACMService from "../../../api/ACMService";
import { Alert } from "react-bootstrap";
import CommissioningUtils from "./utils/CommissioningUtils";
const version = '1.0.0';
useEffect(async () => {
- const toscaTemplateResponse = await ControlLoopService.getToscaTemplate(name, version)
+ const toscaTemplateResponse = await ACMService.getToscaTemplate(name, version)
.catch(error => error.message);
- const toscaCommonProperties = await ControlLoopService.getCommonOrInstanceProperties(name, version, true)
+ const toscaCommonProperties = await ACMService.getCommonOrInstanceProperties(name, version, true)
.catch(error => error.message);
if (!toscaCommonProperties.ok) {
console.log("handleCommission called")
- await ControlLoopService.deleteToscaTemplate('ToscaServiceTemplateSimple', "1.0.0")
+ await ACMService.deleteToscaTemplate('ToscaServiceTemplateSimple', "1.0.0")
- const recommissioningResponse = await ControlLoopService.uploadToscaFile(fullToscaTemplate)
+ const recommissioningResponse = await ACMService.uploadToscaFile(fullToscaTemplate)
await receiveResponseFromCommissioning(recommissioningResponse)
}
backdrop="static"
keyboard={ false }>
<Modal.Header closeButton>
- <Modal.Title>Change Control Loop Common Properties</Modal.Title>
+ <Modal.Title>Change ACM Common Properties</Modal.Title>
</Modal.Header>
<br/>
<div style={ { padding: '5px 5px 0px 5px' } }>
import CommissioningModal from "./CommissioningModal";
import commonProps from "./testFiles/commonProps.json";
import fullTemp from "./testFiles/fullTemplate.json";
-import ControlLoopService from "../../../api/ControlLoopService";
+import ACMService from "../../../api/ACMService";
let logSpy = jest.spyOn(console, 'log')
const commonProperties = JSON.parse(JSON.stringify(commonProps))
});
it('getToscaTemplate gets called in useEffect with error', async() => {
- const fetchMock = jest.spyOn(ControlLoopService, 'getToscaTemplate').mockImplementation(() => Promise.resolve({
+ const fetchMock = jest.spyOn(ACMService, 'getToscaTemplate').mockImplementation(() => Promise.resolve({
ok: false,
status: 200,
text: () => "OK",
});
it('getCommonProperties gets called in useEffect with error', async() => {
- const fetchMock = jest.spyOn(ControlLoopService, 'getToscaTemplate').mockImplementation(() => Promise.resolve({
+ const fetchMock = jest.spyOn(ACMService, 'getToscaTemplate').mockImplementation(() => Promise.resolve({
ok: false,
status: 200,
text: () => "OK",
});
it('test handleCommission called on click', async () => {
- const deleteToscaTemplateSpy = jest.spyOn(ControlLoopService, 'deleteToscaTemplate').mockImplementation(() => {
+ const deleteToscaTemplateSpy = jest.spyOn(ACMService, 'deleteToscaTemplate').mockImplementation(() => {
Promise.resolve({
ok: true,
status: 200,
json: () => "{handleCommissioning}"
})
})
- const uploadToscaTemplateSpy = jest.spyOn(ControlLoopService, 'uploadToscaFile').mockImplementation(() => {
+ const uploadToscaTemplateSpy = jest.spyOn(ACMService, 'uploadToscaFile').mockImplementation(() => {
Promise.resolve({
ok: true,
status: 200,
import React, { useState } from "react";
import Button from "react-bootstrap/Button";
-import ControlLoopService from "../../../api/ControlLoopService";
+import ACMService from "../../../api/ACMService";
const DeleteToscaTemplate = props => {
const deleteTemplateHandler = async () => {
console.log('deleteTemplateHandler called');
- const response = await ControlLoopService.deleteToscaTemplate(props.templateName, props.templateVersion)
+ const response = await ACMService.deleteToscaTemplate(props.templateName, props.templateVersion)
.catch(error => error.message);
if(!response.ok) {
import React, { useState } from "react";
import Button from "react-bootstrap/Button";
-import ControlLoopService from "../../../api/ControlLoopService";
+import ACMService from "../../../api/ACMService";
const GetToscaTemplate = (props) => {
const getTemplateHandler = async () => {
- const response = await ControlLoopService.getToscaTemplate(props.templateName, props.templateVersion)
+ const response = await ACMService.getToscaTemplate(props.templateName, props.templateVersion)
.catch(error => error.message);
if(!response.ok) {
import Modal from "react-bootstrap/Modal";
import styled from "styled-components";
import Button from "react-bootstrap/Button";
-import ControlLoopService from "../../../api/ControlLoopService";
+import ACMService from "../../../api/ACMService";
import Alert from "react-bootstrap/Alert";
import * as PropTypes from "prop-types";
import InstantiationUtils from "./utils/InstantiationUtils";
const [instanceName, setInstanceName] = useState('')
useEffect(async () => {
- const toscaTemplateResponse = await ControlLoopService.getToscaTemplate(templateName, templateVersion)
+ const toscaTemplateResponse = await ACMService.getToscaTemplate(templateName, templateVersion)
.catch(error => error.message);
- const toscaInstanceProperties = await ControlLoopService.getCommonOrInstanceProperties(templateName, templateVersion, false)
+ const toscaInstanceProperties = await ACMService.getCommonOrInstanceProperties(templateName, templateVersion, false)
.catch(error => error.message);
if (!toscaInstanceProperties.ok) {
setToscaFullTemplate(InstantiationUtils.updateTemplate(jsonEditor.getValue(), toscaFullTemplate));
}
- const response = await ControlLoopService.createInstanceProperties(instanceName, toscaFullTemplate)
+ const response = await ACMService.createInstanceProperties(instanceName, toscaFullTemplate)
.catch(error => error.message);
if (response.ok) {
*/
import Modal from "react-bootstrap/Modal";
-import { Alert, Container, Dropdown, Table } from "react-bootstrap";
+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 ControlLoopService from "../../../api/ControlLoopService";
+import ACMService from "../../../api/ACMService";
import Row from "react-bootstrap/Row";
import InstantiationUtils from "./utils/InstantiationUtils";
const InstantiationManagementModal = (props) => {
const [show, setShow] = useState(true);
const [instantiationList, setInstantiationList] = useState([]);
- const [deleteInstantiation, setDeleteInstantiation] = useState(false);
const [alertMessage, setAlertMessage] = useState(null);
useEffect(async () => {
- const response = await ControlLoopService.getControlLoopInstantiation();
+ const response = await ACMService.getACMInstantiation();
const instantiationListJson = await response.json();
- const parsedInstantiationList = InstantiationUtils.parseInstantiationList(instantiationListJson['controlLoopList']);
+ console.log(instantiationListJson);
+
+ const parsedInstantiationList = InstantiationUtils.parseInstantiationList(instantiationListJson['automationCompositionList']);
setInstantiationList(parsedInstantiationList);
}, []);
const deleteInstantiationHandler = async (index, instantiation) => {
console.log("deleteInstantiationHandler called");
- setDeleteInstantiation(true);
console.log(instantiation);
const name = instantiation.name;
const version = instantiation.version;
- const response = await ControlLoopService.deleteInstantiation(name, version);
+ const response = await ACMService.deleteInstantiation(name, version);
updateList(index);
if (response.ok) {
successAlert();
- setDeleteInstantiation(false);
} else {
await errorAlert(response);
}
<Modal.Body>
<Container>
<Row>
- <Link to={ { pathname: "/editControlLoopInstanceProperties" } }>
+ <Link to={ { pathname: "/editACMInstanceProperties" } }>
<Button variant="primary" type="null">Create Instance</Button>
</Link>
<HorizontalSpace/>
<td>{ instantiation.name }</td>
<td style={ { textAlign: "center" } }>
<Link to={ {
- pathname: "editControlLoopInstanceProperties",
+ pathname: "editACMInstanceProperties",
} } state={ instantiation.name }>
<Button variant="outline-success" type="null"
disabled={ true }
import InstantiationManagementModal from "./InstantiationManagementModal";
import {act} from "react-dom/test-utils";
import {createMemoryHistory} from "history";
-import ControlLoopService from "../../../api/ControlLoopService";
-import clLoopList from "./testFiles/controlLoopList.json";
+import ACMService from "../../../api/ACMService";
+import acmLoopList from "./testFiles/acmList.json";
import {BrowserRouter} from "react-router-dom";
const logSpy = jest.spyOn(console, 'log')
it('Check useEffect is being called', async () => {
jest.resetAllMocks();
- jest.spyOn(ControlLoopService, 'getControlLoopInstantiation')
+ jest.spyOn(ACMService, 'getACMInstantiation')
.mockImplementationOnce(async () => {
return Promise.resolve({
ok: true,
status: 200,
text: () => "OK",
json: () => {
- return Promise.resolve(clLoopList);
+ return Promise.resolve(acmLoopList);
}
});
});
ok: true,
status: 200,
text: () => "OK",
- json: () => clLoopList
+ json: () => acmLoopList
})
)
import Modal from "react-bootstrap/Modal";
import Button from "react-bootstrap/Button";
import InstantiationItem from "./InstantiationItem";
-import ControlLoopService from "../../../api/ControlLoopService";
+import ACMService from "../../../api/ACMService";
import InstantiationElements from "./InstantiationElements";
import { Alert } from "react-bootstrap";
const MonitorInstantiation = (props) => {
const [show, setShow] = useState(true);
- const [controlLoopList, setControlLoopList] = useState([]);
- const [controlLoopInstantiationOk, setControlLoopInstantiationOk] = useState(true);
- const [controlLoopInstantiationError, setControlLoopInstantiationError] = useState({});
+ const [acmList, setAcmList] = useState([]);
+ const [acmInstantiationOk, setAcmInstantiationOk] = useState(true);
+ const [acmInstantiationError, setACMInstantiationError] = useState({});
useEffect(async () => {
- const controlLoopInstantiation = await ControlLoopService.getControlLoopInstantiation()
+ const acmInstantiation = await ACMService.getACMInstantiation()
.catch(error => error.message);
- const controlLoopInstantiationJson = await controlLoopInstantiation.json();
+ const acmInstantiationJson = await acmInstantiation.json();
- if (!controlLoopInstantiation.ok || controlLoopInstantiationJson['controlLoopList'].length === 0) {
- setControlLoopInstantiationOk(false)
- setControlLoopInstantiationError(controlLoopInstantiationJson)
+ if (!acmInstantiation.ok || acmInstantiationJson['automationCompositionList'].length === 0) {
+ setAcmInstantiationOk(false)
+ setACMInstantiationError(acmInstantiationJson)
} else {
- setControlLoopList(controlLoopInstantiationJson['controlLoopList']);
+ setAcmList(acmInstantiationJson['automationCompositionList']);
}
}, [])
</Modal.Header>
<Modal.Body>
{
- controlLoopList.map((clList, index) => (
+ acmList.map((clList, index) => (
<InstantiationItem title={ clList["name"] } orderedState={ clList["orderedState"] } index={ index } key={ index } >
<InstantiationElements elements={ clList["elements"] } />
</InstantiationItem>
))
}
- <AlertStyled show={ !controlLoopInstantiationOk }
- variant="danger">Can't get control loop instantiation info:<br/>{ JSON.stringify(controlLoopInstantiationError, null, 2) }</AlertStyled>
+ <AlertStyled show={ !acmInstantiationOk }
+ variant="danger">Can't get acm instantiation info:<br/>{ JSON.stringify(acmInstantiationError, null, 2) }</AlertStyled>
</Modal.Body>
<Modal.Footer>
<Button variant="secondary" type="null" onClick={ handleClose }>Close</Button>
import { act } from "react-dom/test-utils";
import { createMemoryHistory } from "history";
import MonitorInstantiation from "./MonitorInstantiation";
-import ControlLoopService from "../../../api/ControlLoopService";
-import clLoopList from "./testFiles/controlLoopList.json";
+import ACMService from "../../../api/ACMService";
+import clLoopList from "./testFiles/acmList.json";
const logSpy = jest.spyOn(console, 'log')
const history = createMemoryHistory();
it('Check useEffect is being called', async () => {
jest.resetAllMocks();
- jest.spyOn(ControlLoopService, 'getControlLoopInstantiation')
+ jest.spyOn(ACMService, 'getACMInstantiation')
.mockImplementationOnce(async () => {
return Promise.resolve({
ok: true,
import Button from "react-bootstrap/Button";
import React, { useState } from "react";
-import ControlLoopService from "../../../api/ControlLoopService";
+import ACMService from "../../../api/ACMService";
const UploadToscaFile = (props) => {
event.preventDefault();
console.log('postServiceTemplateHandler called');
- const response = await ControlLoopService.uploadToscaFile(props.toscaObject)
+ const response = await ACMService.uploadToscaFile(props.toscaObject)
.catch(error => error.message);
// const responseMessage = await response.text();
closeLabel="Close"
>
<ModalTitle>
- Change Control Loop Common Properties
+ Change ACM Common Properties
</ModalTitle>
</ModalHeader>
<br />
<Link
to={
Object {
- "pathname": "/editControlLoopInstanceProperties",
+ "pathname": "/editACMInstanceProperties",
}
}
>
show={false}
variant="danger"
>
- Can't get control loop instantiation info:
+ Can't get acm instantiation info:
<br />
{}
</Styled(Alert)>
{
- "controlLoopList": [
+ "automationCompositionList": [
{
"name": "PMSHInstance0",
"version": "1.0.1",
{
"orderedState": "PASSIVE",
- "controlLoopIdentifierList": [
+ "acmIdentifierList": [
{
"name": "PMSH_Instance1",
"version": "2.3.1"
const InstantiationUtils = {
- parseInstantiationList: (controlLoopList) => {
- const parsedControlLoopList = [];
+ parseInstantiationList: (acmList) => {
+ console.log(acmList);
+ const parsedAcmList = [];
- controlLoopList.map((instance, index) => {
+ acmList.map((instance, index) => {
- const controlLoopObj = {
+ const acmObj = {
index,
name: instance['name'],
version: instance['version'],
disableDelete: instance['state'] !== 'UNINITIALISED'
}
- parsedControlLoopList.push(controlLoopObj);
+ parsedAcmList.push(acmObj);
});
- return parsedControlLoopList;
+ return parsedAcmList;
},
makeSchemaForInstanceProperties: (instanceProps) => {
+++ /dev/null
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-import { mount, shallow } from "enzyme";
-import React from "react";
-import toJson from "enzyme-to-json";
-import { createMemoryHistory } from "history";
-import { act } from "react-dom/test-utils";
-import ChangeOrderStateModal from "./ControlLoop/ChangeOrderStateModal";
-
-describe('Verify InstantiationManagementModal', () => {
-
- it("renders without crashing", () => {
- shallow(<ChangeOrderStateModal />);
- });
-
- it("renders correctly", () => {
- const tree = shallow(<ChangeOrderStateModal />);
- expect(toJson(tree)).toMatchSnapshot();
- });
-
- it('should have save button element', () => {
- const container = shallow(<ChangeOrderStateModal/>)
- expect(container.find('[variant="primary"]').length).toEqual(1);
- });
-
- it('handleSave called when save button clicked', () => {
- const history = createMemoryHistory();
- const component = mount(<ChangeOrderStateModal history={ history }/>)
- const logSpy = jest.spyOn(console, 'log');
-
- act(() => {
- component.find('[variant="primary"]').simulate('click');
- expect(logSpy).toHaveBeenCalledWith('handleSave called');
- });
- });
-
- it('should have close button element', () => {
- const container = shallow(<ChangeOrderStateModal/>)
- expect(container.find('[variant="secondary"]').length).toEqual(1);
- });
-
- it('handleClose called when close button clicked', () => {
- const history = createMemoryHistory();
- const component = mount(<ChangeOrderStateModal history={ history }/>)
- const logSpy = jest.spyOn(console, 'log');
-
- act(() => {
- component.find('[variant="secondary"]').simulate('click');
- expect(logSpy).toHaveBeenCalledWith('handleClose called');
- });
- });
-});
const loopName = this.state.loopName;
if (action === 'delete') {
- if (window.confirm('You are about to remove Control Loop Model "' + loopName +
+ if (window.confirm('You are about to remove ACM Model "' + loopName +
'". Select OK to continue with deletion or Cancel to keep the model.') === false) {
return;
}
],
"eventName": "vLoadBalancer",
"policyVersion": "v0.0.1",
- "controlLoopSchemaType": "VM",
+ "acmSchemaType": "VM",
"policyName": "DCAE.Config_tca-hi-lo"
}
]
"name": "OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca",
"configurationsJson": {
"operational_policy": {
- "controlLoop": {},
+ "acm": {},
"policies": []
}
},
let toscaYaml = fs.readFileSync('src/components/dialogs/Policy/toscaData.test.yaml', { encoding: 'utf8', flag: 'r' })
const toscaData = {
- "policyModelType": "onap.policies.controlloop.Guard",
+ "policyModelType": "onap.policies.acm.Guard",
"version": "1.0.0",
"policyAcronym": "Guard",
"createdDate": "2021-04-09T02:29:31.407356Z",
"domain": "measurementsForVfScaling",
"metricsPerEventName": Array [
Object {
- "controlLoopSchemaType": "VM",
+ "acmSchemaType": "VM",
"eventName": "vLoadBalancer",
"policyName": "DCAE.Config_tca-hi-lo",
"policyScope": "DCAE",
{
- "controlLoopList": [
+ "acmList": [
{
"name": "PMSHInstance0",
"version": "1.0.1",
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Verify InstantiationManagementModal renders correctly 1`] = `
-<Styled(Modal)
- backdrop="static"
- keyboard={false}
- onHide={[Function]}
- show={true}
- size="sm"
->
- <ModalHeader
- closeButton={true}
- closeLabel="Close"
- >
- <ModalTitle>
- Manage Instantiation
- </ModalTitle>
- </ModalHeader>
- <div
- style={
- Object {
- "padding": "5px 5px 0 5px",
- }
- }
- >
- <ModalBody>
- <Container
- fluid={false}
- >
- <Dropdown
- navbar={false}
- onSelect={[Function]}
- >
- <DropdownToggle
- id="dropdown-basic"
- variant="dark"
- >
- Select Order State
- </DropdownToggle>
- <DropdownMenu
- align="left"
- alignRight={false}
- flip={true}
- >
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- }
- }
- disabled={false}
- eventKey="UNINITIALISED"
- >
- UNINITIALISED
- </DropdownItem>
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- }
- }
- disabled={false}
- eventKey="PASSIVE"
- >
- PASSIVE
- </DropdownItem>
- <DropdownItem
- as={
- Object {
- "$$typeof": Symbol(react.forward_ref),
- "render": [Function],
- }
- }
- disabled={false}
- eventKey="RUNNING"
- >
- RUNNING
- </DropdownItem>
- </DropdownMenu>
- </Dropdown>
- </Container>
- <Styled(Alert)
- show={false}
- variant="danger"
- >
- Can't get instantiation ordered state:
- <br />
- {}
- </Styled(Alert)>
- </ModalBody>
- <styled.div />
- </div>
- <ModalFooter>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- variant="primary"
- >
- Save
- </Button>
- <Button
- active={false}
- disabled={false}
- onClick={[Function]}
- variant="secondary"
- >
- Close
- </Button>
- </ModalFooter>
-</Styled(Modal)>
-`;
<NavDropdown.Item as={ StyledLink } to="/deploy" disabled={ this.state.disabled }>Deploy to DCAE (DEPLOY)</NavDropdown.Item>
<NavDropdown.Item as={ StyledLink } to="/undeploy" disabled={ this.state.disabled }>UnDeploy to DCAE (UNDEPLOY)</NavDropdown.Item>
</StyledNavDropdown>
- <StyledNavDropdown title="TOSCA Control Loop">
+ <StyledNavDropdown title="TOSCA Automation Composition">
<NavDropdown.Header>Instantiation</NavDropdown.Header>
<NavDropdown.Item as={ StyledLink } to="/instantiationManagement">Instantiation Management</NavDropdown.Item>
<NavDropdown.Divider/>
<NavDropdown.Header>Commissioning</NavDropdown.Header>
- <NavDropdown.Item as={ StyledLink } to="/readToscaTemplate">Manage Commissioned Tosca Template</NavDropdown.Item>
- <NavDropdown.Item as={ StyledLink } to="/uploadToscaFile">Upload Tosca to Commissioning</NavDropdown.Item>
- <NavDropdown.Item as={ StyledLink } to="/getJsonSchema">Edit Control Loop Common Properties</NavDropdown.Item>
+ <NavDropdown.Item as={ StyledLink } to="/readToscaTemplate">Manage Commissioned Automation Composition Template</NavDropdown.Item>
+ <NavDropdown.Item as={ StyledLink } to="/uploadToscaFile">Upload Automation Composition to Commissioning</NavDropdown.Item>
+ <NavDropdown.Item as={ StyledLink } to="/getJsonSchema">Edit Automation Composition Properties</NavDropdown.Item>
</StyledNavDropdown>
<StyledNavDropdown title="Help">
<StyledNavLink href="https://wiki.onap.org/" target="_blank">Wiki</StyledNavLink>
</DropdownItem>
</Styled(NavDropdown)>
<Styled(NavDropdown)
- title="TOSCA Control Loop"
+ title="TOSCA Automation Composition"
>
<DropdownHeader
role="heading"
disabled={false}
to="/readToscaTemplate"
>
- Manage Commissioned Tosca Template
+ Manage Commissioned Automation Composition Template
</DropdownItem>
<DropdownItem
as={
disabled={false}
to="/uploadToscaFile"
>
- Upload Tosca to Commissioning
+ Upload Automation Composition to Commissioning
</DropdownItem>
<DropdownItem
as={
disabled={false}
to="/getJsonSchema"
>
- Edit Control Loop Common Properties
+ Edit Automation Composition Properties
</DropdownItem>
</Styled(NavDropdown)>
<Styled(NavDropdown)