Commit eff8e196 authored by Maria Ruiz's avatar Maria Ruiz
Browse files

SHAPERA

parent e24489dd
Loading
Loading
Loading
Loading
+32 −1
Original line number Diff line number Diff line
@@ -46,6 +46,8 @@ class SAT_NMS:
            num_service = new_service.get("reply",{}).get("%row")
            #mapeo QoS:
            if QoS_profile == "A":
                shaperA = json_data.get("bandwidth", None)
                self.shaper(self.satnms_ip, QoS_profile, None, None, shaperA)
                qos_mapped = "qos:0 QoS_P7" 
                if cirB_lim is not None or cirC_lim is not None:
                    self.shaper(self.satnms_ip, QoS_profile, cirC_lim, cirB_lim) 
@@ -265,7 +267,7 @@ class SAT_NMS:
                validation = "error"
                return validation

    def shaper(self,ip,profile, shaperC, shaperB):
    def shaper(self,ip,profile, shaperC, shaperB, shaperA):
        

       #primero hay que modificar el valor del max_cir en el shaper y luego asignarlo al el perfil de QoS
@@ -391,6 +393,35 @@ class SAT_NMS:
                
        elif profile == "A":

            if shaperA is not None:

                session = self.loggin_NMS(ip)
                if session is None:
                    print("No se pudo iniciar sesion en el NMS")
                    return None
                shaperC = shaperC*1000  #convertimos a Kbps
                url = "http://"+ip+":8000/api/object/write/shaper=1"
                body_dict = {
                    "max_cir": shaperA,
                    "cir": shaperA
                }
                payload = json.dumps(body_dict)
                response = requests.post(url, cookies=session, auth=('admin', '12345'), data=payload)

                url = "http://"+ip+":8000/api/object/write/qos=3"
                body_dict = {
                "shaper": "shaper:3 shaperA"
                }
                payload = json.dumps(body_dict)
                response = requests.post(url, cookies=session, auth=('admin', '12345'), data=payload)
                error_code = response.json().get("error_code",None)

                session = self.loggin_NMS(ip)
                if session is None:
                    print("No se pudo iniciar sesion en el NMS")
                    return None


            if shaperC is not None and shaperC !=0:

                session = self.loggin_NMS(ip)