Skip to content

Conversation

@waseembaig
Copy link

@waseembaig waseembaig commented Mar 1, 2024

Following are the proposed models for L47.

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

Sample script

import snappi
api = snappi.api(location="10.10.10.10",ext='ixload')
config = api.config()
tx = config.ports.port("10.36.79.165;11;1")
rx = config.ports.port("10.36.79.165;11:2")
#creating device with Ethernet and IP
#device 1 configs
dev_1 = config.devices.device(name='CLIENT')
d1_eth = config.ethernet(name="Ethernet1", mac="00:1A:6E:18:00:01")  # ethernet properties
d1_eth.vlans.add(name="vlan1", id=1002)
dev_1.ethernets = [d1_eth]
d1_ipv1 = config.ip(name="IPv4_1",address="2.2.2.2", gateway='1.1.1.1', prefix="16") #ipv4/6 properties
d1_eth.ips = [d1_ipv1]

dev_2 = config.devices.device(name='SERVER')
d2_eth = dev_2.ethernets.add(name="Ethernet1", mac="00:1A:6E:18:00:01") # ethernet properties
d2_eth.vlans.add(name="vlan1", id=1002)
d2_ipv1 = d2_eth.ipv4_addresses.add(name="IPv4_1",address="2.2.2.2", gateway='1.1.1.1', prefix="16") #ipv4/6 properties 

#TCP/UDP configs
tcp_1 = config.devices.tcp(name="Tcp1")
tcp_1.ip_address = d1_ipv1.name
tcp_1.REUSE_TIME_SOCKET = True
tcp_1.RFC1897_TIMESTAMP = True
tcp_1.close_type = tcp_1.types[].3_WAY_CLOSE

tcp_2 = config.devices.tcp(name="Tcp2")
tcp_2.ip_address = d2_ipv1.name
tcp_2.REUSE_TIME_SOCKET = True
tcp_2.RFC1897_TIMESTAMP = True
tcp_2.close_type = tcp_2.types.3_WAY_CLOSE


http_1 = config.device.Http(name="HTTP1")
http_1.transport = tcp_1.name   #UDP configs can be mapped http.transport = udp_1.name
http_1.client.version = '1.1'
http_1.client(endpoints_allow_inbound)

get1 = http1.client.method.add("get")
get1.page = "./1b.html"
get1.destination = "10.10.10.1" #real http server ip or emulated http object  get1.destination = "http2:80"
#for http server emulation
#get1.destination = http_2.name 

http_2 = config.device.Http(name="HTTP2")
http_1.transport = tcp_2.name		#UDP configs can be mapped http.transport = udp_2.name
http_2.server(endpoints_allow_outbound)
http_2.server.port = "80"




# create cps traffic
traffic_profile = config.TrafficProfiles.TrafficProfile(name = "traffic_profile_1")
traffic_profile.apps = [http_1, http_2] # traffic_profile_cps.app - "app" using it for reference can be some generic name for traffic profile on which traffic has to flow
cps_objective = traffic_profile.objective.connection_per_sec()
cps_objective.sustain_time = 100
cps_objective.ramp_down_time = 10
SU_objective = traffic_profile.objective.simulation_user()
SU_objective.sustain_time = 100
SU_objective.ramp_down_time = 10
traffic_profile.objectiveType = [cps_objective, SU_objective]
traffic_profile.objectiveValue =["100", "100]"
segment1 = traffic_profile.segment()
segment1.name = "Linear segment1"
segment1.start = 0
segment1.duration = 10
segment1.rate = 10
segment1.target = 100
segment2 = traffic_profile.segment()
segment2.name = "Linear segment2"
segment2.start = 0
segment2.duration = 10
segment2.rate = 10
segment2.target = 100
traffic_profile.timeline = [segment1.name, segment2.name]

@waseembaig waseembaig requested a review from ByReaL March 1, 2024 11:14
@waseembaig waseembaig marked this pull request as ready for review March 1, 2024 11:14
@waseembaig waseembaig marked this pull request as draft March 1, 2024 11:15
@waseembaig waseembaig requested review from bortok and pmajumdarKS March 1, 2024 17:28
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.

3 participants