Commit 81d3827e authored by Mohammad Ismaeel's avatar Mohammad Ismaeel
Browse files

add_children route tapi

parent aaec05ed
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ spec:
    kind: Deployment
    name: contextservice
  minReplicas: 1
  maxReplicas: 20
  maxReplicas: 1
  metrics:
    - type: Resource
      resource:
+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ spec:
          #    command: ["/bin/grpc_health_probe", "-addr=:10060"]
          resources:
            requests:
              cpu: 500m
              cpu: 250m
              memory: 128Mi
            limits:
              cpu: 1000m
+10 −5
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@

import base64, json, logging , os  #, re
import requests
from flask import jsonify, redirect, render_template, Blueprint, flash, session, url_for, request
from flask import jsonify, redirect, render_template, Blueprint, flash, session, url_for, request , make_response
from common.proto.context_pb2 import (ContextList, Empty, TopologyId, TopologyList, Topology)
from common.proto.tapi_pb2 import (ChildTopology)

@@ -89,14 +89,14 @@ def add_children () :
            host = child.get('host',None)
            port = child.get('port',None)
            
            url = ('{}/8008/tapi/topology/get_topology/{}/{}').format(host,context_uuid,topo_uuid) 
            url = ('http://{}:8008/topology/get_topology/{}/{}').format(host,context_uuid,topo_uuid) 
            response = requests.get(url)
            if response.status_code == 200 : 
                logging.info(f"get_child_topo_details {response}")
                logging.info(f"get_child_topo_details {response.json}")
            
                child_topo.topology_id.topology_uuid.uuid = topo_uuid
                child_topo.host = host
                child_topo.port = port 
               
                for dev in response.devices :
                    for en in dev.device_endpoints:
                        endpoints.append({
@@ -107,6 +107,11 @@ def add_children () :
                        })
                child_topo.endpoints.extend(endpoints)
                logging.info(f'child_topo {child_topo}') 
            else : 
                err_respones = make_response(response.text, 400)
                return err_respones 
    else : 
        return 400          
                    
                    
          
 No newline at end of file