return nodebInfo, nil
}
-func (h E2SetupRequestNotificationHandler) handleExistingRan(ranName string, nodebInfo *entities.NodebInfo, setupRequest *models.E2SetupRequestMessage) error {
- if nodebInfo.GetConnectionStatus() == entities.ConnectionStatus_SHUTTING_DOWN {
- h.logger.Errorf("#E2SetupRequestNotificationHandler.Handle - RAN name: %s, connection status: %s - nodeB entity in incorrect state", ranName, nodebInfo.ConnectionStatus)
- return errors.New("nodeB entity in incorrect state")
- }
-
+func (h E2SetupRequestNotificationHandler) setGnbFunctions(nodebInfo *entities.NodebInfo, setupRequest *models.E2SetupRequestMessage) error {
ranFunctions, err := setupRequest.ExtractRanFunctionsList()
if err != nil {
- h.logger.Errorf("#E2SetupRequestNotificationHandler.Handle - RAN name: %s - failed to update nodebInfo entity. Error: %s", ranName, err)
+ h.logger.Errorf("#E2SetupRequestNotificationHandler.setGnbFunctions - RAN name: %s - failed to update nodebInfo entity. Error: %s", nodebInfo.GetRanName(), err)
return err
}
return nil
}
+func (h E2SetupRequestNotificationHandler) handleExistingRan(ranName string, nodebInfo *entities.NodebInfo, setupRequest *models.E2SetupRequestMessage) error {
+ if nodebInfo.GetConnectionStatus() == entities.ConnectionStatus_SHUTTING_DOWN {
+ h.logger.Errorf("#E2SetupRequestNotificationHandler.Handle - RAN name: %s, connection status: %s - nodeB entity in incorrect state", ranName, nodebInfo.ConnectionStatus)
+ return errors.New("nodeB entity in incorrect state")
+ }
+
+ err := h.setGnbFunctions(nodebInfo, setupRequest)
+ return err
+}
+
func (h E2SetupRequestNotificationHandler) handleUnsuccessfulResponse(nodebInfo *entities.NodebInfo, req *models.NotificationRequest) {
failureResponse := models.NewE2SetupFailureResponseMessage(models.TimeToWaitEnum.V60s)
h.logger.Debugf("#E2SetupRequestNotificationHandler.handleUnsuccessfulResponse - E2_SETUP_RESPONSE has been built successfully %+v", failureResponse)
if len(e2tIpAddress) == 0 {
return nil, "", errors.New("#E2SetupRequestNotificationHandler.parseSetupRequest - Empty E2T Address received")
}
+
+ h.logger.Infof("#E2SetupRequestNotificationHandler.parseSetupRequest - payload: %s", payload[pipInd+1:])
+
setupRequest := &models.E2SetupRequestMessage{}
err := xml.Unmarshal(payload[pipInd+1:], &setupRequest.E2APPDU)
if err != nil {
}
func (h E2SetupRequestNotificationHandler) buildNodebInfo(ranName string, e2tAddress string, request *models.E2SetupRequestMessage) (*entities.NodebInfo, error) {
+
var err error
nodebInfo := &entities.NodebInfo{
AssociatedE2TInstanceAddress: e2tAddress,
RanName: ranName,
NodeType: entities.Node_GNB,
Configuration: &entities.NodebInfo_Gnb{Gnb: &entities.Gnb{}},
- GlobalNbId: &entities.GlobalNbId{
- PlmnId: request.GetPlmnId(),
- NbId: request.GetNbId(),
- },
+ GlobalNbId: h.buildGlobalNbId(request),
}
- nodebInfo.GetGnb().RanFunctions, err = request.ExtractRanFunctionsList()
+
+ err = h.setGnbFunctions(nodebInfo, request)
return nodebInfo, err
}
+func (h E2SetupRequestNotificationHandler) buildGlobalNbId(setupRequest *models.E2SetupRequestMessage) *entities.GlobalNbId {
+ return &entities.GlobalNbId{
+ PlmnId: setupRequest.GetPlmnId(),
+ NbId: setupRequest.GetNbId(),
+ }
+}
+
func (h E2SetupRequestNotificationHandler) buildNbIdentity(ranName string, setupRequest *models.E2SetupRequestMessage) *entities.NbIdentity {
return &entities.NbIdentity{
InventoryName: ranName,
- GlobalNbId: &entities.GlobalNbId{
- PlmnId: setupRequest.GetPlmnId(),
- NbId: setupRequest.GetNbId(),
- },
+ GlobalNbId: h.buildGlobalNbId(setupRequest),
}
}
)
const (
- prefix = "10.0.2.15:9999|"
- e2tInstanceFullAddress = "10.0.2.15:9999"
- nodebRanName = "gnb:310-410-b5c67788"
+ prefix = "10.0.2.15:9999|"
+ e2tInstanceFullAddress = "10.0.2.15:9999"
+ nodebRanName = "gnb:310-410-b5c67788"
+ GnbSetupRequestXmlPath = "../../tests/resources/setupRequest_gnb.xml"
+ EnGnbSetupRequestXmlPath = "../../tests/resources/setupRequest_en-gNB.xml"
+ NgEnbSetupRequestXmlPath = "../../tests/resources/setupRequest_ng-eNB.xml"
+ EnbSetupRequestXmlPath = "../../tests/resources/setupRequest_enb.xml"
)
-func TestParseSetupRequest_Success(t *testing.T){
- path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
+func readXmlFile(t *testing.T, xmlPath string) []byte {
+ path, err := filepath.Abs(xmlPath)
if err != nil {
t.Fatal(err)
}
- xmlGnb, err := ioutil.ReadFile(path)
+ xmlAsBytes, err := ioutil.ReadFile(path)
if err != nil {
t.Fatal(err)
}
+
+ return xmlAsBytes
+}
+
+func TestParseGnbSetupRequest_Success(t *testing.T) {
+ xmlGnb := readXmlFile(t, GnbSetupRequestXmlPath)
handler, _, _, _, _, _ := initMocks(t)
prefBytes := []byte(prefix)
request, _, err := handler.parseSetupRequest(append(prefBytes, xmlGnb...))
- assert.Equal(t, request.GetPlmnId(), "131014")
- assert.Equal(t, request.GetNbId(), "10011001101010101011")
+ assert.Equal(t, "131014", request.GetPlmnId())
+ assert.Equal(t, "10011001101010101011", request.GetNbId())
+ assert.Nil(t, err)
}
-func TestParseSetupRequest_PipFailure(t *testing.T){
- path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
- if err != nil {
- t.Fatal(err)
- }
- xmlGnb, err := ioutil.ReadFile(path)
- if err != nil {
- t.Fatal(err)
- }
+func TestParseEnGnbSetupRequest_Success(t *testing.T) {
+ enGnbXml := readXmlFile(t, EnGnbSetupRequestXmlPath)
+ handler, _, _, _, _, _ := initMocks(t)
+ prefBytes := []byte(prefix)
+ request, _, err := handler.parseSetupRequest(append(prefBytes, enGnbXml...))
+ assert.Equal(t, "131014", request.GetPlmnId())
+ assert.Equal(t, "11000101110001101100011111111000", request.GetNbId())
+ assert.Nil(t, err)
+}
+
+func TestParseNgEnbSetupRequest_Success(t *testing.T) {
+ ngEnbXml := readXmlFile(t, NgEnbSetupRequestXmlPath)
+ handler, _, _, _, _, _ := initMocks(t)
+ prefBytes := []byte(prefix)
+ request, _, err := handler.parseSetupRequest(append(prefBytes, ngEnbXml...))
+ assert.Equal(t, "131014", request.GetPlmnId())
+ assert.Equal(t, "101010101010101010", request.GetNbId())
+ assert.Nil(t, err)
+}
+
+func TestParseEnbSetupRequest_Success(t *testing.T) {
+ enbXml := readXmlFile(t, EnbSetupRequestXmlPath)
+ handler, _, _, _, _, _ := initMocks(t)
+ prefBytes := []byte(prefix)
+ request, _, err := handler.parseSetupRequest(append(prefBytes, enbXml...))
+ assert.Equal(t, "6359AB", request.GetPlmnId())
+ assert.Equal(t, "101010101010101010", request.GetNbId())
+ assert.Nil(t, err)
+}
+
+func TestParseSetupRequest_PipFailure(t *testing.T) {
+ xmlGnb := readXmlFile(t, GnbSetupRequestXmlPath)
handler, _, _, _, _, _ := initMocks(t)
prefBytes := []byte("10.0.2.15:9999")
request, _, err := handler.parseSetupRequest(append(prefBytes, xmlGnb...))
assert.EqualError(t, err, "#E2SetupRequestNotificationHandler.parseSetupRequest - Error parsing E2 Setup Request failed extract Payload: no | separator found")
}
-func TestParseSetupRequest_UnmarshalFailure(t *testing.T){
+func TestParseSetupRequest_UnmarshalFailure(t *testing.T) {
handler, _, _, _, _, _ := initMocks(t)
prefBytes := []byte(prefix)
- request, _, err := handler.parseSetupRequest(append(prefBytes, 1,2,3))
+ request, _, err := handler.parseSetupRequest(append(prefBytes, 1, 2, 3))
assert.Nil(t, request)
assert.NotNil(t, err)
assert.EqualError(t, err, "#E2SetupRequestNotificationHandler.parseSetupRequest - Error unmarshalling E2 Setup Request payload: 31302e302e322e31353a393939397c010203")
}
func TestE2SetupRequestNotificationHandler_HandleNewGnbSuccess(t *testing.T) {
- path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
- if err != nil {
- t.Fatal(err)
- }
- xmlGnb, err := ioutil.ReadFile(path)
- if err != nil {
- t.Fatal(err)
- }
-
+ xmlGnb := readXmlFile(t, GnbSetupRequestXmlPath)
handler, readerMock, writerMock, rmrMessengerMock, e2tInstancesManagerMock, routingManagerClientMock := initMocks(t)
var e2tInstance = &entities.E2TInstance{}
e2tInstancesManagerMock.On("GetE2TInstance", e2tInstanceFullAddress).Return(e2tInstance, nil)
}
func TestE2SetupRequestNotificationHandler_HandleNewEnGnbSuccess(t *testing.T) {
- path, err :=filepath.Abs("../../tests/resources/setupRequest_en-gNB.xml")
- if err != nil {
- t.Fatal(err)
- }
- xmlEnGnb, err := ioutil.ReadFile(path)
- if err != nil {
- t.Fatal(err)
- }
-
+ xmlEnGnb := readXmlFile(t, EnGnbSetupRequestXmlPath)
handler, readerMock, writerMock, rmrMessengerMock, e2tInstancesManagerMock, routingManagerClientMock := initMocks(t)
var e2tInstance = &entities.E2TInstance{}
e2tInstancesManagerMock.On("GetE2TInstance", e2tInstanceFullAddress).Return(e2tInstance, nil)
}
func TestE2SetupRequestNotificationHandler_HandleNewNgEnbSuccess(t *testing.T) {
- path, err :=filepath.Abs("../../tests/resources/setupRequest_ng-eNB.xml")
- if err != nil {
- t.Fatal(err)
- }
- xmlEnGnb, err := ioutil.ReadFile(path)
- if err != nil {
- t.Fatal(err)
- }
-
+ xmlNgEnb := readXmlFile(t, NgEnbSetupRequestXmlPath)
handler, readerMock, writerMock, rmrMessengerMock, e2tInstancesManagerMock, routingManagerClientMock := initMocks(t)
var e2tInstance = &entities.E2TInstance{}
e2tInstancesManagerMock.On("GetE2TInstance", e2tInstanceFullAddress).Return(e2tInstance, nil)
rmrMessage := &rmrCgo.MBuf{}
rmrMessengerMock.On("SendMsg", mock.Anything, mock.Anything).Return(rmrMessage, errEmpty)
prefBytes := []byte(prefix)
- notificationRequest := &models.NotificationRequest{RanName: nodebRanName, Payload: append(prefBytes, xmlEnGnb...)}
+ notificationRequest := &models.NotificationRequest{RanName: nodebRanName, Payload: append(prefBytes, xmlNgEnb...)}
handler.Handle(notificationRequest)
assertNewNodebSuccessCalls(readerMock, t, e2tInstancesManagerMock, writerMock, routingManagerClientMock, rmrMessengerMock)
}
func TestE2SetupRequestNotificationHandler_HandleExistingGnbSuccess(t *testing.T) {
- path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
- if err != nil {
- t.Fatal(err)
- }
- xmlGnb, err := ioutil.ReadFile(path)
- if err != nil {
- t.Fatal(err)
- }
+ xmlGnb := readXmlFile(t, GnbSetupRequestXmlPath)
handler, readerMock, writerMock, rmrMessengerMock, e2tInstancesManagerMock, routingManagerClientMock := initMocks(t)
var e2tInstance = &entities.E2TInstance{}
e2tInstancesManagerMock.On("GetE2TInstance", e2tInstanceFullAddress).Return(e2tInstance, nil)
var gnb = &entities.NodebInfo{
- RanName: nodebRanName,
+ RanName: nodebRanName,
AssociatedE2TInstanceAddress: e2tInstanceFullAddress,
- ConnectionStatus: entities.ConnectionStatus_CONNECTED,
- NodeType: entities.Node_GNB,
- Configuration: &entities.NodebInfo_Gnb{Gnb: &entities.Gnb{}},
+ ConnectionStatus: entities.ConnectionStatus_CONNECTED,
+ NodeType: entities.Node_GNB,
+ Configuration: &entities.NodebInfo_Gnb{Gnb: &entities.Gnb{}},
}
readerMock.On("GetNodeb", mock.Anything).Return(gnb, nil)
routingManagerClientMock.On("AssociateRanToE2TInstance", e2tInstanceFullAddress, mock.Anything).Return(nil)
}
func TestE2SetupRequestNotificationHandler_HandleParseError(t *testing.T) {
- path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
- if err != nil {
- t.Fatal(err)
- }
- xmlGnb, err := ioutil.ReadFile(path)
- if err != nil {
- t.Fatal(err)
- }
+ xmlGnb := readXmlFile(t, GnbSetupRequestXmlPath)
handler, readerMock, writerMock, rmrMessengerMock, e2tInstancesManagerMock, routingManagerClientMock := initMocks(t)
prefBytes := []byte("invalid_prefix")
}
func TestE2SetupRequestNotificationHandler_HandleGetE2TInstanceError(t *testing.T) {
- path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
- if err != nil {
- t.Fatal(err)
- }
- xmlGnb, err := ioutil.ReadFile(path)
- if err != nil {
- t.Fatal(err)
- }
-
+ xmlGnb := readXmlFile(t, GnbSetupRequestXmlPath)
handler, readerMock, writerMock, rmrMessengerMock, e2tInstancesManagerMock, routingManagerClientMock := initMocks(t)
- var e2tInstance * entities.E2TInstance
+ var e2tInstance *entities.E2TInstance
e2tInstancesManagerMock.On("GetE2TInstance", e2tInstanceFullAddress).Return(e2tInstance, common.NewResourceNotFoundError("Not found"))
prefBytes := []byte(prefix)
notificationRequest := &models.NotificationRequest{RanName: nodebRanName, Payload: append(prefBytes, xmlGnb...)}
}
func TestE2SetupRequestNotificationHandler_HandleGetNodebError(t *testing.T) {
- path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
- if err != nil {
- t.Fatal(err)
- }
- xmlGnb, err := ioutil.ReadFile(path)
- if err != nil {
- t.Fatal(err)
- }
+ xmlGnb := readXmlFile(t, GnbSetupRequestXmlPath)
+
handler, readerMock, writerMock, routingManagerClientMock, e2tInstancesManagerMock, rmrMessengerMock := initMocks(t)
var e2tInstance = &entities.E2TInstance{}
e2tInstancesManagerMock.On("GetE2TInstance", e2tInstanceFullAddress).Return(e2tInstance, nil)
}
func TestE2SetupRequestNotificationHandler_HandleAssociationError(t *testing.T) {
- path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
- if err != nil {
- t.Fatal(err)
- }
- xmlGnb, err := ioutil.ReadFile(path)
- if err != nil {
- t.Fatal(err)
- }
+ xmlGnb := readXmlFile(t, GnbSetupRequestXmlPath)
handler, readerMock, writerMock, rmrMessengerMock, e2tInstancesManagerMock, routingManagerClientMock := initMocks(t)
var e2tInstance = &entities.E2TInstance{}
rmrMessengerMock.AssertCalled(t, "WhSendMsg", mock.Anything, mock.Anything)
}
-
-func TestE2SetupRequestNotificationHandler_ConvertTo20BitStringError(t *testing.T){
-
- path, err :=filepath.Abs("../../tests/resources/setupRequest_en-gNB.xml")
- if err != nil {
- t.Fatal(err)
- }
- xmlEnGnb, err := ioutil.ReadFile(path)
- if err != nil {
- t.Fatal(err)
- }
+func TestE2SetupRequestNotificationHandler_ConvertTo20BitStringError(t *testing.T) {
+ xmlEnGnb := readXmlFile(t, EnGnbSetupRequestXmlPath)
logger := tests.InitLog(t)
config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3, GlobalRicId: struct {
PlmnId string
RicNearRtId string
- }{PlmnId : "131014", RicNearRtId: "10011001101010101011"}}
+ }{PlmnId: "131014", RicNearRtId: "10011001101010101011"}}
rmrMessengerMock := &mocks.RmrMessengerMock{}
rmrSender := tests.InitRmrSender(rmrMessengerMock, logger)
readerMock := &mocks.RnibReaderMock{}
}
func TestE2SetupRequestNotificationHandler_HandleExistingGnbInvalidStatusError(t *testing.T) {
- path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
- if err != nil {
- t.Fatal(err)
- }
- xmlGnb, err := ioutil.ReadFile(path)
- if err != nil {
- t.Fatal(err)
- }
-
+ xmlGnb := readXmlFile(t, GnbSetupRequestXmlPath)
handler, readerMock, writerMock, routingManagerClientMock, e2tInstancesManagerMock, rmrMessengerMock := initMocks(t)
- var gnb = &entities.NodebInfo{RanName: nodebRanName, ConnectionStatus:entities.ConnectionStatus_SHUTTING_DOWN}
+ var gnb = &entities.NodebInfo{RanName: nodebRanName, ConnectionStatus: entities.ConnectionStatus_SHUTTING_DOWN}
readerMock.On("GetNodeb", mock.Anything).Return(gnb, nil)
var e2tInstance = &entities.E2TInstance{}
e2tInstancesManagerMock.On("GetE2TInstance", e2tInstanceFullAddress).Return(e2tInstance, nil)
config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3, GlobalRicId: struct {
PlmnId string
RicNearRtId string
- }{PlmnId : "131014", RicNearRtId: "556670"}}
+ }{PlmnId: "131014", RicNearRtId: "556670"}}
rmrMessengerMock := &mocks.RmrMessengerMock{}
rmrSender := tests.InitRmrSender(rmrMessengerMock, logger)
readerMock := &mocks.RnibReaderMock{}
writerMock.AssertCalled(t, "UpdateNodebInfo", mock.Anything)
e2tInstancesManagerMock.AssertCalled(t, "AddRansToInstance", mock.Anything, mock.Anything)
rmrMessengerMock.AssertCalled(t, "SendMsg", mock.Anything, mock.Anything)
-}
\ No newline at end of file
+}
} `xml:"global-gNB-ID"`
}
+type NgEnbId struct {
+ Text string `xml:",chardata"`
+ EnbIdMacro string `xml:"enb-ID-macro"`
+ EnbIdShortMacro string `xml:"enb-ID-shortmacro"`
+ EnbIdLongMacro string `xml:"enb-ID-longmacro"`
+}
+
type NgEnb struct {
Text string `xml:",chardata"`
GlobalNgENBID struct {
- Text string `xml:",chardata"`
- PlmnID string `xml:"plmn-id"`
- GnbID struct {
- Text string `xml:",chardata"`
- GnbID string `xml:"gnb-ID"`
- } `xml:"gnb-id"`
+ Text string `xml:",chardata"`
+ PlmnID string `xml:"plmn-id"`
+ EnbID NgEnbId `xml:"enb-id"`
} `xml:"global-ng-eNB-ID"`
}
+type EnbId struct {
+ Text string `xml:",chardata"`
+ MacroEnbId string `xml:"macro-eNB-ID"`
+ HomeEnbId string `xml:"home-eNB-ID"`
+ ShortMacroEnbId string `xml:"short-Macro-eNB-ID"`
+ LongMacroEnbId string `xml:"long-Macro-eNB-ID"`
+}
+
type Enb struct {
Text string `xml:",chardata"`
GlobalENBID struct {
Text string `xml:",chardata"`
- PlmnID string `xml:"plmn-id"`
- GnbID struct {
- Text string `xml:",chardata"`
- GnbID string `xml:"gnb-ID"`
- } `xml:"gnb-id"`
+ PlmnID string `xml:"pLMN-Identity"`
+ EnbID EnbId `xml:"eNB-ID"`
} `xml:"global-eNB-ID"`
}
return m.E2APPDU.InitiatingMessage.Value.E2setupRequest.ProtocolIEs.E2setupRequestIEs[0].Value.GlobalE2nodeID
}
-func (m *E2SetupRequestMessage) GetNodeType() entities.Node_Type {
- globalE2NodeId := m.getGlobalE2NodeId()
- if id := globalE2NodeId.GNB.GlobalGNBID.PlmnID; id != "" {
- return entities.Node_GNB
- }
- if id := globalE2NodeId.EnGNB.GlobalGNBID.PlmnID; id != "" {
- return entities.Node_GNB
- }
- if id := globalE2NodeId.ENB.GlobalENBID.PlmnID; id != "" {
- return entities.Node_ENB
- }
- if id := globalE2NodeId.NgENB.GlobalNgENBID.PlmnID; id != "" {
- return entities.Node_GNB
- }
- return entities.Node_UNKNOWN
-}
+//func (m *E2SetupRequestMessage) GetNodeType() entities.Node_Type {
+// globalE2NodeId := m.getGlobalE2NodeId()
+// if id := globalE2NodeId.GNB.GlobalGNBID.PlmnID; id != "" {
+// return entities.Node_GNB
+// }
+// if id := globalE2NodeId.EnGNB.GlobalGNBID.PlmnID; id != "" {
+// return entities.Node_GNB
+// }
+// if id := globalE2NodeId.ENB.GlobalENBID.PlmnID; id != "" {
+// return entities.Node_ENB
+// }
+// if id := globalE2NodeId.NgENB.GlobalNgENBID.PlmnID; id != "" {
+// return entities.Node_ENB
+// }
+// return entities.Node_UNKNOWN
+//}
func (m *E2SetupRequestMessage) GetPlmnId() string {
globalE2NodeId := m.getGlobalE2NodeId()
return ""
}
+func (m *E2SetupRequestMessage) getInnerEnbId(enbId EnbId) string {
+
+ if id := enbId.HomeEnbId; id != "" {
+ return id
+ }
+
+ if id := enbId.LongMacroEnbId; id != "" {
+ return id
+ }
+
+ if id := enbId.MacroEnbId; id != "" {
+ return id
+ }
+
+ if id := enbId.ShortMacroEnbId; id != "" {
+ return id
+ }
+
+ return ""
+}
+
+func (m *E2SetupRequestMessage) getInnerNgEnbId(enbId NgEnbId) string {
+ if id := enbId.EnbIdLongMacro; id != "" {
+ return id
+ }
+
+ if id := enbId.EnbIdMacro; id != "" {
+ return id
+ }
+
+ if id := enbId.EnbIdShortMacro; id != "" {
+ return id
+ }
+
+ return ""
+}
+
func (m *E2SetupRequestMessage) GetNbId() string {
globalE2NodeId := m.getGlobalE2NodeId()
+
if id := globalE2NodeId.GNB.GlobalGNBID.GnbID.GnbID; id != "" {
return m.trimSpaces(id)
}
+
if id := globalE2NodeId.EnGNB.GlobalGNBID.GnbID.GnbID; id != "" {
return m.trimSpaces(id)
}
- if id := globalE2NodeId.ENB.GlobalENBID.GnbID.GnbID; id != "" {
+
+ if id := m.getInnerEnbId(globalE2NodeId.ENB.GlobalENBID.EnbID); id != "" {
return m.trimSpaces(id)
}
- if id := globalE2NodeId.NgENB.GlobalNgENBID.GnbID.GnbID; id != "" {
+
+ if id := m.getInnerNgEnbId(globalE2NodeId.NgENB.GlobalNgENBID.EnbID); id != "" {
return m.trimSpaces(id)
}
+
return ""
}
// platform project (RICP).
package models
+
import (
"encoding/xml"
)
-
type TimeToWait = int
-var TimeToWaitEnum = struct{
+var TimeToWaitEnum = struct {
V60s TimeToWait
V20s TimeToWait
V10s TimeToWait
- V5s TimeToWait
- V2s TimeToWait
- V1s TimeToWait
+ V5s TimeToWait
+ V2s TimeToWait
+ V1s TimeToWait
}{60, 20, 10, 5, 2, 1}
var timeToWaitMap = map[TimeToWait]interface{}{
- TimeToWaitEnum.V60s : struct {
+ TimeToWaitEnum.V60s: struct {
XMLName xml.Name `xml:"TimeToWait"`
- Text string `xml:",chardata"`
- V60s string `xml:"v60s"`
+ Text string `xml:",chardata"`
+ V60s string `xml:"v60s"`
}{},
- TimeToWaitEnum.V20s : struct {
+ TimeToWaitEnum.V20s: struct {
XMLName xml.Name `xml:"TimeToWait"`
- Text string `xml:",chardata"`
- V20s string `xml:"v20s"`
+ Text string `xml:",chardata"`
+ V20s string `xml:"v20s"`
}{},
- TimeToWaitEnum.V10s : struct {
+ TimeToWaitEnum.V10s: struct {
XMLName xml.Name `xml:"TimeToWait"`
- Text string `xml:",chardata"`
- V10s string `xml:"v10s"`
+ Text string `xml:",chardata"`
+ V10s string `xml:"v10s"`
}{},
- TimeToWaitEnum.V5s : struct {
+ TimeToWaitEnum.V5s: struct {
XMLName xml.Name `xml:"TimeToWait"`
- Text string `xml:",chardata"`
- V5s string `xml:"v5s"`
+ Text string `xml:",chardata"`
+ V5s string `xml:"v5s"`
}{},
- TimeToWaitEnum.V2s : struct {
+ TimeToWaitEnum.V2s: struct {
XMLName xml.Name `xml:"TimeToWait"`
- Text string `xml:",chardata"`
- V2s string `xml:"v2s"`
+ Text string `xml:",chardata"`
+ V2s string `xml:"v2s"`
}{},
- TimeToWaitEnum.V1s : struct {
+ TimeToWaitEnum.V1s: struct {
XMLName xml.Name `xml:"TimeToWait"`
- Text string `xml:",chardata"`
- V1s string `xml:"v1s"`
+ Text string `xml:",chardata"`
+ V1s string `xml:"v1s"`
}{},
}
-func NewE2SetupSuccessResponseMessage(plmnId string, ricId string, request *E2SetupRequestMessage) E2SetupResponseMessage{
+func NewE2SetupSuccessResponseMessage(plmnId string, ricId string, request *E2SetupRequestMessage) E2SetupResponseMessage {
outcome := SuccessfulOutcome{}
outcome.Value.E2setupResponse.ProtocolIEs.E2setupResponseIEs = make([]E2setupResponseIEs, 2)
outcome.ProcedureCode = "1"
Text string `xml:",chardata"`
PLMNIdentity string `xml:"pLMN-Identity"`
RicID string `xml:"ric-ID"`
- }{PLMNIdentity:plmnId, RicID:ricId}}
+ }{PLMNIdentity: plmnId, RicID: ricId}}
outcome.Value.E2setupResponse.ProtocolIEs.E2setupResponseIEs[1].ID = "9"
outcome.Value.E2setupResponse.ProtocolIEs.E2setupResponseIEs[1].Value = RANfunctionsIDList{RANfunctionsIDList: struct {
- Text string `xml:",chardata"`
+ Text string `xml:",chardata"`
ProtocolIESingleContainer []ProtocolIESingleContainer `xml:"ProtocolIE-SingleContainer"`
- }{ProtocolIESingleContainer:extractRanFunctionsIDList(request)}}
- return E2SetupResponseMessage{E2APPDU:E2APPDU{Outcome:outcome}}
+ }{ProtocolIESingleContainer: extractRanFunctionsIDList(request)}}
+ return E2SetupResponseMessage{E2APPDU: E2APPDU{Outcome: outcome}}
}
-func NewE2SetupFailureResponseMessage(timeToWait TimeToWait) E2SetupResponseMessage{
+func NewE2SetupFailureResponseMessage(timeToWait TimeToWait) E2SetupResponseMessage {
outcome := UnsuccessfulOutcome{}
outcome.Value.E2setupFailure.ProtocolIEs.E2setupFailureIEs = make([]E2setupFailureIEs, 2)
outcome.ProcedureCode = "1"
outcome.Value.E2setupFailure.ProtocolIEs.E2setupFailureIEs[0].Value.Value = Cause{}
outcome.Value.E2setupFailure.ProtocolIEs.E2setupFailureIEs[1].ID = "31"
outcome.Value.E2setupFailure.ProtocolIEs.E2setupFailureIEs[1].Value.Value = timeToWaitMap[timeToWait]
- return E2SetupResponseMessage{E2APPDU:E2APPDU{Outcome:outcome}}
+ return E2SetupResponseMessage{E2APPDU: E2APPDU{Outcome: outcome}}
}
type E2SetupResponseMessage struct {
type E2APPDU struct {
XMLName xml.Name `xml:"E2AP-PDU"`
- Text string `xml:",chardata"`
+ Text string `xml:",chardata"`
Outcome interface{}
}
type SuccessfulOutcome struct {
- XMLName xml.Name `xml:"successfulOutcome"`
- Text string `xml:",chardata"`
- ProcedureCode string `xml:"procedureCode"`
+ XMLName xml.Name `xml:"successfulOutcome"`
+ Text string `xml:",chardata"`
+ ProcedureCode string `xml:"procedureCode"`
Criticality struct {
Text string `xml:",chardata"`
Reject string `xml:"reject"`
E2setupResponse struct {
Text string `xml:",chardata"`
ProtocolIEs struct {
- Text string `xml:",chardata"`
- E2setupResponseIEs []E2setupResponseIEs`xml:"E2setupResponseIEs"`
+ Text string `xml:",chardata"`
+ E2setupResponseIEs []E2setupResponseIEs `xml:"E2setupResponseIEs"`
} `xml:"protocolIEs"`
} `xml:"E2setupResponse"`
} `xml:"value"`
Text string `xml:",chardata"`
Reject string `xml:"reject"`
} `xml:"criticality"`
- Value interface{}`xml:"value"`
+ Value interface{} `xml:"value"`
}
type GlobalRICID struct {
}
type RANfunctionsIDList struct {
- Text string `xml:",chardata"`
+ Text string `xml:",chardata"`
RANfunctionsIDList struct {
- Text string `xml:",chardata"`
+ Text string `xml:",chardata"`
ProtocolIESingleContainer []ProtocolIESingleContainer `xml:"ProtocolIE-SingleContainer"`
} `xml:"RANfunctionsID-List"`
}
} `xml:"value"`
}
-
type UnsuccessfulOutcome struct {
- XMLName xml.Name `xml:"unsuccessfulOutcome"`
- Text string `xml:",chardata"`
- ProcedureCode string `xml:"procedureCode"`
+ XMLName xml.Name `xml:"unsuccessfulOutcome"`
+ 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"`
+ Text string `xml:",chardata"`
E2setupFailure struct {
Text string `xml:",chardata"`
ProtocolIEs struct {
- Text string `xml:",chardata"`
- E2setupFailureIEs []E2setupFailureIEs`xml:"E2setupFailureIEs"`
+ Text string `xml:",chardata"`
+ E2setupFailureIEs []E2setupFailureIEs `xml:"E2setupFailureIEs"`
} `xml:"protocolIEs"`
} `xml:"E2setupFailure"`
} `xml:"value"`
}
type Cause struct {
- XMLName xml.Name `xml:"Cause"`
- Text string `xml:",chardata"`
+ XMLName xml.Name `xml:"Cause"`
+ Text string `xml:",chardata"`
Transport struct {
Text string `xml:",chardata"`
TransportResourceUnavailable string `xml:"transport-resource-unavailable"`
} `xml:"transport"`
}
-func extractRanFunctionsIDList(request *E2SetupRequestMessage) []ProtocolIESingleContainer{
+func extractRanFunctionsIDList(request *E2SetupRequestMessage) []ProtocolIESingleContainer {
list := &request.E2APPDU.InitiatingMessage.Value.E2setupRequest.ProtocolIEs.E2setupRequestIEs[1].Value.RANfunctionsList
- ids := make([]ProtocolIESingleContainer,len(list.ProtocolIESingleContainer))
- for i := 0; i< len(ids); i++{
+ ids := make([]ProtocolIESingleContainer, len(list.ProtocolIESingleContainer))
+ for i := 0; i < len(ids); i++ {
ids[i] = convertToRANfunctionID(list, i)
}
return ids
}
-func convertToRANfunctionID(list *RANfunctionsList, i int) ProtocolIESingleContainer{
+func convertToRANfunctionID(list *RANfunctionsList, i int) ProtocolIESingleContainer {
id := ProtocolIESingleContainer{}
id.ID = "6"
id.Value.RANfunctionIDItem.RanFunctionID = list.ProtocolIESingleContainer[i].Value.RANfunctionItem.RanFunctionID
id.Value.RANfunctionIDItem.RanFunctionRevision = list.ProtocolIESingleContainer[i].Value.RANfunctionItem.RanFunctionRevision
return id
-}
\ No newline at end of file
+}
--- /dev/null
+<E2AP-PDU>\r
+ <initiatingMessage>\r
+ <procedureCode>1</procedureCode>\r
+ <criticality>\r
+ <reject/>\r
+ </criticality>\r
+ <value>\r
+ <E2setupRequest>\r
+ <protocolIEs>\r
+ <E2setupRequestIEs>\r
+ <id>3</id>\r
+ <criticality>\r
+ <reject/>\r
+ </criticality>\r
+ <value>\r
+ <GlobalE2node-ID>\r
+ <eNB>\r
+ <global-eNB-ID>\r
+ <pLMN-Identity>63 59 AB</pLMN-Identity>\r
+ <eNB-ID>\r
+ <macro-eNB-ID>101010101010101010</macro-eNB-ID>\r
+ </eNB-ID>\r
+ </global-eNB-ID>\r
+ </eNB>\r
+ </GlobalE2node-ID>\r
+ </value>\r
+ </E2setupRequestIEs>\r
+ <E2setupRequestIEs>\r
+ <id>10</id>\r
+ <criticality>\r
+ <reject/>\r
+ </criticality>\r
+ <value>\r
+ <RANfunctions-List>\r
+ <ProtocolIE-SingleContainer>\r
+ <id>8</id>\r
+ <criticality>\r
+ <reject/>\r
+ </criticality>\r
+ <value>\r
+ <RANfunction-Item>\r
+ <ranFunctionID>1</ranFunctionID>\r
+ <ranFunctionDefinition>334455</ranFunctionDefinition>\r
+ <ranFunctionRevision>0</ranFunctionRevision>\r
+ </RANfunction-Item>\r
+ </value>\r
+ </ProtocolIE-SingleContainer>\r
+ <ProtocolIE-SingleContainer>\r
+ <id>8</id>\r
+ <criticality>\r
+ <reject/>\r
+ </criticality>\r
+ <value>\r
+ <RANfunction-Item>\r
+ <ranFunctionID>7</ranFunctionID>\r
+ <ranFunctionDefinition>334455</ranFunctionDefinition>\r
+ <ranFunctionRevision>0</ranFunctionRevision>\r
+ </RANfunction-Item>\r
+ </value>\r
+ </ProtocolIE-SingleContainer>\r
+ </RANfunctions-List>\r
+ </value>\r
+ </E2setupRequestIEs>\r
+ </protocolIEs>\r
+ </E2setupRequest>\r
+ </value>\r
+ </initiatingMessage>\r
+</E2AP-PDU>
\ No newline at end of file
<ng-eNB>\r
<global-ng-eNB-ID>\r
<plmn-id>13 10 14</plmn-id>\r
- <gnb-id>\r
- <gnb-ID>10011001101010101011</gnb-ID>\r
- </gnb-id>\r
+ <enb-id>\r
+ <enb-ID-shortmacro>101010101010101010</enb-ID-shortmacro>\r
+ </enb-id>\r
</global-ng-eNB-ID>\r
</ng-eNB>\r
</GlobalE2node-ID>\r