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

Support of OSPFv2 OTG Model #384

Merged
merged 59 commits into from
Oct 22, 2024
Merged

Support of OSPFv2 OTG Model #384

merged 59 commits into from
Oct 22, 2024

Conversation

SuryyaKrJana
Copy link
Contributor

@SuryyaKrJana SuryyaKrJana commented Aug 20, 2024

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

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
}

apratimmukherjee

This comment was marked as resolved.

SuryyaKrJana and others added 5 commits August 22, 2024 13:22
	modified:   device/dhcp/clients/v6/dhcpv6client.yaml
	modified:   device/dhcp/common/dhcpv6options.yaml
	deleted:    device/ospf/ospf.yaml
	deleted:    device/ospf/ospfv2/interface/auth.yaml
	deleted:    device/ospf/ospfv2/interface/interface.yaml
	deleted:    device/ospf/ospfv2/interface/linkprotection.yaml
	deleted:    device/ospf/ospfv2/router.yaml
	deleted:    device/ospf/ospfv2/routerange/v4routerange.yaml
@SuryyaKrJana SuryyaKrJana marked this pull request as ready for review September 9, 2024 05:50
device/ospfv2/interface/interface.yaml Outdated Show resolved Hide resolved
device/ospfv2/router.yaml Outdated Show resolved Hide resolved
result/ospfv2lsa.yaml Outdated Show resolved Hide resolved
result/ospfv2lsa.yaml Show resolved Hide resolved
result/ospfv2.yaml Show resolved Hide resolved
device/ospfv2/interface/interface.yaml Outdated Show resolved Hide resolved
device/ospfv2/interface/interface.yaml Outdated Show resolved Hide resolved
device/ospfv2/interface/interface.yaml Outdated Show resolved Hide resolved
flow/endpoint.yaml Outdated Show resolved Hide resolved
flow/endpoint.yaml Outdated Show resolved Hide resolved
device/ospfv2/interface/auth.yaml Outdated Show resolved Hide resolved
result/ospfv2lsa.yaml Show resolved Hide resolved
result/ospfv2lsa.yaml Outdated Show resolved Hide resolved
result/ospfv2lsa.yaml Show resolved Hide resolved
result/ospfv2.yaml Show resolved Hide resolved
device/ospfv2/interface/interface.yaml Outdated Show resolved Hide resolved
@rudranil-das rudranil-das self-requested a review October 17, 2024 15:44
Copy link
Contributor

@rudranil-das rudranil-das left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review comments addressed

device/ospfv2/router.yaml Outdated Show resolved Hide resolved
result/ospfv2lsa.yaml Outdated Show resolved Hide resolved
result/ospfv2lsa.yaml Show resolved Hide resolved
apratimmukherjee

This comment was marked as resolved.

Copy link
Contributor

@rudranil-das rudranil-das left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review comments closed.

Copy link
Contributor

@apratimmukherjee apratimmukherjee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. One minor comment related to possible easier access of network_lsa neighbor router_ids array by test writer from ospfv2 state information.

result/ospfv2lsa.yaml Outdated Show resolved Hide resolved
@apratimmukherjee apratimmukherjee merged commit 33e7463 into master Oct 22, 2024
@apratimmukherjee apratimmukherjee deleted the ospfv2 branch October 22, 2024 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants