Skip to content
Snippets Groups Projects
Commit c31e7046 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'feat/pathcomp-component-frontend' of...

Merge branch 'feat/pathcomp-component-frontend' of https://gitlab.com/teraflow-h2020/controller into feat/ecoc22-dc-interconnect-disjoint
parents 4add883c 8b9da5fa
No related branches found
No related tags found
2 merge requests!54Release 2.0.0,!4Compute component:
Showing
with 241 additions and 142 deletions
......@@ -6,3 +6,4 @@ prometheus-client==0.13.0
protobuf==3.20.*
pytest==6.2.5
pytest-benchmark==3.4.1
python-dateutil==2.8.2
......@@ -86,33 +86,76 @@ for COMPONENT in $TFS_COMPONENTS; do
if [ "$COMPONENT" == "automation" ] || [ "$COMPONENT" == "policy" ]; then
docker build -t "$IMAGE_NAME" -f ./src/"$COMPONENT"/Dockerfile ./src/"$COMPONENT"/ > "$BUILD_LOG"
else
elif [ "$COMPONENT" == "pathcomp" ]; then
BUILD_LOG="$TMP_LOGS_FOLDER/build_${COMPONENT}-frontend.log"
docker build -t "$COMPONENT-frontend:$TFS_IMAGE_TAG" -f ./src/"$COMPONENT"/frontend/Dockerfile . >> "$BUILD_LOG"
BUILD_LOG="$TMP_LOGS_FOLDER/build_${COMPONENT}-backend.log"
docker build -t "$COMPONENT-backend:$TFS_IMAGE_TAG" -f ./src/"$COMPONENT"/backend/Dockerfile . >> "$BUILD_LOG"
# next command is redundant, but helpful to keep cache updated between rebuilds
docker build -t "$COMPONENT-backend:$TFS_IMAGE_TAG-builder" --target builder -f ./src/"$COMPONENT"/backend/Dockerfile . >> "$BUILD_LOG"
else
docker build -t "$IMAGE_NAME" -f ./src/"$COMPONENT"/Dockerfile . > "$BUILD_LOG"
fi
if [ -n "$TFS_REGISTRY_IMAGE" ]; then
echo " Pushing Docker image to '$TFS_REGISTRY_IMAGE'..."
TAG_LOG="$TMP_LOGS_FOLDER/tag_${COMPONENT}.log"
docker tag "$IMAGE_NAME" "$IMAGE_URL" > "$TAG_LOG"
if [ "$COMPONENT" == "pathcomp" ]; then
TAG_LOG="$TMP_LOGS_FOLDER/tag_${COMPONENT}-frontend.log"
docker tag "$COMPONENT-frontend:$TFS_IMAGE_TAG" "$IMAGE_URL-frontend" > "$TAG_LOG"
TAG_LOG="$TMP_LOGS_FOLDER/tag_${COMPONENT}-backend.log"
docker tag "$COMPONENT-backend:$TFS_IMAGE_TAG" "$IMAGE_URL-backend" > "$TAG_LOG"
PUSH_LOG="$TMP_LOGS_FOLDER/push_${COMPONENT}-frontend.log"
docker push "$IMAGE_URL-frontend" > "$PUSH_LOG"
PUSH_LOG="$TMP_LOGS_FOLDER/push_${COMPONENT}-backend.log"
docker push "$IMAGE_URL-backend" > "$PUSH_LOG"
else
TAG_LOG="$TMP_LOGS_FOLDER/tag_${COMPONENT}.log"
docker tag "$IMAGE_NAME" "$IMAGE_URL" > "$TAG_LOG"
PUSH_LOG="$TMP_LOGS_FOLDER/push_${COMPONENT}.log"
docker push "$IMAGE_URL" > "$PUSH_LOG"
PUSH_LOG="$TMP_LOGS_FOLDER/push_${COMPONENT}.log"
docker push "$IMAGE_URL" > "$PUSH_LOG"
fi
fi
echo " Adapting '$COMPONENT' manifest file..."
MANIFEST="$TMP_MANIFESTS_FOLDER/${COMPONENT}service.yaml"
cp ./manifests/"${COMPONENT}"service.yaml "$MANIFEST"
VERSION=$(grep -i "${GITLAB_REPO_URL}/${COMPONENT}:" "$MANIFEST" | cut -d ":" -f3)
if [ -n "$TFS_REGISTRY_IMAGE" ]; then
# Registry is set
sed -E -i "s#image: $GITLAB_REPO_URL/$COMPONENT:${VERSION}#image: $IMAGE_URL#g" "$MANIFEST"
sed -E -i "s#imagePullPolicy: .*#imagePullPolicy: Always#g" "$MANIFEST"
if [ "$COMPONENT" == "pathcomp" ]; then
VERSION=$(grep -i "${GITLAB_REPO_URL}/${COMPONENT}-frontend:" "$MANIFEST" | cut -d ":" -f3)
sed -E -i "s#image: $GITLAB_REPO_URL/$COMPONENT-frontend:${VERSION}#image: $IMAGE_URL-frontend#g" "$MANIFEST"
VERSION=$(grep -i "${GITLAB_REPO_URL}/${COMPONENT}-backend:" "$MANIFEST" | cut -d ":" -f3)
sed -E -i "s#image: $GITLAB_REPO_URL/$COMPONENT-backend:${VERSION}#image: $IMAGE_URL-backend#g" "$MANIFEST"
sed -E -i "s#imagePullPolicy: .*#imagePullPolicy: Always#g" "$MANIFEST"
else
VERSION=$(grep -i "${GITLAB_REPO_URL}/${COMPONENT}:" "$MANIFEST" | cut -d ":" -f3)
sed -E -i "s#image: $GITLAB_REPO_URL/$COMPONENT:${VERSION}#image: $IMAGE_URL#g" "$MANIFEST"
sed -E -i "s#imagePullPolicy: .*#imagePullPolicy: Always#g" "$MANIFEST"
fi
else
# Registry is not set
sed -E -i "s#image: $GITLAB_REPO_URL/$COMPONENT:${VERSION}#image: $IMAGE_NAME#g" "$MANIFEST"
sed -E -i "s#imagePullPolicy: .*#imagePullPolicy: Never#g" "$MANIFEST"
if [ "$COMPONENT" == "pathcomp" ]; then
VERSION=$(grep -i "${GITLAB_REPO_URL}/${COMPONENT}-frontend:" "$MANIFEST" | cut -d ":" -f3)
sed -E -i "s#image: $GITLAB_REPO_URL/$COMPONENT-frontend:${VERSION}#image: $IMAGE_NAME-frontend#g" "$MANIFEST"
VERSION=$(grep -i "${GITLAB_REPO_URL}/${COMPONENT}-backend:" "$MANIFEST" | cut -d ":" -f3)
sed -E -i "s#image: $GITLAB_REPO_URL/$COMPONENT-backend:${VERSION}#image: $IMAGE_NAME-backend#g" "$MANIFEST"
sed -E -i "s#imagePullPolicy: .*#imagePullPolicy: Never#g" "$MANIFEST"
else
VERSION=$(grep -i "${GITLAB_REPO_URL}/${COMPONENT}:" "$MANIFEST" | cut -d ":" -f3)
sed -E -i "s#image: $GITLAB_REPO_URL/$COMPONENT:${VERSION}#image: $IMAGE_NAME#g" "$MANIFEST"
sed -E -i "s#imagePullPolicy: .*#imagePullPolicy: Never#g" "$MANIFEST"
fi
fi
echo " Deploying '$COMPONENT' component to Kubernetes..."
......
......@@ -18,7 +18,7 @@
########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"}
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
# If not already set, set the list of components you want to build images for, and deploy.
export TFS_COMPONENTS=${TFS_COMPONENTS:-"context device automation policy service compute monitoring dbscanserving opticalattackmitigator opticalcentralizedattackdetector webui"}
......@@ -32,6 +32,7 @@ for COMPONENT in $TFS_COMPONENTS; do
echo "Processing '$COMPONENT' component..."
SERVICE_GRPC_PORT=$(kubectl get service ${COMPONENT}service --namespace $TFS_K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.name=="grpc")].port}')
echo " '$COMPONENT' service port: $SERVICE_GRPC_PORT"
if [ -z "${SERVICE_GRPC_PORT}" ]; then
printf "\n"
continue;
......
......@@ -29,19 +29,23 @@ spec:
terminationGracePeriodSeconds: 5
restartPolicy: Always
containers:
- name: influxdb
image: influxdb:1.8
- name: metricsdb
image: questdb/questdb
ports:
- containerPort: 8086
envFrom:
- secretRef:
name: influxdb-secrets
- containerPort: 9000
- containerPort: 9009
- containerPort: 9003
env:
- name: QDB_CAIRO_COMMIT_LAG
value: "1000"
- name: QDB_CAIRO_MAX_UNCOMMITTED_ROWS
value: "100000"
readinessProbe:
exec:
command: ["curl", "-XGET", "localhost:8086/health"]
command: ["curl", "-XGET", "localhost:9000"]
livenessProbe:
exec:
command: ["curl", "-XGET", "localhost:8086/health"]
command: ["curl", "-XGET", "localhost:9003/metrics"]
resources:
requests:
cpu: 250m
......@@ -54,9 +58,15 @@ spec:
imagePullPolicy: Always
ports:
- containerPort: 7070
envFrom:
- secretRef:
name: monitoring-secrets
env:
- name: METRICSDB_HOSTNAME
value: "localhost"
- name: METRICSDB_ILP_PORT
value: "9009"
- name: METRICSDB_REST_PORT
value: "9000"
- name: METRICSDB_TABLE
value: "monitoring"
readinessProbe:
exec:
command: ["/bin/grpc_health_probe", "-addr=:7070"]
......@@ -70,6 +80,7 @@ spec:
limits:
cpu: 700m
memory: 1024Mi
---
apiVersion: v1
kind: Service
......@@ -84,7 +95,7 @@ spec:
protocol: TCP
port: 7070
targetPort: 7070
- name: influxdb
- name: questdb
protocol: TCP
port: 8086
targetPort: 8086
port: 9000
targetPort: 9000
\ No newline at end of file
......@@ -27,8 +27,8 @@ spec:
spec:
terminationGracePeriodSeconds: 5
containers:
- name: server
image: registry.gitlab.com/teraflow-h2020/controller/pathcomp:latest
- name: frontend
image: registry.gitlab.com/teraflow-h2020/controller/pathcomp-frontend:latest
imagePullPolicy: Always
ports:
- containerPort: 10020
......@@ -48,6 +48,37 @@ spec:
limits:
cpu: 700m
memory: 1024Mi
- name: backend
image: registry.gitlab.com/teraflow-h2020/controller/pathcomp-backend:latest
imagePullPolicy: Always
# not working; to be investigated
#readinessProbe:
# exec:
# command:
# - curl -X POST -0
# - -H 'Expect:'
# - -H 'Content-Type:\ application/json'
# - -d '{}'
# - http://127.0.0.1:8081/pathComp/api/v1/compRoute
# initialDelaySeconds: 5
# timeoutSeconds: 5
#livenessProbe:
# exec:
# command:
# - curl -X POST -0
# - -H 'Expect:'
# - -H 'Content-Type:\ application/json'
# - -d '{}'
# - http://127.0.0.1:8081/pathComp/api/v1/compRoute
# initialDelaySeconds: 5
# timeoutSeconds: 5
resources:
requests:
cpu: 250m
memory: 512Mi
limits:
cpu: 700m
memory: 1024Mi
---
apiVersion: v1
kind: Service
......@@ -62,3 +93,7 @@ spec:
protocol: TCP
port: 10020
targetPort: 10020
- name: http
protocol: TCP
port: 8081
targetPort: 8081
......@@ -21,7 +21,7 @@ service AutomationService {
rpc ZtpGetDeviceRole(DeviceRoleId) returns (DeviceRole) {}
rpc ZtpGetDeviceRolesByDeviceId(context.DeviceId) returns (DeviceRoleList) {}
rpc ZtpAdd(DeviceRole) returns (DeviceRoleState) {}
rpc ZtpUpdate(DeviceRole) returns (DeviceRoleState) {}
rpc ZtpUpdate(DeviceRoleConfig) returns (DeviceRoleState) {}
rpc ZtpDelete(DeviceRole) returns (DeviceRoleState) {}
rpc ZtpDeleteAll(context.Empty) returns (DeviceDeletionResult) {}
}
......@@ -43,6 +43,11 @@ message DeviceRole {
DeviceRoleType devRoleType = 2;
}
message DeviceRoleConfig {
DeviceRole devRole = 1;
context.DeviceConfig devConfig = 2;
}
message DeviceRoleList {
repeated DeviceRole devRole = 1;
}
......
......@@ -19,56 +19,35 @@ import "context.proto";
import "kpi_sample_types.proto";
service MonitoringService {
rpc CreateKpi (KpiDescriptor ) returns (KpiId ) {}
rpc EditKpiDescriptor (EditedKpiDescriptor ) returns (context.Empty ) {}
rpc DeleteKpi (KpiId ) returns (context.Empty ) {}
rpc GetKpiDescriptorList (context.Empty ) returns (KpiDescriptorList) {}
rpc CreateBundleKpi (BundleKpiDescriptor ) returns (KpiId ) {}
rpc GetKpiDescriptor (KpiId ) returns (KpiDescriptor ) {}
rpc IncludeKpi (Kpi ) returns (context.Empty ) {}
rpc MonitorKpi (MonitorKpiRequest ) returns (context.Empty ) {}
rpc QueryKpiData (KpiQuery ) returns (KpiList ) {}
rpc SubscribeKpi (SubsDescriptor ) returns (stream KpiList ) {}
rpc GetSubsDescriptor (SubscriptionID ) returns (SubsDescriptor ) {}
rpc GetSubscriptions (context.Empty ) returns (SubsIDList ) {}
rpc EditKpiSubscription (SubsDescriptor ) returns (context.Empty ) {}
rpc CreateKpiAlarm (AlarmDescriptor ) returns ( AlarmID ) {}
rpc EditKpiAlarm (AlarmDescriptor ) returns (context.Empty ) {}
rpc GetAlarms (context.Empty ) returns (AlarmIDList ) {}
rpc GetAlarmDescriptor (AlarmID ) returns (AlarmDescriptor ) {}
rpc GetAlarmResponseStream (AlarmID ) returns (stream AlarmResponse ) {}
// rpc GetStreamKpi (KpiId ) returns (stream Kpi ) {}
// rpc GetInstantKpi (KpiId ) returns (KpiList ) {}
rpc SetKpi (KpiDescriptor ) returns (KpiId ) {}
rpc DeleteKpi (KpiId ) returns (context.Empty ) {}
rpc GetKpiDescriptor (KpiId ) returns (KpiDescriptor ) {}
rpc GetKpiDescriptorList (context.Empty ) returns (KpiDescriptorList ) {}
rpc IncludeKpi (Kpi ) returns (context.Empty ) {}
rpc MonitorKpi (MonitorKpiRequest ) returns (context.Empty ) {}
rpc QueryKpiData (KpiQuery ) returns (KpiList ) {}
rpc SetKpiSubscription (SubsDescriptor ) returns (stream KpiList ) {}
rpc GetSubsDescriptor (SubscriptionID ) returns (SubsDescriptor ) {}
rpc GetSubscriptions (context.Empty ) returns (SubsIDList ) {}
rpc DeleteSubscription (SubscriptionID ) returns (context.Empty ) {}
rpc SetKpiAlarm (AlarmDescriptor ) returns (AlarmID ) {}
rpc GetAlarms (context.Empty ) returns (AlarmIDList ) {}
rpc GetAlarmDescriptor (AlarmID ) returns (AlarmDescriptor ) {}
rpc GetAlarmResponseStream(AlarmSubscription ) returns (stream AlarmResponse) {}
rpc DeleteAlarm (AlarmID ) returns (context.Empty ) {}
rpc GetStreamKpi (KpiId ) returns (stream Kpi ) {}
rpc GetInstantKpi (KpiId ) returns (KpiList ) {}
}
message KpiDescriptor {
string kpi_description = 1;
kpi_sample_types.KpiSampleType kpi_sample_type = 2;
context.DeviceId device_id = 3;
context.EndPointId endpoint_id = 4;
context.ServiceId service_id = 5;
context.SliceId slice_id = 6;
}
message BundleKpiDescriptor {
string kpi_description = 1;
repeated KpiId kpi_id_list = 2;
kpi_sample_types.KpiSampleType kpi_sample_type = 3;
context.DeviceId device_id = 4;
context.EndPointId endpoint_id = 5;
context.ServiceId service_id = 6;
context.SliceId slice_id = 7;
}
message EditedKpiDescriptor {
KpiId kpi_id = 1;
string kpi_description = 2;
repeated KpiId kpi_id_list = 3;
kpi_sample_types.KpiSampleType kpi_sample_type = 4;
context.DeviceId device_id = 5;
context.EndPointId endpoint_id = 6;
context.ServiceId service_id = 7;
context.SliceId slice_id = 8;
KpiId kpi_id = 1;
string kpi_description = 2;
repeated KpiId kpi_id_list = 3;
kpi_sample_types.KpiSampleType kpi_sample_type = 4;
context.DeviceId device_id = 5;
context.EndPointId endpoint_id = 6;
context.ServiceId service_id = 7;
context.SliceId slice_id = 8;
}
message MonitorKpiRequest {
......@@ -79,12 +58,12 @@ message MonitorKpiRequest {
}
message KpiQuery {
repeated KpiId kpi_id = 1;
float monitoring_window_s = 2;
float sampling_rate_s = 3;
uint32 last_n_samples = 4; // used when you want something like "get the last N many samples
string start_date = 5; // used when you want something like "get the samples since X date/time"
string end_date = 6; // used when you want something like "get the samples until X date/time"
repeated KpiId kpi_id = 1;
float monitoring_window_s = 2;
float sampling_rate_s = 3;
uint32 last_n_samples = 4; // used when you want something like "get the last N many samples
context.Timestamp start_timestamp = 5; // used when you want something like "get the samples since X date/time"
context.Timestamp end_timestamp = 6; // used when you want something like "get the samples until X date/time"
// Pending add field to reflect Available Device Protocols
}
......@@ -93,39 +72,47 @@ message KpiId {
}
message Kpi {
KpiId kpi_id = 1;
string timestamp = 2;
KpiValue kpi_value = 3;
KpiId kpi_id = 1;
context.Timestamp timestamp = 2;
KpiValue kpi_value = 3;
}
message KpiValueRange {
KpiValue kpiMinValue = 1;
KpiValue kpiMaxValue = 2;
KpiValue kpiMinValue = 1;
KpiValue kpiMaxValue = 2;
bool inRange = 3; // by default True
bool includeMinValue = 4; // False is outside the interval
bool includeMaxValue = 5; // False is outside the interval
}
message KpiValue {
oneof value {
uint32 intVal = 1;
float floatVal = 2;
string stringVal = 3;
bool boolVal = 4;
int32 int32Val = 1;
uint32 uint32Val = 2;
int64 int64Val = 3;
uint64 uint64Val = 4;
float floatVal = 5;
string stringVal = 6;
bool boolVal = 7;
}
}
message KpiList {
repeated Kpi kpi_list = 1;
repeated Kpi kpi_list = 1;
}
message KpiDescriptorList {
repeated KpiDescriptor kpi_descriptor_list = 1;
repeated KpiDescriptor kpi_descriptor_list = 1;
}
message SubsDescriptor{
KpiId kpi_id = 1;
float sampling_duration_s = 2;
float sampling_interval_s = 3;
string start_date = 4; // used when you want something like "get the samples since X date/time"
string end_date = 5; // used when you want something like "get the samples until X date/time"
SubscriptionID subs_id = 1;
KpiId kpi_id = 2;
float sampling_duration_s = 3;
float sampling_interval_s = 4;
context.Timestamp start_timestamp = 5; // used when you want something like "get the samples since X date/time"
context.Timestamp end_timestamp = 6; // used when you want something like "get the samples until X date/time"
// Pending add field to reflect Available Device Protocols
}
......@@ -134,30 +121,38 @@ message SubscriptionID {
}
message SubsResponse {
SubscriptionID subs_id = 1;
SubscriptionID subs_id = 1;
repeated KpiList kpi_list = 2;
}
message SubsIDList {
repeated SubscriptionID subs_list = 1;
repeated SubscriptionID subs_list = 1;
}
message AlarmDescriptor {
string alarm_description = 1;
string name = 2;
KpiId kpi_id = 3;
KpiValueRange kpi_value_range = 4;
string timestamp = 5;
AlarmID alarm_id = 1;
string alarm_description = 2;
string name = 3;
repeated KpiId kpi_id = 4;
repeated KpiValueRange kpi_value_range = 5;
context.Timestamp timestamp = 6;
}
message AlarmID{
context.Uuid alarm_id = 1;
}
message AlarmSubscription{
AlarmID alarmID = 1;
float subscription_timeout_s = 2;
float subscription_frequency_ms = 3;
}
message AlarmResponse {
AlarmID alarm_id = 1;
string text = 2;
KpiValue kpi_value = 3;
AlarmID alarm_id = 1;
string text = 2;
KpiValue kpi_value = 3;
context.Timestamp timestamp = 4;
}
message AlarmIDList {
......
......@@ -28,11 +28,16 @@ message Algorithm_KShortestPath {
uint32 k_return = 2;
}
message Algorithm_KDisjointPath {
uint32 num_disjoint = 1;
}
message PathCompRequest {
repeated context.Service services = 1;
oneof algorithm {
Algorithm_ShortestPath shortest_path = 10;
Algorithm_KShortestPath k_shortest_path = 11;
Algorithm_KDisjointPath k_disjoint_path = 12;
}
}
......
......@@ -18,7 +18,7 @@ package te;
import "context.proto";
service TEService {
rpc RequestLSP (context.Service) returns (context.ServiceStatus) {}
rpc RequestLSP(context.Service ) returns (context.ServiceStatus) {}
rpc UpdateLSP (context.ServiceId) returns (context.ServiceStatus) {}
rpc DeleteLSP (context.ServiceId) returns (context.Empty) {}
rpc DeleteLSP (context.ServiceId) returns (context.Empty ) {}
}
......@@ -16,7 +16,7 @@
# this script opens the dashboard
K8S_NAMESPACE=${K8S_NAMESPACE:-'tf-dev'}
K8S_NAMESPACE=${K8S_NAMESPACE:-'tfs'}
GRAFANA_IP=$(kubectl get service/webuiservice -n ${K8S_NAMESPACE} -o jsonpath='{.spec.clusterIP}')
GRAFANA_PORT=$(kubectl get service webuiservice-public --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==3000)].nodePort}')
......
......@@ -14,10 +14,9 @@
# this script opens the webui
K8S_NAMESPACE=${K8S_NAMESPACE:-'tf-dev'}
K8S_NAMESPACE=${K8S_NAMESPACE:-'tfs'}
WEBUI_SERVICE_NAME="webuiservice-public"
WEBUI_PROTO=`kubectl get service ${WEBUI_SERVICE_NAME} -n ${K8S_NAMESPACE} -o jsonpath='{.spec.ports[0].name}'`
WEBUI_SERVICE_NAME="webuiservice"
WEBUI_IP=`kubectl get service ${WEBUI_SERVICE_NAME} -n ${K8S_NAMESPACE} -o jsonpath='{.spec.clusterIP}'`
# WEBUI_PORT=$(kubectl get service ${WEBUI_SERVICE_NAME} --namespace $K8S_NAMESPACE -o 'jsonpath={.spec.ports[?(@.port==8004)].nodePort}')
WEBUI_PORT=8004
......@@ -25,13 +24,13 @@ WEBUI_PORT=8004
GRAFANA_PORT=3000
# Open WebUI
URL=${WEBUI_PROTO}://${WEBUI_IP}:${WEBUI_PORT}
echo Opening web UI on URL ${URL}
# curl -kL ${URL}
python3 -m webbrowser ${URL}
UI_URL="http://${WEBUI_IP}:${WEBUI_PORT}"
echo "Opening web UI on URL ${UI_URL}"
# curl -kL ${UI_URL}
python3 -m webbrowser ${UI_URL}
# Open Dashboard
URL=${WEBUI_PROTO}://${WEBUI_IP}:${GRAFANA_PORT}
echo Opening Dashboard on URL ${URL}
# curl -kL ${URL}
python3 -m webbrowser ${URL}
DASHB_URL="http://${WEBUI_IP}:${GRAFANA_PORT}"
echo "Opening Dashboard on URL ${DASHB_URL}"
# curl -kL ${DASHB_URL}
python3 -m webbrowser ${DASHB_URL}
......@@ -18,7 +18,7 @@
########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"}
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
########################################################################################################################
# Automated steps start here
......
......@@ -18,7 +18,7 @@
########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"}
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
########################################################################################################################
# Automated steps start here
......
......@@ -18,7 +18,7 @@
########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"}
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
########################################################################################################################
# Automated steps start here
......
......@@ -18,7 +18,7 @@
########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"}
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
########################################################################################################################
# Automated steps start here
......
......@@ -18,7 +18,7 @@
########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"}
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
########################################################################################################################
# Automated steps start here
......
......@@ -18,7 +18,7 @@
########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"}
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
########################################################################################################################
# Automated steps start here
......
......@@ -18,7 +18,7 @@
########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"}
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
########################################################################################################################
# Automated steps start here
......
......@@ -18,7 +18,7 @@
########################################################################################################################
# If not already set, set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs-dev"}
export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"}
########################################################################################################################
# Automated steps start here
......
......@@ -17,9 +17,12 @@
package eu.teraflow.automation;
import automation.Automation;
import automation.Automation.DeviceRoleConfig;
import automation.Automation.DeviceRoleState;
import context.ContextOuterClass;
import eu.teraflow.automation.context.model.Device;
import eu.teraflow.automation.model.DeviceRoleId;
import eu.teraflow.automation.model.DeviceState;
import io.quarkus.grpc.GrpcService;
import io.smallrye.mutiny.Uni;
import javax.inject.Inject;
......@@ -56,17 +59,19 @@ public class AutomationGatewayImpl implements AutomationGateway {
return automationService
.addDevice(deviceId)
.onItem()
.transform(device -> transformToDeviceRoleState(device, devRoleId));
.transform(device -> transformToDeviceRoleState(device, devRoleId, DeviceState.CREATED));
}
@Override
public Uni<Automation.DeviceRoleState> ztpUpdate(Automation.DeviceRole request) {
return Uni.createFrom()
.item(
() ->
Automation.DeviceRoleState.newBuilder()
.setDevRoleId(request.getDevRoleId())
.build());
public Uni<DeviceRoleState> ztpUpdate(DeviceRoleConfig request) {
final var devRoleId = request.getDevRole().getDevRoleId().getDevRoleId().getUuid();
final var deviceId = serializer.deserialize(request.getDevRole().getDevRoleId().getDevId());
final var deviceConfig = serializer.deserialize(request.getDevConfig());
return automationService
.updateDevice(deviceId, deviceConfig)
.onItem()
.transform(device -> transformToDeviceRoleState(device, devRoleId, DeviceState.UPDATED));
}
@Override
......@@ -84,16 +89,15 @@ public class AutomationGatewayImpl implements AutomationGateway {
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) {
private Automation.DeviceRoleState transformToDeviceRoleState(
Device device, String devRoleId, DeviceState deviceState) {
final var deviceRoleId = new DeviceRoleId(devRoleId, device.getDeviceId());
final var serializeDeviceRoleId = serializer.serialize(deviceRoleId);
final var serializedDeviceState = serializer.serialize(deviceState);
return Automation.DeviceRoleState.newBuilder()
.setDevRoleId(serializeDeviceRoleId)
.setDevRoleState(Automation.ZtpDeviceState.ZTP_DEV_STATE_CREATED)
.setDevRoleState(serializedDeviceState)
.build();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment