This repository has been archived by the owner on Mar 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
TimeDecode_test.go
103 lines (95 loc) · 2.21 KB
/
TimeDecode_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package TimeDecode_test
import (
"log"
"testing"
"time"
"github.com/free5gc/TimeDecode"
"github.com/free5gc/openapi/models"
)
func TestDecode(t *testing.T) {
//Set time
date := time.Now()
dateFormat, _ := time.Parse(time.RFC3339, date.Format(time.RFC3339))
testData1 := map[string]interface{}{
"NfInstanceId": "0",
"NfType": models.NfType_NRF,
"NfStatus": models.NfStatus_REGISTERED,
"HeartBeatTimer": 10,
"PlmnList": &[]models.PlmnId{ // Pattern: '^[0-9]{3}[0-9]{2,3}$'
{
Mcc: "111",
Mnc: "111",
},
},
"SNssais": &[]models.Snssai{ // range 0-255
{
Sst: 222,
Sd: "SNssais",
},
},
"NsiList": []string{
"nsi0",
},
"Fqdn": "fqdn",
"InterPlmnFqdn": "InterPlmnFqdn",
"Ipv4Addresses": []string{
"140.113.1.1",
},
"Ipv6Addresses": []string{
"fc00::",
},
"AllowedPlmns": &[]models.PlmnId{
{
Mcc: "111",
Mnc: "111",
},
},
"AllowedNfTypes": []models.NfType{
models.NfType_NRF,
},
"AllowedNfDomains": []string{
"nfdomain1",
},
"AllowedNssais": &[]models.Snssai{
{
Sst: 333,
Sd: "AllowedNssais",
},
},
"Priority": 1,
"Capacity": 1,
"Load": 1,
"Locality": "NCTU",
"UdrInfo": &models.UdrInfo{},
"UdmInfo": &models.UdmInfo{},
"AusfInfo": &models.AusfInfo{},
"AmfInfo": &models.AmfInfo{},
"SmfInfo": &models.SmfInfo{},
"UpfInfo": &models.UpfInfo{},
"PcfInfo": &models.PcfInfo{},
"BsfInfo": &models.BsfInfo{},
"ChfInfo": &models.ChfInfo{},
"NrfInfo": &models.NrfInfo{},
"CustomInfo": &map[string]interface{}{},
"RecoveryTime": &dateFormat,
"NfServicePersistence": true,
"NfServices": &[]models.NfService{
{
ServiceName: models.ServiceName_NNRF_DISC,
NfServiceStatus: models.NfServiceStatus_REGISTERED,
AllowedNfDomains: []string{
"nfdomain3",
"nfdomain4",
},
},
},
}
var source = []map[string]interface{}{
testData1,
}
target, err := TimeDecode.Decode(source, time.RFC3339)
if err != nil {
t.Log(err)
}
log.Printf("%+v", target)
}