use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class SDNOValidatorImpl method healthDiagnostic.
@Override
public boolean healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId));
AAIResourcesClient client = new AAIResourcesClient();
GenericVnf vnf = client.get(GenericVnf.class, uri).orElseThrow(() -> new NotFoundException(vnfId + " not found in A&AI"));
SDNO requestDiagnostic = buildRequestDiagnostic(vnf, uuid, requestingUserId);
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(requestDiagnostic);
this.submitRequest(json);
boolean status = this.pollForResponse(uuid.toString());
return status;
}
use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class SDNOValidatorImplTest method buildRequestDiagnosticTest.
@Test
public void buildRequestDiagnosticTest() throws Exception {
SDNOValidatorImpl validator = new SDNOValidatorImpl();
UUID uuid = UUID.randomUUID();
GenericVnf vnf = new GenericVnf();
vnf.setVnfName("VNFNAME");
vnf.setVnfId("test");
vnf.setIpv4OamAddress("1.2.3.4");
vnf.setNfRole("VPE");
SDNO request = validator.buildRequestDiagnostic(vnf, uuid, "mechid");
assertEquals(request.getNodeType(), "VPE");
assertEquals(request.getOperation(), "health-diagnostic");
RequestHealthDiagnostic innerRequest = request.getBody().getInput().getRequestHealthDiagnostic();
assertEquals(innerRequest.getRequestClientName(), "MSO");
assertEquals(innerRequest.getRequestNodeName(), "VNFNAME");
assertEquals(innerRequest.getRequestNodeUuid(), "test");
assertEquals(innerRequest.getRequestNodeType(), "VPE");
assertEquals(innerRequest.getRequestNodeIp(), "1.2.3.4");
assertEquals(innerRequest.getRequestUserId(), "mechid");
assertEquals(innerRequest.getRequestId(), uuid.toString());
assertEquals(innerRequest.getHealthDiagnosticCode(), "default");
}
use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class BpmnRequestBuilderTest method test_getCloudConfigurationVfModuleReplace.
@Test
public void test_getCloudConfigurationVfModuleReplace() throws Exception {
String vnfId = "vnfId";
String vfModuleId = "vfModuleId";
GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)));
CloudConfiguration result = reqBuilder.getCloudConfigurationVfModuleReplace(vnfId, vfModuleId);
assertEquals("0422ffb57ba042c0800a29dc85ca70f8", result.getTenantId());
assertEquals("cloudOwner", result.getCloudOwner());
assertEquals("regionOne", result.getLcpCloudRegionId());
}
use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class BpmnRequestBuilderTest method test_buildVnfDeleteRequest.
@Test
public void test_buildVnfDeleteRequest() throws Exception {
GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")));
ServiceInstancesRequest expectedRequest = mapper.readValue(new File(RESOURCE_PATH + "ExpectedVnfRequest.json"), ServiceInstancesRequest.class);
ServiceInstancesRequest actualRequest = reqBuilder.buildVnfDeleteRequest("vnfId");
assertThat(actualRequest, sameBeanAs(expectedRequest));
}
Aggregations