Merge "Fix license issues in dmaap mr"
authorvarun gudisena <vg411h@att.com>
Wed, 11 Oct 2017 02:51:21 +0000 (02:51 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 11 Oct 2017 02:51:21 +0000 (02:51 +0000)
docs/Filter/Filter.rst [new file with mode: 0644]
docs/Filter/images/image1.png [new file with mode: 0644]
docs/Filter/images/image2.png [new file with mode: 0644]
docs/Installation/Installation.rst [new file with mode: 0644]
docs/Installation/docker.png [new file with mode: 0644]
docs/index.rst
docs/message-router/message router.jpg [new file with mode: 0644]
docs/message-router/message-router.rst

diff --git a/docs/Filter/Filter.rst b/docs/Filter/Filter.rst
new file mode 100644 (file)
index 0000000..b9f8d07
--- /dev/null
@@ -0,0 +1,582 @@
+Filter \r
+\r
+A filter examine an event and decides if it matches or doesn't.  Filters\r
+are mainly used in rules to decide if the processing entries should be\r
+executed on the given event. They're also used for settings, and systems\r
+like the Graph Correlator re-use Highland Park's filter mechanism to\r
+specify which alarms fit in a correlation.  Some publishers may produce\r
+topics with a lot of volume and a subscriber may want only a portion of\r
+those messages. The subscriber can certainly filter messages after\r
+receiving them, but it may be substantially more efficient to ask the\r
+API server to filter the messages before sending them to the\r
+subscriber.The standard library includes a number of simple filters. The\r
+Equals filter, for example, compares a field's value with some other\r
+value and returns true if the values match.  The standard library also\r
+includes filter classes called And, Or, and Not, so you can compose more\r
+complex filters. For example, written in the standard JSON config\r
+format: \r
+\r
++-----------------------------------------+\r
+| "filter":{                              |\r
+| "class":"And",                          |\r
+| "filters":                              |\r
+| [                                       |\r
+| { "class":"Equals", "foo":"abc" },      |\r
+| { "class":"Assigned", "field":"bar" }   |\r
+| ]                                       |\r
+| }                                       |\r
++-----------------------------------------+\r
+\r
+| This filter matches events in which the field "foo" has value "abc"\r
+  and the field "bar" is assigned to some value (as opposed to not being\r
+  present on the event). Filters are used by the consumers to filter out\r
+  data and consume only specific set of data which matches the\r
+  conditions mentioned in filter. Filters can be passed as a query\r
+  parameter by the consumer in consume request as mentioned below:\r
+  **http://localhost:8080/DMaaP/dmaaprest/events/DMaaP/consumergroup/mHOeNFY4XiWx4CBa?filter=\\{"class":"Equals",\r
+  "field":"email", "value":"test@abc.com" }** \r
+| Filters can be applied only on data in JSON format i.e. if applied,\r
+  filters will automatically ignore any non-json data.  While consuming,\r
+  request CONTENT\_TYPE is not relevant to filter.\r
+\r
+All the supported filter can be found below.\r
+\r
+`Types of\r
+Filters <https://wiki.web.att.com/display/MessageRouter/Types+of+Filters>`__\r
+\r
+| DMaaP Message Router supports all the filters which were supported by\r
+  DMaaP Message Router and are mentioned below:- \r
+| **All Alarms:**\r
+| Match all alarms. \r
+| **And:**\r
+| Create a set of filters. This filter matches when all of them matches.\r
+\r
++-------------+--------------------+------------+---------------------+\r
+| **Field**   | **Description**    | **Type**   | **Notes**           |\r
++=============+====================+============+=====================+\r
+| filters     | Combined Filters   | LIST       | A list of filters   |\r
++-------------+--------------------+------------+---------------------+\r
+|             |                    |            |                     |\r
++-------------+--------------------+------------+---------------------+\r
+\r
+| **Assigned:**\r
+| Choose a field from the event to check for assignment. This filter\r
+  matches when the field is assigned.\r
+\r
++-------------------+--------------------------------------------------------+------------+-----------------+\r
+| **Field**         | **Description**                                        | **Type**   | **Notes**       |\r
++===================+========================================================+============+=================+\r
+| field             | The field to check for on the event.                   | STRING     | A field name    |\r
++-------------------+--------------------------------------------------------+------------+-----------------+\r
+| emptyIsAssigned   | If true, an empty value is considered an assignment.   | BOOLEAN    | True or False   |\r
++-------------------+--------------------------------------------------------+------------+-----------------+\r
+\r
+| **Contains:**\r
+| Check if a search string contains another string.\r
+\r
++-------------+---------------------------------------------------+------------+--------------+\r
+| **Field**   | **Description**                                   | **Type**   | **Notes**    |\r
++=============+===================================================+============+==============+\r
+| String      | The value to search. Supports ${} notation.       | STRING     | Any string   |\r
++-------------+---------------------------------------------------+------------+--------------+\r
+| Value       | The value to search for. Supports ${} notation.   | STRING     | Any string   |\r
++-------------+---------------------------------------------------+------------+--------------+\r
+|             |                                                   |            |              |\r
++-------------+---------------------------------------------------+------------+--------------+\r
+\r
+| **EndsWith**:\r
+| Check if a search string ends with another string.\r
+\r
++-------------+---------------------------------------------------+------------+--------------+\r
+| **Field**   | **Description**                                   | **Type**   | **Notes**    |\r
++=============+===================================================+============+==============+\r
+| string      | The value to search. Supports ${} notation.       | STRING     | Any string   |\r
++-------------+---------------------------------------------------+------------+--------------+\r
+| value       | The value to search for. Supports ${} notation.   | STRING     | Any string   |\r
++-------------+---------------------------------------------------+------------+--------------+\r
+\r
+| **Equals:**\r
+| Choose a field from the event and a value to check for equality.\r
+\r
++-------------+----------------------------------------------+------------+--------------+\r
+| **Field**   | **Description**                              | **Type**   | **Notes**    |\r
++=============+==============================================+============+==============+\r
+| field       | The field to check. Supports ${} notation.   | STRING     | Any string   |\r
++-------------+----------------------------------------------+------------+--------------+\r
+| value       | The value to match. Supports ${} notation.   | STRING     | Any string   |\r
++-------------+----------------------------------------------+------------+--------------+\r
+\r
+| **FlatironObjectExists**\r
+| Matches when the given object exists in the given Flatiron instance.\r
+\r
++-------------+---------------------------------------------+------------+--------------+\r
+| **Field**   | **Description**                             | **Type**   | **Notes**    |\r
++=============+=============================================+============+==============+\r
+| oid         | The OID of the object to look for.          | STRING     | Any string   |\r
++-------------+---------------------------------------------+------------+--------------+\r
+| flatiron    | The name of the Flatiron client instance.   | STRING     | Any string   |\r
++-------------+---------------------------------------------+------------+--------------+\r
+\r
+| **IsAging**\r
+| Choose a field to test. This filter matches if the expression is\r
+  numeric.\r
+\r
++-------------+---------------------------------------------+------------+--------------+\r
+| **Field**   | **Description**                             | **Type**   | **Notes**    |\r
++=============+=============================================+============+==============+\r
+| field       | The field to test. Supports ${} notation.   | STRING     | Any string   |\r
++-------------+---------------------------------------------+------------+--------------+\r
+\r
+| **IsNumeric**\r
+| Choose a field to test. This filter matches if the expression is\r
+  numeric.\r
+\r
++-------------+---------------------------------------------+------------+--------------+\r
+| **Field**   | **Description**                             | **Type**   | **Notes**    |\r
++=============+=============================================+============+==============+\r
+| field       | The field to test. Supports ${} notation.   | STRING     | Any string   |\r
++-------------+---------------------------------------------+------------+--------------+\r
+\r
+| **MathCondition**\r
+| Choose a field from the event and a value for logical math conditions.\r
+\r
++-------------+-------------------------------------------------+------------+-----------------------------------+\r
+| **Field**   | **Description**                                 | **Type**   | **Notes**                         |\r
++=============+=================================================+============+===================================+\r
+| Field       | The field to check. Supports ${} notation.      | STRING     | Any string                        |\r
++-------------+-------------------------------------------------+------------+-----------------------------------+\r
+| Value       | The value to consider. Supports ${} notation.   | STRING     | Any string                        |\r
++-------------+-------------------------------------------------+------------+-----------------------------------+\r
+| operator    | The operation.                                  | STRING     | One of { "<=", ">=", ">", "<" }   |\r
++-------------+-------------------------------------------------+------------+-----------------------------------+\r
+|             |                                                 |            |                                   |\r
++-------------+-------------------------------------------------+------------+-----------------------------------+\r
+\r
+| **NoAlarms**\r
+| Don't match any alarms. \r
+| **Not**\r
+| Negate the configured filter.\r
+\r
++-------------+-------------------------+------------+-------------+\r
+| **Field**   | **Description**         | **Type**   | **Notes**   |\r
++=============+=========================+============+=============+\r
+| filter      | The filter to negate.   | FILTER     | A filter    |\r
++-------------+-------------------------+------------+-------------+\r
+\r
+| **NotEqual**\r
+| Choose a field from the event and a value to check for inequality.\r
+\r
++-------------+----------------------------------------------+------------+--------------+\r
+| **Field**   | **Description**                              | **Type**   | **Notes**    |\r
++=============+==============================================+============+==============+\r
+| field       | The field to check. Supports ${} notation.   | STRING     | Any string   |\r
++-------------+----------------------------------------------+------------+--------------+\r
+| value       | The value to match. Supports ${} notation.   | STRING     | Any string   |\r
++-------------+----------------------------------------------+------------+--------------+\r
+\r
+| **NotOneOf**\r
+| Match when the specified field does not have a value from the given\r
+  list.\r
+\r
++-------------+---------------------------------------------+------------+---------------------+\r
+| **Field**   | **Description**                             | **Type**   | **Notes**           |\r
++=============+=============================================+============+=====================+\r
+| field       | The field to test. Supports ${} notation.   | STRING     | Any string          |\r
++-------------+---------------------------------------------+------------+---------------------+\r
+| values      | The matching values.                        | LIST       | A list of strings   |\r
++-------------+---------------------------------------------+------------+---------------------+\r
+\r
+| **OneOf**\r
+| Match when the specified field has a value from the given list.\r
+\r
++-------------+---------------------------------------------+------------+---------------------+\r
+| **Field**   | **Description**                             | **Type**   | **Notes**           |\r
++=============+=============================================+============+=====================+\r
+| field       | The field to test. Supports ${} notation.   | STRING     | Any string          |\r
++-------------+---------------------------------------------+------------+---------------------+\r
+| values      | The matching values.                        | LIST       | A list of strings   |\r
++-------------+---------------------------------------------+------------+---------------------+\r
+\r
+| **Or**\r
+| Create a set of filters. This filter matches when any one of them\r
+  matches.\r
+\r
++-------------+--------------------+------------+---------------------+\r
+| **Field**   | **Description**    | **Type**   | **Notes**           |\r
++=============+====================+============+=====================+\r
+| filters     | Combined Filters   | LIST       | A list of filters   |\r
++-------------+--------------------+------------+---------------------+\r
+\r
+| **RegEx**\r
+| Choose a field from the event to match against the regular expression\r
+  you provide.\r
+\r
++-------------+---------------------------------------------------------+------------+--------------+\r
+| **Field**   | **Description**                                         | **Type**   | **Notes**    |\r
++=============+=========================================================+============+==============+\r
+| field       | The text to check for a match. Supports ${} notation.   | STRING     | Any string   |\r
++-------------+---------------------------------------------------------+------------+--------------+\r
+| value       | The regular expression (pattern) to match.              | STRING     | Any string   |\r
++-------------+---------------------------------------------------------+------------+--------------+\r
+\r
+| **StartsWith**\r
+| Check if a search string starts with another string.\r
+\r
++-------------+---------------------------------------------------+------------+--------------+\r
+| **Field**   | **Description**                                   | **Type**   | **Notes**    |\r
++=============+===================================================+============+==============+\r
+| string      | The value to search. Supports ${} notation.       | STRING     | Any string   |\r
++-------------+---------------------------------------------------+------------+--------------+\r
+| Value       | The value to search for. Supports ${} notation.   | STRING     | Any string   |\r
++-------------+---------------------------------------------------+------------+--------------+\r
+\r
+| **Unassigned**\r
+| Choose a field from the event to check for assignment. This filter\r
+  matches when the field is not assigned.\r
+\r
++-------------------+--------------------------------------------------------+------------+-----------------+\r
+| **Field**         | **Description**                                        | **Type**   | **Notes**       |\r
++===================+========================================================+============+=================+\r
+| field             | The field to check for on the event.                   | STRING     | A field name    |\r
++-------------------+--------------------------------------------------------+------------+-----------------+\r
+| emptyIsAssigned   | If true, an empty value is considered an assignment.   | BOOLEAN    | True or False   |\r
++-------------------+--------------------------------------------------------+------------+-----------------+\r
+\r
+| **WithinSecondsFrom**\r
+| This filter matches when the specified epoch time value is within the\r
+  given number of seconds from the baseline time value. Both time values\r
+  are assumed to be in seconds. If a value is in milliseconds, set\r
+  baselineTimeInMillis and/or eventTimeInMillis to true.\r
+\r
++------------------------+------------------------------------------------------------+------------+-----------------+\r
+| **Field**              | **Description**                                            | **Type**   | **Notes**       |\r
++========================+============================================================+============+=================+\r
+| field                  | The time value to test. Supports ${}                       | STRING     | A field name    |\r
++------------------------+------------------------------------------------------------+------------+-----------------+\r
+| eventTimeInMillis      | Whether to convert the event value from milliseconds.      | BOOLEAN    | True or False   |\r
++------------------------+------------------------------------------------------------+------------+-----------------+\r
+| seconds                | The number of seconds.                                     | NUMBER     | A number        |\r
++------------------------+------------------------------------------------------------+------------+-----------------+\r
+| baselineTimeInMillis   | Whether to convert the baseline value from milliseconds.   | BOOLEAN    | True or False   |\r
++------------------------+------------------------------------------------------------+------------+-----------------+\r
+| baseline               | The baseline time value. Supports ${}.                     | STRING     | Any string      |\r
++------------------------+------------------------------------------------------------+------------+-----------------+\r
+\r
+| **WithinTimeFromNow**\r
+| This filter matches when the named field has an epoch time value\r
+  within the given number of seconds from the current time. The event's\r
+  time value is assumed to be in seconds. If it's in milliseconds, set\r
+  eventTimeInMillis to true.\r
+\r
++---------------------+---------------------------------------------------------+------------+-----------------+\r
+| **Field**           | **Description**                                         | **Type**   | **Notes**       |\r
++=====================+=========================================================+============+=================+\r
+| field               | The field to check on the event.                        | STRING     | A field name    |\r
++---------------------+---------------------------------------------------------+------------+-----------------+\r
+| eventTimeInMillis   | Whether to convert the event value from milliseconds.   | BOOLEAN    | True or False   |\r
++---------------------+---------------------------------------------------------+------------+-----------------+\r
+| seconds             | The number of seconds.                                  | NUMBER     | A number        |\r
++---------------------+---------------------------------------------------------+------------+-----------------+\r
+\r
+**Limit:** \r
+\r
+-  Limit is the integer value and DMaaP Message Router will consumes\r
+   only that set of message which are specified in limit.\r
+\r
+| Suppose if we set limit=2, then only 2 sets of data will be consumed. \r
+| *Get \ **<<topicName>>/group/2?limit=4*** \r
+| Let us suppose if \r
+| **No of data available** = 4\r
+| **Set limit** = 6\r
+| i.e. limit>no of data\r
+| In this scenario all 4 sets of data will be consumed. \r
+\r
+-  If limit is not passed with the url then by default limit is set to\r
+   4096.\r
+\r
+| i.e. 4096 sets of data will be consumed. \r
+|  **Timeout and Long Poll:** \r
+\r
+-  Timeout is the integer value which will be treated by DMaaP Message\r
+   Router as time in millisecond.\r
+\r
\r
+\r
+-  Get\r
+\r
++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r
+| `***http://localhost/DMaaP/dmaaprest/events/<<topicName>>/group/2?timeout=20000*** <http://localhost/DMaaP/dmaaprest/events/%3c%3ctopicName%3e%3e/group/2?timeout=20000>`__   |\r
++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\r
+\r
+-  If there is no data available to be consumed, then DMaaP Message\r
+   Router will poll for the particular period of time specified in\r
+   timeout this mechanism is known as Long Poll.\r
+\r
+-  If timeout is not passed with url then DMaaP Message Router will set\r
+   the value of timeout =10000\r
+\r
+-  i.e. if no set of data are available then DMaaP Message Router will\r
+   poll for 10000 ms.\r
+\r
+***Meta:***\r
+\r
+-  Meta is a Boolean value.\r
+\r
+-  DMaaP Message Router reads the value of meta from\r
+   MRConfiguration.properties file at the time of startup.\r
+\r
+-  If the value of meta is not null and if value of meta is one of these\r
+   values true, yes, on, 1, y, checked then DMaaP Message Router will\r
+   take meta flag as true, else it will be false.\r
+\r
+-  If meta is set to true then consumer will get the value of message\r
+   offset along with message.\r
+\r
+|image1|\r
+| **Pretty**:\r
+\r
+-  Pretty is a Boolean value.\r
+\r
+-  DMaaP Message Router reads the value of pretty from\r
+   MRConfiguration.properties file at the time of startup.\r
+\r
+-  If the value of pretty is not null and if value of pretty is one of\r
+   these values true, yes, on, 1, y, checked then DMaaP Message Router\r
+   will take pretty flag as true, else it will be false.\r
+\r
+-  If pretty is set to true then different sets of messages will be\r
+   printed in next line separated by comma (,).\r
+\r
+|image2|\r
+| **Filter**\r
+| A filter examine an event and decides if it matches or doesn't. \r
+| Filters are mainly used in rules to decide if the processing entries\r
+  should be executed on the given event. They're also used for settings,\r
+  and systems like the Graph Correlator re-use Highland Park's filter\r
+  mechanism to specify which alarms fit in a correlation. \r
+| The standard library includes a number of simple filters. The Equals\r
+  filter, for example, compares a field's value with some other value\r
+  and returns true if the values match. \r
+| The standard library also includes filter classes called And, Or, and\r
+  Not, so you can compose more complex filters. For example, written in\r
+  the standard JSON config format: \r
+\r
++-----------------------------------------+\r
+| "filter":{                              |\r
+| "class":"And",                          |\r
+| "filters":                              |\r
+| [                                       |\r
+| { "class":"Equals", "foo":"abc" },      |\r
+| { "class":"Assigned", "field":"bar" }   |\r
+| ]                                       |\r
+| }                                       |\r
++-----------------------------------------+\r
+\r
+| This filter matches events in which the field "foo" has value "abc"\r
+  and the field "bar" is assigned to some value (as opposed to not being\r
+  present on the event).\r
+| Filters are used by the consumers to filter out data and consume only\r
+  specific set of data which matches the conditions mentioned in filter.\r
+| Filters can be passed as a query parameter by the consumer in consume\r
+  request as mentioned below:\r
+| **http://localhost:8080/DMaaP/dmaaprest/events/DMaaP/consumergroup/mHOeNFY4XiWx4CBa?filter=\\{"class":"Equals",\r
+  "field":"email", "value":"`test@abc.com <mailto:test@att.com>`__" }** \r
+| Filters can be applied only on data in JSON format i.e. if applied,\r
+  filters will automatically ignore any non-json data. \r
+| While consuming, request CONTENT\_TYPE is not relevant to filter.\r
+\r
+The MR API allows a subscriber pass a Highland Park filter as part of\r
+the GET request. This will filter the stream of messages sent back to\r
+the subscriber, but for this to work, there are some requirements: \r
+\r
+-  The message payload must be JSON\r
+\r
+-  Only a filter built from Highland Park's Standard Library  may be\r
+   used. (The Cambria API server doesn't have access to plugged in\r
+   filters.)\r
+\r
+-  The filter must be encoded properly in the URL path.\r
+\r
+ Server-side filtering can also be setup in the Java client as\r
+illustrated below\r
+\r
+**Filtering Consumer**\r
+\r
+You can also provide a Highland Park filter to your consumer instance,\r
+and this filter is passed on to the server in the GET request. One way\r
+to create the filter is programmatically. In your code, instantiate a\r
+filter from the Highland Park Standard Library Then create a String\r
+representation of the filter using the FilterIo.write utility. This\r
+String can then be passed to the Cambria client instance for use on the\r
+server.\r
+\r
+Remember, only Highland Park standard library filter components can be\r
+used -- no plug-ins are available in the Cambria server context.\r
+\r
+package org.onap.sa.highlandPark.integration;\r
+\r
+import java.io.IOException;\r
+\r
+import java.util.UUID;\r
+\r
+import org.onap.nsa.cambria.client.CambriaClientFactory;\r
+\r
+import org.onap.nsa.cambria.client.CambriaConsumer;\r
+\r
+import org.onap.sa.highlandPark.processor.HpEvent;\r
+\r
+import org.onap.sa.highlandPark.stdlib.filters.FilterIo;\r
+\r
+import org.onap.sa.highlandPark.stdlib.filters.OneOf;\r
+\r
+public class ExampleFilteringConsumer\r
+\r
+{\r
+\r
+public static void main ( String[] args ) throws IOException,\r
+InterruptedException\r
+\r
+{\r
+\r
+// Cambria clients take a set of 1 or more servers to use in round-robin\r
+fashion.\r
+\r
+// If a server becomes unreachable, another in the group is used.\r
+\r
+final String\r
+serverGroup="ueb01hydc.it.att.com,ueb02hydc.it.att.com,ueb03hydc.it.att.com";\r
+\r
+// choose a topic\r
+\r
+final String topic = "TEST-TOPIC";\r
+\r
+// Cambria clients can run in a cooperative group to handle high-volume\r
+topics.\r
+\r
+// Here, we create a random group name, which means this client is not\r
+re-startable.\r
+\r
+final String consumerGroup = UUID.randomUUID ().toString ();\r
+\r
+final String consumerId = "0";\r
+\r
+// Cambria clients can sit in a tight loop on the client side, using a\r
+long-poll\r
+\r
+// to wait for messages, and a limit to tell the server the most to send\r
+at a time.\r
+\r
+final int longPollMs = 30\*1000;\r
+\r
+final int limit = -1;\r
+\r
+// The Cambria server can filter the returned message stream using\r
+filters from the\r
+\r
+// Highland Park system. Here, we create a simple filter to test for the\r
+AlarmID\r
+\r
+// value being one of the Mobility power alarms.\r
+\r
+final OneOf oneOf = new OneOf ( "AlarmId", kPowerAlarms );\r
+\r
+// create the consumer\r
+\r
+final CambriaConsumer cc = CambriaClientFactory.createConsumer (\r
+serverGroup, topic,\r
+\r
+consumerGroup, consumerId, longPollMs, limit, FilterIo.write ( oneOf )\r
+);\r
+\r
+// now loop reading messages. Note that cc.fetch() will wait in its HTTP\r
+receive\r
+\r
+// method for up to 30 seconds (longPollMs) when nothing's available at\r
+the server.\r
+\r
+long count = 0;\r
+\r
+while ( true )\r
+\r
+{\r
+\r
+for ( String msg : cc.fetch () )\r
+\r
+{\r
+\r
+System.out.println ( "" + (++count) + ": " + msg );\r
+\r
+}\r
+\r
+}\r
+\r
+}\r
+\r
+private static final String[] kPowerAlarms =\r
+\r
+{\r
+\r
+"HUB COMMERCIAL POWER FAIL\_FWD",\r
+\r
+"HUB COMMERCIAL POWER FAIL",\r
+\r
+"RBS COMMERCIAL POWER FAIL - Fixed\_FWD",\r
+\r
+"RBS COMMERCIAL POWER FAIL\_FWD",\r
+\r
+"RBS COMMERCIAL POWER FAIL - No Generator\_FWD",\r
+\r
+"RBS COMMERCIAL POWER FAIL - Portable\_FWD",\r
+\r
+"RBS COMMERCIAL POWER FAIL - Shared\_FWD",\r
+\r
+"RBS COMMERCIAL POWER FAIL - Yes\_FWD",\r
+\r
+"RBS COMMERCIAL POWER FAIL - YES\_FWD",\r
+\r
+"RBS COMMERCIAL POWER FAIL - Fixed",\r
+\r
+"RBS COMMERCIAL POWER FAIL - No Generator",\r
+\r
+"RBS COMMERCIAL POWER FAIL - Portable",\r
+\r
+"RBS COMMERCIAL POWER FAIL - Shared",\r
+\r
+"RBS COMMERCIAL POWER FAIL - YES",\r
+\r
+"RBS COMMERCIAL POWER FAIL - Yes",\r
+\r
+"RBS COMMERCIAL POWER FAIL",\r
+\r
+"HUB COMMERCIAL POWER FAIL - Fixed",\r
+\r
+"HUB COMMERCIAL POWER FAIL - No Generator",\r
+\r
+"HUB COMMERCIAL POWER FAIL - Portable",\r
+\r
+"HUB COMMERCIAL POWER FAIL - Shared",\r
+\r
+"HUB COMMERCIAL POWER FAIL - Fixed\_FWD",\r
+\r
+"HUB COMMERCIAL POWER FAIL - No Generator\_FWD",\r
+\r
+"HUB COMMERCIAL POWER FAIL - Portable\_FWD",\r
+\r
+"HUB COMMERCIAL POWER FAIL - Shared\_FWD",\r
+\r
+};\r
+\r
+}\r
+\r
\r
+\r
+** Filter Builder**\r
+\r
+ MR server-side filtering allows a consumer to filter the stream of\r
+messages returned from the GET call.  The following link provide details\r
+of building some of the filter to illustrate Filter Builder.  It is not\r
+meant to cover and provide examples of every filter\r
+\r
+.. |image1| image:: images/image1.png\r
+.. |image2| image:: images/image2.png\r
+\r
diff --git a/docs/Filter/images/image1.png b/docs/Filter/images/image1.png
new file mode 100644 (file)
index 0000000..d424f15
Binary files /dev/null and b/docs/Filter/images/image1.png differ
diff --git a/docs/Filter/images/image2.png b/docs/Filter/images/image2.png
new file mode 100644 (file)
index 0000000..faddcfe
Binary files /dev/null and b/docs/Filter/images/image2.png differ
diff --git a/docs/Installation/Installation.rst b/docs/Installation/Installation.rst
new file mode 100644 (file)
index 0000000..8026928
--- /dev/null
@@ -0,0 +1,57 @@
+=================================\r
+DMAAP MESSAGE ROUTER INSTALLATION\r
+=================================\r
+This document describes how to install and access DMaaP Message Router.\r
+Message Router has 3 docker containers. Dmaap\_container,\r
+kafka\_contaienr and zookeeper\_container. Zookeeper runs on 172.18.0.3,\r
+kafka runs on 172.18.0.2 and dmaap on 172.18.0.4.\r
+\r
+1) Clone message service repo\r
+\r
+   git clone http://gerrit.onap.org/r/dmaap/messagerouter/messageservice\r
+\r
+2) copy\r
+   messageservice/bundleconfig-local/etc/appprops/MsgRtrApi.properties\r
+   to /var/tmp directory\r
+\r
+3) In /var/tmp/MsgRtrApi.properties, change value of below variables as\r
+   shown below:\r
+\r
+   config.zk.servers=172.18.0.3\r
+\r
+   kafka.metadata.broker.list=172.18.0.2:9092\r
+\r
+4) Install docker and docker-compose\r
+\r
+5) Go to messageservice/src/main/resources/docker-compose and run:\r
+\r
+   docker-compose up \96d\r
+\r
+   This should start 3 containers.\r
+\r
+6) Run \91docker ps\92. It should show 3 containers.\r
+\r
+   |image0|\r
+   \r
+   .. |image0| image:: docker.png\r
+   :width: 5.84375in\r
+   :height: 0.76042in\r
+\r
+Testing\r
+-------\r
+\r
+-  For publishing, create a sample.txt file with some content in the\r
+   directory where you will run below rest api. Run below rest api:\r
+\r
+   curl -H "Content-Type:text/plain" -X POST -d @sample.txt\r
+   http://172.18.0.4:3904/events/TestTopic1\r
+\r
+-  For subscribing, run below rest api:\r
+\r
+   curl -H "Content-Type:text/plain" -XGET\r
+   http://172.18.0.4:3904/events/TestTopic1/CG1/C1?timeout=1000\r
+\r
+   Note: You will only receive messages which have been published after\r
+   you have subscribed to a topic.\r
+\r
+\r
diff --git a/docs/Installation/docker.png b/docs/Installation/docker.png
new file mode 100644 (file)
index 0000000..ec26ef5
Binary files /dev/null and b/docs/Installation/docker.png differ
index be660db..4eda778 100644 (file)
@@ -11,5 +11,7 @@ Message Router (MR)
    :maxdepth: 2
    
    message-router/message-router
+   Installation/Installation
+   Filter/Filter
 
 
diff --git a/docs/message-router/message router.jpg b/docs/message-router/message router.jpg
new file mode 100644 (file)
index 0000000..100973d
Binary files /dev/null and b/docs/message-router/message router.jpg differ
index 4289a61..983603a 100644 (file)
@@ -1,6 +1,18 @@
 ============================================\r
 Message Router (MR) API Guide\r
 ============================================\r
+Architecture\r
+-------------\r
+\r
+In DMaaP Message Router, Restful web service is exposed to client to perform any needed action with Kafka. After getting the request it calls the Message router service layer which is created using AJSC ( AT&T Java Service Container) . AJSC finally calls Kafka services and response is sent back.\r
+\r
+|image0|\r
+\r
+.. |image0| image:: message router.jpg\r
+   :height: 600px\r
+   :width: 800px\r
+\r
+\r
 \r
 HTTP Service APIs\r
 ------------------\r
@@ -53,8 +65,8 @@ are not inspected for content.
 | Content-Type            |  Description                                                                                                   |\r
 +=========================+================================================================================================================+\r
 | text/plain              | Each line in the POST body is treated as a separate message. No partition key is specified, and therefore no   |\r
-|                                                |     order is guaranteed. This format is mainly for test, as messages are highly likely to be re-ordered when       |\r
-|                                                | delivered through the Kafka cluster.                                                                           |\r
+|                                |     order is guaranteed. This format is mainly for test, as messages are highly likely to be re-ordered when       |\r
+|                            | delivered through the Kafka cluster.                                                                           |\r
 +-------------------------+----------------------------------------------------------------------------------------------------------------+\r
 | application/json        | The payload maybe a single JSON object or a JSON array of JSON objects. Each object is handled as an individual|\r
 |                                                | message..Note that use of this format may result in equivalent but altered JSON objects sent to consumers.     | \r
@@ -100,7 +112,7 @@ Request Parameters
 | partitionKey             |                                 |  QueryParam      | String     |           | N           | String value                   |?Partitionkey=123            |\r
 +--------------------------+---------------------------------+------------------+------------+-----------+-------------+--------------------------------+-----------------------------+\r
 \r
-**NOTE:** Publishers/user should have access on the topics. The user (id) and\r
+**NOTE **: Publishers/user should have access on the topics. The user (id) and\r
 permissions details needs to be in AAF.\r
 \r
 Response Parameters\r
@@ -198,15 +210,14 @@ Subscribers
 Request URL:\r
 ============\r
 \r
-GET http(s)://{HOST:PORT}}/events/{topicname}/{consumegroup}/{consumerid}?{timeout=x}\r
+GET http(s)://{HOST:PORT}}/events/{topicname}/{consumegroup}/{consumerid}/{timeout=x}\r
 \r
 Request Parameters:\r
 ==================\r
 \r
 +-------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-------------------------------------------------+\r
 | Name        | Description                     |  Param Type      |  data type |   MaxLen     |  Req\92d      |  Format     |  Valid/Example Values                           |\r
-|                        |                                                             |                                  |            |              |             |             |                                                                                             |\r
-+-------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-------------------------------------------------+\r
++=============+=================================+==================+============+==============+=============+=============+=================================================+\r
 | Topicname   | topic name to be posted         |     Path         |   String   |        40    |     Y       | namespace.  |                                                                                            |\r
 |                        |                                                                     |                                  |            |              |             |  String     |                                                 |\r
 +-------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-------------------------------------------------+        \r
@@ -225,7 +236,7 @@ Request Parameters:
 | Password    |                                 | Header           | String     | 1            | N           |             |                                                 |\r
 +-------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-------------------------------------------------+       \r
 \r
-**NOTE1:**Subscribers /user should have access on the topics. The user () and\r
+**NOTE1**:Subscribers /user should have access on the topics. The user () and\r
 permissions details needs to be in AAF.\r
 \r
 Response Parameters:\r
@@ -246,7 +257,7 @@ Response Parameters:
 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
 | ResponseBody     | Messages consumed from topic   | Json       | Json         |                                                           |\r
 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
-|\r
+\r
 +---------------------------+------------------------------------+\r
 | Response statusCode       | Response statusMessage             |\r
 +===========================+====================================+\r
@@ -256,10 +267,10 @@ Response Parameters:
 +---------------------------+------------------------------------+\r
 | 500-599                   | the DMaaP service has a problem    |\r
 +---------------------------+------------------------------------+\r
-|\r
+\r
 +-------------------------+-----------------+----------------------------+----------------------------------------------------------------------------------------------------+\r
 | Error code              |  HTTP Code      |  Description               |Issue reason                                                                                        |\r
-+-------------------------+-----------------+----------------------------+----------------------------------------------------------------------------------------------------+\r
++=========================+=================+============================+====================================================================================================+\r
 | DMaaP\_MR\_ERR\_3008    | 413             | Request Entity too large   | Message size exceeds the batch limit <limit>.Reduce the batch size and try again                   | +-------------------------+-----------------+----------------------------+----------------------------------------------------------------------------------------------------+\r
 | DMaaP\_MR\_ERR\_3009    | 500             | Internal Server Error      | Unable to publish messages. Please contact administartor                                           | +-------------------------+-----------------+----------------------------+----------------------------------------------------------------------------------------------------+\r
 | DMaaP\_MR\_ERR\_3010    | 400             | Bad Request                | Incorrect Batching format. Please correct the batching format and try again                        | +-------------------------+-----------------+----------------------------+----------------------------------------------------------------------------------------------------+\r
@@ -294,18 +305,17 @@ Request Parameters:
 \r
 +----------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-----------------------------------+\r
 | Name           | Description                     |  Param Type      |  data type |   MaxLen     |  Req\92d      |  Format     |  Valid/Example Values             |\r
-|                           |                                                             |                              |            |              |             |             |                                                   |\r
-+----------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-----------------------------------+\r
++================+=================================+==================+============+==============+=============+=============+===================================+\r
 | Topicname      | topicname to be created in MR   |     Body         |   String   |        20    |     Y       | Json        |                com.att.dmaap.mr.metrics      |\r
 +----------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-----------------------------------+       \r
-|topicDescription|   description for topic         |      Body        |   String   |     15       | Y           |             |                                   |\r
+|topicDescription|   description for topic         |      Body        |   String   |     15       |     Y       |             |                                   |\r
 +----------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-----------------------------------+  \r
 |partitionCount  |   Kafka topic partition         |     Body         |   String   |     1        | Y           |             |                                   |\r
 +----------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-----------------------------------+ \r
 |replicationCount|   Kafka topic replication       |     Body         |   String   |     1        | Y           |             |  3 (Default -for 3 node Kafka )   |\r
 +----------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-----------------------------------+ \r
 |transaction     |to create transaction id for     |     Body         | Boolean    |              |             |             |                                   |\r
-|                               |      each message transaction       |                  |            |      1       |        N    |             |   true                            |\r
+|                |     each message transaction       |                  |            |      1       |        N    |             |   true                            |\r
 | Enabled        |                                 |                  |            |              |             |             |                                   | \r
 +----------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-----------------------------------+ \r
 |Content-Type    |   application/json              |     Header       |   String   |              |             |             |  application/json                 |\r
@@ -323,9 +333,9 @@ Request Parameters:
 \r
 +-------------------------+-----------------+--------------------------------------------------+\r
 | Error code              |  HTTP Code      |  Description                                     |\r
-+-------------------------+-----------------+--------------------------------------------------+\r
++=========================+=================+==================================================+\r
 | DMaaP\_MR\_ERR\_5001    | 500             | Failed to retrieve list of all topics            | +-------------------------+-----------------+--------------------------------------------------+\r
-| DMaaP\_MR\_ERR\_5002    | 500             | Failed to retrieve details of topic:<topicName>  |     |+-------------------------+----------------+--------------------------------------------------+\r
+| DMaaP\_MR\_ERR\_5002    | 500             | Failed to retrieve details of topic:<topicName>  |     +-------------------------+-----------------+--------------------------------------------------+\r
 | DMaaP\_MR\_ERR\_5003    | 500             |Failed to create topic:<topicName>                | +-------------------------+-----------------+--------------------------------------------------+\r
 | DMaaP\_MR\_ERR\_5004    | 500             | Failed to delete topic:<topicName>               | +-------------------------+-----------------+--------------------------------------------------+\r
 \r
@@ -337,7 +347,7 @@ Response Parameters
 +==================+================================+============+==============+===========================================================+\r
 | httpStatusCode   |                                |            |              | 200, 201 etc.                                             |\r
 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
-| mrErrorCode      | Numeric error code             |            |              |5005                                                       |\r
+| mrErrorCode      | Numeric error code             |            |              | 5005                                                       |\r
 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
 | errorMessage     |                                |            |              | SUCCESS, or error message.                                |\r
 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
@@ -354,19 +364,19 @@ Sample Request:
 +-----------------------------------------------------------------------------------+\r
 | POST   http://<hostname>:3904/topic/create                                        |\r
 |Request Body                                                                       |\r
-|{"topicName":"com.att.dmaap.mr.topicname","description":"This is a SAPTopic ",     |\r
+|{"topicName":"com.abc.dmaap.mr.topicname","description":"This is a SAPTopic ",     |\r
 | "partitionCount":"1","replicationCount":"3","transactionEnabled":"true"}          |\r
 | Content-Type: application/json                                                    |\r
 |Example:                                                                           |\r
 |curl -u XXXc@csp.abc.com:xxxxx$  -H 'Content-Type:application/json' -X POST -d     |\r
-|@topicname.txt  http://mrlocal00.dcae.proto.research.att.com:3904/topics/create    |\r
+|@topicname.txt  http://mrlocal00.dcae.proto.research.abc.com:3904/topics/create    |\r
 |{                                                                                  |\r
 |    "writerAcl": {                                                                 |\r
 |        "enabled": false,                                                          |\r
 |        "users": []                                                                |\r
 |    },                                                                             |\r
 |    "description": "This is a TestTopic",                                          |\r
-|    "name": "com.att.ecomp_test.crm.Load9",                                        |\r
+|    "name": "com.abc.ecomp_test.crm.Load9",                                        |\r
 |    "readerAcl": {                                                                 |\r
 |        "enabled": false,                                                          |\r
 |        "users": []                                                                |\r
@@ -388,7 +398,7 @@ Request Parameters
 +--------------------------+---------------------------------+------------------+------------+-----------+-------------+-----------------+-----------------------------+\r
 | Name                     | Description                     | Param Type       | Data type  | Max Len   | Req\92d       | Format          | Valid/EXample values        |\r
 +==========================+=================================+==================+============+===========+=============+=================+=============================+\r
-| Topicname                | topic name details              | Body             | String     | 20        | Y           |  Json           | com.att.dmaap.mr.metrics    |\r
+| Topicname                | topic name details              | Body             | String     | 20        | Y           |  Json           | com.abc.dmaap.mr.metrics    |\r
 +--------------------------+---------------------------------+------------------+------------+-----------+-------------+-----------------+-----------------------------+\r
 \r
 \r
@@ -398,7 +408,7 @@ Response Parameters
 +------------------+------------------------+------------+----------+---------+--------------------------+\r
 | Name             | Description            | ParamType  | datatype |Format   | Valid/Example Values     |\r
 +==================+========================+============+==========+=========+==========================+\r
-| topicname        |  topic name details    |      Body  |   String |   Json  | com.att.dmaap.mr.metrics | \r
+| topicname        |  topic name details    |      Body  |   String |   Json  | com.abc.dmaap.mr.metrics | \r
 +------------------+------------------------+------------+----------+---------+--------------------------+\r
 | description      |                        |            |   String |         |                          | \r
 +------------------+------------------------+------------+----------+---------+--------------------------+\r
@@ -430,14 +440,14 @@ Sample Request:
 |    {                                                                              |\r
 |       "txenabled": true,                                                          |\r
 |        "description": "This is a TestTopic",                                      |\r
-|      "owner": "rs857c@csp.att.com",                                               |\r
-|        "topicName": "com.att.ecomp_test.crm.Load9"                                |\r
+|      "owner": "XXXX@csp.abc.com",                                               |\r
+|        "topicName": "com.abc.ecomp_test.crm.Load9"                                |\r
 |    },                                                                             |\r
 |    {                                                                              |\r
 |        "txenabled": false,                                                        |\r
 |        "description": "",                                                         |\r
 |        "owner": "",                                                               |\r
-|        "topicName": "com.att.ecomp_test.crm.Load1"                                |\r
+|        "topicName": "com.abc.ecomp_test.crm.Load1"                                |\r
 |    },                                                                             |\r
 +-----------------------------------------------------------------------------------+\r
 \r
@@ -466,7 +476,45 @@ ex: http://<hostname>:3904/dmaap/v1/topics/com.att.dmaap.mr.testopic
 \r
 +-------------------------+---------------------------------------------+----------------------+\r
 | Error code              |    Description                              |HTTP code             |\r
-+-------------------------+---------------------------------------------+----------------------+\r
++=========================+=============================================+======================+\r
 |  DMaaP\_MR\_ERR\_5004   |  Failed to delete topic:<topicName>         |   500                |   \r
 +-------------------------+---------------------------------------------+----------------------+\r
 \r
+API Inventory\r
+------------- \r
+\r
++-----------+-------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
+|           |   API Name        |   API Method                            |   REST API Path                       |                | Comments                         |\r
++===========+===================+=========================================+=======================================+================+==================================+\r
+| Topics    | GetAll Topics List|  getTopics()                            | /topics                               | GET            |                                  |\r
+|           +-------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
+|           | Get All Topics    |                                         |                                       |                |                                  |\r
+|           |List with details  | getAllTopics()                          | /topics/listAll                       | GET            |                                  |\r
+|           +-------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
+|           | Get individual    |                                         |                                       |                |                                  |\r
+|           | Topic Details     | getTopic(String topicName)              | /topics/{topicName}                   | GET            |                                  |\r
+|           +-------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
+|           | Create Topic      | createTopic(TopicBean topicBean)        | /topics/create                        | POST           |                                  |\r
+|           +-------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
+|           | Delete Topic      | deleteTopicString topicName)            | /topics/{topicName}                   | DELETE         |  Not used in current MR version  |\r
+|           +-------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
+|           | Get Publishers for| getPublishersByTopicName                |                                       |                |                                  |\r
+|           | a Topic           | (String topicName)                      | /topics/{topicName}/producers         | GET            |  UEB Backward Compatibility      |\r
+|           +-------------------+-----------------------------------------+---------------------------------------+----------------+                                  |\r
+|           | Add a Publisher to|permitPublisherForTopic(String topicName,| /topics/{topicName}/producers/        |                |                                  |\r
+|           |write ACLon a Topic|     String producerId)                  |    {producerId}                       | PUT            |                                  |\r
+|           +-------------------+-----------------------------------------+---------------------------------------+----------------+                                  |\r
+|           | Remove a Publisher|denyPublisherForTopic(String   topicName,|/topics/{topicName}/producers/         |                |                                  | \r
+|           |from write   ACL on|String producerId)                       |{producerId}                           |   DELETE       |                                  |\r
+|           | a Topic           |                                         |                                       |                |                                  |\r
+|           +-------------------+-----------------------------------------+---------------------------------------+----------------+                                  |\r
+|           |Get Consumers for a| getConsumersByTopicName                 |  /topics/{topicName}/consumers        |       GET      |                                  |\r
+|           |  Topic            | (String topicName)                      |                                       |                |                                  |\r
+|           +-------------------+-----------------------------------------+---------------------------------------+----------------+                                  |\r
+|           | Add a Consumer to | permitConsumerForTopic(String topicName,|   /topics/{topicName}/consumers/      |      PUT       |                                  |\r
+|           |read ACL on a Topic|      String consumerId)                 |       {consumerId}                    |                |                                  |    \r
+|           +-------------------+-----------------------------------------+---------------------------------------+----------------+                                  |\r
+|           | Remove a consumer |denyPublisherForTopic(String   topicName,|/topics/{topicName}/consumers/         |                |                                  | \r
+|           |from write   ACL on|String consumerId)                       |{consumerId}                           |                |                                  |\r
+|           | a Topic           |                                         |                                       |    DELETE      |                                  |\r
++-----------+-------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r