Skip to content

Dhcpv4 support review - #371

Merged
apratimmukherjee merged 106 commits into
masterfrom
dhcpv4_support_review
May 17, 2024
Merged

apratimmukherjee merged 106 commits into
masterfrom
dhcpv4_support_review

Conversation

@SuryyaKrJana

@SuryyaKrJana SuryyaKrJana commented Mar 29, 2024 •

Copy link
Copy Markdown
Contributor

https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/open-traffic-generator/models/dhcpv4_support_review/artifacts/openapi.yaml&nocors.

This model is designed to take care of following implementation:
1. DHCP Client & Server are Keysight and Relay Agent as DUT:
In this the construct dhcp_v4interfaces and dhcp_v4interfaces are exposed under an Ethernet Interface to configure DHCP Client parameters. The configuration of a DHCP client is placed under Ethernet Interface as parallel to IP configuration as protocol like BGP can be configured referring an IP interface or a DHCP interface.
2. BGP peer can be configured on top of DHCP interface:
BGP peer is to refer ipv4_name or ipv6_name for IPv4/IPv6 connected or loopback interfaces. Now BGP peer can also refer to dhcp_v4interface or dhcp_v6interface interfaces.

gNMI Model:
open-traffic-generator/models-yang#29
https://github.com/open-traffic-generator/models-yang/blob/dhcpv4-yang/artifacts/open-traffic-generator-dhcpv4client.txt
https://github.com/open-traffic-generator/models-yang/blob/dhcpv4-yang/artifacts/open-traffic-generator-dhcpv4server.txt

Path for fetching Client Interface information:
// Path from root: "/dhcpv4-clients/dhcpv4-client[name=dhpc4-client1]/state/
// Path from root: "/dhcpv4-clients/dhcpv4-client[name=dhpc4-client1]/state/interface/address"
// Path from root: "/dhcpv4-clients/dhcpv4-client[name=dhpc4-client1]/state/interface/prefix-length"
// Path from root: "/dhcpv4-clients/dhcpv4-client[name=dhpc4-client1]/state/interface/gateway_address"
// Path from root: "/dhcpv4-clients/dhcpv4-client[name=dhpc4-client1]/state/interface/lease_time"
// Path from root: "/dhcpv4-clients/dhcpv4-client[name=dhpc4-client1]/state/interface/renew_time"

A code snippet for BGP over DHCP

// OTG (BGP over DHCPv4-Client)
// ^
// |
// |
// v
// DUT(Relay Agent/Router with BGP)
// ^
// |
// |
// v
// OTG (DHCPv4Server, BGP)

  ```
   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 flows and common properties
for i := 1; i <= 2; i++ {
	flow := config.Flows().Add()
	flow.Metrics().SetEnable(true)
	flow.Duration().FixedPackets().SetPackets(1000)
	flow.Rate().SetPps(500)
}

// add protocol stacks for device d1
d1Eth1 := d1.Ethernets().
	Add().
	SetName("p1d1eth").
	SetMac("00:00:01:01:01:01").
	SetMtu(1500)

d1Eth1.Connection().SetPortName(p1.Name())

// Configure a DHCP Client
d1Eth1.Dhcpv4Interfaces().Add().
	SetName("p1d1dchpv4client").
	ParametersRequestList().
	SetRebindingTimer(true).
	SetRenewalTimer(true).
	SetRouter(true)

// Configure BGP over a DCHP Interface
d1Bgp := d1.Bgp().
	SetRouterId("1.1.1.2")

d1BgpIpv4Interface1 := d1Bgp.
	Ipv4Interfaces().Add().
	SetIpv4Name("p1d1dchpv4client")

d1BgpIpv4Interface1Peer1 := d1BgpIpv4Interface1.
	Peers().
	Add().
	SetAsNumber(2222).
	SetAsType(gosnappi.BgpV4PeerAsType.EBGP).
	SetPeerAddress("1.1.1.1").
	SetName("p1d1bgpv4")

d1BgpIpv4Interface1Peer1V4Route1 := d1BgpIpv4Interface1Peer1.
	V4Routes().
	Add().
	SetNextHopIpv4Address("1.1.1.2").
	SetName("p1d1peer1rrv4").
	SetNextHopAddressType(gosnappi.BgpV4RouteRangeNextHopAddressType.IPV4).
	SetNextHopMode(gosnappi.BgpV4RouteRangeNextHopMode.MANUAL)

d1BgpIpv4Interface1Peer1V4Route1.Addresses().Add().
	SetAddress("10.10.10.1").
	SetPrefix(32).
	SetCount(4).
	SetStep(1)

d1BgpIpv4Interface1Peer1V4Route1.Advanced().
	SetMultiExitDiscriminator(50).
	SetOrigin(gosnappi.BgpRouteAdvancedOrigin.EGP)

// Add protocol stacks for device d2
d2Eth1 := d2.Ethernets().
	Add().
	SetName("p2d1eth").
	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(32)
// Configure a DHCP Server
d2Dhcpv4Server := d2.DhcpServer().Ipv4Interfaces().Add().
	SetName("p2d2dhcpv4server")

d2Dhcpv4Server.SetIpv4Name("p2d1ipv4").AddressPools().
	Add().SetName("pool1").
	SetLeaseTime(3600).
	SetStartAddress("1.1.1.2").
	SetStep(1).
	SetCount(5).
	SetPrefixLength(31).
	Options().SetRouterAddress("1.1.1.1")

// Create a loop over Ethernet 2
d2lo1 := d2.Ipv4Loopbacks().
	Add().
	SetName("d2lo1").
	SetAddress("22.22.22.1").
	SetEthName(d2Eth1.Name())

d2Bgp := d2.Bgp().
	SetRouterId("2.2.2.2")

d2BgpIpv4Interface1 := d2Bgp.
	Ipv4Interfaces().Add().
	SetIpv4Name(d2lo1.Name())

d2BgpIpv4Interface1Peer1 := d2BgpIpv4Interface1.
	Peers().
	Add().
	SetAsNumber(3333).
	SetAsType(gosnappi.BgpV4PeerAsType.EBGP).
	SetPeerAddress("2.2.2.1").
	SetName("p2d1bgpv4")

d2BgpIpv4Interface1Peer1V4Route1 := d2BgpIpv4Interface1Peer1.
	V4Routes().
	Add().
	SetNextHopIpv4Address("2.2.2.2").
	SetName("p2d1peer1rrv4").
	SetNextHopAddressType(gosnappi.BgpV4RouteRangeNextHopAddressType.IPV4).
	SetNextHopMode(gosnappi.BgpV4RouteRangeNextHopMode.MANUAL)

d2BgpIpv4Interface1Peer1V4Route1.Addresses().Add().
	SetAddress("20.20.20.1").
	SetPrefix(32).
	SetCount(2).
	SetStep(2)

d2BgpIpv4Interface1Peer1V4Route1.Advanced().
	SetMultiExitDiscriminator(40).
	SetOrigin(gosnappi.BgpRouteAdvancedOrigin.EGP)

// add endpoints and packet description flow 1
f1 := config.Flows().Items()[0]
f1.SetName(p1.Name() + " -> " + p2.Name()).
	TxRx().Device().
	SetTxNames([]string{d1BgpIpv4Interface1Peer1V4Route1.Name()}).
	SetRxNames([]string{d2BgpIpv4Interface1Peer1V4Route1.Name()})

f1Eth := f1.Packet().Add().Ethernet()
f1Eth.Src().SetValue(d1Eth1.Mac())
f1Eth.Dst().Auto()

f1Ip := f1.Packet().Add().Ipv4()
f1Ip.Src().SetValue("10.10.10.1")
f1Ip.Dst().SetValue("20.20.20.1")

// add endpoints and packet description flow 2
f2 := config.Flows().Items()[1]
f2.SetName(p2.Name() + " -> " + p1.Name()).
	TxRx().Device().
	SetTxNames([]string{d2BgpIpv4Interface1Peer1V4Route1.Name()}).
	SetRxNames([]string{d1BgpIpv4Interface1Peer1V4Route1.Name()})

f2Eth := f2.Packet().Add().Ethernet()
f2Eth.Src().SetValue(d2Eth1.Mac())
f2Eth.Dst().Auto()

f2Ip := f2.Packet().Add().Ipv4()
f2Ip.Src().SetValue("20.20.20.1")
f2Ip.Dst().SetValue("10.10.10.1")


Comment thread result/dhcpv4interface.yaml Resolved
Comment thread device/dhcp/servers/dhcpserver.yaml Resolved
Comment thread device/ethernet.yaml Resolved
Comment thread device/ethernet.yaml Resolved
Comment thread result/dhcpv4interface.yaml Resolved
Comment thread result/dhcpv4server.yaml Resolved
Comment thread result/dhcpv4server.yaml Resolved
Comment thread result/dhcpv4server.yaml Resolved
Comment thread result/dhcpv4serverleases.yaml Resolved
@apratimmukherjee
apratimmukherjee merged commit 92190ea into master May 17, 2024
@apratimmukherjee
apratimmukherjee deleted the dhcpv4_support_review branch May 17, 2024 06:16
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.

7 participants