X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=E2Manager%2Fmodels%2Fric_service_update_ack_message.go;h=9ba085c141b5b7a013091b3094cc6bfb6a208c52;hb=8b146be80f4b6daa8ce90d8ab62cab9f53f7e4f6;hp=1388f14a75dcf07c087ec2714c467d5aea7da20b;hpb=44ec41750c0592938e23f89b9b5ba1044062366c;p=ric-plt%2Fe2mgr.git diff --git a/E2Manager/models/ric_service_update_ack_message.go b/E2Manager/models/ric_service_update_ack_message.go index 1388f14..9ba085c 100644 --- a/E2Manager/models/ric_service_update_ack_message.go +++ b/E2Manager/models/ric_service_update_ack_message.go @@ -19,89 +19,123 @@ package models import ( - "encoding/xml" + "encoding/xml" ) type RicServiceAckRANFunctionIDItem struct { Text string `xml:",chardata"` - RanFunctionID uint32 `xml:"ranFunctionID"` - RanFunctionRevision uint32 `xml:"ranFunctionRevision"` + RanFunctionID uint32 `xml:"ranFunctionID"` + RanFunctionRevision uint32 `xml:"ranFunctionRevision"` } type RICserviceUpdateAcknowledgeProtocolIESingleContainer struct { - Text string `xml:",chardata"` - Id string `xml:"id"` - Criticality struct { - Text string `xml:",chardata"` - //Ignore string `xml:"ignore"` - Reject string `xml:"reject"` - } `xml:"criticality"` - Value struct { - Text string `xml:",chardata"` - RANfunctionIDItem RicServiceAckRANFunctionIDItem `xml:"RANfunctionID-Item"` - } `xml:"value"` + Text string `xml:",chardata"` + Id string `xml:"id"` + Criticality struct { + Text string `xml:",chardata"` + //Ignore string `xml:"ignore"` + Reject string `xml:"reject"` + } `xml:"criticality"` + Value struct { + Text string `xml:",chardata"` + RANfunctionIDItem RicServiceAckRANFunctionIDItem `xml:"RANfunctionID-Item"` + } `xml:"value"` } type RICserviceUpdateAcknowledgeIEs struct { Text string `xml:",chardata"` - ID string `xml:"id"` - Criticality struct { - Text string `xml:",chardata"` - Reject string `xml:"reject"` - } `xml:"criticality"` - Value struct { + ID string `xml:"id"` + Criticality struct { Text string `xml:",chardata"` - RANfunctionsIDList struct { - Text string `xml:",chardata"` - ProtocolIESingleContainer []RICserviceUpdateAcknowledgeProtocolIESingleContainer `xml:"ProtocolIE-SingleContainer"` - } `xml:"RANfunctionsID-List"` - }`xml:"value"` + Reject string `xml:"reject"` + } `xml:"criticality"` + Value interface{} `xml:"value"` } +type RICserviceUpdateAcknowledgeTransactionID struct { + Text string `xml:",chardata"` + TransactionID string `xml:"TransactionID"` +} + +type RICserviceUpdateAcknowledgeRANfunctionsList struct { + Text string `xml:",chardata"` + RANfunctionsIDList struct { + Text string `xml:",chardata"` + ProtocolIESingleContainer []RICserviceUpdateAcknowledgeProtocolIESingleContainer `xml:"ProtocolIE-SingleContainer"` + } `xml:"RANfunctionsID-List"` +} type RicServiceUpdateAckSuccessfulOutcome struct { - XMLName xml.Name `xml:"successfulOutcome"` - Text string `xml:",chardata"` - ProcedureCode string `xml:"procedureCode"` - Criticality struct { - Text string `xml:",chardata"` - Reject string `xml:"reject"` - } `xml:"criticality"` + XMLName xml.Name `xml:"successfulOutcome"` + Text string `xml:",chardata"` + ProcedureCode string `xml:"procedureCode"` + Criticality struct { + Text string `xml:",chardata"` + Reject string `xml:"reject"` + } `xml:"criticality"` Value struct { - Text string `xml:",chardata"` - RICserviceUpdateAcknowledge RICserviceUpdateAcknowledge `xml:"RICserviceUpdateAcknowledge"` + Text string `xml:",chardata"` + RICserviceUpdateAcknowledge RICserviceUpdateAcknowledge `xml:"RICserviceUpdateAcknowledge"` } `xml:"value"` } type RICserviceUpdateAcknowledge struct { Text string `xml:",chardata"` ProtocolIEs struct { - Text string `xml:",chardata"` + Text string `xml:",chardata"` RICserviceUpdateAcknowledgeIEs []RICserviceUpdateAcknowledgeIEs `xml:"RICserviceUpdateAcknowledge-IEs"` } `xml:"protocolIEs"` } type RicServiceUpdateAckE2APPDU struct { - XMLName xml.Name `xml:"E2AP-PDU"` - Text string `xml:",chardata"` - InitiatingMessage interface{} + XMLName xml.Name `xml:"E2AP-PDU"` + Text string `xml:",chardata"` + SuccessfulOutcome interface{} } -func NewServiceUpdateAck(ricServiceUpdate []RicServiceAckRANFunctionIDItem) RicServiceUpdateAckE2APPDU { - successfulOutcome := RicServiceUpdateAckSuccessfulOutcome{} - successfulOutcome.ProcedureCode = "7" - if len(ricServiceUpdate) == 0 { - return RicServiceUpdateAckE2APPDU{InitiatingMessage:successfulOutcome} +func NewServiceUpdateAck(ricServiceUpdate []RicServiceAckRANFunctionIDItem, txId string) RicServiceUpdateAckE2APPDU { + + txIE := RICserviceUpdateAcknowledgeIEs{ + ID: ProtocolIE_ID_id_TransactionID, + Value: RICserviceUpdateAcknowledgeTransactionID{ + TransactionID: txId, + }, } - ricServiceUpdateAcknowledgeIEs := make([]RICserviceUpdateAcknowledgeIEs, 1) - ricServiceUpdateAcknowledgeIEs[0].ID = "9" protocolIESingleContainer := make([]RICserviceUpdateAcknowledgeProtocolIESingleContainer, len(ricServiceUpdate)) for i := 0; i < len(ricServiceUpdate); i++ { protocolIESingleContainer[i].Value.RANfunctionIDItem = ricServiceUpdate[i] - protocolIESingleContainer[i].Id = "6" + protocolIESingleContainer[i].Id = ProtocolIE_ID_id_RANfunctionID_Item + } + + // mandatory RANFunctionsAccepted + functionListIE := RICserviceUpdateAcknowledgeIEs{ + ID: ProtocolIE_ID_id_RANfunctionsAccepted, + Value: RICserviceUpdateAcknowledgeRANfunctionsList{ + RANfunctionsIDList: struct { + Text string `xml:",chardata"` + ProtocolIESingleContainer []RICserviceUpdateAcknowledgeProtocolIESingleContainer `xml:"ProtocolIE-SingleContainer"` + }{ + ProtocolIESingleContainer: protocolIESingleContainer, + }, + }, } - ricServiceUpdateAcknowledgeIEs[0].Value.RANfunctionsIDList.ProtocolIESingleContainer = protocolIESingleContainer - successfulOutcome.Value.RICserviceUpdateAcknowledge.ProtocolIEs.RICserviceUpdateAcknowledgeIEs = ricServiceUpdateAcknowledgeIEs - return RicServiceUpdateAckE2APPDU{InitiatingMessage:successfulOutcome} -} + successfulOutcome := RicServiceUpdateAckSuccessfulOutcome{ + ProcedureCode: ProcedureCode_id_RICserviceUpdate, + Value: struct { + Text string `xml:",chardata"` + RICserviceUpdateAcknowledge RICserviceUpdateAcknowledge `xml:"RICserviceUpdateAcknowledge"` + }{ + RICserviceUpdateAcknowledge: RICserviceUpdateAcknowledge{ + ProtocolIEs: struct { + Text string `xml:",chardata"` + RICserviceUpdateAcknowledgeIEs []RICserviceUpdateAcknowledgeIEs `xml:"RICserviceUpdateAcknowledge-IEs"` + }{ + RICserviceUpdateAcknowledgeIEs: []RICserviceUpdateAcknowledgeIEs{txIE, functionListIE}, + }, + }, + }, + } + + return RicServiceUpdateAckE2APPDU{SuccessfulOutcome: successfulOutcome} +}