func HandleSessionCreateQof(c *gin.Context) {

	logger.PduSessLog.Infoln("Handling PDU Session Creation")

	var mobileSession MobileSession

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

	logger.PduSessLog.Infof("New 5G session created for slice %s", mobileSession.SliceID)

	// Translate the 5G DSCP to Satellite DSCP
	dscp5G := mobileSession.QosMatch.DSCP
	dscpSatellite := TranslateQoS(mobileSession.QosMatch)
	logger.PduSessLog.Infof("Slice ID: %s, DSCP 5G: %d, DSCP SAT: %d", mobileSession.SliceID, dscp5G, dscpSatellite)
	logger.PduSessLog.Infof("RAN EP: %s, CN EP: %s", mobileSession.RAN, mobileSession.UPF)

	u64, _ := strconv.ParseUint(mobileSession.SliceID, 10, 64)

	// Get the ST endpoint and the GW endpoint
	sliceSatellite := MapSlice(uint8(u64))
	// logger.PduSessLog.Infof("Getting ST endpoint %s and GW endpoint %s for Slice ID %d", sliceSatellite.StEndpoint, sliceSatellite.GwEndpoint, sliceSatellite.SliceId)
	// logger.PduSessLog.Infof("5G RAN endpoint %s and 5G CN endpoint %s for Slice ID %d", mobileSession.RAN, mobileSession.UPF, uint8(u64))

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

	// Get the Egress interfaces for the IPipe operation
	// classifierRANEgress, _ := GetEgressInterface(classifierRAN, sliceSatellite.StEndpoint)
	// classifierCNEgress, _ := GetEgressInterface(classifierCN, sliceSatellite.GwEndpoint)
	// logger.PduSessLog.Infof("Egress interface of RAN %s and CN %s", classifierRANEgress, classifierCNEgress)

	// Get the Ingress interfaces for the Pipe operation
	classifierRANIngress, _ := GetIngressInterface(classifierRAN, mobileSession.RAN)
	classifierCNIngress, _ := GetIngressInterface(classifierCN, mobileSession.UPF)
	logger.PduSessLog.Infof("Classifier CN: %s, Classifier RAN: %s", classifierCNIngress, classifierRANIngress)
	// logger.PduSessLog.Infof("Ingress interface of RAN %s and CN %s", classifierRANIngress, classifierCNIngress)

	// logger.PduSessLog.Infof("Got IP of UE %s", mobileSession.IPv4)

	var wg sync.WaitGroup
	wg.Add(2)

	// Programm the forward link
	go Pipe(classifierCN, mobileSession.SliceMatch.DTEID, dscp5G, dscpSatellite, sliceSatellite.SliceID, mobileSession.UPF, sliceSatellite.ClassifierCNEndpoint, classifierCNIngress, false, &wg)
	// go IPipe(classifierRAN, dscp5G, dscpSatellite, classifierRANEgress, mobileSession.RAN, sliceSatellite.SliceID, mobileSession.UPF, mobileSession.IPv4, true, &wg)

	// Programm the return link
	go Pipe(classifierRAN, mobileSession.SliceMatch.UTEID, dscp5G, dscpSatellite, sliceSatellite.SliceID, mobileSession.UPF, sliceSatellite.ClassifierRANEndpoint, classifierRANIngress, true, &wg)
	// go IPipe(classifierCN, dscp5G, dscpSatellite, classifierCNEgress, mobileSession.UPF, sliceSatellite.SliceID, mobileSession.RAN, mobileSession.IPv4, false, &wg)

	wg.Wait()

	c.JSON(200, gin.H{
		"message": "success",
	})
}
// HandleSessionCreateQof handles the PDU Session creation on the satellite side
HandleSessionCreateQof handles the PDU Session creation on the satellite side
// HandleSessionCreateQof handles the PDU Session creation on the satellite side
func HandleSessionCreateQof(c *gin.Context) {
	logger.PduSessLog.Infoln("Handling PDU Session Creation")
	var mobileSession MobileSession
	if err := c.BindJSON(&mobileSession); err != nil {
		logger.PduSessLog.Errorln(err)
		c.JSON(500, gin.H{
			"message": "Error retrieving parameters",
		})
		return
	}
	logger.PduSessLog.Infof("New 5G session created for slice %s", mobileSession.SliceID)
	dscp5G := mobileSession.QosMatch.DSCP
	dscpSatellite := TranslateQoS(mobileSession.QosMatch)
	logger.PduSessLog.Infof("Slice ID: %s, DSCP 5G: %d, DSCP SAT: %d", mobileSession.SliceID, dscp5G, dscpSatellite)
	logger.PduSessLog.Infof("RAN EP: %s, CN EP: %s", mobileSession.RAN, mobileSession.UPF)
	u64, _ := strconv.ParseUint(mobileSession.SliceID, 10, 64)
	sliceSatellite := MapSlice(uint8(u64))
	classifierCN := context.NTN_Self().Classifiers.CN
	classifierRAN := context.NTN_Self().Classifiers.RAN
	classifierRANIngress, _ := GetIngressInterface(classifierRAN, mobileSession.RAN)
	classifierCNIngress, _ := GetIngressInterface(classifierCN, mobileSession.UPF)
	logger.PduSessLog.Infof("Classifier CN: %s, Classifier RAN: %s", classifierCNIngress, classifierRANIngress)
	var wg sync.WaitGroup
	wg.Add(2)
	go Pipe(classifierCN, mobileSession.SliceMatch.DTEID, dscp5G, dscpSatellite, sliceSatellite.SliceID, mobileSession.UPF, sliceSatellite.ClassifierCNEndpoint, classifierCNIngress, false, &wg)
	go Pipe(classifierRAN, mobileSession.SliceMatch.UTEID, dscp5G, dscpSatellite, sliceSatellite.SliceID, mobileSession.UPF, sliceSatellite.ClassifierRANEndpoint, classifierRANIngress, true, &wg)
	wg.Wait()
	c.JSON(200, gin.H{
		"message": "success",
	})
}
func HandleSessionCreateQof ( c * gin . Context ) { logger . PduSessLog . Infoln ( " " ) var mobileSession MobileSession if err := c . BindJSON ( & mobileSession ) ; err != nil { logger . PduSessLog . Errorln ( err ) c . JSON ( 500 , gin . H { " " : " " , } ) return } logger . PduSessLog . Infof ( " " , mobileSession . SliceID ) dscp5G := mobileSession . QosMatch . DSCP dscpSatellite := TranslateQoS ( mobileSession . QosMatch ) logger . PduSessLog . Infof ( " " , mobileSession . SliceID , dscp5G , dscpSatellite ) logger . PduSessLog . Infof ( " " , mobileSession . RAN , mobileSession . UPF ) u64 , _ := strconv . ParseUint ( mobileSession . SliceID , 10 , 64 ) sliceSatellite := MapSlice ( uint8 ( u64 ) ) classifierCN := context . NTN_Self ( ) . Classifiers . CN classifierRAN := context . NTN_Self ( ) . Classifiers . RAN classifierRANIngress , _ := GetIngressInterface ( classifierRAN , mobileSession . RAN ) classifierCNIngress , _ := GetIngressInterface ( classifierCN , mobileSession . UPF ) logger . PduSessLog . Infof ( " " , classifierCNIngress , classifierRANIngress ) var wg sync . WaitGroup wg . Add ( 2 ) go Pipe ( classifierCN , mobileSession . SliceMatch . DTEID , dscp5G , dscpSatellite , sliceSatellite . SliceID , mobileSession . UPF , sliceSatellite . ClassifierCNEndpoint , classifierCNIngress , false , & wg ) go Pipe ( classifierRAN , mobileSession . SliceMatch . UTEID , dscp5G , dscpSatellite , sliceSatellite . SliceID , mobileSession . UPF , sliceSatellite . ClassifierRANEndpoint , classifierRANIngress , true , & wg ) wg . Wait ( ) c . JSON ( 200 , gin . H { " " : " " , } ) }
HandleSessionCreateQof handles the PDU Session creation on the satellite side
HandleSessionCreateQof handles the PDU Session creation on the satellite side
// Translate the 5G DSCP to Satellite DSCP // Get the ST endpoint and the GW endpoint // logger.PduSessLog.Infof("Getting ST endpoint %s and GW endpoint %s for Slice ID %d", sliceSatellite.StEndpoint, sliceSatellite.GwEndpoint, sliceSatellite.SliceId) // logger.PduSessLog.Infof("5G RAN endpoint %s and 5G CN endpoint %s for Slice ID %d", mobileSession.RAN, mobileSession.UPF, uint8(u64)) // Get the Egress interfaces for the IPipe operation // classifierRANEgress, _ := GetEgressInterface(classifierRAN, sliceSatellite.StEndpoint) // classifierCNEgress, _ := GetEgressInterface(classifierCN, sliceSatellite.GwEndpoint) // logger.PduSessLog.Infof("Egress interface of RAN %s and CN %s", classifierRANEgress, classifierCNEgress) // Get the Ingress interfaces for the Pipe operation // logger.PduSessLog.Infof("Ingress interface of RAN %s and CN %s", classifierRANIngress, classifierCNIngress) // logger.PduSessLog.Infof("Got IP of UE %s", mobileSession.IPv4) // Programm the forward link // go IPipe(classifierRAN, dscp5G, dscpSatellite, classifierRANEgress, mobileSession.RAN, sliceSatellite.SliceID, mobileSession.UPF, mobileSession.IPv4, true, &wg) // Programm the return link // go IPipe(classifierCN, dscp5G, dscpSatellite, classifierCNEgress, mobileSession.UPF, sliceSatellite.SliceID, mobileSession.RAN, mobileSession.IPv4, false, &wg)