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
bff8692a
Commit
bff8692a
authored
3 years ago
by
Fotis Soldatos
Browse files
Options
Downloads
Patches
Plain Diff
fix(automation): bind ztpAdd with return statement
parent
19ec3808
No related branches found
No related tags found
1 merge request
!54
Release 2.0.0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/automation/src/main/java/eu/teraflow/automation/AutomationGatewayImpl.java
+20
-11
20 additions, 11 deletions
...in/java/eu/teraflow/automation/AutomationGatewayImpl.java
src/automation/target/kubernetes/kubernetes.yml
+12
-12
12 additions, 12 deletions
src/automation/target/kubernetes/kubernetes.yml
with
32 additions
and
23 deletions
src/automation/src/main/java/eu/teraflow/automation/AutomationGatewayImpl.java
+
20
−
11
View file @
bff8692a
...
@@ -2,6 +2,8 @@ package eu.teraflow.automation;
...
@@ -2,6 +2,8 @@ package eu.teraflow.automation;
import
automation.Automation
;
import
automation.Automation
;
import
context.ContextOuterClass
;
import
context.ContextOuterClass
;
import
eu.teraflow.automation.device.model.Device
;
import
eu.teraflow.automation.model.DeviceRoleId
;
import
io.quarkus.grpc.GrpcService
;
import
io.quarkus.grpc.GrpcService
;
import
io.smallrye.mutiny.Uni
;
import
io.smallrye.mutiny.Uni
;
import
javax.inject.Inject
;
import
javax.inject.Inject
;
...
@@ -32,18 +34,13 @@ public class AutomationGatewayImpl implements AutomationGateway {
...
@@ -32,18 +34,13 @@ public class AutomationGatewayImpl implements AutomationGateway {
@Override
@Override
public
Uni
<
Automation
.
DeviceRoleState
>
ztpAdd
(
Automation
.
DeviceRole
request
)
{
public
Uni
<
Automation
.
DeviceRoleState
>
ztpAdd
(
Automation
.
DeviceRole
request
)
{
final
var
devRoleId
=
request
.
getDevRoleId
().
getDevRoleId
().
getUuid
();
final
var
deviceId
=
serializer
.
deserialize
(
request
.
getDevRoleId
().
getDevId
());
final
var
deviceId
=
serializer
.
deserialize
(
request
.
getDevRoleId
().
getDevId
());
// TODO tie this with return
return
automationService
automationService
.
addDevice
(
deviceId
);
.
addDevice
(
deviceId
)
.
onItem
()
// TODO Set all fields of device role state (create models, serializer)
.
transform
(
device
->
transformToDeviceRoleState
(
device
,
devRoleId
));
return
Uni
.
createFrom
()
.
item
(
()
->
Automation
.
DeviceRoleState
.
newBuilder
()
.
setDevRoleId
(
request
.
getDevRoleId
())
.
build
());
}
}
@Override
@Override
...
@@ -70,4 +67,16 @@ public class AutomationGatewayImpl implements AutomationGateway {
...
@@ -70,4 +67,16 @@ public class AutomationGatewayImpl implements AutomationGateway {
public
Uni
<
Automation
.
DeviceDeletionResult
>
ztpDeleteAll
(
Automation
.
Empty
empty
)
{
public
Uni
<
Automation
.
DeviceDeletionResult
>
ztpDeleteAll
(
Automation
.
Empty
empty
)
{
return
Uni
.
createFrom
().
item
(()
->
Automation
.
DeviceDeletionResult
.
newBuilder
().
build
());
return
Uni
.
createFrom
().
item
(()
->
Automation
.
DeviceDeletionResult
.
newBuilder
().
build
());
}
}
}
// TODO When `DeviceRoleState` domain object will be created, move this method to Serializer class and create related tests
private
Automation
.
DeviceRoleState
transformToDeviceRoleState
(
Device
device
,
String
devRoleId
){
final
var
deviceRoleId
=
new
DeviceRoleId
(
devRoleId
,
device
.
getDeviceId
());
final
var
serializeDeviceRoleId
=
serializer
.
serialize
(
deviceRoleId
);
return
Automation
.
DeviceRoleState
.
newBuilder
()
.
setDevRoleId
(
serializeDeviceRoleId
)
.
setDevRoleState
(
Automation
.
ZtpDeviceState
.
ZTP_DEV_STATE_CREATED
)
.
build
();
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/automation/target/kubernetes/kubernetes.yml
+
12
−
12
View file @
bff8692a
...
@@ -3,20 +3,20 @@ apiVersion: v1
...
@@ -3,20 +3,20 @@ apiVersion: v1
kind
:
Service
kind
:
Service
metadata
:
metadata
:
annotations
:
annotations
:
app.quarkus.io/commit-id
:
500a0a232ec361b669b48cc432e9bd9c332eae8b
app.quarkus.io/commit-id
:
10192a8dd76072b7c1026824117157d672385e29
app.quarkus.io/build-timestamp
:
2022-02-11 - 1
0:27:21
+0000
app.quarkus.io/build-timestamp
:
2022-02-11 - 1
6:52:33
+0000
labels
:
labels
:
app.kubernetes.io/name
:
automationservice
app.kubernetes.io/name
:
automationservice
app
:
automationservice
app
:
automationservice
name
:
automationservice
name
:
automationservice
spec
:
spec
:
ports
:
ports
:
-
name
:
grpc-server
port
:
9999
targetPort
:
9999
-
name
:
http
-
name
:
http
port
:
8080
port
:
8080
targetPort
:
8080
targetPort
:
8080
-
name
:
grpc-server
port
:
9999
targetPort
:
9999
selector
:
selector
:
app.kubernetes.io/name
:
automationservice
app.kubernetes.io/name
:
automationservice
type
:
ClusterIP
type
:
ClusterIP
...
@@ -25,8 +25,8 @@ apiVersion: apps/v1
...
@@ -25,8 +25,8 @@ apiVersion: apps/v1
kind
:
Deployment
kind
:
Deployment
metadata
:
metadata
:
annotations
:
annotations
:
app.quarkus.io/commit-id
:
500a0a232ec361b669b48cc432e9bd9c332eae8b
app.quarkus.io/commit-id
:
10192a8dd76072b7c1026824117157d672385e29
app.quarkus.io/build-timestamp
:
2022-02-11 - 1
0:27:21
+0000
app.quarkus.io/build-timestamp
:
2022-02-11 - 1
6:52:33
+0000
labels
:
labels
:
app
:
automationservice
app
:
automationservice
app.kubernetes.io/name
:
automationservice
app.kubernetes.io/name
:
automationservice
...
@@ -39,8 +39,8 @@ spec:
...
@@ -39,8 +39,8 @@ spec:
template
:
template
:
metadata
:
metadata
:
annotations
:
annotations
:
app.quarkus.io/commit-id
:
500a0a232ec361b669b48cc432e9bd9c332eae8b
app.quarkus.io/commit-id
:
10192a8dd76072b7c1026824117157d672385e29
app.quarkus.io/build-timestamp
:
2022-02-11 - 1
0:27:21
+0000
app.quarkus.io/build-timestamp
:
2022-02-11 - 1
6:52:33
+0000
labels
:
labels
:
app
:
automationservice
app
:
automationservice
app.kubernetes.io/name
:
automationservice
app.kubernetes.io/name
:
automationservice
...
@@ -69,12 +69,12 @@ spec:
...
@@ -69,12 +69,12 @@ spec:
timeoutSeconds
:
10
timeoutSeconds
:
10
name
:
automationservice
name
:
automationservice
ports
:
ports
:
-
containerPort
:
9999
name
:
grpc-server
protocol
:
TCP
-
containerPort
:
8080
-
containerPort
:
8080
name
:
http
name
:
http
protocol
:
TCP
protocol
:
TCP
-
containerPort
:
9999
name
:
grpc-server
protocol
:
TCP
readinessProbe
:
readinessProbe
:
failureThreshold
:
3
failureThreshold
:
3
httpGet
:
httpGet
:
...
...
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