From 3d442efc3a76f962c5b83100bac3e699120b32e0 Mon Sep 17 00:00:00 2001 From: vsuryaprasad-hcl Date: Wed, 22 May 2024 10:39:29 -0400 Subject: [PATCH] [sdn_tests]: Adding Installation test to pins_ondatra. --- .../pins_ondatra/tests/installation_test.go | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 sdn_tests/pins_ondatra/tests/installation_test.go diff --git a/sdn_tests/pins_ondatra/tests/installation_test.go b/sdn_tests/pins_ondatra/tests/installation_test.go new file mode 100644 index 00000000000..f9349642451 --- /dev/null +++ b/sdn_tests/pins_ondatra/tests/installation_test.go @@ -0,0 +1,33 @@ +package installation_test + +import ( + "testing" + "time" + + syspb "github.com/openconfig/gnoi/system" + "github.com/openconfig/ondatra" + "github.com/sonic-net/sonic-mgmt/sdn_tests/pins_ondatra/infrastructure/binding/pinsbind" + "github.com/sonic-net/sonic-mgmt/sdn_tests/pins_ondatra/infrastructure/testhelper/testhelper" +) + +func TestMain(m *testing.M) { + ondatra.RunTests(m, pinsbind.New) +} + +func TestConfigInstallationSuccess(t *testing.T) { + ttID := "0dedda87-1b76-40a2-8712-24c1572587ee" + defer testhelper.NewTearDownOptions(t).WithID(ttID).Teardown(t) + dut := ondatra.DUT(t, "DUT") + err :=testhelper.ConfigPush(t, dut, nil) + if err != nil { + t.Fatalf("switch config push failed due to err : %v", err) + } + waitTime, err := testhelper.RebootTimeForDevice(t, dut) + if err != nil { + t.Fatalf("Unable to get reboot wait time: %v", err) + } + params := testhelper.NewRebootParams().WithWaitTime(waitTime).WithCheckInterval(30*time.Second).WithRequest(syspb.RebootMethod_COLD).WithLatencyMeasurement(ttID, "gNOI Reboot With Type: "+syspb.RebootMethod_COLD.String()) + if err := testhelper.Reboot(t, dut, params); err != nil { + t.Fatalf("Failed to reboot DUT: %v", err) + } +}