Skip to content

Commit

Permalink
dev: fix control policy model (#3)
Browse files Browse the repository at this point in the history
* add missing copyright notices, add pre-commit hook to update copyright automatically

* replace old ewpo url

* bump package version

* remove ospo scorecard workflow (#2)

* remove ospo scorecard workflow

* add Shivram to codeowners

* sync with 0.40.0
  • Loading branch information
sbasan authored Nov 19, 2024
1 parent cce92cf commit 234cd1b
Show file tree
Hide file tree
Showing 64 changed files with 976 additions and 894 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence

@natalisucks @JimOverholt @sbasan
@sashiv20 @JimOverholt @sbasan
29 changes: 0 additions & 29 deletions .github/workflows/scorecard.yml

This file was deleted.

7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ default_stages: [commit]
repos:

# Autoformatting (modifies staged files)
- repo: local
hooks:
- id: copyright
name: copyright
entry: python copyright.py
language: system
types: [python]

- repo: https://github.com/timothycrosley/isort
rev: 5.12.0
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# See https://help.github.com/articles/about-codeowners/
# for more info about CODEOWNERS file

@natalisucks @JimOverholt @sbasan @cicharka @jpkrajewski @smialy
@sashiv20 @JimOverholt @sbasan @cicharka @jpkrajewski @smialy
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
We're really glad you want to help.

## Here are some important resources:
* Want to add something from yourself? [Make a PR](https://github.com/cisco-open/cisco-catalyst-wan-sdk/pulls) - remember to follow [code guidelines](#code-guidelines).
* Want to add something from yourself? [Make a PR](https://github.com/cisco-en-programmability/catalystwan-sdk/pulls) - remember to follow [code guidelines](#code-guidelines).
### Contributors from CiscoDevNet organization:
To make a PR - pull the repository, create branch for your changes, make said changes and make the pull request. Now just wait for the review and feedback from our developers.
### Contributors outside CiscoDevNet organization
To make a PR - fork our repository, make your changes and make the pull request. Now just wait for the review and feedback from our developers.
* Feel free to review existing [PR](https://github.com/cisco-open/cisco-catalyst-wan-sdk/pulls)s, any suggestion is welcome.
* Want to help but you don't have any new ideas for improvement or feature? Take any [issue](https://github.com/cisco-open/cisco-catalyst-wan-sdk/issues) and fix it.
* Bugs? [Report it here](https://github.com/cisco-open/cisco-catalyst-wan-sdk/issues/new?assignees=&labels=needs+review&template=bug_report.yml) - remember to provide as much information as you can.
* Need some additional feature? [Let us know here](https://github.com/cisco-open/cisco-catalyst-wan-sdk/issues/new?assignees=&labels=enhancement&template=feature_request.yml)
* Feel free to review existing [PR](https://github.com/cisco-en-programmability/catalystwan-sdk/pulls)s, any suggestion is welcome.
* Want to help but you don't have any new ideas for improvement or feature? Take any [issue](https://github.com/cisco-en-programmability/catalystwan-sdk/issues) and fix it.
* Bugs? [Report it here](https://github.com/cisco-en-programmability/catalystwan-sdk/issues/new?assignees=&labels=needs+review&template=bug_report.yml) - remember to provide as much information as you can.
* Need some additional feature? [Let us know here](https://github.com/cisco-en-programmability/catalystwan-sdk/issues/new?assignees=&labels=enhancement&template=feature_request.yml)

## Testing

Expand All @@ -37,7 +37,7 @@ Always write a clear log message for your commits.
1. Download Python3.8 or higher.
2. Download repository
```
git clone https://github.com/cisco-open/cisco-catalyst-wan-sdk.git
git clone https://github.com/cisco-en-programmability/catalystwan-sdk.git
```
3. Install and configure poetry (v1.3.1 or higher)
https://python-poetry.org/docs/#installation
Expand Down
1,698 changes: 849 additions & 849 deletions ENDPOINTS.md

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,11 @@ except ManagerHTTPError as error:

```

## [Supported API endpoints](https://github.com/cisco-open/cisco-catalyst-wan-sdk/blob/main/ENDPOINTS.md)
## [Supported API endpoints](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/ENDPOINTS.md)

## [Contributing, bug reporting and feature requests](https://github.com/cisco-open/cisco-catalyst-wan-sdk/blob/main/CONTRIBUTING.md)

## [Contributing, bug reporting and feature requests](https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/CONTRIBUTING.md)

## Seeking support

You can contact us by submitting [issues](https://github.com/cisco-open/cisco-catalyst-wan-sdk/issues), or directly via mail on catalystwan@cisco.com.
You can contact us by submitting [issues](https://github.com/cisco-en-programmability/catalystwan-sdk/issues), or directly via mail on catalystwan@cisco.com.
1 change: 1 addition & 0 deletions catalystwan/api/builders/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions catalystwan/api/builders/feature_profiles/cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from __future__ import annotations

from typing import TYPE_CHECKING, List
Expand Down
1 change: 1 addition & 0 deletions catalystwan/api/builders/feature_profiles/other.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions catalystwan/apigw_auth.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
import logging
from threading import RLock
from typing import Literal, Optional
Expand Down
1 change: 1 addition & 0 deletions catalystwan/endpoints/api_gateway.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from pydantic import BaseModel

from catalystwan.endpoints import APIEndpoints, post
Expand Down
1 change: 1 addition & 0 deletions catalystwan/endpoints/configuration/policy/abstractions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import Protocol
from uuid import UUID

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import Type

from catalystwan.api.feature_profile_api import PolicyObjectFeatureProfileAPI
Expand Down
1 change: 1 addition & 0 deletions catalystwan/integration_tests/test_settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import Optional

from catalystwan.integration_tests.base import TestCaseBase
Expand Down
2 changes: 1 addition & 1 deletion catalystwan/models/configuration/feature_profile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This README document provides guidelines on creating configuration groups within

Cellular controller Parcel will be used for example purposes. Please change the parcel according to which one you are implementing.

1. Add new endpoints following the guide: https://github.com/cisco-open/cisco-catalyst-wan-sdk/blob/main/CONTRIBUTING.md
1. Add new endpoints following the guide: https://github.com/cisco-en-programmability/catalystwan-sdk/blob/main/CONTRIBUTING.md
2. Download a schema with new endpoint:
```python
@versions(supported_versions=(">=20.9"), raises=False)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from ipaddress import IPv6Address, IPv6Interface
from typing import List, Literal, Optional, Tuple, Union
from uuid import UUID
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import List, Union

from pydantic import Field
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from __future__ import annotations

from typing import Literal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from __future__ import annotations

from typing import Any, Literal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import List, Union

from pydantic import Field
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from __future__ import annotations

from ipaddress import IPv4Address
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from __future__ import annotations

from ipaddress import IPv4Address, IPv4Interface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import List, Literal, Optional

from pydantic import AliasPath, Field
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import List, Literal, Optional

from pydantic import AliasPath, Field
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from ipaddress import IPv4Address, IPv6Interface
from typing import List, Literal, Optional, Union

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import List

from pydantic import Field
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from ipaddress import IPv4Address
from typing import List, Literal, Optional, Union

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import List, Union

from pydantic import Field
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from __future__ import annotations

from typing import Literal, Union
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from __future__ import annotations

from typing import List, Literal, Optional, Union
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import List, Literal, Optional, Union

from pydantic import AliasPath, BaseModel, ConfigDict, Field
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from __future__ import annotations

from typing import Literal, Union
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import List, Literal, Optional, Union

from pydantic import AliasPath, BaseModel, ConfigDict, Field
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from __future__ import annotations

from typing import List, Literal, Optional, Union
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from __future__ import annotations

from ipaddress import IPv4Address, IPv6Address
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from __future__ import annotations

from typing import List, Literal, Optional, Union
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from __future__ import annotations

from ipaddress import IPv4Address, IPv6Address
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import List, Union

from pydantic import Field
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from ipaddress import IPv4Address
from typing import Any, Dict, List, Literal, Optional, overload
from uuid import UUID
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import List, Literal, Optional

from pydantic import AliasPath, BaseModel, ConfigDict, Field
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import List, Literal

from pydantic import AliasPath, BaseModel, ConfigDict, Field
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from ipaddress import IPv6Interface
from typing import List, Literal, Optional, Union

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import List, Literal, Optional, Union

from pydantic import AliasPath, BaseModel, ConfigDict, Field
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from ipaddress import IPv4Address, IPv6Interface
from typing import List, Literal, Optional, Union

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from ipaddress import IPv4Address, IPv6Interface
from typing import List, Literal, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions catalystwan/models/configuration/policy_group.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import List, Literal, Optional
from uuid import UUID

Expand Down
1 change: 1 addition & 0 deletions catalystwan/models/configuration/topology_group.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import List, Literal, Optional
from uuid import UUID

Expand Down
1 change: 1 addition & 0 deletions catalystwan/models/policy/definition/app_route.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from ipaddress import IPv4Network, IPv6Network
from typing import List, Literal, Optional, Set, Tuple, Union, overload
from uuid import UUID
Expand Down
5 changes: 5 additions & 0 deletions catalystwan/models/policy/definition/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
ExpandedCommunityListEntry,
ExportToAction,
GroupIDEntry,
Ipv6PrefixListEntry,
Match,
MultiRegionRole,
OMPTagEntry,
Expand Down Expand Up @@ -60,6 +61,7 @@
ColorListEntry,
CommunityListEntry,
ExpandedCommunityListEntry,
Ipv6PrefixListEntry,
OMPTagEntry,
OriginatorEntry,
OriginEntry,
Expand Down Expand Up @@ -191,6 +193,9 @@ def match_vpn_list(self, vpn_list_id: UUID) -> None:
def match_prefix_list(self, prefix_list_id: UUID) -> None:
self._insert_match(PrefixListEntry(ref=prefix_list_id))

def match_ipv6_prefix_list(self, prefix_list_id: UUID) -> None:
self._insert_match(Ipv6PrefixListEntry(ref=prefix_list_id))

@accept_action
def associate_community_action(self, community: str, additive: bool = False) -> None:
self._insert_action_in_set(CommunityEntry(value=community))
Expand Down
1 change: 1 addition & 0 deletions catalystwan/models/policy/list/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from typing import List, Literal, Optional

from pydantic import BaseModel, ConfigDict, Field, model_validator
Expand Down
6 changes: 6 additions & 0 deletions catalystwan/models/policy/policy_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,11 @@ class PrefixListEntry(BaseModel):
ref: UUID


class Ipv6PrefixListEntry(BaseModel):
field: Literal["ipv6prefixList"] = "ipv6prefixList"
ref: UUID


class RegionListEntry(BaseModel):
field: Literal["regionList"] = "regionList"
ref: UUID
Expand Down Expand Up @@ -1289,6 +1294,7 @@ class ActionSet(BaseModel):
ExtendedCommunityEntry,
GroupIDEntry,
ICMPMessageEntry,
Ipv6PrefixListEntry,
LocalPreferenceEntry,
MetricEntry,
NextHeaderEntry,
Expand Down
1 change: 1 addition & 0 deletions catalystwan/request_limiter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from __future__ import annotations

from contextlib import AbstractContextManager
Expand Down
1 change: 1 addition & 0 deletions catalystwan/tests/templates/models/aaa.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from catalystwan.api.templates.models.aaa_model import (
AAAModel,
RadiusServer,
Expand Down
1 change: 1 addition & 0 deletions catalystwan/tests/templates/models/cisco_ospf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from ipaddress import IPv4Interface

from catalystwan.api.templates.models.cisco_ospf import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from ipaddress import IPv4Address, IPv4Interface

from catalystwan.api.templates.models.cisco_secure_internet_gateway import (
Expand Down
1 change: 1 addition & 0 deletions catalystwan/tests/templates/test_find_template_values.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from catalystwan.api.templates.device_variable import DeviceVariable
from catalystwan.utils.feature_template.find_template_values import find_template_values

Expand Down
1 change: 1 addition & 0 deletions catalystwan/tests/templates/test_find_template_values_2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates
from catalystwan.api.templates.device_variable import DeviceVariable
from catalystwan.utils.feature_template.find_template_values import find_template_values

Expand Down
Loading

0 comments on commit 234cd1b

Please sign in to comment.