summaryrefslogtreecommitdiffstats
path: root/appc-adapters
diff options
context:
space:
mode:
authorPatrick Brady <pb071s@att.com>2017-07-28 11:29:23 -0700
committerPatrick Brady <pb071s@att.com>2017-08-02 15:43:44 +0000
commit38713207b817ed4700f630748c681116338d32f0 (patch)
tree9eb2097cee8d85ac14f17e3a280ae8aefb69d9de /appc-adapters
parent771ac55e29d099d8bbf783612de975047d75ab12 (diff)
Merging in bug fixes
Change-Id: I85da90b9ba0d03149f42035a820c76ef0285e413 Signed-off-by: Patrick Brady <pb071s@att.com> Issue: APPC-100
Diffstat (limited to 'appc-adapters')
-rw-r--r--appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/pom.xml24
-rw-r--r--appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/impl/ChefAdapterImpl.java131
-rw-r--r--appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/CommonHttpClient.java18
-rw-r--r--appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/HttpDmaapProducerImpl.java2
-rw-r--r--appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/resources/DCAEResponse.txt2
-rw-r--r--appc-adapters/appc-dmaap-adapter/appc-message-adapter-factory/src/main/java/org/openecomp/appc/adapter/factory/DmaapMessageAdapterFactoryImpl.java18
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/impl/ProviderAdapterImpl.java7
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/provider/operation/impl/base/ProviderServerOperation.java32
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/pom.xml10
-rw-r--r--appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/pom.xml21
-rw-r--r--appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/test/java/org/openecomp/appc/adapter/restHealthcheck/impl/TestRestHealthcheckAdapterImpl.java119
-rw-r--r--appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-features/src/main/resources/features.xml2
-rw-r--r--appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-installer/pom.xml2
13 files changed, 275 insertions, 113 deletions
diff --git a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/pom.xml b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/pom.xml
index 0fddd2bfa..0cb1c1d96 100644
--- a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/pom.xml
+++ b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/pom.xml
@@ -13,6 +13,11 @@
<name>chef Adapter - bundle</name>
<dependencies>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ <version>20160810</version>
+ </dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
@@ -35,8 +40,6 @@
<version>4.4.4</version>
</dependency>
- <!--<dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId>
- <version>4.5.1</version> </dependency> -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
@@ -51,14 +54,6 @@
<groupId>org.openecomp.appc</groupId>
<artifactId>appc-common</artifactId>
<version>${project.version}</version>
- <!-- <classifier>jar-with-dependencies</classifier> -->
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.openecomp.appc</groupId>
- <artifactId>appc-common</artifactId>
- <version>${project.version}</version>
-
</dependency>
<dependency>
<groupId>javax</groupId>
@@ -78,6 +73,13 @@
<artifactId>jackson-jaxrs</artifactId>
<version>1.9.12</version>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.5.1</version>
+ </dependency>
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -158,7 +160,7 @@
<Embed-Transitive>true</Embed-Transitive>
</instructions>
- <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
+ <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
</configuration>
</plugin>
</plugins>
diff --git a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/impl/ChefAdapterImpl.java b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/impl/ChefAdapterImpl.java
index 9dc50e516..5326b66b4 100644
--- a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/impl/ChefAdapterImpl.java
+++ b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/impl/ChefAdapterImpl.java
@@ -106,7 +106,7 @@ import org.json.JSONObject;
public class ChefAdapterImpl implements ChefAdapter {
// chef server Initialize variable
- public String username = "";
+ public String clientName = "";
public String clientPrivatekey = "";
public String chefserver = "";
public String serverAddress = "";
@@ -207,7 +207,7 @@ public class ChefAdapterImpl implements ChefAdapter {
String message = null;
if (privateKeyCheck()) {
// update the details of an environment on the Chef server.
- ChefApiClient cac = new ChefApiClient(username, clientPrivatekey, chefserver, organizations);
+ ChefApiClient cac = new ChefApiClient(clientName, clientPrivatekey, chefserver, organizations);
ApiMethod am = cac.put("/environments/"+envName).body(env);
am.execute();
code = am.getReturnCode();
@@ -247,7 +247,7 @@ public class ChefAdapterImpl implements ChefAdapter {
int code=200;
String message = null;
if (privateKeyCheck()) {
- ChefApiClient cac = new ChefApiClient(username, clientPrivatekey, chefserver, organizations);
+ ChefApiClient cac = new ChefApiClient(clientName, clientPrivatekey, chefserver, organizations);
for(int i = 0; i < nodes.size(); i++){
String nodeName=nodes.get(i);
@@ -306,7 +306,7 @@ public class ChefAdapterImpl implements ChefAdapter {
rc.isAlive();
SvcLogicContext svcLogic = rc.getSvcLogicContext();
- ChefApiClient cac = new ChefApiClient(username, clientPrivatekey, chefserver, organizations);
+ ChefApiClient cac = new ChefApiClient(clientName, clientPrivatekey, chefserver, organizations);
ApiMethod am = cac.post(chefAction).body(pushRequest);
am.execute();
@@ -342,7 +342,7 @@ public class ChefAdapterImpl implements ChefAdapter {
int code;
String message = null;
if (privateKeyCheck()) {
- ChefApiClient cac = new ChefApiClient(username, clientPrivatekey, chefserver, organizations);
+ ChefApiClient cac = new ChefApiClient(clientName, clientPrivatekey, chefserver, organizations);
ApiMethod am = cac.get(chefAction);
am.execute();
code = am.getReturnCode();
@@ -393,16 +393,21 @@ public class ChefAdapterImpl implements ChefAdapter {
}
+
+ /**
+ * build node object
+ */
+
@SuppressWarnings("nls")
@Override
public void nodeObejctBuilder(Map<String, String> params, SvcLogicContext ctx) {
logger.info("nodeObejctBuilder");
- String name = params.get("nodeobject.name");
- String normal = params.get("nodeobject.normal");
- String overrides = params.get("nodeobject.overrides");
- String defaults = params.get("nodeobject.defaults");
- String run_list = params.get("nodeobject.run_list");
- String chef_environment = params.get("nodeobject.chef_environment");
+ String name = params.get("org.openecomp.appc.instance.nodeobject.name");
+ String normal = params.get("org.openecomp.appc.instance.nodeobject.normal");
+ String overrides = params.get("org.openecomp.appc.instance.nodeobject.overrides");
+ String defaults = params.get("org.openecomp.appc.instance.nodeobject.defaults");
+ String run_list = params.get("org.openecomp.appc.instance.nodeobject.run_list");
+ String chef_environment = params.get("org.openecomp.appc.instance.nodeobject.chef_environment");
String nodeObject = "{\"json_class\":\"Chef::Node\",\"default\":{" + defaults
+ "},\"chef_type\":\"node\",\"run_list\":[" + run_list + "],\"override\":{" + overrides
+ "},\"normal\": {" + normal + "},\"automatic\":{},\"name\":\"" + name + "\",\"chef_environment\":\""
@@ -412,17 +417,20 @@ public class ChefAdapterImpl implements ChefAdapter {
RequestContext rc = new RequestContext(ctx);
rc.isAlive();
SvcLogicContext svcLogic = rc.getSvcLogicContext();
- svcLogic.setAttribute("chef.nodeObject", nodeObject);
+ svcLogic.setAttribute("org.openecomp.appc.chef.nodeObject", nodeObject);
}
+ /**
+ * Nicolas send get request to chef server
+ */
public void chefInfo(Map<String, String> params) {
- username = params.get("username");
- serverAddress = params.get("serverAddress");
- organizations = params.get("organizations");
+ clientName = params.get("org.openecomp.appc.instance.username");
+ serverAddress = params.get("org.openecomp.appc.instance.serverAddress");
+ organizations = params.get("org.openecomp.appc.instance.organizations");
chefserver = "https://" + serverAddress + "/organizations/" + organizations;
- clientPrivatekey = "/opt/app/bvc/chef/" + serverAddress + "/" + organizations + "/" + username + ".pem";
+ clientPrivatekey = "/opt/app/bvc/chef/" + serverAddress + "/" + organizations + "/" + clientName + ".pem";
}
public Boolean privateKeyCheck() {
@@ -438,9 +446,9 @@ public class ChefAdapterImpl implements ChefAdapter {
@Override
public void retrieveData(Map<String, String> params, SvcLogicContext ctx) {
String contextData = "someValue";
- String allConfigData = params.get("allConfig");
- String key = params.get("key");
- String dgContext = params.get("dgContext");
+ String allConfigData = params.get("org.openecomp.appc.instance.allConfig");
+ String key = params.get("org.openecomp.appc.instance.key");
+ String dgContext = params.get("org.openecomp.appc.instance.dgContext");
JSONObject josnConfig = new JSONObject(allConfigData);
try {
contextData = josnConfig.getString(key);
@@ -462,28 +470,33 @@ public class ChefAdapterImpl implements ChefAdapter {
@Override
public void combineStrings(Map<String, String> params, SvcLogicContext ctx) {
- String String1 = params.get("String1");
- String String2 = params.get("String2");
- String dgContext = params.get("dgContext");
+ String String1 = params.get("org.openecomp.appc.instance.String1");
+ String String2 = params.get("org.openecomp.appc.instance.String2");
+ String dgContext = params.get("org.openecomp.appc.instance.dgContext");
String contextData = String1 + String2;
RequestContext rc = new RequestContext(ctx);
rc.isAlive();
SvcLogicContext svcLogic = rc.getSvcLogicContext();
svcLogic.setAttribute(dgContext, contextData);
}
+
+
+ /**
+ * Send GET request to chef server
+ */
@SuppressWarnings("nls")
@Override
public void chefGet(Map<String, String> params, SvcLogicContext ctx) {
logger.info("chef get method");
chefInfo(params);
- String chefAction = params.get("chefAction");
+ String chefAction = params.get("org.openecomp.appc.instance.chefAction");
RequestContext rc = new RequestContext(ctx);
rc.isAlive();
int code;
String message = null;
if (privateKeyCheck()) {
- ChefApiClient cac = new ChefApiClient(username, clientPrivatekey, chefserver, organizations);
+ ChefApiClient cac = new ChefApiClient(clientName, clientPrivatekey, chefserver, organizations);
ApiMethod am = cac.get(chefAction);
am.execute();
code = am.getReturnCode();
@@ -505,14 +518,14 @@ public class ChefAdapterImpl implements ChefAdapter {
@Override
public void chefPut(Map<String, String> params, SvcLogicContext ctx) {
chefInfo(params);
- String chefAction = params.get("chefAction");
- String CHEF_NODE_STR = params.get("chefRequestBody");
+ String chefAction = params.get("org.openecomp.appc.instance.chefAction");
+ String CHEF_NODE_STR = params.get("org.openecomp.appc.instance.chefRequestBody");
RequestContext rc = new RequestContext(ctx);
rc.isAlive();
int code;
String message = null;
if (privateKeyCheck()) {
- ChefApiClient cac = new ChefApiClient(username, clientPrivatekey, chefserver, organizations);
+ ChefApiClient cac = new ChefApiClient(clientName, clientPrivatekey, chefserver, organizations);
ApiMethod am = cac.put(chefAction).body(CHEF_NODE_STR);
am.execute();
@@ -525,10 +538,11 @@ public class ChefAdapterImpl implements ChefAdapter {
}
logger.info(code + " " + message);
chefServerResult(rc, Integer.toString(code), message);
- }
+ }
+
/**
- * send Post request to chef server
+ * Nicolas send Post request to chef server
*/
@SuppressWarnings("nls")
@@ -536,15 +550,25 @@ public class ChefAdapterImpl implements ChefAdapter {
public void chefPost(Map<String, String> params, SvcLogicContext ctx) {
chefInfo(params);
logger.info("chef Post method");
- logger.info(username + " " + clientPrivatekey + " " + chefserver + " " + organizations);
- String CHEF_NODE_STR = params.get("chefRequestBody");
- String chefAction = params.get("chefAction");
+ logger.info(clientName + " " + clientPrivatekey + " " + chefserver + " " + organizations);
+ String CHEF_NODE_STR = params.get("org.openecomp.appc.instance.chefRequestBody");
+ String chefAction = params.get("org.openecomp.appc.instance.chefAction");
+
+ // attributes="\"reconfig-test\":{\"secret\":\"newpass2\"}";
+ // String CHEF_NODE_STR =
+ // "{\"json_class\":\"Chef::Node\",\"default\":{},\"chef_type\":\"node\",\"run_list\":[\""+runList+"\"],\"override\":{},\"automatic\":{},\"normal\":{"+attributes+"},\"name\":\"testnode\",\"chef_environment\":\"_default\"}";
+ // String CHEF_NODE_STR = "{\"json_class\":\"Chef::Node\"}";
+ // logger.info(vm_url);
RequestContext rc = new RequestContext(ctx);
rc.isAlive();
int code;
String message = null;
+ // should load pem from somewhere else
if (privateKeyCheck()) {
- ChefApiClient cac = new ChefApiClient(username, clientPrivatekey, chefserver, organizations);
+ ChefApiClient cac = new ChefApiClient(clientName, clientPrivatekey, chefserver, organizations);
+
+ // need pass path into it
+ // "/nodes/testnode"
ApiMethod am = cac.post(chefAction).body(CHEF_NODE_STR);
am.execute();
code = am.getReturnCode();
@@ -558,19 +582,22 @@ public class ChefAdapterImpl implements ChefAdapter {
chefServerResult(rc, Integer.toString(code), message);
}
+ /**
+ * Nicolas send delete request to chef server
+ */
@SuppressWarnings("nls")
@Override
public void chefDelete(Map<String, String> params, SvcLogicContext ctx) {
logger.info("chef delete method");
chefInfo(params);
- String chefAction = params.get("chefAction");
+ String chefAction = params.get("org.openecomp.appc.instance.chefAction");
RequestContext rc = new RequestContext(ctx);
rc.isAlive();
int code;
String message = null;
if (privateKeyCheck()) {
- ChefApiClient cac = new ChefApiClient(username, clientPrivatekey, chefserver, organizations);
+ ChefApiClient cac = new ChefApiClient(clientName, clientPrivatekey, chefserver, organizations);
ApiMethod am = cac.delete(chefAction);
am.execute();
code = am.getReturnCode();
@@ -583,6 +610,10 @@ public class ChefAdapterImpl implements ChefAdapter {
logger.info(code + " " + message);
chefServerResult(rc, Integer.toString(code), message);
}
+
+
+
+
@SuppressWarnings("nls")
@@ -608,13 +639,16 @@ public class ChefAdapterImpl implements ChefAdapter {
}
}
+
+
+
@SuppressWarnings("nls")
@Override
public void checkPushJob(Map<String, String> params, SvcLogicContext ctx) {
chefInfo(params);
- String jobID = params.get("jobid");
- int retryTimes = Integer.parseInt(params.get("retryTimes"));
- int retryInterval = Integer.parseInt(params.get("retryInterval"));
+ String jobID = params.get("org.openecomp.appc.instance.jobid");
+ int retryTimes = Integer.parseInt(params.get("org.openecomp.appc.instance.retryTimes"));
+ int retryInterval = Integer.parseInt(params.get("org.openecomp.appc.instance.retryInterval"));
String chefAction = "/pushy/jobs/" + jobID;
RequestContext rc = new RequestContext(ctx);
@@ -628,7 +662,7 @@ public class ChefAdapterImpl implements ChefAdapter {
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
- ChefApiClient cac = new ChefApiClient(username, clientPrivatekey, chefserver, organizations);
+ ChefApiClient cac = new ChefApiClient(clientName, clientPrivatekey, chefserver, organizations);
ApiMethod am = cac.get(chefAction);
am.execute();
int code = am.getReturnCode();
@@ -642,15 +676,15 @@ public class ChefAdapterImpl implements ChefAdapter {
}
if (status.equals("complete")) {
- svcLogic.setAttribute("chefServerResult.code", "200");
- svcLogic.setAttribute("chefServerResult.message", message);
+ svcLogic.setAttribute("org.openecomp.appc.chefServerResult.code", "200");
+ svcLogic.setAttribute("org.openecomp.appc.chefServerResult.message", message);
} else {
if (status.equals("running")) {
- svcLogic.setAttribute("chefServerResult.code", "202");
- svcLogic.setAttribute("chefServerResult.message", "chef client runtime out");
+ svcLogic.setAttribute("org.openecomp.appc.chefServerResult.code", "202");
+ svcLogic.setAttribute("org.openecomp.appc.chefServerResult.message", "chef client runtime out");
} else {
- svcLogic.setAttribute("chefServerResult.code", "500");
- svcLogic.setAttribute("chefServerResult.message", message);
+ svcLogic.setAttribute("org.openecomp.appc.chefServerResult.code", "500");
+ svcLogic.setAttribute("org.openecomp.appc.chefServerResult.message", message);
}
}
}
@@ -660,12 +694,12 @@ public class ChefAdapterImpl implements ChefAdapter {
@Override
public void pushJob(Map<String, String> params, SvcLogicContext ctx) {
chefInfo(params);
- String pushRequest = params.get("pushRequest");
+ String pushRequest = params.get("org.openecomp.appc.instance.pushRequest");
String chefAction = "/pushy/jobs";
RequestContext rc = new RequestContext(ctx);
rc.isAlive();
SvcLogicContext svcLogic = rc.getSvcLogicContext();
- ChefApiClient cac = new ChefApiClient(username, clientPrivatekey, chefserver, organizations);
+ ChefApiClient cac = new ChefApiClient(clientName, clientPrivatekey, chefserver, organizations);
ApiMethod am = cac.post(chefAction).body(pushRequest);
;
am.execute();
@@ -675,13 +709,12 @@ public class ChefAdapterImpl implements ChefAdapter {
int startIndex = message.indexOf("jobs") + 6;
int endIndex = message.length() - 2;
String jobID = message.substring(startIndex, endIndex);
- svcLogic.setAttribute("jobID", jobID);
+ svcLogic.setAttribute("org.openecomp.appc.jobID", jobID);
logger.info(jobID);
}
chefServerResult(rc, Integer.toString(code), message);
}
-
@SuppressWarnings("static-method")
private void doFailure(RequestContext rc, int code, String message) {
SvcLogicContext svcLogic = rc.getSvcLogicContext();
diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/CommonHttpClient.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/CommonHttpClient.java
index a2e15797a..ed2f13ff0 100644
--- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/CommonHttpClient.java
+++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/CommonHttpClient.java
@@ -50,19 +50,23 @@ public class CommonHttpClient {
}
public HttpGet getReq(URI uri, int timeoutMs) throws Exception {
- HttpGet out = (uri == null) ? new HttpGet() : new HttpGet(uri);
- if (AUTH_STR != null) {
- out.setHeader("Authorization", String.format("Basic %s", AUTH_STR));
- }
+ if (AUTH_STR == null) {
+ throw new Exception("All DMaaP requests require authentication and none was provided.");
+ }
+
+ HttpGet out = (uri == null) ? new HttpGet() : new HttpGet(uri);
+ out.setHeader("Authorization", String.format("Basic %s", AUTH_STR));
out.setConfig(getConfig(timeoutMs));
return out;
}
public HttpPost postReq(String url) throws Exception {
- HttpPost out = (url == null) ? new HttpPost() : new HttpPost(url);
- if (AUTH_STR != null) {
- out.setHeader("Authorization", String.format("Basic %s", AUTH_STR));
+ if (AUTH_STR == null) {
+ throw new Exception("All DMaaP requests require authentication and none was provided.");
}
+
+ HttpPost out = (url == null) ? new HttpPost() : new HttpPost(url);
+ out.setHeader("Authorization", String.format("Basic %s", AUTH_STR));
out.setConfig(getConfig(0));
return out;
}
diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/HttpDmaapProducerImpl.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/HttpDmaapProducerImpl.java
index 1073e152f..aeb248c9b 100644
--- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/HttpDmaapProducerImpl.java
+++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/HttpDmaapProducerImpl.java
@@ -119,7 +119,7 @@ public class HttpDmaapProducerImpl extends CommonHttpClient implements Producer
}
/**
- * Format the body for the application/cambria content type with no partitioning.
+ * Format the body for the application/cambria content type with no partitioning. See
*
* @param msg
* The message body to format
diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/resources/DCAEResponse.txt b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/resources/DCAEResponse.txt
index 0d7ea2afa..884a8525f 100644
--- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/resources/DCAEResponse.txt
+++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/test/resources/DCAEResponse.txt
@@ -15,4 +15,6 @@
"nOID": ".1.3.6.1.4.1.193.183.4.2.0.4",
"AgentAddress": "192.168.1.2",
"vmOID": ".1.3.6.1.4.1.193.183.4.1.2.1",
+"AICTenantID": "0123456789abcdef0123456789",
+"AICVServerSelfLink": "http://somewhere"
} \ No newline at end of file
diff --git a/appc-adapters/appc-dmaap-adapter/appc-message-adapter-factory/src/main/java/org/openecomp/appc/adapter/factory/DmaapMessageAdapterFactoryImpl.java b/appc-adapters/appc-dmaap-adapter/appc-message-adapter-factory/src/main/java/org/openecomp/appc/adapter/factory/DmaapMessageAdapterFactoryImpl.java
index ed27db93e..d555f3952 100644
--- a/appc-adapters/appc-dmaap-adapter/appc-message-adapter-factory/src/main/java/org/openecomp/appc/adapter/factory/DmaapMessageAdapterFactoryImpl.java
+++ b/appc-adapters/appc-dmaap-adapter/appc-message-adapter-factory/src/main/java/org/openecomp/appc/adapter/factory/DmaapMessageAdapterFactoryImpl.java
@@ -30,21 +30,29 @@ import java.util.Set;
import org.openecomp.appc.adapter.message.Consumer;
import org.openecomp.appc.adapter.message.MessageAdapterFactory;
import org.openecomp.appc.adapter.message.Producer;
+
import org.openecomp.appc.adapter.messaging.dmaap.http.HttpDmaapConsumerImpl;
import org.openecomp.appc.adapter.messaging.dmaap.http.HttpDmaapProducerImpl;
+import org.openecomp.appc.adapter.messaging.dmaap.impl.DmaapConsumerImpl;
+import org.openecomp.appc.adapter.messaging.dmaap.impl.DmaapProducerImpl;
+
public class DmaapMessageAdapterFactoryImpl implements MessageAdapterFactory {
+ //Set to true if the HttpDmaap... should be used instead of the regular Dmaap...
+ private static final boolean HTTP = true;
+
public Producer createProducer(Collection<String> pools, String writeTopic, String apiKey, String apiSecret) {
- return new HttpDmaapProducerImpl(pools, writeTopic);
+ return HTTP ? new HttpDmaapProducerImpl(pools, writeTopic) : new DmaapProducerImpl(pools, writeTopic,apiKey, apiSecret);
}
-
+
public Producer createProducer(Collection<String> pools, Set<String> writeTopics, String apiKey, String apiSecret) {
- return new HttpDmaapProducerImpl(pools, writeTopics);
+ return HTTP ? new HttpDmaapProducerImpl(pools, writeTopics) : new DmaapProducerImpl(pools, writeTopics, apiKey, apiSecret);
}
public Consumer createConsumer(Collection<String> pool, String readTopic,
- String clientName, String clientId, String filter_json, String apiKey, String apiSecret) {
- return new HttpDmaapConsumerImpl(pool, readTopic, clientName, clientId, apiKey, apiSecret, filter_json);
+ String clientName, String clientId, String filter_json, String apiKey, String apiSecret) {
+ return HTTP ? new HttpDmaapConsumerImpl(pool, readTopic, clientName, clientId, apiKey, apiSecret, filter_json) :
+ new DmaapConsumerImpl(pool, readTopic, clientName, clientId, apiKey, apiSecret, filter_json);
}
}
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/impl/ProviderAdapterImpl.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/impl/ProviderAdapterImpl.java
index de0569d42..1888861c6 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/impl/ProviderAdapterImpl.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/impl/ProviderAdapterImpl.java
@@ -52,6 +52,9 @@ import java.util.Properties;
/**
* This class implements the {@link ProviderAdapter} interface. This interface defines the behaviors that our service
* provides.
+ *
+ * @since Aug 12, 2015
+ * @version $Id$
*/
@SuppressWarnings("javadoc")
public class ProviderAdapterImpl implements ProviderAdapter {
@@ -278,8 +281,8 @@ public class ProviderAdapterImpl implements ProviderAdapter {
* provider1.name=ILAB
* provider1.identity=http://provider1:5000/v2.0
* provider1.tenant1.name=CDP-ONAP-APPC
- * provider1.tenant1.userid=cdpdev
- * provider1.tenant1.password=cdpdev@123
+ * provider1.tenant1.userid=testUser
+ * provider1.tenant1.password=testPassword
* provider1.tenant2.name=TEST-TENANT
* provider1.tenant2.userid=testUser
* provider1.tenant2.password=testPassword
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/provider/operation/impl/base/ProviderServerOperation.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/provider/operation/impl/base/ProviderServerOperation.java
index f037e58a3..b7ad626ce 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/provider/operation/impl/base/ProviderServerOperation.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/provider/operation/impl/base/ProviderServerOperation.java
@@ -535,19 +535,33 @@ public abstract class ProviderServerOperation extends ProviderOperation{
throws ZoneException, RequestFailedException {
logger.info("Performing the Hypervisor status checks..");
- String status = null, state = null, msg = null;
-
- status = server.getHypervisor().getStatus().toString();
- state = server.getHypervisor().getState().toString();
- if (!status.equals(Hypervisor.Status.ENABLED.toString()) || !state.equals(Hypervisor.State.UP.toString())) {
- msg = EELFResourceManager.format(Msg.HYPERVISOR_DOWN_ERROR, server.getHypervisor().getHostName(), server.getName());
- logger.error(msg.toString());
+ String msg = null;
+ if(server.getHypervisor() != null && server.getHypervisor().getStatus() != null && server.getHypervisor().getState() != null)
+ {
+ String status = null, state = null;
+
+ status = server.getHypervisor().getStatus().toString();
+ state = server.getHypervisor().getState().toString();
+
+ if (!status.equals(Hypervisor.Status.ENABLED.toString()) || !state.equals(Hypervisor.State.UP.toString()))
+ {
+ msg = EELFResourceManager.format(Msg.HYPERVISOR_DOWN_ERROR, server.getHypervisor().getHostName(), server.getName());
+ logger.error(msg.toString());
- //doFailure(rc, HttpStatus.PRECONDITION_FAILED_412, msg);
- throw new RequestFailedException("Hypervisor status DOWN or NOT ENABLED", msg.toString(), HttpStatus.PRECONDITION_FAILED_412,
+ //doFailure(rc, HttpStatus.PRECONDITION_FAILED_412, msg);
+ throw new RequestFailedException("Hypervisor status DOWN or NOT ENABLED", msg.toString(), HttpStatus.PRECONDITION_FAILED_412,
server);
+ }
+ }
+ else
+ {
+ msg = EELFResourceManager.format(Msg.HYPERVISOR_STATUS_UKNOWN, server.getName());
+ logger.error(msg.toString());
+
+ throw new RequestFailedException("Unable to determine Hypervisor status", msg.toString(), HttpStatus.PRECONDITION_FAILED_412,
+ server);
}
logger.info("Passed the Hypervisor status checks..");
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/pom.xml b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/pom.xml
index 19f9ebb72..b09e5593c 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/pom.xml
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/pom.xml
@@ -22,11 +22,6 @@
<artifactId>appc-common</artifactId>
<version>${project.version}</version>
</dependency>
-<!-- <dependency> -->
-<!-- <groupId>org.openecomp.appc</groupId> -->
-<!-- <artifactId>appc-dmaap-adapter-bundle</artifactId> -->
-<!-- <version>${project.version}</version> -->
-<!-- </dependency> -->
<dependency>
<groupId>javax</groupId>
@@ -110,11 +105,6 @@
</dependency>
<dependency>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.eclipse.osgi</artifactId>
- </dependency>
-
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
diff --git a/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/pom.xml b/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/pom.xml
index 094ca9ab6..b8fdf9a4a 100644
--- a/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/pom.xml
+++ b/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/pom.xml
@@ -48,15 +48,8 @@
<groupId>org.openecomp.appc</groupId>
<artifactId>appc-common</artifactId>
<version>${project.version}</version>
- <classifier>jar-with-dependencies</classifier>
<scope>compile</scope>
</dependency>
- <dependency>
- <groupId>org.openecomp.appc</groupId>
- <artifactId>appc-common</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>javax</groupId>
@@ -110,6 +103,7 @@
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-common</artifactId>
<version>2.9.1</version>
+ <scope>test</scope>
</dependency>
<dependency>
@@ -119,12 +113,6 @@
</dependency>
<dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>4.5.1</version>
- </dependency>
-
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
@@ -133,7 +121,7 @@
<dependency>
<groupId>org.openecomp.sdnc.core</groupId>
<artifactId>sli-common</artifactId>
- <scope>compile</scope>
+ <scope>provided</scope>
<!-- Added exclusion to prevent missing dependency issue on dblib -->
<exclusions>
<exclusion>
@@ -146,7 +134,7 @@
<dependency>
<groupId>org.openecomp.sdnc.core</groupId>
<artifactId>sli-provider</artifactId>
- <scope>compile</scope>
+ <scope>provided</scope>
<!-- Added exclusion to prevent missing dependency issue on dblib -->
<exclusions>
<exclusion>
@@ -206,8 +194,7 @@
<Bundle-SymbolicName>appc-rest-healthcheck-adapter</Bundle-SymbolicName>
<Bundle-Activator>org.openecomp.appc.adapter.restHealthcheck.RestHealthcheckActivator</Bundle-Activator>
<Export-Package>org.openecomp.appc.adapter.restHealthcheck</Export-Package>
- <Import-Package>
- org.openecomp.sdnctl.sli.*,org.osgi.framework.*,org.slf4j.*,com.vmware.*,org.apache.xerces.*,javax.net.*,javax.net.ssl.*,org.xml.sax.*,javax.xml.bind.*,javax.naming.*,javax.security.auth.*
+ <Import-Package>org.openecomp.sdnc.sli.*,org.osgi.framework.*,org.slf4j.*,com.vmware.*,org.apache.xerces.*,javax.net.*,javax.net.ssl.*,org.xml.sax.*,javax.xml.bind.*,javax.naming.*,javax.security.auth.*
</Import-Package>
<Embed-Dependency>
*;scope=compile|runtime;artifactId=!sli-common|!appc-common|org.eclipse.osgi|slf4j-api|jcl-over-slf4j|xml-apis
diff --git a/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/test/java/org/openecomp/appc/adapter/restHealthcheck/impl/TestRestHealthcheckAdapterImpl.java b/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/test/java/org/openecomp/appc/adapter/restHealthcheck/impl/TestRestHealthcheckAdapterImpl.java
new file mode 100644
index 000000000..de18956de
--- /dev/null
+++ b/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/test/java/org/openecomp/appc/adapter/restHealthcheck/impl/TestRestHealthcheckAdapterImpl.java
@@ -0,0 +1,119 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.appc.adapter.restHealthcheck.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.MDC;
+
+import org.openecomp.appc.Constants;
+import org.openecomp.appc.adapter.restHealthcheck.*;
+import org.openecomp.appc.configuration.ConfigurationFactory;
+import org.openecomp.appc.exceptions.APPCException;
+import org.openecomp.appc.exceptions.UnknownProviderException;
+import com.att.cdp.exceptions.ZoneException;
+import com.att.cdp.zones.ComputeService;
+import com.att.cdp.zones.Context;
+import com.att.cdp.zones.ContextFactory;
+import com.att.cdp.zones.model.Server;
+import com.att.cdp.zones.model.Server.Status;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+
+
+
+public class TestRestHealthcheckAdapterImpl {
+
+ @SuppressWarnings("nls")
+ private static final String PROVIDER_NAME = "ILAB";
+
+ @SuppressWarnings("nls")
+ private static final String PROVIDER_TYPE = "OpenStackProvider";
+
+ private static String IDENTITY_URL;
+
+ private static String PRINCIPAL;
+
+ private static String CREDENTIAL;
+
+ private static String TENANT_NAME;
+
+ private static String TENANT_ID;
+
+ private static String USER_ID;
+
+ private static String REGION_NAME;
+
+ private static String SERVER_URL;
+
+ private static Class<?> providerAdapterImplClass;
+ private static Class<?> configurationFactoryClass;
+ private static Field providerCacheField;
+ private static Field configField;
+
+ private RestHealthcheckAdapterImpl adapter;
+
+
+ @SuppressWarnings("nls")
+ @BeforeClass
+ public static void once() throws NoSuchFieldException, SecurityException, NoSuchMethodException {
+
+ }
+
+ @Before
+ public void setup() throws IllegalArgumentException, IllegalAccessException {
+
+ adapter = new RestHealthcheckAdapterImpl();
+ }
+
+ @Test
+ public void testCheckHealth() throws IOException, IllegalStateException, IllegalArgumentException,
+ ZoneException, APPCException {
+
+ Map<String, String> params = new HashMap<>();
+ params.put("VNF.URI", "http://restHalthCheck.test");
+ params.put("VNF.endpoint", "health");
+ SvcLogicContext svcContext = new SvcLogicContext();
+ adapter.checkHealth(params, svcContext);
+ String statusCode=svcContext.getAttribute("healthcheck.result.code");
+ assertEquals("200",statusCode);
+ }
+
+
+
+}
diff --git a/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-features/src/main/resources/features.xml b/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-features/src/main/resources/features.xml
index 1758e957a..0342b2310 100644
--- a/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-features/src/main/resources/features.xml
+++ b/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-features/src/main/resources/features.xml
@@ -28,7 +28,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
- <repository>mvn:org.opendaylight.mdsal/features-mdsal/${features-mdsal.version}/xml/features</repository>
+ <repository>mvn:org.opendaylight.mdsal/features-mdsal/${odl.mdsal.features.version}/xml/features</repository>
<feature name='appc-rest-healthcheck-adapter' description="appc-rest-healthcheck-adapter" version='${project.version}'>
<!-- Most applications will have a dependency on the ODL MD-SAL Broker -->
diff --git a/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-installer/pom.xml b/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-installer/pom.xml
index 4dc4a4d13..2490cd803 100644
--- a/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-installer/pom.xml
+++ b/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-installer/pom.xml
@@ -7,7 +7,7 @@
<version>1.1.0-SNAPSHOT</version>
</parent>
<artifactId>appc-rest-healthcheck-adapter-installer</artifactId>
- <name>Chef Adapter - Karaf Installer</name>
+ <name>Rest Health Check Adapter - Karaf Installer</name>
<packaging>pom</packaging>
<properties>
<application.name>appc-rest-healthcheck-adapter</application.name>