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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
ucpe-instance=builder.store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'pserver', 'complex'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'pserver', 'cloud-region').createEdgeTraversal(EdgeType.COUSIN, 'cloud-region', 'complex')\
).store('x').cap('x').unfold().dedup()
cloud-region-sites=builder.getVerticesByProperty('aai-node-type', 'cloud-region').getVerticesByProperty('cloud-owner', owner).store('x').createEdgeTraversal(EdgeType.COUSIN, 'cloud-region', 'complex').store('x').cap('x').unfold()
service-sites=builder.getVerticesByProperty('global-customer-id', customerId).createEdgeTraversal(EdgeType.TREE, 'customer', 'service-subscription')\
.getVerticesByProperty('service-type', type).createEdgeTraversal(EdgeType.TREE, 'service-subscription', 'service-instance').store('x')\
.createEdgeTraversal(EdgeType.COUSIN, 'service-instance', 'generic-vnf').store('x')\
.createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'vserver').union(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'pserver').createEdgeTraversal(EdgeType.COUSIN, 'pserver', 'complex'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'vserver', 'tenant').createEdgeTraversal(EdgeType.TREE, 'tenant', 'cloud-region')\
).store('x')\
.cap('x').unfold().dedup()
edge-tag=builder.emit().repeat(builder.newInstance().union(builder.newInstance().outE().getVerticesByProperty(tag, "OUT").inV(), builder.newInstance().inE().getVerticesByProperty(tag, "IN").outV()).dedup())
ucpe-topology=builder.store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'pserver', 'p-interface')\
.where(builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'p-interface', 'physical-link')).as('item').store('x')\
.createEdgeTraversal(EdgeType.COUSIN, 'p-interface', 'physical-link').store('x')\
.createEdgeTraversal(EdgeType.COUSIN, 'physical-link', 'p-interface').where(builder.newInstance().not(builder.newInstance().cap('item'))).store('x')\
.createEdgeTraversal(EdgeType.TREE, 'p-interface', 'pnf').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'pserver', 'generic-vnf').store('x')\
.as('vnf').createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'vnf-image').store('x')\
.select('vnf')\
.createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'service-instance').store('x')\
.createEdgeTraversal(EdgeType.TREE, 'service-instance', 'service-subscription').store('x')\
.createEdgeTraversal(EdgeType.TREE, 'service-subscription', 'customer').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'pserver', 'complex').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'pserver', 'vserver').createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'generic-vnf').store('x')\
.as('vnf').createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'vnf-image').store('x')\
.select('vnf')\
.createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'service-instance').store('x')\
.createEdgeTraversal(EdgeType.TREE, 'service-instance', 'service-subscription').store('x')\
.createEdgeTraversal(EdgeType.TREE, 'service-subscription', 'customer').store('x')\
).cap('x').unfold().dedup()
pnf-topology=builder.store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'pnf', 'p-interface').where(builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'p-interface', 'physical-link')).as('item').store('x')\
.createEdgeTraversal(EdgeType.COUSIN, 'p-interface', 'physical-link').store('x')\
.createEdgeTraversal(EdgeType.COUSIN, 'physical-link', 'p-interface').where(builder.newInstance().not(builder.newInstance().cap('item'))).store('x')\
.union(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'p-interface', 'pserver').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'p-interface', 'pnf').store('x')\
),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'pnf', 'complex').store('x')\
).cap('x').unfold().dedup()
topology-summary=builder.store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'vnfc').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'vserver').store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'vnfc').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'vserver', 'tenant').store('x').createEdgeTraversal(EdgeType.TREE, 'tenant', 'cloud-region').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'image').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'flavor').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'pserver').store('x').createEdgeTraversal(EdgeType.COUSIN, 'pserver', 'complex').store('x'))\
).cap('x').unfold().dedup()
v2-legacy-subgraph=builder.newInstance().store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'flavor'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'image'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'pserver').store('x').createEdgeTraversal(EdgeType.COUSIN, 'pserver', 'complex')\
).store('x').cap('x').unfold()
sites-byCountryFilterCloudRegionVer=builder.where(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'complex', 'l3-network')\
.createEdgeTraversal(EdgeType.COUSIN, 'l3-network', 'cloud-region').getVerticesByProperty('cloud-region-version', cloudRegionVersion))\
.store('x').cap('x').unfold().dedup()
sites-byCloudRegionId=builder.createEdgeTraversal(EdgeType.COUSIN, 'cloud-region', 'l3-network')\
.createEdgeTraversal(EdgeType.COUSIN, 'l3-network', 'complex')\
.store('x').cap('x').unfold().dedup()
site-l3network-cloudRegion=builder.store('x')\
.createEdgeTraversal(EdgeType.COUSIN, 'complex', 'l3-network').store('x')\
.createEdgeTraversal(EdgeType.COUSIN, 'l3-network', 'cloud-region').store('x').cap('x').unfold()
sites-byCountryFilterCloudRegionId=builder.where(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'complex', 'l3-network')\
.createEdgeTraversal(EdgeType.COUSIN, 'l3-network', 'cloud-region').getVerticesByProperty('cloud-region-id', cloudRegionId))\
.store('x').cap('x').unfold().dedup()
complex-fromVnf=builder.store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'pserver').store('x')\
.createEdgeTraversal(EdgeType.COUSIN, 'pserver', 'complex'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'vserver')\
.createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'pserver').store('x')\
.createEdgeTraversal(EdgeType.COUSIN,'pserver', 'complex')\
).store('x').cap('x').unfold().dedup()
colocated-devices=builder.store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'pserver', 'p-interface').store('x').createEdgeTraversal(EdgeType.COUSIN, 'p-interface', 'physical-link').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'pserver', 'complex')\
.union(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'complex', 'pserver').store('x')\
.createEdgeTraversal(EdgeType.TREE, 'pserver', 'p-interface').store('x').createEdgeTraversal(EdgeType.COUSIN, 'p-interface', 'physical-link').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'complex', 'pnf').store('x')\
.createEdgeTraversal(EdgeType.TREE, 'pnf', 'p-interface').store('x').createEdgeTraversal(EdgeType.COUSIN, 'p-interface', 'physical-link').store('x')\
)).cap('x').unfold().dedup()
pservers-fromVnf=builder.union(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'pserver').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'vserver').createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'pserver').store('x')\
).cap('x').unfold().dedup()
cloudRegion-fromNfType=builder.createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'vserver').createEdgeTraversal(EdgeType.TREE, 'vserver', 'tenant').createEdgeTraversal(EdgeType.TREE, 'tenant', 'cloud-region')\
.store('x').cap('x').unfold().dedup()
nfType-fromCloudRegion=builder.createEdgeTraversal(EdgeType.TREE, 'cloud-region', 'tenant').createEdgeTraversal(EdgeType.TREE, 'tenant', 'vserver').createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'generic-vnf')\
.store('x').cap('x').unfold().dedup()
cloudRegion-fromCountry=builder.createEdgeTraversal(EdgeType.COUSIN, 'complex', 'cloud-region')\
.store('x').cap('x').unfold().dedup()
locationNetTypeNetRole-fromCloudRegion=builder.store('x').createEdgeTraversal(EdgeType.COUSIN, 'cloud-region', 'complex').store('x')\
.createEdgeTraversal(EdgeType.COUSIN, 'complex', 'l3-network')\
.store('x').cap('x').unfold().dedup()
cloudRegion-fromCountryCloudRegionVersion=builder.createEdgeTraversal(EdgeType.COUSIN, 'complex', 'cloud-region').getVerticesByProperty('cloud-region-version', cloudRegionVersion)\
.store('x').cap('x').unfold().dedup()
vnf-topology-fromServiceInstance=builder.store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'service-instance', 'service-subscription').createEdgeTraversal(EdgeType.TREE, 'service-subscription', 'customer').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'service-instance', 'allotted-resource').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'service-instance', 'generic-vnf').store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'generic-vnf', 'vf-module').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'volume-group').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'generic-vnf', 'l-interface').union(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'l-interface', 'l3-interface-ipv4-address-list').store('x').createEdgeTraversal(EdgeType.COUSIN, 'l3-interface-ipv4-address-list', 'l3-network').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'l-interface', 'l3-interface-ipv6-address-list').store('x').createEdgeTraversal(EdgeType.COUSIN, 'l3-interface-ipv6-address-list', 'l3-network').store('x')\
),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'vserver').store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'vserver', 'tenant').store('x').createEdgeTraversal(EdgeType.TREE, 'tenant', 'cloud-region').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'pserver').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'vserver', 'l-interface').createEdgeTraversal(EdgeType.TREE, 'l-interface', 'l3-interface-ipv4-address-list').store('x').createEdgeTraversal(EdgeType.COUSIN, 'l3-interface-ipv4-address-list', 'l3-network').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'vserver', 'l-interface').createEdgeTraversal(EdgeType.TREE, 'l-interface', 'l3-interface-ipv6-address-list').store('x').createEdgeTraversal(EdgeType.COUSIN, 'l3-interface-ipv6-address-list', 'l3-network').store('x')\
)\
)\
).cap('x').unfold().dedup()
vnf-topology-fromVnf=builder.store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'service-instance').store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'service-instance', 'service-subscription').createEdgeTraversal(EdgeType.TREE, 'service-subscription', 'customer').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'service-instance', 'allotted-resource').store('x')\
),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'generic-vnf', 'vf-module').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'volume-group').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'generic-vnf', 'l-interface').union(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'l-interface', 'l3-interface-ipv4-address-list').store('x').createEdgeTraversal(EdgeType.COUSIN, 'l3-interface-ipv4-address-list', 'l3-network').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'l-interface', 'l3-interface-ipv6-address-list').store('x').createEdgeTraversal(EdgeType.COUSIN, 'l3-interface-ipv6-address-list', 'l3-network').store('x'),\
),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'vserver').store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'vserver', 'tenant').store('x').createEdgeTraversal(EdgeType.TREE, 'tenant', 'cloud-region').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'pserver').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'vserver', 'l-interface').createEdgeTraversal(EdgeType.TREE, 'l-interface', 'l3-interface-ipv4-address-list').store('x').createEdgeTraversal(EdgeType.COUSIN, 'l3-interface-ipv4-address-list', 'l3-network').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'vserver', 'l-interface').createEdgeTraversal(EdgeType.TREE, 'l-interface', 'l3-interface-ipv6-address-list').store('x').createEdgeTraversal(EdgeType.COUSIN, 'l3-interface-ipv6-address-list', 'l3-network').store('x'),\
)\
).cap('x').unfold().dedup()
vnf-topology-fromVfModule=builder.createEdgeTraversal(EdgeType.TREE, 'vf-module', 'generic-vnf').store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'service-instance').store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'service-instance', 'service-subscription').createEdgeTraversal(EdgeType.TREE, 'service-subscription', 'customer').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'service-instance', 'allotted-resource').store('x')\
),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'generic-vnf', 'vf-module').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'volume-group').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'generic-vnf', 'l-interface').union(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'l-interface', 'l3-interface-ipv4-address-list').store('x').createEdgeTraversal(EdgeType.COUSIN, 'l3-interface-ipv4-address-list', 'l3-network').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'l-interface', 'l3-interface-ipv6-address-list').store('x').createEdgeTraversal(EdgeType.COUSIN, 'l3-interface-ipv6-address-list', 'l3-network').store('x'),\
),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'vserver').store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'vserver', 'tenant').store('x').createEdgeTraversal(EdgeType.TREE, 'tenant', 'cloud-region').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'pserver').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'vserver', 'l-interface').createEdgeTraversal(EdgeType.TREE, 'l-interface', 'l3-interface-ipv4-address-list').store('x').createEdgeTraversal(EdgeType.COUSIN, 'l3-interface-ipv4-address-list', 'l3-network').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'vserver', 'l-interface').createEdgeTraversal(EdgeType.TREE, 'l-interface', 'l3-interface-ipv6-address-list').store('x').createEdgeTraversal(EdgeType.COUSIN, 'l3-interface-ipv6-address-list', 'l3-network').store('x'),\
)\
).cap('x').unfold().dedup()
images-fromCloudRegionNfType=builder.createEdgeTraversal(EdgeType.TREE, 'cloud-region', 'tenant')\
.createEdgeTraversal(EdgeType.TREE, 'tenant', 'vserver').where(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'generic-vnf').getVerticesByProperty('nf-type',nfType)\
).createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'image').store('x').cap('x').unfold().dedup()
cloudRegion-fromNfTypeVendorVersion=builder.createEdgeTraversal(EdgeType.COUSIN, 'image', 'vserver').where(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'generic-vnf').getVerticesByProperty('nf-type',nfType)\
).createEdgeTraversal(EdgeType.TREE, 'vserver', 'tenant').createEdgeTraversal(EdgeType.TREE, 'tenant', 'cloud-region')\
.store('x').cap('x').unfold().dedup()
vnf-instances-fromServiceInstancebyModelVersion=builder.createEdgeTraversal(EdgeType.COUSIN, 'service-instance', 'generic-vnf')\
.getVerticesByProperty('vnf-type', vnfType).getVerticesByProperty('model-version-id-local', modelVersionId)\
.store('x').cap('x').unfold().dedup()
topology-fromCloudRegionIdandServiceId=builder.createEdgeTraversal(EdgeType.TREE, 'cloud-region', 'availability-zone')\
.createEdgeTraversal(EdgeType.COUSIN, 'availability-zone', 'generic-vnf').getVerticesByProperty('service-id',serviceId).union(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'service-instance').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'vserver').store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'flavor').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'image').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'vserver', 'volume').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'vnfc').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'snapshot').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'vf-module').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'vserver', 'l-interface').store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'l-interface', 'logical-link').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'l-interface', 'l3-interface-ipv4-address-list').store('x')\
.createEdgeTraversal(EdgeType.COUSIN, 'l3-interface-ipv4-address-list', 'subnet').store('x')\
.createEdgeTraversal(EdgeType.TREE, 'subnet', 'l3-network').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'l-interface', 'l3-interface-ipv6-address-list').store('x')\
.createEdgeTraversal(EdgeType.COUSIN, 'l3-interface-ipv6-address-list', 'subnet').store('x')\
.createEdgeTraversal(EdgeType.TREE, 'subnet', 'l3-network').store('x')\
)\
)\
).cap('x').unfold().dedup()
vserverlogicallink-frompServer=builder.createEdgeTraversal(EdgeType.COUSIN, 'pserver', 'vserver').store('x')\
.createEdgeTraversal(EdgeType.TREE, 'vserver', 'l-interface')\
.createEdgeTraversal(EdgeType.COUSIN, 'l-interface', 'logical-link')\
.store('x').cap('x').unfold().dedup()
service-fromPserverandSubsName=builder.createEdgeTraversal(EdgeType.COUSIN, 'pserver', 'vserver')\
.createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'generic-vnf')\
.createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'service-instance').where(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'service-instance', 'service-subscription').where(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'service-subscription', 'customer').getVerticesByProperty('subscriber-name', subscriberName)\
).store('x')\
).store('x').cap('x').unfold().dedup()
spaas-topology-fromServiceInstance=builder.createEdgeTraversal(EdgeType.COUSIN, 'service-instance', 'generic-vnf')\
.createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'vserver').store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'flavor').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'image').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'vserver', 'l-interface').store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'l-interface', 'logical-link').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'l-interface', 'l3-interface-ipv4-address-list').store('x')\
.createEdgeTraversal(EdgeType.COUSIN, 'l3-interface-ipv4-address-list', 'subnet').store('x')\
.createEdgeTraversal(EdgeType.TREE, 'subnet', 'l3-network').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'l-interface', 'l3-interface-ipv6-address-list').store('x')\
.createEdgeTraversal(EdgeType.COUSIN, 'l3-interface-ipv6-address-list', 'subnet').store('x')\
.createEdgeTraversal(EdgeType.TREE, 'subnet', 'l3-network').store('x')\
),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'pserver').store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'pserver', 'complex').store('x'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'pserver', 'p-interface')\
.createEdgeTraversal(EdgeType.COUSIN, 'p-interface', 'physical-link').store('x')\
)\
).cap('x').unfold().dedup()
vnfs-fromServiceInstance=builder.createEdgeTraversal(EdgeType.COUSIN, 'service-instance', 'generic-vnf')\
.store('x').cap('x').unfold().dedup()
vnfs-fromPserver=builder.where(\
builder.newInstance().union(\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'pserver').getVerticesByProperty('hostname', hostname),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'generic-vnf', 'vserver').createEdgeTraversal(EdgeType.COUSIN, 'vserver', 'pserver').getVerticesByProperty('hostname', hostname)\
)\
).store('x').cap('x').unfold().dedup()
linked-devices=builder.store('x').union(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'generic-vnf', 'l-interface'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'generic-vnf', 'lag-interface'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'newvce', 'l-interface'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'vserver', 'l-interface')\
).dedup()\
.until(builder.newInstance().getVerticesByProperty('aai-node-type', new ArrayList<>(Arrays.asList('generic-vnf','newvce','vserver'))))\
.repeat(builder.newInstance()\
.union(\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'lag-interface', 'l-interface'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'l-interface', 'lag-interface'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'l-interface', 'vlan'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'vlan', 'l-interface'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'lag-interface', 'logical-link'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'logical-link', 'lag-interface'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'l-interface', 'logical-link'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'logical-link', 'l-interface'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'vlan', 'logical-link'),\
builder.newInstance().createEdgeTraversal(EdgeType.COUSIN, 'logical-link', 'vlan'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'l-interface', 'generic-vnf'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'lag-interface', 'generic-vnf'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'l-interface', 'newvce'),\
builder.newInstance().createEdgeTraversal(EdgeType.TREE, 'l-interface', 'vserver')\
).dedup().simplePath()\
).store('x').cap('x').unfold().dedup()
|