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

ISIS Tlv Replay #353

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft

ISIS Tlv Replay #353

wants to merge 8 commits into from

Conversation

SuryyaKrJana
Copy link
Contributor

@SuryyaKrJana SuryyaKrJana commented Jan 10, 2024

Redocly View:
ReDoc Interactive Demo (redocly.github.io)
(New optional object at : set_config/devices/isis/replay_tlvs )

Requirement:
While waiting for a proto definition to be available, this PR proposes a potential approach for ISIS Tlv Replay.
A stream of ISIS Tlvs is available to user in a well-known format. When this is fed as input then Open Traffic Generator implementation is expected to play it back over an ISIS session. A user may configure array of Tlv streams to append using function replay_tlvs() or may configure Tlv bytes directly. User can combine both the methods as shown in the code snippet.

Converting exported routes to neutral OTG format:
The proposal is to create a community maintained repository , ( similar to https://github.com/open-traffic-generator/routeimporter ) which would host the source code for converting an input set of ISIS Tlvs
to OTG specific format. This will allow conversion logic to be maintained in a public repo. A public repo will allow users to debug and fix issues that may arise while converting to OTG format.

When to perform conversion?
In initial delivery, we plan to target the initial use-case for this when used from a test program written in go.
a) Create a OTG config with ISIS Router configured.

b) In the test program, import the public conversion go library.

c) Use API provided by the conversion library to convert the input byte stream read from a file to neutral ISIS Tlvs and append it to a specified peer in the OTG config. This API is described below in little more detail in the example. Separate PR will address addition of this library as output of a conversion repository in Open Traffic Generator.

d) Next, the usual workflow will be followed i.e. SetConfig and StartProtocols to advertise the imported Tlvs to the Device Under Test.

Example Code
ISIS Router A (1.1.1.2) <------------------>(1.1.1.1) DUT (2.2.2.1)<---------------------> ISIS Router B(2.2.2.2)

       config := gosnappi.NewConfig()
	port1 := config.Ports().Add().SetName("port1").SetLocation(opts.IxiaCPorts()[1])
	port2 := config.Ports().Add().SetName("port2").SetLocation(opts.IxiaCPorts()[2])

	// port 1 device 1
	devA := config.Devices().Add().SetName("devA")
	// port 1 device 1 ethernet
	devAEth := devA.Ethernets().Add().
		SetName("devAEth").
		SetMac("00:00:01:01:01:01").
		SetMtu(1500)
	devAEth.Connection().SetPortName(port1.Name())

	// port 1 device 1 ipv4
	devAIpv4 := devAEth.Ipv4Addresses().
		Add().
		SetAddress("1.1.1.2").
		SetGateway("1.1.1.1").
		SetName("p1d1Ipv4").
		SetPrefix(24)

	// port 1 device 1 isis
	IsisRouterA := p1d1.Isis().SetName("IsisRouterA")

	// port 1 device 1 isis basic
	IsisRouterA.Basic().SetIpv4TeRouterId(p1d1Ipv4.Address())
	IsisRouterA.Basic().SetHostname("ixia-c-port2")
	IsisRouterA.Basic().SetEnableWideMetric(true)
	IsisRouterA.Basic().SetLearnedLspFilter(true)

	.................................................................................................
        .................................................................................................

      filename := "./input_isis_tlvs.bin"
      fb, err := os.ReadFile(filename)
      if err != nil {
	 // Error
        }
      // ImportConfig defines various import parameters that dictates the import processing.
       importConfig := ImportISISTlv.ImportConfig{		 
		 TlvReplayType: tlvReplay.ProtoFile,  //Later could add .WiresharkPcap for example. Similar to BGP importing update. 
		 TargetIsisRouter: gosnappi.Isis{IsisRouterA}, // Normally one ISIS Router which will advertise these Tlvs to peer.
	       }
      // Get route importer service specific to the import file format
      tlvReplayProtoService, err := routeimporter.GetTlvReplayService(tlvReplay.ProtoFile)
      if err != nil {
	 // Error
      }
      // Import Tlvs based on the config. On success TargetIsisRouter gets updated with replay_tlvs.
      _, err := tlvReplayProtoService.ImportTlvReplay(importConfig, &fb)
      if err != nil {
	 // Error
      }

      replayTlvs := IsisRouterA.ReplayTlvs().Items()
      fmt.Printf("Number of Tlvs imported = %v\n", len(replayTlvs()))

     _//Example appending an area Tlv: Type:1, Length 8_
     IsisRouterA.ReplayTlvs().append("01080349494903494948")

     _//Example appending an extended IP Reachability Tlv of Type: 135 and Length 9_
     IsisRouterA.ReplayTlvs().append("870900000000200c000001")

device/isis/isis.yaml Outdated Show resolved Hide resolved
@SuryyaKrJana SuryyaKrJana changed the title Isis tlv replay ISIS Tlv Replay Jan 11, 2024
@SuryyaKrJana SuryyaKrJana linked an issue Jan 11, 2024 that may be closed by this pull request
@SuryyaKrJana SuryyaKrJana added the enhancement New feature or request label Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ISIS Replay for Tlvs using OTG APIs
3 participants