synapse 2.154.1__py311-none-any.whl → 2.156.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.

Files changed (74) hide show
  1. synapse/cmds/cortex.py +2 -14
  2. synapse/common.py +13 -36
  3. synapse/cortex.py +15 -508
  4. synapse/lib/ast.py +215 -22
  5. synapse/lib/cell.py +35 -8
  6. synapse/lib/certdir.py +11 -0
  7. synapse/lib/cmdr.py +0 -5
  8. synapse/lib/gis.py +2 -2
  9. synapse/lib/httpapi.py +14 -43
  10. synapse/lib/layer.py +64 -201
  11. synapse/lib/lmdbslab.py +11 -0
  12. synapse/lib/node.py +1 -3
  13. synapse/lib/parser.py +10 -0
  14. synapse/lib/slabseqn.py +2 -1
  15. synapse/lib/snap.py +121 -21
  16. synapse/lib/spooled.py +9 -0
  17. synapse/lib/storm.lark +23 -6
  18. synapse/lib/storm.py +16 -339
  19. synapse/lib/storm_format.py +5 -0
  20. synapse/lib/stormhttp.py +10 -1
  21. synapse/lib/stormlib/gen.py +1 -2
  22. synapse/lib/stormlib/gis.py +41 -0
  23. synapse/lib/stormlib/graph.py +2 -1
  24. synapse/lib/stormlib/stats.py +21 -2
  25. synapse/lib/stormlib/storm.py +16 -1
  26. synapse/lib/stormtypes.py +244 -16
  27. synapse/lib/types.py +16 -2
  28. synapse/lib/version.py +2 -2
  29. synapse/lib/view.py +118 -25
  30. synapse/models/base.py +2 -2
  31. synapse/models/inet.py +60 -30
  32. synapse/models/infotech.py +130 -8
  33. synapse/models/orgs.py +3 -0
  34. synapse/models/proj.py +3 -0
  35. synapse/models/risk.py +24 -6
  36. synapse/models/syn.py +0 -38
  37. synapse/tests/test_cmds_cortex.py +1 -1
  38. synapse/tests/test_cortex.py +70 -338
  39. synapse/tests/test_lib_agenda.py +19 -54
  40. synapse/tests/test_lib_aha.py +97 -0
  41. synapse/tests/test_lib_ast.py +596 -0
  42. synapse/tests/test_lib_grammar.py +30 -10
  43. synapse/tests/test_lib_httpapi.py +33 -49
  44. synapse/tests/test_lib_layer.py +19 -234
  45. synapse/tests/test_lib_lmdbslab.py +22 -0
  46. synapse/tests/test_lib_snap.py +9 -0
  47. synapse/tests/test_lib_spooled.py +4 -0
  48. synapse/tests/test_lib_storm.py +16 -309
  49. synapse/tests/test_lib_stormlib_gis.py +21 -0
  50. synapse/tests/test_lib_stormlib_stats.py +107 -20
  51. synapse/tests/test_lib_stormlib_storm.py +25 -0
  52. synapse/tests/test_lib_stormtypes.py +253 -8
  53. synapse/tests/test_lib_types.py +40 -0
  54. synapse/tests/test_lib_view.py +6 -13
  55. synapse/tests/test_model_base.py +1 -1
  56. synapse/tests/test_model_inet.py +15 -0
  57. synapse/tests/test_model_infotech.py +110 -0
  58. synapse/tests/test_model_orgs.py +10 -0
  59. synapse/tests/test_model_person.py +0 -3
  60. synapse/tests/test_model_proj.py +2 -1
  61. synapse/tests/test_model_risk.py +24 -0
  62. synapse/tests/test_model_syn.py +20 -34
  63. synapse/tests/test_tools_csvtool.py +2 -1
  64. synapse/tests/test_tools_feed.py +4 -30
  65. synapse/tools/csvtool.py +2 -1
  66. {synapse-2.154.1.dist-info → synapse-2.156.0.dist-info}/METADATA +9 -9
  67. {synapse-2.154.1.dist-info → synapse-2.156.0.dist-info}/RECORD +70 -72
  68. {synapse-2.154.1.dist-info → synapse-2.156.0.dist-info}/WHEEL +1 -1
  69. synapse/cmds/cron.py +0 -726
  70. synapse/cmds/trigger.py +0 -319
  71. synapse/tests/test_cmds_cron.py +0 -453
  72. synapse/tests/test_cmds_trigger.py +0 -176
  73. {synapse-2.154.1.dist-info → synapse-2.156.0.dist-info}/LICENSE +0 -0
  74. {synapse-2.154.1.dist-info → synapse-2.156.0.dist-info}/top_level.txt +0 -0
@@ -1115,3 +1115,100 @@ class AhaTest(s_test.SynTest):
1115
1115
  online = svcinfo.get('online')
1116
1116
  self.nn(online)
1117
1117
  self.true(ready)
1118
+
1119
+ async def test_aha_reprovision(self):
1120
+ with self.withNexusReplay() as stack:
1121
+ with self.getTestDir() as dirn:
1122
+ aha00dirn = s_common.gendir(dirn, 'aha00')
1123
+ aha01dirn = s_common.gendir(dirn, 'aha01')
1124
+ svc0dirn = s_common.gendir(dirn, 'svc00')
1125
+ svc1dirn = s_common.gendir(dirn, 'svc01')
1126
+ async with await s_base.Base.anit() as cm:
1127
+ aconf = {
1128
+ 'aha:name': 'aha',
1129
+ 'aha:network': 'loop.vertex.link',
1130
+ 'provision:listen': 'ssl://aha.loop.vertex.link:0'
1131
+ }
1132
+ name = aconf.get('aha:name')
1133
+ netw = aconf.get('aha:network')
1134
+ dnsname = f'{name}.{netw}'
1135
+
1136
+ aha = await s_aha.AhaCell.anit(aha00dirn, conf=aconf)
1137
+ await cm.enter_context(aha)
1138
+
1139
+ addr, port = aha.provdmon.addr
1140
+ # update the config to reflect the dynamically bound port
1141
+ aha.conf['provision:listen'] = f'ssl://{dnsname}:{port}'
1142
+
1143
+ # do this config ex-post-facto due to port binding...
1144
+ host, ahaport = await aha.dmon.listen(f'ssl://0.0.0.0:0?hostname={dnsname}&ca={netw}')
1145
+ aha.conf['aha:urls'] = (f'ssl://{dnsname}:{ahaport}',)
1146
+
1147
+ onetime = await aha.addAhaSvcProv('00.svc', provinfo=None)
1148
+ sconf = {'aha:provision': onetime}
1149
+ s_common.yamlsave(sconf, svc0dirn, 'cell.yaml')
1150
+ svc0 = await s_cell.Cell.anit(svc0dirn, conf=sconf)
1151
+ await cm.enter_context(svc0)
1152
+
1153
+ onetime = await aha.addAhaSvcProv('01.svc', provinfo={'mirror': 'svc'})
1154
+ sconf = {'aha:provision': onetime}
1155
+ s_common.yamlsave(sconf, svc1dirn, 'cell.yaml')
1156
+ svc1 = await s_cell.Cell.anit(svc1dirn, conf=sconf)
1157
+ await cm.enter_context(svc1)
1158
+
1159
+ # Ensure that services have connected
1160
+ await asyncio.wait_for(svc1.nexsroot._mirready.wait(), timeout=6)
1161
+ await svc1.sync()
1162
+
1163
+ # Get Aha services
1164
+ snfo = await aha.getAhaSvc('01.svc.loop.vertex.link')
1165
+ svcinfo = snfo.get('svcinfo')
1166
+ ready = svcinfo.get('ready')
1167
+ self.true(ready)
1168
+
1169
+ await aha.fini()
1170
+
1171
+ # Now re-deploy the AHA Service and re-provision the two cells
1172
+ # with the same AHA configuration
1173
+ async with await s_base.Base.anit() as cm:
1174
+ aconf = {
1175
+ 'aha:name': 'aha',
1176
+ 'aha:network': 'loop.vertex.link',
1177
+ 'provision:listen': 'ssl://aha.loop.vertex.link:0'
1178
+ }
1179
+ name = aconf.get('aha:name')
1180
+ netw = aconf.get('aha:network')
1181
+ dnsname = f'{name}.{netw}'
1182
+
1183
+ aha = await s_aha.AhaCell.anit(aha01dirn, conf=aconf)
1184
+ await cm.enter_context(aha)
1185
+
1186
+ addr, port = aha.provdmon.addr
1187
+ # update the config to reflect the dynamically bound port
1188
+ aha.conf['provision:listen'] = f'ssl://{dnsname}:{port}'
1189
+
1190
+ # do this config ex-post-facto due to port binding...
1191
+ host, ahaport = await aha.dmon.listen(f'ssl://0.0.0.0:0?hostname={dnsname}&ca={netw}')
1192
+ aha.conf['aha:urls'] = (f'ssl://{dnsname}:{ahaport}',)
1193
+
1194
+ onetime = await aha.addAhaSvcProv('00.svc', provinfo=None)
1195
+ sconf = {'aha:provision': onetime}
1196
+ s_common.yamlsave(sconf, svc0dirn, 'cell.yaml')
1197
+ svc0 = await s_cell.Cell.anit(svc0dirn, conf=sconf)
1198
+ await cm.enter_context(svc0)
1199
+
1200
+ onetime = await aha.addAhaSvcProv('01.svc', provinfo={'mirror': 'svc'})
1201
+ sconf = {'aha:provision': onetime}
1202
+ s_common.yamlsave(sconf, svc1dirn, 'cell.yaml')
1203
+ svc1 = await s_cell.Cell.anit(svc1dirn, conf=sconf)
1204
+ await cm.enter_context(svc1)
1205
+
1206
+ # Ensure that services have connected
1207
+ await asyncio.wait_for(svc1.nexsroot._mirready.wait(), timeout=6)
1208
+ await svc1.sync()
1209
+
1210
+ # Get Aha services
1211
+ snfo = await aha.getAhaSvc('01.svc.loop.vertex.link')
1212
+ svcinfo = snfo.get('svcinfo')
1213
+ ready = svcinfo.get('ready')
1214
+ self.true(ready)