We're really glad you want to help.
- Want to add something from yourself? Make a PR - remember to follow code guidelines. 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. 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 PRs, any suggestion is welcome.
- Want to help but you don't have any new ideas for improvement or feature? Take any issue and fix it.
- Bugs? Report it here - remember to provide as much information as you can.
- Need some additional feature? Let us know here
Test newly implemented features on Cisco SD-WAN, ideally on different versions. If you don't have access to any SD-WAN you can use Cisco provided sandboxes.
- Building package for tests
To make a.whlfile runThen inpoetry build/catalystwan/dist/directory there is a.whlfile namedcatalystwan-<version>-py3-none-any.whl, which can be installed by runningpip install catalystwan-<version>-py3-none-any.whl
Make clear PR description and include doc strings in your code to make it easily understandable.
Always write a clear log message for your commits.
-
Download Python3.8 or higher.
-
Download repository
git clone https://github.com/CiscoDevNet/catalystwan.git -
Install and configure poetry (v1.3.1 or higher) https://python-poetry.org/docs/#installation
On linux/mac this usually means:
curl -sSL https://install.python-poetry.org | python3 - poetry config virtualenvs.in-project true -
Install dependecies
poetry install -
Activate
pre-commitpre-commit install
-
catalystwan_develwhen set: loggers will be configured according to./logging.confandurllib3.exceptions.InsecureRequestWarningwill be suppressed -
catalystwan_export_endpointswhen setendpoints-mdpre-commit step will generateENDPOINTS.mdfile in addition to perform definition checks. This should be set only when creating version bump commit with new release tag.
Start reading our code, and you'll get the hang of it.
- Make sure you run pre-commit on your code before submitting it, it will make sure you follow rules we use:
- Use clear naming and add description with examples.
- Use Google Style Python Docstring.
- Add unit tests to your code.
catalystwan APIs should make requests only through API Endpoints layer. This layer defines:
- http method
- endpoint url
- payload data-model (subtyping
pydantic.BaseModeland others) - return type (subtyping
pydantic.BaseModeland others) - allowed views (session types)
- supported versions
Example:
# to keep example brief we define models and endpoints in single file - however it is suggested to use separate files
from pydantic import BaseModel, Field
from typing import List
from catalystwan.endpoints import APIEndpoints, delete, versions, view
from catalystwan.utils.session_type import ProviderView
class TenantBulkDeleteRequest(BaseModel):
password: str
tenant_id_list: List[str] = Field(alias="tenantIdList")
class TenantTaskId(BaseModel):
id: str
class TenantManagement(APIEndpoints):
@versions(">=20.4")
@view({ProviderView})
@delete("/tenant/bulk/async")
def delete_tenant_async_bulk(self, payload: TenantBulkDeleteRequest) -> TenantTaskId:
...Please note that when using @request decorator method must have no body. Request will be built automatically and return value based on defined type will be provided.
API endpoints definitions can be found in: catalystwan/endpoints directory.
The organization of items should follow OpenAPI spec: https://developer.cisco.com/docs/sdwan/#!sd-wan-vmanage-v20-9
For example with given tag Configuration - Feature Profile (SDWAN) items should be placed in:
catalystwan/endpoints/configuration/feature_profile/sdwan/...for APIEndpoints sub-classescatalystwan/models/configuration/feature_profile/sdwan/...for pydantic models defining payload, return type and possibly query params.
Auto generated python methods names can be found in: https://ghe-msite.cisco.com/sbasan/openapi-generator-vmanage
Dedicated pre-commit step will automatically check corectness and add documentation for endpoints with @request (or @get, @post, @put, @delete) decorator.
Custom payload types are allowed (eg. for sending various types of files) please check example: SoftwarePackageUploadPayload
- Check that endpoints you want to utilize in your API already defined in
catalystwan/endpoints. - If endpoint not present, create new file with endpoint including data-model and methods with
@request,@viewand@versionsdecorators when needed. - Implement higher level API in
catalystwan/apiusing created endpoints.
Thanks,
catalystwan team