[1/2] metron git commit: METRON-1277 Add match statement to Stellar language closes apache/incubator-metron#814

2017-11-30 Thread cestella
Repository: metron
Updated Branches:
  refs/heads/master f08440481 -> c749b5173


http://git-wip-us.apache.org/repos/asf/metron/blob/c749b517/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarParser.java
--
diff --git 
a/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarParser.java
 
b/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarParser.java
index 3ee2603..3bd4ad1 100644
--- 
a/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarParser.java
+++ 
b/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarParser.java
@@ -40,10 +40,10 @@ public class StellarParser extends Parser {
IN=1, LAMBDA_OP=2, DOUBLE_QUOTE=3, SINGLE_QUOTE=4, COMMA=5, 
PERIOD=6, 
AND=7, OR=8, NOT=9, TRUE=10, FALSE=11, EQ=12, NEQ=13, LT=14, 
LTE=15, GT=16, 
GTE=17, QUESTION=18, COLON=19, IF=20, THEN=21, ELSE=22, 
NULL=23, NAN=24, 
-   MINUS=25, PLUS=26, DIV=27, MUL=28, LBRACE=29, RBRACE=30, 
LBRACKET=31, 
-   RBRACKET=32, LPAREN=33, RPAREN=34, NIN=35, EXISTS=36, 
EXPONENT=37, INT_LITERAL=38, 
-   DOUBLE_LITERAL=39, FLOAT_LITERAL=40, LONG_LITERAL=41, 
IDENTIFIER=42, STRING_LITERAL=43, 
-   COMMENT=44, WS=45;
+   MATCH=25, DEFAULT=26, MATCH_ACTION=27, MINUS=28, PLUS=29, 
DIV=30, MUL=31, 
+   LBRACE=32, RBRACE=33, LBRACKET=34, RBRACKET=35, LPAREN=36, 
RPAREN=37, 
+   NIN=38, EXISTS=39, EXPONENT=40, INT_LITERAL=41, 
DOUBLE_LITERAL=42, FLOAT_LITERAL=43, 
+   LONG_LITERAL=44, IDENTIFIER=45, STRING_LITERAL=46, COMMENT=47, 
WS=48;
public static final int
RULE_transformation = 0, RULE_transformation_expr = 1, 
RULE_if_expr = 2, 
RULE_then_expr = 3, RULE_else_expr = 4, RULE_conditional_expr = 
5, RULE_logical_expr = 6, 
@@ -51,30 +51,35 @@ public class StellarParser extends Parser {
RULE_comp_operator = 11, RULE_func_args = 12, RULE_op_list = 
13, RULE_list_entity = 14, 
RULE_kv_list = 15, RULE_map_entity = 16, RULE_arithmetic_expr = 
17, RULE_arithmetic_expr_mul = 18, 
RULE_functions = 19, RULE_arithmetic_operands = 20, 
RULE_identifier_operand = 21, 
-   RULE_lambda_without_args = 22, RULE_lambda_with_args = 23, 
RULE_lambda_variables = 24, 
-   RULE_single_lambda_variable = 25, RULE_lambda_variable = 26;
+   RULE_default_operand = 22, RULE_lambda_without_args = 23, 
RULE_lambda_with_args = 24, 
+   RULE_lambda_variables = 25, RULE_single_lambda_variable = 26, 
RULE_lambda_variable = 27, 
+   RULE_match_expr = 28, RULE_match_clauses = 29, 
RULE_match_clause = 30, 
+   RULE_match_clause_action = 31, RULE_match_clause_check = 32;
public static final String[] ruleNames = {
"transformation", "transformation_expr", "if_expr", 
"then_expr", "else_expr", 
"conditional_expr", "logical_expr", "b_expr", "in_expr", 
"comparison_expr", 
"transformation_entity", "comp_operator", "func_args", 
"op_list", "list_entity", 
"kv_list", "map_entity", "arithmetic_expr", 
"arithmetic_expr_mul", "functions", 
-   "arithmetic_operands", "identifier_operand", 
"lambda_without_args", "lambda_with_args", 
-   "lambda_variables", "single_lambda_variable", "lambda_variable"
+   "arithmetic_operands", "identifier_operand", "default_operand", 
"lambda_without_args", 
+   "lambda_with_args", "lambda_variables", 
"single_lambda_variable", "lambda_variable", 
+   "match_expr", "match_clauses", "match_clause", 
"match_clause_action", 
+   "match_clause_check"
};
 
private static final String[] _LITERAL_NAMES = {
null, null, "'->'", "'\"'", "'''", "','", "'.'", null, null, 
null, null, 
null, "'=='", "'!='", "'<'", "'<='", "'>'", "'>='", "'?'", 
"':'", null, 
-   null, null, null, "'NaN'", "'-'", "'+'", "'/'", "'*'", "'{'", 
"'}'", "'['", 
-   "']'", "'('", "')'"
+   null, null, null, "'NaN'", null, null, "'=>'", "'-'", "'+'", 
"'/'", "'*'", 
+   "'{'", "'}'", "'['", "']'", "'('", "')'"
};
private static final String[] _SYMBOLIC_NAMES = {
null, "IN", "LAMBDA_OP", "DOUBLE_QUOTE", "SINGLE_QUOTE", 
"COMMA", "PERIOD", 
"AND", "OR", "NOT", "TRUE", "FALSE", "EQ", "NEQ", "LT", "LTE", 
"GT", "GTE", 
-   "QUESTION", "COLON", "IF", "THEN", "ELSE", "NULL", "NAN", 
"MINUS", "PLUS", 
-   "DIV", "MUL", "LBRACE", "RBRACE", "LBRACKET", "RBRACKET", 
"LPAREN", "RPAREN", 
-   "NIN", "EXISTS", "EXPONENT", 

[2/2] metron git commit: METRON-1277 Add match statement to Stellar language closes apache/incubator-metron#814

2017-11-30 Thread cestella
METRON-1277 Add match statement to Stellar language closes 
apache/incubator-metron#814


Project: http://git-wip-us.apache.org/repos/asf/metron/repo
Commit: http://git-wip-us.apache.org/repos/asf/metron/commit/c749b517
Tree: http://git-wip-us.apache.org/repos/asf/metron/tree/c749b517
Diff: http://git-wip-us.apache.org/repos/asf/metron/diff/c749b517

Branch: refs/heads/master
Commit: c749b51730f7fd24a900da31c3fe2072a54086bc
Parents: f084404
Author: Otto Fowler 
Authored: Thu Nov 30 15:16:18 2017 -0500
Committer: cstella 
Committed: Thu Nov 30 15:16:18 2017 -0500

--
 Upgrading.md|   13 +
 metron-stellar/stellar-common/README.md |   29 +-
 .../metron/stellar/common/generated/Stellar.g4  |   27 +
 .../stellar-common/src/main/java/Stellar.tokens |   66 +-
 .../src/main/java/StellarLexer.tokens   |   66 +-
 .../metron/stellar/common/StellarCompiler.java  |  122 ++-
 .../common/generated/StellarBaseListener.java   |   84 ++
 .../stellar/common/generated/StellarLexer.java  |  379 +++
 .../common/generated/StellarListener.java   |  180 +++-
 .../stellar/common/generated/StellarParser.java | 1007 --
 .../metron/stellar/dsl/functions/MatchTest.java |  377 +++
 11 files changed, 1736 insertions(+), 614 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/metron/blob/c749b517/Upgrading.md
--
diff --git a/Upgrading.md b/Upgrading.md
index dd68de0..c3892ce 100644
--- a/Upgrading.md
+++ b/Upgrading.md
@@ -4,6 +4,19 @@ configuration which are non-backwards compatible.
 
 ## 0.4.1 to 0.4.2
 
+### [METRON-1277: STELLAR Add Match functionality to 
language](https://issues.apache.org/jira/browse/METRON-1277)
+As we continue to evolve the Stellar language, it is possible that new keywords
+will be added to the language.  This may cause compatablity issues where these
+reserved words and symbols are used in existing scripts.
+
+Adding `match` to the Stellar lanaguage has introduced the following new
+reserved keywords and symbols:
+
+`match`, `default`, `{`, `}`, '=>'
+
+Any stellar expressions which use these keywords not in quotes will need to be
+modified.
+
 ### [METRON-1158: Build backend for grouping alerts into meta 
alerts](https://issues.apache.org/jira/browse/METRON-1158)
 In order to allow for meta alerts to be queries alongside regular alerts in 
Elasticsearch 2.x,
 it is necessary to add an additional field to the templates and mapping for 
existing sensors.

http://git-wip-us.apache.org/repos/asf/metron/blob/c749b517/metron-stellar/stellar-common/README.md
--
diff --git a/metron-stellar/stellar-common/README.md 
b/metron-stellar/stellar-common/README.md
index 5fe9ae7..e6bfc7c 100644
--- a/metron-stellar/stellar-common/README.md
+++ b/metron-stellar/stellar-common/README.md
@@ -30,6 +30,7 @@ The Stellar language supports the following:
 * Simple comparison operations `<`, `>`, `<=`, `>=`
 * Simple equality comparison operations `==`, `!=`
 * if/then/else comparisons (i.e. `if var1 < 10 then 'less than 10' else '10 or 
more'`)
+* Simple match evaluations (i.e. `match{ var1 < 10 => 'warn', var1 >= 10 => 
'critical', default => 'info'}`
 * Determining whether a field exists (via `exists`)
 * An `in` operator that works like the `in` in Python
 * The ability to have parenthesis to make order of operations explicit
@@ -41,10 +42,11 @@ The following keywords need to be single quote escaped in 
order to be used in St
 |   |   | | | |
 | :---: | :---: | :-: | :-: | :-: |
 | not   | else  | exists  | if  | then|
-| and   | or| in  | NaN | ==  |
-| !=| \<=   | \>  | \>= | \+  |
-| \-| \<| ?   | \*  | /   |
-| , |   | | | |
+| and   | or| in  | NaN | match   |
+| default   | ==| !=  | \<= | \>  | 
+| \>=   | \+| \-  | \<  | ?   | 
+| \*| / | ,   | \{  | \}  |
+| \=>   |   | | | |
 
 Using parens such as: "foo" : "\" requires escaping; "foo": "\'\\'"
 
@@ -100,6 +102,25 @@ In the core language functions, we support basic 
functional programming primitiv
 * `FILTER` - Filters a list by a predicate in the form of a lambda expression. 
 For instance `FILTER([ 'foo', 

metron git commit: METRON-1239 Drop extra dev environments (nickwallen) closes apache/metron#852

2017-11-30 Thread nickallen
Repository: metron
Updated Branches:
  refs/heads/master 5a1bb6784 -> f08440481


METRON-1239 Drop extra dev environments (nickwallen) closes apache/metron#852


Project: http://git-wip-us.apache.org/repos/asf/metron/repo
Commit: http://git-wip-us.apache.org/repos/asf/metron/commit/f0844048
Tree: http://git-wip-us.apache.org/repos/asf/metron/tree/f0844048
Diff: http://git-wip-us.apache.org/repos/asf/metron/diff/f0844048

Branch: refs/heads/master
Commit: f08440481bb95e135e59deadc6f6fd35775c66a2
Parents: 5a1bb67
Author: nickwallen 
Authored: Thu Nov 30 09:58:39 2017 -0500
Committer: nickallen 
Committed: Thu Nov 30 09:58:39 2017 -0500

--
 metron-deployment/Kerberos-manual-setup.md  |  20 +-
 metron-deployment/README.md |   9 +-
 metron-deployment/amazon-ec2/run.sh |   2 +-
 .../inventory/quick-dev-platform/group_vars/all |  89 ---
 .../inventory/quick-dev-platform/hosts  |  47 
 .../packaging/docker/ansible-docker/README.md   |   5 +-
 .../packaging/packer-build/README.md|  18 +-
 .../packer-build/quick-dev-centos-6.7.json  | 132 ---
 metron-deployment/playbooks/metron_install.yml  |  11 +-
 metron-deployment/roles/quick_dev/meta/main.yml |  19 --
 .../roles/quick_dev/tasks/main.yml  |  75 --
 metron-deployment/roles/sensor-stubs/README.md  |  10 +-
 metron-deployment/vagrant/README.md |   2 -
 .../vagrant/codelab-platform/README.md  |  65 -
 .../vagrant/codelab-platform/Vagrantfile|  94 
 .../vagrant/codelab-platform/ansible.cfg|  27 ---
 .../vagrant/codelab-platform/run.sh |  20 --
 .../codelab-platform/run_ansible_role.sh|  20 --
 .../codelab-platform/run_enrichment_role.sh |  20 --
 .../vagrant/full-dev-platform/Vagrantfile   |   2 +-
 .../vagrant/quick-dev-platform/README.md|  77 --
 .../vagrant/quick-dev-platform/Vagrantfile  |  94 
 .../vagrant/quick-dev-platform/ansible.cfg  |  27 ---
 .../quick-dev-platform/run_ansible_role.sh  |  20 --
 .../quick-dev-platform/run_enrichment_role.sh   |  20 --
 metron-interface/metron-alerts/README.md|   4 +-
 metron-interface/metron-config/README.md|   2 +-
 metron-interface/metron-rest/README.md  |  28 +--
 .../apache/metron/rest/utils/ReadMeUtils.java   | 130 --
 .../metron-rest/src/test/resources/README.vm| 236 ---
 30 files changed, 47 insertions(+), 1278 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/metron/blob/f0844048/metron-deployment/Kerberos-manual-setup.md
--
diff --git a/metron-deployment/Kerberos-manual-setup.md 
b/metron-deployment/Kerberos-manual-setup.md
index f42b7ed..5d44b2a 100644
--- a/metron-deployment/Kerberos-manual-setup.md
+++ b/metron-deployment/Kerberos-manual-setup.md
@@ -1,7 +1,7 @@
 Kerberos Setup
 ==
 
-This document provides instructions for kerberizing Metron's Vagrant-based 
development environments; "Quick Dev" and "Full Dev".  These instructions do 
not cover the Ambari MPack or sensors.  General Kerberization notes can be 
found in the metron-deployment [README.md](../README.md).
+This document provides instructions for kerberizing Metron's Vagrant-based 
development environments.  These instructions do not cover the Ambari MPack or 
sensors.  General Kerberization notes can be found in the metron-deployment 
[README.md](../README.md).
 
 * [Setup](#setup)
 * [Setup a KDC](#setup-a-kdc)
@@ -17,7 +17,7 @@ This document provides instructions for kerberizing Metron's 
Vagrant-based devel
 Setup
 -
 
-1. Deploy a Vagrant development environment; either [Full 
Dev](vagrant/full-dev-platform/README.md) or [Quick 
Dev](vagrant/quick-dev-platform/README.md).
+1. Deploy the [development environment.](vagrant/full-dev-platform/README.md).
 
 1. Export the following environment variables.  These need to be set for the 
remainder of the instructions. Replace `node1` with the appropriate hosts, if 
you are running Metron anywhere other than Vagrant.
 
@@ -73,7 +73,7 @@ Setup a KDC
 cp -f /etc/krb5.conf /var/lib/ambari-server/resources/scripts
 ```
 
-1. Ensure that the KDC can issue renewable tickets. This may be necessary on a 
real cluster, but should not be on [Full 
Dev](vagrant/full-dev-platform/README.md). 
+1. Ensure that the KDC can issue renewable tickets. This may be necessary on a 
real cluster, but should not be on [Full 
Dev](vagrant/full-dev-platform/README.md).
 
 Edit `/var/kerberos/krb5kdc/kdc.conf` and ensure the following is added to 
the `realm` section
 
@@ -93,9 +93,9 @@ Setup a KDC
 /etc/rc.d/init.d/krb5kdc start
 chkconfig krb5kdc on
 ```
-
+
 1. Start the Kerberos