This repository has been archived by the owner on Nov 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add function to transform header. Add network type to feature profile…
…. Add unittest for qos map and settings for app prio. Add converter for settings. Move logic to localized pusher
- Loading branch information
1 parent
5f51956
commit ab1809a
Showing
12 changed files
with
293 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
catalystwan/tests/config_migration/test_data/localized_policies/localized_policy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright 2024 Cisco Systems, Inc. and its affiliates | ||
from datetime import datetime | ||
from uuid import uuid4 | ||
|
||
from catalystwan.models.policy.localized import LocalizedPolicyInfo, LocalizedPolicySettings | ||
|
||
|
||
def create_localized_policy_info(name: str) -> LocalizedPolicyInfo: | ||
policy = LocalizedPolicyInfo( | ||
policy_type="feature", | ||
policy_id=uuid4(), | ||
policy_name=name, | ||
created_by="tester", | ||
created_on=datetime.now(), | ||
last_updated_by="tester", | ||
last_updated_on=datetime.now(), | ||
policy_version=None, | ||
) | ||
settings = LocalizedPolicySettings( | ||
flow_visibility=True, | ||
flow_visibility_ipv6=True, | ||
app_visibility=True, | ||
app_visibility_ipv6=True, | ||
cloud_qos=True, | ||
cloud_qos_service_side=True, | ||
implicit_acl_logging=True, | ||
log_frequency=10, | ||
ip_visibility_cache_entries=100, | ||
ip_v6_visibility_cache_entries=200, | ||
) | ||
policy.set_definition([], settings) | ||
return policy |
Empty file.
23 changes: 23 additions & 0 deletions
23
catalystwan/tests/config_migration/test_data/policy_definitions/qos_map.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2024 Cisco Systems, Inc. and its affiliates | ||
from datetime import datetime | ||
from uuid import uuid4 | ||
|
||
from catalystwan.models.policy.definition.qos_map import QoSMapPolicyGetResponse | ||
|
||
|
||
def create_qos_map_policy(name: str) -> QoSMapPolicyGetResponse: | ||
policy = QoSMapPolicyGetResponse( | ||
definition_id=uuid4(), | ||
name=name, | ||
description=f"{name} description", | ||
last_updated=datetime.now(), | ||
owner="tester", | ||
reference_count=0, | ||
references=[], | ||
is_activated_by_vsmart=False, | ||
) | ||
policy.add_scheduler(queue=1, class_map_ref=uuid4(), scheduling="llq", drops="red-drop", bandwidth=10) | ||
policy.add_scheduler(queue=2, class_map_ref=uuid4(), scheduling="wrr", drops="red-drop", bandwidth=20) | ||
policy.add_scheduler(queue=3, class_map_ref=uuid4(), scheduling="llq", drops="tail-drop", bandwidth=30) | ||
policy.add_scheduler(queue=4, class_map_ref=uuid4(), scheduling="wrr", drops="tail-drop", bandwidth=40) | ||
return policy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
catalystwan/utils/config_migration/converters/policy/policy_settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright 2024 Cisco Systems, Inc. and its affiliates | ||
from uuid import UUID | ||
|
||
from catalystwan.api.configuration_groups.parcel import as_optional_global | ||
from catalystwan.models.configuration.config_migration import ConvertResult, PolicyConvertContext | ||
from catalystwan.models.configuration.feature_profile.sdwan.application_priority.policy_settings import ( | ||
PolicySettingsParcel, | ||
) | ||
from catalystwan.models.policy.localized import LocalizedPolicyInfo | ||
|
||
|
||
def convert_localized_policy_settings( | ||
policy: LocalizedPolicyInfo, uuid: UUID, context: PolicyConvertContext | ||
) -> ConvertResult[PolicySettingsParcel]: | ||
if isinstance(policy.policy_definition, str): | ||
return ConvertResult( | ||
output=None, | ||
status="unsupported", | ||
info=[ | ||
f"Localized policy {policy.policy_name} has a string settings definition. " | ||
"This is not supported by the converter." | ||
], | ||
) | ||
settings = policy.policy_definition.settings | ||
if settings is None: | ||
parcel = PolicySettingsParcel( | ||
parcel_name=f"{policy.policy_name}_Settings", | ||
parcel_description=policy.policy_description, | ||
) | ||
return ConvertResult(output=parcel, status="complete") | ||
parcel = PolicySettingsParcel( | ||
parcel_name=f"{policy.policy_name}_Settings", | ||
parcel_description=policy.policy_description, | ||
app_visibility=as_optional_global(settings.app_visibility), | ||
app_visibility_ipv6=as_optional_global(settings.app_visibility_ipv6), | ||
flow_visibility=as_optional_global(settings.flow_visibility), | ||
flow_visibility_ipv6=as_optional_global(settings.app_visibility_ipv6), | ||
) | ||
return ConvertResult(output=parcel, status="partial", info=["cflowd is not supported yet"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.