summaryrefslogtreecommitdiffstats
path: root/restapi-call-node
diff options
context:
space:
mode:
Diffstat (limited to 'restapi-call-node')
-rwxr-xr-x[-rw-r--r--]restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Parameters.java1
-rwxr-xr-xrestapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/PartnerDetails.java14
-rwxr-xr-x[-rw-r--r--]restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java169
-rw-r--r--restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RetryPolicy.java59
-rw-r--r--restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RetryPolicyStore.java50
-rwxr-xr-x[-rw-r--r--]restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java348
-rwxr-xr-xrestapi-call-node/provider/src/test/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java511
-rwxr-xr-xrestapi-call-node/provider/src/test/resources/partners.json16
8 files changed, 746 insertions, 422 deletions
diff --git a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Parameters.java b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Parameters.java
index aeb07c4d6..8b9cdc39c 100644..100755
--- a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Parameters.java
+++ b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Parameters.java
@@ -26,6 +26,7 @@ import java.util.Set;
public class Parameters {
public String templateFileName;
public String restapiUrl;
+ public String restapiUrlSuffix;
public String restapiUser;
public String restapiPassword;
public Format format;
diff --git a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/PartnerDetails.java b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/PartnerDetails.java
new file mode 100755
index 000000000..1cd4b99bb
--- /dev/null
+++ b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/PartnerDetails.java
@@ -0,0 +1,14 @@
+package org.onap.ccsdk.sli.plugins.restapicall;
+
+public class PartnerDetails {
+ protected String username;
+ protected String password;
+ protected String url;
+
+ public PartnerDetails(String username, String password, String url) {
+ this.username = username;
+ this.password = password;
+ this.url = url;
+ }
+
+}
diff --git a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java
index 9b50eaa44..34e5dec21 100644..100755
--- a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java
+++ b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java
@@ -37,6 +37,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -57,7 +58,10 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
@@ -66,6 +70,8 @@ import org.glassfish.jersey.client.oauth1.OAuth1ClientSupport;
import org.glassfish.jersey.media.multipart.MultiPart;
import org.glassfish.jersey.media.multipart.MultiPartFeature;
import org.glassfish.jersey.media.multipart.file.FileDataBodyPart;
+import org.glassfish.jersey.client.oauth1.ConsumerCredentials;
+import org.glassfish.jersey.client.oauth1.OAuth1ClientSupport;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
@@ -74,34 +80,36 @@ import org.slf4j.LoggerFactory;
public class RestapiCallNode implements SvcLogicJavaPlugin {
- protected static final String DME2_PROPERTIES_FILE_NAME = "dme2.properties";
+ protected static final String PARTNERS_FILE_NAME = "partners.json";
protected static final String UEB_PROPERTIES_FILE_NAME = "ueb.properties";
protected static final String DEFAULT_PROPERTIES_DIR = "/opt/onap/ccsdk/data/properties";
protected static final String PROPERTIES_DIR_KEY = "SDNC_CONFIG_DIR";
private static final Logger log = LoggerFactory.getLogger(RestapiCallNode.class);
- protected RetryPolicyStore retryPolicyStore;
private String uebServers;
private String defaultUebTemplateFileName = "/opt/bvc/restapi/templates/default-ueb-message.json";
private String responseReceivedMessage = "Response received. Time: {}";
private String responseHttpCodeMessage = "HTTP response code: {}";
private String requestPostingException = "Exception while posting http request to client ";
- private static String skipSendingMessage = "skipSending";
- private static String responsePrefix = "responsePrefix";
- private static String restapiUrlString = "restapiUrl";
+ protected static final String skipSendingMessage = "skipSending";
+ protected static final String responsePrefix = "responsePrefix";
+ protected static final String restapiUrlString = "restapiUrl";
+ protected static final String restapiUserKey = "restapiUser";
+ protected static final String restapiPasswordKey = "restapiPassword";
- public RestapiCallNode() {
- String configDir = System.getProperty(PROPERTIES_DIR_KEY, DEFAULT_PROPERTIES_DIR);
+ protected HashMap<String,PartnerDetails> partnerStore;
- try (FileInputStream in = new FileInputStream(configDir + "/" + DME2_PROPERTIES_FILE_NAME)) {
- Properties props = new Properties();
- props.load(in);
- retryPolicyStore = new RetryPolicyStore();
- retryPolicyStore.setProxyServers(props.getProperty("proxyUrl"));
- log.info("DME2 support enabled");
+ public RestapiCallNode() {
+ String configDir = System.getProperty(PROPERTIES_DIR_KEY, DEFAULT_PROPERTIES_DIR);
+ try {
+ String jsonString = readFile(configDir + "/" + PARTNERS_FILE_NAME);
+ JSONObject partners = new JSONObject(jsonString);
+ partnerStore = new HashMap<String,PartnerDetails>();
+ loadPartners(partners);
+ log.info("Partners support enabled");
} catch (Exception e) {
- log.warn("DME2 properties could not be read, DME2 support will not be enabled.", e);
+ log.warn("Partners file could not be read, Partner support will not be enabled.", e);
}
try (FileInputStream in = new FileInputStream(configDir + "/" + UEB_PROPERTIES_FILE_NAME)) {
@@ -114,6 +122,35 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
}
}
+ protected void loadPartners(JSONObject partners) {
+ Iterator<String> keys = partners.keys();
+ String partnerUserKey = "user";
+ String partnerPasswordKey = "password";
+ String partnerUrlKey = "url";
+
+ while (keys.hasNext()) {
+ String partnerKey = keys.next();
+ try {
+ JSONObject partnerObject = (JSONObject) partners.get(partnerKey);
+ if (partnerObject.has(partnerUserKey) && partnerObject.has(partnerPasswordKey)) {
+ String url = null;
+ if (partnerObject.has(partnerUrlKey)) {
+ url = partnerObject.getString(partnerUrlKey);
+ }
+ String userName = partnerObject.getString(partnerUserKey);
+ String password = partnerObject.getString(partnerPasswordKey);
+ PartnerDetails details = new PartnerDetails(userName, password, url);
+ partnerStore.put(partnerKey, details);
+ log.info("mapped partner using partner key " + partnerKey);
+ } else {
+ log.info("Partner " + partnerKey + " is missing required keys, it won't be mapped");
+ }
+ } catch (JSONException e) {
+ log.info("Couldn't map the partner using partner key " + partnerKey, e);
+ }
+ }
+ }
+
/**
* Returns parameters from the parameter map.
*
@@ -125,14 +162,21 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
public static Parameters getParameters(Map<String, String> paramMap,
Parameters p)
throws SvcLogicException {
- p.templateFileName = parseParam(paramMap, "templateFileName",
+
+ p.templateFileName = parseParam(paramMap, "templateFileName",
false, null);
p.requestBody = parseParam(paramMap, "requestBody", false, null);
p.restapiUrl = parseParam(paramMap, restapiUrlString, true, null);
validateUrl(p.restapiUrl);
- p.restapiUser = parseParam(paramMap, "restapiUser", false, null);
- p.restapiPassword = parseParam(paramMap, "restapiPassword", false,
+ p.restapiUrlSuffix = parseParam(paramMap, "restapiUrlSuffix",
+ false, null);
+ p.restapiUser = parseParam(paramMap, restapiUserKey, false, null);
+ p.restapiPassword = parseParam(paramMap, restapiPasswordKey, false,
null);
+ if(p.restapiUrlSuffix != null) {
+ p.restapiUrl = p.restapiUrl + p.restapiUrlSuffix;
+ validateUrl(p.restapiUrl);
+ }
p.oAuthConsumerKey = parseParam(paramMap, "oAuthConsumerKey",
false, null);
p.oAuthConsumerSecret = parseParam(paramMap, "oAuthConsumerSecret",
@@ -185,14 +229,19 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
* @param restapiUrl rest api URL
* @throws SvcLogicException when URL validation fails
*/
- private static void validateUrl(String restapiUrl)
- throws SvcLogicException {
- try {
- URI.create(restapiUrl);
- } catch (IllegalArgumentException e) {
- throw new SvcLogicException("Invalid input of url "
- + e.getLocalizedMessage(), e);
- }
+ private static void validateUrl(String restapiUrl) throws SvcLogicException {
+ if (restapiUrl.contains(",")) {
+ String[] urls = restapiUrl.split(",");
+ for(String url : urls) {
+ validateUrl(url);
+ }
+ } else {
+ try {
+ URI.create(restapiUrl);
+ } catch (IllegalArgumentException e) {
+ throw new SvcLogicException("Invalid input of url " + e.getLocalizedMessage(), e);
+ }
+ }
}
/**
@@ -262,14 +311,6 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
return value.toString();
}
- public RetryPolicyStore getRetryPolicyStore() {
- return retryPolicyStore;
- }
-
- public void setRetryPolicyStore(RetryPolicyStore retryPolicyStore) {
- this.retryPolicyStore = retryPolicyStore;
- }
-
/**
* Allows Directed Graphs the ability to interact with REST APIs.
* @param paramMap HashMap<String,String> of parameters passed by the DG to this function
@@ -293,7 +334,7 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
* <tr><td>convertResponse </td><td>Optional</td><td>whether the response should be converted</td><td>true or false</td></tr>
* <tr><td>customHttpHeaders</td><td>Optional</td><td>a list additional http headers to be passed in, follow the format in the example</td><td>X-CSI-MessageId=messageId,headerFieldName=headerFieldValue</td></tr>
* <tr><td>dumpHeaders</td><td>Optional</td><td>when true writes http header content to context memory</td><td>true or false</td></tr>
- * <tr><td>partner</td><td>Optional</td><td>needed for DME2 calls</td><td>dme2proxy</td></tr>
+ * <tr><td>partner</td><td>Optional</td><td>used to retrieve username, password and url if partner store exists</td><td>aaf</td></tr>
* <tr><td>returnRequestPayload</td><td>Optional</td><td>used to return payload built in the request</td><td>true or false</td></tr>
* </tbody>
* </table>
@@ -306,15 +347,17 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
sendRequest(paramMap, ctx, null);
}
- public void sendRequest(Map<String, String> paramMap, SvcLogicContext ctx, Integer retryCount)
+ protected void sendRequest(Map<String, String> paramMap, SvcLogicContext ctx, RetryPolicy retryPolicy)
throws SvcLogicException {
- RetryPolicy retryPolicy = null;
HttpResponse r = new HttpResponse();
try {
+ handlePartner(paramMap);
Parameters p = getParameters(paramMap, new Parameters());
- if (p.partner != null) {
- retryPolicy = retryPolicyStore.getRetryPolicy(p.partner);
+ if(p.restapiUrl.contains(",") && retryPolicy == null) {
+ String[] urls = p.restapiUrl.split(",");
+ retryPolicy = new RetryPolicy(urls,urls.length * 2);
+ p.restapiUrl = urls[0];
}
String pp = p.responsePrefix != null ? p.responsePrefix + '.' : "";
@@ -367,36 +410,20 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
if (retryPolicy == null || !shouldRetry) {
setFailureResponseStatus(ctx, prefix, e.getMessage(), r);
} else {
- if (retryCount == null) {
- retryCount = 0;
- }
- String retryMessage = retryCount + " attempts were made out of " + retryPolicy.getMaximumRetries() +
- " maximum retries.";
- log.debug(retryMessage);
+ log.debug(retryPolicy.getRetryMessage());
try {
- retryCount = retryCount + 1;
- if (retryCount < retryPolicy.getMaximumRetries() + 1) {
- URI uri = new URI(paramMap.get(restapiUrlString));
- String hostname = uri.getHost();
- String retryString = retryPolicy.getNextHostName(uri.toString());
- URI uriTwo = new URI(retryString);
- URI retryUri = UriBuilder.fromUri(uri).host(uriTwo.getHost()).port(uriTwo.getPort()).scheme(
- uriTwo.getScheme()).build();
- paramMap.put(restapiUrlString, retryUri.toString());
- log.debug("URL was set to {}", retryUri.toString());
- log.debug("Failed to communicate with host {}. Request will be re-attempted using the host {}.",
- hostname, retryString);
- log.debug("This is retry attempt {} out of {}", retryCount, retryPolicy.getMaximumRetries());
- sendRequest(paramMap, ctx, retryCount);
+ //calling getNextHostName increments the retry count so it should be called before shouldRetry
+ String retryString = retryPolicy.getNextHostName();
+ if (retryPolicy.shouldRetry()) {
+ paramMap.put(restapiUrlString, retryString);
+ log.debug("retry attempt {} will use the retry url {}", retryPolicy.getRetryCount(), retryString);
+ sendRequest(paramMap, ctx, retryPolicy);
} else {
- log.debug("Maximum retries reached, calling setFailureResponseStatus.");
+ log.debug("Maximum retries reached, won't attempt to retry. Calling setFailureResponseStatus.");
setFailureResponseStatus(ctx, prefix, e.getMessage(), r);
}
} catch (Exception ex) {
- log.error("Could not attempt retry.", ex);
- String retryErrorMessage =
- "Retry attempt has failed. No further retry shall be attempted, calling " +
- "setFailureResponseStatus.";
+ String retryErrorMessage = "Retry attempt " + retryPolicy.getRetryCount() + "has failed with error message " + ex.getMessage();
setFailureResponseStatus(ctx, prefix, retryErrorMessage, r);
}
}
@@ -407,6 +434,18 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
}
}
+ protected void handlePartner(Map<String, String> paramMap) {
+ String partner = paramMap.get("partner");
+ if (partner != null && partner.length() > 0) {
+ PartnerDetails details = partnerStore.get(partner);
+ paramMap.put(restapiUserKey, details.username);
+ paramMap.put(restapiPasswordKey, details.password);
+ if(paramMap.get(restapiUrlString) == null) {
+ paramMap.put(restapiUrlString, details.url);
+ }
+ }
+ }
+
protected String buildXmlJsonRequest(SvcLogicContext ctx, String template, Format format)
throws SvcLogicException {
log.info("Building {} started", format);
@@ -571,6 +610,7 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
.builder(new ConsumerCredentials(p.oAuthConsumerKey, p.oAuthConsumerSecret))
.version(p.oAuthVersion).signatureMethod(p.oAuthSignatureMethod).feature().build();
client.register(oAuth1Feature);
+
}
} else {
if (p.authtype == AuthType.DIGEST) {
@@ -636,13 +676,12 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
WebTarget webTarget = addAuthType(client, p).target(p.restapiUrl);
- log.info("Sending request:");
+ log.info("Sending request below to url " + p.restapiUrl);
log.info(request);
long t1 = System.currentTimeMillis();
HttpResponse r = new HttpResponse();
r.code = 200;
-
String accept = p.accept;
if(accept == null) {
accept = p.format == Format.XML ? "application/xml" : "application/json";
diff --git a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RetryPolicy.java b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RetryPolicy.java
index 54c86fefc..65684d937 100644
--- a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RetryPolicy.java
+++ b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RetryPolicy.java
@@ -21,40 +21,41 @@
*/
package org.onap.ccsdk.sli.plugins.restapicall;
-
public class RetryPolicy {
private String[] hostnames;
private Integer maximumRetries;
-
- public RetryPolicy(String[] hostnames, Integer maximumRetries){
- this.hostnames = hostnames;
- this.maximumRetries = maximumRetries;
+
+ private int position;
+
+ private int retryCount;
+ public RetryPolicy(String[] hostnames, Integer maximumRetries) {
+ this.hostnames = hostnames;
+ this.maximumRetries = maximumRetries;
+
+ this.position = 0;
+
+ this.retryCount = 0;
}
-
public Integer getMaximumRetries() {
- return maximumRetries;
+ return maximumRetries;
+ }
+ public int getRetryCount() {
+ return retryCount;
+ }
+ public Boolean shouldRetry() {
+ return retryCount < maximumRetries + 1;
+ }
+ public String getRetryMessage() {
+ return retryCount + " retry attempts were made out of " + maximumRetries + " maximum retry attempts.";
}
- public String getNextHostName(String uri) throws RetryException {
- Integer position = null;
-
- for (int i = 0; i < hostnames.length; i++) {
- if (uri.contains(hostnames[i])) {
- position = i;
- break;
- }
- }
-
- if(position == null){
- throw new RetryException("No match found for the provided uri[" + uri + "] " +
- "so the next host name could not be retreived");
- }
- position++;
-
- if (position > hostnames.length - 1) {
- position = 0;
- }
- return hostnames[position];
+ public String getNextHostName() throws RetryException {
+ retryCount++;
+ position++;
+
+ if (position > hostnames.length - 1) {
+ position = 0;
+ }
+ return hostnames[position];
}
-
-}
+} \ No newline at end of file
diff --git a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RetryPolicyStore.java b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RetryPolicyStore.java
deleted file mode 100644
index f68b851d3..000000000
--- a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RetryPolicyStore.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * Modifications Copyright © 2018 IBM.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.plugins.restapicall;
-
-import java.util.HashMap;
-
-public class RetryPolicyStore {
- HashMap<String, RetryPolicy> retryPolicies;
- public String proxyServers;
-
- public RetryPolicyStore() {
- retryPolicies = new HashMap<>();
- }
-
- public String getProxyServers() {
- return proxyServers;
- }
-
- public void setProxyServers(String admServers) {
- this.proxyServers = admServers;
- String[] adminServersArray = admServers.split(",");
- RetryPolicy adminPortalRetry = new RetryPolicy(adminServersArray, adminServersArray.length);
- retryPolicies.put("dme2proxy", adminPortalRetry);
- }
-
- public RetryPolicy getRetryPolicy(String policyName) {
- return (this.retryPolicies.get(policyName));
- }
-
-}
diff --git a/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java b/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java
index bdf67dc45..0704d297a 100644..100755
--- a/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java
+++ b/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java
@@ -21,16 +21,19 @@
package org.onap.ccsdk.sli.plugins.restapicall;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import java.net.URI;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
import java.util.HashMap;
import java.util.Map;
+
import org.codehaus.jettison.json.JSONObject;
import org.glassfish.grizzly.http.server.HttpServer;
import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
import org.glassfish.jersey.media.multipart.MultiPartFeature;
import org.glassfish.jersey.server.ResourceConfig;
+
import org.junit.Test;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
@@ -40,9 +43,9 @@ import org.slf4j.LoggerFactory;
public class TestRestapiCallNode {
+ @SuppressWarnings("unused")
private static final Logger log = LoggerFactory.getLogger(TestRestapiCallNode.class);
-
@Test
public void testDelete() throws SvcLogicException {
SvcLogicContext ctx = new SvcLogicContext();
@@ -64,7 +67,6 @@ public class TestRestapiCallNode {
ctx.setAttribute("prop.name", "site1");
-
Map<String, String> p = new HashMap<>();
p.put("templateFileName", "src/test/resources/sdwan-site.json");
p.put("restapiUrl", "https://echo.getpostman.com/delete");
@@ -78,61 +80,6 @@ public class TestRestapiCallNode {
}
@Test
- public void testJsonSdwanVpnTopologyTemplate() throws SvcLogicException {
- SvcLogicContext ctx = new SvcLogicContext();
-
- ctx.setAttribute("prop.topology", "topoType");
-
- ctx.setAttribute("prop.roles_length", "1");
- ctx.setAttribute("prop.roles[0]", "role1");
-
- ctx.setAttribute("prop.siteAttachement_length", "2");
-
- ctx.setAttribute("prop.siteAttachement[0].siteId", "site1");
- ctx.setAttribute("prop.siteAttachement[0].roles_length", "0");
- ctx.setAttribute("prop.siteAttachement[0].roles[0]", "role1");
- ctx.setAttribute("prop.siteAttachement[0].roles[1]", "role3");
-
- ctx.setAttribute("prop.siteAttachement[1].siteId", "site2");
- ctx.setAttribute("prop.siteAttachement[1].roles_length", "1");
- ctx.setAttribute("prop.siteAttachement[1].roles[0]", "role2");
-
- Map<String, String> p = new HashMap<>();
- p.put("templateFileName", "src/test/resources/sdwan-vpn-topology.json");
- p.put("restapiUrl", "http://echo.getpostman.com");
- p.put("restapiUser", "user1");
- p.put("restapiPassword", "abc123");
- p.put("format", "json");
- p.put("httpMethod", "post");
- p.put("responsePrefix", "response");
- p.put("skipSending", "true");
-
- RestapiCallNode rcn = new RestapiCallNode();
- rcn.sendRequest(p, ctx);
- }
-
- @Test
- public void testJsonSdwanSiteTemplate() throws SvcLogicException {
- SvcLogicContext ctx = new SvcLogicContext();
-
- ctx.setAttribute("prop.name", "site1");
-
-
- Map<String, String> p = new HashMap<>();
- p.put("templateFileName", "src/test/resources/sdwan-site.json");
- p.put("restapiUrl", "http://echo.getpostman.com");
- p.put("restapiUser", "user1");
- p.put("restapiPassword", "abc123");
- p.put("format", "json");
- p.put("httpMethod", "post");
- p.put("responsePrefix", "response");
- p.put("skipSending", "true");
-
- RestapiCallNode rcn = new RestapiCallNode();
- rcn.sendRequest(p, ctx);
- }
-
- @Test
public void testJsonTemplate() throws SvcLogicException {
SvcLogicContext ctx = new SvcLogicContext();
ctx.setAttribute("tmp.sdn-circuit-req-row_length", "3");
@@ -250,33 +197,6 @@ public class TestRestapiCallNode {
rcn.sendRequest(p, ctx);
}
- @Test(expected = SvcLogicException.class)
- public void testFormData() throws SvcLogicException {
- SvcLogicContext ctx = new SvcLogicContext();
- ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
- ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123");
- ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete");
- ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0");
- ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New");
- ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New");
- ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1");
- ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci");
-
- Map<String, String> p = new HashMap<>();
- p.put("templateFileName", "src/test/resources/test-template.json");
- p.put("restapiUrl", "http://echo.getpostman.com");
- p.put("restapiUser", "user1");
- p.put("restapiPassword", "abc123");
- p.put("format", "json");
- p.put("httpMethod", "post");
- p.put("responsePrefix", "response");
- p.put("skipSending", "false");
- p.put("multipartFormData", "true");
- p.put("multipartFile", "src/test/resources/test-template.json");
-
- RestapiCallNode rcn = new RestapiCallNode();
- rcn.sendRequest(p, ctx);
- }
@Test(expected = SvcLogicException.class)
public void testWithInvalidURI() throws SvcLogicException {
@@ -525,202 +445,74 @@ public class TestRestapiCallNode {
RestapiCallNode rcn = new RestapiCallNode();
rcn.sendRequest(p, ctx);
}
-
- @Test
- public void testDeleteOAuthType() throws SvcLogicException {
- SvcLogicContext ctx = new SvcLogicContext();
-
- Map<String, String> p = new HashMap<>();
- p.put("restapiUrl", "https://echo.getpostman.com/delete");
- p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
- p.put("oAuthConsumerSecret", "secret");
- p.put("oAuthSignatureMethod", "plainTEXT");
- p.put("oAuthVersion", "1.0");
- p.put("httpMethod", "delete");
- p.put("format", "none");
- p.put("skipSending", "true");
-
- RestapiCallNode rcn = new RestapiCallNode();
- rcn.sendRequest(p, ctx);
- }
-
- @Test
- public void testDeleteAuthTypeBasic() throws SvcLogicException {
- SvcLogicContext ctx = new SvcLogicContext();
-
- Map<String, String> p = new HashMap<>();
- p.put("restapiUrl", "https://echo.getpostman.com/delete");
- p.put("authType", "basic");
- p.put("restapiUser", "admin");
- p.put("restapiPassword", "admin123");
- p.put("httpMethod", "delete");
- p.put("format", "none");
- p.put("skipSending", "true");
-
- RestapiCallNode rcn = new RestapiCallNode();
- rcn.sendRequest(p, ctx);
- }
-
- @Test
- public void testDeleteAuthTypeDigest() throws SvcLogicException {
- SvcLogicContext ctx = new SvcLogicContext();
-
- Map<String, String> p = new HashMap<>();
- p.put("restapiUrl", "https://echo.getpostman.com/delete");
- p.put("authType", "digest");
- p.put("restapiUser", "admin");
- p.put("restapiPassword", "admin123");
- p.put("httpMethod", "delete");
- p.put("format", "none");
- p.put("skipSending", "true");
-
- RestapiCallNode rcn = new RestapiCallNode();
- rcn.sendRequest(p, ctx);
- }
-
- @Test
- public void testDeleteAuthTypeOAuth() throws SvcLogicException {
- SvcLogicContext ctx = new SvcLogicContext();
-
- Map<String, String> p = new HashMap<>();
- p.put("restapiUrl", "https://echo.getpostman.com/delete");
- p.put("authType", "oauth");
- p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
- p.put("oAuthConsumerSecret", "secret");
- p.put("oAuthSignatureMethod", "plainTEXT");
- p.put("oAuthVersion", "1.0");
- p.put("httpMethod", "delete");
- p.put("format", "none");
- p.put("skipSending", "true");
-
- RestapiCallNode rcn = new RestapiCallNode();
- rcn.sendRequest(p, ctx);
- }
-
- @Test
- public void testDeleteAuthTypeNoneOAuth() throws SvcLogicException {
- SvcLogicContext ctx = new SvcLogicContext();
-
- Map<String, String> p = new HashMap<>();
- p.put("restapiUrl", "https://echo.getpostman.com/delete");
- p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
- p.put("oAuthConsumerSecret", "secret");
- p.put("oAuthSignatureMethod", "plainTEXT");
- p.put("oAuthVersion", "1.0");
- p.put("httpMethod", "delete");
- p.put("format", "none");
- p.put("skipSending", "true");
-
- RestapiCallNode rcn = new RestapiCallNode();
- rcn.sendRequest(p, ctx);
- }
- @Test
- public void testDeleteAuthTypeNoneBasic() throws SvcLogicException {
- SvcLogicContext ctx = new SvcLogicContext();
-
- Map<String, String> p = new HashMap<>();
- p.put("restapiUrl", "https://echo.getpostman.com/delete");
- p.put("restapiUser", "admin");
- p.put("restapiPassword", "admin123");
- p.put("httpMethod", "delete");
- p.put("format", "none");
- p.put("skipSending", "true");
-
- RestapiCallNode rcn = new RestapiCallNode();
- rcn.sendRequest(p, ctx);
- }
-
- @Test(expected = SvcLogicException.class)
- public void testInvalidDeleteAuthTypeOAuth() throws SvcLogicException {
- SvcLogicContext ctx = new SvcLogicContext();
-
- Map<String, String> p = new HashMap<>();
- p.put("restapiUrl", "https://echo.getpostman.com/delete");
- p.put("authType", "oauth");
- p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
- p.put("oAuthConsumerSecret", "secret");
- p.put("httpMethod", "delete");
- p.put("format", "none");
- p.put("skipSending", "true");
-
- RestapiCallNode rcn = new RestapiCallNode();
- rcn.sendRequest(p, ctx);
- }
-
- @Test(expected = SvcLogicException.class)
- public void testInvalidDeleteAuthTypeBasic() throws SvcLogicException {
- SvcLogicContext ctx = new SvcLogicContext();
-
- Map<String, String> p = new HashMap<>();
- p.put("restapiUrl", "https://echo.getpostman.com/delete");
- p.put("authType", "basic");
- p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
- p.put("oAuthConsumerSecret", "secret");
- p.put("httpMethod", "delete");
- p.put("format", "none");
- p.put("skipSending", "true");
-
- RestapiCallNode rcn = new RestapiCallNode();
- rcn.sendRequest(p, ctx);
- }
-
- @Test(expected = SvcLogicException.class)
- public void testInvalidDeleteAuthTypeDigest() throws SvcLogicException {
- SvcLogicContext ctx = new SvcLogicContext();
-
- Map<String, String> p = new HashMap<>();
- p.put("restapiUrl", "https://echo.getpostman.com/delete");
- p.put("authType", "digest");
- p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
- p.put("oAuthConsumerSecret", "secret");
- p.put("httpMethod", "delete");
- p.put("format", "none");
- p.put("skipSending", "true");
-
- RestapiCallNode rcn = new RestapiCallNode();
- rcn.sendRequest(p, ctx);
- }
-
+ /*
+ * {
+ "partnerOne": {
+ "url": "http://localhost:7001" 4 http://uebsb93kcdc.it.att.com:3904",
+ "test": "/metrics"
+ },
+ "partnerTwo": {
+ "url": "http://localhost:7002",
+ "user": "controller_user",
+ "password": "P@ssword",
+ "test": "/metrics"
+ },
+ "partnerThree": {
+ "url": "http://localhost:7003",
+ "user": "controller_admin"
+ }
+}
+ */
@Test
- public void testMultipartFormData() throws SvcLogicException {
- final ResourceConfig resourceConfig = new ResourceConfig(
- MultipartServerMock.class, MultiPartFeature.class);
- HttpServer server = GrizzlyHttpServerFactory.createHttpServer(
- URI.create("http://localhost:8080/"),resourceConfig);
+ public void testPartners() throws Exception{
+ String partnerTwoKey = "partnerTwo";
+ String partnerTwoUsername = "controller_user";
+ String partnerTwoPassword = "P@ssword";
- Map<String, String> p = new HashMap<>();
- p.put("multipartFormData", "true");
- p.put("format", "none");
- p.put("multipartFile", "src/test/resources/test-template.json");
- p.put("restapiUrl", "http://localhost:8080/file-upload/upload");
-
- SvcLogicContext ctx = new SvcLogicContext();
+ System.setProperty("SDNC_CONFIG_DIR", "src/test/resources");
RestapiCallNode rcn = new RestapiCallNode();
- rcn.sendRequest(p, ctx);
- assertThat(ctx.getAttribute("response-code"), is("200"));
- assertThat(ctx.getAttribute("httpResponse"), is( "test-template.json"));
- server.shutdownNow();
+ assertNull(rcn.partnerStore.get("partnerOne"));
+ PartnerDetails details = rcn.partnerStore.get(partnerTwoKey);
+ assertEquals(partnerTwoUsername,details.username);
+ assertEquals(partnerTwoPassword,details.password);
+ assertNull(rcn.partnerStore.get("partnerThree"));
+
+ //In this scenario the caller expects username, password and url to be picked up from the partners json
+ Map<String, String> paramMap = new HashMap<String,String>();
+ paramMap.put("partner", partnerTwoKey);
+ rcn.handlePartner(paramMap );
+ assertEquals(partnerTwoUsername,paramMap.get(rcn.restapiUserKey));
+ assertEquals(partnerTwoPassword,paramMap.get(rcn.restapiPasswordKey));
+ assertEquals("http://localhost:7002",paramMap.get(rcn.restapiUrlString));
+
+ //In this scenario the caller expects username, password and url to be picked up from the partners json
+ //the provided suffix will be appended to the default url from the partners json
+ paramMap = new HashMap<String,String>();
+ paramMap.put("partner", partnerTwoKey);
+ paramMap.put("restapiUrlSuffix", "/networking/v1/instance/3");
+ rcn.handlePartner(paramMap);
+ Parameters p = new Parameters();
+ RestapiCallNode.getParameters(paramMap, p);
+ assertEquals(partnerTwoUsername,p.restapiUser);
+ assertEquals(partnerTwoPassword,p.restapiPassword);
+ assertEquals("http://localhost:7002/networking/v1/instance/3",p.restapiUrl);
}
-
+
@Test
- public void testCookieResponse() throws SvcLogicException {
- final ResourceConfig resourceConfig = new ResourceConfig(
- MockCookieAuthServer.class);
- HttpServer server = GrizzlyHttpServerFactory.createHttpServer(
- URI.create("http://localhost:8080/"),resourceConfig);
-
- Map<String, String> p = new HashMap<>();
- p.put("format", "none");
- p.put("httpMethod", "get");
- p.put("restapiUrl", "http://localhost:8080/get-cookie/cookie");
- p.put("dumpHeaders", "true");
-
- SvcLogicContext ctx = new SvcLogicContext();
- RestapiCallNode rcn = new RestapiCallNode();
- rcn.sendRequest(p, ctx);
- assertThat(ctx.getAttribute("response-code"), is("200"));
- assertThat(ctx.getAttribute("header.Set-Cookie"), is("cookieResponse=cookieValueInReturn;Version=1"));
- server.shutdownNow();
+ public void retryPolicyBean() throws Exception {
+ Integer retries = 3;
+ String first = "http://localhost:7001";
+ String second = "http://localhost:7001";
+
+ RetryPolicy p = new RetryPolicy(new String[] {first,second}, retries);
+ assertEquals(retries,p.getMaximumRetries());
+ assertNotNull(p.getRetryMessage());
+ String next = p.getNextHostName();
+ assertEquals(second,next);
+ assertEquals(1,p.getRetryCount());
+ next = p.getNextHostName();
+ assertEquals(first,next);
+ assertEquals(2,p.getRetryCount());
}
@Test
diff --git a/restapi-call-node/provider/src/test/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java b/restapi-call-node/provider/src/test/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java
new file mode 100755
index 000000000..50371278a
--- /dev/null
+++ b/restapi-call-node/provider/src/test/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java
@@ -0,0 +1,511 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.plugins.restapicall;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.junit.Test;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestRestapiCallNode {
+
+ @SuppressWarnings("unused")
+ private static final Logger log = LoggerFactory.getLogger(TestRestapiCallNode.class);
+
+
+ @Test
+ public void testDelete() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+
+ Map<String, String> p = new HashMap<>();
+ p.put("restapiUrl", "https://echo.getpostman.com/delete");
+ p.put("restapiUser", "user1");
+ p.put("restapiPassword", "pwd1");
+ p.put("httpMethod", "delete");
+ p.put("skipSending", "true");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
+
+ @Test
+ public void testDeleteWithPayload() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+
+ ctx.setAttribute("prop.name", "site1");
+
+ Map<String, String> p = new HashMap<>();
+ p.put("templateFileName", "src/test/resources/sdwan-site.json");
+ p.put("restapiUrl", "https://echo.getpostman.com/delete");
+ p.put("restapiUser", "user1");
+ p.put("restapiPassword", "pwd1");
+ p.put("httpMethod", "delete");
+ p.put("skipSending", "true");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
+
+ @Test
+ public void testJsonTemplate() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("tmp.sdn-circuit-req-row_length", "3");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[1].source-uid", "APIDOC-123");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[1].action", "delete");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[1].request-timestamp", "2016-09-09 16:30:35.0");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[1].request-status", "New");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[1].processing-status", "New");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[1].service-clfi", "testClfi1");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[1].clci", "clci");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[2].source-uid", "APIDOC-123");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[2].action", "delete");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[2].request-timestamp", "2016-09-09 16:30:35.0");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[2].request-status", "New");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[2].processing-status", "New");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[2].service-clfi", "testClfi1");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[2].clci", "clci");
+
+ Map<String, String> p = new HashMap<>();
+ p.put("templateFileName", "src/test/resources/test-template.json");
+ p.put("restapiUrl", "http://echo.getpostman.com");
+ p.put("restapiUser", "user1");
+ p.put("restapiPassword", "abc123");
+ p.put("format", "json");
+ p.put("httpMethod", "post");
+ p.put("responsePrefix", "response");
+ p.put("skipSending", "true");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
+
+ @Test
+ public void testInvalidRepeatTimes() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("tmp.sdn-circuit-req-row_length", "a");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci");
+
+ Map<String, String> p = new HashMap<>();
+ p.put("templateFileName", "src/test/resources/test-template.json");
+ p.put("restapiUrl", "http://echo.getpostman.com");
+ p.put("restapiUser", "user1");
+ p.put("restapiPassword", "abc123");
+ p.put("format", "json");
+ p.put("httpMethod", "post");
+ p.put("responsePrefix", "response");
+ p.put("skipSending", "true");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
+
+ @Test(expected = SvcLogicException.class)
+ public void testInvalidTemplatePath() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci");
+
+ Map<String, String> p = new HashMap<>();
+ p.put("templateFileName", "src/test/resourcess/test-template.json");
+ p.put("restapiUrl", "http://echo.getpostman.com");
+ p.put("restapiUser", "user1");
+ p.put("restapiPassword", "abc123");
+ p.put("format", "json");
+ p.put("httpMethod", "post");
+ p.put("responsePrefix", "response");
+ p.put("skipSending", "true");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
+
+ @Test(expected = SvcLogicException.class)
+ public void testWithoutSkipSending() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci");
+
+ Map<String, String> p = new HashMap<>();
+ p.put("templateFileName", "src/test/resources/test-template.json");
+ p.put("restapiUrl", "http://echo.getpostman.com");
+ p.put("restapiUser", "user1");
+ p.put("restapiPassword", "abc123");
+ p.put("format", "json");
+ p.put("httpMethod", "post");
+ p.put("responsePrefix", "response");
+ p.put("skipSending", "false");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
+
+
+ @Test(expected = SvcLogicException.class)
+ public void testWithInvalidURI() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci");
+
+ Map<String, String> p = new HashMap<>();
+ p.put("templateFileName", "src/test/resources/test-template.json");
+ p.put("restapiUrl", "http://echo. getpostman.com");
+ p.put("restapiUser", "user1");
+ p.put("restapiPassword", "abc123");
+ p.put("format", "json");
+ p.put("httpMethod", "post");
+ p.put("responsePrefix", "response");
+ p.put("skipSending", "false");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
+
+ @Test
+ public void testVpnJsonTemplate() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("prop.l3vpn.name", "10000000-0000-0000-0000-000000000001");
+ ctx.setAttribute("prop.l3vpn.topology", "point_to_point");
+
+ Map<String, String> p = new HashMap<>();
+ p.put("templateFileName", "src/test/resources/l3smvpntemplate.json");
+ p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/vpn-services");
+ p.put("restapiUser", "admin");
+ p.put("restapiPassword", "admin123");
+ p.put("format", "json");
+ p.put("httpMethod", "post");
+ p.put("responsePrefix", "restapi-result");
+ p.put("skipSending", "true");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
+
+ @Test
+ public void testSiteJsonTemplate() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("prop.l3vpn.name", "10000000-0000-0000-0000-000000000001");
+ ctx.setAttribute("prop.l3vpn.topology", "point_to_point");
+
+ ctx.setAttribute("prop.l3vpn.site1_name", "10000000-0000-0000-0000-000000000002");
+ ctx.setAttribute("prop.l3vpn.vpn-policy1-id", "10000000-0000-0000-0000-000000000003");
+ ctx.setAttribute("prop.l3vpn.entry1-id", "1");
+ ctx.setAttribute("prop.l3vpn.sna1_name", "10000000-0000-0000-0000-000000000004");
+ ctx.setAttribute("prop.l3vpn.pe1_id", "a8098c1a-f86e-11da-bd1a-00112444be1e");
+ ctx.setAttribute("prop.l3vpn.ac1_id", "a8098c1a-f86e-11da-bd1a-00112444be1b");
+ ctx.setAttribute("prop.l3vpn.ac1-peer-ip", "192.168.1.1");
+ ctx.setAttribute("prop.l3vpn.ac1-ip", "192.168.1.2");
+ ctx.setAttribute("prop.l3vpn.sna1_svlan", "100");
+ ctx.setAttribute("prop.l3vpn.ac1_protocol", "static");
+ ctx.setAttribute("prop.l3vpn.sna1-route.ip-prefix", "192.168.1.1/24");
+ ctx.setAttribute("prop.l3vpn.sna1-route.next-hop", "192.168.1.4");
+
+ ctx.setAttribute("prop.l3vpn.site2_name", "10000000-0000-0000-0000-000000000005");
+ ctx.setAttribute("prop.l3vpn.vpn-policy2-id", "10000000-0000-0000-0000-000000000006");
+ ctx.setAttribute("prop.l3vpn.entry2-id", "1");
+ ctx.setAttribute("prop.l3vpn.sna2_name", "10000000-0000-0000-0000-000000000007");
+ ctx.setAttribute("prop.l3vpn.pe2_id", "a8098c1a-f86e-11da-bd1a-00112444be1a");
+ ctx.setAttribute("prop.l3vpn.ac2_id", "a8098c1a-f86e-11da-bd1a-00112444be1c");
+ ctx.setAttribute("prop.l3vpn.ac2-peer-ip", "192.168.1.6");
+ ctx.setAttribute("prop.l3vpn.ac2-ip", "192.168.1.5");
+ ctx.setAttribute("prop.l3vpn.sna2_svlan", "200");
+ ctx.setAttribute("prop.l3vpn.ac2_protocol", "bgp");
+ ctx.setAttribute("prop.l3vpn.peer2-ip", "192.168.1.7");
+ ctx.setAttribute("prop.l3vpn.ac2_protocol_bgp_as", "200");
+
+ Map<String, String> p = new HashMap<>();
+ p.put("templateFileName", "src/test/resources/l3smsitetemplate.json");
+ p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/sites");
+ p.put("restapiUser", "admin");
+ p.put("restapiPassword", "admin123");
+ p.put("format", "json");
+ p.put("httpMethod", "post");
+ p.put("responsePrefix", "restapi-result");
+ p.put("skipSending", "true");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
+
+ @Test
+ public void testVrfJsonTemplate() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("prop.l3vpn.vrf1-id", "10000000-0000-0000-0000-000000000007");
+ ctx.setAttribute("prop.l3vpn.vpn-policy1-id", "10000000-0000-0000-0000-000000000003");
+ ctx.setAttribute("prop.l3vpn.pe1_id", "a8098c1a-f86e-11da-bd1a-00112444be1e");
+ ctx.setAttribute("prop.l3vpn.vrf2-id", "10000000-0000-0000-0000-000000000009");
+ ctx.setAttribute("prop.l3vpn.vpn-policy2-id", "10000000-0000-0000-0000-000000000006");
+ ctx.setAttribute("prop.l3vpn.pe2_id", "a8098c1a-f86e-11da-bd1a-00112444be1a");
+
+ Map<String, String> p = new HashMap<>();
+ p.put("templateFileName", "src/test/resources/l3smvrftemplate.json");
+ p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/vrf-attributes");
+ p.put("restapiUser", "admin");
+ p.put("restapiPassword", "admin123");
+ p.put("format", "json");
+ p.put("httpMethod", "post");
+ p.put("responsePrefix", "restapi-result");
+ p.put("skipSending", "true");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
+
+ @Test
+ public void testDeleteVpnJsonTemplate() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("prop.l3vpn.name", "10000000-0000-0000-0000-000000000001");
+ ctx.setAttribute("prop.l3vpn.topology", "point_to_point");
+
+ Map<String, String> p = new HashMap<>();
+ //p.put("templateFileName", "src/test/resources/l3smvpntemplate.json");
+ p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/vpn-services"
+ + "/vpnservice=10000000-0000-0000-0000-000000000001");
+ p.put("restapiUser", "admin");
+ p.put("restapiPassword", "admin123");
+ p.put("format", "json");
+ p.put("httpMethod", "delete");
+ p.put("responsePrefix", "restapi-result");
+ p.put("skipSending", "true");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
+
+ @Test
+ public void testL2DciTemplate() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("prop.dci-connects.id", "Id1");
+ ctx.setAttribute("prop.dci-connects.name", "Name1");
+ ctx.setAttribute("prop.dci-connects.local_networks[0]", "NetId1");
+ ctx.setAttribute("prop.dci-connects.local_networks[1]", "NetId2");
+ ctx.setAttribute("prop.dci-connects.evpn_irts[0]", "100:1");
+ ctx.setAttribute("prop.dci-connects.evpn_erts[0]", "100:2");
+ ctx.setAttribute("prop.dci-connects.evpn_irts[1]", "200:1");
+ ctx.setAttribute("prop.dci-connects.evpn_erts[1]", "200:2");
+ ctx.setAttribute("prop.dci-connects.vni", "1");
+
+ Map<String, String> p = new HashMap<>();
+ p.put("templateFileName", "src/test/resources/l2-dci-connects-template.json");
+ p.put("restapiUrl", "http://echo.getpostman.com");
+ p.put("restapiUser", "user1");
+ p.put("restapiPassword", "abc123");
+ p.put("format", "json");
+ p.put("httpMethod", "post");
+ p.put("responsePrefix", "response");
+ p.put("skipSending", "true");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
+
+ @Test
+ public void testL3DciTemplate() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("prop.dci-connects.id", "Id1");
+ ctx.setAttribute("prop.dci-connects.name", "Name1");
+ ctx.setAttribute("prop.dci-connects.local_networks_length", "2");
+ ctx.setAttribute("prop.dci-connects.local_networks[0]", "NetId1");
+ ctx.setAttribute("prop.dci-connects.local_networks[1]", "NetId2");
+ ctx.setAttribute("prop.dci-connects.evpn_irts[0]", "100:1");
+ ctx.setAttribute("prop.dci-connects.evpn_erts[0]", "100:2");
+ ctx.setAttribute("prop.dci-connects.evpn_irts[1]", "200:1");
+ ctx.setAttribute("prop.dci-connects.evpn_erts[1]", "200:2");
+ ctx.setAttribute("prop.dci-connects.vni", "1");
+
+ Map<String, String> p = new HashMap<>();
+ p.put("templateFileName", "src/test/resources/l3-dci-connects-template.json");
+ p.put("restapiUrl", "http://echo.getpostman.com");
+ p.put("restapiUser", "user1");
+ p.put("restapiPassword", "abc123");
+ p.put("format", "json");
+ p.put("httpMethod", "post");
+ p.put("responsePrefix", "response");
+ p.put("skipSending", "true");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+
+ }
+
+ @Test
+ public void testControllerTokenTemplate() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("prop.sdncRestApi.thirdpartySdnc.user", "admin");
+ ctx.setAttribute("prop.sdncRestApi.thirdpartySdnc.password", "admin123");
+
+ Map<String, String> p = new HashMap<>();
+ p.put("templateFileName", "src/test/resources/actokentemplate.json");
+ p.put("restapiUrl", "https://ipwan:18002/controller/v2/tokens");
+ p.put("format", "json");
+ p.put("httpMethod", "post");
+ p.put("responsePrefix", "restapi-result");
+ p.put("skipSending", "true");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
+
+
+ @Test
+ public void testDeleteNoneAsContentType() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+
+ Map<String, String> p = new HashMap<>();
+ p.put("restapiUrl", "https://echo.getpostman.com/delete");
+ p.put("restapiUser", "user1");
+ p.put("restapiPassword", "pwd1");
+ p.put("httpMethod", "delete");
+ p.put("format", "none");
+ p.put("skipSending", "true");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
+
+ @Test
+ public void testPostNoneAsContentType() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("prop.l3vpn.name", "10000000-0000-0000-0000-000000000001");
+ ctx.setAttribute("prop.l3vpn.topology", "point_to_point");
+
+ Map<String, String> p = new HashMap<>();
+ p.put("templateFileName", "src/test/resources/l3smvpntemplate.json");
+ p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/vpn-services");
+ p.put("restapiUser", "admin");
+ p.put("restapiPassword", "admin123");
+ p.put("format", "none");
+ p.put("httpMethod", "post");
+ p.put("responsePrefix", "restapi-result");
+ p.put("skipSending", "true");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
+ /*
+ * {
+ "partnerOne": {
+ "url": "http://localhost:7001" 4 http://uebsb93kcdc.it.att.com:3904",
+ "test": "/metrics"
+ },
+ "partnerTwo": {
+ "url": "http://localhost:7002",
+ "user": "controller_user",
+ "password": "P@ssword",
+ "test": "/metrics"
+ },
+ "partnerThree": {
+ "url": "http://localhost:7003",
+ "user": "controller_admin"
+ }
+}
+ */
+ @Test
+ public void testPartners() throws Exception{
+ String partnerTwoKey = "partnerTwo";
+ String partnerTwoUsername = "controller_user";
+ String partnerTwoPassword = "P@ssword";
+
+ System.setProperty("SDNC_CONFIG_DIR", "src/test/resources");
+ RestapiCallNode rcn = new RestapiCallNode();
+ assertNull(rcn.partnerStore.get("partnerOne"));
+ PartnerDetails details = rcn.partnerStore.get(partnerTwoKey);
+ assertEquals(partnerTwoUsername,details.username);
+ assertEquals(partnerTwoPassword,details.password);
+ assertNull(rcn.partnerStore.get("partnerThree"));
+
+ //In this scenario the caller expects username, password and url to be picked up from the partners json
+ Map<String, String> paramMap = new HashMap<String,String>();
+ paramMap.put("partner", partnerTwoKey);
+ rcn.handlePartner(paramMap );
+ assertEquals(partnerTwoUsername,paramMap.get(rcn.restapiUserKey));
+ assertEquals(partnerTwoPassword,paramMap.get(rcn.restapiPasswordKey));
+ assertEquals("http://localhost:7002",paramMap.get(rcn.restapiUrlString));
+
+ //In this scenario the caller expects username, password and url to be picked up from the partners json
+ //the provided suffix will be appended to the default url from the partners json
+ paramMap = new HashMap<String,String>();
+ paramMap.put("partner", partnerTwoKey);
+ paramMap.put("restapiUrlSuffix", "/networking/v1/instance/3");
+ rcn.handlePartner(paramMap);
+ Parameters p = new Parameters();
+ RestapiCallNode.getParameters(paramMap, p);
+ assertEquals(partnerTwoUsername,p.restapiUser);
+ assertEquals(partnerTwoPassword,p.restapiPassword);
+ assertEquals("http://localhost:7002/networking/v1/instance/3",p.restapiUrl);
+ }
+
+ @Test
+ public void retryPolicyBean() throws Exception {
+ Integer retries = 3;
+ String first = "http://localhost:7001";
+ String second = "http://localhost:7001";
+
+ RetryPolicy p = new RetryPolicy(new String[] {first,second}, retries);
+ assertEquals(retries,p.getMaximumRetries());
+ assertNotNull(p.getRetryMessage());
+ String next = p.getNextHostName();
+ assertEquals(second,next);
+ assertEquals(1,p.getRetryCount());
+ next = p.getNextHostName();
+ assertEquals(first,next);
+ assertEquals(2,p.getRetryCount());
+ }
+}
diff --git a/restapi-call-node/provider/src/test/resources/partners.json b/restapi-call-node/provider/src/test/resources/partners.json
new file mode 100755
index 000000000..9a17a1acf
--- /dev/null
+++ b/restapi-call-node/provider/src/test/resources/partners.json
@@ -0,0 +1,16 @@
+{
+ "partnerOne": {
+ "url": "http://localhost:7001",
+ "test": "/metrics"
+ },
+ "partnerTwo": {
+ "url": "http://localhost:7002",
+ "user": "controller_user",
+ "password": "P@ssword",
+ "test": "/metrics"
+ },
+ "partnerThree": {
+ "url": "http://localhost:7003",
+ "user": "controller_admin"
+ }
+}
> 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516