Search in sources :

Example 1 with RelatedToProperty

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

the class AaiConnectionTest method testRelatedToProperty.

@Test
public void testRelatedToProperty() {
    // given
    final Relationship relationship = new Relationship();
    final RelatedToProperty property = new RelatedToProperty();
    property.setPropertyKey(KEY);
    property.setPropertyValue(VALUE);
    relationship.getRelatedToProperty().add(property);
    // when
    final String value = AaiConnection.getRelatedToProperty(relationship, KEY);
    // then
    assertEquals(VALUE, value);
}
Also used : RelatedToProperty(org.onap.aai.domain.yang.RelatedToProperty) Relationship(org.onap.aai.domain.yang.Relationship) Test(org.junit.Test)

Example 2 with RelatedToProperty

use of org.onap.aai.domain.yang.RelatedToProperty 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

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