Skip to content

Commit

Permalink
Merge branch 'main' into ANCX_QOS11
Browse files Browse the repository at this point in the history
  • Loading branch information
charantejag504 authored Jul 11, 2023
2 parents d47e3c9 + 229f48c commit 9ff471b
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 9 deletions.
39 changes: 39 additions & 0 deletions feature/gnoi/healthz/feature.textproto
Original file line number Diff line number Diff line change
@@ -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"
}
39 changes: 39 additions & 0 deletions feature/gnoi/packet_link_qualification/feature.textproto
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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())
}

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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())
}
Expand Down

0 comments on commit 9ff471b

Please sign in to comment.