use of org.onap.aai.domain.yang.Relationship in project so by onap.
the class AAITransactionalClientTest method testUpdate.
@Test
public void testUpdate() throws IOException {
final Relationship body = new Relationship();
body.setRelatedLink(uriB.build().toString());
AAIResourceUri uriAClone = uriA.clone().relationshipAPI();
AAITransactionalClient transactions = aaiClient.beginTransaction().update(uriAClone, 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").replace("put", "patch"), new TypeReference<Map<String, Object>>() {
});
assertEquals(actual, expected);
}
use of org.onap.aai.domain.yang.Relationship in project policy-models by onap.
the class AaiCqResponse method getDefaultGenericVnf.
/**
* Get the generic vnf associated with the vserver in the custom query.
*
* @return Generic VNF
*/
public GenericVnf getDefaultGenericVnf() {
GenericVnf genericVnf = null;
// Get the vserver associated with the query
var vserver = this.getVserver();
// Get the relationships of the vserver
List<Relationship> relations = vserver.getRelationshipList().getRelationship();
// Find the relationship of the genericVNF
var genericVnfId = "";
List<RelationshipData> relationshipData = null;
// relationship data
for (Relationship r : relations) {
// Get the name of generic-vnf related to this server
if (GENERIC_VNF.equals(r.getRelatedTo())) {
relationshipData = r.getRelationshipData();
}
}
// Iterate through relationship data, and get vnf-id
for (RelationshipData rd : relationshipData) {
// Get the id of the generic-vnf
if ("generic-vnf.vnf-id".equals(rd.getRelationshipKey())) {
genericVnfId = rd.getRelationshipValue();
}
}
// Get the list of generic vnfs
List<GenericVnf> genericVnfList = this.getGenericVnfs();
for (GenericVnf genVnf : genericVnfList) {
if (genericVnfId.equals(genVnf.getVnfId())) {
genericVnf = genVnf;
}
}
return genericVnf;
}
use of org.onap.aai.domain.yang.Relationship in project so by onap.
the class GraphInventoryTransactionClient method buildRelationship.
private Relationship buildRelationship(SingleUri uri, Optional<EdgeLabel> label) {
final Relationship result = new Relationship();
result.setRelatedLink(uri.build().toString());
if (label.isPresent()) {
result.setRelationshipLabel(label.toString());
}
return result;
}
Aggregations