Commit 54bdc26e authored by Pablo Armingol's avatar Pablo Armingol
Browse files

code clean up

parent 84e08b59
Loading
Loading
Loading
Loading
+7 −11
Original line number Diff line number Diff line
@@ -27,20 +27,20 @@ spec:
      labels:
        app: bgpls-speakerservice
    spec:
      hostNetwork: true  # ← CLAVE: Usa la red del nodo host
      dnsPolicy: ClusterFirstWithHostNet  # ← Importante para DNS
      hostNetwork: true
      dnsPolicy: ClusterFirstWithHostNet
      terminationGracePeriodSeconds: 5
      containers:
        - name: server
          image: localhost:32000/tfs/bgpls_speaker:dev
          imagePullPolicy: Always
          ports:
            - containerPort: 12179  # ← Netphony BGP-LS (interno)
            - containerPort: 20030  # ← Módulo Python gRPC (TFS)
            - containerPort: 9192   # ← Métricas
            - containerPort: 12179
            - containerPort: 20030
            - containerPort: 9192
          env:
            - name: LOG_LEVEL
              value: "DEBUG"
              value: "INFO"
          readinessProbe:
            exec:
              command: ["/bin/grpc_health_probe", "-addr=:20030"]
@@ -54,12 +54,9 @@ spec:
            limits:
              cpu: 1000m
              memory: 1024Mi
          # AÑADIDO PARA EL JSON (Conecta la carpeta interna) 
          volumeMounts:
            - name: shared-te-data
              mountPath: /var/teraflow/shared_te_data
          
      # AÑADIDO PARA EL JSON (Apunta a la carpeta de Ubuntu del NBI)
      volumes:
        - name: shared-te-data
          hostPath:
@@ -86,4 +83,3 @@ spec:
      protocol: TCP
      port: 9192
      targetPort: 9192
    
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ metadata:
  namespace: metallb-system
spec:
  addresses:
    - 192.168.165.200-192.168.165.210  # <-- Change this to match your network
    - 192.168.5.250-192.168.5.251  # <-- Change this to match your network
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
+8 −9
Original line number Diff line number Diff line
@@ -35,9 +35,9 @@ message DiscoveredDevice {
  int32 sid = 4;
  repeated DiscoveredTerminationPoint termination_points = 5;
  string areaID = 6;
  string prefixSid = 7;     // Loopback
  string sid_index = 8;      // El INDEX (ej. 4)
  int32 sid_label = 9;      // La BASE (ej. 18500)
  string prefixSid = 7;
  string sid_index = 8;
  int32 sid_label = 9;
  uint32 identifier = 10;
}

@@ -70,7 +70,6 @@ message NodeDescriptors{
	string igp_id   = 2;
  string nodeName = 3;
  string ipv4_address = 4;
  //NEW
  int32 sid_index = 5;
  int32 sid_label = 6;
  string area_id = 7;
+2 −3
Original line number Diff line number Diff line
@@ -51,7 +51,6 @@ class BgplsClient:
    def ListDiscoveredDevices(self, request: Empty) -> DiscoveredDeviceList:
        LOGGER.info('ListDiscoveredDevices request: {:s}'.format(grpc_message_to_json_string(request)))
        response = self.stub.ListDiscoveredDevices(request)
        # LOG DE DEPURACIÓN: Verificamos si el SID viene en la respuesta gRPC
        for dev in response.discovereddevices:
            LOGGER.info('DEBUG: Nodo %s tiene SID: %s', dev.nodeName, dev.sid)
        LOGGER.info('ListDiscoveredDevices result: {:s}'.format(grpc_message_to_json_string(response)))
+14 −21
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ public class grpcClient {
            return;
        }

        // 1. Construcción de Nodes
        if (update.nodeCheck() != false) {
            for (NodeNLRIMsg node : update.getNodeList()) {
                nodeInfo n = nodeInfo.newBuilder()
@@ -68,7 +67,6 @@ public class grpcClient {
            }
        }

        // 2. Construcción de Links
        for (LinkNLRIMsg link : update.getLinkList()) {
            String strIgpR = (link.getRemoteNodeIGPId() == null) ? "-" : link.getRemoteNodeIGPId().toString();
            String strIgpL = (link.getLocalNodeIGPId() == null) ? "-" : link.getLocalNodeIGPId().toString();
@@ -76,9 +74,9 @@ public class grpcClient {
            String ipv4L = (link.getiPv4RouterIDNeighborNodeLATLV() == null) ? "-" : link.getiPv4RouterIDNeighborNodeLATLV();

            linkInfo unic = linkInfo.newBuilder()
                .setLocalID(strIgpL) // Corregido: Local con Local
                .setLocalID(strIgpL)
                .setLocalIPv4ID(ipv4L)
                .setRemoteID(strIgpR) // Corregido: Remote con Remote
                .setRemoteID(strIgpR)
                .setRemoteIPv4ID(ipv4R)
                .setLocal(NodeDescriptors.newBuilder()
                    .setAsNumber(link.getLocalDomainID() != null ? link.getLocalDomainID().toString() : "0")
@@ -100,13 +98,10 @@ public class grpcClient {
            l.add(unic);
        }

        // 3. Construcción de Prefixes 
        int lastIdentifier = 0;
        for (PrefixInfo pref : update.getPrefixList()) {
            // 1. Primero extraemos el ID (fuera del Builder)
            String sourceRouterId = (pref.getIgpId() != null) ? pref.getIgpId() : "";

            // 2. Ahora construimos el objeto gRPC usando la variable ya definida
            prefixInfo p = prefixInfo.newBuilder()
                .setPrefix(pref.getPrefix())
                .setPrefixSid(pref.getPrefixSid())
@@ -123,7 +118,6 @@ public class grpcClient {
                        " | Identifier: " + pref.getIdentifier());
        }

        // 4. Construcción de la Request final
        updateRequest.Builder requestBuilder = updateRequest.newBuilder()
            .setNextHop(update.getNextHop() != null ? update.getNextHop().toString() : "-")
            .setAddressFamilyID(String.valueOf(update.getAFI()))
@@ -136,7 +130,6 @@ public class grpcClient {

        updateRequest request = requestBuilder.build();

        // Configuración del canal gRPC
        final ManagedChannel channel = NettyChannelBuilder
            .forAddress(new InetSocketAddress("127.0.0.1", 2021))
            .directExecutor()
Loading