aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBharath Balasubramanian <bharathb@research.att.com>2018-06-07 20:25:03 +0000
committerGerrit Code Review <gerrit@onap.org>2018-06-07 20:25:03 +0000
commit5e5d6ed9badebfbc1cc65a90e3de8dad232f9e42 (patch)
tree4be095aec105a581336c8e0fd8a0e725fbda8395
parent43dba6f628b7c97cfcfec66118b574a4a1ea8b10 (diff)
parent05585a1df490fb548f43cff120410c253745cf9a (diff)
Merge "Document Updates and Bug Fixes"
-rw-r--r--docs/architecture.rst10
-rw-r--r--docs/configuration.rst27
-rw-r--r--docs/consumedapis.rst16
-rw-r--r--docs/delivery.rst44
-rwxr-xr-xdocs/index.rst12
-rw-r--r--docs/installation.rst20
-rw-r--r--docs/logging.rst13
-rw-r--r--docs/release-notes.rst5
-rw-r--r--docs/setup.rst4
-rw-r--r--docs/single.rst2
-rw-r--r--jar/pom.xml2
-rw-r--r--jar/version.properties2
-rwxr-xr-xpom.xml5
-rw-r--r--src/main/java/org/onap/music/conductor/conditionals/MusicContional.java14
-rw-r--r--src/main/java/org/onap/music/lockingservice/MusicLockState.java7
-rwxr-xr-xsrc/main/java/org/onap/music/main/CachingUtil.java10
-rw-r--r--src/main/java/org/onap/music/main/MusicCore.java21
-rw-r--r--src/test/java/org/onap/music/unittests/TestMusicCore.java6
-rw-r--r--src/test/java/org/onap/music/unittests/TestRestMusicData.java2
-rw-r--r--version.properties2
20 files changed, 92 insertions, 132 deletions
diff --git a/docs/architecture.rst b/docs/architecture.rst
index 8daa0d3b..ae29f9e0 100644
--- a/docs/architecture.rst
+++ b/docs/architecture.rst
@@ -4,15 +4,7 @@
Architecture
============
-.. note::
- * This section is used to describe a software component from a high level
- view of capability, common usage scenarios, and interactions with other
- components required in the usage scenarios.
-
- * The architecture section is typically: provided in a platform-component
- and sdk collections; and referenced from developer and user guides.
-
- * This note must be removed after content has been added.
+` See ONAP Wiki <https://wiki.onap.org/display/DW/MUSIC-Multi-site+State+Coordination+Service>`_
Capabilities
diff --git a/docs/configuration.rst b/docs/configuration.rst
index 085f9c66..609b33e0 100644
--- a/docs/configuration.rst
+++ b/docs/configuration.rst
@@ -4,24 +4,25 @@
Configuration
=============
-.. note::
- * This section is used to describe the options a software component offers for configuration.
+See the following pages for Configuration Information:
- * Configuration is typically: provided for platform-component and sdk projects;
- and referenced in developer and user guides.
-
- * This note must be removed after content has been added.
+.. toctree::
+ :maxdepth: 1
+ Single-Site Install <single>
+ Muili-Site Install <multi>
+ Authentication <authentication>
-Example ...
-You can provide the following in ``basic.conf``
+.. Example ...
-``host=ADDRESS``
- The address of the host
+.. You can provide the following in ``basic.conf``
-``port=PORT``
- The port used for signaling
+.. ``host=ADDRESS``
+.. The address of the host
- Optional. Default: ``8080``
+.. ``port=PORT``
+.. The port used for signaling
+
+.. Optional. Default: ``8080``
diff --git a/docs/consumedapis.rst b/docs/consumedapis.rst
deleted file mode 100644
index c2af4c20..00000000
--- a/docs/consumedapis.rst
+++ /dev/null
@@ -1,16 +0,0 @@
-.. This work is licensed under a Creative Commons Attribution 4.0 International License.
-.. http://creativecommons.org/licenses/by/4.0
-
-Consumed APIs
-=============
-
-.. note::
- * This section is used to reference APIs that a software component depends on
- and uses from other sources.
-
- * Consumed APIs should be a specific link to the offered APIs from another component
- or external source.
-
- * This note must be removed after content has been added.
-
-
diff --git a/docs/delivery.rst b/docs/delivery.rst
deleted file mode 100644
index f3f083a7..00000000
--- a/docs/delivery.rst
+++ /dev/null
@@ -1,44 +0,0 @@
-.. This work is licensed under a Creative Commons Attribution 4.0 International License.
-.. http://creativecommons.org/licenses/by/4.0
-
-Delivery
-========
-
-.. note::
- * This section is used to describe a software component packaging.
- For a run-time component this might be executable images, containers, etc.
- For an SDK this might be libraries.
-
- * This section is typically provided for a platform-component and sdk;
- and referenced in developer and user guides
-
- * This note must be removed after content has been added.
-
-Example use of a block diagram.
-
-.. blockdiag::
-
-
- blockdiag layers {
- orientation = portrait
- a -> m;
- b -> n;
- c -> x;
- m -> y;
- m -> z;
- group l1 {
- color = blue;
- x; y; z;
- }
- group l2 {
- color = yellow;
- m; n;
- }
- group l3 {
- color = orange;
- a; b; c;
- }
-
- }
-
-
diff --git a/docs/index.rst b/docs/index.rst
index 3ef97755..437a50d8 100755
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -8,17 +8,17 @@ Music Developer Documentation
.. toctree::
:maxdepth: 1
- Single-SIte Install <single>
- Muili-Site Install <multi>
+ installation
setup
release-notes
-
+ architecture
+ logging
+ configuration
+
.. architecture
-.. configuration
.. consumedapis
.. delivery
.. index
-.. installation
-.. logging
+..
.. offeredapis
diff --git a/docs/installation.rst b/docs/installation.rst
index be64a63b..0f591eb7 100644
--- a/docs/installation.rst
+++ b/docs/installation.rst
@@ -4,17 +4,17 @@
Installation
============
-.. note::
- * This section is used to describe how a software component is acquired and installed.
-
- * This section is typically: provided for a platform-component and application; and
- referenced in user guides.
- * This note must be removed after content has been added.
+.. toctree::
+ :maxdepth: 1
-Environment
------------
+ Single-Site Install <single>
+ Muili-Site Install <multi>
-Steps
------
+.. Environment
+.. -----------
+
+
+.. Steps
+.. -----
diff --git a/docs/logging.rst b/docs/logging.rst
index 39eabfba..b1d3a186 100644
--- a/docs/logging.rst
+++ b/docs/logging.rst
@@ -4,14 +4,8 @@
Logging
=======
-.. note::
- * This section is used to describe the informational or diagnostic messages emitted from
- a software component and the methods or collecting them.
-
- * This section is typically: provided for a platform-component and sdk; and
- referenced in developer and user guides
-
- * This note must be removed after content has been added.
+Log file produced will be in /opt/app/music/logs/MUSIC/music.log,error.log,debug.log
+Log files are in EELF format.
Where to Access Information
@@ -20,3 +14,6 @@ Where to Access Information
Error / Warning Messages
------------------------
+
+
+
diff --git a/docs/release-notes.rst b/docs/release-notes.rst
index aead6632..766fb123 100644
--- a/docs/release-notes.rst
+++ b/docs/release-notes.rst
@@ -13,6 +13,11 @@ Version: 2.5.4
**New Features**
+MUSIC provides a service with recipes that individual ONAP components and microservice can use for
+ - state replication across multiple geo-distributed sites
+ - flexible fine-grained consistency management of state
+ - policy driven state-ownership across replicas of the service
+
**Bug Fixes**
diff --git a/docs/setup.rst b/docs/setup.rst
index 208c779b..8406361f 100644
--- a/docs/setup.rst
+++ b/docs/setup.rst
@@ -6,7 +6,7 @@ Setup for Developing MUSIC
Single-Site Install <single>
Muili-Site Install <multi>
- Authentication
+ Authentication <authentication>
MUSIC is to be installed in a single Dir on a vm.
@@ -47,4 +47,4 @@ Continue by selecting the link to the setup you are doing.
Single-Site Install <single>
Muili-Site Install <multi>
- Authentication
+ Authentication <authentication>
diff --git a/docs/single.rst b/docs/single.rst
index 08c5e315..060f02b4 100644
--- a/docs/single.rst
+++ b/docs/single.rst
@@ -15,7 +15,7 @@ Instructions
- Ensure you have OpenJDK 8 on your machine.
- Download Apache Cassandra 3.0, install into /opt/app/music and follow these instructions http://cassandra.apache.org/doc/latest/getting_started/installing.html till and including Step
- By the end of this you should have Cassandra working.
-- Download Apache Zookeeper 3.4.6, install into /opt/app/music and follow these instructions https://zookeeper.apache.org/doc/trunk/zookeeperStarted.html pertaining to the standalone operation. By the end of this you should have Zookeeper working.
+- Download Apache Zookeeper 3.4.6, install into /opt/app/music and follow these instructions https://zookeeper.apache.org/doc/r3.4.6/zookeeperStarted.html pertaining to the standalone operation. By the end of this you should have Zookeeper working.
- Download the Version 8.5 Apache Tomcat and install it using these instructions https://tomcat.apache.org/download-80.cgi (this is for version 8.5).
- Create a music.properties file and place it in /opt/app/music/etc/. Here is a sample of the file:
diff --git a/jar/pom.xml b/jar/pom.xml
index 91652832..ccd23679 100644
--- a/jar/pom.xml
+++ b/jar/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.onap.music</groupId>
<artifactId>MUSIC</artifactId>
<packaging>jar</packaging>
- <version>2.5.11</version>
+ <version>2.5.6</version>
<description>
This is the MUSIC REST interface, packaged as a war file.
</description>
diff --git a/jar/version.properties b/jar/version.properties
index d80599bb..2ffa6347 100644
--- a/jar/version.properties
+++ b/jar/version.properties
@@ -4,7 +4,7 @@
major=2
minor=5
-patch=11
+patch=6
base_version=${major}.${minor}.${patch}
diff --git a/pom.xml b/pom.xml
index be207fec..b3e0ebb7 100755
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.onap.music</groupId>
<artifactId>MUSIC</artifactId>
<packaging>war</packaging>
- <version>2.5.11</version>
+ <version>2.5.14</version>
<description>
This is the MUSIC REST interface, packaged as a war file.
</description>
@@ -114,6 +114,9 @@
<configuration>
<source>1.7</source>
<target>1.7</target>
+ <excludes>
+ <exclude>jar/**</exclude>
+ </excludes>
</configuration>
</plugin>
<plugin>
diff --git a/src/main/java/org/onap/music/conductor/conditionals/MusicContional.java b/src/main/java/org/onap/music/conductor/conditionals/MusicContional.java
index 93e34721..492f7c62 100644
--- a/src/main/java/org/onap/music/conductor/conditionals/MusicContional.java
+++ b/src/main/java/org/onap/music/conductor/conditionals/MusicContional.java
@@ -95,7 +95,7 @@ public class MusicContional {
if (lockAcqResult.getResult().equals(ResultType.SUCCESS)) {
ReturnType criticalPutResult = conditionalInsertAtomic(lockId, keyspace, tablename, primaryKey,
queryBank);
- MusicCore.destroyLockRef(lockId);
+ MusicCore.releaseLock(lockId, true);
if (criticalPutResult.getMessage().contains("insert"))
criticalPutResult
.setMessage("Insert values: ");
@@ -105,11 +105,11 @@ public class MusicContional {
return criticalPutResult;
} else {
- MusicCore.destroyLockRef(lockId);
+ MusicCore.releaseLock(lockId, true);
return lockAcqResult;
}
} catch (Exception e) {
- MusicCore.destroyLockRef(lockId);
+ MusicCore.releaseLock(lockId, true);
return new ReturnType(ResultType.FAILURE, e.getMessage());
}
@@ -163,15 +163,17 @@ public class MusicContional {
try {
if (lockAcqResult.getResult().equals(ResultType.SUCCESS)) {
- return updateAtomic(lockId, keyspace, tableName, primaryKey,primaryKeyValue, queryBank,planId,cascadeColumnValues,cascadeColumnName);
+ ReturnType updateResult= updateAtomic(lockId, keyspace, tableName, primaryKey,primaryKeyValue, queryBank,planId,cascadeColumnValues,cascadeColumnName);
+ MusicCore.releaseLock(lockId, true);
+ return updateResult;
} else {
- MusicCore.destroyLockRef(lockId);
+ MusicCore.releaseLock(lockId, true);
return lockAcqResult;
}
} catch (Exception e) {
- MusicCore.destroyLockRef(lockId);
+ MusicCore.releaseLock(lockId, true);
return new ReturnType(ResultType.FAILURE, e.getMessage());
}
diff --git a/src/main/java/org/onap/music/lockingservice/MusicLockState.java b/src/main/java/org/onap/music/lockingservice/MusicLockState.java
index 6c31410f..448a36e5 100644
--- a/src/main/java/org/onap/music/lockingservice/MusicLockState.java
+++ b/src/main/java/org/onap/music/lockingservice/MusicLockState.java
@@ -134,4 +134,11 @@ public class MusicLockState implements Serializable {
}
return (MusicLockState) o;
}
+
+ @Override
+ public String toString() {
+ // TODO Auto-generated method stub
+ return "lockStatus:"+ (lockStatus == null ? null : lockStatus.toString())+" |needToSyncQuorum:"+needToSyncQuorum+" |lockHolder:"+lockHolder
+ +" |leasePeriod:"+leasePeriod+" |leaseStartTime:"+leaseStartTime;
+ }
}
diff --git a/src/main/java/org/onap/music/main/CachingUtil.java b/src/main/java/org/onap/music/main/CachingUtil.java
index 26491302..b34721bb 100755
--- a/src/main/java/org/onap/music/main/CachingUtil.java
+++ b/src/main/java/org/onap/music/main/CachingUtil.java
@@ -133,9 +133,9 @@ public class CachingUtil implements Runnable {
String keySpace) throws Exception {
if (aafCache.get(nameSpace) != null) {
- if (keySpace != null && !musicCache.get(keySpace).equals(nameSpace)) {
+ /* if (keySpace != null && !musicCache.get(keySpace).equals(nameSpace)) {
logger.info(EELFLoggerDelegate.applicationLogger,"Create new application for the same namespace.");
- } else if (aafCache.get(nameSpace).get(userId).equals(password)) {
+ } else */if (aafCache.get(nameSpace).get(userId).equals(password)) {
logger.info(EELFLoggerDelegate.applicationLogger,"Authenticated with cache value..");
// reset invalid attempts to 0
userAttempts.put(nameSpace, 0);
@@ -167,9 +167,9 @@ public class CachingUtil implements Runnable {
if (aafRresponse) {
//TODO
//if (responseObj.getNs().get(0).getAdmin().contains(userId)) {
- //Map<String, String> map = new HashMap<>();
- //map.put(userId, password);
- //aafCache.put(nameSpace, map);
+ Map<String, String> map = new HashMap<>();
+ map.put(userId, password);
+ aafCache.put(nameSpace, map);
return true;
//}
}
diff --git a/src/main/java/org/onap/music/main/MusicCore.java b/src/main/java/org/onap/music/main/MusicCore.java
index cc147d57..661d7adc 100644
--- a/src/main/java/org/onap/music/main/MusicCore.java
+++ b/src/main/java/org/onap/music/main/MusicCore.java
@@ -294,6 +294,10 @@ public class MusicCore {
logger.info(EELFLoggerDelegate.applicationLogger,"In acquire lock: You already have the lock!");
return new ReturnType(ResultType.SUCCESS, "You already have the lock!");
}
+ if (currentMls.getLockStatus() != MusicLockState.LockStatus.UNLOCKED || currentMls.getLockHolder() != null) {
+ logger.info("In acquire lock: the previous lock has not been released yet! current mls:"+currentMls.toString());
+ return new ReturnType(ResultType.FAILURE, "The previous lock has not been released yet.");
+ }
} catch (NullPointerException e) {
logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.INVALIDLOCK+lockId,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
}
@@ -511,6 +515,14 @@ public class MusicCore {
public static void voluntaryReleaseLock(String lockId) throws MusicLockingException{
try {
getLockingServiceHandle().unlockAndDeleteId(lockId);
+ String lockName = getLockNameFromId(lockId);
+ String lockHolder = null;
+ MusicLockState mls = new MusicLockState(MusicLockState.LockStatus.UNLOCKED, lockHolder);
+ try {
+ getLockingServiceHandle().setLockState(lockName, mls);
+ } catch (MusicLockingException e) {
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.RELEASELOCK+lockId ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ }
} catch (KeeperException.NoNodeException e) {
// ??? No way
}
@@ -641,6 +653,7 @@ public class MusicCore {
try {
MusicLockState mls = getLockingServiceHandle()
.getLockState(keyspaceName + "." + tableName + "." + primaryKey);
+ logger.info("Got MusicLockState object... :"+mls.toString());
if (mls.getLockHolder().equals(lockId) == true) {
if (conditionInfo != null)
try {
@@ -762,7 +775,7 @@ public class MusicCore {
ReturnType criticalPutResult = criticalPut(keyspaceName, tableName, primaryKey,
queryObject, lockId, conditionInfo);
long criticalPutTime = System.currentTimeMillis();
- voluntaryReleaseLock(lockId);
+ releaseLock(lockId, true);
long lockDeleteTime = System.currentTimeMillis();
String timingInfo = "|lock creation time:" + (lockCreationTime - start)
+ "|lock accquire time:" + (lockAcqTime - lockCreationTime)
@@ -772,7 +785,7 @@ public class MusicCore {
return criticalPutResult;
} else {
logger.info(EELFLoggerDelegate.applicationLogger,"unable to acquire lock, id " + lockId);
- destroyLockRef(lockId);
+ releaseLock(lockId, true);;
return lockAcqResult;
}
}
@@ -842,10 +855,10 @@ public class MusicCore {
logger.info(EELFLoggerDelegate.applicationLogger,"acquired lock with id " + lockId);
ResultSet result =
criticalGet(keyspaceName, tableName, primaryKey, queryObject, lockId);
- voluntaryReleaseLock(lockId);
+ releaseLock(lockId, true);
return result;
} else {
- destroyLockRef(lockId);
+ releaseLock(lockId, true);
logger.info(EELFLoggerDelegate.applicationLogger,"unable to acquire lock, id " + lockId);
return null;
}
diff --git a/src/test/java/org/onap/music/unittests/TestMusicCore.java b/src/test/java/org/onap/music/unittests/TestMusicCore.java
index e798aaf1..d1da3195 100644
--- a/src/test/java/org/onap/music/unittests/TestMusicCore.java
+++ b/src/test/java/org/onap/music/unittests/TestMusicCore.java
@@ -136,11 +136,11 @@ public class TestMusicCore {
@Test
public void testAcquireLockifisMyTurnTrueandIsTableOrKeySpaceLockFalseandDontHaveLock() throws MusicLockingException {
MusicLockState musicLockState = new MusicLockState(LockStatus.LOCKED, "id2");
- Mockito.when(mLockHandle.isMyTurn("id1")).thenReturn(true);
+ Mockito.when(mLockHandle.isMyTurn("id2")).thenReturn(true);
Mockito.when(mLockHandle.getLockState("ks1.tn1.pk1")).thenReturn(musicLockState);
- ReturnType lock = MusicCore.acquireLock("ks1.tn1.pk1", "id1");
+ ReturnType lock = MusicCore.acquireLock("ks1.tn1.pk1", "id2");
assertEquals(lock.getResult(), ResultType.SUCCESS);
- Mockito.verify(mLockHandle).isMyTurn("id1");
+ Mockito.verify(mLockHandle).isMyTurn("id2");
Mockito.verify(mLockHandle).getLockState("ks1.tn1.pk1");
}
diff --git a/src/test/java/org/onap/music/unittests/TestRestMusicData.java b/src/test/java/org/onap/music/unittests/TestRestMusicData.java
index b9fd058a..4234c88e 100644
--- a/src/test/java/org/onap/music/unittests/TestRestMusicData.java
+++ b/src/test/java/org/onap/music/unittests/TestRestMusicData.java
@@ -470,7 +470,7 @@ public class TestRestMusicData {
JsonDelete jsonDelete = new JsonDelete();
Map<String, String> consistencyInfo = new HashMap<>();
MultivaluedMap<String, String> row = new MultivaluedMapImpl();
- consistencyInfo.put("type", "atomic");
+ consistencyInfo.put("type", "eventual");
jsonDelete.setConsistencyInfo(consistencyInfo);
Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Mockito.when(info.getQueryParameters()).thenReturn(row);
diff --git a/version.properties b/version.properties
index d80599bb..3f9e0c66 100644
--- a/version.properties
+++ b/version.properties
@@ -4,7 +4,7 @@
major=2
minor=5
-patch=11
+patch=14
base_version=${major}.${minor}.${patch}