Skip to content

Commit

Permalink
ni_proto -> niProto (#2135)
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-dennis authored Sep 15, 2023
1 parent a6f9af6 commit a611567
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ func buildNbrList(asN uint32) []*bgpNeighbor {
func bgpWithNbr(as uint32, nbrs []*bgpNeighbor, dut *ondatra.DUTDevice) *oc.NetworkInstance_Protocol {
d := &oc.Root{}
ni1 := d.GetOrCreateNetworkInstance(deviations.DefaultNetworkInstance(dut))
ni_proto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := ni_proto.GetOrCreateBgp()
niProto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := niProto.GetOrCreateBgp()

g := bgp.GetOrCreateGlobal()
g.As = ygot.Uint32(as)
Expand Down Expand Up @@ -246,7 +246,7 @@ func bgpWithNbr(as uint32, nbrs []*bgpNeighbor, dut *ondatra.DUTDevice) *oc.Netw
af4.Enabled = ygot.Bool(false)
}
}
return ni_proto
return niProto
}

func checkBgpStatus(t *testing.T, dut *ondatra.DUTDevice) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ func bgpCreateNbr(localAs, peerAs uint32, policy string, dut *ondatra.DUTDevice)

d := &oc.Root{}
ni1 := d.GetOrCreateNetworkInstance(deviations.DefaultNetworkInstance(dut))
ni_proto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := ni_proto.GetOrCreateBgp()
niProto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := niProto.GetOrCreateBgp()
global := bgp.GetOrCreateGlobal()
global.RouterId = ygot.String(dutDst.IPv4)
global.As = ygot.Uint32(localAs)
Expand Down Expand Up @@ -219,7 +219,7 @@ func bgpCreateNbr(localAs, peerAs uint32, policy string, dut *ondatra.DUTDevice)
}

}
return ni_proto
return niProto
}

// configureBGPPolicy configures a BGP routing policy to accept or reject routes based on prefix match conditions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ func bgpCreateNbr(localAs, peerAs uint32, policy string, dut *ondatra.DUTDevice)

d := &oc.Root{}
ni1 := d.GetOrCreateNetworkInstance(deviations.DefaultNetworkInstance(dut))
ni_proto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := ni_proto.GetOrCreateBgp()
niProto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := niProto.GetOrCreateBgp()
global := bgp.GetOrCreateGlobal()
global.RouterId = ygot.String(dutDst.IPv4)
global.As = ygot.Uint32(localAs)
Expand Down Expand Up @@ -226,7 +226,7 @@ func bgpCreateNbr(localAs, peerAs uint32, policy string, dut *ondatra.DUTDevice)
}

}
return ni_proto
return niProto
}

// configureBGPPolicy configures a BGP routing policy to accept or reject routes based on prefix match conditions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ func createBGPNeighbor(localAs, peerAs, pLimit uint32, restartTime uint16, dut *

d := &oc.Root{}
ni1 := d.GetOrCreateNetworkInstance(deviations.DefaultNetworkInstance(dut))
ni_proto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := ni_proto.GetOrCreateBgp()
niProto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := niProto.GetOrCreateBgp()

global := bgp.GetOrCreateGlobal()
global.As = ygot.Uint32(localAs)
Expand Down Expand Up @@ -302,7 +302,7 @@ func createBGPNeighbor(localAs, peerAs, pLimit uint32, restartTime uint16, dut *
}
}
}
return ni_proto
return niProto
}

func configureRoutePolicy(t *testing.T, dut *ondatra.DUTDevice, name string, pr oc.E_RoutingPolicy_PolicyResultType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ func createBGPNeighbor(localAs, peerAs, pLimit uint32, restartTime uint16, dut *

d := &oc.Root{}
ni1 := d.GetOrCreateNetworkInstance(deviations.DefaultNetworkInstance(dut))
ni_proto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := ni_proto.GetOrCreateBgp()
niProto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := niProto.GetOrCreateBgp()

global := bgp.GetOrCreateGlobal()
global.As = ygot.Uint32(localAs)
Expand Down Expand Up @@ -334,7 +334,7 @@ func createBGPNeighbor(localAs, peerAs, pLimit uint32, restartTime uint16, dut *
}
}
}
return ni_proto
return niProto
}

func configureRoutePolicy(t *testing.T, dut *ondatra.DUTDevice, name string, pr oc.E_RoutingPolicy_PolicyResultType) {
Expand Down
6 changes: 3 additions & 3 deletions feature/bgp/tests/local_bgp_test/local_bgp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ func bgpWithNbr(as uint32, routerID string, nbr *oc.NetworkInstance_Protocol_Bgp

d := &oc.Root{}
ni1 := d.GetOrCreateNetworkInstance(deviations.DefaultNetworkInstance(dut))
ni_proto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := ni_proto.GetOrCreateBgp()
niProto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := niProto.GetOrCreateBgp()
bgp.GetOrCreateGlobal().As = ygot.Uint32(as)
bgp.GetOrCreateGlobal().GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).Enabled = ygot.Bool(true)

Expand All @@ -88,7 +88,7 @@ func bgpWithNbr(as uint32, routerID string, nbr *oc.NetworkInstance_Protocol_Bgp
}

bgp.AppendNeighbor(nbr)
return ni_proto
return niProto
}

func configureNIType(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ func configureATE(t *testing.T, ateParams *bgpNbr, connectionType string) *ondat
func createBgpNeighbor(nbr *bgpNbr, dut *ondatra.DUTDevice) *oc.NetworkInstance_Protocol {
d := &oc.Root{}
ni1 := d.GetOrCreateNetworkInstance(deviations.DefaultNetworkInstance(dut))
ni_proto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := ni_proto.GetOrCreateBgp()
niProto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := niProto.GetOrCreateBgp()

global := bgp.GetOrCreateGlobal()
global.As = ygot.Uint32(nbr.localAS)
Expand All @@ -244,5 +244,5 @@ func createBgpNeighbor(nbr *bgpNbr, dut *ondatra.DUTDevice) *oc.NetworkInstance_
afisafi6.Enabled = ygot.Bool(true)
neighbor.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).Enabled = ygot.Bool(false)
}
return ni_proto
return niProto
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ func bgpCreateNbr(localAs, peerAs uint32, dut *ondatra.DUTDevice) *oc.NetworkIns

dutOcRoot := &oc.Root{}
ni1 := dutOcRoot.GetOrCreateNetworkInstance(deviations.DefaultNetworkInstance(dut))
ni_proto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := ni_proto.GetOrCreateBgp()
niProto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := niProto.GetOrCreateBgp()
global := bgp.GetOrCreateGlobal()
global.RouterId = ygot.String(dutDst2.IPv4)
global.As = ygot.Uint32(localAs)
Expand Down Expand Up @@ -196,7 +196,7 @@ func bgpCreateNbr(localAs, peerAs uint32, dut *ondatra.DUTDevice) *oc.NetworkIns
af6.Enabled = ygot.Bool(false)
}
}
return ni_proto
return niProto
}

// verifyBgpTelemetry checks that the dut has an established BGP session with reasonable settings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ func buildNbrList(asN uint32) []*bgpNeighbor {
func bgpWithNbr(as uint32, nbrs []*bgpNeighbor, dut *ondatra.DUTDevice) *oc.NetworkInstance_Protocol {
d := &oc.Root{}
ni1 := d.GetOrCreateNetworkInstance(deviations.DefaultNetworkInstance(dut))
ni_proto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := ni_proto.GetOrCreateBgp()
niProto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := niProto.GetOrCreateBgp()

g := bgp.GetOrCreateGlobal()
g.As = ygot.Uint32(as)
Expand Down Expand Up @@ -382,7 +382,7 @@ func bgpWithNbr(as uint32, nbrs []*bgpNeighbor, dut *ondatra.DUTDevice) *oc.Netw
af4.Enabled = ygot.Bool(false)
}
}
return ni_proto
return niProto
}

func checkBgpStatus(t *testing.T, dut *ondatra.DUTDevice, nbrIP []*bgpNeighbor) {
Expand Down Expand Up @@ -950,8 +950,8 @@ func configureDUTNewPeers(t *testing.T, dut *ondatra.DUTDevice, nbrs []*bgpNeigh
d := &oc.Root{}
dutConfPath := gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
ni1 := d.GetOrCreateNetworkInstance(deviations.DefaultNetworkInstance(dut))
ni_proto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := ni_proto.GetOrCreateBgp()
niProto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := niProto.GetOrCreateBgp()

// Note: we have to define the peer group even if we aren't setting any policy because it's
// invalid OC for the neighbor to be part of a peer group that doesn't exist.
Expand All @@ -968,7 +968,7 @@ func configureDUTNewPeers(t *testing.T, dut *ondatra.DUTDevice, nbrs []*bgpNeigh
af6 := nv4.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV6_UNICAST)
af6.Enabled = ygot.Bool(false)
}
gnmi.Update(t, dut, dutConfPath.Config(), ni_proto)
gnmi.Update(t, dut, dutConfPath.Config(), niProto)
fptest.LogQuery(t, "DUT BGP Config", dutConfPath.Config(), gnmi.GetConfig(t, dut, dutConfPath.Config()))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ func bgpCreateNbr(localAs, peerAs uint32, dut *ondatra.DUTDevice) *oc.NetworkIns

d := &oc.Root{}
ni1 := d.GetOrCreateNetworkInstance(deviations.DefaultNetworkInstance(dut))
ni_proto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := ni_proto.GetOrCreateBgp()
niProto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := niProto.GetOrCreateBgp()
global := bgp.GetOrCreateGlobal()
global.RouterId = ygot.String(dutDst.IPv4)
global.As = ygot.Uint32(localAs)
Expand Down Expand Up @@ -172,7 +172,7 @@ func bgpCreateNbr(localAs, peerAs uint32, dut *ondatra.DUTDevice) *oc.NetworkIns
af6 := nv4.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV6_UNICAST)
af6.Enabled = ygot.Bool(false)
}
return ni_proto
return niProto
}

// verifyBGPTelemetry checks that the dut has an established BGP session with reasonable settings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ func bgpCreateNbr(t *testing.T, localAs, peerAs uint32, dut *ondatra.DUTDevice,
nbrs := []*bgpNeighbor{nbr1, nbr2, nbr3, nbr4}
dutOcRoot := &oc.Root{}
ni1 := dutOcRoot.GetOrCreateNetworkInstance(deviations.DefaultNetworkInstance(dut))
ni_proto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := ni_proto.GetOrCreateBgp()
niProto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := niProto.GetOrCreateBgp()
global := bgp.GetOrCreateGlobal()
global.RouterId = ygot.String(dutPort2.IPv4)
global.As = ygot.Uint32(localAs)
Expand Down Expand Up @@ -176,7 +176,7 @@ func bgpCreateNbr(t *testing.T, localAs, peerAs uint32, dut *ondatra.DUTDevice,
pg2af6.Enabled = ygot.Bool(true)
}
}
return ni_proto
return niProto
}

func verifyOtgBgpTelemetry(t *testing.T, otg *otg.OTG, c gosnappi.Config, state string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ func bgpCreateNbr(localAs, peerAs uint32, dut *ondatra.DUTDevice) *oc.NetworkIns

dutOcRoot := &oc.Root{}
ni1 := dutOcRoot.GetOrCreateNetworkInstance(deviations.DefaultNetworkInstance(dut))
ni_proto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := ni_proto.GetOrCreateBgp()
niProto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := niProto.GetOrCreateBgp()
global := bgp.GetOrCreateGlobal()
global.RouterId = ygot.String(dutDst2.IPv4)
global.As = ygot.Uint32(localAs)
Expand Down Expand Up @@ -180,7 +180,7 @@ func bgpCreateNbr(localAs, peerAs uint32, dut *ondatra.DUTDevice) *oc.NetworkIns
af6 := nv4.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV6_UNICAST)
af6.Enabled = ygot.Bool(false)
}
return ni_proto
return niProto
}

func sendTraffic(t *testing.T, otg *otg.OTG, c gosnappi.Config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ func bgpCreateNbr(localAs, peerAs uint32, dut *ondatra.DUTDevice) *oc.NetworkIns

d := &oc.Root{}
ni1 := d.GetOrCreateNetworkInstance(deviations.DefaultNetworkInstance(dut))
ni_proto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := ni_proto.GetOrCreateBgp()
niProto := ni1.GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP")
bgp := niProto.GetOrCreateBgp()
global := bgp.GetOrCreateGlobal()
global.RouterId = ygot.String(dutDst.IPv4)
global.As = ygot.Uint32(localAs)
Expand Down Expand Up @@ -192,7 +192,7 @@ func bgpCreateNbr(localAs, peerAs uint32, dut *ondatra.DUTDevice) *oc.NetworkIns
af6 := nv4.GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV6_UNICAST)
af6.Enabled = ygot.Bool(false)
}
return ni_proto
return niProto
}

// verifyBGPTelemetry checks that the dut has an established BGP session with reasonable settings.
Expand Down

0 comments on commit a611567

Please sign in to comment.