Commit 1b2a5bb9 authored by Sergio Gonzalez Diaz's avatar Sergio Gonzalez Diaz
Browse files

Merge branch 'feat/monitoring-service' into 'develop'

Merge monitoring-service to develop

See merge request teraflow-h2020/controller!28
parents 6c271dfe 9b2e2340
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -148,3 +148,6 @@ cython_debug/

# Other
/tmp

# Sqlite
*.db
+8 −8
Original line number Diff line number Diff line
@@ -10,11 +10,11 @@ stages:

# include the individual .gitlab-ci.yml of each micro-service
include: 
  - local: '/manifests/.gitlab-ci.yml'
  #- local: '/src/monitoring/.gitlab-ci.yml'
  - local: '/src/centralizedattackdetector/.gitlab-ci.yml'
  - local: '/src/context/.gitlab-ci.yml'
  - local: '/src/device/.gitlab-ci.yml'
  - local: '/src/service/.gitlab-ci.yml'
  - local: '/src/tester_integration/.gitlab-ci.yml'
  - local: '/src/tester_functional/.gitlab-ci.yml'
  # - local: '/manifests/.gitlab-ci.yml'
  - local: '/src/monitoring/.gitlab-ci.yml'
  # - local: '/src/centralizedattackdetector/.gitlab-ci.yml'
  # - local: '/src/context/.gitlab-ci.yml'
  # - local: '/src/device/.gitlab-ci.yml'
  # - local: '/src/service/.gitlab-ci.yml'
  # - local: '/src/tester_integration/.gitlab-ci.yml'
  # - local: '/src/tester_functional/.gitlab-ci.yml'
+36 −10
Original line number Diff line number Diff line
@@ -6,26 +6,49 @@ spec:
  selector:
    matchLabels:
      app: monitoring
  replicas: 1
  template:
    metadata:
      labels:
        app: monitoring
    spec:
      terminationGracePeriodSeconds: 5
      restartPolicy: Always
      containers:
      - name: influxdb
        image: influxdb:1.8
        ports:
        - containerPort: 8086
        envFrom:
          - secretRef:
              name: influxdb-secrets
        readinessProbe:
          exec:
            command: ["curl", "-XGET", "localhost:8086/health"]
        livenessProbe:
          exec:
            command: ["curl", "-XGET", "localhost:8086/health"]
        resources:
          requests:
            cpu: 250m
            memory: 512Mi
          limits:
            cpu: 700m
            memory: 1024Mi
      - name: server
        image: registry.gitlab.com/teraflow-h2020/controller/monitoring:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
        env:
        - name: PORT
          value: "8080"
        - containerPort: 7070
        envFrom:
          - secretRef:
              name: monitoring-secrets
        readinessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:8080"]
            command: ["/bin/grpc_health_probe", "-addr=:7070"]
        livenessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:8080"]
            command: ["/bin/grpc_health_probe", "-addr=:7070"]
        resources:
          requests:
            cpu: 250m
@@ -33,8 +56,6 @@ spec:
          limits:
            cpu: 700m
            memory: 1024Mi
      imagePullSecrets:
      - name: regcred
---
apiVersion: v1
kind: Service
@@ -47,5 +68,10 @@ spec:
  ports:
  - name: grpc
    protocol: TCP
    port: 8080
    targetPort: 8080
    port: 7070
    targetPort: 7070
  - name: influxdb
    protocol: TCP
    port: 8086
    targetPort: 8086
---
 No newline at end of file
+44 −5
Original line number Diff line number Diff line
@@ -5,17 +5,51 @@ package monitoring;
import "context.proto";

service MonitoringService {
  rpc IncludeKpi (Kpi) returns (context.Empty) {}
  rpc MonitorKpi ( KpiDevice ) returns (context.Empty) {}
  rpc CreateKpi (CreateKpiRequest) returns (KpiId) {}
  rpc IncludeKpi (IncludeKpiRequest) returns (context.Empty) {}
  rpc MonitorKpi (MonitorKpiRequest) returns (context.Empty) {}
  rpc MonitorDeviceKpi (MonitorDeviceKpiRequest) returns (context.Empty) {}
  rpc GetStreamKpi ( KpiId ) returns (stream Kpi) {}
  rpc GetInstantKpi ( KpiId ) returns (Kpi) {}
}

message CreateKpiRequest{
  string kpiDescription = 1;
  context.DeviceId device_id = 2;
  KpiSampleType kpi_sample_type = 3;
//  context.EndpointId endpoint_id = 4;  // others might be added
//  context.ServiceId  service_id  = 5;  // for monitoring other
//  context.SliceId    slice_id    = 6;  // entities
}

message MonitorKpiRequest{
  KpiId kpi_id = 1;
  uint32 connexion_time_s = 2;
  uint32 sample_rate_ms = 3;
}

message MonitorDeviceKpiRequest{
  Kpi kpi = 1;
  uint32 connexion_time_s = 2;
  uint32 sample_rate_ms = 3;
}

message IncludeKpiRequest{
    KpiId kpi_id = 1;
    string time_stamp = 2;
    KpiValue kpi_value= 3;
}

message Kpi {
  KpiId kpi_id = 1;
  string timestamp = 2;
  string kpiDescription = 3;
  KpiValue kpi_value = 4;
  KpiSampleType kpi_sample_type = 5;
  context.DeviceId device_id = 6;
//  context.EndpointId endpoint_id = 7;  // others might be added
//  context.ServiceId  service_id  = 8;  // for monitoring other
//  context.SliceId    slice_id    = 9;  // entities
}

message KpiId {
@@ -27,13 +61,18 @@ message KpiDevice {
  context.DeviceId device_id = 2;
}


enum KpiSampleType {
    UNKNOWN = 0;
    PACKETS_TRANSMITTED = 101;  // others might be added for
    PACKETS_RECEIVED    = 102;  // packet, optical, radio,...
    BYTES_TRANSMITTED   = 201;
    BYTES_RECEIVED      = 202;
}

message KpiList {
  repeated Kpi kpiList = 1;
}


message KpiValue {
  oneof value {
    uint32 intVal = 1;

proto/src/attack_mitigator_pb2.py

deleted100644 → 0
+0 −186
Original line number Diff line number Diff line
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: attack_mitigator.proto

import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)

_sym_db = _symbol_database.Default()


import context_pb2 as context__pb2


DESCRIPTOR = _descriptor.FileDescriptor(
  name='attack_mitigator.proto',
  package='attack_mitigator',
  syntax='proto3',
  serialized_options=None,
  serialized_pb=_b('\n\x16\x61ttack_mitigator.proto\x12\x10\x61ttack_mitigator\x1a\rcontext.proto\"t\n\x11\x41ttackDescription\x12\x1c\n\x05\x63s_id\x18\x01 \x01(\x0b\x32\r.context.Uuid\x12\x11\n\tattack_id\x18\x02 \x01(\x05\x12\x12\n\nconfidence\x18\x03 \x01(\x02\x12\x1a\n\x12\x61ttack_description\x18\x04 \x01(\t\"\xa2\x01\n\x0e\x41ttackResponse\x12\x1c\n\x05\x63s_id\x18\x01 \x01(\x0b\x32\r.context.Uuid\x12\x11\n\tattack_id\x18\x02 \x01(\x05\x12\x1a\n\x12\x61ttack_description\x18\x03 \x01(\t\x12\x1c\n\x14response_strategy_id\x18\x04 \x01(\x05\x12%\n\x1dresponse_strategy_description\x18\x05 \x01(\t2j\n\x0f\x41ttackMitigator\x12W\n\x0cNotifyAttack\x12#.attack_mitigator.AttackDescription\x1a .attack_mitigator.AttackResponse\"\x00\x62\x06proto3')
  ,
  dependencies=[context__pb2.DESCRIPTOR,])




_ATTACKDESCRIPTION = _descriptor.Descriptor(
  name='AttackDescription',
  full_name='attack_mitigator.AttackDescription',
  filename=None,
  file=DESCRIPTOR,
  containing_type=None,
  fields=[
    _descriptor.FieldDescriptor(
      name='cs_id', full_name='attack_mitigator.AttackDescription.cs_id', index=0,
      number=1, type=11, cpp_type=10, label=1,
      has_default_value=False, default_value=None,
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      serialized_options=None, file=DESCRIPTOR),
    _descriptor.FieldDescriptor(
      name='attack_id', full_name='attack_mitigator.AttackDescription.attack_id', index=1,
      number=2, type=5, cpp_type=1, label=1,
      has_default_value=False, default_value=0,
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      serialized_options=None, file=DESCRIPTOR),
    _descriptor.FieldDescriptor(
      name='confidence', full_name='attack_mitigator.AttackDescription.confidence', index=2,
      number=3, type=2, cpp_type=6, label=1,
      has_default_value=False, default_value=float(0),
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      serialized_options=None, file=DESCRIPTOR),
    _descriptor.FieldDescriptor(
      name='attack_description', full_name='attack_mitigator.AttackDescription.attack_description', index=3,
      number=4, type=9, cpp_type=9, label=1,
      has_default_value=False, default_value=_b("").decode('utf-8'),
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      serialized_options=None, file=DESCRIPTOR),
  ],
  extensions=[
  ],
  nested_types=[],
  enum_types=[
  ],
  serialized_options=None,
  is_extendable=False,
  syntax='proto3',
  extension_ranges=[],
  oneofs=[
  ],
  serialized_start=59,
  serialized_end=175,
)


_ATTACKRESPONSE = _descriptor.Descriptor(
  name='AttackResponse',
  full_name='attack_mitigator.AttackResponse',
  filename=None,
  file=DESCRIPTOR,
  containing_type=None,
  fields=[
    _descriptor.FieldDescriptor(
      name='cs_id', full_name='attack_mitigator.AttackResponse.cs_id', index=0,
      number=1, type=11, cpp_type=10, label=1,
      has_default_value=False, default_value=None,
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      serialized_options=None, file=DESCRIPTOR),
    _descriptor.FieldDescriptor(
      name='attack_id', full_name='attack_mitigator.AttackResponse.attack_id', index=1,
      number=2, type=5, cpp_type=1, label=1,
      has_default_value=False, default_value=0,
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      serialized_options=None, file=DESCRIPTOR),
    _descriptor.FieldDescriptor(
      name='attack_description', full_name='attack_mitigator.AttackResponse.attack_description', index=2,
      number=3, type=9, cpp_type=9, label=1,
      has_default_value=False, default_value=_b("").decode('utf-8'),
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      serialized_options=None, file=DESCRIPTOR),
    _descriptor.FieldDescriptor(
      name='response_strategy_id', full_name='attack_mitigator.AttackResponse.response_strategy_id', index=3,
      number=4, type=5, cpp_type=1, label=1,
      has_default_value=False, default_value=0,
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      serialized_options=None, file=DESCRIPTOR),
    _descriptor.FieldDescriptor(
      name='response_strategy_description', full_name='attack_mitigator.AttackResponse.response_strategy_description', index=4,
      number=5, type=9, cpp_type=9, label=1,
      has_default_value=False, default_value=_b("").decode('utf-8'),
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      serialized_options=None, file=DESCRIPTOR),
  ],
  extensions=[
  ],
  nested_types=[],
  enum_types=[
  ],
  serialized_options=None,
  is_extendable=False,
  syntax='proto3',
  extension_ranges=[],
  oneofs=[
  ],
  serialized_start=178,
  serialized_end=340,
)

_ATTACKDESCRIPTION.fields_by_name['cs_id'].message_type = context__pb2._UUID
_ATTACKRESPONSE.fields_by_name['cs_id'].message_type = context__pb2._UUID
DESCRIPTOR.message_types_by_name['AttackDescription'] = _ATTACKDESCRIPTION
DESCRIPTOR.message_types_by_name['AttackResponse'] = _ATTACKRESPONSE
_sym_db.RegisterFileDescriptor(DESCRIPTOR)

AttackDescription = _reflection.GeneratedProtocolMessageType('AttackDescription', (_message.Message,), {
  'DESCRIPTOR' : _ATTACKDESCRIPTION,
  '__module__' : 'attack_mitigator_pb2'
  # @@protoc_insertion_point(class_scope:attack_mitigator.AttackDescription)
  })
_sym_db.RegisterMessage(AttackDescription)

AttackResponse = _reflection.GeneratedProtocolMessageType('AttackResponse', (_message.Message,), {
  'DESCRIPTOR' : _ATTACKRESPONSE,
  '__module__' : 'attack_mitigator_pb2'
  # @@protoc_insertion_point(class_scope:attack_mitigator.AttackResponse)
  })
_sym_db.RegisterMessage(AttackResponse)



_ATTACKMITIGATOR = _descriptor.ServiceDescriptor(
  name='AttackMitigator',
  full_name='attack_mitigator.AttackMitigator',
  file=DESCRIPTOR,
  index=0,
  serialized_options=None,
  serialized_start=342,
  serialized_end=448,
  methods=[
  _descriptor.MethodDescriptor(
    name='NotifyAttack',
    full_name='attack_mitigator.AttackMitigator.NotifyAttack',
    index=0,
    containing_service=None,
    input_type=_ATTACKDESCRIPTION,
    output_type=_ATTACKRESPONSE,
    serialized_options=None,
  ),
])
_sym_db.RegisterServiceDescriptor(_ATTACKMITIGATOR)

DESCRIPTOR.services_by_name['AttackMitigator'] = _ATTACKMITIGATOR

# @@protoc_insertion_point(module_scope)
Loading