Commit ac763c70 authored by Alexander Lercher's avatar Alexander Lercher

Added Network Metrics Retrieval microservice

parent a89f5913
FROM python:3
LABEL maintainer="Alexander Lercher"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update
RUN pip install flask
RUN pip install connexion[swagger-ui]
EXPOSE 5000
WORKDIR /app
COPY app/ /app/
RUN chmod a+x main.py
CMD ["python", "./main.py"]
\ No newline at end of file
# Network Metrics Retrieval Microservice
The network metrics retrieval microservice is used as an interface to the provisioning and orchestration platform (CONF). It receives and preprocesses all available metrics and information about the network, like physical locations of virtual machine instances.
## Technologies
- Python 3.x
- Python module Flask
- Python module Connexion with Swagger
- Docker
- Kubernetes
\ No newline at end of file
swagger: "2.0"
info:
title: Network Metrics Retrieval microservice
description: This is the documentation for the network metrics retrieval microservice.
version: "1.0.0"
consumes:
- "application/json"
produces:
- "application/json"
basePath: "/api"
paths:
/debug:
post:
operationId: "debug.echo"
tags:
- "Echo"
summary: "Echo function for debugging purposes"
description: "Echoes the input back to the caller."
parameters:
- in: body
name: "Object"
required: true
schema:
type: object
responses:
200:
description: "Successful echo of request data"
from flask import request
def echo():
return request.json
\ No newline at end of file
import connexion
# load swagger config
app = connexion.App(__name__, specification_dir='configs/')
app.add_api('swagger.yml')
@app.route('/', methods=['GET'])
def api_root():
return 'Endpoint of network-metrics-retrieval-microservice!'
# start app
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True)
apiVersion: apps/v1
kind: Deployment
metadata:
name: network-metrics-retrieval
spec:
replicas: 2
selector:
matchLabels:
app: network-metrics-retrieval
template:
metadata:
labels:
app: network-metrics-retrieval
spec:
containers:
- name: network-metrics-retrieval
image: 172.16.1.20:5000/network-metrics-retrieval-microservice
ports:
- containerPort: 5000
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: network-metrics-retrieval-endpoint
spec:
type: LoadBalancer
externalIPs:
- 143.205.173.36
selector:
app: network-metrics-retrieval
ports:
- name: http
port: 80
targetPort: 5000
nodePort: 30002
protocol: TCP
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment