diff options
author | dglFromAtt <dgl@research.att.com> | 2018-10-12 15:40:48 -0400 |
---|---|---|
committer | dglFromAtt <dgl@research.att.com> | 2018-10-12 15:42:34 -0400 |
commit | 378d55bf699e9a3d6c5a1f1a5e47bdbde9594abc (patch) | |
tree | 4615631b561af504a115c11e29286e80d6397e70 /src/main | |
parent | 74d55c254031a25f06f106291e8506eb53bd813d (diff) |
Changes for ONAP AAF
Change-Id: I20eee308e03822a94fcecd7467963cfe69671e61
Signed-off-by: dglFromAtt <dgl@research.att.com>
Issue-ID: DMAAP-846
Diffstat (limited to 'src/main')
3 files changed, 35 insertions, 6 deletions
diff --git a/src/main/java/org/onap/dmaap/dbcapi/authentication/AafLurAndFish.java b/src/main/java/org/onap/dmaap/dbcapi/authentication/AafLurAndFish.java index 2366452..0c81fa9 100644 --- a/src/main/java/org/onap/dmaap/dbcapi/authentication/AafLurAndFish.java +++ b/src/main/java/org/onap/dmaap/dbcapi/authentication/AafLurAndFish.java @@ -89,10 +89,17 @@ public class AafLurAndFish implements ApiAuthorizationCheckInterface { } - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws Exception { AafLurAndFish alaf = new AafLurAndFish(); DmaapPerm p = new DmaapPerm( "org.onap.dmaap-bc.api.dmaap", "boot", "GET"); - alaf.check("demo@people.osaaf.org", "demo123456!", p); + try { + alaf.check("mmanager@people.osaaf.org", "demo123456!", p); + } catch (AuthenticationErrorException aee ) { + logger.error( "Check failed for: " + p.toJSON()); + System.exit(-1); + } + logger.info( "Check succeeded for: " + p.toJSON() ); + } } diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/DmaapService.java b/src/main/java/org/onap/dmaap/dbcapi/service/DmaapService.java index de87b00..e2bc379 100644 --- a/src/main/java/org/onap/dmaap/dbcapi/service/DmaapService.java +++ b/src/main/java/org/onap/dmaap/dbcapi/service/DmaapService.java @@ -52,6 +52,7 @@ public class DmaapService extends BaseLoggingClass { private Singleton<Dmaap> dmaapholder = DatabaseClass.getDmaap(); + private static String noEnvironmentPrefix; String topicFactory; // = "org.openecomp.dcae.dmaap.topicFactory"; @@ -66,6 +67,15 @@ public class DmaapService extends BaseLoggingClass { topicMgrRole = p.getProperty("MR.TopicMgrRole", "MR.TopicMgrRole.not.set" ); dcaeTopicNs = dmaapholder.get().getTopicNsRoot(); multiSite = "true".equalsIgnoreCase(p.getProperty("MR.multisite", "true")); + noEnvironmentPrefix = p.getProperty( "AAF.NoEnvironmentPrefix", "org.onap"); + + logger.info( "DmaapService settings: " + + " topicFactory=" + topicFactory + + " topicMgrRole=" + topicMgrRole + + " dcaeTopicNs=" + dcaeTopicNs + + " multisite=" + multiSite + + " noEnvironmentPrefix=" + noEnvironmentPrefix + ); } @@ -155,7 +165,15 @@ public class DmaapService extends BaseLoggingClass { } public String getTopicPerm( String val ) { Dmaap dmaap = dmaapholder.get(); - return dmaap.getTopicNsRoot() + "." + val + ".mr.topic"; + String nsRoot = dmaap.getTopicNsRoot(); + String t; + // in ONAP Casablanca, we assume no distinction of environments reflected in topic namespace + if ( nsRoot.startsWith(noEnvironmentPrefix) ) { + t = nsRoot + ".mr.topic"; + } else { + t = nsRoot + "." + val + ".mr.topic"; + } + return t; } public String getBridgeAdminFqtn(){ diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java b/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java index 26def91..6e7b744 100644 --- a/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java +++ b/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java @@ -70,7 +70,9 @@ public class TopicService extends BaseLoggingClass { DmaapConfig p = (DmaapConfig)DmaapConfig.getConfig(); defaultGlobalMrHost = p.getProperty("MR.globalHost", "global.host.not.set"); centralCname = p.getProperty("MR.CentralCname"); - logger.info( "TopicService properties: CentralCname=" + centralCname + " defaultGlobarlMrHost=" + defaultGlobalMrHost ); + + logger.info( "TopicService properties: CentralCname=" + centralCname + + " defaultGlobarlMrHost=" + defaultGlobalMrHost ); } public Map<String, Topic> getTopics() { @@ -116,9 +118,11 @@ public class TopicService extends BaseLoggingClass { err.reset(); // err filled with NOT_FOUND is expected case, but don't want to litter... topic.setFqtn( nFqtn ); - + AafService aaf = new AafService(ServiceType.AAF_TopicMgr); - String t = dmaap.getTopicNsRoot() + "." + dmaap.getDmaapName() + ".mr.topic"; + + String t = dmaapSvc.getTopicPerm(); + String instance = ":topic." + topic.getFqtn(); String[] actions = { "pub", "sub", "view" }; |