Commit f5e60f2f authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'feat/pathcomp-component' into 'develop'

Preliminary non-functional version of PathComp component

See merge request teraflow-h2020/controller!123
parents c7ce67d9 ae6bc78b
Loading
Loading
Loading
Loading
+64 −0
Original line number Diff line number Diff line
# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: pathcompservice
spec:
  selector:
    matchLabels:
      app: pathcompservice
  template:
    metadata:
      labels:
        app: pathcompservice
    spec:
      terminationGracePeriodSeconds: 5
      containers:
      - name: server
        image: registry.gitlab.com/teraflow-h2020/controller/pathcomp:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 10020
        env:
        - name: LOG_LEVEL
          value: "INFO"
        readinessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:10020"]
        livenessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:10020"]
        resources:
          requests:
            cpu: 250m
            memory: 512Mi
          limits:
            cpu: 700m
            memory: 1024Mi
---
apiVersion: v1
kind: Service
metadata:
  name: pathcompservice
spec:
  type: ClusterIP
  selector:
    app: pathcompservice
  ports:
  - name: grpc
    protocol: TCP
    port: 10020
    targetPort: 10020

proto/pathcomp.proto

0 → 100644
+48 −0
Original line number Diff line number Diff line
// Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";
package pathcomp;

import "context.proto";

service PathCompService {
  rpc Compute(PathCompRequest) returns (PathCompReply) {}
}

message Algorithm_ShortestPath {}

message Algorithm_KShortestPath {
  uint32 k_inspection = 1;
  uint32 k_return     = 2;
}

message PathCompRequest {
  repeated context.Service services = 1;
  oneof algorithm {
    Algorithm_ShortestPath  shortest_path   = 10;
    Algorithm_KShortestPath k_shortest_path = 11;
  }
}

message PathCompReply {
  // Services requested completed with possible missing fields, and
  // sub-services required for supporting requested services on the
  // underlying layers.
  repeated context.Service services = 1;

  // Connections supporting the requested services and sub-services
  // required for the underlying layers.
  repeated context.Connection connections = 2;
}
+17 −0
Original line number Diff line number Diff line
#!/bin/bash
# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


./report_coverage_all.sh | grep --color -E -i "^pathcomp/.*$|$"
+28 −0
Original line number Diff line number Diff line
#!/bin/bash
# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


PROJECTDIR=`pwd`

cd $PROJECTDIR/src
RCFILE=$PROJECTDIR/coverage/.coveragerc

# Run unitary tests and analyze coverage of code at same time

# Useful flags for pytest:
#-o log_cli=true -o log_file=service.log -o log_file_level=DEBUG

coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    pathcomp/tests/test_unitary.py
+3 −0
Original line number Diff line number Diff line
@@ -97,3 +97,6 @@ coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \

coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    slice/tests/test_unitary.py

coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    pathcomp/tests/test_unitary.py
Loading