Search in sources :

Example 1 with RelationshipData

use of org.onap.aai.domain.yang.RelationshipData in project so by onap.

the class AaiConnectionTest method testRelationshipData.

@Test
public void testRelationshipData() {
    // given
    final Relationship relationship = new Relationship();
    final RelationshipData data = new RelationshipData();
    data.setRelationshipKey(KEY);
    data.setRelationshipValue(VALUE);
    relationship.getRelationshipData().add(data);
    // when
    final String value = AaiConnection.getRelationshipData(relationship, KEY);
    // then
    assertEquals(VALUE, value);
}
Also used : RelationshipData(org.onap.aai.domain.yang.RelationshipData) Relationship(org.onap.aai.domain.yang.Relationship) Test(org.junit.Test)

Example 2 with RelationshipData

use of org.onap.aai.domain.yang.RelationshipData in project so by onap.

the class AAIPnfResources method prepareRelationErrorMessage.

private String prepareRelationErrorMessage(org.onap.aai.domain.yang.Pnf pnfFromAai, Relationship relationship) {
    String serviceInstanceName = "";
    String serviceInstanceId = "";
    for (RelationshipData relationshipData : relationship.getRelationshipData()) {
        if (relationshipData.getRelationshipKey().equals("service-instance.service-instance-id")) {
            serviceInstanceId = relationshipData.getRelationshipValue();
            break;
        }
    }
    for (RelatedToProperty relatedToProperty : relationship.getRelatedToProperty()) {
        if (relatedToProperty.getPropertyKey().equals("service-instance.service-instance-name")) {
            serviceInstanceName = relatedToProperty.getPropertyValue();
            break;
        }
    }
    return String.format("Pnf with name %s exist with orchestration status %s and is related to %s service with certain service-instance-id: %s", pnfFromAai.getPnfName(), pnfFromAai.getOrchestrationStatus(), serviceInstanceName, serviceInstanceId);
}
Also used : RelationshipData(org.onap.aai.domain.yang.RelationshipData) RelatedToProperty(org.onap.aai.domain.yang.RelatedToProperty)

Aggregations

RelationshipData (org.onap.aai.domain.yang.RelationshipData)2 Test (org.junit.Test)1 RelatedToProperty (org.onap.aai.domain.yang.RelatedToProperty)1 Relationship (org.onap.aai.domain.yang.Relationship)1