From d8693924366990c23440d35812e9286611d5805b Mon Sep 17 00:00:00 2001 From: anksaiki Date: Tue, 11 Jul 2023 09:55:34 -0400 Subject: [PATCH 1/4] fix copying_debug_files_test (#1851) --- .../copying_debug_files_test.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/feature/gnoi/system/tests/copying_debug_files_test/copying_debug_files_test.go b/feature/gnoi/system/tests/copying_debug_files_test/copying_debug_files_test.go index 35488124e57..dd751643c55 100644 --- a/feature/gnoi/system/tests/copying_debug_files_test/copying_debug_files_test.go +++ b/feature/gnoi/system/tests/copying_debug_files_test/copying_debug_files_test.go @@ -23,12 +23,13 @@ import ( spb "github.com/openconfig/gnoi/system" tpb "github.com/openconfig/gnoi/types" "github.com/openconfig/ondatra" + "github.com/openconfig/ondatra/gnmi" ) var ( bgpProcName = map[ondatra.Vendor]string{ ondatra.NOKIA: "sr_bgp_mgr", - ondatra.ARISTA: "bgp", + ondatra.ARISTA: "Bgp-main", ondatra.JUNIPER: "rpd", } components = map[ondatra.Vendor]string{ @@ -70,6 +71,7 @@ func TestCopyingDebugFiles(t *testing.T) { killProcessRequest := &spb.KillProcessRequest{ Signal: spb.KillProcessRequest_SIGNAL_KILL, Name: bgpProcName[dut.Vendor()], + Pid: findProcessByName(context.Background(), t, dut, bgpProcName[dut.Vendor()]), Restart: true, } processKillResponse, err := gnoiClient.System().KillProcess(context.Background(), killProcessRequest) @@ -102,3 +104,16 @@ func TestCopyingDebugFiles(t *testing.T) { t.Fatalf("Unexpected error on healthz get response after restart of %v: %v", bgpProcName[dut.Vendor()], err) } } + +// findProcessByName uses telemetry to find out the PID of a process +func findProcessByName(ctx context.Context, t *testing.T, dut *ondatra.DUTDevice, pName string) uint32 { + pList := gnmi.GetAll(t, dut, gnmi.OC().System().ProcessAny().State()) + var pID uint32 + for _, proc := range pList { + if proc.GetName() == pName { + pID = uint32(proc.GetPid()) + t.Logf("Pid of daemon '%s' is '%d'", pName, pID) + } + } + return pID +} From 98fcf55b5ce10ec722acc2f8d77cc7d6b682a679 Mon Sep 17 00:00:00 2001 From: anksaiki Date: Tue, 11 Jul 2023 09:58:58 -0400 Subject: [PATCH 2/4] fix core llp tlv test (#1856) --- .../core_lldp_tlv_population_test.go | 27 +++++++++++++------ .../core_lldp_tlv_population_test.go | 7 +++++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/feature/lldp/ate_tests/core_lldp_tlv_population_test/core_lldp_tlv_population_test.go b/feature/lldp/ate_tests/core_lldp_tlv_population_test/core_lldp_tlv_population_test.go index eedef7f3ddb..580e05c415f 100644 --- a/feature/lldp/ate_tests/core_lldp_tlv_population_test/core_lldp_tlv_population_test.go +++ b/feature/lldp/ate_tests/core_lldp_tlv_population_test/core_lldp_tlv_population_test.go @@ -64,16 +64,23 @@ func TestCoreLLDPTLVPopulation(t *testing.T) { dutPort := dut.Port(t, portName) atePort := ate.Port(t, portName) - verifyNodeConfig(t, dut, dutPort, dutConf, test.lldpEnabled) verifyNodeConfig(t, ate, atePort, ateConf, true) + verifyNodeConfig(t, dut, dutPort, dutConf, test.lldpEnabled) if test.lldpEnabled { - verifyNodeTelemetry(t, dut, ate, dutPort, atePort, test.lldpEnabled, dut) - verifyNodeTelemetry(t, ate, dut, atePort, dutPort, test.lldpEnabled, dut) + verifyNodeTelemetry(t, dut, ate, dutPort, atePort, test.lldpEnabled) + verifyNodeTelemetry(t, ate, dut, atePort, dutPort, test.lldpEnabled) } else { - verifyNodeTelemetry(t, dut, ate, dutPort, atePort, test.lldpEnabled, dut) + verifyNodeTelemetry(t, dut, ate, dutPort, atePort, test.lldpEnabled) } }) } + + // disable LLDP before releasing the devices. + dut := ondatra.DUT(t, "dut1") + ate := ondatra.DUT(t, "dut2") + + gnmi.Replace(t, dut, gnmi.OC().Lldp().Enabled().Config(), false) + gnmi.Replace(t, ate, gnmi.OC().Lldp().Enabled().Config(), false) } // configureNode configures LLDP on a single node. @@ -88,6 +95,10 @@ func configureNode(t *testing.T, name string, lldpEnabled bool) (*ondatra.DUTDev gnmi.Replace(t, node, lldp.Interface(p.Name()).Enabled().Config(), lldpEnabled) } + if deviations.InterfaceEnabled(node) { + gnmi.Replace(t, node, gnmi.OC().Interface(p.Name()).Enabled().Config(), true) + } + return node, gnmi.GetConfig(t, node, lldp.Config()) } @@ -124,11 +135,11 @@ func verifyNodeConfig(t *testing.T, node gnmi.DeviceOrOpts, port *ondatra.Port, } // verifyNodeTelemetry verifies the telemetry values from the node such as port LLDP neighbor info. -func verifyNodeTelemetry(t *testing.T, node, peer gnmi.DeviceOrOpts, nodePort, peerPort *ondatra.Port, lldpEnabled bool, dut *ondatra.DUTDevice) { +func verifyNodeTelemetry(t *testing.T, node, peer *ondatra.DUTDevice, nodePort, peerPort *ondatra.Port, lldpEnabled bool) { interfacePath := gnmi.OC().Lldp().Interface(nodePort.Name()) // LLDP Disabled - if !deviations.MissingValueForDefaults(dut) { + if !deviations.MissingValueForDefaults(node) { lldpTelemetry := gnmi.Get(t, node, gnmi.OC().Lldp().Enabled().State()) if lldpEnabled != lldpTelemetry { t.Errorf("LLDP enabled telemetry got: %t, want: %t.", lldpTelemetry, lldpEnabled) @@ -146,12 +157,12 @@ func verifyNodeTelemetry(t *testing.T, node, peer gnmi.DeviceOrOpts, nodePort, p return true } gotLen = len(intf.Neighbor) - if deviations.LLDPInterfaceConfigOverrideGlobal(dut) { + if deviations.LLDPInterfaceConfigOverrideGlobal(node) { return gotLen > 0 } return gotLen == 0 }).Await(t); !ok { - if deviations.LLDPInterfaceConfigOverrideGlobal(dut) { + if deviations.LLDPInterfaceConfigOverrideGlobal(node) { t.Errorf("Number of neighbors got: %d, want: non-zero.", gotLen) } else { t.Errorf("Number of neighbors got: %d, want: 0.", gotLen) diff --git a/feature/lldp/otg_tests/core_lldp_tlv_population_test/core_lldp_tlv_population_test.go b/feature/lldp/otg_tests/core_lldp_tlv_population_test/core_lldp_tlv_population_test.go index 7d6c2fbd5a4..cf719418b65 100644 --- a/feature/lldp/otg_tests/core_lldp_tlv_population_test/core_lldp_tlv_population_test.go +++ b/feature/lldp/otg_tests/core_lldp_tlv_population_test/core_lldp_tlv_population_test.go @@ -22,6 +22,7 @@ import ( "github.com/open-traffic-generator/snappi/gosnappi" "github.com/openconfig/featureprofiles/internal/attrs" "github.com/openconfig/featureprofiles/internal/confirm" + "github.com/openconfig/featureprofiles/internal/deviations" "github.com/openconfig/featureprofiles/internal/fptest" "github.com/openconfig/featureprofiles/internal/otgutils" "github.com/openconfig/ondatra" @@ -104,6 +105,9 @@ func TestLLDPEnabled(t *testing.T) { chassisIdType: otgtelemetry.E_LldpNeighbor_ChassisIdType(dutConf.GetChassisIdType()), } checkOTGLLDPNeighbor(t, otg, otgConfig, expOtgLLDPNeighbor) + + // disable LLDP before releasing the devices. + gnmi.Replace(t, dut, gnmi.OC().Lldp().Enabled().Config(), false) } // TestLLDPDisabled tests LLDP advertisement turned off. @@ -136,6 +140,9 @@ func configureDUT(t *testing.T, name string, lldpEnabled bool) (*ondatra.DUTDevi if lldpEnabled { gnmi.Replace(t, node, lldp.Interface(p.Name()).Enabled().Config(), lldpEnabled) } + if deviations.InterfaceEnabled(node) { + gnmi.Replace(t, node, gnmi.OC().Interface(p.Name()).Enabled().Config(), true) + } return node, gnmi.GetConfig(t, node, lldp.Config()) } From 26be8924ed4510bcba842e38776a7a27bc97c56a Mon Sep 17 00:00:00 2001 From: Darren Loher Date: Tue, 11 Jul 2023 08:10:01 -0700 Subject: [PATCH 3/4] add feature gnoi.LinkQualification (#1836) --- .../feature.textproto | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 feature/gnoi/packet_link_qualification/feature.textproto diff --git a/feature/gnoi/packet_link_qualification/feature.textproto b/feature/gnoi/packet_link_qualification/feature.textproto new file mode 100644 index 00000000000..8d710ba0d81 --- /dev/null +++ b/feature/gnoi/packet_link_qualification/feature.textproto @@ -0,0 +1,39 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +id { + name: "gnoi_packet_link_qualification" + version: 1 +} + +gnoi_service { + service_name: "gnoi.gnoi_packet_link_qualification.LinkQualification" + method_name: "Create" +} +gnoi_service { + service_name: "gnoi.gnoi_packet_link_qualification.LinkQualification" + method_name: "Get" +} +gnoi_service { + service_name: "gnoi.gnoi_packet_link_qualification.LinkQualification" + method_name: "Capabilities" +} +gnoi_service { + service_name: "gnoi.gnoi_packet_link_qualification.LinkQualification" + method_name: "Delete" +} +gnoi_service { + service_name: "gnoi.gnoi_packet_link_qualification.LinkQualification" + method_name: "List" +} From 229f48cdde95be2ed010956b448b6c3de2fb781b Mon Sep 17 00:00:00 2001 From: Darren Loher Date: Tue, 11 Jul 2023 08:10:22 -0700 Subject: [PATCH 4/4] Add feature healthz (#1835) --- feature/gnoi/healthz/feature.textproto | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 feature/gnoi/healthz/feature.textproto diff --git a/feature/gnoi/healthz/feature.textproto b/feature/gnoi/healthz/feature.textproto new file mode 100644 index 00000000000..fdfdc06fe22 --- /dev/null +++ b/feature/gnoi/healthz/feature.textproto @@ -0,0 +1,39 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +id { + name: "gnoi_healthz" + version: 1 +} + +gnoi_service { + service_name: "gnoi.healthz.Healthz" + method_name: "Get" +} +gnoi_service { + service_name: "gnoi.healthz.Healthz" + method_name: "List" +} +gnoi_service { + service_name: "gnoi.healthz.Healthz" + method_name: "Acknowledge" +} +gnoi_service { + service_name: "gnoi.healthz.Healthz" + method_name: "Artifact" +} +gnoi_service { + service_name: "gnoi.healthz.Healthz" + method_name: "Check" +}