Skip to content

Commit

Permalink
correcting python tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vhowdhur committed Oct 11, 2023
1 parent 2129cf0 commit 98a4809
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
7 changes: 4 additions & 3 deletions tests/test_create_meshed_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def test_create_meshed_flow(api):
"""Demonstrates a fully meshed configuration
"""
config = api.config()

end_points = []
for i in range(1, 33):
config.ports.port(name='Port %s' % i, location='localhost/%s' % i)
device = config.devices.device(name='Device %s' % i)[-1]
Expand All @@ -15,12 +15,13 @@ def test_create_meshed_flow(api):
device.ethernets[-1].mac = '00:00:00:00:00:{:02x}'.format(i)
device.ethernets[-1].ipv4_addresses.ipv4()
device.ethernets[-1].ipv4_addresses[-1].name = 'Ipv4 %s' % i
end_points.append('Ipv4 %s' % i)
device.ethernets[-1].ipv4_addresses[-1].gateway = '10.1.1.%s' % i
device.ethernets[-1].ipv4_addresses[-1].address = '10.1.2.%s' % i

flow = config.flows.flow(name='Fully Meshed Flow')[0]
flow.tx_rx.device.tx_names = [tx.name for tx in config.devices]
flow.tx_rx.device.rx_names = [rx.name for rx in config.devices]
flow.tx_rx.device.tx_names = [tx for tx in end_points]
flow.tx_rx.device.rx_names = [rx for rx in end_points]
flow.tx_rx.device.mode = flow.tx_rx.device.MESH

flow.size.fixed = 128
Expand Down
36 changes: 29 additions & 7 deletions tests/test_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_defaults(api):
'fixed': 64
},
'rate': {
'choice': 'pps', # default choice is pps
'choice': 'pps', # default choice is pps
'pps': "1000"
},
'packet': [
Expand Down Expand Up @@ -56,7 +56,7 @@ def test_defaults(api):
{
'name': "abc",
'protocol': {
'choice': 'lacp', # default choice is lacp
'choice': 'lacp', # default choice is lacp
'lacp': {
'actor_key': 0,
'actor_system_id': '00:00:00:00:00:00',
Expand All @@ -70,7 +70,7 @@ def test_defaults(api):
'actor_activity': 'active',
'actor_port_number': 0,
'actor_port_priority': 1,
'lacpdu_periodic_time_interval': 0,
'lacpdu_periodic_time_interval': 0,
'lacpdu_timeout': 0
},
'ethernet': {
Expand All @@ -86,8 +86,8 @@ def test_defaults(api):
'auto_negotiate': True,
'ieee_media_defaults': True,
'mtu': 1500,
'name': "abc",
'port_names': ["test"],
'name': "def",
'port_names': ["testport"],
'promiscuous': True,
'speed': 'speed_10_gbps',
'flow_control': {
Expand All @@ -106,6 +106,17 @@ def test_defaults(api):
}
}
}
],
'ports': [
{
'name': 'ptest'
},
{
'name': 'lagport'
},
{
'name': 'testport'
}
]
}
config = api.config()
Expand Down Expand Up @@ -192,14 +203,25 @@ def test_defaults_by_deserialize(api):
'auto_negotiate': True,
'ieee_media_defaults': True,
'mtu': 1500,
'name': "abc",
'port_names': ["test"],
'name': "def",
'port_names': ["testport"],
'promiscuous': True,
'speed': 'speed_10_gbps',
'flow_control': {
'directed_address': '01:80:C2:00:00:01'
}
}
],
'ports': [
{
'name': 'ptest'
},
{
'name': 'lagport'
},
{
'name': 'testport'
}
]
}
config = api.config()
Expand Down

0 comments on commit 98a4809

Please sign in to comment.