Skip to content

Commit

Permalink
Fix handling usecases not being available yet
Browse files Browse the repository at this point in the history
  • Loading branch information
DerAndereAndi committed Jan 9, 2024
1 parent 8e0372a commit eb9a1f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion spine/device_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,11 @@ func (d *DeviceRemoteImpl) UseCases() []model.UseCaseInformationDataType {
nodemgmt := d.FeatureByEntityTypeAndRole(entity, model.FeatureTypeTypeNodeManagement, model.RoleTypeSpecial)

data := nodemgmt.DataCopy(model.FunctionTypeNodeManagementUseCaseData).(*model.NodeManagementUseCaseDataType)
if data != nil {
return data.UseCaseInformation
}

return data.UseCaseInformation
return nil
}

// Checks if the given actor, usecasename and provided server features are available
Expand Down
5 changes: 4 additions & 1 deletion spine/device_remote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,12 @@ func (s *DeviceRemoteSuite) Test_FeatureByEntityTypeAndRole() {
}

func (s *DeviceRemoteSuite) Test_Usecases() {
uc := s.remoteDevice.UseCases()
assert.Nil(s.T(), uc)

_, _ = s.remoteDevice.HandleIncomingSpineMesssage(loadFileData(s.T(), nm_usecaseinformationlistdata_recv_reply_file_path))

uc := s.remoteDevice.UseCases()
uc = s.remoteDevice.UseCases()
assert.NotNil(s.T(), uc)
}

Expand Down

0 comments on commit eb9a1f6

Please sign in to comment.