Skip to content

Commit

Permalink
Remove unnecessary SetChoice calls (openconfig#2555)
Browse files Browse the repository at this point in the history
* Remove unnecessary SetChoice calls

* remove inadvertent quotes around Set
  • Loading branch information
greg-dennis authored Jan 17, 2024
1 parent 73a89ba commit a4e0264
Show file tree
Hide file tree
Showing 52 changed files with 126 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func (ad *ateData) ConfigureOTG(t *testing.T, otg *otg.OTG, ateList []string) go
dev := config.Devices().Add().SetName(devName)

eth := dev.Ethernets().Add().SetName(devName + ".Eth").SetMac(v.iface.MAC)
eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(port.Name())
eth.Connection().SetPortName(port.Name())
bgp := dev.Bgp().SetRouterId(v.iface.IPv4)
if v.ip.v4 != "" {
address := strings.Split(v.ip.v4, "/")[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (ad *ateData) ConfigureOTG(t *testing.T, otg *otg.OTG, ateList []string) go
ateIndex++

eth := dev.Ethernets().Add().SetName(devName + ".Eth").SetMac(v.iface.mac)
eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(port.Name())
eth.Connection().SetPortName(port.Name())
bgp := dev.Bgp().SetRouterId(v.iface.routerId)
if v.ip.v4 != "" {
address := strings.Split(v.ip.v4, "/")[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ func configureFlow(bs *cfgplugins.BGPSession) {
flow.TxRx().Device().
SetTxNames([]string{bs.ATEPorts[0].Name + ".IPv4"}).
SetRxNames(rxNames)
flow.Duration().SetChoice(gosnappi.FlowDurationChoice.FIXED_PACKETS)
flow.Duration().FixedPackets().SetPackets(totalPackets)
flow.Size().SetFixed(1500)
flow.Rate().SetPps(trafficPps)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func configureOTG(t *testing.T, otg *otg.OTG) {
// Port1 Configuration.
iDut1Dev := config.Devices().Add().SetName(atePort1.Name)
iDut1Eth := iDut1Dev.Ethernets().Add().SetName(atePort1.Name + ".Eth").SetMac(atePort1.MAC)
iDut1Eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(port1.Name())
iDut1Eth.Connection().SetPortName(port1.Name())
iDut1Ipv4 := iDut1Eth.Ipv4Addresses().Add().SetName(atePort1.Name + ".IPv4")
iDut1Ipv4.SetAddress(atePort1.IPv4).SetGateway(dutPort1.IPv4).SetPrefix(uint32(atePort1.IPv4Len))
iDut1Ipv6 := iDut1Eth.Ipv6Addresses().Add().SetName(atePort1.Name + ".IPv6")
Expand All @@ -296,7 +296,7 @@ func configureOTG(t *testing.T, otg *otg.OTG) {
// Port2 Configuration.
iDut2Dev := config.Devices().Add().SetName(atePort2.Name)
iDut2Eth := iDut2Dev.Ethernets().Add().SetName(atePort2.Name + ".Eth").SetMac(atePort2.MAC)
iDut2Eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(port2.Name())
iDut2Eth.Connection().SetPortName(port2.Name())
iDut2Ipv4 := iDut2Eth.Ipv4Addresses().Add().SetName(atePort2.Name + ".IPv4")
iDut2Ipv4.SetAddress(atePort2.IPv4).SetGateway(dutPort2.IPv4).SetPrefix(uint32(atePort2.IPv4Len))
iDut2Ipv6 := iDut2Eth.Ipv6Addresses().Add().SetName(atePort2.Name + ".IPv6")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,15 +426,15 @@ func configureATE(t *testing.T, otg *otg.OTG) gosnappi.Config {

srcDev := config.Devices().Add().SetName(ateSrc.Name)
srcEth := srcDev.Ethernets().Add().SetName(ateSrc.Name + ".Eth").SetMac(ateSrc.MAC)
srcEth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(srcPort.Name())
srcEth.Connection().SetPortName(srcPort.Name())
srcIpv4 := srcEth.Ipv4Addresses().Add().SetName(ateSrc.Name + ".IPv4")
srcIpv4.SetAddress(ateSrc.IPv4).SetGateway(dutSrc.IPv4).SetPrefix(uint32(ateSrc.IPv4Len))
srcIpv6 := srcEth.Ipv6Addresses().Add().SetName(ateSrc.Name + ".IPv6")
srcIpv6.SetAddress(ateSrc.IPv6).SetGateway(dutSrc.IPv6).SetPrefix(uint32(ateSrc.IPv6Len))

dstDev := config.Devices().Add().SetName(ateDst.Name)
dstEth := dstDev.Ethernets().Add().SetName(ateDst.Name + ".Eth").SetMac(ateDst.MAC)
dstEth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(dstPort.Name())
dstEth.Connection().SetPortName(dstPort.Name())
dstIpv4 := dstEth.Ipv4Addresses().Add().SetName(ateDst.Name + ".IPv4")
dstIpv4.SetAddress(ateDst.IPv4).SetGateway(dutDst.IPv4).SetPrefix(uint32(ateDst.IPv4Len))
dstIpv6 := dstEth.Ipv6Addresses().Add().SetName(ateDst.Name + ".IPv6")
Expand Down Expand Up @@ -477,7 +477,7 @@ func configureATE(t *testing.T, otg *otg.OTG) gosnappi.Config {
SetTxNames([]string{srcIpv4.Name()}).
SetRxNames([]string{dstBgp4PeerRoutes.Name()})
flowipv4.Size().SetFixed(512)
flowipv4.Duration().SetChoice("continuous")
flowipv4.Duration().Continuous()
e1 := flowipv4.Packet().Add().Ethernet()
e1.Src().SetValue(srcEth.Mac())
v4 := flowipv4.Packet().Add().Ipv4()
Expand All @@ -490,7 +490,7 @@ func configureATE(t *testing.T, otg *otg.OTG) gosnappi.Config {
SetTxNames([]string{srcIpv6.Name()}).
SetRxNames([]string{dstBgp6PeerRoutes.Name()})
flowipv6.Size().SetFixed(512)
flowipv6.Duration().SetChoice("continuous")
flowipv6.Duration().Continuous()
e2 := flowipv6.Packet().Add().Ethernet()
e2.Src().SetValue(srcEth.Mac())
v6 := flowipv6.Packet().Add().Ipv6()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func configureATE(t *testing.T, ate *ondatra.ATEDevice) gosnappi.Config {
srcPort := topo.Ports().Add().SetName("port1")
srcDev := topo.Devices().Add().SetName(ateSrc.Name)
srcEth := srcDev.Ethernets().Add().SetName(ateSrc.Name + ".Eth").SetMac(ateSrc.MAC)
srcEth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(srcPort.Name())
srcEth.Connection().SetPortName(srcPort.Name())
srcIpv4 := srcEth.Ipv4Addresses().Add().SetName(ateSrc.Name + ".IPv4")
srcIpv4.SetAddress(ateSrc.IPv4).SetGateway(dutSrc.IPv4).SetPrefix(uint32(ateSrc.IPv4Len))
srcIpv6 := srcEth.Ipv6Addresses().Add().SetName(ateSrc.Name + ".IPv6")
Expand All @@ -168,7 +168,7 @@ func configureATE(t *testing.T, ate *ondatra.ATEDevice) gosnappi.Config {
dstPort := topo.Ports().Add().SetName("port2")
dstDev := topo.Devices().Add().SetName(ateDst.Name)
dstEth := dstDev.Ethernets().Add().SetName(ateDst.Name + ".Eth").SetMac(ateDst.MAC)
dstEth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(dstPort.Name())
dstEth.Connection().SetPortName(dstPort.Name())
dstIpv4 := dstEth.Ipv4Addresses().Add().SetName(ateDst.Name + ".IPv4")
dstIpv4.SetAddress(ateDst.IPv4).SetGateway(dutDst.IPv4).SetPrefix(uint32(ateDst.IPv4Len))
dstIpv6 := dstEth.Ipv6Addresses().Add().SetName(ateDst.Name + ".IPv6")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func ateFlowConfig(t *testing.T, topo gosnappi.Config, srcEth gosnappi.DeviceEth
SetTxNames([]string{srcIpv4.Name()}).
SetRxNames([]string{dstBgp4PeerRoutes.Name()})
flowipv4.Size().SetFixed(512)
flowipv4.Duration().SetChoice("continuous")
flowipv4.Duration().Continuous()
e1 := flowipv4.Packet().Add().Ethernet()
e1.Src().SetValue(srcEth.Mac())
v4 := flowipv4.Packet().Add().Ipv4()
Expand All @@ -221,7 +221,7 @@ func ateFlowConfig(t *testing.T, topo gosnappi.Config, srcEth gosnappi.DeviceEth
SetTxNames([]string{srcIpv6.Name()}).
SetRxNames([]string{dstBgp6PeerRoutes.Name()})
flowipv6.Size().SetFixed(512)
flowipv6.Duration().SetChoice("continuous")
flowipv6.Duration().Continuous()
e2 := flowipv6.Packet().Add().Ethernet()
e2.Src().SetValue(srcEth.Mac())
v6 := flowipv6.Packet().Add().Ipv6()
Expand Down
2 changes: 1 addition & 1 deletion feature/example/tests/topology_test/topology_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func configureATE(t *testing.T, ate *ondatra.ATEDevice) gosnappi.Config {
in := top.Ports().Add().SetName(ap.ID())
dev := top.Devices().Add().SetName(ap.Name() + ".dev")
eth := dev.Ethernets().Add().SetName(ap.Name() + ".eth").SetMac(atePortMac(i))
eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(in.Name())
eth.Connection().SetPortName(in.Name())
ipv4Addr := strings.Split(atePortCIDR(i), "/")[0]
eth.Ipv4Addresses().Add().SetName(dev.Name() + ".ipv4").
SetAddress(ipv4Addr).SetGateway(dutPortIP(i)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,15 @@ func configureOTG(t *testing.T, otg *otg.OTG, otgPeerList []string) gosnappi.Con

iDut1Dev := config.Devices().Add().SetName(atePort1.Name)
iDut1Eth := iDut1Dev.Ethernets().Add().SetName(atePort1.Name + ".Eth").SetMac(atePort1.MAC)
iDut1Eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(port1.Name())
iDut1Eth.Connection().SetPortName(port1.Name())
iDut1Ipv4 := iDut1Eth.Ipv4Addresses().Add().SetName(atePort1.Name + ".IPv4")
iDut1Ipv4.SetAddress(atePort1.IPv4).SetGateway(dutPort1.IPv4).SetPrefix(uint32(atePort1.IPv4Len))
iDut1Ipv6 := iDut1Eth.Ipv6Addresses().Add().SetName(atePort1.Name + ".IPv6")
iDut1Ipv6.SetAddress(atePort1.IPv6).SetGateway(dutPort1.IPv6).SetPrefix(uint32(atePort1.IPv6Len))

iDut2Dev := config.Devices().Add().SetName(atePort2.Name)
iDut2Eth := iDut2Dev.Ethernets().Add().SetName(atePort2.Name + ".Eth").SetMac(atePort2.MAC)
iDut2Eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(port2.Name())
iDut2Eth.Connection().SetPortName(port2.Name())
iDut2Ipv4 := iDut2Eth.Ipv4Addresses().Add().SetName(atePort2.Name + ".IPv4")
iDut2Ipv4.SetAddress(atePort2.IPv4).SetGateway(dutPort2.IPv4).SetPrefix(uint32(atePort2.IPv4Len))
iDut2Ipv6 := iDut2Eth.Ipv6Addresses().Add().SetName(atePort2.Name + ".IPv6")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,19 +288,19 @@ func configureOTG(t *testing.T, otg *otg.OTG) gosnappi.Config {

iDut1Dev := config.Devices().Add().SetName(ateSrc.Name)
iDut1Eth := iDut1Dev.Ethernets().Add().SetName(ateSrc.Name + ".Eth").SetMac(ateSrc.MAC)
iDut1Eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(port1.Name())
iDut1Eth.Connection().SetPortName(port1.Name())
iDut1Ipv4 := iDut1Eth.Ipv4Addresses().Add().SetName(ateSrc.Name + ".IPv4")
iDut1Ipv4.SetAddress(ateSrc.IPv4).SetGateway(dutSrc.IPv4).SetPrefix(uint32(ateSrc.IPv4Len))

iDut2Dev := config.Devices().Add().SetName(ateDst1.Name)
iDut2Eth := iDut2Dev.Ethernets().Add().SetName(ateDst1.Name + ".Eth").SetMac(ateDst1.MAC)
iDut2Eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(port2.Name())
iDut2Eth.Connection().SetPortName(port2.Name())
iDut2Ipv4 := iDut2Eth.Ipv4Addresses().Add().SetName(ateDst1.Name + ".IPv4")
iDut2Ipv4.SetAddress(ateDst1.IPv4).SetGateway(dutDst1.IPv4).SetPrefix(uint32(ateDst1.IPv4Len))

iDut3Dev := config.Devices().Add().SetName(ateDst2.Name)
iDut3Eth := iDut3Dev.Ethernets().Add().SetName(ateDst2.Name + ".Eth").SetMac(ateDst2.MAC)
iDut3Eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(port3.Name())
iDut3Eth.Connection().SetPortName(port3.Name())
iDut3Ipv4 := iDut3Eth.Ipv4Addresses().Add().SetName(ateDst2.Name + ".IPv4")
iDut3Ipv4.SetAddress(ateDst2.IPv4).SetGateway(dutDst2.IPv4).SetPrefix(uint32(ateDst2.IPv4Len))

Expand Down Expand Up @@ -345,7 +345,7 @@ func configureOTG(t *testing.T, otg *otg.OTG) gosnappi.Config {
SetRxNames([]string{bgpNeti1Bgp4PeerRoutes.Name()})
flow1ipv4.Size().SetFixed(512)
flow1ipv4.Rate().SetPps(100)
flow1ipv4.Duration().SetChoice("continuous")
flow1ipv4.Duration().Continuous()
e1 := flow1ipv4.Packet().Add().Ethernet()
e1.Src().SetValue(iDut1Eth.Mac())
v4 := flow1ipv4.Packet().Add().Ipv4()
Expand All @@ -360,7 +360,7 @@ func configureOTG(t *testing.T, otg *otg.OTG) gosnappi.Config {
SetRxNames([]string{bgpNeti2Bgp4PeerRoutes.Name()})
flow2ipv4.Size().SetFixed(512)
flow2ipv4.Rate().SetPps(100)
flow2ipv4.Duration().SetChoice("continuous")
flow2ipv4.Duration().Continuous()
e2 := flow2ipv4.Packet().Add().Ethernet()
e2.Src().SetValue(iDut1Eth.Mac())
v4Flow2 := flow2ipv4.Packet().Add().Ipv4()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,15 @@ func configureOTG(t *testing.T, otg *otg.OTG, asSeg []uint32, asSEQMode bool) go

iDut1Dev := config.Devices().Add().SetName(ateSrc.Name)
iDut1Eth := iDut1Dev.Ethernets().Add().SetName(ateSrc.Name + ".Eth").SetMac(ateSrc.MAC)
iDut1Eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(port1.Name())
iDut1Eth.Connection().SetPortName(port1.Name())
iDut1Ipv4 := iDut1Eth.Ipv4Addresses().Add().SetName(ateSrc.Name + ".IPv4")
iDut1Ipv4.SetAddress(ateSrc.IPv4).SetGateway(dutSrc.IPv4).SetPrefix(uint32(ateSrc.IPv4Len))
iDut1Ipv6 := iDut1Eth.Ipv6Addresses().Add().SetName(ateSrc.Name + ".IPv6")
iDut1Ipv6.SetAddress(ateSrc.IPv6).SetGateway(dutSrc.IPv6).SetPrefix(uint32(ateSrc.IPv6Len))

iDut2Dev := config.Devices().Add().SetName(ateDst.Name)
iDut2Eth := iDut2Dev.Ethernets().Add().SetName(ateDst.Name + ".Eth").SetMac(ateDst.MAC)
iDut2Eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(port2.Name())
iDut2Eth.Connection().SetPortName(port2.Name())
iDut2Ipv4 := iDut2Eth.Ipv4Addresses().Add().SetName(ateDst.Name + ".IPv4")
iDut2Ipv4.SetAddress(ateDst.IPv4).SetGateway(dutDst.IPv4).SetPrefix(uint32(ateDst.IPv4Len))
iDut2Ipv6 := iDut2Eth.Ipv6Addresses().Add().SetName(ateDst.Name + ".IPv6")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func configureOTG(t *testing.T, otg *otg.OTG) gosnappi.Config {

iDut1Dev := config.Devices().Add().SetName(atePort1.Name)
iDut1Eth := iDut1Dev.Ethernets().Add().SetName(atePort1.Name + ".Eth").SetMac(atePort1.MAC)
iDut1Eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(port1.Name())
iDut1Eth.Connection().SetPortName(port1.Name())
iDut1Ipv4 := iDut1Eth.Ipv4Addresses().Add().SetName(atePort1.Name + ".IPv4")
iDut1Ipv4.SetAddress(atePort1.IPv4).SetGateway(dut1Port1.IPv4).SetPrefix(uint32(atePort1.IPv4Len))
iDut1Ipv6 := iDut1Eth.Ipv6Addresses().Add().SetName(atePort1.Name + ".IPv6")
Expand Down Expand Up @@ -247,7 +247,7 @@ func configOTG(t *testing.T, otg *otg.OTG) gosnappi.Config {

iDut1Dev := config.Devices().Add().SetName(atePort1.Name)
iDut1Eth := iDut1Dev.Ethernets().Add().SetName(atePort1.Name + ".Eth").SetMac(atePort1.MAC).SetMtu(uint32(mtu5040B))
iDut1Eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(port1.Name())
iDut1Eth.Connection().SetPortName(port1.Name())
iDut1Ipv4 := iDut1Eth.Ipv4Addresses().Add().SetName(atePort1.Name + ".IPv4")
iDut1Ipv4.SetAddress(atePort1.IPv4).SetGateway(dut1Port1.IPv4).SetPrefix(uint32(atePort1.IPv4Len))
iDut1Ipv6 := iDut1Eth.Ipv6Addresses().Add().SetName(atePort1.Name + ".IPv6")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ func configureOTG(t *testing.T, otg *otg.OTG) (gosnappi.BgpV6Peer, gosnappi.Devi

iDut1Dev := config.Devices().Add().SetName(atePort1.Name)
iDut1Eth := iDut1Dev.Ethernets().Add().SetName(atePort1.Name + ".Eth").SetMac(atePort1.MAC)
iDut1Eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(port1.Name())
iDut1Eth.Connection().SetPortName(port1.Name())
iDut1Ipv4 := iDut1Eth.Ipv4Addresses().Add().SetName(atePort1.Name + ".IPv4")
iDut1Ipv4.SetAddress(atePort1.IPv4).SetGateway(dutPort1.IPv4).SetPrefix(uint32(atePort1.IPv4Len))
iDut1Ipv6 := iDut1Eth.Ipv6Addresses().Add().SetName(atePort1.Name + ".IPv6")
iDut1Ipv6.SetAddress(atePort1.IPv6).SetGateway(dutPort1.IPv6).SetPrefix(uint32(atePort1.IPv6Len))

iDut2Dev := config.Devices().Add().SetName(atePort2.Name)
iDut2Eth := iDut2Dev.Ethernets().Add().SetName(atePort2.Name + ".Eth").SetMac(atePort2.MAC)
iDut2Eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(port2.Name())
iDut2Eth.Connection().SetPortName(port2.Name())
iDut2Ipv4 := iDut2Eth.Ipv4Addresses().Add().SetName(atePort2.Name + ".IPv4")
iDut2Ipv4.SetAddress(atePort2.IPv4).SetGateway(dutPort2.IPv4).SetPrefix(uint32(atePort2.IPv4Len))

Expand Down Expand Up @@ -304,7 +304,7 @@ func sendTraffic(t *testing.T, args *testArgs) {
SetRxNames([]string{atePort2.Name + ".IPv4"})
flow1ipv4.Size().SetFixed(512)
flow1ipv4.Rate().SetPps(100)
flow1ipv4.Duration().SetChoice("continuous")
flow1ipv4.Duration().Continuous()
e1 := flow1ipv4.Packet().Add().Ethernet()
e1.Src().SetValue(atePort1.MAC)
v4 := flow1ipv4.Packet().Add().Ipv4()
Expand All @@ -318,7 +318,7 @@ func sendTraffic(t *testing.T, args *testArgs) {
SetRxNames([]string{atePort2.Name + ".IPv4"})
flow2ipv4.Size().SetFixed(512)
flow2ipv4.Rate().SetPps(100)
flow2ipv4.Duration().SetChoice("continuous")
flow2ipv4.Duration().Continuous()
e2 := flow2ipv4.Packet().Add().Ethernet()
e2.Src().SetValue(atePort1.MAC)
v4Flow2 := flow2ipv4.Packet().Add().Ipv4()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func configureSubinterfaceDUT(t *testing.T, d *oc.Root, dutPort *ondatra.Port, i
func configureATE(t *testing.T, top gosnappi.Config, atePort *ondatra.Port, vlanID uint16, Name, MAC, dutIPv4, ateIPv4 string) {
dev := top.Devices().Add().SetName(Name + ".Dev")
eth := dev.Ethernets().Add().SetName(Name + ".Eth").SetMac(MAC)
eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(atePort.ID())
eth.Connection().SetPortName(atePort.ID())
if vlanID != 0 {
eth.Vlans().Add().SetName(Name).SetId(uint32(vlanID))
}
Expand Down Expand Up @@ -386,7 +386,7 @@ func createTrafficFlow(t *testing.T, ate *ondatra.ATEDevice, top gosnappi.Config
flow.TxRx().Port().SetTxName("port1").SetRxName("port2")
e1 := flow.Packet().Add().Ethernet()
e1.Src().SetValue(atePort1.MAC)
e1.Dst().SetChoice("value").SetValue(dstMac)
e1.Dst().SetValue(dstMac)
v4 := flow.Packet().Add().Ipv4()
v4.Src().SetValue(atePort1.IPv4)
v4.Dst().Increment().SetStart(flowArgs.flowStartAddress).SetCount(flowArgs.flowCount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ func configureSubinterfaceDUT(d *oc.Root, dutPort *ondatra.Port, index uint32, v
func configureATE(top gosnappi.Config, atePort *ondatra.Port, Name string, vlanID uint16, dutIPv4, ateIPv4, ateMAC string) {
dev := top.Devices().Add().SetName(Name + ".Dev")
eth := dev.Ethernets().Add().SetName(Name + ".Eth").SetMac(ateMAC)
eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(atePort.ID())
eth.Connection().SetPortName(atePort.ID())
if vlanID != 0 {
eth.Vlans().Add().SetName(Name).SetId(uint32(vlanID))
}
Expand Down Expand Up @@ -333,7 +333,7 @@ func createTrafficFlow(t *testing.T, ate *ondatra.ATEDevice, top gosnappi.Config
flow.TxRx().Port().SetTxName("port1").SetRxName("port2")
e1 := flow.Packet().Add().Ethernet()
e1.Src().SetValue(atePort1.MAC)
e1.Dst().SetChoice("value").SetValue(dstMac)
e1.Dst().SetValue(dstMac)
v4 := flow.Packet().Add().Ipv4()
v4.Src().SetValue(atePort1.IPv4)
v4.Dst().Increment().SetStart("198.18.196.1").SetCount(1020)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func configureOTG(t *testing.T, otg *otg.OTG) {
port1 := config.Ports().Add().SetName("port1")
iDut1Dev := config.Devices().Add().SetName(atePort1Attr.Name)
iDut1Eth := iDut1Dev.Ethernets().Add().SetName(atePort1Attr.Name + ".Eth").SetMac(atePort1Attr.MAC)
iDut1Eth.Connection().SetChoice(gosnappi.EthernetConnectionChoice.PORT_NAME).SetPortName(port1.Name())
iDut1Eth.Connection().SetPortName(port1.Name())
t.Logf("Pushing config to ATE and starting protocols...")
otg.PushConfig(t, config)
otg.StartProtocols(t)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func testTraffic(
flow.Metrics().SetEnable(true)
eth := flow.Packet().Add().Ethernet()
eth.Src().SetValue(ateSrc.MAC)
eth.Dst().SetChoice("value").SetValue(myStationMAC)
eth.Dst().SetValue(myStationMAC)
if ipType == "IPv4" {
v4 := flow.Packet().Add().Ipv4()
v4.Src().SetValue(ateSrc.IPv4)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func configureOTG(t *testing.T, ts *isissession.TestSession) {
SetRxNames([]string{v4NetName})
v4Flow.Size().SetFixed(512)
v4Flow.Rate().SetPps(100)
v4Flow.Duration().SetChoice("continuous")
v4Flow.Duration().Continuous()
e1 := v4Flow.Packet().Add().Ethernet()
e1.Src().SetValue(isissession.ATEISISAttrs.MAC)
v4 := v4Flow.Packet().Add().Ipv4()
Expand All @@ -114,7 +114,7 @@ func configureOTG(t *testing.T, ts *isissession.TestSession) {
SetRxNames([]string{v6NetName})
v6Flow.Size().SetFixed(512)
v6Flow.Rate().SetPps(100)
v6Flow.Duration().SetChoice("continuous")
v6Flow.Duration().Continuous()
e2 := v6Flow.Packet().Add().Ethernet()
e2.Src().SetValue(isissession.ATEISISAttrs.MAC)
v6 := v6Flow.Packet().Add().Ipv6()
Expand Down
Loading

0 comments on commit a4e0264

Please sign in to comment.