Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
lookup-rule
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sabari T
lookup-rule
Commits
ef7a808c
Commit
ef7a808c
authored
Aug 25, 2021
by
charankumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified
parent
d33b9882
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
171 additions
and
143 deletions
+171
-143
conf/service.yml
conf/service.yml
+2
-1
main.py
main.py
+23
-7
scripts/handler/rule_configuration_handler.py
scripts/handler/rule_configuration_handler.py
+1
-1
scripts/handler/rule_engine_update.py
scripts/handler/rule_engine_update.py
+145
-134
No files found.
conf/service.yml
View file @
ef7a808c
...
...
@@ -7,7 +7,8 @@ log:
back_up_count
:
10
mongo_db
:
URI
:
mongodb://192.168.0.220:2717/
URI
:
mongodb://ilens:iLens%231234@192.168.0.207:2117/ilens_configuration?authSource=admin
URI_
:
mongodb://192.168.0.220:2717
REDIS
:
REDIS_HOST
:
192.168.0.220
...
...
main.py
View file @
ef7a808c
...
...
@@ -5,16 +5,32 @@ from scripts.handler.rule_engine_update import RuleUpdate
if
__name__
==
'__main__'
:
try
:
logger
.
debug
(
"main block started"
)
status
=
RuleUpdate
()
.
rule_update
()
if
status
:
print
(
"Created successfully"
)
else
:
print
(
"Some records are not created successfully, Please check the log file"
)
# status = RuleUpdate().rule_update(request_payload)
# status = RuleUpdate().fetch_hireares('MODBUS_DELTA_UPDATED')
lst
=
[[
"rule_errorcode_1"
,
"tag_194"
,
"tag_352"
,
"rule_engine_131"
],
[
"rule_errorcode_2"
,
"tag_197"
,
"tag_353"
,
"rule_engine_132"
],
[
"rule_errorcode_3"
,
"tag_200"
,
"tag_354"
,
"rule_engine_133"
],
[
"rule_errorcode_4"
,
"tag_202"
,
"tag_355"
,
"rule_engine_134"
],
[
"rule_errorcode_5"
,
"tag_205"
,
"tag_356"
,
"rule_engine_135"
],
[
"rule_errorcode_6"
,
"tag_207"
,
"tag_357"
,
"rule_engine_136"
],
[
"rule_errorcode_7"
,
"tag_208"
,
"tag_358"
,
"rule_engine_137"
],
[
"rule_errorcode_8"
,
"tag_209"
,
"tag_359"
,
"rule_engine_139"
],
[
"rule_errorcode_9"
,
"tag_210"
,
"tag_360"
,
"rule_engine_140"
]]
for
each
in
lst
:
status
=
RuleUpdate
()
.
fetch_hireares
(
'MODBUS_DELTA_UPDATED'
,
each
[
0
]
.
split
(
'rule_'
)[
0
],
input_tag
=
each
[
1
],
output_tag
=
each
[
2
],
rule_id
=
each
[
-
1
],
lookup_name
=
each
[
0
])
# status = RuleUpdate().rule_update(request_payload, 'error_code_1')
if
status
.
get
(
'status'
)
==
'success'
:
print
(
f
"Created successfully: {each}"
)
else
:
print
(
"Some records are not created successfully, Please check the log file"
)
except
RequiredFieldsMissing
:
logger
.
exception
(
"Required Fields are missing in the static JSON"
)
print
(
"Required Fields are missing in the static JSON"
)
except
Exception
as
e
:
logger
.
exception
(
"Exception in the main block"
+
str
(
e
))
print
(
"Exception in the main block"
+
str
(
e
))
scripts/handler/rule_configuration_handler.py
View file @
ef7a808c
...
...
@@ -359,7 +359,7 @@ class RuleConfigurationHandler(object):
this will check whether that rule already exists while creations
"""
exists
=
self
.
rules_mongo
.
find_one_rule
(
query
=
{
"ruleName"
:
input_data
[
"ruleName"
]})
if
exists
is
not
None
:
if
exists
:
return
True
else
:
return
False
...
...
scripts/handler/rule_engine_update.py
View file @
ef7a808c
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment