Commit 175b0079 authored by Javier Velázquez's avatar Javier Velázquez
Browse files

Fix bugs

Update swagger model
parent f5fcc357
Loading
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -306,6 +306,7 @@ class Api:
            return send_response(
            return send_response(
                True,
                True,
                code=201,
                code=201,
                message="Network Slice created successfully",
                data=result 
                data=result 
            )
            )
        except RuntimeError as e:
        except RuntimeError as e:
@@ -327,7 +328,7 @@ class Api:
            return send_response(
            return send_response(
                True,
                True,
                code=201,
                code=201,
                data="Template created successfully" # Añadir otra data?
                message="Template created successfully"
            )
            )
        except Exception as e:
        except Exception as e:
            # Handle unexpected errors
            # Handle unexpected errors
@@ -375,6 +376,7 @@ class Api:
            return send_response(
            return send_response(
                True,
                True,
                code=201,
                code=201,
                message="Slice created successfully",
                data=result 
                data=result 
            )
            )
        except RuntimeError as e:
        except RuntimeError as e:
@@ -428,7 +430,8 @@ class Api:
            return send_response(
            return send_response(
                True,
                True,
                code=200,
                code=200,
                message="Network slice services updated successfully"
                message="Network slice services updated successfully",
                data=result
            )
            )
        
        
        except ValueError as e:
        except ValueError as e:
+16 −1
Original line number Original line Diff line number Diff line
# src/database/sysrepo_store.py
# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This file is an original contribution from Telefonica Innovación Digital S.L.

import sysrepo
import sysrepo
import logging
import logging


+13 −15
Original line number Original line Diff line number Diff line
@@ -13,15 +13,13 @@
                 "security":"",
                 "security":"",
                 "isolation":"",
                 "isolation":"",
                 "path-constraints":{
                 "path-constraints":{
                    "service-functions":"",
                    "service-functions":{},
                    "diversity":{
                    "diversity":{
                    "diversity":{
                        "diversity-type":""
                        "diversity-type":""
                    }
                    }
                 }
                 }
              }
              }
           }
           }
           }
        ]
        ]
     },
     },
     "slice-service":[
     "slice-service":[
@@ -46,7 +44,7 @@
              "sdp":[
              "sdp":[
                 {
                 {
                    "id": "",
                    "id": "",
                    "geo-location":"",
                    "geo-location":{},
                    "node-id":"",
                    "node-id":"",
                    "sdp-ip-address":"",
                    "sdp-ip-address":"",
                    "tp-ref":"",
                    "tp-ref":"",
@@ -64,11 +62,11 @@
                          }
                          }
                       ]
                       ]
                    },
                    },
                    "incoming-qos-policy":"",
                    "incoming-qos-policy":{},
                    "outgoing-qos-policy":"",
                    "outgoing-qos-policy":{},
                    "sdp-peering":{
                    "sdp-peering":{
                       "peer-sap-id":"",
                       "peer-sap-id":"",
                       "protocols":""
                       "protocols":{}
                    },
                    },
                    "ac-svc-ref":[
                    "ac-svc-ref":[
                       
                       
@@ -91,11 +89,11 @@
                    "status":{
                    "status":{
                       
                       
                    },
                    },
                    "sdp-monitoring":""
                    "sdp-monitoring":{}
                 },
                 },
                 {
                 {
                    "id":"",
                    "id":"",
                    "geo-location":"",
                    "geo-location":{},
                    "node-id":"",
                    "node-id":"",
                    "sdp-ip-address":"",
                    "sdp-ip-address":"",
                    "tp-ref":"",
                    "tp-ref":"",
@@ -113,11 +111,11 @@
                          }
                          }
                       ]
                       ]
                    },
                    },
                    "incoming-qos-policy":"",
                    "incoming-qos-policy":{},
                    "outgoing-qos-policy":"",
                    "outgoing-qos-policy":{},
                    "sdp-peering":{
                    "sdp-peering":{
                       "peer-sap-id":"",
                       "peer-sap-id":"",
                       "protocols":""
                       "protocols":{}
                    },
                    },
                    "ac-svc-ref":[
                    "ac-svc-ref":[
                       
                       
@@ -140,7 +138,7 @@
                    "status":{
                    "status":{
                       
                       
                    },
                    },
                    "sdp-monitoring":""
                    "sdp-monitoring":{}
                 }
                 }
              ]
              ]
           },
           },
@@ -151,7 +149,7 @@
                    "connectivity-type":"ietf-vpn-common:any-to-any",
                    "connectivity-type":"ietf-vpn-common:any-to-any",
                    "connectivity-construct":[
                    "connectivity-construct":[
                       {
                       {
                          "id":1,
                          "id":"1",
                          "a2a-sdp":[
                          "a2a-sdp":[
                             {
                             {
                                "sdp-id":"01"
                                "sdp-id":"01"
+1 −2
Original line number Original line Diff line number Diff line
@@ -51,8 +51,7 @@ def build_response(intent, response, controller_type = None):
    id = safe_get(intent, ["ietf-network-slice-service:network-slice-services","slice-service",0,"id"])
    id = safe_get(intent, ["ietf-network-slice-service:network-slice-services","slice-service",0,"id"])
    source = safe_get(intent, ["ietf-network-slice-service:network-slice-services","slice-service",0,"sdps","sdp",0,"id"])
    source = safe_get(intent, ["ietf-network-slice-service:network-slice-services","slice-service",0,"sdps","sdp",0,"id"])
    destination = safe_get(intent, ["ietf-network-slice-service:network-slice-services","slice-service",0,"sdps","sdp",1,"id"])
    destination = safe_get(intent, ["ietf-network-slice-service:network-slice-services","slice-service",0,"sdps","sdp",1,"id"])
    vlan = safe_get(intent, ["ietf-network-slice-service:network-slice-services","slice-service",0,"sdps","sdp",0,"service-match-criteria","match-criterion",0,"value"])
    vlan = safe_get(intent, ["ietf-network-slice-service:network-slice-services","slice-service",0,"sdps","sdp",0,"service-match-criteria","match-criterion",0,"match-type", 0, "vlan", 0])

    qos_requirements = []
    qos_requirements = []


    # Populate response with QoS requirements and VLAN from intent
    # Populate response with QoS requirements and VLAN from intent
+1 −1
Original line number Original line Diff line number Diff line
@@ -383,7 +383,7 @@ def search():


            source_ip = sdp[0]["sdp-ip-address"]
            source_ip = sdp[0]["sdp-ip-address"]
            dest_ip = sdp[1]["sdp-ip-address"]
            dest_ip = sdp[1]["sdp-ip-address"]
            vlan = sdp[0]["service-match-criteria"]["match-criterion"][0]["value"]
            vlan = sdp[0]["service-match-criteria"]["match-criterion"][0]["match-type"][0]["vlan"][0]
            controller = item["controller"]
            controller = item["controller"]


            # Build attributes list
            # Build attributes list
Loading