Skip to content

Commit

Permalink
DP-1.10: Adding test support for Nokia
Browse files Browse the repository at this point in the history
Following changes are made in this PR -
   1. Updating deviations in metadata file
   2. Updating test script to support Nokia
   3. Adding function (SetForwardingGroupWithFabricPriority) to configure ForwardingGroup with Fabric-priority in qoscfg.go

"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
trathod1 committed Aug 15, 2023
1 parent 716ed0b commit 3725232
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ platform_exceptions: {
vendor: NOKIA
}
deviations: {
explicit_interface_ref_definition: true
dequeue_delete_not_counted_as_drops: true
qos_octets: true
interface_enabled: true
explicit_port_speed: true
explicit_interface_in_default_vrf: true
}
}
platform_exceptions: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,14 @@ func ConfigureDUTIntf(t *testing.T, dut *ondatra.DUTDevice) {
a := s.GetOrCreateAddress(intf.ipAddr)
a.PrefixLength = ygot.Uint8(intf.prefixLen)
gnmi.Replace(t, dut, gnmi.OC().Interface(intf.intfName).Config(), i)
if deviations.ExplicitInterfaceInDefaultVRF(dut) {
fptest.AssignToNetworkInstance(t, dut, intf.intfName, deviations.DefaultNetworkInstance(dut), 0)
}
}
if deviations.ExplicitPortSpeed(dut) {
fptest.SetPortSpeed(t, dp1)
fptest.SetPortSpeed(t, dp2)
fptest.SetPortSpeed(t, dp3)
}
}

Expand All @@ -675,42 +683,54 @@ func ConfigureQoS(t *testing.T, dut *ondatra.DUTDevice) {

t.Logf("Create qos forwarding groups config")
forwardingGroups := []struct {
desc string
queueName string
targetGroup string
desc string
queueName string
targetGroup string
fabricPriority uint8
}{{
desc: "forwarding-group-BE1",
queueName: queues.BE1,
targetGroup: "target-group-BE1",
}, {
desc: "forwarding-group-BE0",
queueName: queues.BE0,
targetGroup: "target-group-BE0",
}, {
desc: "forwarding-group-AF1",
queueName: queues.AF1,
targetGroup: "target-group-AF1",
}, {
desc: "forwarding-group-AF2",
queueName: queues.AF2,
targetGroup: "target-group-AF2",
}, {
desc: "forwarding-group-AF3",
queueName: queues.AF3,
targetGroup: "target-group-AF3",
}, {
desc: "forwarding-group-AF4",
queueName: queues.AF4,
targetGroup: "target-group-AF4",
}, {
desc: "forwarding-group-NC1",
queueName: queues.NC1,
targetGroup: "target-group-NC1",
desc: "forwarding-group-BE1",
queueName: queues.BE1,
targetGroup: "target-group-BE1",
fabricPriority: 1,
}, {
desc: "forwarding-group-BE0",
queueName: queues.BE0,
targetGroup: "target-group-BE0",
fabricPriority: 2,
}, {
desc: "forwarding-group-AF1",
queueName: queues.AF1,
targetGroup: "target-group-AF1",
fabricPriority: 3,
}, {
desc: "forwarding-group-AF2",
queueName: queues.AF2,
targetGroup: "target-group-AF2",
fabricPriority: 4,
}, {
desc: "forwarding-group-AF3",
queueName: queues.AF3,
targetGroup: "target-group-AF3",
fabricPriority: 5,
}, {
desc: "forwarding-group-AF4",
queueName: queues.AF4,
targetGroup: "target-group-AF4",
fabricPriority: 6,
}, {
desc: "forwarding-group-NC1",
queueName: queues.NC1,
targetGroup: "target-group-NC1",
fabricPriority: 7,
}}

t.Logf("qos forwarding groups config: %v", forwardingGroups)
for _, tc := range forwardingGroups {
qoscfg.SetForwardingGroup(t, dut, q, tc.targetGroup, tc.queueName)
if dut.Vendor() == ondatra.NOKIA {
qoscfg.SetForwardingGroupWithFabricPriority(t, dut, q, tc.targetGroup, tc.queueName, tc.fabricPriority)
} else {
qoscfg.SetForwardingGroup(t, dut, q, tc.targetGroup, tc.queueName)
}
}

t.Logf("Create qos Classifiers config")
Expand Down Expand Up @@ -969,7 +989,13 @@ func ConfigureQoS(t *testing.T, dut *ondatra.DUTDevice) {
input.SetId(tc.inputID)
input.SetInputType(tc.inputType)
input.SetQueue(tc.queueName)
input.SetWeight(tc.weight)
if dut.Vendor() == ondatra.NOKIA {
if tc.priority != oc.Scheduler_Priority_STRICT {
input.SetWeight(tc.weight)
}
} else {
input.SetWeight(tc.weight)
}
gnmi.Replace(t, dut, gnmi.OC().Qos().Config(), q)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ platform_exceptions: {
vendor: NOKIA
}
deviations: {
explicit_interface_ref_definition: true
dequeue_delete_not_counted_as_drops: true
qos_octets: true
interface_enabled: true
explicit_port_speed: true
explicit_interface_in_default_vrf: true
}
}
platform_exceptions: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,14 @@ func ConfigureDUTIntf(t *testing.T, dut *ondatra.DUTDevice) {
a := s.GetOrCreateAddress(intf.ipAddr)
a.PrefixLength = ygot.Uint8(intf.prefixLen)
gnmi.Replace(t, dut, gnmi.OC().Interface(intf.intfName).Config(), i)
if deviations.ExplicitInterfaceInDefaultVRF(dut) {
fptest.AssignToNetworkInstance(t, dut, intf.intfName, deviations.DefaultNetworkInstance(dut), 0)
}
}
if deviations.ExplicitPortSpeed(dut) {
fptest.SetPortSpeed(t, dp1)
fptest.SetPortSpeed(t, dp2)
fptest.SetPortSpeed(t, dp3)
}
}

Expand All @@ -740,42 +748,54 @@ func ConfigureQoS(t *testing.T, dut *ondatra.DUTDevice) {

t.Logf("Create qos forwarding groups config")
forwardingGroups := []struct {
desc string
queueName string
targetGroup string
desc string
queueName string
targetGroup string
fabricPriority uint8
}{{
desc: "forwarding-group-BE1",
queueName: queues.BE1,
targetGroup: "target-group-BE1",
}, {
desc: "forwarding-group-BE0",
queueName: queues.BE0,
targetGroup: "target-group-BE0",
}, {
desc: "forwarding-group-AF1",
queueName: queues.AF1,
targetGroup: "target-group-AF1",
}, {
desc: "forwarding-group-AF2",
queueName: queues.AF2,
targetGroup: "target-group-AF2",
}, {
desc: "forwarding-group-AF3",
queueName: queues.AF3,
targetGroup: "target-group-AF3",
}, {
desc: "forwarding-group-AF4",
queueName: queues.AF4,
targetGroup: "target-group-AF4",
}, {
desc: "forwarding-group-NC1",
queueName: queues.NC1,
targetGroup: "target-group-NC1",
desc: "forwarding-group-BE1",
queueName: queues.BE1,
targetGroup: "target-group-BE1",
fabricPriority: 1,
}, {
desc: "forwarding-group-BE0",
queueName: queues.BE0,
targetGroup: "target-group-BE0",
fabricPriority: 2,
}, {
desc: "forwarding-group-AF1",
queueName: queues.AF1,
targetGroup: "target-group-AF1",
fabricPriority: 3,
}, {
desc: "forwarding-group-AF2",
queueName: queues.AF2,
targetGroup: "target-group-AF2",
fabricPriority: 4,
}, {
desc: "forwarding-group-AF3",
queueName: queues.AF3,
targetGroup: "target-group-AF3",
fabricPriority: 5,
}, {
desc: "forwarding-group-AF4",
queueName: queues.AF4,
targetGroup: "target-group-AF4",
fabricPriority: 6,
}, {
desc: "forwarding-group-NC1",
queueName: queues.NC1,
targetGroup: "target-group-NC1",
fabricPriority: 7,
}}

t.Logf("qos forwarding groups config: %v", forwardingGroups)
for _, tc := range forwardingGroups {
qoscfg.SetForwardingGroup(t, dut, q, tc.targetGroup, tc.queueName)
if dut.Vendor() == ondatra.NOKIA {
qoscfg.SetForwardingGroupWithFabricPriority(t, dut, q, tc.targetGroup, tc.queueName, tc.fabricPriority)
} else {
qoscfg.SetForwardingGroup(t, dut, q, tc.targetGroup, tc.queueName)
}
}

t.Logf("Create qos Classifiers config")
Expand Down Expand Up @@ -1034,7 +1054,13 @@ func ConfigureQoS(t *testing.T, dut *ondatra.DUTDevice) {
input.SetId(tc.inputID)
input.SetInputType(tc.inputType)
input.SetQueue(tc.queueName)
input.SetWeight(tc.weight)
if dut.Vendor() == ondatra.NOKIA {
if tc.priority != oc.Scheduler_Priority_STRICT {
input.SetWeight(tc.weight)
}
} else {
input.SetWeight(tc.weight)
}
gnmi.Replace(t, dut, gnmi.OC().Qos().Config(), q)
}

Expand Down
10 changes: 10 additions & 0 deletions internal/qoscfg/qoscfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ func SetForwardingGroup(t *testing.T, dut *ondatra.DUTDevice, qos *oc.Qos, group
gnmi.Replace(t, dut, gnmi.OC().Qos().Config(), qos)
}

func SetForwardingGroupWithFabricPriority(t *testing.T, dut *ondatra.DUTDevice, qos *oc.Qos, groupName, queueName string, fabricPriority uint8) {
t.Helper()

fwdGroup := qos.GetOrCreateForwardingGroup(groupName)
fwdGroup.SetOutputQueue(queueName)
fwdGroup.SetFabricPriority(uint8(fabricPriority))
qos.GetOrCreateQueue(queueName)
gnmi.Replace(t, dut, gnmi.OC().Qos().Config(), qos)
}

// SetInputClassifier sets an input classifier in the specified QoS config.
func SetInputClassifier(t *testing.T, dut *ondatra.DUTDevice, qos *oc.Qos, intfID string, classType oc.E_Input_Classifier_Type, className string) {
t.Helper()
Expand Down

0 comments on commit 3725232

Please sign in to comment.