Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
v2020-07-21-01
Browse files Browse the repository at this point in the history
  • Loading branch information
free5gc-org committed Jul 21, 2020
1 parent 8ebf360 commit 4f83de4
Show file tree
Hide file tree
Showing 9 changed files with 610 additions and 22 deletions.
26 changes: 14 additions & 12 deletions AMF/TestAmf/Init.go
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package TestAmf

import (
"free5gc/lib/path_util"
"free5gc/src/amf/factory"
"free5gc/src/amf/gmm"
"free5gc/src/amf/logger"
amf_ngap_sctp "free5gc/src/amf/ngap/sctp"
"free5gc/src/amf/util"
"log"
"net"
"strings"
"time"

"git.cs.nctu.edu.tw/calee/sctp"

"github.com/davecgh/go-spew/spew"

"free5gc/lib/nas/security"
"free5gc/lib/openapi/models"
"free5gc/lib/path_util"
"free5gc/src/amf/context"
"free5gc/src/amf/factory"
"free5gc/src/amf/gmm"
"free5gc/src/amf/logger"
amf_ngap_sctp "free5gc/src/amf/ngap/sctp"
"free5gc/src/amf/util"
)

var TestAmf = context.AMF_Self()
Expand Down Expand Up @@ -102,8 +102,8 @@ func AmfInit() {
ue.Kamf = strings.Repeat("1", 64)
ue.SecurityCapabilities.NRIntegrityProtectionAlgorithms = [2]byte{0x40, 0x00}
ue.SecurityCapabilities.NREncryptionAlgorithms = [2]byte{0x40, 0x00}
ue.CipheringAlg = context.ALG_CIPHERING_128_NEA2
ue.IntegrityAlg = context.ALG_INTEGRITY_128_NIA2
ue.CipheringAlg = security.AlgCiphering128NEA2
ue.IntegrityAlg = security.AlgIntegrity128NIA2
ue.DerivateAnKey(models.AccessType__3_GPP_ACCESS)
ue.DerivateNH(ue.Kgnb)
ue.DerivateAlgKey()
Expand Down Expand Up @@ -217,19 +217,21 @@ func UeAttach(anType models.AccessType) {
if Conn == nil {
ran = TestAmf.NewAmfRan(testConn)
} else {
ran = TestAmf.AmfRanPool[Laddr.String()]
value, _ := TestAmf.AmfRanPool.Load(Laddr.String())
ran = value.(*context.AmfRan)
}
} else {
if Conn2 == nil {
testConn.RAddr.Value = "127.0.0.1:9488"
ran = TestAmf.NewAmfRan(testConn)
} else {
ran = TestAmf.AmfRanPool[Laddr2.String()]
value, _ := TestAmf.AmfRanPool.Load(Laddr2.String())
ran = value.(*context.AmfRan)
}
}
ran.AnType = anType
ranUe := ran.NewRanUe()
ue := TestAmf.UePool["imsi-2089300007487"]
ue, _ := TestAmf.AmfUeFindBySupi("imsi-2089300007487")
ran.SupportedTAList = []context.SupportedTAI{
{
Tai: ue.Tai,
Expand Down
121 changes: 121 additions & 0 deletions AMF/TestAmf/TestNeaNia/nea1_test_data.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
package TestNeaNia

type NEA1TestSet struct {
CountC uint32
Bearer uint32
Direction uint32
Ck [16]byte
Length uint32
Ibs []byte
Obs []byte
}

const (
NEA1Test1 = "NEA1Test1"
NEA1Test2 = "NEA1Test2"
NEA1Test3 = "NEA1Test3"
NEA1Test4 = "NEA1Test4"
NEA1Test5 = "NEA1Test5"
)

var TestNEA1Table = make(map[string]*NEA1TestSet)

func init() {
TestNEA1Table[NEA1Test1] = &NEA1TestSet{
CountC: 0x72a4f20f,
Bearer: 0x0c,
Direction: 1,
Ck: [16]byte{0x2b, 0xd6, 0x45, 0x9f, 0x82, 0xc5, 0xb3, 0x00, 0x95, 0x2c, 0x49, 0x10, 0x48, 0x81, 0xff, 0x48},
Length: 798,
Ibs: []byte{
0x7e, 0xc6, 0x12, 0x72, 0x74, 0x3b, 0xf1, 0x61, 0x47, 0x26, 0x44, 0x6a, 0x6c, 0x38, 0xce, 0xd1,
0x66, 0xf6, 0xca, 0x76, 0xeb, 0x54, 0x30, 0x04, 0x42, 0x86, 0x34, 0x6c, 0xef, 0x13, 0x0f, 0x92,
0x92, 0x2b, 0x03, 0x45, 0x0d, 0x3a, 0x99, 0x75, 0xe5, 0xbd, 0x2e, 0xa0, 0xeb, 0x55, 0xad, 0x8e,
0x1b, 0x19, 0x9e, 0x3e, 0xc4, 0x31, 0x60, 0x20, 0xe9, 0xa1, 0xb2, 0x85, 0xe7, 0x62, 0x79, 0x53,
0x59, 0xb7, 0xbd, 0xfd, 0x39, 0xbe, 0xf4, 0xb2, 0x48, 0x45, 0x83, 0xd5, 0xaf, 0xe0, 0x82, 0xae,
0xe6, 0x38, 0xbf, 0x5f, 0xd5, 0xa6, 0x06, 0x19, 0x39, 0x01, 0xa0, 0x8f, 0x4a, 0xb4, 0x1a, 0xab,
0x9b, 0x13, 0x48, 0x80,
},
Obs: []byte{
0x8c, 0xeb, 0xa6, 0x29, 0x43, 0xdc, 0xed, 0x3a, 0x09, 0x90, 0xb0, 0x6e, 0xa1, 0xb0, 0xa2, 0xc4,
0xfb, 0x3c, 0xed, 0xc7, 0x1b, 0x36, 0x9f, 0x42, 0xba, 0x64, 0xc1, 0xeb, 0x66, 0x65, 0xe7, 0x2a,
0xa1, 0xc9, 0xbb, 0x0d, 0xea, 0xa2, 0x0f, 0xe8, 0x60, 0x58, 0xb8, 0xba, 0xee, 0x2c, 0x2e, 0x7f,
0x0b, 0xec, 0xce, 0x48, 0xb5, 0x29, 0x32, 0xa5, 0x3c, 0x9d, 0x5f, 0x93, 0x1a, 0x3a, 0x7c, 0x53,
0x22, 0x59, 0xaf, 0x43, 0x25, 0xe2, 0xa6, 0x5e, 0x30, 0x84, 0xad, 0x5f, 0x6a, 0x51, 0x3b, 0x7b,
0xdd, 0xc1, 0xb6, 0x5f, 0x0a, 0xa0, 0xd9, 0x7a, 0x05, 0x3d, 0xb5, 0x5a, 0x88, 0xc4, 0xc4, 0xf9,
0x60, 0x5e, 0x41, 0x40,
},
}

TestNEA1Table[NEA1Test2] = &NEA1TestSet{
CountC: 0xe28bcf7b,
Bearer: 0x18,
Direction: 0,
Ck: [16]byte{0xef, 0xa8, 0xb2, 0x22, 0x9e, 0x72, 0x0c, 0x2a, 0x7c, 0x36, 0xea, 0x55, 0xe9, 0x60, 0x56, 0x95},
Length: 510,
Ibs: []byte{
0x10, 0x11, 0x12, 0x31, 0xe0, 0x60, 0x25, 0x3a, 0x43, 0xfd, 0x3f, 0x57, 0xe3, 0x76, 0x07, 0xab,
0x28, 0x27, 0xb5, 0x99, 0xb6, 0xb1, 0xbb, 0xda, 0x37, 0xa8, 0xab, 0xcc, 0x5a, 0x8c, 0x55, 0x0d,
0x1b, 0xfb, 0x2f, 0x49, 0x46, 0x24, 0xfb, 0x50, 0x36, 0x7f, 0xa3, 0x6c, 0xe3, 0xbc, 0x68, 0xf1,
0x1c, 0xf9, 0x3b, 0x15, 0x10, 0x37, 0x6b, 0x02, 0x13, 0x0f, 0x81, 0x2a, 0x9f, 0xa1, 0x69, 0xd8,
},
Obs: []byte{
0xe0, 0xda, 0x15, 0xca, 0x8e, 0x25, 0x54, 0xf5, 0xe5, 0x6c, 0x94, 0x68, 0xdc, 0x6c, 0x7c, 0x12,
0x9c, 0x56, 0x8a, 0xa5, 0x03, 0x23, 0x17, 0xe0, 0x4e, 0x07, 0x29, 0x64, 0x6c, 0xab, 0xef, 0xa6,
0x89, 0x86, 0x4c, 0x41, 0x0f, 0x24, 0xf9, 0x19, 0xe6, 0x1e, 0x3d, 0xfd, 0xfa, 0xd7, 0x7e, 0x56,
0x0d, 0xb0, 0xa9, 0xcd, 0x36, 0xc3, 0x4a, 0xe4, 0x18, 0x14, 0x90, 0xb2, 0x9f, 0x5f, 0xa2, 0xfc,
},
}

TestNEA1Table[NEA1Test3] = &NEA1TestSet{
CountC: 0xfa556b26,
Bearer: 0x03,
Direction: 1,
Ck: [16]byte{0x5a, 0xcb, 0x1d, 0x64, 0x4c, 0x0d, 0x51, 0x20, 0x4e, 0xa5, 0xf1, 0x45, 0x10, 0x10, 0xd8, 0x52},
Length: 120,
Ibs: []byte{0xad, 0x9c, 0x44, 0x1f, 0x89, 0x0b, 0x38, 0xc4, 0x57, 0xa4, 0x9d, 0x42, 0x14, 0x07, 0xe8, 0x00},
Obs: []byte{0xba, 0x0f, 0x31, 0x30, 0x03, 0x34, 0xc5, 0x6b, 0x52, 0xa7, 0x49, 0x7c, 0xba, 0xc0, 0x46, 0x00},
}

TestNEA1Table[NEA1Test4] = &NEA1TestSet{
CountC: 0x398a59b4,
Bearer: 0x05,
Direction: 1,
Ck: [16]byte{0xd3, 0xc5, 0xd5, 0x92, 0x32, 0x7f, 0xb1, 0x1c, 0x40, 0x35, 0xc6, 0x68, 0x0a, 0xf8, 0xc6, 0xd1},
Length: 253,
Ibs: []byte{
0x98, 0x1b, 0xa6, 0x82, 0x4c, 0x1b, 0xfb, 0x1a, 0xb4, 0x85, 0x47, 0x20, 0x29, 0xb7, 0x1d, 0x80,
0x8c, 0xe3, 0x3e, 0x2c, 0xc3, 0xc0, 0xb5, 0xfc, 0x1f, 0x3d, 0xe8, 0xa6, 0xdc, 0x66, 0xb1, 0xf0,
},
Obs: []byte{
0x98, 0x9b, 0x71, 0x9c, 0xdc, 0x33, 0xce, 0xb7, 0xcf, 0x27, 0x6a, 0x52, 0x82, 0x7c, 0xef, 0x94,
0xa5, 0x6c, 0x40, 0xc0, 0xab, 0x9d, 0x81, 0xf7, 0xa2, 0xa9, 0xba, 0xc6, 0x0e, 0x11, 0xc4, 0xb0,
},
}

TestNEA1Table[NEA1Test5] = &NEA1TestSet{
CountC: 0x72a4f20f,
Bearer: 0x09,
Direction: 0,
Ck: [16]byte{0x60, 0x90, 0xea, 0xe0, 0x4c, 0x83, 0x70, 0x6e, 0xec, 0xbf, 0x65, 0x2b, 0xe8, 0xe3, 0x65, 0x66},
Length: 837,
Ibs: []byte{
0x40, 0x98, 0x1b, 0xa6, 0x82, 0x4c, 0x1b, 0xfb, 0x42, 0x86, 0xb2, 0x99, 0x78, 0x3d, 0xaf, 0x44,
0x2c, 0x09, 0x9f, 0x7a, 0xb0, 0xf5, 0x8d, 0x5c, 0x8e, 0x46, 0xb1, 0x04, 0xf0, 0x8f, 0x01, 0xb4,
0x1a, 0xb4, 0x85, 0x47, 0x20, 0x29, 0xb7, 0x1d, 0x36, 0xbd, 0x1a, 0x3d, 0x90, 0xdc, 0x3a, 0x41,
0xb4, 0x6d, 0x51, 0x67, 0x2a, 0xc4, 0xc9, 0x66, 0x3a, 0x2b, 0xe0, 0x63, 0xda, 0x4b, 0xc8, 0xd2,
0x80, 0x8c, 0xe3, 0x3e, 0x2c, 0xcc, 0xbf, 0xc6, 0x34, 0xe1, 0xb2, 0x59, 0x06, 0x08, 0x76, 0xa0,
0xfb, 0xb5, 0xa4, 0x37, 0xeb, 0xcc, 0x8d, 0x31, 0xc1, 0x9e, 0x44, 0x54, 0x31, 0x87, 0x45, 0xe3,
0x98, 0x76, 0x45, 0x98, 0x7a, 0x98, 0x6f, 0x2c, 0xb0,
},
Obs: []byte{
0x58, 0x92, 0xbb, 0xa8, 0x8b, 0xbb, 0xca, 0xae, 0xae, 0x76, 0x9a, 0xa0, 0x6b, 0x68, 0x3d, 0x3a,
0x17, 0xcc, 0x04, 0xa3, 0x69, 0x88, 0x16, 0x97, 0x43, 0x5e, 0x44, 0xfe, 0xd5, 0xff, 0x9a, 0xf5,
0x7b, 0x9e, 0x89, 0x0d, 0x4d, 0x5c, 0x64, 0x70, 0x98, 0x85, 0xd4, 0x8a, 0xe4, 0x06, 0x90, 0xec,
0x04, 0x3b, 0xaa, 0xe9, 0x70, 0x57, 0x96, 0xe4, 0xa9, 0xff, 0x5a, 0x4b, 0x8d, 0x8b, 0x36, 0xd7,
0xf3, 0xfe, 0x57, 0xcc, 0x6c, 0xfd, 0x6c, 0xd0, 0x05, 0xcd, 0x38, 0x52, 0xa8, 0x5e, 0x94, 0xce,
0x6b, 0xcd, 0x90, 0xd0, 0xd0, 0x78, 0x39, 0xce, 0x09, 0x73, 0x35, 0x44, 0xca, 0x8e, 0x35, 0x08,
0x43, 0x24, 0x85, 0x50, 0x92, 0x2a, 0xc1, 0x28, 0x18,
},
}
}
Loading

0 comments on commit 4f83de4

Please sign in to comment.