cisco-open / cisco-catalyst-wan-sdk

Cisco Catalyst WAN SDK
Apache License 2.0
18 stars 3 forks source link

dev: support device config items for 20.13 #841

Closed sbasan closed 3 weeks ago

sbasan commented 1 month ago

Pull Request summary:

Support device config items for 20.13

Description of changes:

  1. CLI Config Group
    • [x] /v1/feature-profile/sdwan/cli/full-config
  2. Unified Communications
    • [x] /v1/feature-profile/sdwan/uc-voice/dsp-farm
    • [x] /v1/feature-profile/sdwan/uc-voice/media-profile
    • [x] /v1/feature-profile/sdwan/uc-voice/trunk-group
    • [x] /template/policy/list/faxprotocol
    • [x] /template/policy/list/mediaprofile
    • [x] /template/policy/list/modempassthrough
    • [x] /template/policy/list/supervisorydisc
    • [x] /template/policy/list/translationprofile
    • [x] /template/policy/list/translationrules
    • [x] /template/policy/list/trunkgroup
    • [x] /template/policy/definition/dialpeer
    • [x] /template/policy/definition/fxsport
    • [x] /template/policy/definition/fxoport
    • [x] /template/policy/definition/fxsdidport
    • [x] /template/policy/definition/priisdnport
    • [x] /template/policy/definition/srstphoneprofile
    • [x] /template/policy/voice

Usage example:

from catalystwan.models.policy.definition.dial_peer import DialPeerPolicy
from catalystwan.models.policy.definition.fxo_port import FxoPortPolicy
from catalystwan.models.policy.definition.fxs_port import FxsPortPolicy
from catalystwan.models.policy.definition.fxs_did_port import FxsDidPortPolicy
from catalystwan.models.policy.definition.pri_isdn_port import PriIsdnPortPolicy
from catalystwan.models.policy.definition.srst_phone_profile import SrstPhoneProfilePolicy
from catalystwan.models.policy.list.fax_protocol import FaxProtocolList
from catalystwan.models.policy.list.media_profile import MediaProfileList
from catalystwan.models.policy.list.modem_pass_through import ModemPassThroughList
from catalystwan.models.policy.list.supervisory_disconnect import SupervisoryDisconnectList
from catalystwan.models.policy.list.translation_profile import TranslationProfileList
from catalystwan.models.policy.list.translation_rules import TranslationRulesList
from catalystwan.models.policy.list.trunkgroup import TrunkGroupList
from catalystwan.session import create_manager_session

with create_manager_session(**login) as session:
    lapi = session.api.policy.lists
    dapi = session.api.policy.definitions
    vapi = session.api.policy.voice
    # get lists
    la = lapi.get_all()
    fp = lapi.get(FaxProtocolList)
    mp = lapi.get(MediaProfileList)
    mpt = lapi.get(ModemPassThroughList)
    sd = lapi.get(SupervisoryDisconnectList)
    tg = lapi.get(TrunkGroupList)
    tp = lapi.get(TranslationProfileList)
    tr = lapi.get(TranslationRulesList)
    # get definitions
    da = dapi.get_all()
    fxo = [dapi.get(FxoPortPolicy, i.definition_id) for i in dapi.get(FxoPortPolicy)]
    fxs = [dapi.get(FxsPortPolicy, i.definition_id) for i in dapi.get(FxsPortPolicy)]
    fxsd = [dapi.get(FxsDidPortPolicy, i.definition_id) for i in dapi.get(FxsDidPortPolicy)]
    dp = [dapi.get(DialPeerPolicy, i.definition_id) for i in dapi.get(DialPeerPolicy)]
    pi = [dapi.get(PriIsdnPortPolicy, i.definition_id) for i in dapi.get(PriIsdnPortPolicy)]
    sp = [dapi.get(SrstPhoneProfilePolicy, i.definition_id) for i in dapi.get(SrstPhoneProfilePolicy)]
    # voice api
    va = vapi.get()
    vp = [vapi.get(i.policy_id) for i in va]

Checklist: