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

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
radkrawczyk committed Jul 2, 2024
1 parent 47e1b95 commit 600e57e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,6 @@ def add_scheduler(
scheduling=scheduling,
)
)

def set_variable_target(self, variable: str) -> None:
self.target = QosPolicyTarget(interfaces=Variable(value=variable))
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def as_num_list(ports_list: List[Union[int, Tuple[int, int]]]) -> List[int]:

def conditional_split(s: str, seps: List[str]) -> List[str]:
"""
split s by first sep in sepsrun
split s by first sep in seps
"""
for sep in seps:
if sep in s:
Expand Down Expand Up @@ -493,6 +493,9 @@ def qos_map(in_: QoSMapPolicy, uuid: UUID, context: PolicyConvertContext) -> Con
out = QosPolicyParcel.create(**_get_parcel_name_desc(in_))
result.output = out

# add target
out.set_variable_target("{{Interface_1}}") # for tests

for scheduler in in_.definition.qos_schedulers:
out.add_scheduler(
queue=str(scheduler.queue),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from uuid import UUID

from catalystwan.api.builders.feature_profiles.report import FeatureProfileBuildReport
from catalystwan.api.configuration_groups.parcel import Global
from catalystwan.exceptions import ManagerHTTPError
from catalystwan.models.configuration.config_migration import (
PushContext,
Expand All @@ -11,7 +12,11 @@
UX2ConfigPushResult,
)
from catalystwan.models.configuration.feature_profile.parcel import AnyDnsSecurityParcel, list_types
from catalystwan.models.configuration.feature_profile.sdwan.application_priority.qos_policy import QosPolicyParcel
from catalystwan.models.configuration.feature_profile.sdwan.application_priority import (
Cflowd,
PolicySettingsParcel,
QosPolicyParcel,
)
from catalystwan.models.configuration.feature_profile.sdwan.embedded_security import NgfirewallParcel, PolicyParcel
from catalystwan.models.configuration.feature_profile.sdwan.embedded_security.policy import NgFirewallContainer
from catalystwan.session import ManagerSession
Expand Down Expand Up @@ -123,6 +128,32 @@ def push_app_priority_and_sla_policies(self) -> None:
profile_report.add_failed_parcel(
parcel_name=parcel.parcel_name, parcel_type=parcel.type_, error_info=e.info
)
continue

# ------- temporary - need to find source of that settings -------
policy_settings_parcel = PolicySettingsParcel(
parcel_description="desc",
parcel_name=parcel.parcel_name + "set",
app_visibility=Global[bool](value=False),
flow_visibility=Global[bool](value=False),
app_visibility_ipv6=Global[bool](value=False),
flow_visibility_ipv6=Global[bool](value=False),
cflowd=Cflowd(value=True),
)

try:
qos_id = self._app_profile_api.create_parcel(profile_id, policy_settings_parcel).id
profile_report.add_created_parcel(policy_settings_parcel.parcel_name, qos_id)
# self.push_context.id_lookup[qos_policy.header.origin] = qos_id # update when source is found
except ManagerHTTPError as e:
logger.error(f"Error occured during creating QoSParcel in app priority and sla profile: {e.info}")
profile_report.add_failed_parcel(
parcel_name=policy_settings_parcel.parcel_name,
parcel_type=policy_settings_parcel.type_,
error_info=e.info,
)
continue
# ------- temporary -------

def push_embedded_security_policies(self) -> None:
security_policies = [
Expand Down

0 comments on commit 600e57e

Please sign in to comment.