Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

TunnelHealth #31

Closed
wants to merge 10 commits into from
Closed

TunnelHealth #31

wants to merge 10 commits into from

Conversation

JimOverholt
Copy link
Contributor

@JimOverholt JimOverholt commented Apr 21, 2024

Pull Request summary:

Add layer 2 support for:

  • /dataservice/statistics/tunnelhealth/history
  • /dataservice/statistics/tunnelhealth/overview/{type}

Description of changes:

  • Create models and sub models for TunnelHealth Responses using the Schema from apidocs
  • Create endpoint placeholder and add to endpoint container
  • These endpoints have optional inputs
  • Create pytest unit tests

Checklist:

  • Make sure to run pre-commit before committing changes
  • Make sure all checks have passed
  • PR description is clear and comprehensive
  • Mentioned the issue that this PR solves (if applicable)
  • Make sure you test the changes

Unit Test

from catalystwan.session import create_manager_session

st_url = "https://172.25.135.17"
st_port = 9912
username = "admin"
password = "Cisco#123@Viptela"
session = create_manager_session(url=st_url, username=username, password=password, port=st_port)

hist = session.endpoints.monitoring_tunnelhealth.get_tunnelhealth_history()
oview = session.endpoints.monitoring_tunnelhealth.get_tunnelhealth_overview("lte")
>>> type(hist)
<class 'catalystwan.typed_list.DataSequence'>

>>> type(hist[0])
<class 'catalystwan.models.monitoring.tunnelhealth.TunnelHealthHistoryItem'>

>>> hist[0].name
'vm4:lte-vm1:lte'

>>> hist[0].summary
TunnelHealthData(jitter=0.0, latency=0.0, loss_percentage=0.0, rx_octets=0, state=<StateEnum.up: 'Up'>, tx_octets=0, vqoe_score=10.0)

>>> hist[0].summary.state
<StateEnum.up: 'Up'>
>>> type(oview)
<class 'catalystwan.models.monitoring.tunnelhealth.TunnelHealthOverview'>

>>> oview.detail.good[0].name
'vm5:lte-vm4:lte'

>>> oview.detail.good[0].local_system_ip
'172.16.255.15'
>>> hist = session.endpoints.monitoring_tunnelhealth.get_tunnelhealth_history()
>>> len(hist)
26

>>> params = TunnelHealthRequest()
>>> hist = session.endpoints.monitoring_tunnelhealth.get_tunnelhealth_history(params)
>>> len(hist)
26

>>> params.limit = 10
>>> hist = session.endpoints.monitoring_tunnelhealth.get_tunnelhealth_history(params)
>>> len(hist)
10

>>> params.site='500'
>>> hist = session.endpoints.monitoring_tunnelhealth.get_tunnelhealth_history(params)
>>> len(hist)
8
>>> params = TunnelHealthRequest()
>>> oview = session.endpoints.monitoring_tunnelhealth.get_tunnelhealth_overview("lte", params)
>>> len(oview.detail.good)
26

>>> params = TunnelHealthRequest()
>>> params.limit = 10
>>> params.last_n_hours = 1
>>> params.site = "500"
>>> oview = session.endpoints.monitoring_tunnelhealth.get_tunnelhealth_overview("lte", params)
>>> len(oview.detail.good)
8

@JimOverholt JimOverholt marked this pull request as draft April 21, 2024 16:35
Copy link
Contributor

@sbasan sbasan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Literal > Enum

catalystwan/models/monitoring/tunnelhealth.py Outdated Show resolved Hide resolved
@JimOverholt JimOverholt mentioned this pull request Apr 25, 2024
@sbasan
Copy link
Contributor

sbasan commented Nov 21, 2024

closing as it is stalled and development moved to https://github.com/cisco-en-programmability/catalystwan-sdk

@sbasan sbasan closed this Nov 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants