synapse 2.166.0__py311-none-any.whl → 2.168.0__py311-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of synapse might be problematic. Click here for more details.
- synapse/axon.py +4 -10
- synapse/cortex.py +55 -12
- synapse/exc.py +1 -0
- synapse/lib/aha.py +4 -1
- synapse/lib/base.py +11 -4
- synapse/lib/cell.py +11 -2
- synapse/lib/hive.py +11 -0
- synapse/lib/layer.py +2 -0
- synapse/lib/modelrev.py +6 -0
- synapse/lib/modules.py +1 -0
- synapse/lib/node.py +4 -2
- synapse/lib/schemas.py +1 -1
- synapse/lib/stormlib/aha.py +385 -20
- synapse/lib/stormlib/easyperm.py +8 -0
- synapse/lib/stormlib/macro.py +11 -18
- synapse/lib/stormlib/stix.py +1 -1
- synapse/lib/stormtypes.py +25 -2
- synapse/lib/types.py +2 -0
- synapse/lib/version.py +2 -2
- synapse/lib/view.py +5 -3
- synapse/models/base.py +8 -0
- synapse/models/files.py +3 -0
- synapse/models/planning.py +161 -0
- synapse/telepath.py +1 -0
- synapse/tests/files/stormpkg/dotstorm/dotstorm.yaml +3 -0
- synapse/tests/test_cortex.py +40 -3
- synapse/tests/test_lib_aha.py +8 -4
- synapse/tests/test_lib_cell.py +6 -2
- synapse/tests/test_lib_grammar.py +62 -64
- synapse/tests/test_lib_httpapi.py +1 -1
- synapse/tests/test_lib_rstorm.py +4 -4
- synapse/tests/test_lib_storm.py +3 -3
- synapse/tests/test_lib_stormlib_aha.py +196 -0
- synapse/tests/test_lib_stormlib_compression.py +12 -12
- synapse/tests/test_lib_stormlib_macro.py +94 -0
- synapse/tests/test_lib_stormlib_spooled.py +1 -1
- synapse/tests/test_lib_stormtypes.py +44 -33
- synapse/tests/test_lib_trigger.py +3 -3
- synapse/tests/test_lib_view.py +50 -3
- synapse/tests/test_model_files.py +3 -0
- synapse/tests/test_model_planning.py +126 -0
- synapse/tests/test_tools_genpkg.py +26 -0
- synapse/tests/test_tools_hiveload.py +1 -0
- synapse/tests/test_tools_hivesave.py +1 -0
- synapse/tests/utils.py +22 -3
- synapse/tools/autodoc.py +1 -1
- synapse/tools/hive/load.py +3 -0
- synapse/tools/hive/save.py +3 -0
- {synapse-2.166.0.dist-info → synapse-2.168.0.dist-info}/METADATA +3 -3
- {synapse-2.166.0.dist-info → synapse-2.168.0.dist-info}/RECORD +53 -50
- {synapse-2.166.0.dist-info → synapse-2.168.0.dist-info}/LICENSE +0 -0
- {synapse-2.166.0.dist-info → synapse-2.168.0.dist-info}/WHEEL +0 -0
- {synapse-2.166.0.dist-info → synapse-2.168.0.dist-info}/top_level.txt +0 -0
|
@@ -94,7 +94,7 @@ Queries = [
|
|
|
94
94
|
'[test:str=foo :tick?=2019 ]',
|
|
95
95
|
'[test:str=a] switch $node.form() { hehe\xa0: {[+#baz]} }',
|
|
96
96
|
'[test:type10=2 :strprop=1] spin | test:type10 +$(:strprop) $foo=1 +$foo',
|
|
97
|
-
'inet:fqdn#xxx.xxxxxx.xxxx.xx for $tag in $node.tags(xxx.xxxxxx.*.xx) { <-
|
|
97
|
+
'inet:fqdn#xxx.xxxxxx.xxxx.xx for $tag in $node.tags(xxx.xxxxxx.*.xx) { <- inet:dns:a +#xx <- meta:note [ +#foo] ->inet:dns:a }',
|
|
98
98
|
' +(syn:tag~=aka.*.mal.*)',
|
|
99
99
|
'+(syn:tag^=aka or syn:tag^=cno or syn:tag^=rep)',
|
|
100
100
|
'[test:str=foo][test:int=42]',
|
|
@@ -113,7 +113,7 @@ Queries = [
|
|
|
113
113
|
'#test.bar +test:pivcomp -> *',
|
|
114
114
|
'#test.bar +test:str <+- *',
|
|
115
115
|
'#test.bar +test:str <- *',
|
|
116
|
-
'test:migr <-
|
|
116
|
+
'test:migr <- meta:note',
|
|
117
117
|
'#test.bar -#test -+> *',
|
|
118
118
|
'#test.bar -#test -> *',
|
|
119
119
|
'#test.bar -#test <+- *',
|
|
@@ -130,7 +130,7 @@ Queries = [
|
|
|
130
130
|
'.created="{created}"',
|
|
131
131
|
'.seen [ -.seen ]',
|
|
132
132
|
'.seen~="^r"',
|
|
133
|
-
"[
|
|
133
|
+
"[meta:note='*' :type=m1]",
|
|
134
134
|
'[ geo:place="*" :latlong=(-30.0,20.22) ]',
|
|
135
135
|
'[ inet:asn=200 :name=visi ]',
|
|
136
136
|
'[ inet:dns:a = ( woot.com , 12.34.56.78 ) ]',
|
|
@@ -192,11 +192,11 @@ Queries = [
|
|
|
192
192
|
'[ test:str=woot .seen=(2014,2015) ]',
|
|
193
193
|
'[ test:str=woot .seen=20 ]',
|
|
194
194
|
'[-#foo]',
|
|
195
|
-
'[
|
|
196
|
-
'[
|
|
197
|
-
'[
|
|
198
|
-
'[
|
|
199
|
-
'[
|
|
195
|
+
'[meta:seen=((test:str, foobar), (test:str, foo))]',
|
|
196
|
+
'[meta:seen=((test:comp, (2048, horton)), (test:comp, (4096, whoville)))]',
|
|
197
|
+
'[meta:seen=((test:comp, (9001, "A mean one")), (test:comp, (40000, greeneggs)))]',
|
|
198
|
+
'[meta:seen=((test:int, 16), (test:comp, (9999, greenham)))]',
|
|
199
|
+
'[meta:seen=((test:str, 123), (test:int, 123))]',
|
|
200
200
|
'[inet:dns:query=(tcp://1.2.3.4, "", 1)]',
|
|
201
201
|
'[inet:dns:query=(tcp://1.2.3.4, "foo*.haha.com", 1)]',
|
|
202
202
|
'[inet:ipv4=1.2.3.1-1.2.3.3]',
|
|
@@ -220,9 +220,8 @@ Queries = [
|
|
|
220
220
|
'[test:str=foo :tick=201808021201]',
|
|
221
221
|
'[test:str=hehe] | iden abcd | count',
|
|
222
222
|
'[test:str=hello]',
|
|
223
|
-
'
|
|
224
|
-
'
|
|
225
|
-
'edge:wentto',
|
|
223
|
+
'meta:seen +:node*range=((test:comp, (1000, green)), (test:comp, (3000, ham)))',
|
|
224
|
+
'meta:seen',
|
|
226
225
|
'file:bytes:size=4',
|
|
227
226
|
'for $fqdn in $fqdns { [ inet:fqdn=$fqdn ] }',
|
|
228
227
|
'for ($fqdn, $ipv4) in $dnsa { [ inet:dns:a=($fqdn,$ipv4) ] }',
|
|
@@ -233,10 +232,10 @@ Queries = [
|
|
|
233
232
|
'geo:place:latlong*near=(("34.118560", "-118.300370"), 50m)',
|
|
234
233
|
'geo:place:latlong*near=((0, 0), 50m)',
|
|
235
234
|
'geo:place:latlong*near=((34.1, -118.3), 10km)',
|
|
236
|
-
'geo:place=$place <-
|
|
237
|
-
'geo:place=$place <-
|
|
235
|
+
'geo:place=$place <- meta:seen <- *',
|
|
236
|
+
'geo:place=$place <- meta:seen <- ps:person',
|
|
238
237
|
'geo:place=abcd $latlong=:latlong $radius=:radius | spin | tel:mob:telem:latlong*near=($latlong, 3km)',
|
|
239
|
-
'
|
|
238
|
+
'meta:note=abcd | noderefs -d 2 --join',
|
|
240
239
|
'help',
|
|
241
240
|
'iden 2cdd997872b10a65407ad5fadfa28e0d',
|
|
242
241
|
'iden deadb33f',
|
|
@@ -291,11 +290,11 @@ Queries = [
|
|
|
291
290
|
'meta:source=8f1401de15918358d5247e21ca29a814',
|
|
292
291
|
'movetag a.b a.m',
|
|
293
292
|
'movetag hehe woot',
|
|
294
|
-
'ps:person=$pers ->
|
|
295
|
-
'ps:person=$pers ->
|
|
296
|
-
'ps:person=$pers ->
|
|
297
|
-
'ps:person=$pers ->
|
|
298
|
-
'ps:person=$pers ->
|
|
293
|
+
'ps:person=$pers -> meta:seen -> *',
|
|
294
|
+
'ps:person=$pers -> meta:seen -> geo:place',
|
|
295
|
+
'ps:person=$pers -> meta:seen +:time@=(2014,2017) -> geo:place',
|
|
296
|
+
'ps:person=$pers -> meta:seen -> *',
|
|
297
|
+
'ps:person=$pers -> meta:seen :node -> *',
|
|
299
298
|
'reindex --form-counts',
|
|
300
299
|
'sudo | [ inet:ipv4=1.2.3.4 ]',
|
|
301
300
|
'sudo | [ test:cycle0=foo :test:cycle1=bar ]',
|
|
@@ -445,12 +444,12 @@ Queries = [
|
|
|
445
444
|
'test:str=bar <- *',
|
|
446
445
|
'test:str=bar test:pivcomp=(foo,bar) [+#test.bar]',
|
|
447
446
|
'test:str=foo +#lol@=2016',
|
|
448
|
-
'test:str=foo <+-
|
|
449
|
-
'test:str=foo <-
|
|
447
|
+
'test:str=foo <+- meta:seen',
|
|
448
|
+
'test:str=foo <- meta:seen',
|
|
450
449
|
'test:str=foo | delnode',
|
|
451
|
-
'test:str=foobar -+>
|
|
452
|
-
'test:str=foobar ->
|
|
453
|
-
'test:str=foobar ->
|
|
450
|
+
'test:str=foobar -+> meta:seen',
|
|
451
|
+
'test:str=foobar -> meta:seen <+- test:str',
|
|
452
|
+
'test:str=foobar -> meta:seen <- test:str',
|
|
454
453
|
'test:str=hello [:tick="2001"]',
|
|
455
454
|
'test:str=hello [:tick="2002"]',
|
|
456
455
|
'test:str=pennywise | noderefs --join -d 9 --traverse-edge',
|
|
@@ -515,7 +514,7 @@ Queries = [
|
|
|
515
514
|
|
|
516
515
|
{[ inet:email:message:attachment=($node, "*") ] -inet:email:message [ :name=sploit.exe ]}
|
|
517
516
|
|
|
518
|
-
{[
|
|
517
|
+
{[ meta:seen=($node, ('inet:email:header', ('to', 'Visi Kensho <visi@vertex.link>'))) ]}
|
|
519
518
|
''',
|
|
520
519
|
'$x = $(1 / 3)',
|
|
521
520
|
'$x = $(1 * 3)',
|
|
@@ -687,18 +686,18 @@ Queries = [
|
|
|
687
686
|
'reverse(*$form=$valu)',
|
|
688
687
|
'test:str=foobar -> inet:dns*',
|
|
689
688
|
'test:str=foobar -> inet:dns:*',
|
|
690
|
-
'test:str=foobar -> (
|
|
691
|
-
'test:str=foobar -> (
|
|
689
|
+
'test:str=foobar -> (meta:seen, inet:dns:a)',
|
|
690
|
+
'test:str=foobar -> (meta:seen, inet:dns*)',
|
|
692
691
|
'test:str=foobar -> $foo',
|
|
693
692
|
'test:str=foobar -+> inet:dns*',
|
|
694
693
|
'test:str=foobar -+> inet:dns:*',
|
|
695
|
-
'test:str=foobar -+> (
|
|
696
|
-
'test:str=foobar -+> (
|
|
694
|
+
'test:str=foobar -+> (meta:seen, inet:dns:a)',
|
|
695
|
+
'test:str=foobar -+> (meta:seen, inet:dns*)',
|
|
697
696
|
'test:str=foobar -+> $foo',
|
|
698
697
|
'test:str=foobar -(refs)> inet:dns:*',
|
|
699
|
-
'inet:fqdn=foo.com :zone -> (
|
|
698
|
+
'inet:fqdn=foo.com :zone -> (meta:seen, inet:dns:a)',
|
|
700
699
|
'inet:fqdn=foo.com :zone -> $foo',
|
|
701
|
-
'inet:fqdn=foo.com :zone -+> (
|
|
700
|
+
'inet:fqdn=foo.com :zone -+> (meta:seen, inet:dns:a)',
|
|
702
701
|
'inet:fqdn=foo.com :zone -+> $foo',
|
|
703
702
|
'test:*#foo',
|
|
704
703
|
'test:*#foo@=2016',
|
|
@@ -809,7 +808,7 @@ _ParseResults = [
|
|
|
809
808
|
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditPropSet: [RelProp: [Const: tick], Const: ?=, Const: 2019]]',
|
|
810
809
|
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: a], SwitchCase: [FuncCall: [VarDeref: [VarValue: [Const: node], Const: form], CallArgs: [], CallKwargs: []], CaseEntry: [Const: hehe, SubQuery: [Query: [EditTagAdd: [TagName: [Const: baz]]]]]]]',
|
|
811
810
|
'Query: [EditNodeAdd: [FormName: [Const: test:type10], Const: =, Const: 2], EditPropSet: [RelProp: [Const: strprop], Const: =, Const: 1], CmdOper: [Const: spin, Const: ()], LiftProp: [Const: test:type10], FiltOper: [Const: +, DollarExpr: [RelPropValue: [Const: strprop]]], SetVarOper: [Const: foo, Const: 1], FiltOper: [Const: +, VarValue: [Const: foo]]]',
|
|
812
|
-
'Query: [LiftFormTag: [Const: inet:fqdn, TagName: [Const: xxx, Const: xxxxxx, Const: xxxx, Const: xx]], ForLoop: [Const: tag, FuncCall: [VarDeref: [VarValue: [Const: node], Const: tags], CallArgs: [Const: xxx.xxxxxx.*.xx], CallKwargs: []], SubQuery: [Query: [PivotInFrom: [Const:
|
|
811
|
+
'Query: [LiftFormTag: [Const: inet:fqdn, TagName: [Const: xxx, Const: xxxxxx, Const: xxxx, Const: xx]], ForLoop: [Const: tag, FuncCall: [VarDeref: [VarValue: [Const: node], Const: tags], CallArgs: [Const: xxx.xxxxxx.*.xx], CallKwargs: []], SubQuery: [Query: [PivotInFrom: [Const: inet:dns:a], isjoin=False, FiltOper: [Const: +, TagCond: [TagMatch: [Const: xx]]], PivotInFrom: [Const: meta:note], isjoin=False, EditTagAdd: [TagName: [Const: foo]], FormPivot: [Const: inet:dns:a], isjoin=False]]]]',
|
|
813
812
|
'Query: [FiltOper: [Const: +, AbsPropCond: [Const: syn:tag, Const: ~=, Const: aka.*.mal.*]]]',
|
|
814
813
|
'Query: [FiltOper: [Const: +, OrCond: [OrCond: [AbsPropCond: [Const: syn:tag, Const: ^=, Const: aka], AbsPropCond: [Const: syn:tag, Const: ^=, Const: cno]], AbsPropCond: [Const: syn:tag, Const: ^=, Const: rep]]]]',
|
|
815
814
|
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditNodeAdd: [FormName: [Const: test:int], Const: =, Const: 42]]',
|
|
@@ -828,7 +827,7 @@ _ParseResults = [
|
|
|
828
827
|
'Query: [LiftTag: [TagName: [Const: test, Const: bar]], FiltOper: [Const: +, HasAbsPropCond: [Const: test:pivcomp]], PivotOut: [], isjoin=False]',
|
|
829
828
|
'Query: [LiftTag: [TagName: [Const: test, Const: bar]], FiltOper: [Const: +, HasAbsPropCond: [Const: test:str]], PivotIn: [], isjoin=True]',
|
|
830
829
|
'Query: [LiftTag: [TagName: [Const: test, Const: bar]], FiltOper: [Const: +, HasAbsPropCond: [Const: test:str]], PivotIn: [], isjoin=False]',
|
|
831
|
-
'Query: [LiftProp: [Const: test:migr], PivotInFrom: [Const:
|
|
830
|
+
'Query: [LiftProp: [Const: test:migr], PivotInFrom: [Const: meta:note], isjoin=False]',
|
|
832
831
|
'Query: [LiftTag: [TagName: [Const: test, Const: bar]], FiltOper: [Const: -, TagCond: [TagMatch: [Const: test]]], PivotOut: [], isjoin=True]',
|
|
833
832
|
'Query: [LiftTag: [TagName: [Const: test, Const: bar]], FiltOper: [Const: -, TagCond: [TagMatch: [Const: test]]], PivotOut: [], isjoin=False]',
|
|
834
833
|
'Query: [LiftTag: [TagName: [Const: test, Const: bar]], FiltOper: [Const: -, TagCond: [TagMatch: [Const: test]]], PivotIn: [], isjoin=True]',
|
|
@@ -845,7 +844,7 @@ _ParseResults = [
|
|
|
845
844
|
'Query: [LiftPropBy: [Const: .created, Const: =, Const: {created}]]',
|
|
846
845
|
'Query: [LiftProp: [Const: .seen], EditUnivDel: [UnivProp: [Const: .seen]]]',
|
|
847
846
|
'Query: [LiftPropBy: [Const: .seen, Const: ~=, Const: ^r]]',
|
|
848
|
-
'Query: [EditNodeAdd: [FormName: [Const:
|
|
847
|
+
'Query: [EditNodeAdd: [FormName: [Const: meta:note], Const: =, Const: *], EditPropSet: [RelProp: [Const: type], Const: =, Const: m1]]',
|
|
849
848
|
'Query: [EditNodeAdd: [FormName: [Const: geo:place], Const: =, Const: *], EditPropSet: [RelProp: [Const: latlong], Const: =, List: [Const: -30.0, Const: 20.22]]]',
|
|
850
849
|
'Query: [EditNodeAdd: [FormName: [Const: inet:asn], Const: =, Const: 200], EditPropSet: [RelProp: [Const: name], Const: =, Const: visi]]',
|
|
851
850
|
'Query: [EditNodeAdd: [FormName: [Const: inet:dns:a], Const: =, List: [Const: woot.com, Const: 12.34.56.78]]]',
|
|
@@ -907,11 +906,11 @@ _ParseResults = [
|
|
|
907
906
|
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: woot], EditPropSet: [UnivProp: [Const: .seen], Const: =, List: [Const: 2014, Const: 2015]]]',
|
|
908
907
|
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: woot], EditPropSet: [UnivProp: [Const: .seen], Const: =, Const: 20]]',
|
|
909
908
|
'Query: [EditTagDel: [TagName: [Const: foo]]]',
|
|
910
|
-
'Query: [EditNodeAdd: [FormName: [Const:
|
|
911
|
-
'Query: [EditNodeAdd: [FormName: [Const:
|
|
912
|
-
'Query: [EditNodeAdd: [FormName: [Const:
|
|
913
|
-
'Query: [EditNodeAdd: [FormName: [Const:
|
|
914
|
-
'Query: [EditNodeAdd: [FormName: [Const:
|
|
909
|
+
'Query: [EditNodeAdd: [FormName: [Const: meta:seen], Const: =, List: [List: [Const: test:str, Const: foobar], List: [Const: test:str, Const: foo]]]]',
|
|
910
|
+
'Query: [EditNodeAdd: [FormName: [Const: meta:seen], Const: =, List: [List: [Const: test:comp, List: [Const: 2048, Const: horton]], List: [Const: test:comp, List: [Const: 4096, Const: whoville]]]]]',
|
|
911
|
+
'Query: [EditNodeAdd: [FormName: [Const: meta:seen], Const: =, List: [List: [Const: test:comp, List: [Const: 9001, Const: A mean one]], List: [Const: test:comp, List: [Const: 40000, Const: greeneggs]]]]]',
|
|
912
|
+
'Query: [EditNodeAdd: [FormName: [Const: meta:seen], Const: =, List: [List: [Const: test:int, Const: 16], List: [Const: test:comp, List: [Const: 9999, Const: greenham]]]]]',
|
|
913
|
+
'Query: [EditNodeAdd: [FormName: [Const: meta:seen], Const: =, List: [List: [Const: test:str, Const: 123], List: [Const: test:int, Const: 123]]]]',
|
|
915
914
|
'Query: [EditNodeAdd: [FormName: [Const: inet:dns:query], Const: =, List: [Const: tcp://1.2.3.4, Const: , Const: 1]]]',
|
|
916
915
|
'Query: [EditNodeAdd: [FormName: [Const: inet:dns:query], Const: =, List: [Const: tcp://1.2.3.4, Const: foo*.haha.com, Const: 1]]]',
|
|
917
916
|
'Query: [EditNodeAdd: [FormName: [Const: inet:ipv4], Const: =, Const: 1.2.3.1-1.2.3.3]]',
|
|
@@ -935,9 +934,8 @@ _ParseResults = [
|
|
|
935
934
|
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditPropSet: [RelProp: [Const: tick], Const: =, Const: 201808021201]]',
|
|
936
935
|
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: hehe], CmdOper: [Const: iden, List: [Const: abcd]], CmdOper: [Const: count, Const: ()]]',
|
|
937
936
|
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: hello]]',
|
|
938
|
-
'Query: [LiftProp: [Const:
|
|
939
|
-
'Query: [LiftProp: [Const:
|
|
940
|
-
'Query: [LiftProp: [Const: edge:wentto]]',
|
|
937
|
+
'Query: [LiftProp: [Const: meta:seen], FiltOper: [Const: +, RelPropCond: [RelPropValue: [RelProp: [Const: node]], Const: range=, List: [List: [Const: test:comp, List: [Const: 1000, Const: green]], List: [Const: test:comp, List: [Const: 3000, Const: ham]]]]]]',
|
|
938
|
+
'Query: [LiftProp: [Const: meta:seen]]',
|
|
941
939
|
'Query: [LiftPropBy: [Const: file:bytes:size, Const: =, Const: 4]]',
|
|
942
940
|
'Query: [ForLoop: [Const: fqdn, VarValue: [Const: fqdns], SubQuery: [Query: [EditNodeAdd: [FormName: [Const: inet:fqdn], Const: =, VarValue: [Const: fqdn]]]]]]',
|
|
943
941
|
"Query: [ForLoop: [VarList: ['fqdn', 'ipv4'], VarValue: [Const: dnsa], SubQuery: [Query: [EditNodeAdd: [FormName: [Const: inet:dns:a], Const: =, List: [VarValue: [Const: fqdn], VarValue: [Const: ipv4]]]]]]]",
|
|
@@ -948,10 +946,10 @@ _ParseResults = [
|
|
|
948
946
|
'Query: [LiftPropBy: [Const: geo:place:latlong, Const: near=, List: [List: [Const: 34.118560, Const: -118.300370], Const: 50m]]]',
|
|
949
947
|
'Query: [LiftPropBy: [Const: geo:place:latlong, Const: near=, List: [List: [Const: 0, Const: 0], Const: 50m]]]',
|
|
950
948
|
'Query: [LiftPropBy: [Const: geo:place:latlong, Const: near=, List: [List: [Const: 34.1, Const: -118.3], Const: 10km]]]',
|
|
951
|
-
'Query: [LiftPropBy: [Const: geo:place, Const: =, VarValue: [Const: place]], PivotInFrom: [Const:
|
|
952
|
-
'Query: [LiftPropBy: [Const: geo:place, Const: =, VarValue: [Const: place]], PivotInFrom: [Const:
|
|
949
|
+
'Query: [LiftPropBy: [Const: geo:place, Const: =, VarValue: [Const: place]], PivotInFrom: [Const: meta:seen], isjoin=False, PivotIn: [], isjoin=False]',
|
|
950
|
+
'Query: [LiftPropBy: [Const: geo:place, Const: =, VarValue: [Const: place]], PivotInFrom: [Const: meta:seen], isjoin=False, PivotInFrom: [Const: ps:person], isjoin=False]',
|
|
953
951
|
'Query: [LiftPropBy: [Const: geo:place, Const: =, Const: abcd], SetVarOper: [Const: latlong, RelPropValue: [Const: latlong]], SetVarOper: [Const: radius, RelPropValue: [Const: radius]], CmdOper: [Const: spin, Const: ()], LiftPropBy: [Const: tel:mob:telem:latlong, Const: near=, List: [VarValue: [Const: latlong], Const: 3km]]]',
|
|
954
|
-
'Query: [LiftPropBy: [Const:
|
|
952
|
+
'Query: [LiftPropBy: [Const: meta:note, Const: =, Const: abcd], CmdOper: [Const: noderefs, List: [Const: -d, Const: 2, Const: --join]]]',
|
|
955
953
|
'Query: [CmdOper: [Const: help, Const: ()]]',
|
|
956
954
|
'Query: [CmdOper: [Const: iden, List: [Const: 2cdd997872b10a65407ad5fadfa28e0d]]]',
|
|
957
955
|
'Query: [CmdOper: [Const: iden, List: [Const: deadb33f]]]',
|
|
@@ -1006,11 +1004,11 @@ _ParseResults = [
|
|
|
1006
1004
|
'Query: [LiftPropBy: [Const: meta:source, Const: =, Const: 8f1401de15918358d5247e21ca29a814]]',
|
|
1007
1005
|
'Query: [CmdOper: [Const: movetag, List: [Const: a.b, Const: a.m]]]',
|
|
1008
1006
|
'Query: [CmdOper: [Const: movetag, List: [Const: hehe, Const: woot]]]',
|
|
1009
|
-
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const:
|
|
1010
|
-
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const:
|
|
1011
|
-
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const:
|
|
1012
|
-
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const:
|
|
1013
|
-
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const:
|
|
1007
|
+
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const: meta:seen], isjoin=False, PivotOut: [], isjoin=False]',
|
|
1008
|
+
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const: meta:seen], isjoin=False, FormPivot: [Const: geo:place], isjoin=False]',
|
|
1009
|
+
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const: meta:seen], isjoin=False, FiltOper: [Const: +, RelPropCond: [RelPropValue: [RelProp: [Const: time]], Const: @=, List: [Const: 2014, Const: 2017]]], FormPivot: [Const: geo:place], isjoin=False]',
|
|
1010
|
+
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const: meta:seen], isjoin=False, PivotOut: [], isjoin=False]',
|
|
1011
|
+
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const: meta:seen], isjoin=False, PropPivotOut: [RelProp: [Const: node]], isjoin=False]',
|
|
1014
1012
|
'Query: [CmdOper: [Const: reindex, List: [Const: --form-counts]]]',
|
|
1015
1013
|
'Query: [CmdOper: [Const: sudo, Const: ()], EditNodeAdd: [FormName: [Const: inet:ipv4], Const: =, Const: 1.2.3.4]]',
|
|
1016
1014
|
'Query: [CmdOper: [Const: sudo, Const: ()], EditNodeAdd: [FormName: [Const: test:cycle0], Const: =, Const: foo], EditPropSet: [RelProp: [Const: test:cycle1], Const: =, Const: bar]]',
|
|
@@ -1160,12 +1158,12 @@ _ParseResults = [
|
|
|
1160
1158
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: bar], PivotIn: [], isjoin=False]',
|
|
1161
1159
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: bar], LiftPropBy: [Const: test:pivcomp, Const: =, List: [Const: foo, Const: bar]], EditTagAdd: [TagName: [Const: test, Const: bar]]]',
|
|
1162
1160
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foo], FiltOper: [Const: +, TagValuCond: [TagMatch: [Const: lol], Const: @=, Const: 2016]]]',
|
|
1163
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foo], PivotInFrom: [Const:
|
|
1164
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foo], PivotInFrom: [Const:
|
|
1161
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foo], PivotInFrom: [Const: meta:seen], isjoin=True]',
|
|
1162
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foo], PivotInFrom: [Const: meta:seen], isjoin=False]',
|
|
1165
1163
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foo], CmdOper: [Const: delnode, Const: ()]]',
|
|
1166
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const:
|
|
1167
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const:
|
|
1168
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const:
|
|
1164
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const: meta:seen], isjoin=True]',
|
|
1165
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const: meta:seen], isjoin=False, PivotInFrom: [Const: test:str], isjoin=True]',
|
|
1166
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const: meta:seen], isjoin=False, PivotInFrom: [Const: test:str], isjoin=False]',
|
|
1169
1167
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: hello], EditPropSet: [RelProp: [Const: tick], Const: =, Const: 2001]]',
|
|
1170
1168
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: hello], EditPropSet: [RelProp: [Const: tick], Const: =, Const: 2002]]',
|
|
1171
1169
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: pennywise], CmdOper: [Const: noderefs, List: [Const: --join, Const: -d, Const: 9, Const: --traverse-edge]]]',
|
|
@@ -1185,7 +1183,7 @@ _ParseResults = [
|
|
|
1185
1183
|
"Query: [ForLoop: [Const: foo, VarValue: [Const: foos], SubQuery: [Query: [VarListSetOper: [VarList: ['fqdn', 'ipv4'], FuncCall: [VarDeref: [VarValue: [Const: foo], Const: split], CallArgs: [Const: |], CallKwargs: []]], EditNodeAdd: [FormName: [Const: inet:dns:a], Const: =, List: [VarValue: [Const: fqdn], VarValue: [Const: ipv4]]]]]]]",
|
|
1186
1184
|
'Query: [ForLoop: [Const: tag, FuncCall: [VarDeref: [VarValue: [Const: node], Const: tags], CallArgs: [], CallKwargs: []], SubQuery: [Query: [FormPivot: [Const: test:int], isjoin=False, EditTagAdd: [TagName: [VarValue: [Const: tag]]]]]]]',
|
|
1187
1185
|
'Query: [ForLoop: [Const: tag, FuncCall: [VarDeref: [VarValue: [Const: node], Const: tags], CallArgs: [Const: fo*], CallKwargs: []], SubQuery: [Query: [FormPivot: [Const: test:int], isjoin=False, EditTagDel: [TagName: [VarValue: [Const: tag]]]]]]]',
|
|
1188
|
-
'Query: [EditNodeAdd: [FormName: [Const: inet:email:message], Const: =, Const: *], EditPropSet: [RelProp: [Const: to], Const: =, Const: woot@woot.com], EditPropSet: [RelProp: [Const: from], Const: =, Const: visi@vertex.link], EditPropSet: [RelProp: [Const: replyto], Const: =, Const: root@root.com], EditPropSet: [RelProp: [Const: subject], Const: =, Const: hi there], EditPropSet: [RelProp: [Const: date], Const: =, Const: 2015], EditPropSet: [RelProp: [Const: body], Const: =, Const: there are mad sploitz here!], EditPropSet: [RelProp: [Const: bytes], Const: =, Const: *], SubQuery: [Query: [EditNodeAdd: [FormName: [Const: inet:email:message:link], Const: =, List: [VarValue: [Const: node], Const: https://www.vertex.link]]]], SubQuery: [Query: [EditNodeAdd: [FormName: [Const: inet:email:message:attachment], Const: =, List: [VarValue: [Const: node], Const: *]], FiltOper: [Const: -, HasAbsPropCond: [Const: inet:email:message]], EditPropSet: [RelProp: [Const: name], Const: =, Const: sploit.exe]]], SubQuery: [Query: [EditNodeAdd: [FormName: [Const:
|
|
1186
|
+
'Query: [EditNodeAdd: [FormName: [Const: inet:email:message], Const: =, Const: *], EditPropSet: [RelProp: [Const: to], Const: =, Const: woot@woot.com], EditPropSet: [RelProp: [Const: from], Const: =, Const: visi@vertex.link], EditPropSet: [RelProp: [Const: replyto], Const: =, Const: root@root.com], EditPropSet: [RelProp: [Const: subject], Const: =, Const: hi there], EditPropSet: [RelProp: [Const: date], Const: =, Const: 2015], EditPropSet: [RelProp: [Const: body], Const: =, Const: there are mad sploitz here!], EditPropSet: [RelProp: [Const: bytes], Const: =, Const: *], SubQuery: [Query: [EditNodeAdd: [FormName: [Const: inet:email:message:link], Const: =, List: [VarValue: [Const: node], Const: https://www.vertex.link]]]], SubQuery: [Query: [EditNodeAdd: [FormName: [Const: inet:email:message:attachment], Const: =, List: [VarValue: [Const: node], Const: *]], FiltOper: [Const: -, HasAbsPropCond: [Const: inet:email:message]], EditPropSet: [RelProp: [Const: name], Const: =, Const: sploit.exe]]], SubQuery: [Query: [EditNodeAdd: [FormName: [Const: meta:seen], Const: =, List: [VarValue: [Const: node], List: [Const: inet:email:header, List: [Const: to, Const: Visi Kensho <visi@vertex.link>]]]]]]]',
|
|
1189
1187
|
'Query: [SetVarOper: [Const: x, DollarExpr: [ExprNode: [Const: 1, Const: /, Const: 3]]]]',
|
|
1190
1188
|
'Query: [SetVarOper: [Const: x, DollarExpr: [ExprNode: [Const: 1, Const: *, Const: 3]]]]',
|
|
1191
1189
|
'Query: [SetVarOper: [Const: x, DollarExpr: [ExprNode: [ExprNode: [Const: 1, Const: *, Const: 3], Const: +, Const: 2]]]]',
|
|
@@ -1313,18 +1311,18 @@ _ParseResults = [
|
|
|
1313
1311
|
'Query: [LiftPropBy: [VarValue: [Const: form], Const: =, VarValue: [Const: valu]]]',
|
|
1314
1312
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const: inet:dns*], isjoin=False]',
|
|
1315
1313
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const: inet:dns:*], isjoin=False]',
|
|
1316
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [List: [Const:
|
|
1317
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [List: [Const:
|
|
1314
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [List: [Const: meta:seen, Const: inet:dns:a]], isjoin=False]',
|
|
1315
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [List: [Const: meta:seen, Const: inet:dns*]], isjoin=False]',
|
|
1318
1316
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [VarValue: [Const: foo]], isjoin=False]',
|
|
1319
1317
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const: inet:dns*], isjoin=True]',
|
|
1320
1318
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const: inet:dns:*], isjoin=True]',
|
|
1321
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [List: [Const:
|
|
1322
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [List: [Const:
|
|
1319
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [List: [Const: meta:seen, Const: inet:dns:a]], isjoin=True]',
|
|
1320
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [List: [Const: meta:seen, Const: inet:dns*]], isjoin=True]',
|
|
1323
1321
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [VarValue: [Const: foo]], isjoin=True]',
|
|
1324
1322
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], N1Walk: [Const: refs, Const: inet:dns:*], isjoin=False]',
|
|
1325
|
-
'Query: [LiftPropBy: [Const: inet:fqdn, Const: =, Const: foo.com], PropPivot: [RelPropValue: [RelProp: [Const: zone]], List: [Const:
|
|
1323
|
+
'Query: [LiftPropBy: [Const: inet:fqdn, Const: =, Const: foo.com], PropPivot: [RelPropValue: [RelProp: [Const: zone]], List: [Const: meta:seen, Const: inet:dns:a]], isjoin=False]',
|
|
1326
1324
|
'Query: [LiftPropBy: [Const: inet:fqdn, Const: =, Const: foo.com], PropPivot: [RelPropValue: [RelProp: [Const: zone]], VarValue: [Const: foo]], isjoin=False]',
|
|
1327
|
-
'Query: [LiftPropBy: [Const: inet:fqdn, Const: =, Const: foo.com], PropPivot: [RelPropValue: [RelProp: [Const: zone]], List: [Const:
|
|
1325
|
+
'Query: [LiftPropBy: [Const: inet:fqdn, Const: =, Const: foo.com], PropPivot: [RelPropValue: [RelProp: [Const: zone]], List: [Const: meta:seen, Const: inet:dns:a]], isjoin=True]',
|
|
1328
1326
|
'Query: [LiftPropBy: [Const: inet:fqdn, Const: =, Const: foo.com], PropPivot: [RelPropValue: [RelProp: [Const: zone]], VarValue: [Const: foo]], isjoin=True]',
|
|
1329
1327
|
'Query: [LiftFormTag: [Const: test:*, TagName: [Const: foo]]]',
|
|
1330
1328
|
'Query: [LiftFormTag: [Const: test:*, TagName: [Const: foo], Const: @=, Const: 2016]]',
|
|
@@ -1385,13 +1383,13 @@ class GrammarTest(s_t_utils.SynTest):
|
|
|
1385
1383
|
self.eq(str(tree), _ParseResults[i])
|
|
1386
1384
|
|
|
1387
1385
|
def test_cmdrargs(self):
|
|
1388
|
-
q = '''add {inet:fqdn | graph 2 --filter { -#nope } } inet:f-M +1 { [
|
|
1386
|
+
q = '''add {inet:fqdn | graph 2 --filter { -#nope } } inet:f-M +1 { [ meta:note='*' :type=m1]}'''
|
|
1389
1387
|
correct = (
|
|
1390
1388
|
'add',
|
|
1391
1389
|
'inet:fqdn | graph 2 --filter { -#nope }',
|
|
1392
1390
|
'inet:f-M',
|
|
1393
1391
|
'+1',
|
|
1394
|
-
"[
|
|
1392
|
+
"[ meta:note='*' :type=m1]"
|
|
1395
1393
|
)
|
|
1396
1394
|
parser = s_parser.Parser(q)
|
|
1397
1395
|
args = parser.cmdrargs()
|
|
@@ -902,7 +902,7 @@ class HttpApiTest(s_tests.SynTest):
|
|
|
902
902
|
self.eq(info['creator'], root.iden)
|
|
903
903
|
self.eq(info['iden'], view)
|
|
904
904
|
|
|
905
|
-
cdef = await core.callStorm('return($lib.cron.add(query="{
|
|
905
|
+
cdef = await core.callStorm('return($lib.cron.add(query="{meta:note=*}", hourly=30).pack())')
|
|
906
906
|
layr = await core.callStorm('return($lib.layer.add().iden)')
|
|
907
907
|
|
|
908
908
|
opts = {'vars': {'view': view, 'cron': cdef['iden'], 'layr': layr}}
|
synapse/tests/test_lib_rstorm.py
CHANGED
|
@@ -206,7 +206,7 @@ multiline00_input = '''
|
|
|
206
206
|
A multiline secondary property.
|
|
207
207
|
.. storm-cortex:: default
|
|
208
208
|
.. storm-opts:: {"vars": {"name": "Node\\nWith a\\nweird name"}}
|
|
209
|
-
.. storm:: [
|
|
209
|
+
.. storm:: [meta:note=(n1,) :text=$name]
|
|
210
210
|
Bye!
|
|
211
211
|
'''
|
|
212
212
|
|
|
@@ -214,9 +214,9 @@ multiline00_output = '''
|
|
|
214
214
|
A multiline secondary property.
|
|
215
215
|
::
|
|
216
216
|
|
|
217
|
-
> [
|
|
218
|
-
|
|
219
|
-
:
|
|
217
|
+
> [meta:note=(n1,) :text=$name]
|
|
218
|
+
meta:note=85d3511b97098d7fd9e07be21f6390de
|
|
219
|
+
:text = Node
|
|
220
220
|
With a
|
|
221
221
|
weird name
|
|
222
222
|
|
synapse/tests/test_lib_storm.py
CHANGED
|
@@ -2505,9 +2505,9 @@ class StormTest(s_t_utils.SynTest):
|
|
|
2505
2505
|
nodes = await core.nodes('test:comp $valu=({"foo": :hehe}) | uniq $valu')
|
|
2506
2506
|
self.len(1, nodes)
|
|
2507
2507
|
q = '''
|
|
2508
|
-
[(
|
|
2509
|
-
(
|
|
2510
|
-
(
|
|
2508
|
+
[(tel:mob:telem=(n1,) :data=(({'hehe': 'haha', 'foo': 'bar'}),))
|
|
2509
|
+
(tel:mob:telem=(n2,) :data=(({'hehe': 'haha', 'foo': 'baz'}),))
|
|
2510
|
+
(tel:mob:telem=(n3,) :data=(({'foo': 'bar', 'hehe': 'haha'}),))]
|
|
2511
2511
|
uniq :data
|
|
2512
2512
|
'''
|
|
2513
2513
|
nodes = await core.nodes(q)
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import synapse.exc as s_exc
|
|
2
|
+
import synapse.common as s_common
|
|
3
|
+
import synapse.cortex as s_cortex
|
|
4
|
+
|
|
5
|
+
import synapse.lib.cell as s_cell
|
|
6
|
+
|
|
7
|
+
import synapse.tests.utils as s_test
|
|
8
|
+
|
|
9
|
+
class AhaLibTest(s_test.SynTest):
|
|
10
|
+
|
|
11
|
+
async def test_stormlib_aha_basics(self):
|
|
12
|
+
|
|
13
|
+
async with self.getTestAhaProv() as aha:
|
|
14
|
+
|
|
15
|
+
with self.getTestDir() as dirn:
|
|
16
|
+
|
|
17
|
+
dirn00 = s_common.genpath(dirn, 'cell00')
|
|
18
|
+
dirn01 = s_common.genpath(dirn, 'cell01')
|
|
19
|
+
dirn02 = s_common.genpath(dirn, 'cell02')
|
|
20
|
+
dirn03 = s_common.genpath(dirn, 'cell03')
|
|
21
|
+
|
|
22
|
+
replay = s_common.envbool('SYNDEV_NEXUS_REPLAY')
|
|
23
|
+
nevents = 10 if replay else 5
|
|
24
|
+
|
|
25
|
+
waiter = aha.waiter(nevents, 'aha:svcadd')
|
|
26
|
+
|
|
27
|
+
cell00 = await aha.enter_context(self.addSvcToAha(aha, '00.cell', s_cell.Cell, dirn=dirn00))
|
|
28
|
+
cell01 = await aha.enter_context(self.addSvcToAha(aha, '01.cell', s_cell.Cell, dirn=dirn01,
|
|
29
|
+
provinfo={'mirror': 'cell'}))
|
|
30
|
+
cell02 = await aha.enter_context(self.addSvcToAha(aha, 'mysvc', s_cell.Cell, dirn=dirn02))
|
|
31
|
+
core00 = await aha.enter_context(self.addSvcToAha(aha, 'core', s_cortex.Cortex, dirn=dirn03))
|
|
32
|
+
|
|
33
|
+
self.len(nevents, await waiter.wait(timeout=12))
|
|
34
|
+
|
|
35
|
+
svcs = await core00.callStorm('$l=() for $i in $lib.aha.list() { $l.append($i) } fini { return ($l) }')
|
|
36
|
+
self.len(5, svcs)
|
|
37
|
+
|
|
38
|
+
svc = await core00.callStorm('return( $lib.aha.get(core...) )')
|
|
39
|
+
self.eq('core.loop.vertex.link', svc.get('name'))
|
|
40
|
+
svc = await core00.callStorm('return( $lib.aha.get(core.loop.vertex.link))')
|
|
41
|
+
self.eq('core.loop.vertex.link', svc.get('name'))
|
|
42
|
+
svc = await core00.callStorm('return( $lib.aha.get(00.cell...))')
|
|
43
|
+
self.eq('00.cell.loop.vertex.link', svc.get('name'))
|
|
44
|
+
svc = await core00.callStorm('return( $lib.aha.get(cell...))')
|
|
45
|
+
self.eq('cell.loop.vertex.link', svc.get('name'))
|
|
46
|
+
svc = await core00.callStorm('$f=({"mirror": (true)}) return( $lib.aha.get(cell..., filters=$f))')
|
|
47
|
+
self.eq('01.cell.loop.vertex.link', svc.get('name'))
|
|
48
|
+
|
|
49
|
+
# List the aha services available
|
|
50
|
+
msgs = await core00.stormlist('aha.svc.list --nexus')
|
|
51
|
+
self.stormIsInPrint('Nexus', msgs)
|
|
52
|
+
self.stormIsInPrint('00.cell.loop.vertex.link true true true', msgs)
|
|
53
|
+
self.stormIsInPrint('01.cell.loop.vertex.link false true true', msgs)
|
|
54
|
+
self.stormIsInPrint('cell.loop.vertex.link true true true', msgs)
|
|
55
|
+
self.stormIsInPrint('core.loop.vertex.link null true true', msgs)
|
|
56
|
+
self.stormIsInPrint('mysvc.loop.vertex.link null true true', msgs)
|
|
57
|
+
|
|
58
|
+
msgs = await core00.stormlist('aha.svc.list')
|
|
59
|
+
self.stormNotInPrint('Nexus', msgs)
|
|
60
|
+
msgs = await core00.stormlist('aha.svc.stat cell...')
|
|
61
|
+
|
|
62
|
+
# The connections information includes runtime information such as port/host info.
|
|
63
|
+
# Omit checking part of that.
|
|
64
|
+
emsg = '''Resolved cell... to an AHA Service.
|
|
65
|
+
|
|
66
|
+
Name: cell.loop.vertex.link
|
|
67
|
+
Online: true
|
|
68
|
+
Ready: true
|
|
69
|
+
Run iden: ********************************
|
|
70
|
+
Cell iden: ********************************
|
|
71
|
+
Leader: cell
|
|
72
|
+
Connection information:
|
|
73
|
+
ca: loop.vertex.link
|
|
74
|
+
'''
|
|
75
|
+
self.stormIsInPrint(emsg, msgs, deguid=True)
|
|
76
|
+
self.stormIsInPrint(' hostname: 00.cell.loop.vertex.link', msgs)
|
|
77
|
+
self.stormIsInPrint(' scheme: ssl', msgs)
|
|
78
|
+
self.stormIsInPrint(' user: root', msgs)
|
|
79
|
+
|
|
80
|
+
msgs = await core00.stormlist('aha.svc.stat --nexus cell...')
|
|
81
|
+
emsg = '''Resolved cell... to an AHA Service.
|
|
82
|
+
|
|
83
|
+
Name: cell.loop.vertex.link
|
|
84
|
+
Online: true
|
|
85
|
+
Ready: true
|
|
86
|
+
Run iden: ********************************
|
|
87
|
+
Cell iden: ********************************
|
|
88
|
+
Leader: cell
|
|
89
|
+
Nexus: 1
|
|
90
|
+
Connection information:
|
|
91
|
+
ca: loop.vertex.link
|
|
92
|
+
'''
|
|
93
|
+
self.stormIsInPrint(emsg, msgs, deguid=True)
|
|
94
|
+
|
|
95
|
+
msgs = await core00.stormlist('aha.svc.stat --nexus 01.cell...')
|
|
96
|
+
emsg = '''Resolved 01.cell... to an AHA Service.
|
|
97
|
+
|
|
98
|
+
Name: 01.cell.loop.vertex.link
|
|
99
|
+
Online: true
|
|
100
|
+
Ready: true
|
|
101
|
+
Run iden: ********************************
|
|
102
|
+
Cell iden: ********************************
|
|
103
|
+
Leader: cell
|
|
104
|
+
Nexus: 1
|
|
105
|
+
Connection information:
|
|
106
|
+
ca: loop.vertex.link
|
|
107
|
+
'''
|
|
108
|
+
self.stormIsInPrint(emsg, msgs, deguid=True)
|
|
109
|
+
|
|
110
|
+
# Full name works
|
|
111
|
+
msgs = await core00.stormlist('aha.svc.stat 01.cell.loop.vertex.link')
|
|
112
|
+
emsg = '''Resolved 01.cell.loop.vertex.link to an AHA Service.
|
|
113
|
+
|
|
114
|
+
Name: 01.cell.loop.vertex.link
|
|
115
|
+
'''
|
|
116
|
+
self.stormIsInPrint(emsg, msgs, deguid=True)
|
|
117
|
+
|
|
118
|
+
# No item for pool00 yet..
|
|
119
|
+
msgs = await core00.stormlist('aha.svc.stat pool00...')
|
|
120
|
+
self.stormIsInPrint('No service found for: "pool00..."', msgs)
|
|
121
|
+
|
|
122
|
+
msgs = await core00.stormlist('aha.pool.add pool00...')
|
|
123
|
+
self.stormHasNoWarnErr(msgs)
|
|
124
|
+
msgs = await core00.stormlist('aha.pool.svc.add pool00... 00.cell...')
|
|
125
|
+
self.stormHasNoWarnErr(msgs)
|
|
126
|
+
|
|
127
|
+
msgs = await core00.stormlist('aha.svc.stat --nexus pool00...')
|
|
128
|
+
emsg = '''Resolved pool00... to an AHA Pool.
|
|
129
|
+
|
|
130
|
+
The pool currently has 1 members.
|
|
131
|
+
AHA Pool: pool00.loop.vertex.link
|
|
132
|
+
Member: 00.cell.loop.vertex.link'''
|
|
133
|
+
self.stormIsInPrint(emsg, msgs)
|
|
134
|
+
|
|
135
|
+
# Shut down a service
|
|
136
|
+
nevents = 2 if replay else 1
|
|
137
|
+
waiter = aha.waiter(nevents, 'aha:svcdown')
|
|
138
|
+
await cell01.fini()
|
|
139
|
+
self.len(nevents, await waiter.wait(timeout=12))
|
|
140
|
+
|
|
141
|
+
msgs = await core00.stormlist('aha.svc.list')
|
|
142
|
+
self.stormIsInPrint('01.cell.loop.vertex.link false false false', msgs)
|
|
143
|
+
|
|
144
|
+
# Fake a record
|
|
145
|
+
await aha.addAhaSvc('00.newp', info={'urlinfo': {'scheme': 'tcp', 'host': '0.0.0.0', 'port': '3030'}},
|
|
146
|
+
network='loop.vertex.link')
|
|
147
|
+
|
|
148
|
+
msgs = await core00.stormlist('aha.svc.list --nexus')
|
|
149
|
+
emsg = '00.newp.loop.vertex.link null false null 0.0.0.0 3030 ' \
|
|
150
|
+
'Service is not online. Will not attempt to retrieve its nexus offset.'
|
|
151
|
+
self.stormIsInPrint(emsg, msgs)
|
|
152
|
+
|
|
153
|
+
self.none(await core00.callStorm('return($lib.aha.del(00.newp...))'))
|
|
154
|
+
msgs = await core00.stormlist('aha.svc.list')
|
|
155
|
+
self.stormNotInPrint('00.newp', msgs)
|
|
156
|
+
|
|
157
|
+
# Fake a online record
|
|
158
|
+
guid = s_common.guid()
|
|
159
|
+
await aha.addAhaSvc('00.newp', info={'urlinfo': {'scheme': 'tcp',
|
|
160
|
+
'host': '0.0.0.0',
|
|
161
|
+
'port': '3030'},
|
|
162
|
+
'online': guid,
|
|
163
|
+
},
|
|
164
|
+
network='loop.vertex.link')
|
|
165
|
+
msgs = await core00.stormlist('aha.svc.list --nexus')
|
|
166
|
+
emsg = '00.newp.loop.vertex.link null true null 0.0.0.0 3030 ' \
|
|
167
|
+
'Failed to connect to Telepath service: "aha://00.newp.loop.vertex.link/" error:'
|
|
168
|
+
self.stormIsInPrint(emsg, msgs)
|
|
169
|
+
|
|
170
|
+
msgs = await core00.stormlist('aha.svc.stat --nexus 00.newp...')
|
|
171
|
+
emsg = '''Resolved 00.newp... to an AHA Service.
|
|
172
|
+
|
|
173
|
+
Name: 00.newp.loop.vertex.link
|
|
174
|
+
Online: true
|
|
175
|
+
Ready: null
|
|
176
|
+
Run iden: $lib.null
|
|
177
|
+
Cell iden: $lib.null
|
|
178
|
+
Leader: Service did not register itself with a leader name.
|
|
179
|
+
Nexus: Failed to connect to Telepath service: "aha://00.newp.loop.vertex.link/" error: [Errno 111] Connect call failed ('0.0.0.0', 3030)
|
|
180
|
+
Connection information:
|
|
181
|
+
host: 0.0.0.0
|
|
182
|
+
port: 3030
|
|
183
|
+
scheme: tcp
|
|
184
|
+
user: root'''
|
|
185
|
+
self.stormIsInPrint(emsg, msgs)
|
|
186
|
+
|
|
187
|
+
# Delete the fake service with its full service name
|
|
188
|
+
self.none(await core00.callStorm('return($lib.aha.del(00.newp.loop.vertex.link))'))
|
|
189
|
+
self.none(await core00.callStorm('return($lib.aha.get(00.newp...))'))
|
|
190
|
+
|
|
191
|
+
# Coverage for sad paths
|
|
192
|
+
with self.raises(s_exc.BadArg):
|
|
193
|
+
await core00.callStorm('$lib.aha.del(pool00...)')
|
|
194
|
+
|
|
195
|
+
with self.raises(s_exc.NoSuchName):
|
|
196
|
+
await core00.callStorm('$lib.aha.del(axon...)')
|
|
@@ -14,13 +14,13 @@ class StormlibCompressionTest(s_test.SynTest):
|
|
|
14
14
|
text = 'ohhai'
|
|
15
15
|
tenc = base64.urlsafe_b64encode((bz2.compress(text.encode()))).decode()
|
|
16
16
|
|
|
17
|
-
await core.nodes(f'[
|
|
18
|
-
await core.nodes(f'[
|
|
17
|
+
await core.nodes(f'[ tel:mob:telem=(node1,) :data="{tenc}" ]')
|
|
18
|
+
await core.nodes(f'[ tel:mob:telem=(node2,) :data="{text}" ]')
|
|
19
19
|
|
|
20
|
-
q = '
|
|
20
|
+
q = 'tel:mob:telem=(node1,) return($lib.compression.bzip2.un($lib.base64.decode(:data)).decode())'
|
|
21
21
|
self.eq(text, await core.callStorm(q))
|
|
22
22
|
|
|
23
|
-
q = '
|
|
23
|
+
q = 'tel:mob:telem=(node2,) return($lib.base64.encode($lib.compression.bzip2.en((:data).encode())))'
|
|
24
24
|
self.eq(tenc, await core.callStorm(q))
|
|
25
25
|
|
|
26
26
|
await self.asyncraises(s_exc.StormRuntimeError, core.nodes('$lib.compression.bzip2.en(foo)'))
|
|
@@ -31,13 +31,13 @@ class StormlibCompressionTest(s_test.SynTest):
|
|
|
31
31
|
text = 'ohhai'
|
|
32
32
|
tenc = base64.urlsafe_b64encode((gzip.compress(text.encode()))).decode()
|
|
33
33
|
|
|
34
|
-
await core.nodes(f'[
|
|
35
|
-
await core.nodes(f'[
|
|
34
|
+
await core.nodes(f'[ tel:mob:telem=(node1,) :data="{tenc}" ]')
|
|
35
|
+
await core.nodes(f'[ tel:mob:telem=(node2,) :data="{text}" ]')
|
|
36
36
|
|
|
37
|
-
q = '
|
|
37
|
+
q = 'tel:mob:telem=(node1,) return($lib.compression.gzip.un($lib.base64.decode(:data)).decode())'
|
|
38
38
|
self.eq(text, await core.callStorm(q))
|
|
39
39
|
|
|
40
|
-
q = '
|
|
40
|
+
q = 'tel:mob:telem=(node2,) return($lib.compression.gzip.en((:data).encode()))'
|
|
41
41
|
self.eq(text.encode(), gzip.decompress(await core.callStorm(q)))
|
|
42
42
|
|
|
43
43
|
await self.asyncraises(s_exc.StormRuntimeError, core.nodes('$lib.compression.gzip.en(foo)'))
|
|
@@ -48,13 +48,13 @@ class StormlibCompressionTest(s_test.SynTest):
|
|
|
48
48
|
text = 'ohhai'
|
|
49
49
|
tenc = base64.urlsafe_b64encode((zlib.compress(text.encode()))).decode()
|
|
50
50
|
|
|
51
|
-
await core.nodes(f'[
|
|
52
|
-
await core.nodes(f'[
|
|
51
|
+
await core.nodes(f'[ tel:mob:telem=(node1,) :data="{tenc}" ]')
|
|
52
|
+
await core.nodes(f'[ tel:mob:telem=(node2,) :data="{text}" ]')
|
|
53
53
|
|
|
54
|
-
q = '
|
|
54
|
+
q = 'tel:mob:telem=(node1,) return($lib.compression.zlib.un($lib.base64.decode(:data)).decode())'
|
|
55
55
|
self.eq(text, await core.callStorm(q))
|
|
56
56
|
|
|
57
|
-
q = '
|
|
57
|
+
q = 'tel:mob:telem=(node2,) return($lib.base64.encode($lib.compression.zlib.en((:data).encode())))'
|
|
58
58
|
self.eq(tenc, await core.callStorm(q))
|
|
59
59
|
|
|
60
60
|
await self.asyncraises(s_exc.StormRuntimeError, core.nodes('$lib.compression.zlib.en(foo)'))
|