Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Mellanox/nic-configuration-operator
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f3ed2932cdb1218d1f766851997c93715d148a96
Choose a base ref
..
head repository: Mellanox/nic-configuration-operator
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d83cc640006ea98677b26889763134424459cdaa
Choose a head ref
Showing with 37 additions and 0 deletions.
  1. +9 −0 pkg/host/configvalidation.go
  2. +28 −0 pkg/host/configvalidation_test.go
9 changes: 9 additions & 0 deletions pkg/host/configvalidation.go
Original file line number Diff line number Diff line change
@@ -198,6 +198,15 @@ func (v *configValidationImpl) ConstructNvParamMapFromTemplate(
} else {
applyDefaultNvConfigValueIfExists(consts.AtsEnabledParam, desiredParameters, query)
}
//TODO: Uncomment once we'll fix DPU mode reset procedure
//for _, rawParam := range template.RawNvConfig {
// // Ignore second port params if device has a single port
// if strings.HasSuffix(rawParam.Name, consts.SecondPortPrefix) && !secondPortPresent {
// continue
// }
//
// desiredParameters[rawParam.Name] = rawParam.Value
//}

return desiredParameters, nil
}
28 changes: 28 additions & 0 deletions pkg/host/configvalidation_test.go
Original file line number Diff line number Diff line change
@@ -313,6 +313,17 @@ var _ = Describe("ConfigValidationImpl", func() {
Template: &v1alpha1.ConfigurationTemplateSpec{
NumVfs: 0,
LinkType: consts.Ethernet,
//TODO: Uncomment once we'll fix DPU mode reset procedure
//RawNvConfig: []v1alpha1.NvConfigParam{
// {
// Name: "TEST_P1",
// Value: "test",
// },
// {
// Name: "TEST_P2",
// Value: "test",
// },
//},
},
},
},
@@ -327,6 +338,9 @@ var _ = Describe("ConfigValidationImpl", func() {

_, err := validator.ConstructNvParamMapFromTemplate(device, query)
Expect(err).NotTo(HaveOccurred())
// TODO: Uncomment once we'll fix DPU mode reset procedure
//Expect(nvParams).To(HaveKeyWithValue("TEST_P1", "test"))
//Expect(nvParams).NotTo(HaveKey("TEST_P2"))
})
It("should apply raw config for the second port if device is dual port", func() {
mockHostUtils.On("GetPCILinkSpeed", mock.Anything).Return(16, nil)
@@ -337,6 +351,17 @@ var _ = Describe("ConfigValidationImpl", func() {
Template: &v1alpha1.ConfigurationTemplateSpec{
NumVfs: 0,
LinkType: consts.Ethernet,
// TODO: Uncomment once we'll fix DPU mode reset procedure
//RawNvConfig: []v1alpha1.NvConfigParam{
// {
// Name: "TEST_P1",
// Value: "test",
// },
// {
// Name: "TEST_P2",
// Value: "test",
// },
//},
},
},
},
@@ -352,6 +377,9 @@ var _ = Describe("ConfigValidationImpl", func() {

_, err := validator.ConstructNvParamMapFromTemplate(device, query)
Expect(err).NotTo(HaveOccurred())
// TODO: Uncomment once we'll fix DPU mode reset procedure
//Expect(nvParams).To(HaveKeyWithValue("TEST_P1", "test"))
//Expect(nvParams).To(HaveKeyWithValue("TEST_P2", "test"))
})
It("should report an error when LinkType cannot be changed and template differs from the actual status", func() {
mockHostUtils.On("GetLinkType", mock.Anything).Return(consts.Ethernet)