use of org.onap.aai.domain.yang.Relationship in project so by onap.
the class AaiConnection method receiveVserverName.
public String receiveVserverName(final String genericId) {
final AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericId));
final Optional<GenericVnf> response = getResourcesClient().get(GenericVnf.class, resourceUri);
if (response.isPresent()) {
final GenericVnf genericVnf = response.get();
final RelationshipList relationshipList = genericVnf.getRelationshipList();
if (relationshipList == null || relationshipList.getRelationship() == null) {
return null;
}
for (final Relationship relationship : relationshipList.getRelationship()) {
if (VSERVER.equals(relationship.getRelatedTo())) {
final String vserverName = getRelatedToProperty(relationship, VSERVER_NAME);
if (vserverName == null) {
final String cloudOwner = getRelationshipData(relationship, CLOUD_OWNER);
final String cloudId = getRelationshipData(relationship, CLOUD_REGION_ID);
final String tenantId = getRelationshipData(relationship, TENANT_ID);
final String vserverId = getRelationshipData(relationship, VSERVER_ID);
return receiveVserverNameFromParams(cloudOwner, cloudId, tenantId, vserverId);
}
return vserverName;
}
}
}
return null;
}
use of org.onap.aai.domain.yang.Relationship in project so by onap.
the class HeatBridgeImpl method processVlanTag.
protected void processVlanTag(LInterface lInterface, List<String> vlanTags) throws HeatBridgeException {
for (String vlanTag : vlanTags) {
Relationship vlanTagRelationship = new Relationship();
vlanTagRelationship.setRelatedLink(createVlanTagUri(vlanTag));
lInterface.getRelationshipList().getRelationship().add(vlanTagRelationship);
}
}
use of org.onap.aai.domain.yang.Relationship in project so by onap.
the class HeatBridgeImpl method processOVS.
protected void processOVS(LInterface lInterface, String hostName, String interfaceName) {
Relationship lagRelationship = new Relationship();
lagRelationship.setRelatedLink(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().pserver(hostName).lagInterface(interfaceName)).build().toString());
lInterface.getRelationshipList().getRelationship().add(lagRelationship);
}
use of org.onap.aai.domain.yang.Relationship in project so by onap.
the class AAIPnfResources method isRelatedToService.
private void isRelatedToService(org.onap.aai.domain.yang.Pnf pnfFromAai) throws Exception {
if (pnfFromAai.getRelationshipList() != null) {
for (Relationship relationship : pnfFromAai.getRelationshipList().getRelationship()) {
if (relationship.getRelatedTo().equals("service-instance")) {
String errorMessage = prepareRelationErrorMessage(pnfFromAai, relationship);
logger.error(errorMessage);
throw new Exception(errorMessage);
}
}
}
}
use of org.onap.aai.domain.yang.Relationship in project so by onap.
the class AAITransactionalClientTest method testCreate.
@Test
public void testCreate() throws IOException {
final Relationship body = new Relationship();
body.setRelatedLink(uriB.build().toString());
AAITransactionalClient transactions = aaiClient.beginTransaction().create(uriA.clone().relationshipAPI(), body);
String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions());
Map<String, Object> actual = mapper.readValue(serializedTransactions, new TypeReference<Map<String, Object>>() {
});
Map<String, Object> expected = mapper.readValue(getJson("test-request-small.json"), new TypeReference<Map<String, Object>>() {
});
assertEquals(actual, expected);
}
Aggregations