1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
package org.onap.simulator.presetGenerator.presets.aai;
public class Placement {
public final String cloudOwner;
public final String lcpRegionId;
public final String tenantId;
public Placement(String cloudOwner, String lcpRegionId, String tenantId) {
this.cloudOwner = cloudOwner;
this.lcpRegionId = lcpRegionId;
this.tenantId = tenantId;
}
public static class Util {
static String placementRelationship(String relatedTo, Placement placement) {
return "" +
"{" +
" \"related-to\": \"" + relatedTo + "\"," +
" \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," +
" \"related-link\": " + relatedLink(placement) + "," +
" \"relationship-data\": [" +
" {" +
" \"relationship-key\": \"cloud-region.cloud-owner\"," +
" \"relationship-value\": \"" + placement.cloudOwner + "\"" +
" }," +
" {" +
" \"relationship-key\": \"cloud-region.cloud-region-id\"," +
" \"relationship-value\": \"" + placement.lcpRegionId + "\"" +
" }," +
" {" +
" \"relationship-key\": \"tenant.tenant-id\"," +
" \"relationship-value\": \"" + placement.tenantId + "\"" +
" }," +
" {" +
" \"relationship-key\": \"vserver.vserver-id\"," +
" \"relationship-value\": \"5eef9f6d-9933-4bc6-9a1a-862d61309437\"" +
" }" +
" ]," +
" \"related-to-property\": [" +
" {" +
" \"property-key\": \"vserver.vserver-name\"," +
" \"property-value\": \"zolson5bfapn01dns002\"" +
" }" +
" ]" +
"}";
}
private static String relatedLink(Placement placement) {
return ""
+ "\""
+ "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/"
+ placement.lcpRegionId
+ "/tenants/tenant/"
+ placement.tenantId
+ "/vservers/vserver/5eef9f6d-9933-4bc6-9a1a-862d61309437"
+ "\"";
}
}
}
|