Commit 9acbab5e authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'feat/370-cttc-fix-ofc25-test' into 'develop'

Resolve "(CTTC) Fix OFC25 test"

See merge request !426
parents 6559fa42 d53fbe40
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -61,7 +61,8 @@ function kfk_deploy_single() {
    else
        echo ">>> Deploy Kafka"
        cp "${KFK_MANIFESTS_PATH}/single-node.yaml" "${TMP_MANIFESTS_FOLDER}/kfk_single_node.yaml"
        #sed -i "s/<KFK_NAMESPACE>/${KFK_NAMESPACE}/" "${TMP_MANIFESTS_FOLDER}/kfk_single_node.yaml"
        # Set the correct advertised listeners based on the namespace
        sed -i "s|kafka-service\.kafka\.svc\.cluster\.local|kafka-service.${KFK_NAMESPACE}.svc.cluster.local|g" "${TMP_MANIFESTS_FOLDER}/kfk_single_node.yaml"
        kubectl --namespace ${KFK_NAMESPACE} apply -f "${TMP_MANIFESTS_FOLDER}/kfk_single_node.yaml"

        echo ">>> Waiting Kafka statefulset to be created..."
+40 −25
Original line number Diff line number Diff line
@@ -15,10 +15,39 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: tfs-ingress
  name: tfs-ingress-web
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: "/$2"

    nginx.ingress.kubernetes.io/use-regex: "true"
    nginx.ingress.kubernetes.io/limit-rps: "50"             # max requests per second per source IP
    nginx.ingress.kubernetes.io/limit-connections: "50"     # max concurrent connections per source IP
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "60" # max timeout for connecting to server
    nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"  # max timeout between two successive read operations
    nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"  # max timeout between two successive write operations
spec:
  rules:
    - http:
        paths:
          - path: /webui(/|$)(.*)
            pathType: ImplementationSpecific
            backend:
              service:
                name: webuiservice
                port:
                  number: 8004
          - path: /grafana(/|$)(.*)
            pathType: ImplementationSpecific
            backend:
              service:
                name: webuiservice
                port:
                  number: 3000
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: tfs-ingress-nbi
  annotations:
    # Enable websocket services and configure sticky cookies (seems not to work)
    #nginx.org/websocket-services: "nbiservice"
    #nginx.org/sticky-cookie-services: "serviceName=nbiservice tfs-nbi-session expires=1h path=/socket.io"
@@ -43,77 +72,63 @@ spec:
  rules:
    - http:
        paths:
          - path: /webui(/|$)(.*)
            pathType: Prefix
            backend:
              service:
                name: webuiservice
                port:
                  number: 8004
          - path: /grafana(/|$)(.*)
            pathType: Prefix
            backend:
              service:
                name: webuiservice
                port:
                  number: 3000
          - path: /()(.well-known/.*)
          - path: /.well-known
            pathType: Prefix
            backend:
              service:
                name: nbiservice
                port:
                  number: 8080
          - path: /()(restconf/.*)
          - path: /restconf
            pathType: Prefix
            backend:
              service:
                name: nbiservice
                port:
                  number: 8080
          - path: /()(socket.io/.*)
          - path: /socket.io
            pathType: Prefix
            backend:
              service:
                name: nbiservice
                port:
                  number: 8080
          - path: /()(tfs-api/.*)
          - path: /tfs-api
            pathType: Prefix
            backend:
              service:
                name: nbiservice
                port:
                  number: 8080
          - path: /()(bmw/.*)
          - path: /bmw
            pathType: Prefix
            backend:
              service:
                name: nbiservice
                port:
                  number: 8080
          - path: /()(qkd_app/.*)
          - path: /qkd_app
            pathType: Prefix
            backend:
              service:
                name: nbiservice
                port:
                  number: 8080
          - path: /()(camara/.*)
          - path: /camara
            pathType: Prefix
            backend:
              service:
                name: nbiservice
                port:
                  number: 8080
          - path: /()(agent-probes/.*)
          - path: /agent-probes
            pathType: Prefix
            backend:
              service:
                name: nbiservice
                port:
                  number: 8080
          - path: /()(osm-api/.*)
          - path: /osm-api
            pathType: Prefix
            backend:
              service:
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ export IP_CONTEXT
echo "Context Service IP: ${IP_CONTEXT}"

# Start Kafka port-forward in background
kubectl port-forward -n kafka service/kafka-public 9094:9094 > /dev/null 2>&1 &
kubectl port-forward -n kafka service/kafka-service 9094:9094 > /dev/null 2>&1 &
KAFKA_PF_PID=$!

# Function to cleanup port-forward on exit
+13 −9
Original line number Diff line number Diff line
@@ -13,12 +13,15 @@
# limitations under the License.


from common.method_wrappers.ServiceExceptions import InvalidArgumentsException
from context.client.ContextClient import ContextClient
import logging
from typing import Optional, Union
from uuid import UUID, uuid4, uuid5
from common.method_wrappers.ServiceExceptions import InvalidArgumentsException
from common.proto.context_pb2 import OpticalBand, OpticalBandId, Empty
from context.client.ContextClient import ContextClient

LOGGER = logging.getLogger(__name__)

# Generate a UUIDv5-like from the SHA-1 of "TFS" and no namespace to be used as the NAMESPACE for all
# the context UUIDs generated. For efficiency purposes, the UUID is hardcoded; however, it is produced
# using the following code:
@@ -98,8 +101,7 @@ def ob_get_uuid(



def find_optical_band (ob_index)->OpticalBand:

def find_optical_band(ob_index) -> Optional[OpticalBand]:
    op_uuid = ob_get_uuid(ob_index)
    op_id = OpticalBandId()
    op_id.opticalband_uuid.uuid = op_uuid
@@ -107,5 +109,7 @@ def find_optical_band (ob_index)->OpticalBand:
        ctxt = ContextClient()
        target_ob = ctxt.SelectOpticalBand(op_id)
        return target_ob
    except Exception as e : 
            logging.debug(f"error in finding optical band {e}")
    except Exception:
        MSG = 'Unable to find OpticalBand({:s}/{:s}) in Context'
        LOGGER.exception(MSG.format(str(ob_index), str(op_uuid)))
        return None
+3 −8
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ class KafkaConfig(Enum):
            KFK_NAMESPACE = get_setting('KFK_NAMESPACE',   default='kafka')
            KFK_PORT      = get_setting('KFK_SERVER_PORT', default='9092')
            kafka_server_address = KFK_SERVER_ADDRESS_TEMPLATE.format(KFK_NAMESPACE, KFK_PORT)
            LOGGER.debug('KFK_SERVER_ADDRESS not set, using default: {:s}'.format(kafka_server_address))
        LOGGER.debug('Using KFK_SERVER_ADDRESS={:s}'.format(kafka_server_address))
        return kafka_server_address

    @staticmethod
@@ -133,10 +135,3 @@ class KafkaTopic(Enum):
        else:
            LOGGER.debug('All topics created and available.')
            return True


if __name__ == '__main__':
    import os
    if 'KFK_SERVER_ADDRESS' not in os.environ:
        os.environ['KFK_SERVER_ADDRESS'] = 'kafka-service.kafka.svc.cluster.local:9092'
    KafkaTopic.create_all_topics()
Loading