Skip to content

Commit

Permalink
p4rt-3.1 & p4rt-7.1: add missing check on metadata length (openconfig…
Browse files Browse the repository at this point in the history
…#2363)

* p4rt-7.1: add check on metadata length

This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia’s intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind.

* p4rt-3.1: add check on metadata length

This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia’s intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind.

* p4rt-7.1: upd. check on metadata length with a strict check

This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia’s intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind.

* p4rt-3.1: upd. check on metadata length with a strict check

This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia’s intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind.

* p4rt-3.1: upd. check on metadata length with a strict check

This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia’s intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind.

* p4rt-3.1: produce an error on unrecognized metadata id

This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia’s intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind.

* p4rt-7.1: produce an error on unrecognized metadata id

This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia’s intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind.
  • Loading branch information
LimeHat authored Nov 28, 2023
1 parent e8f5fef commit 458129f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ func testPacketIn(ctx context.Context, t *testing.T, args *testArgs) {
}

metaData := packet.Pkt.GetMetadata()
if len(metaData) != 2 {
t.Fatalf("Incorrect number of Metadata headers, want: %v, got: %v", 2, len(metaData))
}
for _, data := range metaData {
switch data.GetMetadataId() {
case metadataIngressPort:
Expand All @@ -283,6 +286,8 @@ func testPacketIn(ctx context.Context, t *testing.T, args *testArgs) {
if !found {
t.Fatalf("Egress Port Id is not matching expectation.")
}
default:
t.Errorf("Received an unrecognized metadata with id %v", data.GetMetadataId())
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ func testPacketIn(ctx context.Context, t *testing.T, args *testArgs) {
}

metaData := packet.Pkt.GetMetadata()
if len(metaData) != 2 {
t.Fatalf("Incorrect number of Metadata headers, want: %v, got: %v", 2, len(metaData))
}
for _, data := range metaData {
switch data.GetMetadataId() {
case metadataIngressPort:
Expand All @@ -218,6 +221,8 @@ func testPacketIn(ctx context.Context, t *testing.T, args *testArgs) {
if !found {
t.Fatalf("Egress Port Id is not matching expectation.")
}
default:
t.Errorf("Received an unrecognized metadata with id %v", data.GetMetadataId())
}
}
gotPkts++
Expand Down

0 comments on commit 458129f

Please sign in to comment.