-
Notifications
You must be signed in to change notification settings - Fork 216
fix for 498147479 PF-1.4 ip_guev1_static_decap_subnet_range #5437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -482,7 +482,13 @@ func gueDecapInnerIpv4Traffic(t *testing.T, dut *ondatra.DUTDevice, ate *ondatra | |||||
| stopCapture(t, ate) | ||||||
| if trafficValidation { | ||||||
| verifyTrafficFlow(t, ate, trafficID, true) | ||||||
| verifyCaptureDscpTtlValue(t, ate, "port2", int(innerDscpValue), int(innerTTL-1)) | ||||||
| if verifyCounters { | ||||||
| // PF-1.4.1 / PF-1.4.2: decapsulate — verify inner DSCP and TTL | ||||||
| verifyCaptureDscpTtlValue(t, ate, "port2", int(innerDscpValue), int(innerTTL-1)) | ||||||
| } else { | ||||||
| // PF-1.4.5 / PF-1.4.6: pass-through — verify outer packet unmodified (no decap) | ||||||
| verifyPassThroughGuePacket(t, ate, "port2") | ||||||
| } | ||||||
| } else { | ||||||
| verifyTrafficFlow(t, ate, trafficID, false) | ||||||
| } | ||||||
|
|
@@ -501,7 +507,13 @@ func gueDecapInnerIpv6Traffic(t *testing.T, dut *ondatra.DUTDevice, ate *ondatra | |||||
| stopCapture(t, ate) | ||||||
| if trafficValidation { | ||||||
| verifyTrafficFlow(t, ate, trafficID, true) | ||||||
| verifyCaptureDscpTtlValue(t, ate, "port2", int(innerDscpValue), int(innerTTL-1)) | ||||||
| if verifyCounters { | ||||||
| // PF-1.4.1 / PF-1.4.2: decapsulate — verify inner DSCP and TTL | ||||||
| verifyCaptureDscpTtlValue(t, ate, "port2", int(innerDscpValue), int(innerTTL-1)) | ||||||
| } else { | ||||||
| // PF-1.4.5 / PF-1.4.6: pass-through — verify outer packet unmodified (no decap) | ||||||
| verifyPassThroughGuePacket(t, ate, "port2") | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pass the expected UDP port to
Suggested change
References
|
||||||
| } | ||||||
| } else { | ||||||
| verifyTrafficFlow(t, ate, trafficID, false) | ||||||
| } | ||||||
|
|
@@ -613,7 +625,7 @@ func verifyCaptureDscpTtlValue(t *testing.T, ate *ondatra.ATEDevice, port string | |||||
| if ip6Layer := packet.Layer(layers.LayerTypeIPv6); ip6Layer != nil { | ||||||
| ip6, _ := ip6Layer.(*layers.IPv6) | ||||||
| if ip6.SrcIP.Equal(net.ParseIP(ipv6Src)) { | ||||||
| dscpValue := ip6.TrafficClass >> 2 | ||||||
| dscpValue := ip6.TrafficClass | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The removal of the bit shift (>> 2) for the IPv6 Traffic Class creates an inconsistency with the IPv4 verification logic (line 615) and deviates from the standard definition of DSCP (the 6 most significant bits). This change likely masks an issue in |
||||||
| ttlVal := ip6.HopLimit | ||||||
| if int(dscpValue) == dscp && int(ttlVal) == ttl { | ||||||
| t.Logf("PASS: IPv6 DSCP value %v and TTL value %v are Preserved", dscp, ttl) | ||||||
|
|
@@ -657,3 +669,26 @@ func waitForBGPSession(t *testing.T, dut *ondatra.DUTDevice, wantEstablished boo | |||||
| } | ||||||
| } | ||||||
| } | ||||||
| func verifyPassThroughGuePacket(t *testing.T, ate *ondatra.ATEDevice, port string) { | ||||||
| pcapfilename := processCapture(t, ate, port) | ||||||
| handle, err := pcap.OpenOffline(pcapfilename) | ||||||
| if err != nil { | ||||||
| t.Fatal(err) | ||||||
| } | ||||||
| defer handle.Close() | ||||||
| packetSource := gopacket.NewPacketSource(handle, handle.LinkType()) | ||||||
| for packet := range packetSource.Packets() { | ||||||
| if ip6Layer := packet.Layer(layers.LayerTypeIPv6); ip6Layer != nil { | ||||||
| ip6, _ := ip6Layer.(*layers.IPv6) | ||||||
| if ip6.SrcIP.Equal(net.ParseIP(atePort1.IPv6)) { | ||||||
| expectedTTL := uint8(outerTTL - 1) | ||||||
| if ip6.HopLimit == expectedTTL { | ||||||
| t.Logf("PASS: GUE pass-through packet verified: outer src=%s, TTL=%d (decremented by 1)", atePort1.IPv6, ip6.HopLimit) | ||||||
| return | ||||||
| } | ||||||
| t.Fatalf("ERROR: Outer TTL mismatch in pass-through. Expected: %d, Got: %d", expectedTTL, ip6.HopLimit) | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| t.Fatalf("ERROR: Could not find GUE pass-through packet with outer src IP (%s) in capture", atePort1.IPv6) | ||||||
| } | ||||||
|
Comment on lines
+672
to
+694
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactor func verifyPassThroughGuePacket(t *testing.T, ate *ondatra.ATEDevice, port string, expectedPort int) {
pcapfilename := processCapture(t, ate, port)
handle, err := pcap.OpenOffline(pcapfilename)
if err != nil {
t.Fatal(err)
}
defer handle.Close()
packetSource := gopacket.NewPacketSource(handle, handle.LinkType())
srcIP := net.ParseIP(atePort1.IPv6)
for packet := range packetSource.Packets() {
if ip6Layer := packet.Layer(layers.LayerTypeIPv6); ip6Layer != nil {
ip6, _ := ip6Layer.(*layers.IPv6)
if ip6.SrcIP.Equal(srcIP) {
if udpLayer := packet.Layer(layers.LayerTypeUDP); udpLayer != nil {
udp, _ := udpLayer.(*layers.UDP)
if int(udp.DstPort) == expectedPort {
expectedTTL := uint8(outerTTL - 1)
if ip6.HopLimit == expectedTTL {
t.Logf("PASS: GUE pass-through packet verified: outer src=%s, port=%d, TTL=%d (decremented by 1)", atePort1.IPv6, expectedPort, ip6.HopLimit)
return
}
t.Fatalf("ERROR: Outer TTL mismatch in pass-through. Expected: %d, Got: %d", expectedTTL, ip6.HopLimit)
}
}
}
}
}
t.Fatalf("ERROR: Could not find GUE pass-through packet with outer src IP (%s) and UDP port (%d) in capture", atePort1.IPv6, expectedPort)
}References
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pass the expected UDP port to
verifyPassThroughGuePacketto ensure more robust verification of the GUE packet. This aligns with the practice of using parameterized functions to improve code maintainability and reuse.References