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

implement OSPO guidelines #496

Merged
merged 6 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
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/CiscoDevNet/catalystwan/pulls) - remember to follow code guidelines.
* Want to add something from yourself? [Make a PR](https://github.com/CiscoDevNet/catalystwan/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
Expand Down
1,187 changes: 596 additions & 591 deletions ENDPOINTS.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions catalystwan/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2022 Cisco Systems, Inc. and its affiliates

import logging
import logging.config
import multiprocessing
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/abstractions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates

from typing import Optional, Protocol, Type, TypeVar

from packaging.version import Version # type: ignore
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/admin_tech_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2022 Cisco Systems, Inc. and its affiliates

"""
Module for handling admintech logs for a device
"""
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/administration.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2022 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

import logging
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/alarms_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2022 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

import logging
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/api_container.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/basic_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2022 Cisco Systems, Inc. and its affiliates

"""Methods covering essential API endpoints and related data classes."""
from __future__ import annotations

Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/config_device_inventory_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/config_group_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/configuration_groups/parcel.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from enum import Enum
from typing import Any, Dict, Generic, Literal, Optional, TypeVar, get_origin

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

from enum import Enum
from typing import Union

Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/dashboard_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/device_action_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2022 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

import logging
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/feature_profile_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

from typing import TYPE_CHECKING, Any, Protocol, Type, Union, overload
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/logs_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2022 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

import logging
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/monitoring_status_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

import logging
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/mtt_aaa_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

import logging
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/omp_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2022 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

from typing import TYPE_CHECKING, List
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/packet_capture_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2022 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

import logging
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/parcel_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

from typing import TYPE_CHECKING, Protocol
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/partition_manager_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

import logging
Expand Down
30 changes: 16 additions & 14 deletions catalystwan/api/policy_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

from typing import TYPE_CHECKING, Any, Dict, List, Mapping, Optional, Type, overload
Expand Down Expand Up @@ -122,13 +124,13 @@
from catalystwan.endpoints.configuration.policy.list.site import ConfigurationPolicySiteList, SiteListInfo
from catalystwan.endpoints.configuration.policy.list.sla import ConfigurationPolicySLAClassList, SLAClassListInfo
from catalystwan.endpoints.configuration.policy.list.tloc import ConfigurationPolicyTLOCList, TLOCListInfo
from catalystwan.endpoints.configuration.policy.list.url_black_list import (
ConfigurationPolicyURLBlackList,
URLBlackListInfo,
from catalystwan.endpoints.configuration.policy.list.url_allow_list import (
ConfigurationPolicyURLAllowList,
URLAllowListInfo,
)
from catalystwan.endpoints.configuration.policy.list.url_white_list import (
ConfigurationPolicyURLWhiteList,
URLWhiteListInfo,
from catalystwan.endpoints.configuration.policy.list.url_block_list import (
ConfigurationPolicyURLBlockList,
URLBlockListInfo,
)
from catalystwan.endpoints.configuration.policy.list.vpn import ConfigurationPolicyVPNList, VPNListInfo
from catalystwan.endpoints.configuration.policy.list.zone import ConfigurationPolicyZoneList, ZoneListInfo
Expand Down Expand Up @@ -181,8 +183,8 @@
SiteList,
SLAClassList,
TLOCList,
URLBlackList,
URLWhiteList,
URLAllowList,
URLBlockList,
VPNList,
ZoneList,
)
Expand Down Expand Up @@ -238,8 +240,8 @@
SiteList: ConfigurationPolicySiteList,
SLAClassList: ConfigurationPolicySLAClassList,
TLOCList: ConfigurationPolicyTLOCList,
URLBlackList: ConfigurationPolicyURLBlackList,
URLWhiteList: ConfigurationPolicyURLWhiteList,
URLBlockList: ConfigurationPolicyURLBlockList,
URLAllowList: ConfigurationPolicyURLAllowList,
VPNList: ConfigurationPolicyVPNList,
ZoneList: ConfigurationPolicyZoneList,
}
Expand Down Expand Up @@ -498,11 +500,11 @@ def get(self, type: Type[TLOCList]) -> DataSequence[TLOCListInfo]:
...

@overload
def get(self, type: Type[URLBlackList]) -> DataSequence[URLBlackListInfo]:
def get(self, type: Type[URLBlockList]) -> DataSequence[URLBlockListInfo]:
...

@overload
def get(self, type: Type[URLWhiteList]) -> DataSequence[URLWhiteListInfo]:
def get(self, type: Type[URLAllowList]) -> DataSequence[URLAllowListInfo]:
...

@overload
Expand Down Expand Up @@ -616,11 +618,11 @@ def get(self, type: Type[TLOCList], id: UUID) -> TLOCListInfo:
...

@overload
def get(self, type: Type[URLBlackList], id: UUID) -> URLBlackListInfo:
def get(self, type: Type[URLBlockList], id: UUID) -> URLBlockListInfo:
...

@overload
def get(self, type: Type[URLWhiteList], id: UUID) -> URLWhiteListInfo:
def get(self, type: Type[URLAllowList], id: UUID) -> URLAllowListInfo:
...

@overload
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/resource_pool_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

import logging
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/software_action_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

import logging
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/speedtest_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2022 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

import logging
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/task_status_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

import logging
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/template_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2022 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

import json
Expand Down
17 changes: 5 additions & 12 deletions catalystwan/api/templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ These steps will help you to automate feature template creation. We'll explain w
```python
from pathlib import Path
from typing import ClassVar
from pydantic import ConfigDict
from catalystwan.api.templates.feature_template import FeatureTemplate


class OMPvSmart(FeatureTemplate):
class Config:
arbitrary_types_allowed = True
allow_population_by_field_name = True

model_config = ConfigDict(arbitrary_types_allowed=True, populate_by_name=True)

payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED"
type: ClassVar[str] = "omp-vsmart"
Expand All @@ -42,15 +40,15 @@ These steps will help you to automate feature template creation. We'll explain w
```python
ported_templates = (..., OMPvSmart)
```

NOTE: This step will be removed once all template payloads will be generated automatically.
4. (This step is temporary) Find `available_models` definition in 'supported' and add your new template class.
```python
available_models = {
(...)
'omp_vsmart': OMPvSmart
}
```

NOTE: This step will be removed once all template payloads will be generated dynamically.
5. We can try to create our first template with default values.
```python
omp_vsmart = OMPvSmart(
Expand All @@ -67,7 +65,7 @@ These steps will help you to automate feature template creation. We'll explain w

6. We can check whether our template is created sucessfully in Manager manually. If there is an error, please create an issue with error and try go to the 7th step.

### Custimize Feature Template fields.
### Customize Feature Template fields.
7. Run below code with already created session and changed corresponding variables.

```python
Expand All @@ -87,8 +85,3 @@ These steps will help you to automate feature template creation. We'll explain w

8. Open `response_{template_type}.json` file.
9. Find `fields` key. The value should be list of dictionaries. Get every possible key in the dictionary and fill our class with every possible key. You can find the code in `catalystwan\api\templates\models\omp_vsmart_model.py` file.

TODO:
- Nested fields
- Handle 3 types of variables

2 changes: 2 additions & 0 deletions catalystwan/api/templates/bool_str.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates

from pydantic import PlainSerializer
from typing_extensions import Annotated

Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/templates/cli_template.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

import json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

import logging
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/templates/device_variable.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from pydantic import BaseModel


Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/templates/feature_template.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

import json
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/templates/feature_template_field.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from __future__ import annotations

from enum import Enum
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/templates/feature_template_payload.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from typing import Any, List

from pydantic import BaseModel, ConfigDict, Field
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/templates/models/cisco_aaa_model.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from enum import Enum
from pathlib import Path
from typing import ClassVar, List, Optional
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/templates/models/cisco_banner_model.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from pathlib import Path
from typing import ClassVar, Optional

Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/templates/models/cisco_bfd_model.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from enum import Enum
from pathlib import Path
from typing import ClassVar, List, Optional
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/templates/models/cisco_bgp_model.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from enum import Enum
from pathlib import Path
from typing import ClassVar, List, Optional
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/templates/models/cisco_logging_model.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from enum import Enum
from pathlib import Path
from typing import ClassVar, List, Optional
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/templates/models/cisco_ntp_model.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from pathlib import Path
from typing import ClassVar, List, Optional

Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/templates/models/cisco_omp_model.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from enum import Enum
from pathlib import Path
from typing import ClassVar, List, Optional
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/templates/models/cisco_ospf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

import ipaddress
from enum import Enum
from pathlib import Path
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/api/templates/models/cisco_ospfv3.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

import ipaddress
from enum import Enum
from pathlib import Path
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

import ipaddress
from enum import Enum
from pathlib import Path
Expand Down
Loading
Loading