-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Ignore NRF URI containing a specific IP on registration (#26)
* fix: Ignore NRF URI containing a specific IP on registration * Add copyright and license to example configuration file * Update factory/config.example.yaml Co-authored-by: gab-arrobo <[email protected]> --------- Co-authored-by: gab-arrobo <[email protected]>
- Loading branch information
1 parent
eb2cc23
commit 653cefd
Showing
4 changed files
with
65 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## SPDX-FileCopyrightText: 2023 Open Networking Foundation <[email protected]> | ||
## | ||
## SPDX-License-Identifier: Apache-2.0 | ||
## | ||
info: | ||
version: 1.0.0 | ||
description: UDR initial local configuration | ||
|
||
configuration: | ||
sbi: # Service Based Interface | ||
scheme: https | ||
registerIPv4: 127.0.0.4 | ||
bindingIPv4: 0.0.0.0 | ||
port: 8000 | ||
plmnSupportList: | ||
- plmnId: | ||
mcc: "208" | ||
mnc: "93" | ||
snssaiList: | ||
- sst: 1 | ||
sd: "010203" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright 2023 Open Networking Foundation <[email protected]> | ||
// | ||
|
||
package service | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
"net/http/httptest" | ||
"testing" | ||
"time" | ||
|
||
"github.com/omec-project/udr/context" | ||
"github.com/omec-project/udr/factory" | ||
) | ||
|
||
func Test_nrf_url_is_not_overwritten_when_registering(t *testing.T) { | ||
svr := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||
fmt.Fprintf(w, "banana") | ||
})) | ||
svr.EnableHTTP2 = true | ||
svr.StartTLS() | ||
defer svr.Close() | ||
if err := factory.InitConfigFactory("../factory/config.example.yaml"); err != nil { | ||
t.Fatalf("Could not read example configuration file") | ||
} | ||
self := context.UDR_Self() | ||
self.NrfUri = svr.URL | ||
self.RegisterIPv4 = "127.0.0.2" | ||
var udr *UDR | ||
go udr.registerNF() | ||
factory.ConfigPodTrigger <- true | ||
|
||
time.Sleep(1 * time.Second) | ||
if self.NrfUri != svr.URL { | ||
t.Errorf("Expected NRF URL to stay %v, but was %v", svr.URL, self.NrfUri) | ||
} | ||
} |