Commit 28d1efe9 authored by Mohammad Ismaeel's avatar Mohammad Ismaeel
Browse files

set service route bugs fixed

parent 44ac2cd0
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -37,25 +37,27 @@ slice_client = SliceClient()

@service.route('/set_service', methods = ['POST'])
def set_service () : 
    
    service_json = request.json
    _services= service_json.get('services',[])
    _add_services= get_descriptors_add_services(_services) 
    services_ids= []
    logging.info(f"set_service called {_services}")
    logging.info(f"_add_services  {_add_services}")
    
    try : 
        for service in _add_services: 
            try : 
                service_client.connect()
                service = ParseDict(service, Service())
                service_client.CreateService(service)
                #service = ParseDict(service, Service())
                service_client.CreateService(Service(**service))
                
            except Exception as e : 
                logging.info(f"error in creating service {e}") 
                return make_response(f'error !! {e}' ,400)  
        for service in _services : 
            try : 
                service = ParseDict(service, Service())
                service_id = service_client.UpdateService(service)
              
                service_id = service_client.UpdateService(Service(**service))
                if isinstance(service_id, ServiceId):
                    service_uuid = service_id.service_uuid.uuid    
                    service_id=service_uuid
+2 −2
Original line number Diff line number Diff line
@@ -88,9 +88,9 @@ def service_composer (service_json,context_client) :
                    if name['value-name'] == 'service-type' :
                        composed_service['type'] = name['value'] 
        if service['connection'][0]['direction'] == 'BIDIRECTIONAL' :
            composed_service['bidirectionality'] = 1
            composed_service['bidirectionality'] = '1'
        else :
            composed_service['bidirectionality'] = 0
            composed_service['bidirectionality'] = '0'
        topology_src= get_topology_uuid(composed_service['src_dev'],context_client) 
        topology_dst= get_topology_uuid(composed_service['dst_dev'],context_client)
        if topology_src and topology_dst  and topology_src[2] == topology_dst[2] :