Skip to content

Commit

Permalink
"version 1.1.9"
Browse files Browse the repository at this point in the history
  • Loading branch information
vhowdhur committed Apr 14, 2023
1 parent 82e8a7b commit a191299
Show file tree
Hide file tree
Showing 84 changed files with 7,869 additions and 177 deletions.
8 changes: 8 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# Release Notes
### April 2023
* 1.1.9
* support ixnetwork version 9.30.2304.57 (9.30 Update-1)
* bug fixes in batch update for traffic configuration
* Addition of new samples
* two samples related to l1 config - l1_config_pcs_error_generation.py, l1_config_tx_lane_and_skew.py
* two samples related to custom views - port_cust_view.py, traffic_flow_custom_view.py
* one sample related to learned info - bgp_learned_info.py
### January 2023
* 1.1.8
* support ixnetwork version 9.30.2212.7 (9.30 EA)
Expand Down
2 changes: 1 addition & 1 deletion ixnetwork_restpy/assistants/batch/batchupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def _batch_update(self, url, payload):
update.id = id
update.base = base
update.payload = payload
update.is_list = "find" in dir(base)
update.is_list = "find" in dir(base) and id is not None
self._updates[url][id] = update
else:
self._updates[url][id].payload.update(payload)
Expand Down
3 changes: 2 additions & 1 deletion ixnetwork_restpy/multivalue.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ def Values(self):
"""
Returns
-------
- list(str): a list of the str values which is dictated by the pattern, format and count properties"""
- list(str): a list of the str values which is dictated by the pattern, format and count properties
"""
payload = {"arg1": self._href, "arg2": 0, "arg3": self.Count}
return self._execute("getValues", payload=payload)

Expand Down
42 changes: 42 additions & 0 deletions ixnetwork_restpy/pytest_tests/tests/batch/test_batch_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,48 @@ def test_batch_update_mix_of_multivalue_and_primitive_attributes(ixnetwork):
)


def test_batch_update_with_nodes_of_multiplicity_one(ixnetwork):
vport = ixnetwork.Vport.add().add()
traffic = ixnetwork.Traffic.TrafficItem
for i in range(10):
tr1 = traffic.add(
Name="RAW TCP " + str(i),
BiDirectional=False,
TrafficType="raw",
TrafficItemType="l2L3",
)
tr1.EndpointSet.add(
Sources=vport[0].Protocols.find(), Destinations=vport[1].Protocols.find()
)
ixia_mac_space = "11 22 33 44 55 66"
with BatchUpdate(ixnetwork):
for item in ixnetwork.Traffic.TrafficItem.find():
config_element = item.ConfigElement.find()
config_element.FramePayload.update(
Type="custom",
CustomRepeat=False,
CustomPattern=f'{"11 " * 40}ff ee 22 11 {ixia_mac_space}',
)
config_element.FrameRate.update(Type="framesPerSecond", Rate=99)
config_element.FrameRateDistribution.update(
StreamDistribution="applyRateToAll"
)
config_element.FrameSize.update(Type="fixed", FixedSize="900")
config_element.TransmissionControl.update(
Type="fixedFrameCount", FrameCount=99
) # was 2
config_element.TransmissionDistribution.find().update(
Distributions=["ipv4SourceIp0", "ipv4DestIp0", "vlanVlanId0"]
)

for item in ixnetwork.Traffic.TrafficItem.find():
ce = item.ConfigElement.find()
assert ce.FramePayload.Type == "custom"
assert (
config_element.FrameRateDistribution.StreamDistribution == "applyRateToAll"
)


if __name__ == "__main__":
import pytest

Expand Down
1 change: 0 additions & 1 deletion ixnetwork_restpy/pytest_tests/tests/test_ngpf_ipv4.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
def test_can_configure_ngpf_ipv4(ixnetwork):

vports = ixnetwork.Vport.add().add()

topology = ixnetwork.Topology.add(Name="Topology 1", Ports=vports)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def test_can_import_export_json_as_string(ixnetwork):


def test_can_import_export_json_as_file(ixnetwork):

ixnetwork.Vport.add().add()

ixnetwork.ResourceManager.ExportConfigFile(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
"""
l1_config_pcs_error_generation.py:
- Connect to the API server
- In this test, do the following:
- Add two real ports
- Add two vports
- Assign two real ports in to vports
- Find the pcsErrorGeneration from the l1Config
- Update some attributes of pcsErrorGeneration
- Verify the value of the attributes
Supports IxNetwork API servers:
- Windows, Windows Connection Mgr and Linux
Requirements:
- Minimum IxNetwork 9.30 Update 1
- Python 2.7 and 3+
- pip install requests
- pip install ixnetwork_restpy (minimum version 1.1.9)
RestPy Doc:
https://openixia.github.io/ixnetwork_restpy/#/overview
Usage:
- Enter: python <script>
"""

from ixnetwork_restpy import SessionAssistant

session_assistant = SessionAssistant(
IpAddress="<chassis-ip>",
RestPort="<rest-port>",
UserName="admin",
Password="admin",
LogLevel=SessionAssistant.LOGLEVEL_INFO,
ClearConfig=True,
)

ixnetwork = session_assistant.Ixnetwork

# mapping the ports
port_map = session_assistant.PortMapAssistant()
port_map.Map(Location="<chassis-ip>;<card>;<port>", Name="Port 1")
port_map.Map(Location="<chassis-ip>;<card>;<port>", Name="Port 2")

# using the map connect test port locations and vports
port_map.Connect(ForceOwnership=True, HostReadyTimeout=20, LinkUpTimeout=60)
vport1 = ixnetwork.Vport.find(Name="Port 1")
vport2 = ixnetwork.Vport.find(Name="Port 2")

# PCS Error Generation configuration
v1_pcsErrorGeneration = vport1.L1Config.PcsErrorGeneration
v1_pcsErrorGeneration.update(PeriodType="laneMarkersAndPayload")
v1_pcsErrorGeneration.update(ErrorBitsHexLaneMarkers="1122334455DDEEFF")
vport1.StartPcsErrorGeneration()
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
"""
l1_config_aresone_800g_tx_lane_and_skew_checking.py:
- Connect to the API server
- In this test, do the following:
- Add two real ports of AresOne 800G
- Add two vports
- Assign two the ports in to vports
- Find the AresOneEightHundredGigLanQddC from the l1Config
- Update TxLane and Skew attributes of AresOneEightHundredGigLanQddC
- Verify the value of the attributes
Supports IxNetwork API servers:
- Windows, Windows Connection Mgr and Linux
Requirements:
- Minimum IxNetwork 9.30 Update 1
- Python 2.7 and 3+
- pip install requests
- pip install ixnetwork_restpy (minimum version 1.1.9)
RestPy Doc:
https://openixia.github.io/ixnetwork_restpy/#/overview
Usage:
- Enter: python <script>
"""

from ixnetwork_restpy import SessionAssistant

session_assistant = SessionAssistant(
IpAddress="<chassis-ip>",
RestPort="<rest-port>",
UserName="admin",
Password="admin",
LogLevel=SessionAssistant.LOGLEVEL_INFO,
ClearConfig=True,
)

ixnetwork = session_assistant.Ixnetwork

# mapping the ports. Here we have used AresOne-800G for reference
port_map = session_assistant.PortMapAssistant()
port_map.Map(Location="<chassis-ip>;<card>;<port>", Name="Port 1")
port_map.Map(Location="<chassis-ip>;<card>;<port>", Name="Port 2")

# using the map connect test port locations and vports
port_map.Connect(ForceOwnership=True, HostReadyTimeout=20, LinkUpTimeout=60)
vport1 = ixnetwork.Vport.find(Name="Port 1")
vport2 = ixnetwork.Vport.find(Name="Port 2")

# Tx Lane and skew
v1_txLane = vport1.L1Config.AresOneEightHundredGigLanQddC.TxLane
print(v1_txLane)
v1_txLane.update(IsSkewSynchronized="true")
51 changes: 51 additions & 0 deletions ixnetwork_restpy/samples/protocols/bgp_learned_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
"""
This sample actually demonstrates how call and see the learned information of a protocol.
The sample will be almost identical for rest of the protocols as well
In this test its assumed that bgp session is configured properly and is up and running
This test fetches the bgpv4 peer interface and calls the operation to get all learned info
After that it showcases from where we can get the learned info information for bgp.
Supports IxNetwork API servers:
- Windows, Windows Connection Mgr and Linux
Requirements:
- Minimum IxNetwork 8.50
- Python 2.7 and 3+
RestPy Doc:
https://openixia.github.io/ixnetwork_restpy/#/overview
"""

from ixnetwork_restpy import SessionAssistant

# connecting to an existing ixn session , note the clear config is false.
session_assistant = SessionAssistant(
IpAddress="localhost",
RestPort=11009,
UserName="admin",
Password="admin",
LogLevel=SessionAssistant.LOGLEVEL_ALL,
ClearConfig=False,
)

ixn = session_assistant.Ixnetwork

# finding the bgpv4 peer according to our need
bgp = (
ixn.Topology.find()
.DeviceGroup.find()
.Ethernet.find()
.Ipv4.find()
.BgpIpv4Peer.find()
)

# calling the get all learned info operation
# note here we have showcased a simple call that fetches learned info of all bgp sessions
# if a particular session is required we can pass a list of session indices
# eg: bgp.GetAllLearnedInfo([1,5,9])
bgp.GetAllLearnedInfo()

# showcases from where we can retrieve the fetched learned info
learned_info_table = bgp.LearnedInfo.find().Table.find()
print(learned_info_table)
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
"""
Creates a port custom view
This sample requires a running ixnetwork instance that has ports in up state.
It uses all possible port filters and statistics when creating the view.
The last step prior to getting data should be to enable the view.
Supports IxNetwork API servers:
- Windows, Windows Connection Mgr and Linux
Requirements:
- Minimum IxNetwork 9.30
- Python 2.7 and 3+
- pip install requests
- pip install ixnetwork_restpy (minimum version 1.1.8)
"""

from time import sleep
from ixnetwork_restpy import SessionAssistant


session_assistant = SessionAssistant(
IpAddress="127.0.0.1",
UserName="admin",
Password="admin",
LogLevel=SessionAssistant.LOGLEVEL_INFO,
ClearConfig=False,
)
ixnetwork = session_assistant.Ixnetwork


# remove the view if it already exists
caption = "Port Custom View"
view = ixnetwork.Statistics.View.find(Caption=caption)
if len(view) == 1:
view.remove()

# create the view
view = ixnetwork.Statistics.View.add(
Caption=caption, Type="layer23ProtocolPort", Visible=True
)

# set layer 2-3 port filters
l23_port_filter = view.Layer23ProtocolPortFilter.find()

# iterate over the PortFilters and enable them
for port_filter in l23_port_filter.PortFilters.find():
# set the port filter to True to enable it
port_filter.Enabled = True

# enable statistics
for statistic in view.Statistic.find():
statistic.Enabled = True

# enable the view
view.Enabled = True

# wait for data to become available
attempts = 0
while view.Data.IsReady is False and attempts < 10:
sleep(1)
attempts += 1

# print the column headers
print(" ".join(view.Data.ColumnCaptions))

# print the snapshot data
for data in view.Data.PageValues:
for row in data:
print(" ".join(row))
Loading

0 comments on commit a191299

Please sign in to comment.