use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class SDNOValidatorIT method run.
@Ignore
@Test
public void run() throws Exception {
SDNOValidatorImpl validator = new SDNOValidatorImpl();
UUID uuid = UUID.randomUUID();
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("test");
vnf.setIpv4OamAddress("1.2.3.4");
vnf.setNfRole("VPE");
SDNO request = validator.buildRequestDiagnostic(vnf, uuid, "mechid");
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(request);
validator.submitRequest(json);
thrown.expect(DMaaPConsumerFailure.class);
boolean result = validator.pollForResponse(uuid.toString());
System.out.println(json);
}
use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class AaiConnection method receiveGenericVnfId.
public String receiveGenericVnfId(final String href) {
final AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam(SELFLINK, href);
final Optional<GenericVnfs> response = getResourcesClient().get(GenericVnfs.class, resourceUri);
if (response.isPresent()) {
final GenericVnfs vnfs = response.get();
logger.info("The AAI replied with: {}", vnfs);
final List<GenericVnf> genericVnfList = vnfs.getGenericVnf();
final int size = genericVnfList.size();
if (size == 1) {
final GenericVnf genericVnf = genericVnfList.get(FIRST_INDEX);
return genericVnf.getVnfId();
} else if (size > 1) {
logger.warn("more generic vnfs available");
}
}
return null;
}
use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class AaiResourceIdValidatorTest method validateResourceIdInAAIVnfTest.
@Test
public void validateResourceIdInAAIVnfTest() throws Exception {
RequestDetails reqDetails = setupRequestDetails();
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId("siId123");
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("id123");
vnf.setModelCustomizationId("1234567");
Optional<GenericVnf> opVnf = Optional.of(vnf);
GenericVnf vnf2 = new GenericVnf();
vnf2.setVnfId("id123");
vnf2.setModelCustomizationId("222");
Optional<GenericVnf> opVnf2 = Optional.of(vnf2);
when(bbInputSetupUtilsMock.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName123")).thenReturn(opVnf);
when(bbInputSetupUtilsMock.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName222")).thenReturn(opVnf2);
String id = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "vnfName123", reqDetails, workflowResourceIds);
assertEquals("id123", id);
String id2 = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "nameTest", reqDetails, workflowResourceIds);
assertEquals("generatedId123", id2);
this.expectedException.expect(DuplicateNameException.class);
this.expectedException.expectMessage(containsString("generic-vnf with name (vnfName222), same parent and different customization id (222) already exists. The name must be unique."));
testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "vnfName222", reqDetails, workflowResourceIds);
}
use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class AaiResourceIdValidatorTest method validateVnfResourceIdInAAISameModelCustomizationIdTest.
@Test
public void validateVnfResourceIdInAAISameModelCustomizationIdTest() throws Exception {
RequestDetails reqDetails = setupRequestDetails();
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId("siId123");
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("id123");
vnf.setModelCustomizationId("1234567");
Optional<GenericVnf> opVnf = Optional.of(vnf);
when(bbInputSetupUtilsMock.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName123")).thenReturn(opVnf);
String id = testedObject.validateVnfResourceIdInAAI("generatedId123", "vnfName123", reqDetails, workflowResourceIds);
assertEquals("id123", id);
}
use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class AaiResourceIdValidatorTest method validateVnfResourceIdInAAIDiffModelCustomizationIdTest.
@Test
public void validateVnfResourceIdInAAIDiffModelCustomizationIdTest() throws Exception {
RequestDetails reqDetails = setupRequestDetails();
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId("siId123");
GenericVnf vnf = new GenericVnf();
vnf.setModelCustomizationId("9999999");
Optional<GenericVnf> opVnf = Optional.of(vnf);
when(bbInputSetupUtilsMock.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName123")).thenReturn(opVnf);
this.expectedException.expect(DuplicateNameException.class);
this.expectedException.expectMessage(containsString("generic-vnf with name (vnfName123), same parent and different customization id (9999999) already exists. The name must be unique."));
testedObject.validateVnfResourceIdInAAI("generatedId123", "vnfName123", reqDetails, workflowResourceIds);
}
Aggregations