1 package org.onap.simulator.presetGenerator.presets.aai;
3 import com.google.common.collect.ImmutableMap;
4 import java.util.Collections;
7 import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset;
8 import org.springframework.http.HttpMethod;
10 public class PresetAAIGetPortMirroringSourcePorts extends BaseAAIPreset {
11 public PresetAAIGetPortMirroringSourcePorts(String configurationId, String interfaceId, String interfaceName, boolean isPortMirrored) {
12 this.configurationId = configurationId;
13 this.interfaceId = interfaceId;
14 this.interfaceName = interfaceName;
15 this.isPortMirrored = isPortMirrored;
18 private final String configurationId;
19 private final String interfaceId;
20 private final String interfaceName;
21 private final boolean isPortMirrored;
24 public HttpMethod getReqMethod() {
25 return HttpMethod.PUT;
29 public String getReqPath() {
30 return getRootPath() + "/query";
34 public Map<String, List> getQueryParams() {
35 return ImmutableMap.of(
36 "format", Collections.singletonList("simple"));
40 public Object getRequestBody() {
41 return ImmutableMap.of(
42 "start", "/network/configurations/configuration/" + getConfigurationId(),
43 "query", "query/pserver-fromConfiguration"
47 public String getConfigurationId() {
48 return configurationId;
51 public String getInterfaceId() {
55 public String getInterfaceName() { return interfaceName; }
57 public boolean getIsPortMirrored() { return isPortMirrored; }
60 public Object getResponseBody() {
64 " \"id\": \"4876980240\",\n" +
65 " \"node-type\": \"l-interface\",\n" +
66 " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a/l-interfaces/l-interface/zolson5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\",\n" +
67 " \"properties\": {\n" +
68 " \"interface-name\": " + doubleQuoteIfNotNull(getInterfaceName()) + ",\n" +
69 " \"selflink\": \"https://netw.onap.org:9696/v2.0/ports/6de7bf87-6faa-4984-9492-18d1188b3d4a\",\n" +
70 " \"interface-id\": " + doubleQuoteIfNotNull(getInterfaceId()) + ",\n" +
71 " \"macaddr\": \"02:6d:e7:bf:87:6f\",\n" +
72 " \"network-name\": \"APP-C-24595-D-T001-vprobe_int_pktmirror_net_1\",\n" +
73 " \"is-port-mirrored\": " + getIsPortMirrored() + ",\n" +
74 " \"resource-version\": \"1519383879190\",\n" +
75 " \"in-maint\": false,\n" +
76 " \"is-ip-unnumbered\": false\n" +
78 " \"related-to\": [\n" +
80 " \"id\": \"4999893128\",\n" +
81 " \"relationship-label\": \"org.onap.relationships.inventory.BelongsTo\",\n" +
82 " \"node-type\": \"l3-interface-ipv4-address-list\",\n" +
83 " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a/l-interfaces/l-interface/zolson5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib/l3-interface-ipv4-address-list/107.244.46.254\"\n" +
86 " \"id\": \"6150074384\",\n" +
87 " \"relationship-label\": \"org.onap.relationships.inventory.Source\",\n" +
88 " \"node-type\": \"logical-link\",\n" +
89 " \"url\": \"/aai/v12/network/logical-links/logical-link/PMC_a22607fb-8392-42f4-bbe7-b8d845a97183_Sourcezrdm5bepdg_147_lb_2_Gn_UntrustedVrf_5_RVMI_Destzrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\"\n" +
92 " \"id\": \"6975434912\",\n" +
93 " \"relationship-label\": \"tosca.relationships.network.LinksTo\",\n" +
94 " \"node-type\": \"logical-link\",\n" +
95 " \"url\": \"/aai/v12/network/logical-links/logical-link/PMC_a22607fb-8392-42f4-bbe7-b8d845a97183_Sourcezrdm5bepdg_147_lb_1_Gn_UntrustedVrf_5_RVMI_Destzrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\"\n" +
98 " \"id\": \"7007121568\",\n" +
99 " \"relationship-label\": \"tosca.relationships.network.LinksTo\",\n" +
100 " \"node-type\": \"logical-link\",\n" +
101 " \"url\": \"/aai/v12/network/logical-links/logical-link/PMC_9c099448-a0e1-451d-ac20-c5e3ada8cccd_Sourcezrdm5bepdg_147_lb_2_Gn_UntrustedVrf_5_RVMI_Destzrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\"\n" +
104 " \"id\": \"7048110232\",\n" +
105 " \"relationship-label\": \"tosca.relationships.network.LinksTo\",\n" +
106 " \"node-type\": \"logical-link\",\n" +
107 " \"url\": \"/aai/v12/network/logical-links/logical-link/PMC_9c099448-a0e1-451d-ac20-c5e3ada8cccd_Sourcezrdm5bepdg_147_lb_1_Gn_UntrustedVrf_5_RVMI_Destzrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\"\n" +
110 " \"id\": \"5491453960\",\n" +
111 " \"relationship-label\": \"tosca.relationships.network.BindsTo\",\n" +
112 " \"node-type\": \"vserver\",\n" +
113 " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a\"\n" +
121 private String doubleQuoteIfNotNull(String str) {
125 return "\"" + str + "\"";