/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2022 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2024 Nordix Foundation
+ * Modifications Copyright (C) 2024-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
params = ControlLoopOperationParams.builder().targetType(TargetType.PNF).build();
assertEquals(GrpcOperationPnfProperties.PNF_PROPERTY_NAMES,
GrpcOperationProperties.build(params).getPropertyNames());
-
- params = ControlLoopOperationParams.builder()
- .targetType(TargetType.VFC)
- .targetEntityIds(targetEntityIds)
- .build();
- assertEquals(GrcpOperationResourceVnfProperties.VNF_PROPERTY_NAMES,
- GrpcOperationProperties.build(params).getPropertyNames());
}
}
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019, 2023-2025 OpenInfra Foundation Europe. All rights reserved.
- ================================================================================
- 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=========================================================
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
- <artifactId>model-actors</artifactId>
- <version>4.2.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>actor.vfc</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
- <artifactId>actorServiceProvider</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
- <artifactId>aai</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
- <artifactId>events</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
- <artifactId>vfc</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
- <artifactId>actor.aai</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.common</groupId>
- <artifactId>policy-endpoints</artifactId>
- <version>${policy.common.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.common</groupId>
- <artifactId>message-bus</artifactId>
- <version>${policy.common.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
- <artifactId>actor.test</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions</groupId>
- <artifactId>simulators</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.controlloop.actor.vfc;
-
-import jakarta.ws.rs.client.Entity;
-import jakarta.ws.rs.core.MediaType;
-import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import org.apache.commons.lang3.tuple.Pair;
-import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
-import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
-import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
-import org.onap.policy.vfc.VfcRequest;
-
-public class Restart extends VfcOperation {
- public static final String NAME = "Restart";
-
- public Restart(ControlLoopOperationParams params, HttpConfig config) {
- super(params, config);
- }
-
- @Override
- protected CompletableFuture<OperationOutcome> startOperationAsync(int attempt, OperationOutcome outcome) {
-
- // starting a whole new attempt - reset the count
- resetPollCount();
-
- Pair<String, VfcRequest> pair = makeRequest();
- Entity<VfcRequest> entity = Entity.entity(pair.getRight(), MediaType.APPLICATION_JSON);
- String path = getPath() + pair.getLeft();
- String url = getClient().getBaseUrl() + path;
-
- Map<String, Object> headers = makeHeaders();
- headers.put("Accept", MediaType.APPLICATION_JSON);
-
- return handleResponse(outcome, url, callback -> getClient().post(callback, path, entity, headers));
- }
-
- /**
- * Makes a request.
- *
- * @return a pair containing the request URL and the new request
- */
- protected Pair<String, VfcRequest> makeRequest() {
-
- var request = super.constructVfcRequest();
- String requestUrl = "/" + request.getNsInstanceId() + "/heal";
- return Pair.of(requestUrl, request);
- }
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2017-2018 Intel Corp. All rights reserved.
- * Modifications Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.controlloop.actor.vfc;
-
-import org.onap.policy.controlloop.actorserviceprovider.impl.HttpActor;
-import org.onap.policy.controlloop.actorserviceprovider.impl.HttpPollingOperator;
-import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingActorParams;
-
-public class VfcActor extends HttpActor<HttpPollingActorParams> {
- public static final String NAME = "VFC";
-
- /**
- * Constructor.
- */
- public VfcActor() {
- super(NAME, HttpPollingActorParams.class);
-
- addOperator(new HttpPollingOperator(NAME, Restart.NAME, Restart::new));
- }
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.controlloop.actor.vfc;
-
-import jakarta.ws.rs.core.Response;
-import java.util.List;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
-import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
-import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
-import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperation;
-import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
-import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
-import org.onap.policy.vfc.VfcHealActionVmInfo;
-import org.onap.policy.vfc.VfcHealAdditionalParams;
-import org.onap.policy.vfc.VfcHealRequest;
-import org.onap.policy.vfc.VfcRequest;
-import org.onap.policy.vfc.VfcResponse;
-
-public abstract class VfcOperation extends HttpOperation<VfcResponse> {
- public static final String FAILED = "FAILED";
- public static final String COMPLETE = "COMPLETE";
- public static final int VFC_RESPONSE_CODE = 999;
- public static final String GENERIC_VNF_ID = "generic-vnf.vnf-id";
-
- public static final String REQ_PARAM_NM = "requestParameters";
- public static final String CONFIG_PARAM_NM = "configurationParameters";
-
- // @formatter:off
- private static final List<String> PROPERTY_NAMES = List.of(
- OperationProperties.ENRICHMENT_SERVICE_ID,
- OperationProperties.ENRICHMENT_VSERVER_ID,
- OperationProperties.ENRICHMENT_VSERVER_NAME,
- OperationProperties.ENRICHMENT_GENERIC_VNF_ID);
- // @formatter:on
-
- /**
- * Job ID extracted from the first response.
- */
- private String jobId;
-
-
- /**
- * Constructs the object.
- *
- * @param params operation parameters
- * @param config configuration for this operation
- */
- protected VfcOperation(ControlLoopOperationParams params, HttpConfig config) {
- super(params, config, VfcResponse.class, PROPERTY_NAMES);
-
- setUsePolling();
- }
-
- @Override
- protected void resetPollCount() {
- super.resetPollCount();
- jobId = null;
- }
-
- @Override
- protected String getPollingPath() {
- return super.getPollingPath() + jobId;
- }
-
- @Override
- protected Status detmStatus(Response rawResponse, VfcResponse response) {
- if (rawResponse.getStatus() == 200) {
- String requestState = getRequestState(response);
- if ("finished".equalsIgnoreCase(requestState)) {
- extractJobId(response);
- return Status.SUCCESS;
- }
-
- if ("error".equalsIgnoreCase(requestState)) {
- extractJobId(response);
- return Status.FAILURE;
- }
- }
-
- // still incomplete
-
- // need a job ID with which to query
- if (jobId == null && !extractJobId(response)) {
- throw new IllegalArgumentException("missing job ID in response");
- }
-
- return Status.STILL_WAITING;
- }
-
- private boolean extractJobId(VfcResponse response) {
- if (response == null || response.getJobId() == null) {
- return false;
- }
-
- jobId = response.getJobId();
- return true;
- }
-
- /**
- * Gets the request state of a response.
- *
- * @param response response from which to get the state
- * @return the request state of the response, or {@code null} if it does not exist
- */
- protected String getRequestState(VfcResponse response) {
- if (response == null || response.getResponseDescriptor() == null
- || StringUtils.isBlank(response.getResponseDescriptor().getStatus())) {
- return null;
- }
- return response.getResponseDescriptor().getStatus();
- }
-
- /**
- * Treats everything as a success, so we always go into
- * {@link #postProcessResponse (OperationOutcome, String, Response, SoResponse)}.
- */
- @Override
- protected boolean isSuccess(Response rawResponse, VfcResponse response) {
- return true;
- }
-
- /**
- * Prepends the message with the http status code.
- */
- @Override
- public OperationOutcome setOutcome(OperationOutcome outcome, OperationResult result, Response rawResponse,
- VfcResponse response) {
-
- // set default result and message
- setOutcome(outcome, result);
-
- int code = (result == OperationResult.FAILURE_TIMEOUT ? VFC_RESPONSE_CODE : rawResponse.getStatus());
-
- outcome.setResponse(response);
- outcome.setMessage(code + " " + outcome.getMessage());
- return outcome;
- }
-
- /**
- * Construct VfcRequestObject from the ControlLoopOperationParams.
- *
- * @return request
- */
- protected VfcRequest constructVfcRequest() {
- final String serviceInstance = getProperty(OperationProperties.ENRICHMENT_SERVICE_ID);
- final String vmId = getProperty(OperationProperties.ENRICHMENT_VSERVER_ID);
- final String vmName = getProperty(OperationProperties.ENRICHMENT_VSERVER_NAME);
- final String vnfId = getProperty(OperationProperties.ENRICHMENT_GENERIC_VNF_ID);
-
- if (StringUtils.isBlank(serviceInstance) || StringUtils.isBlank(vmId) || StringUtils.isBlank(vmName)) {
- // original code did not check the VNF id, so we won't check it either
- throw new IllegalArgumentException(
- "Missing enrichment data for service instance, server id, or server name.");
- }
-
- var vmActionInfo = new VfcHealActionVmInfo();
- vmActionInfo.setVmid(vmId);
- vmActionInfo.setVmname(vmName);
-
- var additionalParams = new VfcHealAdditionalParams();
- additionalParams.setAction(getName());
- additionalParams.setActionInfo(vmActionInfo);
-
- var healRequest = new VfcHealRequest();
- healRequest.setVnfInstanceId(vnfId);
- healRequest.setCause(getName());
- healRequest.setAdditionalParams(additionalParams);
-
- var request = new VfcRequest();
- request.setHealRequest(healRequest);
- request.setNsInstanceId(serviceInstance);
- request.setRequestId(params.getRequestId());
-
- return request;
- }
-}
+++ /dev/null
-org.onap.policy.controlloop.actor.vfc.VfcActor
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023, 2024 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.controlloop.actor.vfc;
-
-import static org.mockito.Mockito.lenient;
-
-import org.mockito.Mock;
-import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
-import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
-import org.onap.policy.common.parameters.topic.BusTopicParams;
-import org.onap.policy.controlloop.actor.test.BasicHttpOperation;
-import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingConfig;
-import org.onap.policy.simulators.Util;
-import org.onap.policy.vfc.VfcResponse;
-
-abstract class BasicVfcOperation extends BasicHttpOperation {
- static final String POLL_PATH = "my-path-get/";
- static final int MAX_POLLS = 3;
- static final int POLL_WAIT_SEC = 20;
-
- @Mock
- protected HttpPollingConfig config;
-
- protected VfcResponse response;
-
- /**
- * Constructs the object using a default actor and operation name.
- */
- BasicVfcOperation() {
- super();
- }
-
- /**
- * Constructs the object.
- *
- * @param actor actor name
- * @param operation operation name
- */
- BasicVfcOperation(String actor, String operation) {
- super(actor, operation);
- }
-
- /**
- * Starts the simulator.
- */
- protected static void initBeforeClass() throws Exception {
- Util.buildVfcSim();
-
- BusTopicParams clientParams = BusTopicParams.builder().clientName(MY_CLIENT).basePath("api/nslcm/v1/")
- .hostname("localhost").managed(true).port(Util.VFCSIM_SERVER_PORT).build();
- HttpClientFactoryInstance.getClientFactory().build(clientParams);
- }
-
- protected static void destroyAfterClass() {
- HttpClientFactoryInstance.getClientFactory().destroy();
- HttpServletServerFactoryInstance.getServerFactory().destroy();
- }
-
- /**
- * Initializes mocks and sets up.
- */
- void setUp() throws Exception {
- super.setUpBasic();
-
- response = new VfcResponse();
-
- // PLD
-
- lenient().when(rawResponse.getStatus()).thenReturn(200);
- lenient().when(rawResponse.readEntity(String.class)).thenReturn(coder.encode(response));
-
- initConfig();
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- lenient().when(config.getClient()).thenReturn(client);
- lenient().when(config.getMaxPolls()).thenReturn(MAX_POLLS);
- lenient().when(config.getPollPath()).thenReturn(POLL_PATH);
- lenient().when(config.getPollWaitSec()).thenReturn(POLL_WAIT_SEC);
- }
-
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023, 2024 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.controlloop.actor.vfc;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import java.util.List;
-import java.util.concurrent.CompletableFuture;
-import org.apache.commons.lang3.tuple.Pair;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
-import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
-import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
-import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
-import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingConfig;
-import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingParams;
-import org.onap.policy.vfc.VfcRequest;
-import org.onap.policy.vfc.VfcResponse;
-
-@ExtendWith(MockitoExtension.class)
- class RestartTest extends BasicVfcOperation {
- private static final String TEST_SERVICE_INSTANCE_ID = "test-service-instance-id";
- private static final String TEST_VSERVER_ID = "test-vserver-id";
- private static final String TEST_VSERVER_NAME = "test-vserver-name";
- private static final String TEST_GENERIC_VNF_ID = "test-generic-vnf-id";
-
- private Restart restartOper;
-
-
- @BeforeAll
- static void setUpBeforeClass() throws Exception {
- initBeforeClass();
- }
-
- @AfterAll
- static void tearDownAfterClass() {
- destroyAfterClass();
- }
-
- /**
- * setup restart operation.
- */
- @BeforeEach
- void setup() throws Exception {
- super.setUp();
-
- restartOper = new Restart(params, config);
-
- loadProperties();
- }
-
- /**
- * Tests "success" case with simulator.
- */
- @Test
- void testSuccess() throws Exception {
- HttpPollingParams opParams = HttpPollingParams.builder().clientName(MY_CLIENT).path("ns").pollPath("jobs")
- .maxPolls(1).build();
- config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
-
- params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
-
- restartOper = new Restart(params, config);
-
- loadProperties();
-
- // run the operation
- outcome = restartOper.start().get();
- assertEquals(OperationResult.SUCCESS, outcome.getResult());
- assertTrue(outcome.getResponse() instanceof VfcResponse);
- }
-
- @Test
- void testConstructor() {
- CompletableFuture<OperationOutcome> futureRes = restartOper.startOperationAsync(1, outcome);
- assertNotNull(futureRes);
- assertEquals(0, restartOper.getPollCount());
- }
-
- @Test
- void testGetPropertyNames() {
- // @formatter:off
- assertThat(restartOper.getPropertyNames()).isEqualTo(
- List.of(
- OperationProperties.ENRICHMENT_SERVICE_ID,
- OperationProperties.ENRICHMENT_VSERVER_ID,
- OperationProperties.ENRICHMENT_VSERVER_NAME,
- OperationProperties.ENRICHMENT_GENERIC_VNF_ID));
- // @formatter:on
- }
-
- @Test
- void testMakeRequest() {
- Pair<String, VfcRequest> resultPair = restartOper.makeRequest();
- assertNotNull(resultPair.getLeft());
- assertNotNull(resultPair.getRight());
- }
-
- private void loadProperties() {
- restartOper.setProperty(OperationProperties.ENRICHMENT_SERVICE_ID, TEST_SERVICE_INSTANCE_ID);
- restartOper.setProperty(OperationProperties.ENRICHMENT_VSERVER_ID, TEST_VSERVER_ID);
- restartOper.setProperty(OperationProperties.ENRICHMENT_VSERVER_NAME, TEST_VSERVER_NAME);
- restartOper.setProperty(OperationProperties.ENRICHMENT_GENERIC_VNF_ID, TEST_GENERIC_VNF_ID);
- }
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2018-2019 AT&T Corp. All rights reserved.
- * Modifications Copyright (C) 2019, 2024 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.controlloop.actor.vfc;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-import java.util.Arrays;
-import java.util.stream.Collectors;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.controlloop.actor.test.BasicActor;
-
-class VfcActorTest extends BasicActor {
-
- @Test
- void testConstructor() {
- VfcActor prov = new VfcActor();
- assertEquals(0, prov.getSequenceNumber());
-
- // verify that it has the operators we expect
- var expected = Arrays.asList(Restart.NAME).stream().sorted().collect(Collectors.toList());
- var actual = prov.getOperationNames().stream().sorted().collect(Collectors.toList());
-
- assertEquals(expected.toString(), actual.toString());
- }
-
- @Test
- void testActorService() {
- // verify that it all plugs into the ActorService
- verifyActorService(VfcActor.NAME, "service.yaml");
- }
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023, 2024 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.controlloop.actor.vfc;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertSame;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mockito;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.onap.policy.vfc.VfcResponse;
-import org.onap.policy.vfc.VfcResponseDescriptor;
-
-@ExtendWith(MockitoExtension.class)
- class VfcOperationTest extends BasicVfcOperation {
-
- private VfcOperation oper;
-
- /**
- * setUp.
- */
- @BeforeEach
- @Override
- void setUp() throws Exception {
- super.setUp();
-
- initConfig();
-
- oper = new VfcOperation(params, config) {};
- }
-
- @Test
- void testConstructor() {
- assertEquals(DEFAULT_ACTOR, oper.getActorName());
- assertEquals(DEFAULT_OPERATION, oper.getName());
- assertSame(config, oper.getConfig());
- assertTrue(oper.isUsePolling());
- }
-
- @Test
- void testResetPollCount() {
- oper.resetPollCount();
- assertEquals(0, oper.getPollCount());
- }
-
- @Test
- void testGetRequestState() {
- VfcResponse mockResponse = Mockito.mock(VfcResponse.class);
- Mockito.when(mockResponse.getResponseDescriptor()).thenReturn(null);
- assertNull(oper.getRequestState(mockResponse));
-
- VfcResponseDescriptor mockDescriptor = Mockito.mock(VfcResponseDescriptor.class);
- Mockito.when(mockResponse.getResponseDescriptor()).thenReturn(mockDescriptor);
-
- Mockito.when(mockDescriptor.getStatus()).thenReturn("COMPLETE");
- assertNotNull(oper.getRequestState(mockResponse));
- }
-
- @Test
- void testIsSuccess() {
- assertTrue(oper.isSuccess(rawResponse, response));
- }
-}
+++ /dev/null
-{
- "results": [
- {
- "vserver": {
- "vserver-id": "e7f1db09-ff78-44fc-b256-69095c5556fb",
- "vserver-name": "vfw-vm-0201-2",
- "vserver-name2": "vfw-vm-0201-2",
- "prov-status": "ACTIVE",
- "vserver-selflink": "http://ecompctl1.research.att.com:8774/v2/3f2aaef74ecb4b19b35e26d0849fe9a2/servers/e7f1db09-ff78-44fc-b256-69095c5556fb",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1549553422524",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "generic-vnf",
- "related-link": "/aai/v11/network/generic-vnfs/generic-vnf/17044ef4-e7f3-46a1-af03-e2aa562f23ac",
- "relationship-data": [
- {
- "relationship-key": "generic-vnf.vnf-id",
- "relationship-value": "17044ef4-e7f3-46a1-af03-e2aa562f23ac"
- }
- ],
- "related-to-property": [
- {
- "property-key": "generic-vnf.vnf-name",
- "property-value": "TestVM-Vnf-0201-1"
- }
- ]
- },
- {
- "related-to": "vnfc",
- "related-link": "/aai/v11/network/vnfcs/vnfc/vfw",
- "relationship-data": [
- {
- "relationship-key": "vnfc.vnfc-name",
- "relationship-value": "vfw"
- }
- ]
- },
- {
- "related-to": "vf-module",
- "related-link": "/aai/v11/network/generic-vnfs/generic-vnf/17044ef4-e7f3-46a1-af03-e2aa562f23ac/vf-modules/vf-module/33f9e03d-2fbd-4e9c-8e73-ce6b12f0b3d2",
- "relationship-data": [
- {
- "relationship-key": "generic-vnf.vnf-id",
- "relationship-value": "17044ef4-e7f3-46a1-af03-e2aa562f23ac"
- },
- {
- "relationship-key": "vf-module.vf-module-id",
- "relationship-value": "33f9e03d-2fbd-4e9c-8e73-ce6b12f0b3d2"
- }
- ]
- },
- {
- "related-to": "flavor",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/2",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "CloudOwner"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "RegionOne"
- },
- {
- "relationship-key": "flavor.flavor-id",
- "relationship-value": "2"
- }
- ],
- "related-to-property": [
- {
- "property-key": "flavor.flavor-name",
- "property-value": "m1.small"
- }
- ]
- },
- {
- "related-to": "image",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/84be7136-301f-4f47-9585-3a2e0f9534af",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "CloudOwner"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "RegionOne"
- },
- {
- "relationship-key": "image.image-id",
- "relationship-value": "84be7136-301f-4f47-9585-3a2e0f9534af"
- }
- ],
- "related-to-property": [
- {
- "property-key": "image.image-name",
- "property-value": "unknown"
- }
- ]
- }
- ]
- }
- }
- },
- {
- "generic-vnf": {
- "vnf-id": "7b202620-2936-4b0d-b09c-60b411f10f64",
- "vnf-name": "vLoadBalancerMS-Vnf-0211-1",
- "vnf-type": "vLoadBalancerMS/vLoadBalancerMS 0",
- "prov-status": "ACTIVE",
- "equipment-role": "vLB",
- "orchestration-status": "Active",
- "ipv4-oam-address": "10.0.150.1",
- "in-maint": true,
- "is-closed-loop-disabled": false,
- "resource-version": "1552311656338",
- "model-invariant-id": "724ab1cf-6120-49e8-b909-849963bed1d6",
- "model-version-id": "9d5944d8-2267-4799-824a-0f824e9a978d",
- "model-customization-id": "efcd576d-a05e-4798-bb68-79e7d9c80f4c",
- "nf-type": "ONAP-LOADBALANCER",
- "nf-function": "LOADBALANCER",
- "nf-role": "vLB",
- "nf-naming-code": "vlb",
- "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/101b8fc1-1796-4db1-a4e7-fe39c6a51558/service-data/vnfs/vnf/7b202620-2936-4b0d-b09c-60b411f10f64/vnf-data/vnf-topology/",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "service-instance",
- "related-link": "/aai/v11/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vLB/service-instances/service-instance/101b8fc1-1796-4db1-a4e7-fe39c6a51558",
- "relationship-data": [
- {
- "relationship-key": "customer.global-customer-id",
- "relationship-value": "Demonstration"
- },
- {
- "relationship-key": "service-subscription.service-type",
- "relationship-value": "vLB"
- },
- {
- "relationship-key": "service-instance.service-instance-id",
- "relationship-value": "101b8fc1-1796-4db1-a4e7-fe39c6a51558"
- }
- ],
- "related-to-property": [
- {
- "property-key": "service-instance.service-instance-name",
- "property-value": "vLoadBalancerMS-0211-1"
- }
- ]
- },
- {
- "related-to": "platform",
- "related-link": "/aai/v11/business/platforms/platform/Test-Platform",
- "relationship-data": [
- {
- "relationship-key": "platform.platform-name",
- "relationship-value": "Test-Platform"
- }
- ]
- },
- {
- "related-to": "line-of-business",
- "related-link": "/aai/v11/business/lines-of-business/line-of-business/Test-Business",
- "relationship-data": [
- {
- "relationship-key": "line-of-business.line-of-business-name",
- "relationship-value": "Test-Business"
- }
- ]
- },
- {
- "related-to": "vserver",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/3f2aaef74ecb4b19b35e26d0849fe9a2/vservers/vserver/58ca8df0-17b8-4aa2-8766-9c6c1a12cec8",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "CloudOwner"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "RegionOne"
- },
- {
- "relationship-key": "tenant.tenant-id",
- "relationship-value": "3f2aaef74ecb4b19b35e26d0849fe9a2"
- },
- {
- "relationship-key": "vserver.vserver-id",
- "relationship-value": "58ca8df0-17b8-4aa2-8766-9c6c1a12cec8"
- }
- ],
- "related-to-property": [
- {
- "property-key": "vserver.vserver-name",
- "property-value": "vdns-ms-0211-1"
- }
- ]
- },
- {
- "related-to": "vserver",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/3f2aaef74ecb4b19b35e26d0849fe9a2/vservers/vserver/6c3b3714-e36c-45af-9f16-7d3a73d99497",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "CloudOwner"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "RegionOne"
- },
- {
- "relationship-key": "tenant.tenant-id",
- "relationship-value": "3f2aaef74ecb4b19b35e26d0849fe9a2"
- },
- {
- "relationship-key": "vserver.vserver-id",
- "relationship-value": "6c3b3714-e36c-45af-9f16-7d3a73d99497"
- }
- ],
- "related-to-property": [
- {
- "property-key": "vserver.vserver-name",
- "property-value": "vlb-ms-0211-1"
- }
- ]
- },
- {
- "related-to": "availability-zone",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/availability-zones/availability-zone/nova",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "CloudOwner"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "RegionOne"
- },
- {
- "relationship-key": "availability-zone.availability-zone-name",
- "relationship-value": "nova"
- }
- ]
- }
- ]
- },
- "vf-modules": {
- "vf-module": [
- {
- "vf-module-id": "e46c6636-9ce5-4b77-bb1b-455ce9edc892",
- "vf-module-name": "vLoadBalancerMS-0211-1",
- "heat-stack-id": "vLoadBalancerMS-0211-1/73360253-2dfe-46f6-bcd6-8662a81238ea",
- "orchestration-status": "Active",
- "is-base-vf-module": true,
- "resource-version": "1552311559802",
- "model-invariant-id": "d263fc6d-cfce-4e20-8337-e06f48b474e6",
- "model-version-id": "24c0aa10-3979-402c-ad98-20124751b551",
- "model-customization-id": "65382eb1-db84-466c-b9d7-4e0f1ba7105f",
- "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/101b8fc1-1796-4db1-a4e7-fe39c6a51558/service-data/vnfs/vnf/7b202620-2936-4b0d-b09c-60b411f10f64/vnf-data/vf-modules/vf-module/e46c6636-9ce5-4b77-bb1b-455ce9edc892/vf-module-data/vf-module-topology/",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "vserver",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/3f2aaef74ecb4b19b35e26d0849fe9a2/vservers/vserver/58ca8df0-17b8-4aa2-8766-9c6c1a12cec8",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "CloudOwner"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "RegionOne"
- },
- {
- "relationship-key": "tenant.tenant-id",
- "relationship-value": "3f2aaef74ecb4b19b35e26d0849fe9a2"
- },
- {
- "relationship-key": "vserver.vserver-id",
- "relationship-value": "58ca8df0-17b8-4aa2-8766-9c6c1a12cec8"
- }
- ],
- "related-to-property": [
- {
- "property-key": "vserver.vserver-name",
- "property-value": "vdns-ms-0211-1"
- }
- ]
- },
- {
- "related-to": "vserver",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/3f2aaef74ecb4b19b35e26d0849fe9a2/vservers/vserver/6c3b3714-e36c-45af-9f16-7d3a73d99497",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "CloudOwner"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "RegionOne"
- },
- {
- "relationship-key": "tenant.tenant-id",
- "relationship-value": "3f2aaef74ecb4b19b35e26d0849fe9a2"
- },
- {
- "relationship-key": "vserver.vserver-id",
- "relationship-value": "6c3b3714-e36c-45af-9f16-7d3a73d99497"
- }
- ],
- "related-to-property": [
- {
- "property-key": "vserver.vserver-name",
- "property-value": "vlb-ms-0211-1"
- }
- ]
- }
- ]
- }
- }
- ]
- }
- }
- },
- {
- "service-instance": {
- "service-instance-id": "101b8fc1-1796-4db1-a4e7-fe39c6a51558",
- "service-instance-name": "vLoadBalancerMS-0211-1",
- "environment-context": "General_Revenue-Bearing",
- "workload-context": "Production",
- "model-invariant-id": "1008a768-1b67-407e-88c6-58c82b34ef42",
- "model-version-id": "81f8c1cd-f664-4450-b3a4-be645613ab32",
- "resource-version": "1552311350334",
- "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/101b8fc1-1796-4db1-a4e7-fe39c6a51558/service-data/service-topology/",
- "orchestration-status": "Active",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "project",
- "related-link": "/aai/v11/business/projects/project/Test-Project",
- "relationship-data": [
- {
- "relationship-key": "project.project-name",
- "relationship-value": "Test-Project"
- }
- ]
- },
- {
- "related-to": "generic-vnf",
- "related-link": "/aai/v11/network/generic-vnfs/generic-vnf/7b202620-2936-4b0d-b09c-60b411f10f64",
- "relationship-data": [
- {
- "relationship-key": "generic-vnf.vnf-id",
- "relationship-value": "7b202620-2936-4b0d-b09c-60b411f10f64"
- }
- ],
- "related-to-property": [
- {
- "property-key": "generic-vnf.vnf-name",
- "property-value": "vLoadBalancerMS-Vnf-0211-1"
- }
- ]
- },
- {
- "related-to": "owning-entity",
- "related-link": "/aai/v11/business/owning-entities/owning-entity/bb94a687-4f3b-40a3-914e-e98037d5ebd2",
- "relationship-data": [
- {
- "relationship-key": "owning-entity.owning-entity-id",
- "relationship-value": "bb94a687-4f3b-40a3-914e-e98037d5ebd2"
- }
- ]
- }
- ]
- }
- }
- },
- {
- "generic-vnf": {
- "vnf-id": "17044ef4-e7f3-46a1-af03-e2aa562f23ac",
- "vnf-name": "TestVM-Vnf-0201-1",
- "vnf-type": "TestVM/TestVM 0",
- "prov-status": "ACTIVE",
- "equipment-role": "",
- "orchestration-status": "Active",
- "ipv4-oam-address": "10.0.70.1",
- "in-maint": true,
- "is-closed-loop-disabled": false,
- "resource-version": "1549041636264",
- "model-invariant-id": "6a4d7971-0778-4655-9eab-9d6031c7ad57",
- "model-version-id": "fb6c673c-e5b6-4e0a-9baf-5e0089784de9",
- "model-customization-id": "706a3100-dbe5-442e-86c3-c7b823abbec2",
- "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/d41f8217-d464-4458-bf0a-fba33a0f1b31/service-data/vnfs/vnf/17044ef4-e7f3-46a1-af03-e2aa562f23ac/vnf-data/vnf-topology/",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "service-instance",
- "related-link": "/aai/v11/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW/service-instances/service-instance/d41f8217-d464-4458-bf0a-fba33a0f1b31",
- "relationship-data": [
- {
- "relationship-key": "customer.global-customer-id",
- "relationship-value": "Demonstration"
- },
- {
- "relationship-key": "service-subscription.service-type",
- "relationship-value": "vFW"
- },
- {
- "relationship-key": "service-instance.service-instance-id",
- "relationship-value": "d41f8217-d464-4458-bf0a-fba33a0f1b31"
- }
- ],
- "related-to-property": [
- {
- "property-key": "service-instance.service-instance-name",
- "property-value": "TestVM-Service-0201-1"
- }
- ]
- },
- {
- "related-to": "platform",
- "related-link": "/aai/v11/business/platforms/platform/Test-Platform",
- "relationship-data": [
- {
- "relationship-key": "platform.platform-name",
- "relationship-value": "Test-Platform"
- }
- ]
- },
- {
- "related-to": "line-of-business",
- "related-link": "/aai/v11/business/lines-of-business/line-of-business/Test-Business",
- "relationship-data": [
- {
- "relationship-key": "line-of-business.line-of-business-name",
- "relationship-value": "Test-Business"
- }
- ]
- },
- {
- "related-to": "vserver",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/3f2aaef74ecb4b19b35e26d0849fe9a2/vservers/vserver/e7f1db09-ff78-44fc-b256-69095c5556fb",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "CloudOwner"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "RegionOne"
- },
- {
- "relationship-key": "tenant.tenant-id",
- "relationship-value": "3f2aaef74ecb4b19b35e26d0849fe9a2"
- },
- {
- "relationship-key": "vserver.vserver-id",
- "relationship-value": "e7f1db09-ff78-44fc-b256-69095c5556fb"
- }
- ],
- "related-to-property": [
- {
- "property-key": "vserver.vserver-name",
- "property-value": "vfw-vm-0201-2"
- }
- ]
- },
- {
- "related-to": "availability-zone",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionTwo/availability-zones/availability-zone/zone-1",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "CloudOwner"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "RegionTwo"
- },
- {
- "relationship-key": "availability-zone.availability-zone-name",
- "relationship-value": "zone-1"
- }
- ]
- }
- ]
- },
- "vf-modules": {
- "vf-module": [
- {
- "vf-module-id": "0afde97a-3e3f-4597-aec3-e5488c0f20b7",
- "vf-module-name": "TestVM-0201-1",
- "heat-stack-id": "TestVM-0201-1/aee4d7e5-b4a0-4261-b3cf-bb23348a3d99",
- "orchestration-status": "Active",
- "is-base-vf-module": true,
- "resource-version": "1549039401119",
- "model-invariant-id": "6af68fdb-6479-43e2-8989-938f06c994bd",
- "model-version-id": "16d1834e-d834-431f-b064-98c469c6505d",
- "model-customization-id": "29ffb122-22c8-48d2-b152-b52d9e81e910",
- "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/d41f8217-d464-4458-bf0a-fba33a0f1b31/service-data/vnfs/vnf/17044ef4-e7f3-46a1-af03-e2aa562f23ac/vnf-data/vf-modules/vf-module/0afde97a-3e3f-4597-aec3-e5488c0f20b7/vf-module-data/vf-module-topology/"
- },
- {
- "vf-module-id": "33f9e03d-2fbd-4e9c-8e73-ce6b12f0b3d2",
- "vf-module-name": "TestVM-0201-2",
- "heat-stack-id": "TestVM-0201-2/1b9db6b8-620b-46f1-935a-8a61c294a98b",
- "orchestration-status": "Active",
- "is-base-vf-module": true,
- "resource-version": "1549041447373",
- "model-invariant-id": "6af68fdb-6479-43e2-8989-938f06c994bd",
- "model-version-id": "16d1834e-d834-431f-b064-98c469c6505d",
- "model-customization-id": "29ffb122-22c8-48d2-b152-b52d9e81e910",
- "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/d41f8217-d464-4458-bf0a-fba33a0f1b31/service-data/vnfs/vnf/17044ef4-e7f3-46a1-af03-e2aa562f23ac/vnf-data/vf-modules/vf-module/33f9e03d-2fbd-4e9c-8e73-ce6b12f0b3d2/vf-module-data/vf-module-topology/",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "vserver",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/3f2aaef74ecb4b19b35e26d0849fe9a2/vservers/vserver/e7f1db09-ff78-44fc-b256-69095c5556fb",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "CloudOwner"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "RegionOne"
- },
- {
- "relationship-key": "tenant.tenant-id",
- "relationship-value": "3f2aaef74ecb4b19b35e26d0849fe9a2"
- },
- {
- "relationship-key": "vserver.vserver-id",
- "relationship-value": "e7f1db09-ff78-44fc-b256-69095c5556fb"
- }
- ],
- "related-to-property": [
- {
- "property-key": "vserver.vserver-name",
- "property-value": "vfw-vm-0201-2"
- }
- ]
- }
- ]
- }
- }
- ]
- }
- }
- },
- {
- "vf-module": {
- "vf-module-id": "0afde97a-3e3f-4597-aec3-e5488c0f20b7",
- "vf-module-name": "TestVM-0201-1",
- "heat-stack-id": "TestVM-0201-1/aee4d7e5-b4a0-4261-b3cf-bb23348a3d99",
- "orchestration-status": "Active",
- "is-base-vf-module": true,
- "resource-version": "1549039401119",
- "model-invariant-id": "6af68fdb-6479-43e2-8989-938f06c994bd",
- "model-version-id": "16d1834e-d834-431f-b064-98c469c6505d",
- "model-customization-id": "29ffb122-22c8-48d2-b152-b52d9e81e910",
- "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/d41f8217-d464-4458-bf0a-fba33a0f1b31/service-data/vnfs/vnf/17044ef4-e7f3-46a1-af03-e2aa562f23ac/vnf-data/vf-modules/vf-module/0afde97a-3e3f-4597-aec3-e5488c0f20b7/vf-module-data/vf-module-topology/"
- }
- },
- {
- "vf-module": {
- "vf-module-id": "33f9e03d-2fbd-4e9c-8e73-ce6b12f0b3d2",
- "vf-module-name": "TestVM-0201-2",
- "heat-stack-id": "TestVM-0201-2/1b9db6b8-620b-46f1-935a-8a61c294a98b",
- "orchestration-status": "Active",
- "is-base-vf-module": true,
- "resource-version": "1549041447373",
- "model-invariant-id": "6af68fdb-6479-43e2-8989-938f06c994bd",
- "model-version-id": "16d1834e-d834-431f-b064-98c469c6505d",
- "model-customization-id": "29ffb122-22c8-48d2-b152-b52d9e81e910",
- "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/d41f8217-d464-4458-bf0a-fba33a0f1b31/service-data/vnfs/vnf/17044ef4-e7f3-46a1-af03-e2aa562f23ac/vnf-data/vf-modules/vf-module/33f9e03d-2fbd-4e9c-8e73-ce6b12f0b3d2/vf-module-data/vf-module-topology/",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "vserver",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/3f2aaef74ecb4b19b35e26d0849fe9a2/vservers/vserver/e7f1db09-ff78-44fc-b256-69095c5556fb",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "CloudOwner"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "RegionOne"
- },
- {
- "relationship-key": "tenant.tenant-id",
- "relationship-value": "3f2aaef74ecb4b19b35e26d0849fe9a2"
- },
- {
- "relationship-key": "vserver.vserver-id",
- "relationship-value": "e7f1db09-ff78-44fc-b256-69095c5556fb"
- }
- ],
- "related-to-property": [
- {
- "property-key": "vserver.vserver-name",
- "property-value": "vfw-vm-0201-2"
- }
- ]
- }
- ]
- }
- }
- },
- {
- "tenant": {
- "tenant-id": "tenant1-16197-as988q",
- "tenant-name": "tenant-name-16197-as988q",
- "resource-version": "1550769793637",
- "vservers": {
- "vserver": [
- {
- "vserver-id": "vserver1-16197-as988q",
- "vserver-name": "vserverName",
- "vserver-name2": "vserverTE-name2-as988q",
- "prov-status": "ACTIVE",
- "vserver-selflink": "TRINITY vserverLink",
- "in-maint": false,
- "is-closed-loop-disabled": false,
- "resource-version": "1550769794551",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "generic-vnf",
- "relationship-label": "tosca.relationships.HostedOn",
- "related-link": "/aai/v16/network/generic-vnfs/generic-vnf/VNF1-16197-as988q",
- "relationship-data": [
- {
- "relationship-key": "generic-vnf.vnf-id",
- "relationship-value": "VNF1-16197-as988q"
- }
- ],
- "related-to-property": [
- {
- "property-key": "generic-vnf.vnf-name",
- "property-value": "vnf1Name"
- }
- ]
- }
- ]
- }
- }
- ]
- }
- }
- },
- {
- "cloud-region": {
- "cloud-owner": "co-16197-01-as988q",
- "cloud-region-id": "cr-16197-01-as988q",
- "resource-version": "1550769792672",
- "orchestration-disabled": false,
- "in-maint": false,
- "tenants": {
- "tenant": [
- {
- "tenant-id": "tenant1-16197-as988q",
- "tenant-name": "tenant-name-16197-as988q",
- "resource-version": "1550769793637"
- }
- ]
- }
- }
- }
- ]
-}
+++ /dev/null
-#
-# ============LICENSE_START======================================================
-# ONAP
-# ===============================================================================
-# Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
-# ===============================================================================
-# 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.
-# ============LICENSE_END========================================================
-#
-httpClients:
-- clientName: my-client
- hostname: localhost
- port: 80
- basePath: base-url/
- managed: true
-actors:
- VFC:
- clientName: my-client
- pollPath: jobs
- pollWaitSec: 20
- maxPolls: 20
- operations:
- Restart:
- path: ns
- timeoutSec: 60
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.policy.controlloop.actorserviceprovider;
public enum TargetType {
- VM("VM"), PNF("PNF"), VFC("VFC"), VNF("VNF"), VFMODULE("VFMODULE");
+ VM("VM"), PNF("PNF"), VNF("VNF"), VFMODULE("VFMODULE");
- private String target;
+ private final String target;
- private TargetType(String targetType) {
+ TargetType(String targetType) {
this.target = targetType;
}
if (targetType.equalsIgnoreCase(PNF.toString())) {
return PNF;
}
- if (targetType.equalsIgnoreCase(VFC.toString())) {
- return VFC;
- }
if (targetType.equalsIgnoreCase(VNF.toString())) {
return VNF;
}
<module>actor.sdnr</module>
<module>actor.a1p</module>
<module>actor.so</module>
- <module>actor.vfc</module>
<module>actor.xacml</module>
</modules>
<dependencies>
<module>sdnc</module>
<module>sdnr</module>
<module>so</module>
- <module>vfc</module>
</modules>
</project>
+++ /dev/null
-<!--
- ============LICENSE_START=======================================================
- Copyright (C) 2017 Intel Corp. All rights reserved.
- Modifications Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019, 2023-2025 OpenInfra Foundation Europe. All rights reserved.
- ================================================================================
- 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=========================================================
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
- <artifactId>model-impl</artifactId>
- <version>4.2.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>vfc</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- </dependency>
- </dependencies>
-</project>
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2017-2019 Intel Corp. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2018-2019, 2021 AT&T Corporation. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.vfc;
-
-import java.io.Serializable;
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-public class VfcHealActionVmInfo implements Serializable {
-
- private static final long serialVersionUID = 3208673205100673119L;
-
- private String vmid;
- private String vmname;
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2017-2019 Intel Corp. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2018-2019, 2021 AT&T Corporation. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.vfc;
-
-import com.google.gson.annotations.SerializedName;
-import java.io.Serializable;
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-public class VfcHealAdditionalParams implements Serializable {
-
- private static final long serialVersionUID = 2656694137285096191L;
-
- private String action;
-
- @SerializedName("actionvminfo")
- private VfcHealActionVmInfo actionInfo;
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2017-2019 Intel Corp. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2018-2019, 2021 AT&T Corporation. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.vfc;
-
-import java.io.Serializable;
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-public class VfcHealRequest implements Serializable {
-
- private static final long serialVersionUID = -7341931593089709247L;
-
- private String vnfInstanceId;
- private String cause;
- private VfcHealAdditionalParams additionalParams;
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2017-2019 Intel Corp. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2018-2019, 2021 AT&T Corporation. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.vfc;
-
-import com.google.gson.annotations.SerializedName;
-import java.io.Serializable;
-import java.util.UUID;
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-public class VfcRequest implements Serializable {
-
- private static final long serialVersionUID = 3736300970326332512L;
- // These fields are not serialized and not part of JSON
- private transient String nsInstanceId;
- private transient UUID requestId;
-
- @SerializedName("healVnfData")
- private VfcHealRequest healRequest;
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2017-2019 Intel Corp. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2018-2019, 2021 AT&T Corporation. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.vfc;
-
-import java.io.Serializable;
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-public class VfcResponse implements Serializable {
-
- private static final long serialVersionUID = 9151443891238218455L;
-
- private String jobId;
- private VfcResponseDescriptor responseDescriptor;
-
- private transient String requestId;
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2017-2019 Intel Corp. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2018-2019, 2021 AT&T Corporation. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.vfc;
-
-import java.io.Serializable;
-import java.util.List;
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-public class VfcResponseDescriptor implements Serializable {
-
- private static final long serialVersionUID = 6827782899144150158L;
-
- private String progress;
- private String status;
- private String statusDescription;
- private String errorCode;
- private String responseId;
- private List<VfcResponseDescriptor> responseHistoryList;
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2017-2019 Intel Corp. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2018, 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.vfc.util;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class Serialization {
- public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping()
- .setPrettyPrinting()
- .create();
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2017-2019 Intel Corp. All rights reserved.
- * Modifications Copyright (C) 2019, 2024 Nordix Foundation.
- * Modifications Copyright (C) 2018-2020 AT&T Corporation. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.vfc;
-
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import java.util.LinkedList;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.vfc.util.Serialization;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-class DemoTest {
- private static final Logger logger = LoggerFactory.getLogger(DemoTest.class);
-
- @Test
- void test() {
- VfcRequest request = new VfcRequest();
-
- request.setNsInstanceId("100");
- request.setHealRequest(new VfcHealRequest());
- request.getHealRequest().setVnfInstanceId("1");
- request.getHealRequest().setCause("vm is down");
-
- request.getHealRequest().setAdditionalParams(new VfcHealAdditionalParams());
- request.getHealRequest().getAdditionalParams().setAction("restartvm");
-
- request.getHealRequest().getAdditionalParams().setActionInfo(new VfcHealActionVmInfo());
- request.getHealRequest().getAdditionalParams().getActionInfo().setVmid("33");
- request.getHealRequest().getAdditionalParams().getActionInfo().setVmname("xgw-smp11");
-
- String body = Serialization.gsonPretty.toJson(request);
- logger.info("{}", body);
-
- VfcResponse response = new VfcResponse();
- response.setJobId("1");
-
- body = Serialization.gsonPretty.toJson(response);
- logger.info("{}", body);
-
- response.setResponseDescriptor(new VfcResponseDescriptor());
- response.getResponseDescriptor().setProgress("40");
- response.getResponseDescriptor().setStatus("processing");
- response.getResponseDescriptor().setStatusDescription("OMC VMs are decommissioned in VIM");
- response.getResponseDescriptor().setErrorCode(null);
- response.getResponseDescriptor().setResponseId("42");
- body = Serialization.gsonPretty.toJson(response);
- logger.info("{}", body);
-
- VfcResponseDescriptor responseDescriptor = new VfcResponseDescriptor();
- responseDescriptor.setProgress("20");
- responseDescriptor.setStatus("processing");
- responseDescriptor.setStatusDescription("OMC VMs are decommissioned in VIM");
- responseDescriptor.setErrorCode(null);
- responseDescriptor.setResponseId("11");
-
- response.getResponseDescriptor().setResponseHistoryList(new LinkedList<>());
- response.getResponseDescriptor().getResponseHistoryList().add(responseDescriptor);
-
- body = Serialization.gsonPretty.toJson(response);
- logger.info("{}", body);
-
- response = Serialization.gsonPretty.fromJson(body, VfcResponse.class);
- body = Serialization.gsonPretty.toJson(response);
- logger.info("{}", body);
-
- assertNotNull(body);
- }
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * vfc
- * ================================================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019, 2024 Nordix Foundation.
- * Modifications Copyright (C) 2018-2019 AT&T Corporation. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.vfc;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import org.junit.jupiter.api.Test;
-
-class VfcHealActionVmInfoTest {
-
- @Test
- void testVfcHealActionVmInfo() {
- VfcHealActionVmInfo actionInfo = new VfcHealActionVmInfo();
- assertNotNull(actionInfo);
- assertNotEquals(0, actionInfo.hashCode());
-
- String vmid = "ECity";
- actionInfo.setVmid(vmid);
- assertEquals(vmid, actionInfo.getVmid());
-
- String vmName = "Emerald City";
- actionInfo.setVmname(vmName);
- assertEquals(vmName, actionInfo.getVmname());
-
- assertNotEquals(0, actionInfo.hashCode());
- }
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * vfc
- * ================================================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019, 2024 Nordix Foundation.
- * Modifications Copyright (C) 2018-2019 AT&T Corporation. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.vfc;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import org.junit.jupiter.api.Test;
-
-class VfcHealAdditionalParamsTest {
-
- @Test
- void testVfcHealAdditionalParameters() {
- VfcHealAdditionalParams additionalParams = new VfcHealAdditionalParams();
- assertNotNull(additionalParams);
- assertNotEquals(0, additionalParams.hashCode());
-
- String action = "Go Home";
- additionalParams.setAction(action);
- assertEquals(action, additionalParams.getAction());
-
- VfcHealActionVmInfo actionInfo = new VfcHealActionVmInfo();
- additionalParams.setActionInfo(actionInfo);
- assertEquals(actionInfo, additionalParams.getActionInfo());
-
- assertNotEquals(0, additionalParams.hashCode());
- }
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * vfc
- * ================================================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019, 2024 Nordix Foundation.
- * Modifications Copyright (C) 2018-2019 AT&T Corporation. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.vfc;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import org.junit.jupiter.api.Test;
-
-class VfcHealRequestTest {
-
- @Test
- void testVfcHealRequest() {
- VfcHealRequest request = new VfcHealRequest();
- assertNotNull(request);
- assertNotEquals(0, request.hashCode());
-
- String vnfInstanceId = "Go To Oz";
- request.setVnfInstanceId(vnfInstanceId);
- assertEquals(vnfInstanceId, request.getVnfInstanceId());
-
- String cause = "West Witch";
- request.setCause(cause);
- assertEquals(cause, request.getCause());
-
- VfcHealAdditionalParams additionalParams = new VfcHealAdditionalParams();
- request.setAdditionalParams(additionalParams);
- assertEquals(additionalParams, request.getAdditionalParams());
-
- assertNotEquals(0, request.hashCode());
- }
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * vfc
- * ================================================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019, 2024 Nordix Foundation.
- * Modifications Copyright (C) 2018-2019 AT&T Corporation. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.vfc;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import java.util.UUID;
-import org.junit.jupiter.api.Test;
-
-class VfcRequestTest {
-
- @Test
- void testVfcRequest() {
- VfcRequest request = new VfcRequest();
- assertNotNull(request);
- assertNotEquals(0, request.hashCode());
-
- String nsInstanceId = "Dorothy";
- request.setNsInstanceId(nsInstanceId);
- assertEquals(nsInstanceId, request.getNsInstanceId());
-
- UUID requestId = UUID.randomUUID();
- request.setRequestId(requestId);
- assertEquals(requestId, request.getRequestId());
-
- VfcHealRequest healRequest = new VfcHealRequest();
- request.setHealRequest(healRequest);
- assertEquals(healRequest, request.getHealRequest());
-
- assertNotEquals(0, request.hashCode());
- }
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * vfc
- * ================================================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019, 2024 Nordix Foundation.
- * Modifications Copyright (C) 2018-2019 AT&T Corporation. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.vfc;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.jupiter.api.Test;
-
-class VfcResponseDescriptorTest {
-
- @Test
- void testVfcResponseDescriptor() {
- VfcResponseDescriptor descriptor = new VfcResponseDescriptor();
- assertNotNull(descriptor);
- assertNotEquals(0, descriptor.hashCode());
-
- String errorCode = "WitchIsDead";
- descriptor.setErrorCode(errorCode);
- assertEquals(errorCode, descriptor.getErrorCode());
-
- String progress = "Visited Wizard";
- descriptor.setProgress(progress);
- assertEquals(progress, descriptor.getProgress());
-
- List<VfcResponseDescriptor> responseHistoryList = new ArrayList<>();
- descriptor.setResponseHistoryList(responseHistoryList);
- assertEquals(responseHistoryList, descriptor.getResponseHistoryList());
-
- String responseId = "WishHard";
- descriptor.setResponseId(responseId);
- assertEquals(responseId, descriptor.getResponseId());
-
- String status = "Back in Kansas";
- descriptor.setStatus(status);
- assertEquals(status, descriptor.getStatus());
-
- String statusDescription = "Back on the prairie";
- descriptor.setStatusDescription(statusDescription);
- assertEquals(statusDescription, descriptor.getStatusDescription());
-
- assertNotEquals(0, descriptor.hashCode());
- }
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * vfc
- * ================================================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019, 2024 Nordix Foundation.
- * Modifications Copyright (C) 2018-2019 AT&T Corporation. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.vfc;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import org.junit.jupiter.api.Test;
-
-class VfcResponseTest {
-
- @Test
- void testVfcResponse() {
- VfcResponse response = new VfcResponse();
- assertNotNull(response);
- assertNotEquals(0, response.hashCode());
-
- String jobId = "GetToOz";
- response.setJobId(jobId);
- assertEquals(jobId, response.getJobId());
-
- String requestId = "Get Home";
- response.setRequestId(requestId);
- assertEquals(requestId, response.getRequestId());
-
- VfcResponseDescriptor responseDescriptor = new VfcResponseDescriptor();
- response.setResponseDescriptor(responseDescriptor);
- assertEquals(responseDescriptor, response.getResponseDescriptor());
-
- assertNotEquals(0, response.hashCode());
- }
-}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * vfc
- * ================================================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019, 2024 Nordix Foundation.
- * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.vfc.util;
-
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import org.junit.jupiter.api.Test;
-
-class SerializationTest {
-
- @Test
- void test() {
- assertNotNull(Serialization.gsonPretty);
- }
-}
* simulators
* ================================================================================
* Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019, 2023-2025 Nordix Foundation.
+ * Modifications Copyright (C) 2019, 2023-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
public final class Util {
public static final String AAISIM_SERVER_NAME = "aaiSim";
public static final String SOSIM_SERVER_NAME = "soSim";
- public static final String VFCSIM_SERVER_NAME = "vfcSim";
public static final String XACMLSIM_SERVER_NAME = "xacmlSim";
public static final String SDNCSIM_SERVER_NAME = "sdncSim";
public static final int AAISIM_SERVER_PORT = 6666;
public static final int SOSIM_SERVER_PORT = 6667;
- public static final int VFCSIM_SERVER_PORT = 6668;
public static final int XACMLSIM_SERVER_PORT = 6669;
public static final int SDNCSIM_SERVER_PORT = 6670;
public static final int CDSSIM_SERVER_PORT = 6671;
return testServer;
}
- /**
- * Build a VFC simulator.
- *
- * @return the simulator
- * @throws InterruptedException if a thread is interrupted
- */
- public static HttpServletServer buildVfcSim() throws InterruptedException {
- final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory()
- .build(VFCSIM_SERVER_NAME, LOCALHOST, VFCSIM_SERVER_PORT, "/", false, true);
- testServer.addServletClass("/*", VfcSimulatorJaxRs.class.getName());
- testServer.waitedStart(5000);
- waitForServerToListen(testServer.getPort());
- return testServer;
- }
-
/**
* Build a guard simulator.
*
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * simulators
- * ================================================================================
- * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019, 2023 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.simulators;
-
-import jakarta.servlet.http.HttpServletResponse;
-import jakarta.ws.rs.Consumes;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.core.Context;
-import jakarta.ws.rs.core.MediaType;
-import org.slf4j.LoggerFactory;
-
-@Path("/api/nslcm/v1")
-public class VfcSimulatorJaxRs {
-
- /**
- * VFC post query.
- *
- * @param nsInstanceId the NS instance
- * @param response the response
- * @return the response
- */
- @POST
- @Path("/ns/{nsInstanceId}/heal")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces("application/json")
- public String vfcPostQuery(@PathParam("nsInstanceId") String nsInstanceId,
- @Context final HttpServletResponse response) {
- response.setStatus(HttpServletResponse.SC_ACCEPTED);
- try {
- response.flushBuffer();
- } catch (Exception e) {
- final var logger = LoggerFactory.getLogger(VfcSimulatorJaxRs.class);
- logger.error("flushBuffer threw: ", e);
- return "";
- }
-
- return "{\"jobId\":\"1\"}";
- }
-
- /**
- * VFC get query.
- *
- * @param jobId the job id
- * @return the response
- */
- @GET
- @Path("/jobs/{jobId}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces("application/json")
- public String vfcGetQuery(@PathParam("jobId") String jobId) {
- return "{\"jobId\" : " + jobId
- + ",\"responseDescriptor\" : {\"progress\" : \"40\",\"status\" : \"finished\",\"statusDescription"
- + "\" : \"OMC VMs are decommissioned in VIM\",\"errorCode\" : null,\"responseId\": 101 ,\""
- + "responseHistoryList\": [{\"progress\" : \"40\",\"status\" : \"processing\",\"statusDescription"
- + "\" : \"OMC VMs are decommissioned in VIM\",\"errorCode\" : null,\"responseId\" : \"1\"}, {\""
- + "progress\" : \"41\",\"status\" : \"processing\",\"statusDescription\" : \"OMC VMs are "
- + "decommissioned in VIM\",\"errorCode\" : null,\"responseId\" : \"2\"}]}}";
- }
-
-}
-
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * simulators
- * ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2024 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.simulators;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.fail;
-
-import java.util.HashMap;
-import org.apache.commons.lang3.tuple.Pair;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
-import org.onap.policy.rest.RestManager;
-import org.onap.policy.vfc.VfcResponse;
-import org.onap.policy.vfc.util.Serialization;
-
-class VfcSimulatorTest {
-
- /**
- * Set up test class.
- */
- @BeforeAll
- public static void setUpSimulator() {
- try {
- var testServer = Util.buildVfcSim();
- assertNotNull(testServer);
- } catch (final Exception e) {
- fail(e.getMessage());
- }
- }
-
- @AfterAll
- public static void tearDownSimulator() {
- HttpServletServerFactoryInstance.getServerFactory().destroy();
- }
-
- @Test
- void testPost() {
- final Pair<Integer, String> httpDetails =
- new RestManager().post("http://localhost:6668/api/nslcm/v1/ns/1234567890/heal", "username", "password",
- new HashMap<>(), "application/json", "Some Request Here");
- assertNotNull(httpDetails);
- assertEquals(202, httpDetails.getLeft().intValue());
- final VfcResponse response = Serialization.gsonPretty.fromJson(httpDetails.getRight(), VfcResponse.class);
- assertNotNull(response);
- }
-
- @Test
- void testGet() {
- final Pair<Integer, String> httpDetails = new RestManager().get("http://localhost:6668/api/nslcm/v1/jobs/1234",
- "username", "password", new HashMap<>());
- assertNotNull(httpDetails);
- final VfcResponse response = Serialization.gsonPretty.fromJson(httpDetails.getRight(), VfcResponse.class);
- assertNotNull(response);
- }
-}