Skip to content

Commit

Permalink
Merge branch 'main' into lvaish_0114
Browse files Browse the repository at this point in the history
  • Loading branch information
lvaish05 authored Feb 24, 2025
2 parents 7a6a8e2 + d8f764e commit c443569
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 91 deletions.
5 changes: 2 additions & 3 deletions feature/bgp/otg_tests/bgp_afi_safi_defaults/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ BGP AFI SAFI OC DEFAULTS TEST
"IPv6-unicast enabled" boolean is left to OC default for the IPv4 peer".
* Ensure that only IPv6-Unicast enabled boolean is made "true" for IPv6 neighbor.
"IPv4-unicast enabled" boolean is left to OC default for the IPv6 peer".
* Ensure that there are no AFI-SAFI configurations at the global and peer-group levels.
* Ensure that there are no AFI-SAFI configurations at peer-group levels.
* On the ATE side ensure that IPv4-unicast and IPv6-unicast AFI-SAFI are enabled==true for
IPv4 and IPv6 neighbors.
* Ensure that there is extended-next-hop encoding feature is configured via OC path and the
Expand All @@ -46,7 +46,7 @@ BGP AFI SAFI OC DEFAULTS TEST

* Configuration at the neighbor level is same as in [Test case-1] except for IPv4-unicast and
IPv6-unicast being enabled at the peer-group level
* No configuration should be made at the global AFI-SAFI level
* No configuration should be made at the neighbor AFI-SAFI level

* Verification:
* For IPv4 neighbor, ensure that the IPv4 neighborship is up and both IPv4-unicast and
Expand Down Expand Up @@ -78,7 +78,6 @@ BGP AFI SAFI OC DEFAULTS TEST
* For IPv6 neighbor ensure that the IPv6 neighborship is not ESTABLISHED and
IPv6-unicast capabilities are set to FALSE.


## OpenConfig Path and RPC Coverage

The below yaml defines the OC paths intended to be covered by this test. OC paths used for test setup are not listed here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,10 @@ func bgpCreateNbr(t *testing.T, localAs, peerAs uint32, dut *ondatra.DUTDevice,
case globalLevel:
if nbr.isV4 == true {
global.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).Enabled = ygot.Bool(true)
nv4.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).Enabled = ygot.Bool(true)
} else {
global.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV6_UNICAST).Enabled = ygot.Bool(true)
nv4.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV6_UNICAST).Enabled = ygot.Bool(true)
}
if !isV4Only {
if !deviations.BGPGlobalExtendedNextHopEncodingUnsupported(dut) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ func bgpCreateNbr(t *testing.T, dut *ondatra.DUTDevice, authPwd, routerID string
global := bgp.GetOrCreateGlobal()
global.RouterId = ygot.String(routerID)
global.As = ygot.Uint32(localAs)
global.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).Enabled = ygot.Bool(true)
global.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV6_UNICAST).Enabled = ygot.Bool(true)

pg1 := bgp.GetOrCreatePeerGroup(peerGrpName1)
pg1.PeerAs = ygot.Uint32(ateAS1)
Expand Down
29 changes: 23 additions & 6 deletions feature/gribi/otg_tests/ipv4_entry_test/ipv4_entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ func TestMain(m *testing.M) {

func staticARPWithMagicUniversalIP(t *testing.T, dut *ondatra.DUTDevice) {
t.Helper()
dummyIPCIDR1 := nh1IpAddr + "/32"
dummyIPCIDR2 := nh2IpAddr + "/32"
p2 := dut.Port(t, "port2")
p3 := dut.Port(t, "port3")
s2 := &oc.NetworkInstance_Protocol_Static{
Prefix: ygot.String(nh1IpAddr + "/32"),
Prefix: ygot.String(dummyIPCIDR1),
NextHop: map[string]*oc.NetworkInstance_Protocol_Static_NextHop{
strconv.Itoa(nh1ID): {
Index: ygot.String(strconv.Itoa(nh1ID)),
Expand All @@ -131,7 +133,7 @@ func staticARPWithMagicUniversalIP(t *testing.T, dut *ondatra.DUTDevice) {
},
}
s3 := &oc.NetworkInstance_Protocol_Static{
Prefix: ygot.String(nh2IpAddr + "/32"),
Prefix: ygot.String(dummyIPCIDR2),
NextHop: map[string]*oc.NetworkInstance_Protocol_Static_NextHop{
strconv.Itoa(nh2ID): {
Index: ygot.String(strconv.Itoa(nh2ID)),
Expand All @@ -141,9 +143,24 @@ func staticARPWithMagicUniversalIP(t *testing.T, dut *ondatra.DUTDevice) {
},
},
}
static1 := &oc.NetworkInstance_Protocol{
Identifier: oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_STATIC,
Name: ygot.String(deviations.StaticProtocolName(dut)),
Static: map[string]*oc.NetworkInstance_Protocol_Static{
dummyIPCIDR1: s2,
},
}
static2 := &oc.NetworkInstance_Protocol{
Identifier: oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_STATIC,
Name: ygot.String(deviations.StaticProtocolName(dut)),
Static: map[string]*oc.NetworkInstance_Protocol_Static{
dummyIPCIDR2: s3,
},
}
fptest.ConfigureDefaultNetworkInstance(t, dut)
sp := gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_STATIC, deviations.StaticProtocolName(dut))
gnmi.Replace(t, dut, sp.Static(nh1IpAddr+"/32").Config(), s2)
gnmi.Replace(t, dut, sp.Static(nh2IpAddr+"/32").Config(), s3)
gnmi.Update(t, dut, sp.Config(), static1)
gnmi.Update(t, dut, sp.Config(), static2)
gnmi.Update(t, dut, gnmi.OC().Interface(p2.Name()).Config(), configStaticArp(p2, nh1IpAddr, staticDstMAC))
gnmi.Update(t, dut, gnmi.OC().Interface(p3.Name()).Config(), configStaticArp(p3, nh2IpAddr, staticDstMAC))
}
Expand Down Expand Up @@ -349,7 +366,7 @@ func TestIPv4Entry(t *testing.T) {
if tc.gribiMACOverrideWithStaticARPStaticRoute {
staticARPWithMagicUniversalIP(t, dut)
} else if tc.gribiMACOverrideWithStaticARP {
//Creating a Static ARP entry for staticDstMAC
// Creating a Static ARP entry for staticDstMAC
d := gnmi.OC()
p2 := dut.Port(t, "port2")
p3 := dut.Port(t, "port3")
Expand All @@ -359,7 +376,7 @@ func TestIPv4Entry(t *testing.T) {
gnmi.Update(t, dut, d.Interface(p3.Name()).Config(), configStaticArp(p3, nh2IpAddr, staticDstMAC))
}
if tc.gribiMACOverrideWithStaticARP || tc.gribiMACOverrideWithStaticARPStaticRoute {
//Programming a gRIBI flow with above IP/mac-address as the next-hop entry
// Programming a gRIBI flow with above IP/mac-address as the next-hop entry
tc.entries = []fluent.GRIBIEntry{
fluent.NextHopEntry().WithNetworkInstance(deviations.DefaultNetworkInstance(dut)).
WithIndex(nh1ID).WithInterfaceRef(dut.Port(t, "port2").Name()).WithIPAddress(nh1IpAddr).WithMacAddress(staticDstMAC),
Expand Down
9 changes: 0 additions & 9 deletions feature/gribi/otg_tests/static_lsp_test/metadata.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,3 @@ platform_exceptions: {
ipv4_missing_enabled: true
}
}

platform_exceptions: {
platform: {
vendor: JUNIPER
}
deviations: {
static_lsp_unsupported: true
}
}
64 changes: 9 additions & 55 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,7 +15,6 @@ 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 @@ -142,60 +141,15 @@ 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) {
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)
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)
}

func createTrafficFlow(t *testing.T,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,6 @@ func TestAuthentication(t *testing.T) {
ts := isissession.MustNew(t).WithISIS()
ts.ConfigISIS(func(isis *oc.NetworkInstance_Protocol_Isis) {
level := isis.GetOrCreateLevel(2)
level.Enabled = ygot.Bool(true)
auth := level.GetOrCreateAuthentication()
auth.Enabled = ygot.Bool(true)
auth.AuthMode = tc.mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ func TestMotdBanner(t *testing.T) {

t.Run("Get MOTD Config", func(t *testing.T) {
if testCase.banner == "" {
if gnmi.LookupConfig(t, dut, config.Config()).IsPresent() {
if v, ok := gnmi.LookupConfig(t, dut, config.Config()).Val(); ok && v != "" {
t.Errorf("MOTD Banner not empty")
} else {
t.Logf("No response for the path is expected as the config is empty")
}
} else {
configGot := gnmi.Get(t, dut, config.Config())
Expand All @@ -73,10 +71,8 @@ func TestMotdBanner(t *testing.T) {

t.Run("Get MOTD Telemetry", func(t *testing.T) {
if testCase.banner == "" {
if gnmi.LookupConfig(t, dut, config.Config()).IsPresent() {
if v, ok := gnmi.Lookup(t, dut, state.State()).Val(); ok && v != "" {
t.Errorf("MOTD Telemetry Banner not empty")
} else {
t.Logf("No response for the path is expected as the config is empty")
}
} else {
stateGot := gnmi.Get(t, dut, state.State())
Expand Down Expand Up @@ -124,10 +120,8 @@ func TestLoginBanner(t *testing.T) {

t.Run("Get Login Banner Config", func(t *testing.T) {
if testCase.banner == "" {
if gnmi.LookupConfig(t, dut, config.Config()).IsPresent() {
if v, ok := gnmi.LookupConfig(t, dut, config.Config()).Val(); ok && v != "" {
t.Errorf("Config Login Banner not empty")
} else {
t.Logf("No response for the path expected is expected as the config is empty")
}
} else {
configGot := gnmi.Get(t, dut, config.Config())
Expand All @@ -140,10 +134,8 @@ func TestLoginBanner(t *testing.T) {

t.Run("Get Login Banner Telemetry", func(t *testing.T) {
if testCase.banner == "" {
if gnmi.LookupConfig(t, dut, config.Config()).IsPresent() {
if v, ok := gnmi.Lookup(t, dut, state.State()).Val(); ok && v != "" {
t.Errorf("Telemetry Login Banner not empty")
} else {
t.Logf("No response for the path is expected as the config is empty")
}
} else {
stateGot := gnmi.Get(t, dut, state.State())
Expand Down
4 changes: 2 additions & 2 deletions tools/ci-trigger/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM golang:1.21 as builder
FROM golang:1 as builder
WORKDIR /app
COPY . /app/
RUN CGO_ENABLED=0 GOOS=linux go build -mod=readonly -v -o server github.com/openconfig/featureprofiles/tools/ci-trigger
FROM golang:1.21-alpine
FROM golang:1-alpine
COPY --from=builder /app/server /server
ENTRYPOINT ["/server"]
CMD ["-alsologtostderr"]
2 changes: 1 addition & 1 deletion tools/ci-trigger/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
steps:
- name: golang:1.21
- name: golang:1
entrypoint: /bin/bash
args: [ '-c', 'go test -timeout 5m -v github.com/openconfig/featureprofiles/tools/ci-trigger/...']
- name: 'gcr.io/cloud-builders/docker'
Expand Down
3 changes: 1 addition & 2 deletions tools/ci-trigger/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ const (

// authorizedTeams is the list of GitHub organization teams authorized to launch Cloud Build jobs.
var authorizedTeams = []string{
"featureprofiles-maintainers",
"featureprofiles-quattro-tl",
"featureprofiles-writers",
}

// triggerKeywords is the list of authorized keywords to launch a test. The
Expand Down

0 comments on commit c443569

Please sign in to comment.