Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TFS
controller
Commits
bb834403
Commit
bb834403
authored
1 year ago
by
Konstantinos Poulakakis
Browse files
Options
Downloads
Patches
Plain Diff
refactor: refactor add policy device two add the policyId to the subscription list.
parent
0d501c75
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!235
Release TeraFlowSDN 3.0
,
!197
Resolve "(UBI) Refactor Policy"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/policy/src/main/java/org/etsi/tfs/policy/PolicyServiceImpl.java
+21
-8
21 additions, 8 deletions
.../src/main/java/org/etsi/tfs/policy/PolicyServiceImpl.java
with
21 additions
and
8 deletions
src/policy/src/main/java/org/etsi/tfs/policy/PolicyServiceImpl.java
+
21
−
8
View file @
bb834403
...
...
@@ -322,10 +322,10 @@ public class PolicyServiceImpl implements PolicyService {
return
areDevicesValid
.
onItem
()
.
transform
(
areDevices
->
a
dd
DeviceOnContext
(
areDevices
,
policyRuleDevice
,
policyRuleBasic
));
.
transform
(
areDevices
->
a
re
DeviceOnContext
(
areDevices
,
policyRuleDevice
,
policyRuleBasic
));
}
private
PolicyRuleState
a
dd
DeviceOnContext
(
private
PolicyRuleState
a
re
DeviceOnContext
(
List
<
Boolean
>
areDevices
,
PolicyRuleDevice
policyRuleDevice
,
PolicyRuleBasic
policyRuleBasic
)
{
...
...
@@ -353,7 +353,22 @@ public class PolicyServiceImpl implements PolicyService {
return
policyRuleState
;
}
contextService
.
setPolicyRule
(
policyRule
).
subscribe
().
with
(
x
->
{});
contextService
.
setPolicyRule
(
policyRule
)
.
subscribe
()
.
with
(
policyId
->
{
startMonitoringBasedOnAlarmDescriptors
(
policyId
,
policyRuleDevice
,
alarmDescriptorList
);
});
return
VALIDATED_POLICYRULE_STATE
;
}
private
void
startMonitoringBasedOnAlarmDescriptors
(
String
policyId
,
PolicyRuleDevice
policyRuleDevice
,
List
<
AlarmDescriptor
>
alarmDescriptorList
)
{
setPolicyRuleDeviceToContext
(
policyRuleDevice
,
VALIDATED_POLICYRULE_STATE
);
noAlarms
=
0
;
...
...
@@ -366,14 +381,12 @@ public class PolicyServiceImpl implements PolicyService {
final
var
multi
=
Multi
.
createBy
().
merging
().
streams
(
alarmResponseStreamList
);
setPolicyRuleDeviceToContext
(
policyRuleDevice
,
PROVISIONED_POLICYRULE_STATE
);
monitorAlarmResponseForDevice
(
multi
);
subscriptionList
.
put
(
policyId
,
monitorAlarmResponseForDevice
(
multi
)
)
;
// TODO: Resubscribe to the stream, if it has ended
// TODO: Redesign evaluation of action
// evaluateAction(policyRule, alarmDescriptorList, multi);
return
VALIDATED_POLICYRULE_STATE
;
}
private
List
<
Multi
<
AlarmResponse
>>
getAlarmResponse
(
...
...
@@ -569,8 +582,8 @@ public class PolicyServiceImpl implements PolicyService {
});
}
private
void
monitorAlarmResponseForDevice
(
Multi
<
AlarmResponse
>
multi
)
{
multi
private
Cancellable
monitorAlarmResponseForDevice
(
Multi
<
AlarmResponse
>
multi
)
{
return
multi
.
subscribe
()
.
with
(
alarmResponse
->
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment