Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
197 commits
Select commit Hold shift + click to select a range
4bc8b92
Added CERTZ2.1 testcases
priyacj Jul 19, 2024
a7b604d
Updated README.md under server_certificates
priyacj Jul 19, 2024
e2073ed
modified README
priyacj Jul 19, 2024
c979897
fixed rundata
priyacj Jul 19, 2024
e85c7e0
Merge branch 'main' into certz2.1
priyacj Jul 22, 2024
1a2265c
Merge branch 'openconfig:main' into certz2.1
priyacj Jul 23, 2024
ddc2a66
updated the README file
priyacj Jul 23, 2024
38b960e
fixed permisison issue
priyacj Jul 24, 2024
7b1be4e
fixed few givencomments
priyacj Jul 24, 2024
de2ed06
fixed the executable bit for this file
priyacj Jul 24, 2024
709d85a
added comments
priyacj Jul 24, 2024
c599cdc
added few comment lines
priyacj Jul 24, 2024
df0326e
Merge branch 'openconfig:main' into certz2.1
priyacj Jul 24, 2024
6054cf3
Merge branch 'main' into certz2.1
priyacj Jul 28, 2024
c82cab6
added certz2.2 testcase
priyacj Jul 28, 2024
bdb91e5
Merge branch 'openconfig:main' into certz2.1
priyacj Jul 29, 2024
1cc9619
Merge branch 'openconfig:main' into certz2.1
priyacj Aug 1, 2024
926141b
Merge branch 'openconfig:main' into certz2.1
priyacj Aug 3, 2024
9bd2262
Merge branch 'openconfig:main' into certz2.1
priyacj Aug 14, 2024
353bee0
Merge branch 'openconfig:main' into certz2.1
priyacj Aug 19, 2024
9e1f95b
Merge branch 'openconfig:main' into certz2.1
priyacj Aug 20, 2024
6a45c84
Merge branch 'openconfig:main' into certz2.1
priyacj Aug 23, 2024
382114a
Merge branch 'openconfig:main' into certz2.1
priyacj Aug 28, 2024
7e9a963
Merge branch 'openconfig:main' into certz2.1
priyacj Aug 28, 2024
e6ee1f7
Merge branch 'main' into certz2.1
priyacj Aug 30, 2024
c24ca52
Merge branch 'openconfig:main' into certz2.1
priyacj Sep 10, 2024
33a1fb2
Merge branch 'openconfig:main' into certz2.1
priyacj Sep 18, 2024
3acbd6b
Merge branch 'openconfig:main' into certz2.1
priyacj Sep 21, 2024
d4c3a84
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 21, 2024
189ea2c
Merge branch 'openconfig:main' into certz2.1
priyacj Nov 14, 2024
f45ac2d
Merge branch 'openconfig:main' into certz2.1
priyacj Nov 18, 2024
f0b4d6d
Merge branch 'openconfig:main' into certz2.1
priyacj Nov 20, 2024
b224384
fixed deprecated grpc.WithBlock:DialOption
priyacj Nov 20, 2024
d295a5b
Merge branch 'openconfig:main' into certz2.1
priyacj Nov 21, 2024
4651125
Merge branch 'openconfig:main' into certz2.1
priyacj Nov 25, 2024
da133b1
fixed all the comments
priyacj Nov 25, 2024
ead1573
fixed the else part
priyacj Nov 25, 2024
0033ed7
fixed the staticerror
priyacj Nov 25, 2024
231dab9
Merge branch 'openconfig:main' into certz2.1
priyacj Nov 26, 2024
992597b
Merge branch 'openconfig:main' into certz2.1
priyacj Dec 4, 2024
afd2aad
Merge branch 'openconfig:main' into certz2.1
priyacj Dec 5, 2024
b3e4fbe
Merge branch 'openconfig:main' into certz2.1
priyacj Dec 5, 2024
3343af1
Merge branch 'openconfig:main' into certz2.1
priyacj Dec 5, 2024
f47373c
Merge branch 'openconfig:main' into certz2.1
priyacj Dec 12, 2024
5c70605
Merge branch 'openconfig:main' into certz2.1
priyacj Dec 16, 2024
24ddc5e
Merge branch 'openconfig:main' into certz2.1
priyacj Dec 19, 2024
136e659
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 2, 2025
4775e1d
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 3, 2025
2922501
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 6, 2025
6aa8f42
feedback comments are checkedin
priyacj Jan 6, 2025
59af27e
fixed the lints
priyacj Jan 6, 2025
ca0ffff
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 7, 2025
ce29e9b
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 7, 2025
5d37635
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 9, 2025
b6c72d1
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 10, 2025
7d4e327
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 13, 2025
b020a8a
fixed the feedback comments
priyacj Jan 13, 2025
e4ba474
incorporated the feedback
priyacj Jan 13, 2025
7dee6bb
fixed the executable bit
priyacj Jan 14, 2025
f1a614a
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 16, 2025
a4298d2
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 17, 2025
442561c
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 23, 2025
deeef60
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 27, 2025
208a76a
Merge branch 'main' into certz2.1
lvaish05 Jan 29, 2025
f37fab0
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 30, 2025
a807d52
Merge branch 'main' into certz2.1
lvaish05 Feb 1, 2025
74868e9
Merge branch 'openconfig:main' into certz2.1
priyacj Feb 3, 2025
168ef63
Merge branch 'openconfig:main' into certz2.1
priyacj Feb 7, 2025
5f24b41
Merge branch 'openconfig:main' into certz2.1
priyacj Feb 10, 2025
9d56c34
Merge branch 'main' into certz2.1
lvaish05 Feb 11, 2025
abdfaa4
Merge branch 'openconfig:main' into certz2.1
priyacj Feb 14, 2025
f03decb
Merge branch 'openconfig:main' into certz2.1
priyacj Feb 16, 2025
4222c45
Merge branch 'main' into certz2.1
lvaish05 Feb 18, 2025
e31d412
Merge branch 'openconfig:main' into certz2.1
priyacj Feb 20, 2025
b83f684
Merge branch 'main' into certz2.1
lvaish05 Feb 26, 2025
44f1802
Merge branch 'openconfig:main' into certz2.1
priyacj Mar 10, 2025
2142c0a
Merge branch 'main' into certz2.1
lvaish05 Mar 12, 2025
9870b13
Merge branch 'openconfig:main' into certz2.1
priyacj Mar 13, 2025
c5c78d3
Merge branch 'main' into certz2.1
lvaish05 Mar 19, 2025
0099e24
Merge branch 'openconfig:main' into certz2.1
priyacj Mar 27, 2025
af5369c
Merge branch 'main' into certz2.1
lvaish05 Apr 2, 2025
88e1d00
Merge branch 'openconfig:main' into certz2.1
priyacj Apr 14, 2025
068e198
Merge branch 'main' into certz2.1
lvaish05 Apr 23, 2025
56f0077
Merge branch 'openconfig:main' into certz2.1
priyacj Apr 29, 2025
89635c3
Merge branch 'main' into certz2.1
lvaish05 Apr 30, 2025
b016eca
Merge branch 'main' into certz2.1
lvaish05 May 12, 2025
a2a8366
Merge branch 'openconfig:main' into certz2.1
priyacj May 13, 2025
4fa0929
Merge branch 'main' into certz2.1
lvaish05 Jun 10, 2025
c34c0c4
Merge branch 'openconfig:main' into certz2.1
priyacj Sep 15, 2025
f2a9a84
Merge branch 'openconfig:main' into certz2.1
priyacj Sep 21, 2025
022a5d3
Merge branch 'openconfig:main' into certz2.1
priyacj Sep 23, 2025
c60c2f3
Merge branch 'openconfig:main' into certz2.1
priyacj Sep 26, 2025
4ae8058
Merge branch 'openconfig:main' into certz2.1
priyacj Sep 29, 2025
49a8db4
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 1, 2025
e0bc344
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 1, 2025
06de414
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 2, 2025
bf430c1
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 7, 2025
885ed81
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 7, 2025
4021ab3
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 8, 2025
1b8e074
addressed comments
priyacj Oct 8, 2025
6a54f81
added comment READMEfile
priyacj Oct 8, 2025
be153d5
fixed go.mod conflict error
priyacj Oct 8, 2025
7db115b
removed commented line#10 from mk_cash.sh
priyacj Oct 8, 2025
33e56fa
updated gofile
priyacj Oct 8, 2025
d336c2d
Update README.md
priyacj Oct 8, 2025
1501b33
Update README.md with canonical OC
priyacj Oct 8, 2025
adda5db
Update server_certificates_test.go
priyacj Oct 8, 2025
3e65e0e
fixed typo errors
priyacj Oct 8, 2025
fb5eb6a
Update README.md
priyacj Oct 8, 2025
0567876
Update README.md
priyacj Oct 8, 2025
144766d
fixed go file
priyacj Oct 8, 2025
bd3fe1a
Update README.md
priyacj Oct 9, 2025
4a05122
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 9, 2025
e850779
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 10, 2025
9483158
Update setup_service.go
priyacj Oct 10, 2025
6371752
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 10, 2025
9935fe7
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 13, 2025
4836328
Update README.md for the canonical errors
priyacj Oct 13, 2025
de1d863
Update README.md with name field
priyacj Oct 13, 2025
8fff1ea
Update README.md with error
priyacj Oct 13, 2025
6e61c03
Update README.md fix-1
priyacj Oct 13, 2025
676545c
newadd for certz2.1
priyacj Oct 13, 2025
f0a3940
moved the files to featureprofiles/feature/gnsi/ from featureprofiles…
priyacj Oct 13, 2025
b51711e
fixed the go package
priyacj Oct 13, 2025
e375972
fixed metadata CERTZ-2
priyacj Oct 13, 2025
fd08eec
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 13, 2025
12b9e7a
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 14, 2025
209c774
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 16, 2025
1195276
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 17, 2025
cb3d981
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 21, 2025
952909d
updated server_certificates_test.go
priyacj Oct 21, 2025
e9efc28
Update setup_service.go
priyacj Oct 21, 2025
817b157
Update setup_service.go
priyacj Oct 21, 2025
5ac6d4f
Update setup_service.go
priyacj Oct 22, 2025
0b0834d
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 22, 2025
cfe14e8
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 28, 2025
bf29b9f
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 29, 2025
69d03f1
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 31, 2025
9e7136d
updated the given feedback from 2.1/2.2
priyacj Oct 31, 2025
1a380b6
Merge branch 'main' into certz2.1
priyacj Oct 31, 2025
82721b2
Update server_certificates_test.go
priyacj Oct 31, 2025
7f8c607
Merge branch 'openconfig:main' into certz2.1
priyacj Oct 31, 2025
d261de0
Update server_certificates_test.go -fmt errors
priyacj Oct 31, 2025
6ad9c45
fixed the seen fmt error
priyacj Oct 31, 2025
1aef732
Merge branch 'main' into certz2.1
lvaish05 Nov 3, 2025
f96f7d3
Merge branch 'openconfig:main' into certz2.1
priyacj Nov 4, 2025
6f8ce74
Merge branch 'openconfig:main' into certz2.1
priyacj Nov 5, 2025
d9fd5ee
Merge branch 'openconfig:main' into certz2.1
priyacj Nov 5, 2025
ee791b9
Merge branch 'main' into certz2.1
lvaish05 Nov 6, 2025
c3fa375
Merge branch 'openconfig:main' into certz2.1
priyacj Nov 7, 2025
6cddf84
Merge branch 'openconfig:main' into certz2.1
priyacj Nov 10, 2025
39ca3b2
Merge branch 'openconfig:main' into certz2.1
priyacj Nov 13, 2025
99daf02
Merge branch 'openconfig:main' into certz2.1
priyacj Nov 19, 2025
40ef076
Merge branch 'openconfig:main' into certz2.1
priyacj Nov 20, 2025
065861e
Merge branch 'openconfig:main' into certz2.1
priyacj Nov 21, 2025
3b5a085
Merge branch 'openconfig:main' into certz2.1
priyacj Dec 1, 2025
9a97e9b
Merge branch 'main' into certz2.1
lvaish05 Dec 8, 2025
a403ce6
fixed the go,mod
priyacj Jan 8, 2026
51b3d49
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 13, 2026
d9fc729
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 14, 2026
b960595
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 16, 2026
c6f63b6
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 20, 2026
06c6e6b
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 22, 2026
75534be
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 23, 2026
637525b
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 26, 2026
2229211
Merge branch 'openconfig:main' into certz2.1
priyacj Jan 31, 2026
46c1fd6
Merge branch 'main' into certz2.1
morrowc Feb 3, 2026
6905fca
Merge branch 'openconfig:main' into certz2.1
priyacj Feb 4, 2026
3f294e6
Merge branch 'main' into certz2.1
morrowc Feb 4, 2026
9d8b945
Merge branch 'openconfig:main' into certz2.1
priyacj Feb 6, 2026
3d0411a
Merge branch 'openconfig:main' into certz2.1
priyacj Feb 9, 2026
77f3d6e
Merge branch 'openconfig:main' into certz2.1
priyacj Feb 10, 2026
5e3c55d
Merge branch 'openconfig:main' into certz2.1
priyacj Feb 12, 2026
310427e
Merge branch 'main' into certz2.1
priyacj Mar 30, 2026
dc9436f
Add '20000' to cleanup script directory loop
priyacj Mar 30, 2026
b6e3b30
Add '20000' to CA directories list
priyacj Mar 30, 2026
ead3d14
Clean up TODO comments in README.md
priyacj Mar 30, 2026
f633d41
Merge branch 'main' into certz2.1
priyacj Mar 30, 2026
b41c072
Merge branch 'openconfig:main' into certz2.1
priyacj Mar 31, 2026
1628270
Merge branch 'openconfig:main' into certz2.1
priyacj Apr 13, 2026
97c8707
Merge branch 'main' into certz2.1
lvaish05 Apr 15, 2026
43acc99
Merge branch 'openconfig:main' into certz2.1
priyacj Apr 22, 2026
78b8647
Merge branch 'openconfig:main' into certz2.1
priyacj Apr 24, 2026
42c81b8
Merge branch 'main' into certz2.1
dplore Apr 27, 2026
a835224
Merge branch 'main' into certz2.1
dplore Apr 28, 2026
7fb8e46
Merge branch 'openconfig:main' into certz2.1
priyacj Apr 29, 2026
c98b957
Merge branch 'openconfig:main' into certz2.1
priyacj May 5, 2026
18844d2
Merge branch 'openconfig:main' into certz2.1
priyacj May 11, 2026
5ba411f
Merge branch 'openconfig:main' into certz2.1
priyacj May 13, 2026
0c55dcd
Merge branch 'openconfig:main' into certz2.1
priyacj May 13, 2026
04c3e45
Merge branch 'openconfig:main' into certz2.1
priyacj May 14, 2026
6dcb802
Merge branch 'openconfig:main' into certz2.1
priyacj May 15, 2026
8dd9c79
Merge branch 'openconfig:main' into certz2.1
priyacj May 19, 2026
74b48a7
modified timeout variable and changed the error response as fatal.
priyacj May 19, 2026
a634261
updated the timeoutVar
priyacj May 19, 2026
5ab2d9f
Merge branch 'openconfig:main' into certz2.1
priyacj May 20, 2026
c1b4f4f
Merge branch 'openconfig:main' into certz2.1
priyacj May 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
*creds.UserPass
}

func (r *rpcCredentials) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {

Check failure on line 62 in feature/gnsi/certz/tests/internal/setup_service/setup_service.go

View workflow job for this annotation

GitHub Actions / Static Analysis

parameter 'uri' seems to be unused, consider removing or renaming it as _

Check failure on line 62 in feature/gnsi/certz/tests/internal/setup_service/setup_service.go

View workflow job for this annotation

GitHub Actions / Static Analysis

parameter 'ctx' seems to be unused, consider removing or renaming it as _
return map[string]string{
"username": r.UserPass.Username,
"password": r.UserPass.Password,
Expand Down Expand Up @@ -97,7 +97,7 @@
TrustBundleFile string
}

// CreateDialOptions function to create the gRPC dial options for certz client and retruns connection handle.

Check failure on line 100 in feature/gnsi/certz/tests/internal/setup_service/setup_service.go

View workflow job for this annotation

GitHub Actions / Static Analysis

comment on exported function CreateNewDialOption should be of the form "CreateNewDialOption ..."
func CreateNewDialOption(t *testing.T, newClientCert tls.Certificate, newCaCert *x509.CertPool, san, username, password, serverAddr string) (conn *grpc.ClientConn) {
credOpts := []grpc.DialOption{grpc.WithTransportCredentials(credentials.NewTLS(
&tls.Config{
Expand Down Expand Up @@ -212,7 +212,7 @@
return certzpb.CertificateChain{}
}

// LoadTrustBundle reads a file that contains a PKCS#7 trust‑bundle.

Check failure on line 215 in feature/gnsi/certz/tests/internal/setup_service/setup_service.go

View workflow job for this annotation

GitHub Actions / Static Analysis

comment on exported function Loadpkcs7TrustBundle should be of the form "Loadpkcs7TrustBundle ..."
func Loadpkcs7TrustBundle(path string) ([]*x509.Certificate, []byte, error) {
data, err := os.ReadFile(path)
if err != nil {
Expand Down Expand Up @@ -294,6 +294,11 @@
t.Logf("gNMI config is replaced with new ssl profile %s successfully.", profileID)
time.Sleep(30 * time.Second) //waiting 30s for gnmi config propagation//
}
if scale {
// waiting 180s for large scale certs to propagate after rotate response
t.Logf("STATUS:%s waiting 180s for large-scale 1000certs to propagate", time.Now())
time.Sleep(180 * time.Second)
}
//Verify gNSI service with new TLS credentials in loop with retries before finalize.
if success = VerifyGnsi(t, newcaCert, san, serverAddr, username, password, newclientCert, mismatch); !success {
t.Fatalf("gNSI service RPC did not succeed after rotate. Certz/Rotate failed. FinalizeRequest will not be sent")
Expand Down Expand Up @@ -424,7 +429,7 @@
}

// ValidateGnsiAuthzGetRequest function to verify get request with authz client.
func ValidateGnsiAuthzGetRequest(ctx context.Context, t *testing.T, authzClient authzpb.AuthzClient, mismatch bool) bool {

Check failure on line 432 in feature/gnsi/certz/tests/internal/setup_service/setup_service.go

View workflow job for this annotation

GitHub Actions / Static Analysis

parameter 'mismatch' seems to be unused, consider removing or renaming it as _

t.Logf("Verifying gNSI Authz GetRequest.")
rsp, err := authzClient.Get(ctx, &authzpb.GetRequest{})
Expand Down Expand Up @@ -462,7 +467,7 @@
// Returns:
//
// bool - True if verification succeeds or expected mismatch occurs, false otherwise.
func VerifyGnoi(t *testing.T, caCert *x509.CertPool, san, serverAddr, username, password string, cert tls.Certificate, mismatch bool) bool {

Check failure on line 470 in feature/gnsi/certz/tests/internal/setup_service/setup_service.go

View workflow job for this annotation

GitHub Actions / Static Analysis

parameter 'mismatch' seems to be unused, consider removing or renaming it as _

credOpts := []grpc.DialOption{grpc.WithTransportCredentials(credentials.NewTLS(
&tls.Config{
Expand All @@ -489,7 +494,7 @@
}

// ValidateGnoiPingRequest function verifies ping request with the gnoiclient.
func ValidateGnoiPingRequest(ctx context.Context, t *testing.T, sysClient spb.SystemClient, mismatch bool) bool {

Check failure on line 497 in feature/gnsi/certz/tests/internal/setup_service/setup_service.go

View workflow job for this annotation

GitHub Actions / Static Analysis

parameter 'mismatch' seems to be unused, consider removing or renaming it as _

t.Logf("Verifying gNOI Ping Request.")
if _, err := sysClient.Ping(ctx, &spb.PingRequest{}); err != nil {
Expand Down Expand Up @@ -546,12 +551,12 @@
}

// ValidateGnmiCapabilityRequest function validates the gNMI RPC request.
func ValidateGnmiCapabilityRequest(ctx context.Context, t *testing.T, gnmiClient gnmipb.GNMIClient, mismatch bool) bool {

Check failure on line 554 in feature/gnsi/certz/tests/internal/setup_service/setup_service.go

View workflow job for this annotation

GitHub Actions / Static Analysis

parameter 'mismatch' seems to be unused, consider removing or renaming it as _

t.Logf("Verifying gNMI Capability Request.")
response, err := gnmiClient.Capabilities(ctx, &gnmipb.CapabilityRequest{})
if err != nil {
t.Errorf("gNMI Capability request failed with err: %v", err)
t.Fatalf("gNMI Capability request failed with err: %v", err)
}
t.Logf("VerifyGnmi:gNMI response: %s", response.GNMIVersion)
return true
Expand Down Expand Up @@ -605,7 +610,7 @@
}

// ValidateGribiGetRequest function verifies get request RPC with the gNMIClient.
func ValidateGribiGetRequest(ctx context.Context, t *testing.T, gRibiClient gribipb.GRIBIClient, mismatch bool) bool {

Check failure on line 613 in feature/gnsi/certz/tests/internal/setup_service/setup_service.go

View workflow job for this annotation

GitHub Actions / Static Analysis

parameter 'mismatch' seems to be unused, consider removing or renaming it as _

t.Logf("Verifying gRIBI GetRequest.")
_, err := gRibiClient.Get(ctx, &gribipb.GetRequest{})
Expand Down Expand Up @@ -660,11 +665,12 @@
}

// ValidateP4RtCapabilitiesRequest function verifies the Capabilities request with the p4RT client.
func ValidateP4RtCapabilitiesRequest(ctx context.Context, t *testing.T, p4rtClient p4rtpb.P4RuntimeClient, mismatch bool) bool {

Check failure on line 668 in feature/gnsi/certz/tests/internal/setup_service/setup_service.go

View workflow job for this annotation

GitHub Actions / Static Analysis

parameter 'mismatch' seems to be unused, consider removing or renaming it as _

t.Logf("Verifying P4Rt Capability Request.")

if _, err := p4rtClient.Capabilities(ctx, &p4rtpb.CapabilitiesRequest{}); err != nil {
t.Errorf("Failed to connect P4rtClient with error %v.", err)
t.Fatalf("Failed to connect P4rtClient with error %v.", err)
}
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (

const (
dirPath = "../../test_data/"
timeOutVar time.Duration = 2 * time.Minute
timeOutVar time.Duration = 5 * time.Minute
)

// DUTCredentialer is an interface for getting credentials from a DUT binding.
Expand All @@ -48,7 +48,6 @@ var (
prevClientCertFile string = ""
prevClientKeyFile string = ""
prevTrustBundleFile string = ""
logTime string = time.Now().String() //Timestamp
expectedResult bool = true
)

Expand All @@ -64,37 +63,37 @@ func TestServerCert(t *testing.T) {
dut := ondatra.DUT(t, "dut")
serverAddr = dut.Name() //returns the device name.
if err := binding.DUTAs(dut.RawAPIs().BindingDUT(), &creds); err != nil {
t.Fatalf("%s:STATUS:Failed to get DUT credentials using binding.DUTAs: %v. The binding for %s must implement the DUTCredentialer interface", logTime, err, dut.Name())
t.Fatalf("%s:STATUS:Failed to get DUT credentials using binding.DUTAs: %v. The binding for %s must implement the DUTCredentialer interface", time.Now().String(), err, dut.Name())
}
username := creds.RPCUsername()
password := creds.RPCPassword()
t.Logf("Validation of all services that are using gRPC before server certificate rotation.")
gnmiClient, gnsiC := setupService.PreInitCheck(context.Background(), t, dut)
//Generate testdata certificates.
t.Logf("%s:STATUS:Generation of test data certificates.", logTime)
t.Logf("%s:STATUS:Generation of test data certificates.", time.Now().String())
if err := setupService.TestdataMakeCleanup(t, dirPath, timeOutVar, "./mk_cas.sh"); err != nil {
t.Logf("%s:STATUS:Generation of testdata certificates failed!: %v", logTime, err)
t.Logf("%s:STATUS:Generation of testdata certificates failed!: %v", time.Now().String(), err)
}
//Create a certz client.
ctx := context.Background()
certzClient := gnsiC.Certz()
t.Logf("%s:STATUS:Precheck:checking baseline sslprofile list.", logTime)
t.Logf("%s:STATUS:Precheck:checking baseline sslprofile list.", time.Now().String())
//Get sslprofile list.
if getResp := setupService.GetSslProfilelist(ctx, t, certzClient, &certzpb.GetProfileListRequest{}); slices.Contains(getResp.SslProfileIds, testProfile) {
t.Fatalf("%s:STATUS:profileID %s already exists.", logTime, testProfile)
t.Fatalf("%s:STATUS:profileID %s already exists.", time.Now().String(), testProfile)
}
//Add a new sslprofileID.
t.Logf("%s:STATUS:Adding new sslprofileID %s.", logTime, testProfile)
t.Logf("%s:STATUS:Adding new sslprofileID %s.", time.Now().String(), testProfile)
if addProfileResponse, err := certzClient.AddProfile(ctx, &certzpb.AddProfileRequest{SslProfileId: testProfile}); err != nil {
t.Fatalf("%s:STATUS:Add profile request failed with %v! ", logTime, err)
t.Fatalf("%s:STATUS:Add profile request failed with %v! ", time.Now().String(), err)
} else {
t.Logf("%s:STATUS:Received the AddProfileResponse %v.", logTime, addProfileResponse)
t.Logf("%s:STATUS:Received the AddProfileResponse %v.", time.Now().String(), addProfileResponse)
}
//Get sslprofile list after new sslprofile addition.
if getResp := setupService.GetSslProfilelist(ctx, t, certzClient, &certzpb.GetProfileListRequest{}); !slices.Contains(getResp.SslProfileIds, testProfile) {
t.Fatalf("%s:STATUS:newly added profileID is not seen.", logTime)
t.Fatalf("%s:STATUS:newly added profileID is not seen.", time.Now().String())
} else {
t.Logf("%sSTATUS:new profileID %s is seen in sslprofile list", logTime, testProfile)
t.Logf("%sSTATUS:new profileID %s is seen in sslprofile list", time.Now().String(), testProfile)
}
cases := []struct {
desc string
Expand Down Expand Up @@ -225,7 +224,7 @@ func TestServerCert(t *testing.T) {
}
for _, tc := range cases {
t.Run(tc.desc, func(t *testing.T) {
t.Logf("%s:STATUS:Starting test case: %s", logTime, tc.desc)
t.Logf("%s:STATUS:Starting test case: %s", time.Now().String(), tc.desc)
//Read the serverSAN (Subject Alternative Name) from the certificate used for TLS verification.
serverSAN := setupService.ReadDecodeServerCertificate(t, tc.serverCertFile)
//Build serverCertEntity for the server certificate rotation.
Expand All @@ -237,7 +236,7 @@ func TestServerCert(t *testing.T) {
//Create a new Cert Pool and add the certs from the trust bundle.
pkcs7certs, pkcs7data, err := setupService.Loadpkcs7TrustBundle(tc.trustBundleFile)
if err != nil {
t.Fatalf("%s:STATUS:Failed to load trust bundle: %v", logTime, err)
t.Fatalf("%s:STATUS:Failed to load trust bundle: %v", time.Now().String(), err)
}
newCaCert := x509.NewCertPool()
for _, c := range pkcs7certs {
Expand All @@ -248,18 +247,18 @@ func TestServerCert(t *testing.T) {
//Load Client certificate.
newClientCert, err := tls.LoadX509KeyPair(tc.clientCertFile, tc.clientKeyFile)
if err != nil {
t.Fatalf("%s:STATUS:Failed to load client cert: %v", logTime, err)
t.Fatalf("%s:STATUS:Failed to load client cert: %v", time.Now().String(), err)
}
if tc.newTLScreds {
t.Logf("%s:STATUS:%sCreating new TLS credentials for client connection.", logTime, tc.desc)
t.Logf("%s:STATUS:%sCreating new TLS credentials for client connection.", time.Now().String(), tc.desc)
//Load the prior client keypair for new client TLS credentials.
prevClientCert, err := tls.LoadX509KeyPair(prevClientCertFile, prevClientKeyFile)
if err != nil {
t.Fatalf("%s:STATUS:%s:Failed to load previous client cert: %v.", logTime, tc.desc, err)
t.Fatalf("%s:STATUS:%s:Failed to load previous client cert: %v.", time.Now().String(), tc.desc, err)
}
oldPkcs7certs, oldPkcs7data, err := setupService.Loadpkcs7TrustBundle(prevTrustBundleFile)
if err != nil {
t.Fatalf("%s:STATUS:%s:Failed to load previous trust bundle,data %v with %v.", logTime, tc.desc, oldPkcs7data, err)
t.Fatalf("%s:STATUS:%s:Failed to load previous trust bundle,data %v with %v.", time.Now().String(), tc.desc, oldPkcs7data, err)
}
//Create a old set of Cert Pool and append the certs from previous trust bundle.
prevCaCert := x509.NewCertPool()
Expand All @@ -268,7 +267,7 @@ func TestServerCert(t *testing.T) {
}
//Before rotation, validation of all services with existing certificates.
if result := setupService.ServicesValidationCheck(t, prevCaCert, expectedResult, serverSAN, serverAddr, username, password, prevClientCert, tc.mismatch); !result {
t.Fatalf("%s:STATUS:%s:service validation failed before rotate- got %v, want %v.", logTime, tc.desc, result, expectedResult)
t.Fatalf("%s:STATUS:%s:service validation failed before rotate- got %v, want %v.", time.Now().String(), tc.desc, result, expectedResult)
}
//Retrieve the connection with previous TLS credentials for certz rotation.
conn := setupService.CreateNewDialOption(t, prevClientCert, prevCaCert, serverSAN, username, password, serverAddr)
Expand All @@ -277,31 +276,31 @@ func TestServerCert(t *testing.T) {
certzClient = certzpb.NewCertzClient(conn)
gnmiClient = gnmi.NewGNMIClient(conn)
} else {
t.Logf("%s:STATUS:%s:Using existing TLS credentials for client connection in first iteration.", logTime, tc.desc)
t.Logf("%s:STATUS:%s:Using existing TLS credentials for client connection in first iteration.", time.Now().String(), tc.desc)
}
//Initiate server certificate rotation.
t.Logf("%s:STATUS:%s Initiating Certz rotation with server cert: %s and trust bundle: %s.", logTime, tc.desc, tc.serverCertFile, tc.trustBundleFile)
t.Logf("%s:STATUS:%s Initiating Certz rotation with server cert: %s and trust bundle: %s.", time.Now().String(), tc.desc, tc.serverCertFile, tc.trustBundleFile)
if success := setupService.CertzRotate(ctx, t, newCaCert, certzClient, gnmiClient, newClientCert, dut, username, password, serverSAN, serverAddr, testProfile, tc.newTLScreds, tc.mismatch, tc.scale, &serverCertEntity, &trustBundleEntity); !success {
t.Fatalf("%s:STATUS: %s:Certz rotation failed.", logTime, tc.desc)
t.Fatalf("%s:STATUS: %s:Certz rotation failed.", time.Now().String(), tc.desc)
}
t.Logf("%s:STATUS:%s: Certz rotation completed!", logTime, tc.desc)
t.Logf("%s:STATUS:%s: Certz rotation completed!", time.Now().String(), tc.desc)
//Post rotate validation of all services.
t.Run("Verification of new connection after rotate", func(t *testing.T) {
if result := setupService.ServicesValidationCheck(t, newCaCert, expectedResult, serverSAN, serverAddr, username, password, newClientCert, tc.mismatch); !result {
t.Fatalf("STATUS:%s:service validation failed after rotate- got %v, want %v.", tc.desc, result, expectedResult)
}
t.Logf("%s:STATUS:%s:service validation done!", logTime, tc.desc)
t.Logf("%s:STATUS:%s:service validation done!", time.Now().String(), tc.desc)
})
//Archiving previous client cert/key and trustbundle.
prevClientCertFile = tc.clientCertFile
prevClientKeyFile = tc.clientKeyFile
prevTrustBundleFile = tc.trustBundleFile
})
}
t.Logf("%s:STATUS:Cleanup of test data.", logTime)
t.Logf("%s:STATUS:Cleanup of test data.", time.Now().String())
//Cleanup of test data.
if err := setupService.TestdataMakeCleanup(t, dirPath, timeOutVar, "./cleanup.sh"); err != nil {
t.Logf("%s:STATUS:Cleanup of testdata certificates failed!: %v", logTime, err)
t.Logf("%s:STATUS:Cleanup of testdata certificates failed!: %v", time.Now().String(), err)
}
t.Logf("%s:STATUS:Test completed!", logTime)
t.Logf("%s:STATUS:Test completed!", time.Now().String())
}
Loading