Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TE-9.2: Added deviation static_lsp_unsupported #3347

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions feature/gribi/otg_tests/static_lsp_test/metadata.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,12 @@ platform_exceptions: {
ipv4_missing_enabled: true
}
}

platform_exceptions: {
platform: {
vendor: JUNIPER
}
deviations: {
static_lsp_unsupported: true
}
}
70 changes: 56 additions & 14 deletions feature/gribi/otg_tests/static_lsp_test/static_lsp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/openconfig/featureprofiles/internal/attrs"
"github.com/openconfig/featureprofiles/internal/deviations"
"github.com/openconfig/featureprofiles/internal/fptest"
"github.com/openconfig/featureprofiles/internal/helpers"
"github.com/openconfig/featureprofiles/internal/otgutils"
"github.com/openconfig/ondatra"
"github.com/openconfig/ondatra/gnmi"
Expand Down Expand Up @@ -141,19 +142,60 @@ func configureOTG(t *testing.T) gosnappi.Config {

// configureStaticLSP configures a static MPLS LSP with the provided parameters.
func configureStaticLSP(t *testing.T, dut *ondatra.DUTDevice, lspName string, incomingLabel uint32, nextHopIP string) {
d := &oc.Root{}
dni := deviations.DefaultNetworkInstance(dut)
defPath := gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut))
gnmi.Update(t, dut, defPath.Config(), &oc.NetworkInstance{
Name: ygot.String(deviations.DefaultNetworkInstance(dut)),
Type: oc.NetworkInstanceTypes_NETWORK_INSTANCE_TYPE_DEFAULT_INSTANCE,
})
mplsCfg := d.GetOrCreateNetworkInstance(dni).GetOrCreateMpls()
staticMplsCfg := mplsCfg.GetOrCreateLsps().GetOrCreateStaticLsp(lspName)
staticMplsCfg.GetOrCreateEgress().SetIncomingLabel(oc.UnionUint32(incomingLabel))
staticMplsCfg.GetOrCreateEgress().SetNextHop(nextHopIP)
staticMplsCfg.GetOrCreateEgress().SetPushLabel(oc.Egress_PushLabel_IMPLICIT_NULL)
gnmi.Update(t, dut, gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).Mpls().Config(), mplsCfg)
if deviations.StaticLspConfigUnsupported(dut) {
t.Logf("Push config via native CLI:%s", dut.Vendor())
switch dut.Vendor() {
case ondatra.JUNIPER:
config := juniperMplsLSPConfig(t, dut, lspName, incomingLabel, nextHopIP)
helpers.GnmiCLIConfig(t, dut, config)
default:
t.Fatalf("StaticLspConfigUnsupported deviation needs cli configuration for vendor %s which is not defined", dut.Vendor())
}
} else {
d := &oc.Root{}
// ConfigureDefaultNetworkInstance configures the default network instance name and type.
fptest.ConfigureDefaultNetworkInstance(t, dut)
mplsCfg := d.GetOrCreateNetworkInstance(deviations.DefaultNetworkInstance(dut)).GetOrCreateMpls()
staticMplsCfg := mplsCfg.GetOrCreateLsps().GetOrCreateStaticLsp(lspName)
staticMplsCfg.GetOrCreateEgress().SetIncomingLabel(oc.UnionUint32(incomingLabel))
staticMplsCfg.GetOrCreateEgress().SetNextHop(nextHopIP)
staticMplsCfg.GetOrCreateEgress().SetPushLabel(oc.Egress_PushLabel_IMPLICIT_NULL)
gnmi.Update(t, dut, gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).Mpls().Config(), mplsCfg)
}
}

// juniperMplsLSPConfig is used to configure mpls lsp configuration via native cli as an alternative to below xpaths.
// /network-instances/network-instance/mpls/lsps/static-lsps/static-lsp/egress/config/next-hop
// /network-instances/network-instance/mpls/lsps/static-lsps/static-lsp/egress/config/incoming-label
// /network-instances/network-instance/mpls/lsps/static-lsps/static-lsp/egress/config/push-label
func juniperMplsLSPConfig(t *testing.T, dut *ondatra.DUTDevice, lspName string, incomingLabel uint32, nextHopIP string) string {
p1 := dut.Port(t, "port1").Name()
p2 := dut.Port(t, "port2").Name()
return fmt.Sprintf(`
interfaces {
%s {
unit %d {
family mpls;
}
}
%s {
unit %d {
family mpls;
}
}
}
protocols {
mpls {
interface %s;
interface %s;
static-label-switched-path %s {
transit %d {
next-hop %s;
pop;
}
}
}
}`, p1, 0, p2, 0, p1, p2, lspName, incomingLabel, nextHopIP)
}

func createTrafficFlow(t *testing.T,
Expand All @@ -177,7 +219,7 @@ func createTrafficFlow(t *testing.T,
mplsFlow.Metrics().SetEnable(true)
mplsFlow.Rate().SetPps(500)
mplsFlow.Size().SetFixed(512)
mplsFlow.Duration().Continuous()
mplsFlow.Duration().FixedPackets().SetPackets(1500)

// Set up ethernet layer.
eth := mplsFlow.Packet().Add().Ethernet()
Expand Down
5 changes: 5 additions & 0 deletions internal/deviations/deviations.go
Original file line number Diff line number Diff line change
Expand Up @@ -1302,3 +1302,8 @@ func ChannelRateClassParametersUnsupported(dut *ondatra.DUTDevice) bool {
func QosSchedulerIngressPolicer(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetQosSchedulerIngressPolicerUnsupported()
}

// StaticLspConfigUnsupported returns true if static lsp config is not supported
func StaticLspConfigUnsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetStaticLspUnsupported()
}
4 changes: 4 additions & 0 deletions proto/metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,10 @@ message Metadata {
// Devices that do not support qos scheduler ingress policer.
bool qos_scheduler_ingress_policer_unsupported = 248;

// Devices that do no support static lsp config
// Juniper b/356635233
bool static_lsp_unsupported = 249;

// Reserved field numbers and identifiers.
reserved 84, 9, 28, 20, 90, 97, 55, 89, 19, 36, 35, 40, 173;
}
Expand Down
102 changes: 56 additions & 46 deletions proto/metadata_go_proto/metadata.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading