Commit 39b9f3f9 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Several changes:

- Initial (unfinished) version of Slice component
- Factorized and improved check methods from "device" and "service" components to align with "slice" component
parent f2287700
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -15,5 +15,6 @@ include:
  - local: '/src/context/.gitlab-ci.yml'
  - local: '/src/device/.gitlab-ci.yml'
  - local: '/src/service/.gitlab-ci.yml'
  #- local: '/src/slice/.gitlab-ci.yml'
  - local: '/src/tester_integration/.gitlab-ci.yml'
  - local: '/src/tester_functional/.gitlab-ci.yml'
+54 −0
Original line number Diff line number Diff line
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sliceservice
spec:
  selector:
    matchLabels:
      app: sliceservice
  template:
    metadata:
      labels:
        app: sliceservice
    spec:
      terminationGracePeriodSeconds: 5
      containers:
      - name: server
        image: registry.gitlab.com/teraflow-h2020/controller/slice:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 4040
        env:
        - name: DB_ENGINE
          value: "redis"
        - name: REDIS_DATABASE_ID
          value: "0"
        - name: LOG_LEVEL
          value: "DEBUG"
        readinessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:4040"]
        livenessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:4040"]
        resources:
          requests:
            cpu: 250m
            memory: 512Mi
          limits:
            cpu: 700m
            memory: 1024Mi
---
apiVersion: v1
kind: Service
metadata:
  name: sliceservice
spec:
  type: ClusterIP
  selector:
    app: sliceservice
  ports:
  - name: grpc
    protocol: TCP
    port: 4040
    targetPort: 4040
+3 −0
Original line number Diff line number Diff line
#!/bin/bash

./report_coverage_all.sh | grep --color -E -i "^slice/.*$|$"
+3 −0
Original line number Diff line number Diff line
@@ -22,6 +22,9 @@ coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    service/tests/test_unitary.py

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

# Run integration tests and analyze coverage of code at same time
export DB_ENGINE='redis'
export REDIS_SERVICE_HOST='10.1.7.194'
+31 −0
Original line number Diff line number Diff line
from enum import Enum

class SliceStatus(Enum):
    PLANNED = 0
    INIT    = 1
    ACTIVE  = 2
    DEINIT  = 3

ANY_TO_ENUM = {
    0: SliceStatus.PLANNED,
    1: SliceStatus.INIT,
    2: SliceStatus.ACTIVE,
    3: SliceStatus.DEINIT,

    '0': SliceStatus.PLANNED,
    '1': SliceStatus.INIT,
    '2': SliceStatus.ACTIVE,
    '3': SliceStatus.DEINIT,

    'planned': SliceStatus.PLANNED,
    'init': SliceStatus.INIT,
    'active': SliceStatus.ACTIVE,
    'deinit': SliceStatus.DEINIT,
}

def slicestatus_enum_values():
    return {m.value for m in SliceStatus.__members__.values()}

def to_slicestatus_enum(int_or_str):
    if isinstance(int_or_str, str): int_or_str = int_or_str.lower()
    return ANY_TO_ENUM.get(int_or_str)
Loading