Commit 0c6e465d authored by Maria Ruiz's avatar Maria Ruiz
Browse files

corrección de duplicado ddbb

parent a6461e63
Loading
Loading
Loading
Loading
+3 −63
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ class NSController:
    """

    def __init__(self, controller_type = None, tfs_ip=TFS_IP, ixia_ip =IXIA_IP, need_l2vpn_support=TFS_L2VPN_SUPPORT, satnms_ip=SATNMS_IP):  
    #def __init__(self, controller_type = None, tfs_ip=TFS_IP, ixia_ip =IXIA_IP, need_l2vpn_support=TFS_L2VPN_SUPPORT, satnms_ip=SATNMS_IP): 
        """
        Initialize the Network Slice Controller.

@@ -68,7 +67,6 @@ class NSController:
        self.controller_type = controller_type
        self.tfs_ip = tfs_ip
        self.path = ""
        self.path = ""
        self.answer = {}
        self.cool_answer = {}
        self.start_time = 0
@@ -308,20 +306,7 @@ class NSController:
                        tfs_request = self.__realizer(intent)
                        requests["services"].append(tfs_request)
                        logging.info(f"Realizing request: {tfs_request}")
                    if self.controller_type == "sat":
                        viability = self.__mapper(intent)
                        if viability != "error":
                            tfs_request, sat_request = self.__realizer(intent)
                            requests["services"].append(tfs_request)
                            requests2 = {"services":[]}
                            requests2["services"].append(sat_request)
                            logging.info(f"Realizing request to: SAT NMS {tfs_request} and SAT RM {sat_request}")
                        else:
                            logging.info("Slice request cannot be realized due to insufficient satellite resources")
                    else:
                        tfs_request = self.__realizer(intent)
                        requests["services"].append(tfs_request)
                        logging.info(f"Realizing request: {tfs_request}")
           
            else:
                return self.__send_response(False, code=404, message="No intents found")
            
@@ -395,25 +380,6 @@ class NSController:
                        logging.info("Request sent to NTN SDN controller ")
                        sat_sdn.nscSATSDN(intent)



                elif self.controller_type == "sat":
                    sat_nms = SAT_NMS()
                    sat_rm = SAT_RM()
                    for intent in requests["services"]:
                        logging.info("Request sent to SATELLITE NMS")
                        sat_nms.nscSATNMS(intent)
                        logging.info("Request sent to SATELLITE SNO")
                        sat_rm.nscSATRM(intent)
                    
                elif self.controller_type == "sdn":
                    sat_sdn = SAT_SDN()
                    for intent in requests["services"]:
                        logging.info("Request sent to NTN SDN controller ")
                        sat_sdn.nscSATSDN(intent)
                    


            # End performance tracking
            self.end_time = time.perf_counter()
            return self.__send_response(True, code=200)
@@ -532,22 +498,6 @@ class NSController:
                viability = Planner().planner(ietf_intent)
                logging.info(f"Resource allocation : {viability}")

            if self.controller_type == "sat":
                viability = SATPlanner().satplanner(ietf_intent)
                if viability == "error":
                    logging.info(f"Resource allocation : Not enough satellite resources")
                    return viability
                elif viability == "ok":
                    logging.info(f"Resource allocation : Sufficient satellite resources available")
                    return viability 
                else:
                    logging.info(f"Resource allocation : Partial resources available, need to configure shaper with CIR {viability} ")
                    return viability
                 
            else:
                viability = Planner().planner(ietf_intent)
                logging.info(f"Resource allocation : {viability}")

    def __realizer(self, ietf_intent, need_nrp=False, order=None, nrp=None):
        """
        Manage the slice creation workflow.
@@ -960,10 +910,6 @@ class NSController:
            realizing_request_nms, realizing_request_sat = self.__sat(ietf_intent)
        elif controller == "sdn":
            realizing_request = self.__sdn(ietf_intent)
        elif controller == "sat":
            realizing_request_nms, realizing_request_sat = self.__sat(ietf_intent)
        elif controller == "sdn":
            realizing_request = self.__sdn(ietf_intent)
        else:
            logging.warning(f"Unsupported controller: {controller}. Defaulting to TFS L2VPN realization.")
            realizing_request = self.__tfs_l2vpn(ietf_intent)
@@ -973,12 +919,6 @@ class NSController:
        else:
            return realizing_request

       
        """  if controller == "sat":
            return realizing_request_nms, realizing_request_sat
        else:
            return realizing_request """

    def __tfs_l2vpn(self, ietf_intent):
        """
        Translate slice intent into a TeraFlow service request.
+10 −2
Original line number Diff line number Diff line
@@ -8,8 +8,16 @@
            "destination": "STATION",
            "links": {
                "link": [
                  
        
                    {
                        "id": "1",
                        "vlan-id": "106",
                        "slo-profile": "B",
                        "type": "GEO",
                        "bandwidth-Mbps": 100.0,
                        "latency": 250,
                        "FRW_frequency": 1200000,
                        "RTN_frequency": 1338000
                    }
                ]
            }
        }
+4 −0
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@ class SAT_NMS:
        
        logging.info("Processing satellite slice request")

        logging.info("ENTRA EN LA FUNCIÓN:, ********************************************")

        vlan_id = json_data.get("vlan_id", None)
        QoS_profile = json_data.get("QoS_profile", None)
        bandwidth = json_data.get("bandwidth", None)
@@ -340,6 +342,7 @@ class SAT_NMS:
        with open(os.path.join(SRC_PATH, "planner/sat_resources_ddbb.json"), "r") as archivo:
            data = json.load(archivo)
        links = data["satellite-segment-nodes"][0]["links"]["link"]
        logging.info(f"Antes de append, número de links: {len(links)}")
        next_id = len(links) + 1
        new_link = {
            "id": str(next_id),
@@ -352,6 +355,7 @@ class SAT_NMS:
            "RTN_frequency": RTN_frequency     
        }
        links.append(new_link)
        logging.info(f"Después de append, número de links: {len(links)}")
        with open(os.path.join(SRC_PATH, "planner/sat_resources_ddbb.json"), "w") as archivo:
            json.dump(data, archivo, indent=4)      
            logging.info("Database updated with new link")    
 No newline at end of file
+1944 −0

File changed.

Preview size limit exceeded, changes collapsed.

+17 −17
Original line number Diff line number Diff line
@@ -4,14 +4,14 @@
      "slo-sle-templates": {
        "slo-sle-template": [
          {
            "id": "C",
            "id": "B",
            "description": "",
            "slo-policy": {
              "metric-bound": [
                {
                  "metric-type": "one-way-bandwidth",
                  "metric-unit": "kbps",
                  "bound": 2000
                  "bound": 100000
                },
                {
                  "metric-type": "one-way-delay-maximum",
@@ -37,7 +37,7 @@
      },
      "slice-service": [
        {
          "id": "slice-service-a31860cd-3f76-49a1-894b-691ad1317785",
          "id": "slice-service-a7fd01cd-2354-48f8-a524-cfef22f6d5d5",
          "description": "Transport network slice mapped with 3GPP slice NetworkSlice1",
          "service-tags": {
            "tag-type": {
@@ -46,7 +46,7 @@
            }
          },
          "slo-sle-policy": {
            "slo-sle-template": "C"
            "slo-sle-template": "B"
          },
          "status": {},
          "sdps": {
@@ -54,16 +54,16 @@
              {
                "id": "",
                "geo-location": "",
                "node-id": "SCPC-1",
                "sdp-ip-address": "192.168.27.54",
                "node-id": "HUB",
                "sdp-ip-address": "192.168.27.68",
                "tp-ref": "",
                "service-match-criteria": {
                  "match-criterion": [
                    {
                      "index": 1,
                      "match-type": "VLAN",
                      "value": "100",
                      "target-connection-group-id": "SCPC-1_SCPC-2"
                      "value": "106",
                      "target-connection-group-id": "HUB_STATION"
                    }
                  ]
                },
@@ -78,10 +78,10 @@
                  "attachment-circuit": [
                    {
                      "id": "100",
                      "ac-ipv4-address": "192.168.27.54",
                      "ac-ipv4-address": "192.168.27.68",
                      "ac-ipv4-prefix-length": 0,
                      "sdp-peering": {
                        "peer-sap-id": "SCPC-1"
                        "peer-sap-id": "HUB"
                      },
                      "status": {}
                    }
@@ -93,16 +93,16 @@
              {
                "id": "",
                "geo-location": "",
                "node-id": "SCPC-2",
                "sdp-ip-address": "192.168.27.85",
                "node-id": "STATION",
                "sdp-ip-address": "192.168.27.69",
                "tp-ref": "",
                "service-match-criteria": {
                  "match-criterion": [
                    {
                      "index": 1,
                      "match-type": "VLAN",
                      "value": "100",
                      "target-connection-group-id": "SCPC-1_SCPC-2"
                      "value": "106",
                      "target-connection-group-id": "HUB_STATION"
                    }
                  ]
                },
@@ -117,10 +117,10 @@
                  "attachment-circuit": [
                    {
                      "id": "200",
                      "ac-ipv4-address": "192.168.27.85",
                      "ac-ipv4-address": "192.168.27.69",
                      "ac-ipv4-prefix-length": 0,
                      "sdp-peering": {
                        "peer-sap-id": "SCPC-2"
                        "peer-sap-id": "STATION"
                      },
                      "status": {}
                    }
@@ -134,7 +134,7 @@
          "connection-groups": {
            "connection-group": [
              {
                "id": "SCPC-1_SCPC-2",
                "id": "HUB_STATION",
                "connectivity-type": "ietf-vpn-common:point-to-point",
                "connectivity-construct": [
                  {
Loading