aboutsummaryrefslogtreecommitdiffstats
path: root/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/LagInterfacePnfRequest.java
diff options
context:
space:
mode:
Diffstat (limited to 'aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/LagInterfacePnfRequest.java')
-rw-r--r--aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/LagInterfacePnfRequest.java52
1 files changed, 35 insertions, 17 deletions
diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/LagInterfacePnfRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/LagInterfacePnfRequest.java
index 15b72f1..f4b08e7 100644
--- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/LagInterfacePnfRequest.java
+++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/LagInterfacePnfRequest.java
@@ -24,6 +24,7 @@ package org.openecomp.sdnc.sli.aai;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Properties;
import org.apache.commons.lang.ArrayUtils;
import org.openecomp.sdnc.sli.aai.data.AAIDatum;
@@ -32,23 +33,26 @@ import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.openecomp.aai.inventory.v8.LagInterface;
+import org.openecomp.aai.inventory.v10.LagInterface;
public class LagInterfacePnfRequest extends AAIRequest {
// tenant (1602)
public static final String LAG_INTERFACE_PATH = "org.openecomp.sdnc.sli.aai.path.pserver.pinterface";
public static final String LAG_INTERFACE_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.pserver.pinterface.query";
-
+ public static final String PNF_PATH = "org.openecomp.sdnc.sli.aai.path.pnf";
+
private final String lag_interface_path;
private final String lag_interface_query_path;
-
+
public static final String INTERFACE_NAME = "interface-name";
public static final String LAG_INTERFACE_INTERFACE_NAME = "lag-interface.interface-name";
+ public static final String PNF_NAME = "pnf-name";
+ public static final String PNF_PNF_NAME = "pnf.pnf-name";
public LagInterfacePnfRequest() {
- lag_interface_path = configProperties.getProperty(PnfRequest.PNF_PATH) + "/lag-interfaces/lag-interface/{interface-name}";
+ lag_interface_path = configProperties.getProperty(PNF_PATH) + "/lag-interfaces/lag-interface/{interface-name}";
lag_interface_query_path = configProperties.getProperty(LAG_INTERFACE_QUERY_PATH);
LoggerFactory.getLogger(LagInterfacePnfRequest.class).debug("org.openecomp.sdnc.sli.aai.path.pserver.pinterface=\t" + lag_interface_path);
LoggerFactory.getLogger(LagInterfacePnfRequest.class).debug("org.openecomp.sdnc.sli.aai.path.pserver.pinterface.query=\t" + lag_interface_query_path);
@@ -57,26 +61,26 @@ public class LagInterfacePnfRequest extends AAIRequest {
}
}
-
+
@Override
public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
String request_url = target_uri + lag_interface_path;
String encoded_vnf = null;
-
+
String interfaceName = null;
if(requestProperties.containsKey(INTERFACE_NAME)) {
interfaceName = requestProperties.getProperty(INTERFACE_NAME);
- } else
+ } else
if(requestProperties.containsKey(LAG_INTERFACE_INTERFACE_NAME)) {
interfaceName = requestProperties.getProperty(LAG_INTERFACE_INTERFACE_NAME);
}
encoded_vnf = encodeQuery(interfaceName);
request_url = request_url.replace("{interface-name}", encoded_vnf) ;
-
- request_url = PnfRequest.processPathData(request_url,requestProperties);
+
+ request_url = processPnfRequestPathData(request_url,requestProperties);
if(resourceVersion != null) {
request_url = request_url +"?resource-version="+resourceVersion;
@@ -85,10 +89,27 @@ public class LagInterfacePnfRequest extends AAIRequest {
aaiService.LOGwriteFirstTrace(method, http_req_url.toString());
aaiService.LOGwriteDateTrace("interface-name", interfaceName);
-
+
return http_req_url;
}
-
+
+ public static String processPnfRequestPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException {
+
+ String key = PNF_NAME;
+ if(requestProperties.containsKey(PNF_PNF_NAME)) {
+ key = PNF_PNF_NAME;
+ }
+
+ if(!requestProperties.containsKey(key)) {
+ aaiService.logKeyError(String.format("%s,%s", PNF_NAME, PNF_PNF_NAME));
+ }
+
+ String encoded_vnf = encodeQuery(requestProperties.getProperty(key));
+ request_url = request_url.replace("{pnf-name}", encoded_vnf) ;
+
+ return request_url;
+ }
+
@Override
public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException {
return this.getRequestUrl(method, null);
@@ -111,14 +132,11 @@ public class LagInterfacePnfRequest extends AAIRequest {
@Override
public String[] getArgsList() {
- String[] args = {INTERFACE_NAME, LAG_INTERFACE_INTERFACE_NAME};
- String[] tmpArgs = new PnfRequest().getArgsList();
-
- args = (String[]) ArrayUtils.addAll(args, tmpArgs);
-
+ String[] args = {INTERFACE_NAME, LAG_INTERFACE_INTERFACE_NAME, PNF_PNF_NAME};
+
return args;
}
-
+
@Override
public Class<? extends AAIDatum> getModelClass() {
return LagInterface.class;