Skip to content

Commit 4d14cdc

Browse files
P4RT-5.3: Cisco fix (#5650)
* local p4rt changes * draft p4rt-5.3 * test commit * better defer
1 parent 33a0086 commit 4d14cdc

3 files changed

Lines changed: 46 additions & 22 deletions

File tree

feature/p4rt/otg_tests/traceroute_packetin_with_vrf_selection_test/metadata.textproto

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,17 @@ platform_exceptions: {
4141
interface_ref_interface_id_format: true
4242
}
4343
}
44+
platform_exceptions: {
45+
platform: {
46+
vendor: CISCO
47+
}
48+
deviations: {
49+
interface_id_format_required_for_policy_forwarding: true
50+
pf_require_match_default_rule: true
51+
pf_require_sequential_order_pbr_rules: true
52+
isis_single_topology_required: true
53+
gribi_mac_override_with_static_arp: true
54+
use_interface_name_for_ibgp_neighbor_transport_ipv4_local_address: true
55+
}
56+
}
57+

feature/p4rt/otg_tests/traceroute_packetin_with_vrf_selection_test/packetin_test.go

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ func decodePacket6(t *testing.T, packetData []byte) uint8 {
104104
// number of packets sent out.
105105
func testTraffic(t *testing.T, top gosnappi.Config, ate *ondatra.ATEDevice, flows []gosnappi.Flow, srcEndPoint gosnappi.Port, duration int, cs gosnappi.ControlState) int {
106106
t.Helper()
107+
initialOutPkts := make(map[string]uint64, len(flows))
107108
top.Flows().Clear()
108109
for _, flow := range flows {
109110
flow.TxRx().Port().SetTxName(srcEndPoint.Name()).SetRxName(srcEndPoint.Name())
@@ -113,17 +114,20 @@ func testTraffic(t *testing.T, top gosnappi.Config, ate *ondatra.ATEDevice, flow
113114
ate.OTG().PushConfig(t, top)
114115
ate.OTG().StartProtocols(t)
115116
time.Sleep(30 * time.Second)
117+
for _, flow := range flows {
118+
initialOutPkts[flow.Name()] = gnmi.Get(t, ate.OTG(), gnmi.OTG().Flow(flow.Name()).Counters().OutPkts().State())
119+
}
116120
ate.OTG().StartTraffic(t)
117121
time.Sleep(time.Duration(duration) * time.Second)
118122
ate.OTG().StopTraffic(t)
119123

120124
cs.Port().Capture().SetState(gosnappi.StatePortCaptureState.STOP)
121125
ate.OTG().SetControlState(t, cs)
122126

123-
outPkts := gnmi.GetAll(t, ate.OTG(), gnmi.OTG().FlowAny().Counters().OutPkts().State())
124127
total := 0
125-
for _, count := range outPkts {
126-
total += int(count)
128+
for _, flow := range flows {
129+
current := gnmi.Get(t, ate.OTG(), gnmi.OTG().Flow(flow.Name()).Counters().OutPkts().State())
130+
total += int(current - initialOutPkts[flow.Name()])
127131
}
128132
return total
129133
}
@@ -132,21 +136,15 @@ func testTraffic(t *testing.T, top gosnappi.Config, ate *ondatra.ATEDevice, flow
132136
// then validates packetin message metadata and payload.
133137
func testPacketIn(ctx context.Context, t *testing.T, args *testArgs, isIPv4 bool, cs gosnappi.ControlState, flowValues []*flowArgs, EgressPortMap map[string]bool) []float64 {
134138
leader := args.leader
135-
if isIPv4 {
136-
// Insert p4rtutils acl entry on the DUT
137-
if err := programmTableEntry(leader, args.packetIO, false, isIPv4); err != nil {
138-
t.Fatalf("There is error when programming entry")
139-
}
140-
// Delete p4rtutils acl entry on the device
141-
defer programmTableEntry(leader, args.packetIO, true, isIPv4)
142-
} else {
143-
// Insert p4rtutils acl entry on the DUT
144-
if err := programmTableEntry(leader, args.packetIO, false, false); err != nil {
145-
t.Fatalf("There is error when programming entry")
146-
}
147-
// Delete p4rtutils acl entry on the device
148-
defer programmTableEntry(leader, args.packetIO, true, false)
139+
if err := programmTableEntry(leader, args.packetIO, false, true); err != nil {
140+
t.Fatalf("There is error when programming IPv4 entry")
149141
}
142+
defer programmTableEntry(leader, args.packetIO, true, true)
143+
if err := programmTableEntry(leader, args.packetIO, false, false); err != nil {
144+
t.Fatalf("There is error when programming IPv6 entry")
145+
}
146+
defer programmTableEntry(leader, args.packetIO, true, false)
147+
150148
streamChan := args.leader.StreamChannelGet(&streamName)
151149
qSize := 12000
152150
streamChan.SetArbQSize(qSize)
@@ -215,13 +213,13 @@ func testPacketIn(ctx context.Context, t *testing.T, args *testArgs, isIPv4 bool
215213
}
216214
if wantPacket.TTL != nil {
217215
// TTL/HopLimit comparison for IPV4 & IPV6
218-
if isIPv4 {
216+
switch etherType {
217+
case layers.EthernetTypeIPv4:
219218
captureTTL := decodePacket4(t, packet.Pkt.GetPayload())
220219
if captureTTL != TTL1 {
221220
t.Fatalf("Packet in PacketIn message is not matching wanted packet=IPV4 TTL1")
222221
}
223-
224-
} else {
222+
case layers.EthernetTypeIPv6:
225223
captureHopLimit := decodePacket6(t, packet.Pkt.GetPayload())
226224
if captureHopLimit != HopLimit1 {
227225
t.Fatalf("Packet in PacketIn message is not matching wanted packet=IPV6 HopLimit1")

feature/p4rt/otg_tests/traceroute_packetin_with_vrf_selection_test/traceroute_packetin_with_vrf_selection_test.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,11 @@ func configureISIS(t *testing.T, dut *ondatra.DUTDevice, intfName, dutAreaAddres
742742
globalISIS.Net = []string{fmt.Sprintf("%v.%v.00", dutAreaAddress, dutSysID)}
743743
globalISIS.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV4, oc.IsisTypes_SAFI_TYPE_UNICAST).Enabled = ygot.Bool(true)
744744
globalISIS.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV6, oc.IsisTypes_SAFI_TYPE_UNICAST).Enabled = ygot.Bool(true)
745+
if deviations.ISISSingleTopologyRequired(dut) {
746+
afv6 := globalISIS.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV6, oc.IsisTypes_SAFI_TYPE_UNICAST)
747+
afv6.GetOrCreateMultiTopology().SetAfiName(oc.IsisTypes_AFI_TYPE_IPV4)
748+
afv6.GetOrCreateMultiTopology().SetSafiName(oc.IsisTypes_SAFI_TYPE_UNICAST)
749+
}
745750

746751
lspBit := globalISIS.GetOrCreateLspBit().GetOrCreateOverloadBit()
747752
lspBit.SetBit = ygot.Bool(false)
@@ -808,7 +813,11 @@ func bgpCreateNbr(localAs uint32, dut *ondatra.DUTDevice) *oc.NetworkInstance_Pr
808813
bgpNbr.PeerAs = ygot.Uint32(localAs)
809814
bgpNbr.Enabled = ygot.Bool(true)
810815
bgpNbrT := bgpNbr.GetOrCreateTransport()
811-
bgpNbrT.LocalAddress = ygot.String(dutlo0Attrs.IPv4)
816+
localAddressLeaf := dutlo0Attrs.IPv4
817+
if deviations.UseInterfaceNameForIBGPNeighborTransportIpv4LocalAddress(dut) {
818+
localAddressLeaf = loopbackIntfName
819+
}
820+
bgpNbrT.LocalAddress = ygot.String(localAddressLeaf)
812821
af4 := bgpNbr.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST)
813822
af4.Enabled = ygot.Bool(true)
814823
af6 := bgpNbr.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV6_UNICAST)
@@ -1163,7 +1172,7 @@ func testTunnelTrafficDecapEncap(ctx context.Context, t *testing.T, dut *ondatra
11631172
validateTrafficDistribution(t, args.ate, LoadBalancePercent, gotWeights)
11641173
}
11651174

1166-
// testTraceRoute is to test Test FRR behaviors with encapsulation scenarios
1175+
// testTraceRoute is to test FRR behaviors with encapsulation scenarios
11671176
func TestTraceRoute(t *testing.T) {
11681177
ctx := context.Background()
11691178
dut := ondatra.DUT(t, "dut")
@@ -1202,6 +1211,9 @@ func TestTraceRoute(t *testing.T) {
12021211
// staticARPWithMagicUniversalIP(t, dut)
12031212
baseScenario.StaticARPWithMagicUniversalIP(t, dut)
12041213
}
1214+
if deviations.GRIBIMACOverrideWithStaticARP(dut) {
1215+
baseScenario.StaticARPWithSpecificIP(t, dut)
1216+
}
12051217

12061218
t.Log("Install BGP route resolved by ISIS.")
12071219
t.Log("Configure ISIS on DUT")

0 commit comments

Comments
 (0)