func HandleAdmissionControl(c *gin.Context) {

	var controlPlane factory.ControlPlane

	if err := c.BindJSON(&controlPlane); err != nil {
		logger.PduSessLog.Errorln(err)
		c.JSON(500, gin.H{
			"message": "Error retrieving parameters",
		})
		return
	}

	logger.PduSessLog.Infoln("Handling Admission Control")

	var admRAN *ADM = &ADM{
		Controls: make([]ADMControl, len(context.NTN_Self().Slice)),
		Aware:    context.NTN_Self().SliceAware,
	}
	var admCN *ADM = &ADM{
		Controls: make([]ADMControl, len(context.NTN_Self().Slice)),
		Aware:    context.NTN_Self().SliceAware,
	}

	for k, sl := range context.NTN_Self().Slice {

		admCN.Controls[k] = ADMControl{
			SliceID:    sl.SliceID,
			Throughput: sl.Forward,
			Endpoint:   sl.ClassifierCNEndpoint,
		}

		admRAN.Controls[k] = ADMControl{
			SliceID:    sl.SliceID,
			Throughput: sl.Return,
			Endpoint:   sl.ClassifierRANEndpoint,
		}

	}

	classifierCN := context.NTN_Self().Classifiers.CN
	classifierRAN := context.NTN_Self().Classifiers.RAN

	var wg sync.WaitGroup

	wg.Add(2)
	go AdmissionControl(classifierCN, *admCN, &wg)
	go AdmissionControl(classifierRAN, *admRAN, &wg)

	wg.Wait()

	c.JSON(200, gin.H{
		"message": "success",
	})

}
// HandleAdmissionControl handle the ADM from 5G
HandleAdmissionControl handle the ADM from 5G
// HandleAdmissionControl handle the ADM from 5G
func HandleAdmissionControl(c *gin.Context) {
	var controlPlane factory.ControlPlane
	if err := c.BindJSON(&controlPlane); err != nil {
		logger.PduSessLog.Errorln(err)
		c.JSON(500, gin.H{
			"message": "Error retrieving parameters",
		})
		return
	}
	logger.PduSessLog.Infoln("Handling Admission Control")
	var admRAN *ADM = &ADM{
		Controls: make([]ADMControl, len(context.NTN_Self().Slice)),
		Aware:    context.NTN_Self().SliceAware,
	}
	var admCN *ADM = &ADM{
		Controls: make([]ADMControl, len(context.NTN_Self().Slice)),
		Aware:    context.NTN_Self().SliceAware,
	}
	for k, sl := range context.NTN_Self().Slice {
		admCN.Controls[k] = ADMControl{
			SliceID:    sl.SliceID,
			Throughput: sl.Forward,
			Endpoint:   sl.ClassifierCNEndpoint,
		}
		admRAN.Controls[k] = ADMControl{
			SliceID:    sl.SliceID,
			Throughput: sl.Return,
			Endpoint:   sl.ClassifierRANEndpoint,
		}
	}
	classifierCN := context.NTN_Self().Classifiers.CN
	classifierRAN := context.NTN_Self().Classifiers.RAN
	var wg sync.WaitGroup
	wg.Add(2)
	go AdmissionControl(classifierCN, *admCN, &wg)
	go AdmissionControl(classifierRAN, *admRAN, &wg)
	wg.Wait()
	c.JSON(200, gin.H{
		"message": "success",
	})
}
func HandleAdmissionControl ( c * gin . Context ) { var controlPlane factory . ControlPlane if err := c . BindJSON ( & controlPlane ) ; err != nil { logger . PduSessLog . Errorln ( err ) c . JSON ( 500 , gin . H { " " : " " , } ) return } logger . PduSessLog . Infoln ( " " ) var admRAN * ADM = & ADM { Controls : make ( [ ] ADMControl , len ( context . NTN_Self ( ) . Slice ) ) , Aware : context . NTN_Self ( ) . SliceAware , } var admCN * ADM = & ADM { Controls : make ( [ ] ADMControl , len ( context . NTN_Self ( ) . Slice ) ) , Aware : context . NTN_Self ( ) . SliceAware , } for k , sl := range context . NTN_Self ( ) . Slice { admCN . Controls [ k ] = ADMControl { SliceID : sl . SliceID , Throughput : sl . Forward , Endpoint : sl . ClassifierCNEndpoint , } admRAN . Controls [ k ] = ADMControl { SliceID : sl . SliceID , Throughput : sl . Return , Endpoint : sl . ClassifierRANEndpoint , } } classifierCN := context . NTN_Self ( ) . Classifiers . CN classifierRAN := context . NTN_Self ( ) . Classifiers . RAN var wg sync . WaitGroup wg . Add ( 2 ) go AdmissionControl ( classifierCN , * admCN , & wg ) go AdmissionControl ( classifierRAN , * admRAN , & wg ) wg . Wait ( ) c . JSON ( 200 , gin . H { " " : " " , } ) }
HandleAdmissionControl handle the ADM from 5G
HandleAdmissionControl handle the ADM from 5G