Closed SuryyaKrJana closed 1 week ago
Redocly Link: https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/open-traffic-generator/models/ospfv2/artifacts/openapi.yaml&nocors
func Ospfv2P2PRoutesConfig(client *api.ApiClient, routes uint32) gosnappi.Config { config := gosnappi.NewConfig() // add ports p1 := config.Ports().Add().SetName("p1").SetLocation(opts.IxiaCPorts()[0]) p2 := config.Ports().Add().SetName("p2").SetLocation(opts.IxiaCPorts()[1]) // add devices d1 := config.Devices().Add().SetName("p1d1") d2 := config.Devices().Add().SetName("p2d1") // add protocol stacks for device d1 d1Eth1 := d1.Ethernets(). Add(). SetName("p1d1Eth1"). SetMac("00:00:01:01:01:01"). SetMtu(1500) d1Eth1.Connection().SetPortName(p1.Name()) d1Eth1. Ipv4Addresses(). Add(). SetName("p1d1ipv4"). SetAddress("1.1.1.2"). SetGateway("1.1.1.1"). SetPrefix(24) /* Ospfv2 router configuration on port 1 */ // router id default as Interface-IP. d1ospfv2 := d1.Ospfv2(). SetName("p1d1ospfv2") // Enable optional Learned Information filter d1ospfv2.SetStoreLsa(true) // Set optional timers d1ospfv2. SetLsaRetransmitTime(1). SetLsaRefreshTime(5). SetInterBurstLsuInterval(50). SetMaxFloodLsuPerBurst(10) // Set optional graceful restart mode d1ospfv2.GracefulRestart().SetHelperMode(true) // Set optional capabilities parameters. d1ospfv2.Capabilities(). SetTBit(true). SetEBit(true). SetMcBit(true). SetNpBit(true). SetEaBit(true). SetDcBit(true). SetOBit(true). SetUnusedBit(true). SetLsaBBit(true). SetLsaEBit(true) // Ospfv2 Interface d1ospfv2Intf := d1ospfv2.Interfaces().Add().SetName("p1d1int"). SetIpv4Name("p1d1ipv4") d1ospfv2Intf.Area().SetIp("1.1.1.2") //d1ospfv2Intf.Area().SetId(1) d1ospfv2Intf.NetworkType().PointToPoint() //d1ospfv2Intf.NetworkType().PointToMultipoint().Add().SetNeighborIp("5.5.5.5") //Ospfv2 Traffic Engineering settings d1ospfv2te := d1ospfv2Intf.TrafficEngineering(). Add(). SetAdministrativeGroup("111111"). SetMaxBandwith(125000000). SetMaxReservableBandwidth(125000000). SetMetricLevel(10) d1ospfv2te.PriorityBandwidths(). SetPb0(125000000). SetPb1(125000000). SetPb2(125000000). SetPb3(125000000). SetPb4(125000000). SetPb5(125000000). SetPb6(125000000). SetPb7(125000000) // Set Optional Authentication parameter d1ospfv2Intf.Authentication().Md5S().Add().SetKeyId(1).SetKey("md5key") //d1ospfv2Intf.Authentication().SetClearText("text") // Change Hello timers default values. d1ospfv2Intf.Advanced(). SetHelloInterval(20). SetDeadInterval(60). SetRoutingMetric(1). SetPriority(20). SetValidateReceivedMtu(true) // Change link protection default values d1ospfv2Intf.LinkProtection(). SetExtraTraffic(true). SetUnprotected(true). SetShared(true). SetDedicated1Plus1(true). SetDedicated1To1(true). SetEnhanced(true). SetReserved40(true). SetReserved80(true) // Set optional srlg values d1ospfv2Intf.SetSrlgValues([]uint32{2, 4}) //v4 routes d1ospfv2v4route := d1ospfv2. V4Routes(). Add(). SetName("p1d1rr1_v4routes").SetMetric(10) d1ospfv2v4route. Addresses(). Add(). SetAddress("10.10.10.1"). SetPrefix(32). SetCount(5). SetStep(1) // Change default Inter area route d1ospfv2v4route.RouteOrigin(). IntraArea(). Flags().SetAFlag(true).SetNFlag(true) // add protocol stacks for device d2 d2Eth1 := d2.Ethernets(). Add(). SetName("p2d1Eth1"). SetMac("00:00:02:02:02:02"). SetMtu(1500) d2Eth1.Connection().SetPortName(p2.Name()) d2Eth1. Ipv4Addresses(). Add(). SetName("p2d1ipv4"). SetAddress("2.2.2.2"). SetGateway("2.2.2.1"). SetPrefix(24) /* Ospfv2 router configuration on port 2 */ // router id default as Interface-IP. d2ospfv2 := d1.Ospfv2(). SetName("p2d1ospfv2") // Enable optional Learned Information filter d2ospfv2.SetStoreLsa(true) // Set optional timers d2ospfv2. SetLsaRetransmitTime(1). SetLsaRefreshTime(5). SetInterBurstLsuInterval(50). SetMaxFloodLsuPerBurst(10) // Set optional graceful restart mode d2ospfv2.GracefulRestart().SetHelperMode(true) // Set optional capabilities parameters. d2ospfv2.Capabilities(). SetTBit(true). SetEBit(true). SetMcBit(true). SetNpBit(true). SetEaBit(true). SetDcBit(true). SetOBit(true). SetUnusedBit(true). SetLsaBBit(true). SetLsaEBit(true) // Ospfv2 Interface d2ospfv2Intf := d2ospfv2.Interfaces().Add().SetName("p2d1int"). SetIpv4Name("p2d1ipv4") d2ospfv2Intf.Area().SetIp("2.2.2.2") d2ospfv2Intf.NetworkType().PointToPoint() //Ospfv2 Traffic Engineering settings d2ospfv2te := d2ospfv2Intf.TrafficEngineering(). Add(). SetAdministrativeGroup("222222"). SetMaxBandwith(125000000). SetMaxReservableBandwidth(125000000). SetMetricLevel(10) d2ospfv2te.PriorityBandwidths(). SetPb0(125000000). SetPb1(125000000). SetPb2(125000000). SetPb3(125000000). SetPb4(125000000). SetPb5(125000000). SetPb6(125000000). SetPb7(125000000) // Set Optional Authentication parameter d2ospfv2Intf.Authentication().Md5S().Add().SetKeyId(1).SetKey("md5key") // Change Hello timers default values. d2ospfv2Intf.Advanced(). SetHelloInterval(20). SetDeadInterval(60). SetRoutingMetric(1). SetPriority(20). SetValidateReceivedMtu(true) // Change link protection default values d2ospfv2Intf.LinkProtection(). SetExtraTraffic(true). SetUnprotected(true). SetShared(true). SetDedicated1Plus1(true). SetDedicated1To1(true). SetEnhanced(true). SetReserved40(true). SetReserved80(true) // Set optional srlg values d2ospfv2Intf.SetSrlgValues([]uint32{2, 4}) //v4 routes d2ospfv2v4route := d2ospfv2. V4Routes(). Add(). SetName("p2d2rr1_v4routes").SetMetric(10) d2ospfv2v4route. Addresses(). Add(). SetAddress("20.20.20.1"). SetPrefix(32). SetCount(5). SetStep(1) // Change default Inter area route d2ospfv2v4route.RouteOrigin(). IntraArea(). Flags().SetAFlag(true).SetNFlag(true) // Flows config { // Add endpoints and packet description for flow 1 flow1 := config.Flows().Add() flow1. SetName("IPv4 " + p1.Name() + "-> " + p2.Name()). TxRx(). Device(). SetTxNames([]string{d1ospfv2v4route.Name()}). SetRxNames([]string{d2ospfv2v4route.Name()}) flow1.Metrics().SetEnable(true) flow1.Duration().FixedPackets().SetPackets(1000) flow1.Rate().SetPps(200) //ethernet flow1Eth := flow1.Packet().Add().Ethernet() flow1Eth.Src().SetValue(d1Eth1.Mac()) flow1Eth.Dst().Auto() //IP packet flow1Ip := flow1.Packet().Add().Ipv4() flow1Ip.Src().Increment().SetStart(d1ospfv2v4route.Addresses().Items()[0].Address()) flow1Ip.Src().Increment().SetStep("0.0.0.1") flow1Ip.Src().Increment().SetCount(5) flow1Ip.Dst().Increment().SetStart(d2ospfv2v4route.Addresses().Items()[0].Address()) flow1Ip.Dst().Increment().SetStep("0.0.0.1") flow1Ip.Dst().Increment().SetCount(5) } { // Add endpoints and packet description for flow 2 flow2 := config.Flows().Add() flow2. SetName("IPv4 " + p2.Name() + "-> " + p1.Name()). TxRx(). Device(). SetTxNames([]string{d2ospfv2v4route.Name()}). SetRxNames([]string{d1ospfv2v4route.Name()}) flow2.Metrics().SetEnable(true) flow2.Duration().FixedPackets().SetPackets(1000) flow2.Rate().SetPps(200) //ethernet flow2Eth := flow2.Packet().Add().Ethernet() flow2Eth.Src().SetValue(d1Eth1.Mac()) flow2Eth.Dst().Auto() //IP packet flow2Ip := flow2.Packet().Add().Ipv4() flow2Ip.Src().Increment().SetStart(d2ospfv2v4route.Addresses().Items()[0].Address()) flow2Ip.Src().Increment().SetStep("0.0.0.1") flow2Ip.Src().Increment().SetCount(5) flow2Ip.Dst().Increment().SetStart(d1ospfv2v4route.Addresses().Items()[0].Address()) flow2Ip.Dst().Increment().SetStep("0.0.0.1") flow2Ip.Dst().Increment().SetCount(5) } return config }
Redocly Link: https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/open-traffic-generator/models/ospfv2/artifacts/openapi.yaml&nocors
OTG-PORT-1-OSPFv2 <-----------------------> DUT <-------------------------> OTG-PORT-2-OSPFv2