aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/main/java/org')
-rw-r--r--framework/src/main/java/org/onap/cli/fw/ad/OnapAuthClient.java3
-rw-r--r--framework/src/main/java/org/onap/cli/fw/ad/OnapService.java27
-rw-r--r--framework/src/main/java/org/onap/cli/fw/conf/Constants.java3
-rw-r--r--framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java4
4 files changed, 35 insertions, 2 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/ad/OnapAuthClient.java b/framework/src/main/java/org/onap/cli/fw/ad/OnapAuthClient.java
index 9c7e4a66..e6c69a11 100644
--- a/framework/src/main/java/org/onap/cli/fw/ad/OnapAuthClient.java
+++ b/framework/src/main/java/org/onap/cli/fw/ad/OnapAuthClient.java
@@ -137,8 +137,11 @@ public class OnapAuthClient {
public String getServiceBasePath(OnapService srv) throws OnapCommandException {
if (srv.getName().equals(OnapCommandConfg.getApiGateway())) {
return this.getMsbUrl();
+ } else if (srv.isModeDirect()){
+ return this.creds.getMsbUrl();
}
+
HttpInput input = new HttpInput().setUri(this.creds.getMsbUrl()
+ String.format(Constants.MSB_SERVICE_URI, srv.getName(), srv.getVersion()));
HttpResult result = this.http.get(input);
diff --git a/framework/src/main/java/org/onap/cli/fw/ad/OnapService.java b/framework/src/main/java/org/onap/cli/fw/ad/OnapService.java
index 16752f25..f9d4a638 100644
--- a/framework/src/main/java/org/onap/cli/fw/ad/OnapService.java
+++ b/framework/src/main/java/org/onap/cli/fw/ad/OnapService.java
@@ -16,8 +16,10 @@
package org.onap.cli.fw.ad;
+import org.onap.cli.fw.conf.Constants;
+
/**
- * Onap Service as reported in Onap MSB like msb v1 or /api/microservice/v1.
+ * Onap Service as reported in api catalog.
*/
public class OnapService {
/*
@@ -32,8 +34,29 @@ public class OnapService {
private String basePath;
+ /**
+ * Mode of service consideration. By default, it goes with
+ * 'catalog' mode, where basePath will be discovered by
+ * the framework using serviceName and serviceVersion
+ * Another mode is 'direct', in which bastPath will be
+ * same as OnapCredentails.ServiceUrl.
+ */
+ private String mode = Constants.MODE_CATALOG;
+
private boolean noAuth = false;
+ public String getMode() {
+ return mode;
+ }
+
+ public void setMode(String mode) {
+ this.mode = mode;
+ }
+
+ public boolean isModeDirect() {
+ return this.getMode().equals(Constants.MODE_DIRECT);
+ }
+
public boolean isNoAuth() {
return noAuth;
}
@@ -71,4 +94,4 @@ public class OnapService {
return this.getName() + " " + this.getVersion();
}
-}
+} \ No newline at end of file
diff --git a/framework/src/main/java/org/onap/cli/fw/conf/Constants.java b/framework/src/main/java/org/onap/cli/fw/conf/Constants.java
index 5f95518c..e487bbf2 100644
--- a/framework/src/main/java/org/onap/cli/fw/conf/Constants.java
+++ b/framework/src/main/java/org/onap/cli/fw/conf/Constants.java
@@ -75,6 +75,9 @@ public class Constants {
public static final String VERSION = "version";
public static final String BASE_PATH = "base_path";
public static final String NO_AUTH = "no-auth";
+ public static final String MODE = "mode";
+ public static final String MODE_DIRECT = "direct";
+ public static final String MODE_CATALOG = "catalog";
public static final String SHORT_OPTION = "short_option";
public static final String LONG_OPTION = "long_option";
diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
index 1a5aba0f..b4df2ace 100644
--- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
+++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
@@ -251,6 +251,10 @@ public class OnapCommandUtils {
} else if (Constants.NO_AUTH.equals(key1)) {
Object obj = map.get(key1);
srv.setNoAuth("true".equalsIgnoreCase(obj.toString()));
+ } else if (Constants.MODE.equals(key1)) {
+ Object obj = map.get(key1);
+ //TODO mrkanag Validate and raise exception for invalid case
+ srv.setMode(obj.toString());
}
}