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

Commit

Permalink
Add 'where to add generated model' added 8. Future Features
Browse files Browse the repository at this point in the history
  • Loading branch information
jpkrajewski committed Feb 27, 2024
1 parent 3fac563 commit db7c632
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions catalystwan/models/configuration/feature_profile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ 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/CiscoDevNet/vManage-client/blob/main/CONTRIBUTING.md
2. Download a schema with new endpoint (TODO where to add):
1. Add new endpoints following the guide: https://github.com/CiscoDevNet/catalystwan/blob/main/CONTRIBUTING.md
2. Download a schema with new endpoint:
```python
@versions(supported_versions=(">=20.9"), raises=False)
@get("/v1/feature-profile/sdwan/transport/cellular-controller/schema", resp_json_key="request")
Expand All @@ -25,14 +25,10 @@ with open("sdwan_transport_cellular_controller_parcel_schema.json", "w") as f:
json.dump(schema, f, indent=4)
```

TODO: Possible to automate this step

3. Generate `model.py`

`datamodel-codegen --input sdwan_transport_cellular_controller_parcel_schema.json --output model.py --output-model-type pydantic_v2.BaseModel --enum-field-as-literal all --input-file-type jsonschema --field-constraints --target-python-version 3.8 --snake-case-field`

TODO: Improve `cmd` & check if there is a possibility to improve generator

`model.py`
```python
# generated by datamodel-codegen:
Expand Down Expand Up @@ -251,7 +247,7 @@ class CellularController(BaseModel):
)
```

5. FIx `model.py` file
5. Fix `model.py` file

`cellular_controller.py`
```python
Expand Down Expand Up @@ -287,6 +283,9 @@ class CellularControllerParcel(Parcel):
config_type: Default[ConfigTypeValue] = Field(default=Default(value=ConfigTypeValue.NON_E_SIM), alias="configType")
controller_config: ControllerConfig = Field(alias="controllerConfig")
```

6. Add `cellular_controller.py` file to folder `catalystwan/models/configuration/feature_profile/sdwan/transport`

## Guidelines for Creating Config Groups

### 1. Directory Structure
Expand Down Expand Up @@ -336,9 +335,10 @@ https://peps.python.org/pep-0008/#descriptive-naming-styles

Utilize `model_validator` for two or more excluding values.

### 7. Pipeline and Integration Tests

- Implement a pipeline and integration tests. (TODO: Provide details)
If you have any questions or need further clarification, please reach out to the project maintainers. Thank you for your contribution!

### 8. Future Features

If you have any questions or need further clarification, please reach out to the project maintainers. Thank you for your contribution!
- Automate model generation step
- Improve model generator
- Implement a pipeline and integration tests.

0 comments on commit db7c632

Please sign in to comment.