diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index a207039a0..d50bbcd03 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -5,7 +5,7 @@ [Add more in depth analysis of what changed, provide logs, examples of usage] # Checklist: -- [ ] Make sure to run pre-commit before commiting changes +- [ ] Make sure to run pre-commit before committing changes - [ ] Make sure all checks have passed - [ ] PR description is clear and comprehensive - [ ] Mentioned the issue that this PR solves (if applicable) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5cbcf1002..6ced5483a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -65,3 +65,8 @@ repos: language: system types: [python] fail_fast: true + + - repo: https://github.com/Yelp/detect-secrets + rev: v1.4.0 + hooks: + - id: detect-secrets diff --git a/README.md b/README.md index fd2afe105..3af4a003f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ -# vManage-client +<p align="center"> + <a href="#"><img src="docs/vManage-client_LOGO.svg" alt="vManage-client logo" style="height:150px" /> +</p> + [![Python-Supported](https://img.shields.io/static/v1?label=Python&logo=Python&color=3776AB&message=3.8%20|%203.9%20|%203.10%20|%203.11)](https://www.python.org/) -vManage client is a package for creating simple and parallel automatic requests via official vManageAPI. It is intended to serve as a multiple session handler (provider, provider as a tenant, tenant). The library is not dependent on environment which is being run in, you just need a connection to any vManage. +vManage client is a package for creating simple and parallel automatic requests via official vManage API. It is intended to serve as a multiple session handler (provider, provider as a tenant, tenant). The library is not dependent on environment which is being run in, you just need a connection to any vManage. ## Installation ```console diff --git a/docs/vManage-client_LOGO.svg b/docs/vManage-client_LOGO.svg new file mode 100644 index 000000000..e414c2b9d --- /dev/null +++ b/docs/vManage-client_LOGO.svg @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg id="a" data-name="Warstwa 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 200"> + <defs> + <style> + .b { + fill: #f26419; + } + + .c { + fill: #2f4858; + } + + .d { + fill: #33658a; + } + + .e { + fill: #86bbd8; + } + </style> + </defs> + <path class="c" d="m101.16,94.43c0,6.12,4.96,11.08,11.08,11.08s11.08-4.96,11.08-11.08c0-8.16-9.46-11.39-9.46-19.65,0-8.26,9.46-11.49,9.46-19.65,0-6.12-4.96-11.08-11.08-11.08-6.12,0-11.08,4.96-11.08,11.08,0,8.16,9.46,11.39,9.46,19.65s-9.46,11.49-9.46,19.65Z"/> + <path class="e" d="m160.09,94.43c0,6.12,4.96,11.08,11.08,11.08s11.08-4.96,11.08-11.08c0-8.16-9.46-11.39-9.46-19.65s9.46-11.49,9.46-19.65c0-6.12-4.96-11.08-11.08-11.08-6.12,0-11.08,4.96-11.08,11.08,0,8.16,9.46,11.39,9.46,19.65s-9.46,11.49-9.46,19.65Z"/> + <path class="d" d="m130.63,74.33c0,6.12,4.96,11.08,11.08,11.08,6.12,0,11.08-4.96,11.08-11.08,0-8.16-9.46-11.39-9.46-19.65,0-8.26,9.46-11.49,9.46-19.65,0-6.12-4.96-11.08-11.08-11.08s-11.08,4.96-11.08,11.08c0,8.16,9.46,11.39,9.46,19.65,0,8.26-9.46,11.49-9.46,19.65Z"/> + <circle class="c" cx="82.77" cy="74.78" r="10.52"/> + <path class="e" d="m219.03,94.43c0,6.12,4.96,11.08,11.08,11.08s11.08-4.96,11.08-11.08c0-8.16-9.46-11.39-9.46-19.65,0-8.26,9.46-11.49,9.46-19.65,0-6.12-4.96-11.08-11.08-11.08-6.12,0-11.08,4.96-11.08,11.08,0,8.16,9.46,11.39,9.46,19.65s-9.46,11.49-9.46,19.65Z"/> + <path class="c" d="m277.96,94.43c0,6.12,4.96,11.08,11.08,11.08s11.08-4.96,11.08-11.08c0-8.16-9.46-11.39-9.46-19.65,0-8.26,9.46-11.49,9.46-19.65,0-6.12-4.96-11.08-11.08-11.08-6.12,0-11.08,4.96-11.08,11.08,0,8.16,9.46,11.39,9.46,19.65s-9.46,11.49-9.46,19.65Z"/> + <path class="d" d="m248.49,74.33c0,6.12,4.96,11.08,11.08,11.08,6.12,0,11.08-4.96,11.08-11.08,0-8.16-9.46-11.39-9.46-19.65s9.46-11.49,9.46-19.65c0-6.12-4.96-11.08-11.08-11.08s-11.08,4.96-11.08,11.08c0,8.16,9.46,11.39,9.46,19.65s-9.46,11.49-9.46,19.65Z"/> + <circle class="b" cx="200.64" cy="74.78" r="10.52"/> + <circle class="c" cx="318.51" cy="74.78" r="10.52"/> + <g> + <path class="c" d="m46.1,166.46l-8.19-21.08h7.48l4.46,13.52,4.46-13.52h7.11l-8.19,21.08h-7.15Z"/> + <path class="c" d="m65.23,166.46v-28.03h7.77l7.61,13.39,7.61-13.39h7.44v28.03h-6.49v-19.06l-7.61,13.39h-2.23l-7.61-13.39v19.06h-6.49Z"/> + <path class="c" d="m102.69,165.1c-1.36-1.24-2.03-2.89-2.03-4.92,0-4.18,3.27-6.78,9.88-6.78h3.56v-.08c0-1.82-1.74-3.14-4.59-3.14-2.36,0-4.46.58-6.33,1.78v-5.29c1.9-1.2,4.34-1.78,7.28-1.78s5.54.7,7.44,2.15,2.85,3.72,2.85,6.86v12.57h-6.45l-.41-3.02c-.5.87-1.36,1.7-2.65,2.44-1.28.7-2.56,1.08-3.89,1.08-1.74,0-3.31-.62-4.67-1.86Zm10.13-4.63c.87-.95,1.28-1.98,1.28-3.18v-.12h-3.02c-2.27,0-3.43.78-3.43,2.36,0,1.49,1.12,2.32,2.4,2.32.99,0,1.9-.46,2.77-1.36Z"/> + <path class="c" d="m126.46,166.46v-21.08h6.28l.41,3.02c1.2-1.94,3.93-3.51,6.78-3.51,4.3,0,7.28,3.43,7.28,9.18v12.4h-6.7v-11.49c0-2.52-1.16-4.13-3.31-4.13-2.36,0-4.05,1.86-4.05,4.34v11.29h-6.7Z"/> + <path class="c" d="m153.95,165.1c-1.36-1.24-2.03-2.89-2.03-4.92,0-4.18,3.27-6.78,9.88-6.78h3.56v-.08c0-1.82-1.74-3.14-4.59-3.14-2.36,0-4.46.58-6.33,1.78v-5.29c1.9-1.2,4.34-1.78,7.28-1.78s5.54.7,7.44,2.15,2.85,3.72,2.85,6.86v12.57h-6.45l-.41-3.02c-.5.87-1.36,1.7-2.65,2.44-1.28.7-2.56,1.08-3.89,1.08-1.74,0-3.31-.62-4.67-1.86Zm10.13-4.63c.87-.95,1.28-1.98,1.28-3.18v-.12h-3.02c-2.27,0-3.43.78-3.43,2.36,0,1.49,1.12,2.32,2.4,2.32.99,0,1.9-.46,2.77-1.36Z"/> + <path class="c" d="m179.62,174.69v-6.2c1.7,1.07,3.84,1.61,6.41,1.61,4.42,0,6.82-2.23,6.82-5.58v-1.94c-1.03,1.78-3.6,3.6-6.7,3.6-2.52,0-4.71-1.03-6.57-3.06-1.86-2.07-2.77-4.55-2.77-7.44,0-3.06.99-5.62,3.02-7.69,2.03-2.07,4.34-3.1,6.95-3.1,2.94,0,5.09,1.61,6.08,3.39l.41-2.89h6.28v19.02c0,3.35-1.2,6.12-3.56,8.31-2.36,2.23-5.71,3.35-10.09,3.35-2.4,0-4.51-.45-6.28-1.36Zm13.48-19.14c0-2.52-1.86-4.71-4.63-4.71-1.41,0-2.56.46-3.47,1.41-.91.95-1.36,2.03-1.36,3.31,0,2.48,2.03,4.67,4.84,4.67s4.63-2.19,4.63-4.67Z"/> + <path class="c" d="m207.56,163.9c-2.11-2.03-3.14-4.63-3.14-7.77s1.03-5.87,3.06-8.02c2.07-2.15,4.71-3.22,7.94-3.22s5.79,1.08,7.61,3.22c1.82,2.11,2.73,4.63,2.73,7.48,0,.87-.12,1.65-.33,2.31h-13.93c.54,2.52,2.69,3.76,6.45,3.76,2.44,0,4.38-.37,5.75-1.16v5c-1.94.95-4.22,1.45-6.9,1.45-4.05,0-7.11-1.03-9.22-3.06Zm11.37-9.76c0-2.19-1.41-4.01-3.68-4.01-2.03,0-3.6,1.49-3.93,4.01h7.61Z"/> + <path class="c" d="m230.71,158.57v-5.58h13.73v5.58h-13.73Z"/> + <path class="c" d="m252.42,163.82c-2.03-2.11-3.02-4.71-3.02-7.77s1.08-5.87,3.27-7.98c2.19-2.11,4.96-3.18,8.27-3.18,2.15,0,3.8.37,4.96,1.12v6.04c-1.12-.78-2.48-1.2-4.18-1.2-3.47,0-5.5,2.19-5.5,5.04s1.94,5.13,5.62,5.13c1.61,0,2.93-.33,4.05-.99v5.58c-1.28.91-3.1,1.36-5.5,1.36-3.27,0-5.95-1.03-7.98-3.14Z"/> + <path class="c" d="m271.06,166.46v-30.34h6.7v30.34h-6.7Z"/> + <path class="c" d="m284.12,141.53c-.74-.7-1.12-1.61-1.12-2.69s.37-1.94,1.12-2.65c1.49-1.45,4.05-1.45,5.54,0,.74.7,1.12,1.57,1.12,2.65s-.37,1.98-1.12,2.69c-1.49,1.36-4.05,1.36-5.54,0Zm-.58,24.93v-21.08h6.7v21.08h-6.7Z"/> + <path class="c" d="m298.26,163.9c-2.11-2.03-3.14-4.63-3.14-7.77s1.03-5.87,3.06-8.02c2.07-2.15,4.71-3.22,7.94-3.22s5.79,1.08,7.61,3.22c1.82,2.11,2.73,4.63,2.73,7.48,0,.87-.12,1.65-.33,2.31h-13.93c.54,2.52,2.69,3.76,6.45,3.76,2.44,0,4.38-.37,5.75-1.16v5c-1.94.95-4.22,1.45-6.9,1.45-4.05,0-7.11-1.03-9.22-3.06Zm11.37-9.76c0-2.19-1.41-4.01-3.68-4.01-2.03,0-3.6,1.49-3.93,4.01h7.61Z"/> + <path class="c" d="m321.33,166.46v-21.08h6.28l.41,3.02c1.2-1.94,3.93-3.51,6.78-3.51,4.3,0,7.28,3.43,7.28,9.18v12.4h-6.7v-11.49c0-2.52-1.16-4.13-3.31-4.13-2.36,0-4.05,1.86-4.05,4.34v11.29h-6.7Z"/> + <path class="c" d="m351.47,164.81c-1.41-1.45-2.11-3.31-2.11-5.58v-8.48h-3.93v-5.37h3.93v-3.68l6.7-3.27v6.95h6.04l-1.65,5.37h-4.38v6.95c0,2.19,1.12,3.31,3.31,3.31.79,0,1.45-.12,1.98-.41v5.46c-.95.62-2.36.91-4.22.91-2.36,0-4.22-.7-5.66-2.15Z"/> + </g> +</svg> \ No newline at end of file diff --git a/vmngclient/api/admin_tech_api.py b/vmngclient/api/admin_tech_api.py index cd291ed03..07dbf00c7 100644 --- a/vmngclient/api/admin_tech_api.py +++ b/vmngclient/api/admin_tech_api.py @@ -116,7 +116,7 @@ def generate( timeout=request_timeout, ) except HTTPError as http_error: - response = http_error.response + response = http_error.response # type: ignore if response.status_code == 200: return response.json()["fileName"] if response.status_code == 400 and create_admin_tech_error_msgs in response.json().get("error", {}).get( diff --git a/vmngclient/api/template_api.py b/vmngclient/api/template_api.py index cad87b1eb..cfda26591 100644 --- a/vmngclient/api/template_api.py +++ b/vmngclient/api/template_api.py @@ -26,6 +26,7 @@ from vmngclient.api.templates.models.cisco_ntp_model import CiscoNTPModel from vmngclient.api.templates.models.cisco_omp_model import CiscoOMPModel from vmngclient.api.templates.models.cisco_ospf import CiscoOSPFModel +from vmngclient.api.templates.models.cisco_ospfv3 import CiscoOspfv3Model from vmngclient.api.templates.models.cisco_secure_internet_gateway import CiscoSecureInternetGatewayModel from vmngclient.api.templates.models.cisco_snmp_model import CiscoSNMPModel from vmngclient.api.templates.models.cisco_system import CiscoSystemModel @@ -94,7 +95,10 @@ def get(self, template): raise NotImplementedError() def _get_feature_templates( - self, summary: bool = True, offset: Optional[int] = None, limit: Optional[int] = None + self, + summary: bool = True, + offset: Optional[int] = None, + limit: Optional[int] = None, ) -> DataSequence[FeatureTemplateInfo]: """In a multitenant vManage system, this API is only available in the Provider view.""" endpoint = "/dataservice/template/feature" @@ -139,7 +143,11 @@ def _attach_feature(self, name: str, device: Device, **kwargs): def get_device_specific_variables(name: str): endpoint = "/dataservice/template/device/config/exportcsv" template_id = self.get(DeviceTemplate).filter(name=name).single_or_default().id - body = {"templateId": template_id, "isEdited": False, "isMasterEdited": False} + body = { + "templateId": template_id, + "isEdited": False, + "isMasterEdited": False, + } values = self.session.post(endpoint, json=body).json()["header"]["columns"] return [DeviceSpecificValue(**value) for value in values] @@ -454,7 +462,8 @@ def get_general_template_info( return _template def parse_general_template( - general_template: GeneralTemplate, fr_templates: DataSequence[FeatureTemplateInfo] + general_template: GeneralTemplate, + fr_templates: DataSequence[FeatureTemplateInfo], ) -> GeneralTemplate: if general_template.subTemplates: general_template.subTemplates = [ @@ -515,6 +524,7 @@ def is_created_by_generator(self, template: FeatureTemplate) -> bool: CiscoOSPFModel, CliTemplateModel, CiscoSecureInternetGatewayModel, + CiscoOspfv3Model, ) return isinstance(template, ported_templates) @@ -559,32 +569,15 @@ def generate_feature_template_payload( if field.key in template.device_specific_variables: value = template.device_specific_variables[field.key] else: - # Iterate through every possible field, maybe refactor(?) - # Use data_path instead. data_path as tuple - # next(field_value.field_info.extra.get("vmanage_key") == field.key, template.__fields__.values()) for field_name, field_value in template.__fields__.items(): - if "vmanage_key" in field_value.field_info.extra: # type: ignore - vmanage_key = field_value.field_info.extra.get("vmanage_key") # type: ignore - if vmanage_key != field.key: - break - - value = template.dict(by_alias=True).get(field_name, None) - field_value.field_info.extra.pop("vmanage_key") # type: ignore + if field.dataPath == field_value.field_info.extra.get("data_path", []) and ( # type: ignore + field.key == field_value.alias + or field.key == field_value.field_info.extra.get("vmanage_key") # type: ignore + ): + value = getattr(template, field_name) break if value is None: - value = template.dict(by_alias=True).get(field.key, None) - - # TODO remove workaround, add specific object - # types like Ignore, Constant, None etc so generator will now - # which object to ommit while generating payload - if template.type == "cisco_vpn_interface" and value is None: - continue - - if template.type == "cisco_ospf" and value is None: - continue - - if isinstance(value, bool): - value = str(value).lower() # type: ignore + continue # Merge dictionaries @@ -685,7 +678,12 @@ def edit_before_push(self, name: str, device: Device) -> bool: error_details = json.loads(error.response.text) logger.error(f"Error in config: {error_details['error']['details']}.") return False - payload = {"templateId": template_id, "deviceIds": [device.uuid], "isEdited": True, "isMasterEdited": True} + payload = { + "templateId": template_id, + "deviceIds": [device.uuid], + "isEdited": True, + "isMasterEdited": True, + } endpoint = "/dataservice/template/device/config/input/" logger.info(f"Editing template: {name} of device: {device.hostname}.") response = self.session.post(url=endpoint, json=payload).json() diff --git a/vmngclient/api/templates/feature_template.py b/vmngclient/api/templates/feature_template.py index 8ea526e96..01048980d 100644 --- a/vmngclient/api/templates/feature_template.py +++ b/vmngclient/api/templates/feature_template.py @@ -55,10 +55,12 @@ def remove_device_variables(cls, values): values["device_specific_variables"] = {} to_delete = {} + # TODO: Add support for nested models with DeviceVariable for key, value in values.items(): if isinstance(value, DeviceVariable): to_delete[key] = value - values["device_specific_variables"][cls.__fields__[key].alias] = DeviceVariable(name=value.name) + field_key = cls.__fields__[key].field_info.extra.get("vmanage_key", cls.__fields__[key].alias) + values["device_specific_variables"][field_key] = DeviceVariable(name=value.name) for var in to_delete: if var in values: diff --git a/vmngclient/api/templates/feature_template_field.py b/vmngclient/api/templates/feature_template_field.py index 2a7dbedd5..72943c364 100644 --- a/vmngclient/api/templates/feature_template_field.py +++ b/vmngclient/api/templates/feature_template_field.py @@ -4,8 +4,10 @@ from typing import Any, Dict, List, Optional from pydantic import BaseModel, Field, validator +from pydantic.fields import ModelField # type: ignore from vmngclient.api.templates.device_variable import DeviceVariable +from vmngclient.api.templates.feature_template import FeatureTemplate class FeatureTemplateOptionType(str, Enum): @@ -91,6 +93,13 @@ def payload_scheme(self, value: Any = None, help=None, current_path=None) -> dic output["vipObjectType"] = self.objectType.value + def nest_value_in_output(value: Any) -> dict: + pointer = rel_output + for path in self.dataPath: + pointer = pointer[path] + pointer[self.key] = value + return rel_output + if isinstance(value, DeviceVariable): vip_variable = VipVariable( vipValue="", @@ -98,8 +107,8 @@ def payload_scheme(self, value: Any = None, help=None, current_path=None) -> dic vipObjectType=self.objectType, vipVariableName=value.name, ) + return nest_value_in_output(vip_variable.dict(by_alias=True, exclude_none=True)) - return {self.key: vip_variable.dict(by_alias=True, exclude_none=True)} else: if value: output["vipType"] = FeatureTemplateOptionType.CONSTANT.value @@ -111,19 +120,27 @@ def payload_scheme(self, value: Any = None, help=None, current_path=None) -> dic for child in self.children: # Child in schema if current_path is None: current_path = [] - child_payload.update( - child.payload_scheme( - obj[child.key], help=output, current_path=self.dataPath + [self.key] + obj: FeatureTemplate # type: ignore + model_field: ModelField = next( + filter( + lambda f: f.field_info.extra.get("data_path", []) == child.dataPath + and (f.alias == child.key or f.field_info.extra.get("vmanage_key") == child.key), + obj.__fields__.values(), ) ) + obj_value = getattr(obj, model_field.name) + child_payload.update( + child.payload_scheme(obj_value, help=output, current_path=self.dataPath + [self.key]) + ) children_output.append(child_payload) output["vipValue"] = children_output else: output["vipValue"] = value else: if "default" in self.dataType: - output["vipValue"] = self.dataType["default"] if value is None else value - output["vipType"] = self.defaultOption.value + return {} + # output["vipValue"] = self.dataType["default"] if value is None else value + # output["vipType"] = self.defaultOption.value else: output["vipValue"] = [] output["vipType"] = FeatureTemplateOptionType.IGNORE.value @@ -135,10 +152,4 @@ def payload_scheme(self, value: Any = None, help=None, current_path=None) -> dic if self.primaryKeys: output["vipPrimaryKey"] = self.primaryKeys - pointer = rel_output - - for path in self.dataPath: - pointer = pointer[path] - - pointer[self.key] = output - return rel_output + return nest_value_in_output(output) diff --git a/vmngclient/api/templates/models/cisco_aaa_model.py b/vmngclient/api/templates/models/cisco_aaa_model.py index dce05aa52..d22acb999 100644 --- a/vmngclient/api/templates/models/cisco_aaa_model.py +++ b/vmngclient/api/templates/models/cisco_aaa_model.py @@ -12,7 +12,7 @@ class User(BaseModel): password: str secret: str privilege: Optional[str] - pubkey_chain: List[str] = Field(default=[], alias="pubkey-chain") + pubkey_chain: List[str] = Field(default=[], vmanage_key="pubkey-chain") class RadiusServer(BaseModel): @@ -20,14 +20,14 @@ class Config: allow_population_by_field_name = True address: str - auth_port: int = Field(alias="auth-port", default=1812) - acct_port: int = Field(alias="acct-port", default=1813) + auth_port: int = Field(vmanage_key="auth-port", default=1812) + acct_port: int = Field(vmanage_key="acct-port", default=1813) timeout: int = Field(default=5) retransmit: int = 3 key: str - secret_key: Optional[str] = Field(alias="secret-key", default=None) - key_enum: Optional[str] = Field(alias="key-enum", default=None) - key_type: Optional[str] = Field(alias="key-type", default=None) + secret_key: Optional[str] = Field(vmanage_key="secret-key", default=None) + key_enum: Optional[str] = Field(vmanage_key="key-enum", default=None) + key_type: Optional[str] = Field(vmanage_key="key-type", default=None) class RadiusGroup(BaseModel): @@ -35,9 +35,9 @@ class Config: arbitrary_types_allowed = True allow_population_by_field_name = True - group_name: str = Field(alias="group-name") + group_name: str = Field(vmanage_key="group-name") vpn: Optional[int] - source_interface: Optional[str] = Field(alias="source-interface") + source_interface: Optional[str] = Field(vmanage_key="source-interface") server: List[RadiusServer] = [] @@ -55,17 +55,17 @@ class Config: port: int = 49 timeout: int = Field(default=5) key: str - secret_key: Optional[str] = Field(alias="secret-key", default=None) - key_enum: Optional[str] = Field(alias="key-enum", default=None) + secret_key: Optional[str] = Field(vmanage_key="secret-key", default=None) + key_enum: Optional[str] = Field(vmanage_key="key-enum", default=None) class TacacsGroup(BaseModel): class Config: allow_population_by_field_name = True - group_name: str = Field(alias="group-name") + group_name: str = Field(vmanage_key="group-name") vpn: int = 0 - source_interface: Optional[str] = Field(alias="source-interface", default=None) + source_interface: Optional[str] = Field(vmanage_key="source-interface", default=None) server: List[TacacsServer] = [] @@ -75,13 +75,13 @@ class Config: allow_population_by_field_name = True user: List[User] = [] - authentication_group: bool = Field(alias="authentication_group", default=False) + authentication_group: bool = Field(vmanage_key="authentication_group", default=False) accounting_group: bool = True radius: List[RadiusGroup] = [] - domain_stripping: Optional[DomainStripping] = Field(alias="domain-stripping", default=None) + domain_stripping: Optional[DomainStripping] = Field(vmanage_key="domain-stripping", default=None) port: int = 1700 tacacs: List[TacacsGroup] = [] - server_auth_order: str = Field(alias="server-auth-order", default="local") + server_auth_order: str = Field(vmanage_key="server-auth-order", default="local") payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED" type: ClassVar[str] = "cedge_aaa" diff --git a/vmngclient/api/templates/models/cisco_bfd_model.py b/vmngclient/api/templates/models/cisco_bfd_model.py index 3e83ced59..49bfcc95f 100644 --- a/vmngclient/api/templates/models/cisco_bfd_model.py +++ b/vmngclient/api/templates/models/cisco_bfd_model.py @@ -41,9 +41,9 @@ class ColorType(str, Enum): class Color(ConvertBoolToStringModel): color: ColorType - hello_interval: Optional[int] = Field(DEFAULT_BFD_HELLO_INTERVAL, alias="hello-interval") + hello_interval: Optional[int] = Field(DEFAULT_BFD_HELLO_INTERVAL, vmanage_key="hello-interval") multiplier: Optional[int] = DEFAULT_BFD_COLOR_MULTIPLIER - pmtu_discovery: Optional[bool] = Field(True, alias="pmtu-discovery") + pmtu_discovery: Optional[bool] = Field(True, vmanage_key="pmtu-discovery") dscp: Optional[int] = DEFAULT_BFD_DSCP class Config: @@ -55,9 +55,11 @@ class Config: arbitrary_types_allowed = True allow_population_by_field_name = True - multiplier: Optional[int] = DEFAULT_BFD_MULTIPLIER - poll_interval: Optional[int] = Field(DEFAULT_BFD_POLL_INTERVAL, alias="poll-interval") - default_dscp: Optional[int] = Field(DEFAULT_BFD_DSCP, alias="default-dscp") + multiplier: Optional[int] = Field(DEFAULT_BFD_MULTIPLIER, data_path=["app-route"]) + poll_interval: Optional[int] = Field( + DEFAULT_BFD_POLL_INTERVAL, vmanage_key="poll-interval", data_path=["app-route"] + ) + default_dscp: Optional[int] = Field(DEFAULT_BFD_DSCP, vmanage_key="default-dscp") color: Optional[List[Color]] payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED" diff --git a/vmngclient/api/templates/models/cisco_bgp_model.py b/vmngclient/api/templates/models/cisco_bgp_model.py index 6dc948da2..daa21c7ff 100644 --- a/vmngclient/api/templates/models/cisco_bgp_model.py +++ b/vmngclient/api/templates/models/cisco_bgp_model.py @@ -8,39 +8,39 @@ class Export(BaseModel): - asn_ip: str = Field(alias="asn-ip") + asn_ip: str = Field(vmanage_key="asn-ip") class Config: allow_population_by_field_name = True class Import(BaseModel): - asn_ip: str = Field(alias="asn-ip") + asn_ip: str = Field(vmanage_key="asn-ip") class Config: allow_population_by_field_name = True class RouteTargetIpv4(BaseModel): - vpn_id: int = Field(alias="vpn-id") + vpn_id: int = Field(vmanage_key="vpn-id") export: List[Export] - import_: List[Import] = Field(vmanage_key="import", alias="import") + import_: List[Import] = Field(vmanage_key="import") class Config: allow_population_by_field_name = True class RouteTargetIpv6(BaseModel): - vpn_id: int = Field(alias="vpn-id") + vpn_id: int = Field(vmanage_key="vpn-id") export: List[Export] - import_: List[Import] = Field(vmanage_key="import", alias="import") + import_: List[Import] = Field(vmanage_key="import") class Config: allow_population_by_field_name = True class MplsInterface(BaseModel): - if_name: Optional[str] = Field(alias="if-name") + if_name: Optional[str] = Field(vmanage_key="if-name") class Config: allow_population_by_field_name = True @@ -52,8 +52,8 @@ class AddressFamilyType(str, Enum): class AggregateAddress(BaseModel): prefix: str - as_set: Optional[bool] = Field(alias="as-set") - summary_only: Optional[bool] = Field(alias="summary-only") + as_set: Optional[bool] = Field(vmanage_key="as-set") + summary_only: Optional[bool] = Field(vmanage_key="summary-only") class Config: allow_population_by_field_name = True @@ -66,8 +66,8 @@ def cast_to_str(cls, value): class Ipv6AggregateAddress(BaseModel): prefix: str - as_set: Optional[bool] = Field(False, alias="as-set") - summary_only: Optional[bool] = Field(False, alias="summary-only") + as_set: Optional[bool] = Field(False, vmanage_key="as-set") + summary_only: Optional[bool] = Field(False, vmanage_key="summary-only") class Config: allow_population_by_field_name = True @@ -93,22 +93,22 @@ class Protocol(str, Enum): class Redistribute(BaseModel): protocol: Protocol - route_policy: Optional[str] = Field(alias="route-policy") + route_policy: Optional[str] = Field(vmanage_key="route-policy") class Config: allow_population_by_field_name = True class AddressFamily(BaseModel): - family_type: AddressFamilyType = Field(alias="family-type") - aggregate_address: Optional[List[AggregateAddress]] = Field(alias="aggregate-address") - ipv6_aggregate_address: Optional[List[Ipv6AggregateAddress]] = Field(alias="ipv6-aggregate-address") + family_type: AddressFamilyType = Field(vmanage_key="family-type") + aggregate_address: Optional[List[AggregateAddress]] = Field(vmanage_key="aggregate-address") + ipv6_aggregate_address: Optional[List[Ipv6AggregateAddress]] = Field(vmanage_key="ipv6-aggregate-address") network: Optional[List[Network]] - ipv6_network: Optional[List[Ipv6Network]] = Field(alias="ipv6-network") - paths: Optional[int] - originate: Optional[bool] - name: Optional[str] - filter: Optional[bool] + ipv6_network: Optional[List[Ipv6Network]] = Field(vmanage_key="ipv6-network") + paths: Optional[int] = Field(data_path=["maximum-paths"]) + originate: Optional[bool] = Field(data_path=["default-information"]) + policy_name: Optional[str] = Field(data_path=["table-map"], vmanage_key="name") + filter: Optional[bool] = Field(data_path=["table-map"]) redistribute: Optional[List[Redistribute]] class Config: @@ -133,19 +133,19 @@ class Direction(str, Enum): class RoutePolicy(BaseModel): direction: Direction - pol_name: str = Field(alias="pol-name") + pol_name: str = Field(vmanage_key="pol-name") class Config: allow_population_by_field_name = True class NeighborAddressFamily(BaseModel): - family_type: NeighborFamilyType = Field(alias="family-type") - prefix_num: Optional[int] = Field(alias="prefix-num") - threshold: Optional[int] - restart: Optional[int] - warning_only: Optional[bool] = Field(alias="warning-only") - route_policy: Optional[List[RoutePolicy]] = Field(alias="route-policy") + family_type: NeighborFamilyType = Field(vmanage_key="family-type") + prefix_num: Optional[int] = Field(data_path=["maximum-prefixes"], vmanage_key="prefix-num") + threshold: Optional[int] = Field(data_path=["maximum-prefixes"]) + restart: Optional[int] = Field(data_path=["maximum-prefixes"]) + warning_only: Optional[bool] = Field(data_path=["maximum-prefixes"], vmanage_key="warning-only") + route_policy: Optional[List[RoutePolicy]] = Field(vmanage_key="route-policy") class Config: allow_population_by_field_name = True @@ -155,20 +155,20 @@ class Neighbor(BaseModel): address: str description: Optional[str] shutdown: Optional[bool] - remote_as: int = Field(alias="remote-as") - keepalive: Optional[int] - holdtime: Optional[int] - if_name: Optional[str] = Field(alias="if-name") - next_hop_self: Optional[bool] = Field(alias="next-hop-self") - send_community: Optional[bool] = Field(alias="send-community") - send_ext_community: Optional[bool] = Field(alias="send-ext-community") - ebgp_multihop: Optional[int] = Field(alias="ebgp-multihop") + remote_as: int = Field(vmanage_key="remote-as") + keepalive: Optional[int] = Field(data_path=["timers"]) + holdtime: Optional[int] = Field(data_path=["timers"]) + if_name: Optional[str] = Field(data_path=["update-source"], vmanage_key="if-name") + next_hop_self: Optional[bool] = Field(vmanage_key="next-hop-self") + send_community: Optional[bool] = Field(vmanage_key="send-community") + send_ext_community: Optional[bool] = Field(vmanage_key="send-ext-community") + ebgp_multihop: Optional[int] = Field(vmanage_key="ebgp-multihop") password: Optional[str] - send_label: Optional[bool] = Field(alias="send-label") - send_label_explicit: Optional[bool] = Field(alias="send-label-explicit") - as_override: Optional[bool] = Field(alias="as-override") - as_number: Optional[int] = Field(alias="as-number") - address_family: Optional[List[NeighborAddressFamily]] = Field(alias="address-family") + send_label: Optional[bool] = Field(vmanage_key="send-label") + send_label_explicit: Optional[bool] = Field(vmanage_key="send-label-explicit") + as_override: Optional[bool] = Field(vmanage_key="as-override") + as_number: Optional[int] = Field(data_path=["allowas-in"], vmanage_key="as-number") + address_family: Optional[List[NeighborAddressFamily]] = Field(vmanage_key="address-family") class Config: allow_population_by_field_name = True @@ -192,12 +192,12 @@ class IPv6NeighborFamilyType(str, Enum): class IPv6NeighborAddressFamily(BaseModel): - family_type: IPv6NeighborFamilyType = Field(alias="family-type") - prefix_num: Optional[int] = Field(0, alias="prefix-num") - threshold: Optional[int] - restart: Optional[int] - warning_only: Optional[bool] = Field(False, alias="warning-only") - route_policy: Optional[List[RoutePolicy]] = Field(alias="route-policy") + family_type: IPv6NeighborFamilyType = Field(vmanage_key="family-type") + prefix_num: Optional[int] = Field(0, data_path=["maximum-prefixes"], vmanage_key="prefix-num") + threshold: Optional[int] = Field(data_path=["maximum-prefixes"]) + restart: Optional[int] = Field(data_path=["maximum-prefixes"]) + warning_only: Optional[bool] = Field(False, data_path=["maximum-prefixes"], vmanage_key="warning-only") + route_policy: Optional[List[RoutePolicy]] = Field(vmanage_key="route-policy") class Config: allow_population_by_field_name = True @@ -207,20 +207,20 @@ class Ipv6Neighbor(BaseModel): address: str description: Optional[str] shutdown: Optional[bool] - remote_as: int = Field(alias="remote-as") - keepalive: Optional[int] - holdtime: Optional[int] - if_name: Optional[str] = Field(alias="if-name") - next_hop_self: Optional[bool] = Field(False, alias="next-hop-self") - send_community: Optional[bool] = Field(True, alias="send-community") - send_ext_community: Optional[bool] = Field(True, alias="send-ext-community") - ebgp_multihop: Optional[int] = Field(1, alias="ebgp-multihop") + remote_as: int = Field(vmanage_key="remote-as") + keepalive: Optional[int] = Field(data_path=["timers"]) + holdtime: Optional[int] = Field(data_path=["timers"]) + if_name: Optional[str] = Field(data_path=["update-source"], vmanage_key="if-name") + next_hop_self: Optional[bool] = Field(False, vmanage_key="next-hop-self") + send_community: Optional[bool] = Field(True, vmanage_key="send-community") + send_ext_community: Optional[bool] = Field(True, vmanage_key="send-ext-community") + ebgp_multihop: Optional[int] = Field(1, vmanage_key="ebgp-multihop") password: Optional[str] - send_label: Optional[bool] = Field(False, alias="send-label") - send_label_explicit: Optional[bool] = Field(False, alias="send-label-explicit") - as_override: Optional[bool] = Field(False, alias="as-override") - as_number: Optional[int] = Field(alias="as-number") - address_family: Optional[List[IPv6NeighborAddressFamily]] = Field(alias="address-family") + send_label: Optional[bool] = Field(False, vmanage_key="send-label") + send_label_explicit: Optional[bool] = Field(False, vmanage_key="send-label-explicit") + as_override: Optional[bool] = Field(False, vmanage_key="as-override") + as_number: Optional[int] = Field(data_path=["allowas-in"], vmanage_key="as-number") + address_family: Optional[List[IPv6NeighborAddressFamily]] = Field(vmanage_key="address-family") class Config: allow_population_by_field_name = True @@ -244,32 +244,32 @@ class Config: arbitrary_types_allowed = True allow_population_by_field_name = True - as_num: Optional[str] = Field(alias="as-num") - shutdown: Optional[bool] - router_id: Optional[str] = Field(alias="router-id") - propagate_aspath: Optional[bool] = Field(alias="propagate-aspath") - propagate_community: Optional[bool] = Field(alias="propagate-community") - route_target_ipv4: List[RouteTargetIpv4] = Field([], alias="route-target-ipv4") - route_target_ipv6: List[RouteTargetIpv6] = Field([], alias="route-target-ipv6") - mpls_interface: Optional[List[MplsInterface]] = Field(alias="mpls-interface") - external: Optional[int] - internal: Optional[int] - local: Optional[int] - keepalive: Optional[int] - holdtime: Optional[int] - always_compare: Optional[bool] = Field(alias="always-compare") - deterministic: Optional[bool] - missing_as_worst: Optional[bool] = Field(alias="missing-as-worst") - compare_router_id: Optional[bool] = Field(alias="compare-router-id") - multipath_relax: Optional[bool] = Field(alias="multipath-relax") - address_family: Optional[List[AddressFamily]] = Field(alias="address-family") - neighbor: Optional[List[Neighbor]] - ipv6_neighbor: Optional[List[Ipv6Neighbor]] = Field(alias="ipv6-neighbor") + as_num: Optional[str] = Field(data_path=["bgp"], vmanage_key="as-num") + shutdown: Optional[bool] = Field(data_path=["bgp"]) + router_id: Optional[str] = Field(data_path=["bgp"], vmanage_key="router-id") + propagate_aspath: Optional[bool] = Field(data_path=["bgp"], vmanage_key="propagate-aspath") + propagate_community: Optional[bool] = Field(data_path=["bgp"], vmanage_key="propagate-community") + route_target_ipv4: List[RouteTargetIpv4] = Field([], data_path=["bgp", "target"], vmanage_key="route-target-ipv4") + route_target_ipv6: List[RouteTargetIpv6] = Field([], data_path=["bgp", "target"], vmanage_key="route-target-ipv6") + mpls_interface: Optional[List[MplsInterface]] = Field(data_path=["bgp"], vmanage_key="mpls-interface") + external: Optional[int] = Field(data_path=["bgp", "distance"]) + internal: Optional[int] = Field(data_path=["bgp", "distance"]) + local: Optional[int] = Field(data_path=["bgp", "distance"]) + keepalive: Optional[int] = Field(data_path=["bgp", "timers"]) + holdtime: Optional[int] = Field(data_path=["bgp", "timers"]) + always_compare: Optional[bool] = Field(data_path=["bgp", "best-path", "med"], vmanage_key="always-compare") + deterministic: Optional[bool] = Field(data_path=["bgp", "best-path", "med"]) + missing_as_worst: Optional[bool] = Field(data_path=["bgp", "best-path", "med"], vmanage_key="missing-as-worst") + compare_router_id: Optional[bool] = Field(data_path=["bgp", "best-path"], vmanage_key="compare-router-id") + multipath_relax: Optional[bool] = Field(data_path=["bgp", "best-path", "as-path"], vmanage_key="multipath-relax") + address_family: Optional[List[AddressFamily]] = Field(data_path=["bgp"], vmanage_key="address-family") + neighbor: Optional[List[Neighbor]] = Field(data_path=["bgp"]) + ipv6_neighbor: Optional[List[Ipv6Neighbor]] = Field(data_path=["bgp"], vmanage_key="ipv6-neighbor") payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED" type: ClassVar[str] = "cisco_bgp" - @validator("shutdown") + @validator("shutdown", "deterministic", "missing_as_worst", "compare_router_id", "multipath_relax") def cast_to_str(cls, value): if value is not None: return str(value).lower() diff --git a/vmngclient/api/templates/models/cisco_logging_model.py b/vmngclient/api/templates/models/cisco_logging_model.py index b4579f826..86d018bee 100644 --- a/vmngclient/api/templates/models/cisco_logging_model.py +++ b/vmngclient/api/templates/models/cisco_logging_model.py @@ -23,9 +23,9 @@ class AuthType(str, Enum): class TlsProfile(ConvertBoolToStringModel): profile: str - version: Optional[Version] = Version.TLSV11 - auth_type: AuthType = Field(alias="auth-type") - ciphersuite_list: Optional[List] = Field(alias="ciphersuite-list") + version: Optional[Version] = Field(Version.TLSV11, data_path=["tls-version"]) + auth_type: AuthType = Field(vmanage_key="auth-type") + ciphersuite_list: Optional[List] = Field(data_path=["ciphersuite"], vmanage_key="ciphersuite-list") class Config: allow_population_by_field_name = True @@ -45,11 +45,11 @@ class Priority(str, Enum): class Server(ConvertBoolToStringModel): name: str vpn: Optional[int] - source_interface: Optional[str] = Field(alias="source-interface") + source_interface: Optional[str] = Field(vmanage_key="source-interface") priority: Optional[Priority] = Priority.INFORMATION - enable_tls: Optional[bool] = Field(False, alias="enable-tls") - custom_profile: Optional[bool] = Field(False, alias="custom-profile") - profile: Optional[str] + enable_tls: Optional[bool] = Field(False, data_path=["tls"], vmanage_key="enable-tls") + custom_profile: Optional[bool] = Field(False, data_path=["tls", "tls-properties"], vmanage_key="custom-profile") + profile: Optional[str] = Field(data_path=["tls", "tls-properties"]) class Config: allow_population_by_field_name = True @@ -58,11 +58,11 @@ class Config: class Ipv6Server(ConvertBoolToStringModel): name: str vpn: Optional[int] - source_interface: Optional[str] = Field(alias="source-interface") + source_interface: Optional[str] = Field(vmanage_key="source-interface") priority: Optional[Priority] = Priority.INFORMATION - enable_tls: Optional[bool] = Field(False, alias="enable-tls") - custom_profile: Optional[bool] = Field(False, alias="custom-profile") - profile: Optional[str] + enable_tls: Optional[bool] = Field(False, data_path=["tls"], vmanage_key="enable-tls") + custom_profile: Optional[bool] = Field(False, data_path=["tls", "tls-properties"], vmanage_key="custom-profile") + profile: Optional[str] = Field(data_path=["tls", "tls-properties"]) class Config: allow_population_by_field_name = True @@ -73,12 +73,12 @@ class Config: arbitrary_types_allowed = True allow_population_by_field_name = True - enable: Optional[bool] = True - size: Optional[int] = DEFAULT_LOGGING_SIZE - rotate: Optional[int] = DEFAULT_LOGGING_ROTATE - tls_profile: List[TlsProfile] = Field(alias="tls-profile") + enable: Optional[bool] = Field(True, data_path=["disk"]) + size: Optional[int] = Field(DEFAULT_LOGGING_SIZE, data_path=["disk", "file"]) + rotate: Optional[int] = Field(DEFAULT_LOGGING_ROTATE, data_path=["disk", "file"]) + tls_profile: List[TlsProfile] = Field(vmanage_key="tls-profile") server: Optional[List[Server]] - ipv6_server: Optional[List[Ipv6Server]] = Field(alias="ipv6-server") + ipv6_server: Optional[List[Ipv6Server]] = Field(vmanage_key="ipv6-server") payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED" type: ClassVar[str] = "cisco_logging" diff --git a/vmngclient/api/templates/models/cisco_ntp_model.py b/vmngclient/api/templates/models/cisco_ntp_model.py index 6e60d7dce..7a1012c45 100644 --- a/vmngclient/api/templates/models/cisco_ntp_model.py +++ b/vmngclient/api/templates/models/cisco_ntp_model.py @@ -4,9 +4,10 @@ from pydantic import BaseModel, Field from vmngclient.api.templates.feature_template import FeatureTemplate +from vmngclient.utils.pydantic_validators import ConvertBoolToStringModel -class Server(BaseModel): +class Server(ConvertBoolToStringModel): class Config: allow_population_by_field_name = True @@ -14,7 +15,7 @@ class Config: key: Optional[int] = Field(default=None) vpn: Optional[int] = Field(default=0) version: Optional[int] = Field(default=4) - source_interface: Optional[str] = Field(alias="source-interface", default=None) + source_interface: Optional[str] = Field(vmanage_key="source-interface", default=None) prefer: Optional[bool] = Field(default=False) @@ -26,17 +27,17 @@ class Config: md5: str -class CiscoNTPModel(FeatureTemplate): +class CiscoNTPModel(FeatureTemplate, ConvertBoolToStringModel): class Config: arbitrary_types_allowed = True allow_population_by_field_name = True server: List[Server] = Field(default=[]) - authentication: List[Authentication] = Field(default=[]) - trusted: List[int] = Field(default=[]) - enable: Optional[bool] = Field(default=False) - stratum: Optional[int] = Field(default=None) - source: Optional[str] = Field(default=None) + authentication: List[Authentication] = Field(default=[], data_path=["keys"]) + trusted: List[int] = Field(default=[], data_path=["keys"]) + enable: Optional[bool] = Field(default=False, data_path=["master"]) + stratum: Optional[int] = Field(default=None, data_path=["master"]) + source: Optional[str] = Field(default=None, data_path=["master"]) payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED" type: ClassVar[str] = "cisco_ntp" diff --git a/vmngclient/api/templates/models/cisco_omp_model.py b/vmngclient/api/templates/models/cisco_omp_model.py index 1cf80bbb1..86812ed39 100644 --- a/vmngclient/api/templates/models/cisco_omp_model.py +++ b/vmngclient/api/templates/models/cisco_omp_model.py @@ -69,23 +69,27 @@ class Config: arbitrary_types_allowed = True allow_population_by_field_name = True - graceful_restart: Optional[bool] = Field(True, alias="graceful-restart") - overlay_as: Optional[int] = Field(alias="overlay-as") - send_path_limit: Optional[int] = Field(DEFAULT_OMP_SENDPATH_LIMIT, alias="send-path-limit") - ecmp_limit: Optional[int] = Field(DEFAULT_OMP_ECMP_LIMIT, alias="ecmp-limit") + graceful_restart: Optional[bool] = Field(True, vmanage_key="graceful-restart") + overlay_as: Optional[int] = Field(vmanage_key="overlay-as") + send_path_limit: Optional[int] = Field(DEFAULT_OMP_SENDPATH_LIMIT, vmanage_key="send-path-limit") + ecmp_limit: Optional[int] = Field(DEFAULT_OMP_ECMP_LIMIT, vmanage_key="ecmp-limit") shutdown: Optional[bool] - omp_admin_distance_ipv4: Optional[int] = Field(alias="omp-admin-distance-ipv4") - omp_admin_distance_ipv6: Optional[int] = Field(alias="omp-admin-distance-ipv6") - advertisement_interval: Optional[int] = Field(DEFAULT_OMP_ADVERTISEMENT_INTERVAL, alias="advertisement-interval") - graceful_restart_timer: Optional[int] = Field(DEFAULT_OMP_GRACEFUL_RESTART_TIMER, alias="graceful-restart-timer") - eor_timer: Optional[int] = Field(DEFAULT_OMP_EOR_TIMER, alias="eor-timer") - holdtime: Optional[int] = DEFAULT_OMP_HOLDTIME + omp_admin_distance_ipv4: Optional[int] = Field(vmanage_key="omp-admin-distance-ipv4") + omp_admin_distance_ipv6: Optional[int] = Field(vmanage_key="omp-admin-distance-ipv6") + advertisement_interval: Optional[int] = Field( + DEFAULT_OMP_ADVERTISEMENT_INTERVAL, vmanage_key="advertisement-interval", data_path=["timers"] + ) + graceful_restart_timer: Optional[int] = Field( + DEFAULT_OMP_GRACEFUL_RESTART_TIMER, vmanage_key="graceful-restart-timer", data_path=["timers"] + ) + eor_timer: Optional[int] = Field(DEFAULT_OMP_EOR_TIMER, vmanage_key="eor-timer", data_path=["timers"]) + holdtime: Optional[int] = Field(DEFAULT_OMP_HOLDTIME, data_path=["timers"]) advertise: Optional[List[IPv4Advertise]] - ipv6_advertise: Optional[List[IPv6Advertise]] = Field(alias="ipv6-advertise") - ignore_region_path_length: Optional[bool] = Field(False, alias="ignore-region-path-length") - transport_gateway: Optional[TransportGateway] = Field(alias="transport-gateway") - site_types: Optional[List[SiteTypes]] = Field(alias="site-types") - auto_translate: Optional[bool] = Field(False, alias="auto-translate") + ipv6_advertise: Optional[List[IPv6Advertise]] = Field(vmanage_key="ipv6-advertise") + ignore_region_path_length: Optional[bool] = Field(False, vmanage_key="ignore-region-path-length") + transport_gateway: Optional[TransportGateway] = Field(vmanage_key="transport-gateway") + site_types: Optional[List[SiteTypes]] = Field(vmanage_key="site-types") + auto_translate: Optional[bool] = Field(False, vmanage_key="auto-translate") payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED" type: ClassVar[str] = "cisco_omp" diff --git a/vmngclient/api/templates/models/cisco_ospf.py b/vmngclient/api/templates/models/cisco_ospf.py index 1f70b9500..420ebae93 100644 --- a/vmngclient/api/templates/models/cisco_ospf.py +++ b/vmngclient/api/templates/models/cisco_ospf.py @@ -6,7 +6,7 @@ from pydantic import Field from vmngclient.api.templates.feature_template import FeatureTemplate -from vmngclient.utils.pydantic_validators import ConvertBoolToStringModel +from vmngclient.utils.pydantic_validators import ConvertBoolToStringModel, ConvertIPToStringModel DEFAULT_OSPF_HELLO_INTERVAL = 10 DEFAULT_OSPF_DEAD_INTERVAL = 40 @@ -37,7 +37,7 @@ class Protocol(str, Enum): class Redistribute(ConvertBoolToStringModel): protocol: Protocol - route_policy: Optional[str] = Field(alias="route-policy") + route_policy: Optional[str] = Field(vmanage_key="route-policy") dia: Optional[bool] = True class Config: @@ -50,7 +50,7 @@ class AdType(str, Enum): class RouterLsa(ConvertBoolToStringModel): - ad_type: AdType = Field(alias="ad-type") + ad_type: AdType = Field(vmanage_key="ad-type") time: int class Config: @@ -63,7 +63,7 @@ class Direction(str, Enum): class RoutePolicy(ConvertBoolToStringModel): direction: Direction - pol_name: str = Field(alias="pol-name") + pol_name: str = Field(vmanage_key="pol-name") class Config: allow_population_by_field_name = True @@ -84,34 +84,36 @@ class Type(str, Enum): class Interface(ConvertBoolToStringModel): name: str - hello_interval: Optional[int] = Field(DEFAULT_OSPF_DEAD_INTERVAL, alias="hello-interval") - dead_interval: Optional[int] = Field(DEFAULT_OSPF_DEAD_INTERVAL, alias="dead-interval") - retransmit_interval: Optional[int] = Field(DEFAULT_OSPF_RETRANSMIT_INTERVAL, alias="retransmit-interval") + hello_interval: Optional[int] = Field(DEFAULT_OSPF_DEAD_INTERVAL, vmanage_key="hello-interval") + dead_interval: Optional[int] = Field(DEFAULT_OSPF_DEAD_INTERVAL, vmanage_key="dead-interval") + retransmit_interval: Optional[int] = Field(DEFAULT_OSPF_RETRANSMIT_INTERVAL, vmanage_key="retransmit-interval") cost: Optional[int] priority: Optional[int] = DEFAULT_OSPF_INTERFACE_PRIORITY network: Optional[Network] = Network.BROADCAST - passive_interface: Optional[bool] = Field(False, alias="passive-interface") - type: Optional[Type] - message_digest_key: Optional[int] = Field(alias="message-digest-key") - md5: Optional[str] + passive_interface: Optional[bool] = Field(False, vmanage_key="passive-interface") + type: Optional[Type] = Field(data_path=["authentication"]) + message_digest_key: Optional[int] = Field( + vmanage_key="message-digest-key", data_path=["authentication", "message-digest"] + ) + md5: Optional[str] = Field(data_path=["authentication", "message-digest"]) class Config: allow_population_by_field_name = True -class Range(ConvertBoolToStringModel): +class Range(ConvertBoolToStringModel, ConvertIPToStringModel): address: ipaddress.IPv4Interface cost: Optional[int] - no_advertise: Optional[bool] = Field(False, alias="no-advertise") + no_advertise: Optional[bool] = Field(False, vmanage_key="no-advertise") class Config: allow_population_by_field_name = True class Area(ConvertBoolToStringModel): - a_num: int = Field(alias="a-num") - stub_no_summary: Optional[bool] = Field(vmanage_key="no-summary", data_path=["stub", "no_summary"]) - nssa_no_summary: Optional[bool] = Field(vmanage_key="no-summary") + a_num: int = Field(vmanage_key="a-num") + stub: Optional[bool] = Field(vmanage_key="no-summary", data_path=["stub"]) + nssa: Optional[bool] = Field(vmanage_key="no-summary", data_path=["nssa"]) interface: Optional[List[Interface]] range: Optional[List[Range]] @@ -124,23 +126,29 @@ class Config: arbitrary_types_allowed = True allow_population_by_field_name = True - router_id: Optional[ipaddress.IPv4Address] = Field(alias="router-id") - reference_bandwidth: Optional[int] = Field(DEFAULT_OSPF_REFERENCE_BANDWIDTH, alias="reference-bandwidth") - rfc1583: Optional[bool] = True - originate: Optional[bool] - always: Optional[bool] - metric: Optional[int] - metric_type: Optional[MetricType] = Field(alias="metric-type") - external: Optional[int] = DEFAULT_OSPF_EXTERNAL - inter_area: Optional[int] = Field(DEFAULT_OSPF_INTER_AREA, alias="inter-area") - intra_area: Optional[int] = Field(DEFAULT_OSPF_INTRA_AREA, alias="intra-area") - delay: Optional[int] = DEFAULT_OSPF_DELAY - initial_hold: Optional[int] = Field(DEFAULT_OSPF_INITIAL_HOLD, alias="initial-hold") - max_hold: Optional[int] = Field(DEFAULT_OSPF_MAX_HOLD, alias="max-hold") - redistribute: Optional[List[Redistribute]] - router_lsa: Optional[List[RouterLsa]] = Field(alias="router-lsa") - route_policy: Optional[List[RoutePolicy]] = Field(alias="route-policy") - area: Optional[List[Area]] + router_id: Optional[str] = Field(vmanage_key="router-id", data_path=["ospf"]) + reference_bandwidth: Optional[int] = Field( + DEFAULT_OSPF_REFERENCE_BANDWIDTH, data_path=["ospf", "auto-cost"], vmanage_key="reference-bandwidth" + ) + rfc1583: Optional[bool] = Field(True, data_path=["ospf", "compatible"]) + originate: Optional[bool] = Field(data_path=["ospf", "default-information"]) + always: Optional[bool] = Field(data_path=["ospf", "default-information", "originate"]) + metric: Optional[int] = Field(data_path=["ospf", "default-information", "originate"]) + metric_type: Optional[MetricType] = Field( + vmanage_key="metric-type", data_path=["ospf", "default-information", "originate"] + ) + external: Optional[int] = Field(DEFAULT_OSPF_EXTERNAL, data_path=["ospf", "distance"]) + inter_area: Optional[int] = Field(DEFAULT_OSPF_INTER_AREA, data_path=["ospf", "distance"], vmanage_key="inter-area") + intra_area: Optional[int] = Field(DEFAULT_OSPF_INTRA_AREA, data_path=["ospf", "distance"], vmanage_key="intra-area") + delay: Optional[int] = Field(DEFAULT_OSPF_DELAY, data_path=["ospf", "timers", "spf"]) + initial_hold: Optional[int] = Field( + DEFAULT_OSPF_INITIAL_HOLD, vmanage_key="initial-hold", data_path=["ospf", "timers", "spf"] + ) + max_hold: Optional[int] = Field(DEFAULT_OSPF_MAX_HOLD, vmanage_key="max-hold", data_path=["ospf", "timers", "spf"]) + redistribute: Optional[List[Redistribute]] = Field(vmanage_key="redistribute", data_path=["ospf"]) + router_lsa: Optional[List[RouterLsa]] = Field(vmanage_key="router-lsa", data_path=["ospf", "max-metric"]) + route_policy: Optional[List[RoutePolicy]] = Field(vmanage_key="route-policy", data_path=["ospf"]) + area: Optional[List[Area]] = Field(vmanage_key="area", data_path=["ospf"]) payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED" type: ClassVar[str] = "cisco_ospf" diff --git a/vmngclient/api/templates/models/cisco_ospfv3.py b/vmngclient/api/templates/models/cisco_ospfv3.py new file mode 100644 index 000000000..3b1f7f42f --- /dev/null +++ b/vmngclient/api/templates/models/cisco_ospfv3.py @@ -0,0 +1,320 @@ +import ipaddress +from enum import Enum +from pathlib import Path +from typing import ClassVar, List, Optional + +from pydantic import BaseModel, Field + +from vmngclient.api.templates.feature_template import FeatureTemplate +from vmngclient.utils.pydantic_validators import ConvertBoolToStringModel, ConvertIPToStringModel + + +class MetricType(str, Enum): + TYPE1 = "type1" + TYPE2 = "type2" + + +class Protocol(str, Enum): + BGP = "bgp" + CONNECTED = "connected" + EIGRP = "eigrp" + ISIS = "isis" + LISP = "lisp" + NAT_ROUTE = "nat-route" + OMP = "omp" + STATIC = "static" + + +class Redistribute(ConvertBoolToStringModel): + protocol: Protocol + route_policy: Optional[str] = Field(vmanage_key="route-policy") + dia: Optional[bool] = True + + class Config: + allow_population_by_field_name = True + + +class AdType(str, Enum): + ON_STARTUP = "on-startup" + + +class RouterLsa(BaseModel): + ad_type: AdType = Field(vmanage_key="ad-type") + time: int + + class Config: + allow_population_by_field_name = True + + +class Translate(str, Enum): + ALWAYS = "always" + + +class Network(str, Enum): + BROADCAST = "broadcast" + POINT_TO_POINT = "point-to-point" + NON_BROADCAST = "non-broadcast" + POINT_TO_MULTIPOINT = "point-to-multipoint" + + +class Type(str, Enum): + MD5 = "md5" + SHA1 = "sha1" + + +class Interface(BaseModel): + name: str + hello_interval: Optional[int] = Field(10, vmanage_key="hello-interval") + dead_interval: Optional[int] = Field(40, vmanage_key="dead-interval") + retransmit_interval: Optional[int] = Field(5, vmanage_key="retransmit-interval") + cost: Optional[int] + network: Optional[Network] = Network.BROADCAST + passive_interface: Optional[bool] = Field(False, vmanage_key="passive-interface") + type: Type = Field(data_path=["authentication"]) + authentication_key: str = Field(vmanage_key="authentication-key", data_path=["authentication"]) + spi: Optional[int] = Field(data_path=["authentication", "ipsec"]) + + class Config: + allow_population_by_field_name = True + + +class Range(BaseModel): + address: ipaddress.IPv4Interface + cost: Optional[int] + no_advertise: Optional[bool] = Field(False, vmanage_key="no-advertise") + + class Config: + allow_population_by_field_name = True + + +class Area(ConvertBoolToStringModel): + a_num: int = Field(vmanage_key="a-num") + stub: Optional[bool] = Field(vmanage_key="no-summary", data_path=["stub"]) + nssa: Optional[bool] = Field(vmanage_key="no-summary", data_path=["nssa"]) + translate: Optional[Translate] = Field(data_path=["nssa"]) + normal: Optional[bool] + interface: Optional[List[Interface]] + range: Optional[List[Range]] + + class Config: + allow_population_by_field_name = True + + +class RedistributeV6(BaseModel): + protocol: Protocol + route_policy: Optional[str] = Field(vmanage_key="route-policy") + + class Config: + allow_population_by_field_name = True + + +class InterfaceV6(BaseModel): + name: str + hello_interval: Optional[int] = Field(10, vmanage_key="hello-interval") + dead_interval: Optional[int] = Field(40, vmanage_key="dead-interval") + retransmit_interval: Optional[int] = Field(5, vmanage_key="retransmit-interval") + cost: Optional[int] + network: Optional[Network] = Network.BROADCAST + passive_interface: Optional[bool] = Field(False, vmanage_key="passive-interface") + type: Type = Field(data_path=["authentication"]) + authentication_key: str = Field(vmanage_key="authentication-key", data_path=["authentication"]) + spi: Optional[int] = Field(data_path=["authentication", "ipsec"]) + + class Config: + allow_population_by_field_name = True + + +class RangeV6(BaseModel): + address: ipaddress.IPv6Interface + cost: Optional[int] + no_advertise: Optional[bool] = Field(False, vmanage_key="no-advertise") + + class Config: + allow_population_by_field_name = True + + +class AreaV6(ConvertBoolToStringModel): + a_num: int = Field(vmanage_key="a-num") + stub: Optional[bool] = Field(vmanage_key="no-summary", data_path=["stub"]) + nssa: Optional[bool] = Field(vmanage_key="no-summary", data_path=["nssa"]) + translate: Optional[Translate] = Field(data_path=["nssa"]) + normal: Optional[bool] + interface: Optional[List[InterfaceV6]] + range: Optional[List[RangeV6]] + + class Config: + allow_population_by_field_name = True + + +class CiscoOspfv3Model(FeatureTemplate, ConvertIPToStringModel, ConvertBoolToStringModel): + class Config: + arbitrary_types_allowed = True + allow_population_by_field_name = True + + router_id_v4: Optional[ipaddress.IPv4Address] = Field( + vmanage_key="router-id", data_path=["ospfv3", "address-family", "ipv4"] + ) + reference_bandwidth_v4: Optional[int] = Field( + 100, + vmanage_key="reference-bandwidth", + data_path=["ospfv3", "address-family", "ipv4", "auto-cost"], + ) + rfc1583_v4: Optional[bool] = Field( + True, vmanage_key="rfc1583", data_path=["ospfv3", "address-family", "ipv4", "compatible"] + ) + originate_v4: Optional[bool] = Field( + vmanage_key="originate", data_path=["ospfv3", "address-family", "ipv4", "default-information"] + ) + always_v4: Optional[bool] = Field( + vmanage_key="always", + data_path=[ + "ospfv3", + "address-family", + "ipv4", + "default-information", + "originate", + ], + ) + metric_v4: Optional[int] = Field( + vmanage_key="metric", + data_path=[ + "ospfv3", + "address-family", + "ipv4", + "default-information", + "originate", + ], + ) + metric_type_v4: Optional[MetricType] = Field( + vmanage_key="metric-type", + data_path=[ + "ospfv3", + "address-family", + "ipv4", + "default-information", + "originate", + ], + ) + external_v4: Optional[int] = Field( + 110, vmanage_key="external", data_path=["ospfv3", "address-family", "ipv4", "distance-ipv4", "ospf"] + ) + inter_area_v4: Optional[int] = Field( + 110, + vmanage_key="inter-area", + data_path=["ospfv3", "address-family", "ipv4", "distance-ipv4", "ospf"], + ) + intra_area_v4: Optional[int] = Field( + 110, + vmanage_key="intra-area", + data_path=["ospfv3", "address-family", "ipv4", "distance-ipv4", "ospf"], + ) + delay_v4: Optional[int] = Field( + 200, vmanage_key="delay", data_path=["ospfv3", "address-family", "ipv4", "timers", "throttle", "spf"] + ) + initial_hold_v4: Optional[int] = Field( + 1000, + vmanage_key="initial-hold", + data_path=["ospfv3", "address-family", "ipv4", "timers", "throttle", "spf"], + ) + max_hold_v4: Optional[int] = Field( + 10000, + vmanage_key="max-hold", + data_path=["ospfv3", "address-family", "ipv4", "timers", "throttle", "spf"], + ) + distance_v4: Optional[int] = Field( + 110, vmanage_key="distance", data_path=["ospfv3", "address-family", "ipv4", "distance-ipv4"] + ) + name_v4: Optional[str] = Field(vmanage_key="name", data_path=["ospfv3", "address-family", "ipv4", "table-map"]) + filter_v4: Optional[bool] = Field(vmanage_key="filter", data_path=["ospfv3", "address-family", "ipv4", "table-map"]) + redistribute_v4: Optional[List[Redistribute]] = Field( + vmanage_key="redistribute", data_path=["ospfv3", "address-family", "ipv4"] + ) + router_lsa_v4: Optional[List[RouterLsa]] = Field( + vmanage_key="router-lsa", data_path=["ospfv3", "address-family", "ipv4", "max-metric"] + ) + area_v4: Optional[List[Area]] = Field(vmanage_key="area", data_path=["ospfv3", "address-family", "ipv4"]) + router_id_v6: Optional[ipaddress.IPv4Address] = Field( + vmanage_key="router-id", data_path=["ospfv3", "address-family", "ipv6"] + ) + reference_bandwidth_v6: Optional[int] = Field( + 100, + vmanage_key="reference-bandwidth", + data_path=["ospfv3", "address-family", "ipv6", "auto-cost"], + ) + rfc1583_v6: Optional[bool] = Field( + True, vmanage_key="rfc1583", data_path=["ospfv3", "address-family", "ipv6", "compatible"] + ) + originate_v6: Optional[bool] = Field( + vmanage_key="originate", data_path=["ospfv3", "address-family", "ipv6", "default-information"] + ) + always_v6: Optional[bool] = Field( + vmanage_key="always", + data_path=[ + "ospfv3", + "address-family", + "ipv6", + "default-information", + "originate", + ], + ) + metric_v6: Optional[int] = Field( + vmanage_key="metric", + data_path=[ + "ospfv3", + "address-family", + "ipv6", + "default-information", + "originate", + ], + ) + metric_type_v6: Optional[MetricType] = Field( + vmanage_key="metric-type", + data_path=[ + "ospfv3", + "address-family", + "ipv6", + "default-information", + "originate", + ], + ) + external_v6: Optional[int] = Field( + 110, vmanage_key="external", data_path=["ospfv3", "address-family", "ipv6", "distance-ipv6", "ospf"] + ) + inter_area_v6: Optional[int] = Field( + 110, + vmanage_key="inter-area", + data_path=["ospfv3", "address-family", "ipv6", "distance-ipv6", "ospf"], + ) + intra_area_v6: Optional[int] = Field( + 110, + vmanage_key="intra-area", + data_path=["ospfv3", "address-family", "ipv6", "distance-ipv6", "ospf"], + ) + delay_v6: Optional[int] = Field( + 200, vmanage_key="delay", data_path=["ospfv3", "address-family", "ipv6", "timers", "throttle", "spf"] + ) + initial_hold_v6: Optional[int] = Field( + 1000, + vmanage_key="initial-hold", + data_path=["ospfv3", "address-family", "ipv6", "timers", "throttle", "spf"], + ) + max_hold_v6: Optional[int] = Field( + 10000, + vmanage_key="max-hold", + data_path=["ospfv3", "address-family", "ipv6", "timers", "throttle", "spf"], + ) + distance_v6: Optional[int] = Field( + 110, vmanage_key="distance", data_path=["ospfv3", "address-family", "ipv6", "distance-ipv6"] + ) + name_v6: Optional[str] = Field(vmanage_key="name", data_path=["ospfv3", "address-family", "ipv6", "table-map"]) + filter_v6: Optional[bool] = Field(vmanage_key="filter", data_path=["ospfv3", "address-family", "ipv6", "table-map"]) + redistribute_v6: Optional[List[RedistributeV6]] = Field( + vmanage_key="redistribute", data_path=["ospfv3", "address-family", "ipv6"] + ) + router_lsa_v6: Optional[List[RouterLsa]] = Field( + vmanage_key="router-lsa", data_path=["ospfv3", "address-family", "ipv6", "max-metric"] + ) + area_v6: Optional[List[AreaV6]] = Field(vmanage_key="area", data_path=["ospfv3", "address-family", "ipv6"]) + + payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED" + type: ClassVar[str] = "cisco_ospfv3" diff --git a/vmngclient/api/templates/models/cisco_secure_internet_gateway.py b/vmngclient/api/templates/models/cisco_secure_internet_gateway.py index 4a297647e..61b0e52bc 100644 --- a/vmngclient/api/templates/models/cisco_secure_internet_gateway.py +++ b/vmngclient/api/templates/models/cisco_secure_internet_gateway.py @@ -74,37 +74,41 @@ class PerfectForwardSecrecy(str, Enum): class Interface(ConvertIPToStringModel): - if_name: str = Field(alias="if-name") + if_name: str = Field(vmanage_key="if-name") auto: bool shutdown: bool description: Optional[str] unnumbered: bool = True address: Optional[ipaddress.IPv4Interface] - tunnel_source: ipaddress.IPv4Address = Field(alias="tunnel-source") - tunnel_source_interface: str = Field(alias="tunnel-source-interface") - tunnel_route_via: str = Field(alias="tunnel-route-via") - tunnel_destination: str = Field(alias="tunnel-destination") + tunnel_source: ipaddress.IPv4Address = Field(vmanage_key="tunnel-source") + tunnel_source_interface: str = Field(vmanage_key="tunnel-source-interface") + tunnel_route_via: str = Field(vmanage_key="tunnel-route-via") + tunnel_destination: str = Field(vmanage_key="tunnel-destination") application: Application = Application.SIG - tunnel_set: TunnelSet = Field(TunnelSet.SECURE_INTERNET_GATEWAY_UMBRELLA, alias="tunnel-set") - tunnel_dc_preference: TunnelDcPreference = Field(TunnelDcPreference.PRIMARY_DC, alias="tunnel-dc-preference") - tcp_mss_adjust: Optional[int] = Field(alias="tcp-mss-adjust") + tunnel_set: TunnelSet = Field(TunnelSet.SECURE_INTERNET_GATEWAY_UMBRELLA, vmanage_key="tunnel-set") + tunnel_dc_preference: TunnelDcPreference = Field(TunnelDcPreference.PRIMARY_DC, vmanage_key="tunnel-dc-preference") + tcp_mss_adjust: Optional[int] = Field(vmanage_key="tcp-mss-adjust") mtu: int = DEFAULT_INTERFACE_MTU - dpd_interval: Optional[int] = Field(DEFAULT_INTERFACE_DPD_INTERVAL, alias="dpd-interval") - dpd_retries: Optional[int] = Field(DEFAULT_INTERFACE_DPD_RETRIES, alias="dpd-retries") - ike_version: int = Field(DEFAULT_INTERFACE_IKE_VERSION, alias="ike-version") - pre_shared_secret: Optional[str] = Field(alias="pre-shared-secret") - ike_rekey_interval: Optional[int] = Field(DEFAULT_INTERFACE_IKE_REKEY_INTERVAL, alias="ike-rekey-interval") - ike_ciphersuite: Optional[IkeCiphersuite] = Field(IkeCiphersuite.AES256_CBC_SHA1, alias="ike-ciphersuite") - ike_group: IkeGroup = Field(IkeGroup.FOURTEEN, alias="ike-group") - pre_shared_key_dynamic: bool = Field(True, alias="pre-shared-key-dynamic") - ike_local_id: Optional[str] = Field(alias="ike-local-id") - ike_remote_id: Optional[str] = Field(alias="ike-remote-id") - ipsec_rekey_interval: Optional[int] = Field(DEFAULT_INTERFACE_IPSEC_REKEY_INTERVAL, alias="ipsec-rekey-interval") - ipsec_replay_window: Optional[int] = Field(DEFAULT_INTERFACE_IPSEC_REPLAY_WINDOW, alias="ipsec-replay-window") - ipsec_ciphersuite: IpsecCiphersuite = Field(IpsecCiphersuite.AES256_GCM, alias="ipsec-ciphersuite") - perfect_forward_secrecy: PerfectForwardSecrecy = Field(PerfectForwardSecrecy.NONE, alias="perfect-forward-secrecy") + dpd_interval: Optional[int] = Field(DEFAULT_INTERFACE_DPD_INTERVAL, vmanage_key="dpd-interval") + dpd_retries: Optional[int] = Field(DEFAULT_INTERFACE_DPD_RETRIES, vmanage_key="dpd-retries") + ike_version: int = Field(DEFAULT_INTERFACE_IKE_VERSION, vmanage_key="ike-version") + pre_shared_secret: Optional[str] = Field(vmanage_key="pre-shared-secret") + ike_rekey_interval: Optional[int] = Field(DEFAULT_INTERFACE_IKE_REKEY_INTERVAL, vmanage_key="ike-rekey-interval") + ike_ciphersuite: Optional[IkeCiphersuite] = Field(IkeCiphersuite.AES256_CBC_SHA1, vmanage_key="ike-ciphersuite") + ike_group: IkeGroup = Field(IkeGroup.FOURTEEN, vmanage_key="ike-group") + pre_shared_key_dynamic: bool = Field(True, vmanage_key="pre-shared-key-dynamic") + ike_local_id: Optional[str] = Field(vmanage_key="ike-local-id") + ike_remote_id: Optional[str] = Field(vmanage_key="ike-remote-id") + ipsec_rekey_interval: Optional[int] = Field( + DEFAULT_INTERFACE_IPSEC_REKEY_INTERVAL, vmanage_key="ipsec-rekey-interval" + ) + ipsec_replay_window: Optional[int] = Field(DEFAULT_INTERFACE_IPSEC_REPLAY_WINDOW, vmanage_key="ipsec-replay-window") + ipsec_ciphersuite: IpsecCiphersuite = Field(IpsecCiphersuite.AES256_GCM, vmanage_key="ipsec-ciphersuite") + perfect_forward_secrecy: PerfectForwardSecrecy = Field( + PerfectForwardSecrecy.NONE, vmanage_key="perfect-forward-secrecy" + ) tracker: Optional[bool] - track_enable: Optional[bool] = Field(True, alias="track-enable") + track_enable: Optional[bool] = Field(True, vmanage_key="track-enable") class Config: allow_population_by_field_name = True @@ -115,13 +119,13 @@ class SvcType(str, Enum): class InterfacePair(BaseModel): - active_interface: str = Field(alias="active-interface") + active_interface: str = Field(vmanage_key="active-interface") active_interface_weight: int = Field( - DEFAULT_INTERFACE_PAIR_ACTIVE_INTERFACE_WEIGHT, alias="active-interface-weight" + DEFAULT_INTERFACE_PAIR_ACTIVE_INTERFACE_WEIGHT, vmanage_key="active-interface-weight" ) - backup_interface: Optional[str] = Field("None", alias="backup-interface") + backup_interface: Optional[str] = Field("None", vmanage_key="backup-interface") backup_interface_weight: int = Field( - DEFAULT_INTERFACE_PAIR_BACKUP_INTERFACE_WEIGHT, alias="backup-interface-weight" + DEFAULT_INTERFACE_PAIR_BACKUP_INTERFACE_WEIGHT, vmanage_key="backup-interface-weight" ) class Config: @@ -141,27 +145,27 @@ class RefreshTimeUnit(str, Enum): class Service(BaseModel): - svc_type: SvcType = Field(SvcType.SIG, alias="svc-type") - interface_pair: List[InterfacePair] = Field(alias="interface-pair") - auth_required: Optional[bool] = Field(False, alias="auth-required") - xff_forward_enabled: Optional[bool] = Field(False, alias="xff-forward-enabled") - ofw_enabled: Optional[bool] = Field(False, alias="ofw-enabled") - ips_control: Optional[bool] = Field(False, alias="ips-control") - caution_enabled: Optional[bool] = Field(False, alias="caution-enabled") - primary_data_center: Optional[str] = Field("Auto", alias="primary-data-center") - secondary_data_center: Optional[str] = Field("Auto", alias="secondary-data-center") + svc_type: SvcType = Field(SvcType.SIG, vmanage_key="svc-type") + interface_pair: List[InterfacePair] = Field(vmanage_key="interface-pair") + auth_required: Optional[bool] = Field(False, vmanage_key="auth-required") + xff_forward_enabled: Optional[bool] = Field(False, vmanage_key="xff-forward-enabled") + ofw_enabled: Optional[bool] = Field(False, vmanage_key="ofw-enabled") + ips_control: Optional[bool] = Field(False, vmanage_key="ips-control") + caution_enabled: Optional[bool] = Field(False, vmanage_key="caution-enabled") + primary_data_center: Optional[str] = Field("Auto", vmanage_key="primary-data-center") + secondary_data_center: Optional[str] = Field("Auto", vmanage_key="secondary-data-center") ip: Optional[bool] - idle_time: Optional[int] = Field(DEFAULT_SERVICE_IDLE_TIME, alias="idle-time") - display_time_unit: Optional[DisplayTimeUnit] = Field(DisplayTimeUnit.MINUTE, alias="display-time-unit") - ip_enforced_for_known_browsers: Optional[bool] = Field(False, alias="ip-enforced-for-known-browsers") - refresh_time: Optional[int] = Field(DEFAULT_SERVICE_REFRESH_TIME, alias="refresh-time") - refresh_time_unit: Optional[RefreshTimeUnit] = Field(RefreshTimeUnit.MINUTE, alias="refresh-time-unit") + idle_time: Optional[int] = Field(DEFAULT_SERVICE_IDLE_TIME, vmanage_key="idle-time") + display_time_unit: Optional[DisplayTimeUnit] = Field(DisplayTimeUnit.MINUTE, vmanage_key="display-time-unit") + ip_enforced_for_known_browsers: Optional[bool] = Field(False, vmanage_key="ip-enforced-for-known-browsers") + refresh_time: Optional[int] = Field(DEFAULT_SERVICE_REFRESH_TIME, vmanage_key="refresh-time") + refresh_time_unit: Optional[RefreshTimeUnit] = Field(RefreshTimeUnit.MINUTE, vmanage_key="refresh-time-unit") enabled: Optional[bool] - block_internet_until_accepted: Optional[bool] = Field(False, alias="block-internet-until-accepted") - force_ssl_inspection: Optional[bool] = Field(False, alias="force-ssl-inspection") + block_internet_until_accepted: Optional[bool] = Field(False, vmanage_key="block-internet-until-accepted") + force_ssl_inspection: Optional[bool] = Field(False, vmanage_key="force-ssl-inspection") timeout: Optional[int] - data_center_primary: Optional[str] = Field("Auto", alias="data-center-primary") - data_center_secondary: Optional[str] = Field("Auto", alias="data-center-secondary") + data_center_primary: Optional[str] = Field("Auto", vmanage_key="data-center-primary") + data_center_secondary: Optional[str] = Field("Auto", vmanage_key="data-center-secondary") class Config: allow_population_by_field_name = True @@ -173,11 +177,11 @@ class TrackerType(str, Enum): class Tracker(BaseModel): name: str - endpoint_api_url: str = Field(alias="endpoint-api-url") + endpoint_api_url: str = Field(vmanage_key="endpoint-api-url") threshold: Optional[int] = DEFAULT_TRACKER_THRESHOLD interval: Optional[int] = DEFAULT_TRACKER_INTERVAL multiplier: Optional[int] = DEFAULT_TRACKER_MULTIPLIER - tracker_type: TrackerType = Field(alias="tracker-type") + tracker_type: TrackerType = Field(vmanage_key="tracker-type") class Config: allow_population_by_field_name = True @@ -188,10 +192,10 @@ class Config: arbitrary_types_allowed = True allow_population_by_field_name = True - vpn_id: int = Field(DEFAULT_SIG_VPN_ID, alias="vpn-id") + vpn_id: int = Field(DEFAULT_SIG_VPN_ID, vmanage_key="vpn-id") interface: List[Interface] service: List[Service] - tracker_src_ip: ipaddress.IPv4Interface = Field(alias="tracker-src-ip") + tracker_src_ip: ipaddress.IPv4Interface = Field(vmanage_key="tracker-src-ip") tracker: Optional[List[Tracker]] payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED" diff --git a/vmngclient/api/templates/models/cisco_snmp_model.py b/vmngclient/api/templates/models/cisco_snmp_model.py index d69c2f62d..372ba4bde 100644 --- a/vmngclient/api/templates/models/cisco_snmp_model.py +++ b/vmngclient/api/templates/models/cisco_snmp_model.py @@ -5,9 +5,10 @@ from pydantic import BaseModel, Field from vmngclient.api.templates.feature_template import FeatureTemplate +from vmngclient.utils.pydantic_validators import ConvertBoolToStringModel -class Oid(BaseModel): +class Oid(ConvertBoolToStringModel): id: str exclude: Optional[bool] @@ -35,7 +36,7 @@ class SecurityLevel(str, Enum): class Group(BaseModel): name: str - security_level: SecurityLevel = Field(alias="security-level") + security_level: SecurityLevel = Field(vmanage_key="security-level") view: str class Config: @@ -54,9 +55,9 @@ class Priv(str, Enum): class User(BaseModel): name: str auth: Optional[Auth] - auth_password: Optional[str] = Field(alias="auth-password") + auth_password: Optional[str] = Field(vmanage_key="auth-password") priv: Optional[Priv] - priv_password: Optional[str] = Field(alias="priv-password") + priv_password: Optional[str] = Field(vmanage_key="priv-password") group: str class Config: @@ -64,18 +65,18 @@ class Config: class Target(BaseModel): - vpn_id: int = Field(alias="vpn-id") + vpn_id: int = Field(vmanage_key="vpn-id") ip: str port: int - community_name: str = Field(alias="community-name") + community_name: str = Field(vmanage_key="community-name") user: str - source_interface: str = Field(alias="source-interface") + source_interface: str = Field(vmanage_key="source-interface") class Config: allow_population_by_field_name = True -class CiscoSNMPModel(FeatureTemplate): +class CiscoSNMPModel(FeatureTemplate, ConvertBoolToStringModel): class Config: arbitrary_types_allowed = True allow_population_by_field_name = True @@ -87,7 +88,7 @@ class Config: community: Optional[List[Community]] group: Optional[List[Group]] user: Optional[List[User]] - target: Optional[List[Target]] + target: Optional[List[Target]] = Field(data_path=["trap"]) payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED" type: ClassVar[str] = "cisco_snmp" diff --git a/vmngclient/api/templates/models/cisco_system.py b/vmngclient/api/templates/models/cisco_system.py index 212bdda82..8b3c46234 100644 --- a/vmngclient/api/templates/models/cisco_system.py +++ b/vmngclient/api/templates/models/cisco_system.py @@ -6,6 +6,7 @@ from vmngclient.api.templates.device_variable import DeviceVariable from vmngclient.api.templates.feature_template import FeatureTemplate +from vmngclient.utils.pydantic_validators import ConvertBoolToStringModel from vmngclient.utils.timezone import Timezone @@ -51,11 +52,12 @@ class Type(str, Enum): class Tracker(BaseModel): name: str - endpoint_ip: str = Field(alias="endpoint-ip") - protocol: Protocol - port: int - endpoint_dns_name: str = Field(alias="endpoint-dns-name") - endpoint_api_url: str = Field(alias="endpoint-api-url") + endpoint_ip: str = Field(vmanage_key="endpoint-ip") + endpoint_ip_transport_port: str = Field(vmanage_key="endpoint-ip", data_path=["endpoint-ip-transport-port"]) + protocol: Protocol = Field(data_path=["endpoint-ip-transport-port"]) + port: int = Field(data_path=["endpoint-ip-transport-port"]) + endpoint_dns_name: str = Field(vmanage_key="endpoint-dns-name") + endpoint_api_url: str = Field(vmanage_key="endpoint-api-url") elements: List[str] boolean: Optional[Boolean] = Boolean.OR threshold: Optional[int] = 300 @@ -72,7 +74,7 @@ class Object(BaseModel): class ObjectTrack(BaseModel): - object_number: int = Field(alias="object-number") + object_number: int = Field(vmanage_key="object-number") interface: str sig: str ip: str @@ -91,8 +93,8 @@ class Role(str, Enum): class AffinityPerVrf(BaseModel): - affinity_group_number: Optional[int] = Field(alias="affinity-group-number") - vrf_range: Optional[str] = Field(alias="vrf-range") + affinity_group_number: Optional[int] = Field(vmanage_key="affinity-group-number") + vrf_range: Optional[str] = Field(vmanage_key="vrf-range") class Config: allow_population_by_field_name = True @@ -104,8 +106,8 @@ class EnableMrfMigration(str, Enum): class Vrf(BaseModel): - vrf_id: int = Field(alias="vrf-id") - gateway_preference: Optional[List[int]] = Field(alias="gateway-preference") + vrf_id: int = Field(vmanage_key="vrf-id") + gateway_preference: Optional[List[int]] = Field(vmanage_key="gateway-preference") class Config: allow_population_by_field_name = True @@ -118,51 +120,58 @@ class Epfr(str, Enum): CONSERVATIVE = "conservative" -class CiscoSystemModel(FeatureTemplate): +class CiscoSystemModel(FeatureTemplate, ConvertBoolToStringModel): class Config: arbitrary_types_allowed = True allow_population_by_field_name = True - timezone: Optional[Timezone] - hostname: str = Field(default=DeviceVariable(name="system_host_name"), alias="host-name", validate_default=True) + timezone: Optional[Timezone] = Field(data_path=["clock"]) + hostname: str = Field( + default=DeviceVariable(name="system_host_name"), vmanage_key="host-name", validate_default=True + ) location: Optional[str] - latitude: Optional[float] - longitude: Optional[float] - range: Optional[int] = 100 - enable: Optional[bool] - mobile_number: Optional[List[MobileNumber]] = Field(alias="mobile-number") - device_groups: Optional[List[str]] = Field(alias="device-groups") - controller_group_list: Optional[List[int]] = Field(alias="controller-group-list") - system_ip: DeviceVariable = Field(default=DeviceVariable(name="system_system_ip"), alias="system-ip") - overlay_id: Optional[int] = Field(1, alias="overlay-id") - site_id: int = Field(default=DeviceVariable(name="system_site_id"), alias="site-id") - site_type: Optional[List[SiteType]] = Field(alias="site-type") - port_offset: Optional[int] = Field(alias="port-offset") - port_hop: Optional[bool] = Field(True, alias="port-hop") - control_session_pps: Optional[int] = Field(300, alias="control-session-pps") - track_transport: Optional[bool] = Field(True, alias="track-transport") - track_interface_tag: Optional[int] = Field(alias="track-interface-tag") - console_baud_rate: Optional[ConsoleBaudRate] = Field(alias="console-baud-rate") - max_omp_sessions: Optional[int] = Field(alias="max-omp-sessions") - multi_tenant: Optional[bool] = Field(alias="multi-tenant") - track_default_gateway: Optional[bool] = Field(True, alias="track-default-gateway") - admin_tech_on_failure: Optional[bool] = Field(alias="admin-tech-on-failure") - idle_timeout: Optional[int] = Field(alias="idle-timeout") + latitude: Optional[float] = Field(data_path=["gps-location"]) + longitude: Optional[float] = Field(data_path=["gps-location"]) + range: Optional[int] = Field(100, data_path=["gps-location", "geo-fencing"]) + enable_fencing: Optional[bool] = Field(False, data_path=["gps-location", "geo-fencing"], vmanage_key="enable") + mobile_number: Optional[List[MobileNumber]] = Field( + vmanage_key="mobile-number", data_path=["gps-location", "geo-fencing", "sms"] + ) + enable_sms: Optional[bool] = Field(False, data_path=["gps-location", "geo-fencing", "sms"], vmanage_key="enable") + device_groups: Optional[List[str]] = Field(vmanage_key="device-groups") + controller_group_list: Optional[List[int]] = Field(vmanage_key="controller-group-list") + system_ip: DeviceVariable = Field(default=DeviceVariable(name="system_system_ip"), vmanage_key="system-ip") + overlay_id: Optional[int] = Field(1, vmanage_key="overlay-id") + site_id: int = Field(default=DeviceVariable(name="system_site_id"), vmanage_key="site-id") + site_type: Optional[List[SiteType]] = Field(vmanage_key="site-type") + port_offset: Optional[int] = Field(vmanage_key="port-offset") + port_hop: Optional[bool] = Field(True, vmanage_key="port-hop") + control_session_pps: Optional[int] = Field(300, vmanage_key="control-session-pps") + track_transport: Optional[bool] = Field(True, vmanage_key="track-transport") + track_interface_tag: Optional[int] = Field(vmanage_key="track-interface-tag") + console_baud_rate: Optional[ConsoleBaudRate] = Field(vmanage_key="console-baud-rate") + max_omp_sessions: Optional[int] = Field(vmanage_key="max-omp-sessions") + multi_tenant: Optional[bool] = Field(vmanage_key="multi-tenant") + track_default_gateway: Optional[bool] = Field(True, vmanage_key="track-default-gateway") + admin_tech_on_failure: Optional[bool] = Field(vmanage_key="admin-tech-on-failure") + enable_tunnel: Optional[bool] = Field(False, vmanage_key="enable", data_path=["on-demand"]) + idle_timeout: Optional[int] = Field(vmanage_key="idle-timeout") + on_demand_idle_timeout_min: Optional[int] = Field(vmanage_key="idle-timeout", data_path=["on-demand"]) tracker: Optional[List[Tracker]] - object_track: Optional[List[ObjectTrack]] = Field(alias="object-track") - region_id: Optional[int] = Field(alias="region-id") - secondary_region: Optional[int] = Field(alias="secondary-region") + object_track: Optional[List[ObjectTrack]] = Field(vmanage_key="object-track") + region_id: Optional[int] = Field(vmanage_key="region-id") + secondary_region: Optional[int] = Field(vmanage_key="secondary-region") role: Optional[Role] - affinity_group_number: Optional[int] = Field(alias="affinity-group-number") - preference: Optional[List[int]] - preference_auto: Optional[bool] = Field(alias="preference-auto") - affinity_per_vrf: Optional[List[AffinityPerVrf]] = Field(alias="affinity-per-vrf") - transport_gateway: Optional[bool] = Field(alias="transport-gateway") - enable_mrf_migration: Optional[EnableMrfMigration] = Field(alias="enable-mrf-migration") - migration_bgp_community: Optional[int] = Field(alias="migration-bgp-community") - enable_management_region: Optional[bool] = Field(alias="enable-management-region") + affinity_group_number: Optional[int] = Field(vmanage_key="affinity-group-number", data_path=["affinity-group"]) + preference: Optional[List[int]] = Field(data_path=["affinity-group"]) + preference_auto: Optional[bool] = Field(vmanage_key="preference-auto") + affinity_per_vrf: Optional[List[AffinityPerVrf]] = Field(vmanage_key="affinity-per-vrf") + transport_gateway: Optional[bool] = Field(vmanage_key="transport-gateway") + enable_mrf_migration: Optional[EnableMrfMigration] = Field(vmanage_key="enable-mrf-migration") + migration_bgp_community: Optional[int] = Field(vmanage_key="migration-bgp-community") + enable_management_region: Optional[bool] = Field(vmanage_key="enable-management-region") vrf: Optional[List[Vrf]] - management_gateway: Optional[bool] = Field(alias="management-gateway") + management_gateway: Optional[bool] = Field(vmanage_key="management-gateway") epfr: Optional[Epfr] = Epfr.DISABLED payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED" diff --git a/vmngclient/api/templates/models/cisco_vpn_interface_model.py b/vmngclient/api/templates/models/cisco_vpn_interface_model.py index ee2a089fb..67993c210 100644 --- a/vmngclient/api/templates/models/cisco_vpn_interface_model.py +++ b/vmngclient/api/templates/models/cisco_vpn_interface_model.py @@ -6,7 +6,7 @@ from pydantic import Field from vmngclient.api.templates.feature_template import FeatureTemplate -from vmngclient.utils.pydantic_validators import ConvertBoolToStringModel +from vmngclient.utils.pydantic_validators import ConvertBoolToStringModel, ConvertIPToStringModel DEFAULT_STATIC_NAT64_SOURCE_VPN_ID = 0 DEFAULT_STATIC_NAT_SOURCE_VPN_ID = 0 @@ -20,11 +20,11 @@ DEFAULT_IPV6_VRRP_TIMER = 1000 -class SecondaryIPv4Address(ConvertBoolToStringModel): +class SecondaryIPv4Address(ConvertBoolToStringModel, ConvertIPToStringModel): address: Optional[ipaddress.IPv4Interface] -class SecondaryIPv6Address(ConvertBoolToStringModel): +class SecondaryIPv6Address(ConvertBoolToStringModel, ConvertIPToStringModel): address: Optional[ipaddress.IPv6Interface] @@ -35,13 +35,13 @@ class Direction(str, Enum): class AccessList(ConvertBoolToStringModel): direction: Direction - acl_name: str = Field(alias="acl-name") + acl_name: str = Field(vmanage_key="acl-name") class Config: allow_population_by_field_name = True -class DhcpHelperV6(ConvertBoolToStringModel): +class DhcpHelperV6(ConvertBoolToStringModel, ConvertIPToStringModel): address: ipaddress.IPv6Address vpn: Optional[int] @@ -52,10 +52,10 @@ class NatChoice(str, Enum): LOOPBACK = "Loopback" -class StaticNat66(ConvertBoolToStringModel): - source_prefix: ipaddress.IPv6Interface = Field(alias="source-prefix") - translated_source_prefix: str = Field(alias="translated-source-prefix") - source_vpn_id: int = Field(DEFAULT_STATIC_NAT64_SOURCE_VPN_ID, alias="source-vpn-id") +class StaticNat66(ConvertBoolToStringModel, ConvertIPToStringModel): + source_prefix: ipaddress.IPv6Interface = Field(vmanage_key="source-prefix") + translated_source_prefix: str = Field(vmanage_key="translated-source-prefix") + source_vpn_id: int = Field(DEFAULT_STATIC_NAT64_SOURCE_VPN_ID, vmanage_key="source-vpn-id") class Config: allow_population_by_field_name = True @@ -66,11 +66,11 @@ class StaticNatDirection(str, Enum): OUTSIDE = "outside" -class Static(ConvertBoolToStringModel): - source_ip: ipaddress.IPv4Address = Field(alias="source-ip") - translate_ip: ipaddress.IPv4Address = Field(alias="translate-ip") - static_nat_direction: StaticNatDirection = Field(StaticNatDirection.INSIDE, alias="static-nat-direction") - source_vpn: int = Field(DEFAULT_STATIC_NAT_SOURCE_VPN_ID, alias="source-vpn") +class Static(ConvertBoolToStringModel, ConvertIPToStringModel): + source_ip: ipaddress.IPv4Address = Field(vmanage_key="source-ip") + translate_ip: ipaddress.IPv4Address = Field(vmanage_key="translate-ip") + static_nat_direction: StaticNatDirection = Field(StaticNatDirection.INSIDE, vmanage_key="static-nat-direction") + source_vpn: int = Field(DEFAULT_STATIC_NAT_SOURCE_VPN_ID, vmanage_key="source-vpn") class Config: allow_population_by_field_name = True @@ -81,14 +81,14 @@ class Proto(str, Enum): UDP = "udp" -class StaticPortForward(ConvertBoolToStringModel): - source_ip: ipaddress.IPv4Address = Field(alias="source-ip") - translate_ip: ipaddress.IPv4Address = Field(alias="translate-ip") - static_nat_direction: StaticNatDirection = Field(StaticNatDirection.INSIDE, alias="static-nat-direction") - source_port: int = Field(DEFAULT_STATIC_PORT_FORWARD_SOURCE_PORT, alias="source-port") - translate_port: int = Field(DEFAULT_STATIC_PORT_FORWARD_TRANSLATE_PORT, alias="translate-port") +class StaticPortForward(ConvertBoolToStringModel, ConvertIPToStringModel): + source_ip: ipaddress.IPv4Address = Field(vmanage_key="source-ip") + translate_ip: ipaddress.IPv4Address = Field(vmanage_key="translate-ip") + static_nat_direction: StaticNatDirection = Field(StaticNatDirection.INSIDE, vmanage_key="static-nat-direction") + source_port: int = Field(DEFAULT_STATIC_PORT_FORWARD_SOURCE_PORT, vmanage_key="source-port") + translate_port: int = Field(DEFAULT_STATIC_PORT_FORWARD_TRANSLATE_PORT, vmanage_key="translate-port") proto: Proto - source_vpn: int = Field(DEFAULT_STATIC_PORT_FORWARD_SOURCE_VPN, alias="source-vpn") + source_vpn: int = Field(DEFAULT_STATIC_PORT_FORWARD_SOURCE_VPN, vmanage_key="source-vpn") class Config: allow_population_by_field_name = True @@ -178,12 +178,12 @@ class Duplex(str, Enum): AUTO = "auto" -class Ip(ConvertBoolToStringModel): +class Ip(ConvertBoolToStringModel, ConvertIPToStringModel): addr: ipaddress.IPv4Address mac: str -class Ipv4Secondary(ConvertBoolToStringModel): +class Ipv4Secondary(ConvertBoolToStringModel, ConvertIPToStringModel): address: ipaddress.IPv4Address @@ -194,31 +194,31 @@ class TrackAction(str, Enum): class TrackingObject(ConvertBoolToStringModel): name: int - track_action: TrackAction = Field(TrackAction.DECREMENT, alias="track-action") + track_action: TrackAction = Field(TrackAction.DECREMENT, vmanage_key="track-action") decrement: int class Config: allow_population_by_field_name = True -class Vrrp(ConvertBoolToStringModel): - grp_id: int = Field(alias="grp-id") +class Vrrp(ConvertBoolToStringModel, ConvertIPToStringModel): + grp_id: int = Field(vmanage_key="grp-id") priority: int = DEFAULT_VRRP_PRIORITY timer: int = DEFAULT_VRRP_TIMER - track_omp: bool = Field(False, alias="track-omp") - track_prefix_list: Optional[str] = Field(alias="track-prefix-list") - address: Optional[ipaddress.IPv4Address] - ipv4_secondary: Optional[List[Ipv4Secondary]] = Field(alias="ipv4-secondary") - tloc_change_pref: bool = Field(False, alias="tloc-change-pref") + track_omp: bool = Field(False, vmanage_key="track-omp") + track_prefix_list: Optional[str] = Field(vmanage_key="track-prefix-list") + address: Optional[ipaddress.IPv4Address] = Field(data_path=["ipv4"], vmanage_key="address") + ipv4_secondary: Optional[List[Ipv4Secondary]] = Field(vmanage_key="ipv4-secondary") + tloc_change_pref: bool = Field(False, vmanage_key="tloc-change-pref") value: int - tracking_object: Optional[List[TrackingObject]] = Field(alias="tracking-object") + tracking_object: Optional[List[TrackingObject]] = Field(vmanage_key="tracking-object") class Config: allow_population_by_field_name = True -class Ipv6(ConvertBoolToStringModel): - ipv6_link_local: ipaddress.IPv6Address = Field(alias="ipv6-link-local") +class Ipv6(ConvertBoolToStringModel, ConvertIPToStringModel): + ipv6_link_local: ipaddress.IPv6Address = Field(vmanage_key="ipv6-link-local") prefix: Optional[ipaddress.IPv6Interface] class Config: @@ -226,141 +226,149 @@ class Config: class Ipv6Vrrp(ConvertBoolToStringModel): - grp_id: int = Field(alias="grp-id") + grp_id: int = Field(vmanage_key="grp-id") priority: int = DEFAULT_IPV6_VRRP_PRIORITY timer: int = DEFAULT_IPV6_VRRP_TIMER - track_omp: bool = Field(False, alias="track-omp") - track_prefix_list: Optional[str] = Field(alias="track-prefix-list") + track_omp: bool = Field(False, vmanage_key="track-omp") + track_prefix_list: Optional[str] = Field(vmanage_key="track-prefix-list") ipv6: Optional[List[Ipv6]] class Config: allow_population_by_field_name = True -class CiscoVpnInterfaceModel(FeatureTemplate, ConvertBoolToStringModel): +class CiscoVpnInterfaceModel(FeatureTemplate, ConvertBoolToStringModel, ConvertIPToStringModel): class Config: arbitrary_types_allowed = True allow_population_by_field_name = True - if_name: str = Field(alias="if-name") + if_name: str = Field(vmanage_key="if-name") interface_description: Optional[str] = Field(vmanage_key="description") poe: Optional[bool] - ipv4_address: Optional[str] = Field(vmanage_key="address") + ipv4_address: Optional[str] = Field(data_path=["ip"], vmanage_key="address") secondary_ipv4_address: Optional[List[SecondaryIPv4Address]] = Field( - vmanage_key="secondary-address", alias="secondary-address" + data_path=["ip"], vmanage_key="secondary-address" ) - dhcp_ipv4_client: Optional[bool] = Field(vmanage_key="dhcp-client", alias="dhcp-client") - dhcp_distance: Optional[int] = Field(alias="dhcp-distance") - ipv6_address: Optional[ipaddress.IPv6Interface] = Field(vmanage_key="address") - dhcp_ipv6_client: Optional[bool] = Field(vmanage_key="dhcp-client", alias="dhcp-client") + dhcp_ipv4_client: Optional[bool] = Field(vmanage_key="dhcp-client") + dhcp_distance: Optional[int] = Field(vmanage_key="dhcp-distance") + ipv6_address: Optional[ipaddress.IPv6Interface] = Field(data_path=["ipv6"], vmanage_key="address") + dhcp_ipv6_client: Optional[bool] = Field(vmanage_key="dhcp-client") secondary_ipv6_address: Optional[List[SecondaryIPv6Address]] = Field( - vmanage_key="secondary-address", alias="secondary-address" + data_path=["ipv6"], vmanage_key="secondary-address" ) - access_list_ipv4: Optional[List[AccessList]] = Field(vmanage_key="access-list", alias="access-list") - dhcp_helper: Optional[List[ipaddress.IPv4Address]] = Field(alias="dhcp-helper") - dhcp_helper_v6: Optional[List[DhcpHelperV6]] = Field(alias="dhcp-helper-v6") + access_list_ipv4: Optional[List[AccessList]] = Field(vmanage_key="access-list") + dhcp_helper: Optional[List[ipaddress.IPv4Address]] = Field(vmanage_key="dhcp-helper") + dhcp_helper_v6: Optional[List[DhcpHelperV6]] = Field(vmanage_key="dhcp-helper-v6") tracker: Optional[List[str]] - auto_bandwidth_detect: Optional[bool] = Field(alias="auto-bandwidth-detect") - iperf_server: Optional[ipaddress.IPv4Address] = Field(alias="iperf-server") + auto_bandwidth_detect: Optional[bool] = Field(vmanage_key="auto-bandwidth-detect") + iperf_server: Optional[ipaddress.IPv4Address] = Field(vmanage_key="iperf-server") nat: Optional[bool] - nat_choice: Optional[NatChoice] = Field(alias="nat-choice") - udp_timeout: Optional[int] = Field(alias="udp-timeout") - tcp_timeout: Optional[int] = Field(alias="tcp-timeout") - nat_range_start: Optional[ipaddress.IPv4Address] = Field(alias="range-start") - nat_range_end: Optional[ipaddress.IPv4Address] = Field(alias="range-end") + nat_choice: Optional[NatChoice] = Field(vmanage_key="nat-choice") + udp_timeout: Optional[int] = Field(vmanage_key="udp-timeout") + tcp_timeout: Optional[int] = Field(vmanage_key="tcp-timeout") + nat_range_start: Optional[ipaddress.IPv4Address] = Field(vmanage_key="range-start") + nat_range_end: Optional[ipaddress.IPv4Address] = Field(vmanage_key="range-end") overload: Optional[bool] - loopback_interface: Optional[str] = Field(alias="loopback-interface") - prefix_length: Optional[int] = Field(alias="prefix-length") + loopback_interface: Optional[str] = Field(vmanage_key="loopback-interface") + prefix_length: Optional[int] = Field(vmanage_key="prefix-length") enable: Optional[bool] nat64: Optional[bool] nat66: Optional[bool] - static_nat66: Optional[List[StaticNat66]] = Field(alias="static-nat66") - static: Optional[List[Static]] - static_port_forward: Optional[List[StaticPortForward]] = Field(alias="static-port-forward") - enable_core_region: Optional[bool] = Field(alias="enable-core-region") - core_region: Optional[CoreRegion] = Field(alias="core-region") - secondary_region: Optional[SecondaryRegion] = Field(alias="secondary-region") + static_nat66: Optional[List[StaticNat66]] = Field(vmanage_key="static-nat66") + static: Optional[List[Static]] = Field(data_path=["nat"], vmanage_key="static") + static_port_forward: Optional[List[StaticPortForward]] = Field(vmanage_key="static-port-forward") + enable_core_region: Optional[bool] = Field(vmanage_key="enable-core-region") + core_region: Optional[CoreRegion] = Field(vmanage_key="core-region") + secondary_region: Optional[SecondaryRegion] = Field(vmanage_key="secondary-region") tloc_encapsulation: Optional[List[Encapsulation]] - border: Optional[bool] - per_tunnel_qos: Optional[bool] = Field(alias="per-tunnel-qos") - per_tunnel_qos_aggregator: Optional[bool] = Field(alias="per-tunnel-qos-aggregator") + border: Optional[bool] = Field(data_path=["tunnel-interface"]) + per_tunnel_qos: Optional[bool] = Field(vmanage_key="per-tunnel-qos") + per_tunnel_qos_aggregator: Optional[bool] = Field(vmanage_key="per-tunnel-qos-aggregator") mode: Optional[Mode] - tunnels_bandwidth: Optional[int] = Field(alias="tunnels-bandwidth") - group: Optional[List[int]] - value: Optional[Value] - max_control_connections: Optional[int] = Field(alias="max-control-connections") - control_connections: Optional[bool] = Field(alias="control-connections") - vbond_as_stun_server: Optional[bool] = Field(alias="vbond-as-stun-server") - exclude_controller_group_list: Optional[List[int]] = Field(alias="exclude-controller-group-list") - vmanage_connection_preference: Optional[int] = Field(alias="vmanage-connection-preference") - port_hop: Optional[bool] = Field(alias="port-hop") - restrict: Optional[bool] - dst_ip: Optional[ipaddress.IPv4Address] = Field(alias="dst-ip") - carrier: Optional[Carrier] - nat_refresh_interval: Optional[int] = Field(alias="nat-refresh-interval") - hello_interval: Optional[int] = Field(alias="hello-interval") - hello_tolerance: Optional[int] = Field(alias="hello-tolerance") - bind: Optional[str] - last_resort_circuit: Optional[bool] = Field(alias="last-resort-circuit") - low_bandwidth_link: Optional[bool] = Field(alias="low-bandwidth-link") - tunnel_tcp_mss_adjust: Optional[int] = Field(alias="tunnel-tcp-mss-adjust") - clear_dont_fragment: Optional[bool] = Field(alias="clear-dont-fragment") - propagate_sgt: Optional[bool] = Field(alias="propagate-sgt") - network_broadcast: Optional[bool] = Field(alias="network-broadcast") - all: Optional[bool] - bgp: Optional[bool] - dhcp: Optional[bool] - dns: Optional[bool] - icmp: Optional[bool] - sshd: Optional[bool] - netconf: Optional[bool] - ntp: Optional[bool] - ospf: Optional[bool] - stun: Optional[bool] - snmp: Optional[bool] - https: Optional[bool] - media_type: Optional[MediaType] = Field(alias="media-type") - intrf_mtu: Optional[int] = Field(alias="intrf-mtu") + tunnels_bandwidth: Optional[int] = Field(vmanage_key="tunnels-bandwidth") + group: Optional[List[int]] = Field(data_path=["tunnel-interface"]) + value: Optional[Value] = Field(data_path=["tunnel-interface", "color"]) + max_control_connections: Optional[int] = Field( + vmanage_key="max-control-connections", data_path=["tunnel-interface"] + ) + control_connections: Optional[bool] = Field(vmanage_key="control-connections", data_path=["tunnel-interface"]) + vbond_as_stun_server: Optional[bool] = Field(vmanage_key="vbond-as-stun-server", data_path=["tunnel-interface"]) + exclude_controller_group_list: Optional[List[int]] = Field( + vmanage_key="exclude-controller-group-list", data_path=["tunnel-interface"] + ) + vmanage_connection_preference: Optional[int] = Field( + vmanage_key="vmanage-connection-preference", data_path=["tunnel-interface"] + ) + port_hop: Optional[bool] = Field(vmanage_key="port-hop", data_path=["tunnel-interface"]) + restrict: Optional[bool] = Field(data_path=["tunnel-interface", "color"]) + dst_ip: Optional[ipaddress.IPv4Address] = Field( + vmanage_key="dst-ip", data_path=["tunnel-interface", "tloc-extension-gre-to"] + ) + carrier: Optional[Carrier] = Field(data_path=["tunnel-interface"]) + nat_refresh_interval: Optional[int] = Field(vmanage_key="nat-refresh-interval", data_path=["tunnel-interface"]) + hello_interval: Optional[int] = Field(vmanage_key="hello-interval", data_path=["tunnel-interface"]) + hello_tolerance: Optional[int] = Field(vmanage_key="hello-tolerance", data_path=["tunnel-interface"]) + bind: Optional[str] = Field(data_path=["tunnel-interface"]) + last_resort_circuit: Optional[bool] = Field(vmanage_key="last-resort-circuit", data_path=["tunnel-interface"]) + low_bandwidth_link: Optional[bool] = Field(vmanage_key="low-bandwidth-link", data_path=["tunnel-interface"]) + tunnel_tcp_mss_adjust: Optional[int] = Field(vmanage_key="tunnel-tcp-mss-adjust", data_path=["tunnel-interface"]) + clear_dont_fragment: Optional[bool] = Field(vmanage_key="clear-dont-fragment", data_path=["tunnel-interface"]) + propagate_sgt: Optional[bool] = Field(data_path=["tunnel-interface"], vmanage_key="propagate-sgt") + network_broadcast: Optional[bool] = Field(vmanage_key="network-broadcast", data_path=["tunnel-interface"]) + all: Optional[bool] = Field(data_path=["tunnel-interface", "allow-service"]) + bgp: Optional[bool] = Field(data_path=["tunnel-interface", "allow-service"]) + dhcp: Optional[bool] = Field(data_path=["tunnel-interface", "allow-service"]) + dns: Optional[bool] = Field(data_path=["tunnel-interface", "allow-service"]) + icmp: Optional[bool] = Field(data_path=["tunnel-interface", "allow-service"]) + sshd: Optional[bool] = Field(data_path=["tunnel-interface", "allow-service"]) + netconf: Optional[bool] = Field(data_path=["tunnel-interface", "allow-service"]) + ntp: Optional[bool] = Field(data_path=["tunnel-interface", "allow-service"]) + ospf: Optional[bool] = Field(data_path=["tunnel-interface", "allow-service"]) + stun: Optional[bool] = Field(data_path=["tunnel-interface", "allow-service"]) + snmp: Optional[bool] = Field(data_path=["tunnel-interface", "allow-service"]) + https: Optional[bool] = Field(data_path=["tunnel-interface", "allow-service"]) + media_type: Optional[MediaType] = Field(vmanage_key="media-type") + intrf_mtu: Optional[int] = Field(vmanage_key="intrf-mtu") mtu: Optional[int] - tcp_mss_adjust: Optional[int] = Field(alias="tcp-mss-adjust") - tloc_extension: Optional[str] = Field(alias="tloc-extension") - load_interval: Optional[int] = Field(alias="load-interval") - src_ip: Optional[ipaddress.IPv4Address] = Field(alias="src-ip") - xconnect: Optional[str] - mac_address: Optional[str] = Field(alias="mac-address") + tcp_mss_adjust: Optional[int] = Field(vmanage_key="tcp-mss-adjust") + tloc_extension: Optional[str] = Field(vmanage_key="tloc-extension") + load_interval: Optional[int] = Field(vmanage_key="load-interval") + src_ip: Optional[ipaddress.IPv4Address] = Field(vmanage_key="src-ip", data_path=["tloc-extension-gre-from"]) + xconnect: Optional[str] = Field(data_path=["tloc-extension-gre-from"]) + mac_address: Optional[str] = Field(vmanage_key="mac-address") speed: Optional[Speed] duplex: Optional[Duplex] shutdown: Optional[bool] = False - arp_timeout: Optional[int] = Field(alias="arp-timeout") + arp_timeout: Optional[int] = Field(vmanage_key="arp-timeout") autonegotiate: Optional[bool] - ip_directed_broadcast: Optional[bool] = Field(alias="ip-directed-broadcast") - icmp_redirect_disable: Optional[bool] = Field(alias="icmp-redirect-disable") - qos_adaptive: Optional[bool] = Field(alias="qos-adaptive") - period: Optional[int] - bandwidth_down: Optional[int] = Field(alias="bandwidth-down") - dmin: Optional[int] - dmax: Optional[int] - bandwidth_up: Optional[int] = Field(alias="bandwidth-up") - umin: Optional[int] - umax: Optional[int] - shaping_rate: Optional[int] = Field(alias="shaping-rate") - qos_map: Optional[str] = Field(alias="qos-map") - qos_map_vpn: Optional[str] = Field(alias="qos-map-vpn") - service_provider: Optional[str] = Field(alias="service-provider") - bandwidth_upstream: Optional[int] = Field(alias="bandwidth-upstream") - bandwidth_downstream: Optional[int] = Field(alias="bandwidth-downstream") - block_non_source_ip: Optional[bool] = Field(alias="block-non-source-ip") - rule_name: Optional[str] = Field(alias="rule-name") - access_list_ipv6: Optional[List[AccessList]] = Field(vmanage_key="access-list", alias="access-list") - ip: Optional[List[Ip]] - vrrp: Optional[List[Vrrp]] - ipv6_vrrp: Optional[List[Ipv6Vrrp]] = Field(alias="ipv6-vrrp") - enable_sgt_propagation: Optional[bool] = Field(vmanage_key="sgt", alias="sgt") - sgt: Optional[int] - trusted: Optional[bool] - enable_sgt_authorization_and_forwarding: Optional[bool] = Field(vmanage_key="enable", alias="enable") - enable_sgt_enforcement: Optional[bool] = Field(vmanage_key="enable", alias="enable") - enforcement_sgt: Optional[int] = Field(vmanage_key="sgt") + ip_directed_broadcast: Optional[bool] = Field(vmanage_key="ip-directed-broadcast") + icmp_redirect_disable: Optional[bool] = Field(vmanage_key="icmp-redirect-disable") + qos_adaptive: Optional[bool] = Field(vmanage_key="qos-adaptive") + period: Optional[int] = Field(data_path=["qos-adaptive"]) + bandwidth_down: Optional[int] = Field(vmanage_key="bandwidth-down", data_path=["qos-adaptive", "downstream"]) + dmin: Optional[int] = Field(data_path=["qos-adaptive", "downstream", "range"]) + dmax: Optional[int] = Field(data_path=["qos-adaptive", "downstream", "range"]) + bandwidth_up: Optional[int] = Field(vmanage_key="bandwidth-up", data_path=["qos-adaptive", "upstream"]) + umin: Optional[int] = Field(data_path=["qos-adaptive", "upstream", "range"]) + umax: Optional[int] = Field(data_path=["qos-adaptive", "upstream", "range"]) + shaping_rate: Optional[int] = Field(vmanage_key="shaping-rate") + qos_map: Optional[str] = Field(vmanage_key="qos-map") + qos_map_vpn: Optional[str] = Field(vmanage_key="qos-map-vpn") + service_provider: Optional[str] = Field(vmanage_key="service-provider") + bandwidth_upstream: Optional[int] = Field(vmanage_key="bandwidth-upstream") + bandwidth_downstream: Optional[int] = Field(vmanage_key="bandwidth-downstream") + block_non_source_ip: Optional[bool] = Field(vmanage_key="block-non-source-ip") + rule_name: Optional[str] = Field(vmanage_key="rule-name", data_path=["rewrite-rule"]) + access_list_ipv6: Optional[List[AccessList]] = Field(data_path=["ipv6"], vmanage_key="access-list") + ip: Optional[List[Ip]] = Field(data_path=["arp"]) + vrrp: Optional[List[Vrrp]] = Field(vmanage_key="vrrp") + ipv6_vrrp: Optional[List[Ipv6Vrrp]] = Field(vmanage_key="ipv6-vrrp") + enable_sgt_propagation: Optional[bool] = Field(data_path=["trustsec", "propagate"], vmanage_key="sgt") + security_group_tag: Optional[int] = Field(data_path=["trustsec", "static"], vmanage_key="sgt") + trusted: Optional[bool] = Field(data_path=["trustsec", "static"]) + enable_sgt_authorization_and_forwarding: Optional[bool] = Field(data_path=["trustsec"], vmanage_key="enable") + enable_sgt_enforcement: Optional[bool] = Field(data_path=["trustsec", "enforcement"], vmanage_key="enable") + enforcement_sgt: Optional[int] = Field(data_path=["trustsec", "enforcement"], vmanage_key="sgt") payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED" type: ClassVar[str] = "cisco_vpn_interface" diff --git a/vmngclient/api/templates/models/cisco_vpn_model.py b/vmngclient/api/templates/models/cisco_vpn_model.py index 88fae6d02..7bee94ccc 100644 --- a/vmngclient/api/templates/models/cisco_vpn_model.py +++ b/vmngclient/api/templates/models/cisco_vpn_model.py @@ -13,7 +13,7 @@ class Role(str, Enum): class Dns(BaseModel): - dns_addr: str = Field(alias="dns-addr") + dns_addr: str = Field(vmanage_key="dns-addr") role: Role = Role.PRIMARY class Config: @@ -21,7 +21,7 @@ class Config: class DnsIpv6(BaseModel): - dns_addr: str = Field(alias="dns-addr") + dns_addr: str = Field(vmanage_key="dns-addr") role: Optional[Role] = Role.PRIMARY class Config: @@ -46,10 +46,10 @@ class SvcType(str, Enum): class Service(BaseModel): - svc_type: SvcType = Field(alias="svc-type") + svc_type: SvcType = Field(vmanage_key="svc-type") address: List[str] interface: str - track_enable: bool = Field(True, alias="track-enable") + track_enable: bool = Field(True, vmanage_key="track-enable") class Config: allow_population_by_field_name = True @@ -82,8 +82,8 @@ class NextHopWithTrack(BaseModel): class Routev4(BaseModel): prefix: str - next_hop: Optional[List[NextHop]] = Field(alias="next-hop") - next_hop_with_track: Optional[List[NextHopWithTrack]] = Field(alias="next-hop-with-track") + next_hop: Optional[List[NextHop]] = Field(vmanage_key="next-hop") + next_hop_with_track: Optional[List[NextHopWithTrack]] = Field(vmanage_key="next-hop-with-track") null0: Optional[bool] distance: Optional[int] = 1 vpn: Optional[int] @@ -105,7 +105,7 @@ class Nat(str, Enum): class Routev6(BaseModel): prefix: str - next_hop: Optional[List[NextHopv6]] = Field(alias="next-hop") + next_hop: Optional[List[NextHopv6]] = Field(vmanage_key="next-hop") null0: Optional[bool] vpn: Optional[int] nat: Optional[Nat] @@ -149,8 +149,8 @@ class Region(str, Enum): class PrefixList(BaseModel): - prefix_entry: str = Field(alias="prefix-entry") - aggregate_only: Optional[bool] = Field(alias="aggregate-only") + prefix_entry: str = Field(vmanage_key="prefix-entry") + aggregate_only: Optional[bool] = Field(vmanage_key="aggregate-only") region: Optional[Region] class Config: @@ -159,9 +159,9 @@ class Config: class Advertise(BaseModel): protocol: AdvertiseProtocol - route_policy: Optional[str] = Field(alias="route-policy") - protocol_sub_type: Optional[List[AdvertiseProtocolSubType]] = Field(alias="protocol-sub-type") - prefix_list: Optional[List[PrefixList]] = Field(alias="prefix-list") + route_policy: Optional[str] = Field(vmanage_key="route-policy") + protocol_sub_type: Optional[List[AdvertiseProtocolSubType]] = Field(vmanage_key="protocol-sub-type") + prefix_list: Optional[List[PrefixList]] = Field(vmanage_key="prefix-list") class Config: allow_population_by_field_name = True @@ -182,9 +182,9 @@ class Ipv6AdvertiseProtocolSubType(str, Enum): class Ipv6Advertise(BaseModel): protocol: Ipv6AdvertiseProtocol - route_policy: Optional[str] = Field(alias="route-policy") - protocol_sub_type: Optional[List[Ipv6AdvertiseProtocolSubType]] = Field(alias="protocol-sub-type") - prefix_list: Optional[List[PrefixList]] = Field(alias="prefix-list") + route_policy: Optional[str] = Field(vmanage_key="route-policy") + protocol_sub_type: Optional[List[Ipv6AdvertiseProtocolSubType]] = Field(vmanage_key="protocol-sub-type") + prefix_list: Optional[List[PrefixList]] = Field(vmanage_key="prefix-list") class Config: allow_population_by_field_name = True @@ -201,8 +201,8 @@ class LeakFromGlobalProtocol(str, Enum): class Pool(BaseModel): name: str - start_address: str = Field(alias="start-address") - end_address: str = Field(alias="end-address") + start_address: str = Field(vmanage_key="start-address") + end_address: str = Field(vmanage_key="end-address") overload: Optional[bool] leak_from_global: bool leak_from_global_protocol: LeakFromGlobalProtocol @@ -224,12 +224,12 @@ class Overload(str, Enum): class Natpool(BaseModel): name: int - prefix_length: int = Field(alias="prefix-length") - range_start: str = Field(alias="range-start") - range_end: str = Field(alias="range-end") + prefix_length: int = Field(vmanage_key="prefix-length") + range_start: str = Field(vmanage_key="range-start") + range_end: str = Field(vmanage_key="range-end") overload: Overload = Overload.TRUE direction: Direction - tracker_id: Optional[int] = Field(alias="tracker-id") + tracker_id: Optional[int] = Field(vmanage_key="tracker-id") class Config: allow_population_by_field_name = True @@ -241,22 +241,22 @@ class StaticNatDirection(str, Enum): class Static(BaseModel): - pool_name: Optional[int] = Field(alias="pool-name") - source_ip: str = Field(alias="source-ip") - translate_ip: str = Field(alias="translate-ip") - static_nat_direction: StaticNatDirection = Field(alias="static-nat-direction") - tracker_id: Optional[int] = Field(alias="tracker-id") + pool_name: Optional[int] = Field(vmanage_key="pool-name") + source_ip: str = Field(vmanage_key="source-ip") + translate_ip: str = Field(vmanage_key="translate-ip") + static_nat_direction: StaticNatDirection = Field(vmanage_key="static-nat-direction") + tracker_id: Optional[int] = Field(vmanage_key="tracker-id") class Config: allow_population_by_field_name = True class SubnetStatic(BaseModel): - source_ip_subnet: str = Field(alias="source-ip-subnet") - translate_ip_subnet: str = Field(alias="translate-ip-subnet") - prefix_length: int = Field(alias="prefix-length") - static_nat_direction: StaticNatDirection = Field(alias="static-nat-direction") - tracker_id: Optional[int] = Field(alias="tracker-id") + source_ip_subnet: str = Field(vmanage_key="source-ip-subnet") + translate_ip_subnet: str = Field(vmanage_key="translate-ip-subnet") + prefix_length: int = Field(vmanage_key="prefix-length") + static_nat_direction: StaticNatDirection = Field(vmanage_key="static-nat-direction") + tracker_id: Optional[int] = Field(vmanage_key="tracker-id") class Config: allow_population_by_field_name = True @@ -268,11 +268,11 @@ class Proto(str, Enum): class PortForward(BaseModel): - pool_name: Optional[int] = Field(alias="pool-name") - source_port: int = Field(alias="source-port") - translate_port: int = Field(alias="translate-port") - source_ip: str = Field(alias="source-ip") - translate_ip: str = Field(alias="translate-ip") + pool_name: Optional[int] = Field(vmanage_key="pool-name") + source_port: int = Field(vmanage_key="source-port") + translate_port: int = Field(vmanage_key="translate-port") + source_ip: str = Field(vmanage_key="source-ip") + translate_ip: str = Field(vmanage_key="translate-ip") proto: Proto class Config: @@ -298,7 +298,7 @@ class RouteImportRedistributeProtocol(str, Enum): class RouteImportRedistribute(BaseModel): protocol: RouteImportRedistributeProtocol - route_policy: Optional[str] = Field(alias="route-policy") + route_policy: Optional[str] = Field(vmanage_key="route-policy") class Config: allow_population_by_field_name = True @@ -306,8 +306,8 @@ class Config: class RouteImport(BaseModel): protocol: RouteImportProtocol - protocol_sub_type: List[RouteImportProtocolSubType] = Field(alias="protocol-sub-type") - route_policy: Optional[str] = Field(alias="route-policy") + protocol_sub_type: List[RouteImportProtocolSubType] = Field(vmanage_key="protocol-sub-type") + route_policy: Optional[str] = Field(vmanage_key="route-policy") redistribute: Optional[List[RouteImportRedistribute]] class Config: @@ -334,17 +334,17 @@ class RouteImportFromRedistributeProtocol(str, Enum): class RouteImportFromRedistribute(BaseModel): protocol: RouteImportFromRedistributeProtocol - route_policy: Optional[str] = Field(alias="route-policy") + route_policy: Optional[str] = Field(vmanage_key="route-policy") class Config: allow_population_by_field_name = True class RouteImportFrom(BaseModel): - source_vpn: int = Field(alias="source-vpn") + source_vpn: int = Field(vmanage_key="source-vpn") protocol: RouteImportFromProtocol - protocol_sub_type: List[RouteImportFromProtocolSubType] = Field(alias="protocol-sub-type") - route_policy: Optional[str] = Field(alias="route-policy") + protocol_sub_type: List[RouteImportFromProtocolSubType] = Field(vmanage_key="protocol-sub-type") + route_policy: Optional[str] = Field(vmanage_key="route-policy") redistribute: Optional[List[RouteImportFromRedistribute]] class Config: @@ -370,7 +370,7 @@ class RouteExportRedistributeProtocol(str, Enum): class RouteExportRedistribute(BaseModel): protocol: RouteExportRedistributeProtocol - route_policy: Optional[str] = Field(alias="route-policy") + route_policy: Optional[str] = Field(vmanage_key="route-policy") class Config: allow_population_by_field_name = True @@ -378,8 +378,8 @@ class Config: class RouteExport(BaseModel): protocol: RouteExportProtocol - protocol_sub_type: List[RouteExportProtocolSubType] = Field(alias="protocol-sub-type") - route_policy: Optional[str] = Field(alias="route-policy") + protocol_sub_type: List[RouteExportProtocolSubType] = Field(vmanage_key="protocol-sub-type") + route_policy: Optional[str] = Field(vmanage_key="route-policy") redistribute: Optional[List[RouteExportRedistribute]] class Config: @@ -391,32 +391,32 @@ class Config: arbitrary_types_allowed = True allow_population_by_field_name = True - vpn_id: int = Field(alias="vpn-id", default=0) + vpn_id: int = Field(vmanage_key="vpn-id", default=0) vpn_name: Optional[str] = Field(vmanage_key="name") - tenant_vpn_id: Optional[int] = Field(alias="tenant-vpn-id") - org_name: Optional[str] = Field(alias="org-name") - omp_admin_distance_ipv4: Optional[int] = Field(alias="omp-admin-distance-ipv4") - omp_admin_distance_ipv6: Optional[int] = Field(alias="omp-admin-distance-ipv6") + tenant_vpn_id: Optional[int] = Field(vmanage_key="tenant-vpn-id") + org_name: Optional[str] = Field(vmanage_key="org-name") + omp_admin_distance_ipv4: Optional[int] = Field(vmanage_key="omp-admin-distance-ipv4") + omp_admin_distance_ipv6: Optional[int] = Field(vmanage_key="omp-admin-distance-ipv6") dns: Optional[List[Dns]] - dns_ipv6: Optional[List[DnsIpv6]] = Field(alias="dns-ipv6") - layer4: Optional[bool] + dns_ipv6: Optional[List[DnsIpv6]] = Field(vmanage_key="dns-ipv6") + layer4: Optional[bool] = Field(data_path=["ecmp-hash-key"]) host: Optional[List[Host]] service: Optional[List[Service]] - service_route: Optional[List[ServiceRoute]] = Field(alias="service-route") - route_v4: Optional[List[Routev4]] = Field(vmanage_key="route", data_path=["ip", "route"]) - route_v6: Optional[List[Routev6]] = Field(vmanage_key="route", data_path=["ipv6", "route"]) - gre_route: Optional[List[GreRoute]] = Field(alias="gre-route") - ipsec_route: Optional[List[IpsecRoute]] = Field(alias="ipsec-route") - advertise: Optional[List[Advertise]] - ipv6_advertise: Optional[List[Ipv6Advertise]] = Field(alias="ipv6-advertise") - pool: Optional[List[Pool]] - natpool: Optional[List[Natpool]] - static: Optional[List[Static]] - subnet_static: Optional[List[SubnetStatic]] = Field(alias="subnet-static") - port_forward: Optional[List[PortForward]] = Field(alias="port-forward") - route_import: Optional[List[RouteImport]] = Field(alias="route-import") - route_import_from: Optional[List[RouteImportFrom]] = Field(alias="route-import-from") - route_export: Optional[List[RouteExport]] = Field(alias="route-export") + service_route: Optional[List[ServiceRoute]] = Field(data_path=["ip"], vmanage_key="service-route") + route_v4: Optional[List[Routev4]] = Field(data_path=["ip"], vmanage_key="route") + route_v6: Optional[List[Routev6]] = Field(data_path=["ipv6"], vmanage_key="route") + gre_route: Optional[List[GreRoute]] = Field(data_path=["ip"], vmanage_key="gre-route") + ipsec_route: Optional[List[IpsecRoute]] = Field(data_path=["ip"], vmanage_key="ipsec-route") + advertise: Optional[List[Advertise]] = Field(data_path=["omp"]) + ipv6_advertise: Optional[List[Ipv6Advertise]] = Field(data_path=["omp"], vmanage_key="ipv6-advertise") + pool: Optional[List[Pool]] = Field(data_path=["nat64", "v4"]) + natpool: Optional[List[Natpool]] = Field(data_path=["nat"]) + static: Optional[List[Static]] = Field(data_path=["nat"]) + subnet_static: Optional[List[SubnetStatic]] = Field(data_path=["nat"], vmanage_key="subnet-static") + port_forward: Optional[List[PortForward]] = Field(data_path=["nat"], vmanage_key="port-forward") + route_import: Optional[List[RouteImport]] = Field(vmanage_key="route-import") + route_import_from: Optional[List[RouteImportFrom]] = Field(vmanage_key="route-import-from") + route_export: Optional[List[RouteExport]] = Field(vmanage_key="route-export") payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED" type: ClassVar[str] = "cisco_vpn" diff --git a/vmngclient/api/templates/models/omp_vsmart_model.py b/vmngclient/api/templates/models/omp_vsmart_model.py index 880142549..9baf78849 100644 --- a/vmngclient/api/templates/models/omp_vsmart_model.py +++ b/vmngclient/api/templates/models/omp_vsmart_model.py @@ -4,23 +4,28 @@ from pydantic import Field from vmngclient.api.templates.feature_template import FeatureTemplate +from vmngclient.utils.pydantic_validators import ConvertBoolToStringModel -class OMPvSmart(FeatureTemplate): +class OMPvSmart(FeatureTemplate, ConvertBoolToStringModel): class Config: arbitrary_types_allowed = True allow_population_by_field_name = True - graceful_restart: Optional[bool] = Field(default=None, alias="graceful-restart") - send_path_limit: Optional[int] = Field(default=None, alias="send-path-limit") - send_backup_paths: Optional[bool] = Field(default=None, alias="send-backup-paths") - discard_rejected: Optional[bool] = Field(default=None, alias="discard-rejected") - shutdown: Optional[bool] = Field(default=None, alias="shutdown") - graceful_restart_timer: Optional[int] = Field(default=None, alias="graceful-restart-timer") - eor_timer: Optional[int] = Field(default=None, alias="eor-timer") - holdtime: Optional[int] = Field(default=None, alias="holdtime") - affinity_group_preference: Optional[bool] = Field(default=None, alias="affinity-group-preference") - advertisement_interval: Optional[int] = Field(default=None, alias="advertisement-interval") + graceful_restart: Optional[bool] = Field(default=None, vmanage_key="graceful-restart") + send_path_limit: Optional[int] = Field(default=None, vmanage_key="send-path-limit") + send_backup_paths: Optional[bool] = Field(default=None, vmanage_key="send-backup-paths") + discard_rejected: Optional[bool] = Field(default=None, vmanage_key="discard-rejected") + shutdown: Optional[bool] = Field(default=None, vmanage_key="shutdown") + graceful_restart_timer: Optional[int] = Field( + default=None, vmanage_key="graceful-restart-timer", data_path=["timers"] + ) + eor_timer: Optional[int] = Field(default=None, vmanage_key="eor-timer", data_path=["timers"]) + holdtime: Optional[int] = Field(default=None, vmanage_key="holdtime", data_path=["timers"]) + affinity_group_preference: Optional[bool] = Field(default=None, vmanage_key="affinity-group-preference") + advertisement_interval: Optional[int] = Field( + default=None, vmanage_key="advertisement-interval", data_path=["timers"] + ) payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED" type: ClassVar[str] = "omp-vsmart" diff --git a/vmngclient/api/templates/models/security_vsmart_model.py b/vmngclient/api/templates/models/security_vsmart_model.py index e99a35518..19ab232ef 100644 --- a/vmngclient/api/templates/models/security_vsmart_model.py +++ b/vmngclient/api/templates/models/security_vsmart_model.py @@ -7,9 +7,9 @@ from vmngclient.api.templates.feature_template import FeatureTemplate -class Protocol(Enum): - DTLS: str = "DTLS" - TLS: str = "TLS" +class Protocol(str, Enum): + DTLS: str = "dtls" + TLS: str = "tls" class SecurityvSmart(FeatureTemplate): @@ -17,7 +17,7 @@ class Config: arbitrary_types_allowed = True allow_population_by_field_name = True - protocol: Optional[Protocol] = Field(default=None, converter=Protocol) - tls_port: Optional[int] = Field(default=None, alias="tls-port") + protocol: Optional[Protocol] = Field(default=None, data_path=["control"]) + tls_port: Optional[int] = Field(default=None, vmanage_key="tls-port", data_path=["control"]) payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED" type: ClassVar[str] = "security-vsmart" diff --git a/vmngclient/api/templates/models/system_vsmart_model.py b/vmngclient/api/templates/models/system_vsmart_model.py index 51219dd0f..c687490c9 100644 --- a/vmngclient/api/templates/models/system_vsmart_model.py +++ b/vmngclient/api/templates/models/system_vsmart_model.py @@ -13,25 +13,25 @@ class Config: allow_population_by_field_name = True timezone: Optional[Timezone] = Field(default=None, converter=Timezone) - idle_timeout: Optional[int] = Field(default=None, alias="idle-timeout", ge=0, le=300) - admin_tech_on_failure: Optional[bool] = Field(default=True, alias="admin-tech-on-failure") - iptables_enable: Optional[bool] = Field(default=True, alias="iptables-enable") - track_default_gateway: Optional[bool] = Field(default=True, alias="track-default-gateway") - dns_cache_timeout: Optional[int] = Field(default=2, alias="dns-cache-timeout", ge=1, le=30) - track_transport: Optional[bool] = Field(default=True, alias="track-transport") - controller_group_id: Optional[int] = Field(default=0, alias="controller-group-id", ge=0, le=100) - control_session_pps: Optional[int] = Field(default=300, alias="control-session-pps") - port_hop: Optional[bool] = Field(default=True, alias="port-hop") - port_offset: Optional[int] = Field(default=0, alias="port-offset", ge=0, le=20) - overlay_id: Optional[int] = Field(default=1, alias="overlay-id", ge=1, le=4294967295) - site_id: Optional[int] = Field(default=1, alias="site-id", ge=1, le=4294967295) - system_ip: Optional[str] = Field(default=None, alias="system-ip") - device_groups: Optional[str] = Field(default=None, alias="device-groups") + idle_timeout: Optional[int] = Field(default=None, vmanage_key="idle-timeout", ge=0, le=300) + admin_tech_on_failure: Optional[bool] = Field(default=True, vmanage_key="admin-tech-on-failure") + iptables_enable: Optional[bool] = Field(default=True, vmanage_key="iptables-enable") + track_default_gateway: Optional[bool] = Field(default=True, vmanage_key="track-default-gateway") + dns_cache_timeout: Optional[int] = Field(default=2, vmanage_key="dns-cache-timeout", ge=1, le=30) + track_transport: Optional[bool] = Field(default=True, vmanage_key="track-transport") + controller_group_id: Optional[int] = Field(default=0, vmanage_key="controller-group-id", ge=0, le=100) + control_session_pps: Optional[int] = Field(default=300, vmanage_key="control-session-pps") + port_hop: Optional[bool] = Field(default=True, vmanage_key="port-hop") + port_offset: Optional[int] = Field(default=0, vmanage_key="port-offset", ge=0, le=20) + overlay_id: Optional[int] = Field(default=1, vmanage_key="overlay-id", ge=1, le=4294967295) + site_id: Optional[int] = Field(default=1, vmanage_key="site-id", ge=1, le=4294967295) + system_ip: Optional[str] = Field(default=None, vmanage_key="system-ip") + device_groups: Optional[str] = Field(default=None, vmanage_key="device-groups") longitude: Optional[int] = Field(ge=-180, le=180) latitude: Optional[int] = Field(ge=-90, le=90) - system_tunnel_mtu: Optional[str] = Field(default=1024, alias="system-tunnel-mtu") + system_tunnel_mtu: Optional[str] = Field(default=1024, vmanage_key="system-tunnel-mtu") location: Optional[str] - host_name: Optional[str] = Field(default=None, alias="host-name") + host_name: Optional[str] = Field(default=None, vmanage_key="host-name") payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED" type: ClassVar[str] = "system-vsmart" diff --git a/vmngclient/model/tenant.py b/vmngclient/model/tenant.py index 933775514..5d3464a61 100644 --- a/vmngclient/model/tenant.py +++ b/vmngclient/model/tenant.py @@ -47,3 +47,7 @@ class Tenant(BaseModel): class Config: allow_population_by_field_name = True + + +class MigrationTenant(Tenant): + is_destination_overlay_mt: Optional[bool] = Field(alias="isDestinationOverlayMT") diff --git a/vmngclient/tests/templates/definitions/Basic_Cisco_VPN_Model.json b/vmngclient/tests/templates/definitions/Basic_Cisco_VPN_Model.json index 37ad96a77..d8cce1e31 100644 --- a/vmngclient/tests/templates/definitions/Basic_Cisco_VPN_Model.json +++ b/vmngclient/tests/templates/definitions/Basic_Cisco_VPN_Model.json @@ -1,124 +1,11 @@ { "templateName": "Basic_Cisco_VPN_Model", "templateDescription": "Primitive", - "templateType": "vpn-vedge", - "deviceType": [], + "templateType": "cisco_vpn", + "deviceType": [ + "vedge-C8000V" + ], + "factoryDefault": false, "templateMinVersion": "15.0.0", - "templateDefinition": { - "vpn-id": { - "vipObjectType": "object", - "vipType": "constant", - "vipValue": 0 - }, - "name": { - "vipObjectType": "object", - "vipType": "ignore", - "vipVariableName": "vpn_name" - }, - "ecmp-hash-key": { - "layer4": { - "vipObjectType": "object", - "vipType": "ignore", - "vipValue": "false", - "vipVariableName": "vpn_layer4" - } - }, - "tcp-optimization": { - "vipObjectType": "node-only", - "vipType": "ignore", - "vipValue": "false", - "vipVariableName": "vpn_tcp_optimization" - }, - "nat64-global": { - "prefix": { - "stateful": {} - } - }, - "nat64": { - "v4": { - "pool": { - "vipType": "ignore", - "vipValue": [], - "vipObjectType": "tree", - "vipPrimaryKey": [ - "name" - ] - } - } - }, - "route-import": { - "vipType": "ignore", - "vipValue": [], - "vipObjectType": "tree", - "vipPrimaryKey": [ - "protocol" - ] - }, - "route-export": { - "vipType": "ignore", - "vipValue": [], - "vipObjectType": "tree", - "vipPrimaryKey": [ - "protocol" - ] - }, - "route-import-service": { - "from": { - "vipType": "ignore", - "vipValue": [], - "vipObjectType": "tree", - "vipPrimaryKey": [ - "vpn", - "protocol" - ] - } - }, - "host": { - "vipType": "ignore", - "vipValue": [], - "vipObjectType": "tree", - "vipPrimaryKey": [ - "hostname" - ] - }, - "service": { - "vipType": "ignore", - "vipValue": [], - "vipObjectType": "tree", - "vipPrimaryKey": [ - "svc-type" - ] - }, - "ip": { - "gre-route": {}, - "ipsec-route": {}, - "service-route": {} - }, - "ipv6": {}, - "omp": { - "advertise": { - "vipType": "ignore", - "vipValue": [], - "vipObjectType": "tree", - "vipPrimaryKey": [ - "protocol" - ] - }, - "distance": { - "vipObjectType": "object", - "vipType": "ignore", - "vipValue": "", - "vipVariableName": "vpn_distance" - }, - "ipv6-advertise": { - "vipType": "ignore", - "vipValue": [], - "vipObjectType": "tree", - "vipPrimaryKey": [ - "protocol" - ] - } - } - }, - "factoryDefault": false -} \ No newline at end of file + "templateDefinition": {} +} diff --git a/vmngclient/tests/templates/definitions/banner_1.json b/vmngclient/tests/templates/definitions/banner_1.json new file mode 100644 index 000000000..89febeb5c --- /dev/null +++ b/vmngclient/tests/templates/definitions/banner_1.json @@ -0,0 +1,20 @@ +{ + "templateName": "cisco_banner", + "templateDescription": "na", + "templateType": "cisco_banner", + "deviceType": [], + "factoryDefault": false, + "templateMinVersion": "15.0.0", + "templateDefinition": { + "login": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "login banner" + }, + "motd": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "motd_bnanner" + } + } +} \ No newline at end of file diff --git a/vmngclient/tests/templates/definitions/basic/children.json b/vmngclient/tests/templates/definitions/basic/children.json index 14495a95e..053f1f4a8 100644 --- a/vmngclient/tests/templates/definitions/basic/children.json +++ b/vmngclient/tests/templates/definitions/basic/children.json @@ -1,35 +1,39 @@ { "user": { - "vipObjectType": "tree", - "vipType": "constant", - "vipValue": [ - { - "name": { - "vipObjectType": "object", - "vipType": "constant", - "vipValue": "user1" - }, - "password": { - "vipObjectType": "object", - "vipType": "constant", - "vipValue": "pass" - } - }, - { - "name": { - "vipObjectType": "object", - "vipType": "constant", - "vipValue": "user2" - }, - "password": { - "vipObjectType": "object", - "vipType": "constant", - "vipValue": "pass" - } + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "name": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "user1" + }, + "list": { + "password": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "pass" } - ], - "vipPrimaryKey": [ - "name" - ] + } + }, + { + "name": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "user2" + }, + "list": { + "password": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "pass" + } + } + } + ], + "vipPrimaryKey": [ + "name" + ] } -} \ No newline at end of file + } diff --git a/vmngclient/tests/templates/definitions/basic/children_nested.json b/vmngclient/tests/templates/definitions/basic/children_nested.json index c4f9782e9..40792c51a 100644 --- a/vmngclient/tests/templates/definitions/basic/children_nested.json +++ b/vmngclient/tests/templates/definitions/basic/children_nested.json @@ -1,21 +1,30 @@ { "user": { "vipObjectType": "tree", + "vipPrimaryKey": [ + "name" + ], "vipType": "constant", "vipValue": [ { + "list": { + "password": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "pass" + } + }, "name": { "vipObjectType": "object", "vipType": "constant", "vipValue": "user1" }, - "password": { - "vipObjectType": "object", - "vipType": "constant", - "vipValue": "pass" - }, "pubkey-chain": { "vipObjectType": "tree", + "vipPrimaryKey": [ + "key-string" + ], + "vipType": "constant", "vipValue": [ { "key-string": { @@ -23,42 +32,42 @@ "vipType": "constant", "vipValue": "*****" }, - "key-type": { - "vipObjectType": "object", - "vipType": "constant", - "vipValue": "RSA" + "type": { + "RSA": { + "key-type": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "RSA" + } + } } } - ], - "vipType": "constant", - "vipPrimaryKey": [ - "key-string" ] } }, { + "list": { + "password": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "pass" + } + }, "name": { "vipObjectType": "object", "vipType": "constant", "vipValue": "user2" }, - "password": { - "vipObjectType": "object", - "vipType": "constant", - "vipValue": "pass" - }, "pubkey-chain": { "vipObjectType": "tree", - "vipValue": [], - "vipType": "ignore", "vipPrimaryKey": [ "key-string" + ], + "vipType": "ignore", + "vipValue": [ ] } } - ], - "vipPrimaryKey": [ - "name" ] } -} \ No newline at end of file +} diff --git a/vmngclient/tests/templates/definitions/cisco_bfd.json b/vmngclient/tests/templates/definitions/cisco_bfd.json new file mode 100644 index 000000000..4f780fe2a --- /dev/null +++ b/vmngclient/tests/templates/definitions/cisco_bfd.json @@ -0,0 +1,90 @@ +{ + "templateName": "cisco_bfd", + "templateDescription": "na", + "templateType": "cisco_bfd", + "deviceType": [], + "factoryDefault": false, + "templateMinVersion": "15.0.0", + "templateDefinition": { + "app-route": { + "multiplier": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 100 + }, + "poll-interval": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 50 + } + }, + "default-dscp": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 50 + }, + "color": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "color": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "biz-internet" + }, + "hello-interval": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 50 + }, + "multiplier": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 7 + }, + "pmtu-discovery": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "false" + }, + "dscp": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 100 + } + }, + { + "color": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "silver" + }, + "hello-interval": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 150 + }, + "multiplier": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 7 + }, + "pmtu-discovery": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "true" + }, + "dscp": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 20 + } + } + ], + "vipPrimaryKey": [ + "color" + ] + } + } +} \ No newline at end of file diff --git a/vmngclient/tests/templates/definitions/complex_aaa.json b/vmngclient/tests/templates/definitions/complex_aaa.json new file mode 100644 index 000000000..5f8aa24f1 --- /dev/null +++ b/vmngclient/tests/templates/definitions/complex_aaa.json @@ -0,0 +1,291 @@ +{ + "templateName": "complex_aaa", + "templateDescription": "na", + "templateType": "cedge_aaa", + "deviceType": [], + "factoryDefault": false, + "templateMinVersion": "15.0.0", + "templateDefinition": { + "server-auth-order": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "local" + }, + "user": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "name": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "test1" + }, + "password": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "*****" + }, + "secret": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "secret" + }, + "privilege": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "1" + }, + "pubkey-chain": { + "vipObjectType": "tree", + "vipValue": [], + "vipType": "ignore", + "vipPrimaryKey": [ + "key-string" + ] + } + }, + { + "name": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "test2" + }, + "password": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "*****" + }, + "secret": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "secret" + }, + "privilege": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "15" + }, + "pubkey-chain": { + "vipObjectType": "tree", + "vipValue": [], + "vipType": "ignore", + "vipPrimaryKey": [ + "key-string" + ] + } + } + ], + "vipPrimaryKey": [ + "name" + ] + }, + "radius": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "group-name": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "group1" + }, + "vpn": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 10 + }, + "source-interface": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "Gig1" + }, + "server": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "address": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "1.1.1.1" + }, + "auth-port": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 1812 + }, + "acct-port": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 1813 + }, + "timeout": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 5 + }, + "retransmit": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 3 + }, + "key": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "test_key" + }, + "secret-key": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "secret_key" + }, + "key-enum": { + "vipObjectType": "object", + "vipValue": [], + "vipType": "ignore" + } + } + ], + "vipPrimaryKey": [ + "address" + ] + } + }, + { + "group-name": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "group2" + }, + "vpn": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 11 + }, + "source-interface": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "Gig2" + }, + "server": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "address": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "1.1.2.1" + }, + "auth-port": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 1812 + }, + "acct-port": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 1813 + }, + "timeout": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 5 + }, + "retransmit": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 3 + }, + "key": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "test_key2" + }, + "secret-key": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "secret_key2" + }, + "key-enum": { + "vipObjectType": "object", + "vipValue": [], + "vipType": "ignore" + } + } + ], + "vipPrimaryKey": [ + "address" + ] + } + } + ], + "vipPrimaryKey": [ + "group-name" + ] + }, + "tacacs": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "group-name": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "group1" + }, + "source-interface": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "Gig0" + }, + "server": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "address": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "1.1.1.1" + }, + "port": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 49 + }, + "timeout": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 5 + }, + "key": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "key" + }, + "secret-key": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "secret_key" + }, + "key-enum": { + "vipObjectType": "object", + "vipValue": [], + "vipType": "ignore" + } + } + ], + "vipPrimaryKey": [ + "address" + ] + } + } + ], + "vipPrimaryKey": [ + "group-name" + ] + } + } +} \ No newline at end of file diff --git a/vmngclient/tests/templates/definitions/complex_cisco_vpn.json b/vmngclient/tests/templates/definitions/complex_cisco_vpn.json new file mode 100644 index 000000000..8d649a6bf --- /dev/null +++ b/vmngclient/tests/templates/definitions/complex_cisco_vpn.json @@ -0,0 +1,1071 @@ +{ + "templateName": "test_vpn_new", + "templateDescription": "NA", + "templateType": "cisco_vpn", + "deviceType": [ + "vedge-cloud" + ], + "factoryDefault": false, + "templateMinVersion": "15.0.0", + "templateDefinition": { + "name": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "test_vpn_name" + }, + "omp-admin-distance-ipv4": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 10 + }, + "omp-admin-distance-ipv6": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 100 + }, + "dns": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "dns-addr": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "1.1.1.1" + }, + "role": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "primary" + } + }, + { + "dns-addr": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "2.2.2.2" + }, + "role": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "secondary" + } + } + ], + "vipPrimaryKey": [ + "dns-addr" + ] + }, + "dns-ipv6": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "dns-addr": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "30a8:b25e:3db5:fe9f:231f:7478:4181:9234" + }, + "role": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "primary" + } + } + ], + "vipPrimaryKey": [ + "dns-addr" + ] + }, + "host": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "hostname": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "test_hostname" + }, + "ip": { + "vipObjectType": "list", + "vipType": "constant", + "vipValue": [ + "1.1.1.1" + ] + } + } + ], + "vipPrimaryKey": [ + "hostname" + ] + }, + "service": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "svc-type": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "appqoe" + }, + "address": { + "vipObjectType": "list", + "vipType": "constant", + "vipValue": [ + "1.1.1.1" + ] + }, + "interface": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "Gig0/0/1" + }, + "track-enable": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "false" + } + }, + { + "svc-type": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "FW" + }, + "address": { + "vipObjectType": "list", + "vipType": "constant", + "vipValue": [ + "1.1.122.1", + "2.2.2.2" + ] + }, + "interface": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "Gig0/0/2" + }, + "track-enable": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "true" + } + }, + { + "svc-type": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "IDP" + }, + "address": { + "vipObjectType": "list", + "vipType": "constant", + "vipValue": [ + "1.1.122.2", + "3.2.2.2" + ] + }, + "interface": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "Gig0/0/3" + }, + "track-enable": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "false" + } + } + ], + "vipPrimaryKey": [ + "svc-type" + ] + }, + "ip": { + "service-route": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "prefix": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "service_route" + }, + "vpn": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 1 + }, + "service": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "sig" + } + }, + { + "prefix": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "service_route100" + }, + "vpn": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 100 + }, + "service": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "sig" + } + } + ], + "vipPrimaryKey": [ + "prefix" + ] + }, + "route": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "prefix": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "prefixv4" + }, + "next-hop": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "address": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "1.1.1.1" + }, + "distance": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 1 + } + } + ], + "vipPrimaryKey": [ + "address" + ] + }, + "next-hop-with-track": { + "vipObjectType": "tree", + "vipValue": [], + "vipType": "ignore", + "vipPrimaryKey": [ + "address" + ] + }, + "distance": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 1 + } + } + ], + "vipPrimaryKey": [ + "prefix" + ] + }, + "gre-route": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "prefix": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "gre_route" + }, + "vpn": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 100 + }, + "interface": { + "vipObjectType": "list", + "vipValue": [], + "vipType": "ignore" + } + }, + { + "prefix": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "gre_route2" + }, + "vpn": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 2 + }, + "interface": { + "vipObjectType": "list", + "vipType": "constant", + "vipValue": [ + "Gig0/0/1", + "ge0/0" + ] + } + } + ], + "vipPrimaryKey": [ + "prefix" + ] + }, + "ipsec-route": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "prefix": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "ipsec-prefix" + }, + "vpn": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 10 + }, + "interface": { + "vipObjectType": "list", + "vipType": "constant", + "vipValue": [ + "ge0/0", + "Gig0/0/1" + ] + } + }, + { + "prefix": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "prefix-2" + }, + "vpn": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 100 + }, + "interface": { + "vipObjectType": "list", + "vipValue": [], + "vipType": "ignore" + } + } + ], + "vipPrimaryKey": [ + "prefix" + ] + } + }, + "ipv6": { + "route": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "prefix": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "prefixv6" + }, + "next-hop": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "address": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "2.2.2.2" + }, + "distance": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 1 + } + } + ], + "vipPrimaryKey": [ + "address" + ] + }, + "nat": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "NAT64" + } + } + ], + "vipPrimaryKey": [ + "prefix" + ] + } + }, + "omp": { + "advertise": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "protocol": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "aggregate" + }, + "route-policy": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "route-policy" + }, + "protocol-sub-type": { + "vipObjectType": "list", + "vipType": "constant", + "vipValue": [ + "external" + ] + }, + "prefix-list": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "prefix-entry": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "prefix_entry" + }, + "aggregate-only": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": true + } + } + ], + "vipPrimaryKey": [ + "prefix-entry" + ] + } + } + ], + "vipPrimaryKey": [ + "protocol" + ] + }, + "ipv6-advertise": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "protocol": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "aggregate" + }, + "route-policy": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "route-policyv6" + }, + "protocol-sub-type": { + "vipObjectType": "list", + "vipType": "constant", + "vipValue": [ + "external" + ] + }, + "prefix-list": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "prefix-entry": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "prefix_entryv6" + } + } + ], + "vipPrimaryKey": [ + "prefix-entry" + ] + } + }, + { + "protocol": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "connected" + }, + "route-policy": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "route-policyv6-connected" + }, + "protocol-sub-type": { + "vipObjectType": "list", + "vipType": "constant", + "vipValue": [ + "external" + ] + }, + "prefix-list": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "prefix-entry": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "prefix_entryv6-connected" + }, + "aggregate-only": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": true + } + } + ], + "vipPrimaryKey": [ + "prefix-entry" + ] + } + } + ], + "vipPrimaryKey": [ + "protocol" + ] + } + }, + "nat64": { + "v4": { + "pool": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "name": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "pool" + }, + "start-address": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "1.1.1.1" + }, + "end-address": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "10.10.10.10" + }, + "leak_from_global": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": true + }, + "leak_from_global_protocol": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "connected" + } + } + ], + "vipPrimaryKey": [ + "name" + ] + } + } + }, + "nat": { + "natpool": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "name": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 1 + }, + "prefix-length": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 24 + }, + "range-start": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "10" + }, + "range-end": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "100" + }, + "overload": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "false" + }, + "direction": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "inside" + }, + "tracker-id": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 10 + } + }, + { + "name": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 2 + }, + "prefix-length": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 24 + }, + "range-start": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "10" + }, + "range-end": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "100" + }, + "overload": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "true" + }, + "direction": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "outside" + }, + "tracker-id": { + "vipObjectType": "object", + "vipValue": [], + "vipType": "ignore" + } + } + ], + "vipPrimaryKey": [ + "name" + ] + }, + "static": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "pool-name": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 1 + }, + "source-ip": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "1.1.1.1" + }, + "translate-ip": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "1.1.1.2" + }, + "static-nat-direction": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "inside" + }, + "tracker-id": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 1 + } + }, + { + "pool-name": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 2 + }, + "source-ip": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "2.1.1.1" + }, + "translate-ip": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "2.1.1.2" + }, + "static-nat-direction": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "outside" + }, + "tracker-id": { + "vipObjectType": "object", + "vipValue": [], + "vipType": "ignore" + } + } + ], + "vipPrimaryKey": [ + "source-ip", + "translate-ip" + ] + }, + "subnet-static": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "source-ip-subnet": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "1.1.1.1" + }, + "translate-ip-subnet": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "2.2.2.2" + }, + "prefix-length": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 24 + }, + "static-nat-direction": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "outside" + }, + "tracker-id": { + "vipObjectType": "object", + "vipValue": [], + "vipType": "ignore" + } + }, + { + "source-ip-subnet": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "1.1.2.1" + }, + "translate-ip-subnet": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "2.3.2.2" + }, + "prefix-length": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 24 + }, + "static-nat-direction": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "inside" + }, + "tracker-id": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 10 + } + } + ], + "vipPrimaryKey": [ + "source-ip-subnet", + "translate-ip-subnet" + ] + }, + "port-forward": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "pool-name": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 1 + }, + "source-port": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 1000 + }, + "translate-port": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 2000 + }, + "source-ip": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "1.1.1.1" + }, + "translate-ip": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "2.2.2.2" + }, + "proto": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "tcp" + } + }, + { + "pool-name": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 2 + }, + "source-port": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 1000 + }, + "translate-port": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 2000 + }, + "source-ip": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "1.1.4.1" + }, + "translate-ip": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "2.2.3.2" + }, + "proto": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "udp" + } + } + ], + "vipPrimaryKey": [ + "source-port", + "translate-port", + "source-ip", + "translate-ip", + "proto" + ] + } + }, + "route-import": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "protocol": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "bgp" + }, + "protocol-sub-type": { + "vipObjectType": "list", + "vipType": "constant", + "vipValue": [ + "external" + ] + }, + "route-policy": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "test_route_policy" + }, + "redistribute": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "protocol": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "eigrp" + }, + "route-policy": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "test_route_policy" + } + } + ], + "vipPrimaryKey": [ + "protocol" + ] + } + } + ], + "vipPrimaryKey": [ + "protocol" + ] + }, + "route-import-from": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "source-vpn": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 1 + }, + "protocol": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "connected" + }, + "protocol-sub-type": { + "vipObjectType": "list", + "vipType": "constant", + "vipValue": [ + "external" + ] + }, + "route-policy": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "test_route_policy" + }, + "redistribute": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "protocol": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "bgp" + } + } + ], + "vipPrimaryKey": [ + "protocol" + ] + } + }, + { + "source-vpn": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": 100 + }, + "protocol": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "bgp" + }, + "protocol-sub-type": { + "vipObjectType": "list", + "vipType": "constant", + "vipValue": [ + "external" + ] + }, + "route-policy": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "test_route_policy" + }, + "redistribute": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "protocol": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "eigrp" + }, + "route-policy": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "test_route_policy" + } + } + ], + "vipPrimaryKey": [ + "protocol" + ] + } + } + ], + "vipPrimaryKey": [ + "source-vpn", + "protocol" + ] + }, + "route-export": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "protocol": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "static" + }, + "protocol-sub-type": { + "vipObjectType": "list", + "vipType": "constant", + "vipValue": [ + "external" + ] + }, + "redistribute": { + "vipObjectType": "tree", + "vipType": "constant", + "vipValue": [ + { + "protocol": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "ospf" + }, + "route-policy": { + "vipObjectType": "object", + "vipType": "constant", + "vipValue": "test_route_policy" + } + } + ], + "vipPrimaryKey": [ + "protocol" + ] + } + } + ], + "vipPrimaryKey": [ + "protocol" + ] + } + } +} diff --git a/vmngclient/tests/templates/definitions/iuo.json b/vmngclient/tests/templates/definitions/iuo.json index bf5ed4e6e..46089f31a 100644 --- a/vmngclient/tests/templates/definitions/iuo.json +++ b/vmngclient/tests/templates/definitions/iuo.json @@ -2,108 +2,16 @@ "templateName": "iuo", "templateDescription": "zyx", "templateType": "cedge_aaa", - "deviceType": ["vedge-C8000V"], + "deviceType": [ + "vedge-C8000V" + ], "factoryDefault": false, "templateMinVersion": "15.0.0", "templateDefinition": { - "authentication": { - "dot1x": { - "default": { - "authentication_group": { - "vipObjectType": "object", - "vipType": "constant", - "vipValue": "true" - } - } - } - }, - "accounting": { - "dot1x": { - "default": { - "start-stop": { - "accounting_group": { - "vipObjectType": "object", - "vipType": "constant", - "vipValue": "false" - } - } - } - }, - "accounting-rule": { - "vipObjectType": "tree", - "vipValue": [], - "vipType": "ignore", - "vipPrimaryKey": [ - "rule-id" - ] - } - }, - "radius-dynamic-author": { - "radius-client": { - "vipObjectType": "tree", - "vipValue": [], - "vipType": "ignore", - "vipPrimaryKey": [ - "ip" - ] - }, - "rda-server-key": { - "vipObjectType": "object", - "vipValue": [], - "vipType": "ignore" - }, - "domain-stripping": { - "vipObjectType": "object", - "vipType": "constant", - "vipValue": "no" - }, - "auth-type": { - "vipObjectType": "object", - "vipValue": "any", - "vipType": "ignore" - }, - "port": { - "vipObjectType": "object", - "vipType": "constant", - "vipValue": 1700 - } - }, - "radius-trustsec": { - "cts-auth-list": { - "vipObjectType": "object", - "vipValue": [], - "vipType": "ignore" - }, - "radius-trustsec-group": { - "vipObjectType": "object", - "vipValue": [], - "vipType": "ignore" - } - }, - "authorization": { - "authorization-console": { - "vipObjectType": "object", - "vipValue": "false", - "vipType": "ignore" - }, - "authorization-config-commands": { - "vipObjectType": "object", - "vipValue": "false", - "vipType": "ignore" - }, - "authorization-rule": { - "vipObjectType": "tree", - "vipValue": [], - "vipType": "ignore", - "vipPrimaryKey": [ - "rule-id" - ] - } - }, "server-auth-order": { "vipObjectType": "object", - "vipValue": "local", - "vipType": "constant" + "vipType": "constant", + "vipValue": "local" }, "user": { "vipObjectType": "tree", @@ -238,11 +146,6 @@ "vipObjectType": "object", "vipValue": [], "vipType": "ignore" - }, - "key-type": { - "vipObjectType": "object", - "vipValue": "key", - "vipType": "ignore" } } ], @@ -265,4 +168,4 @@ ] } } -} \ No newline at end of file +} diff --git a/vmngclient/tests/templates/definitions/omp_1.json b/vmngclient/tests/templates/definitions/omp_1.json index 5ffc89880..b3918d9cd 100644 --- a/vmngclient/tests/templates/definitions/omp_1.json +++ b/vmngclient/tests/templates/definitions/omp_1.json @@ -3,71 +3,9 @@ "templateDescription": "default", "templateType": "omp-vsmart", "deviceType": [ - "vsmart" + "vedge-C8000V" ], + "factoryDefault": false, "templateMinVersion": "15.0.0", - "templateDefinition": { - "graceful-restart": { - "vipObjectType": "object", - "vipType": "ignore", - "vipValue": "true", - "vipVariableName": "omp_graceful_restart" - }, - "send-path-limit": { - "vipObjectType": "object", - "vipType": "ignore", - "vipValue": 4, - "vipVariableName": "omp_send_path_limit" - }, - "send-backup-paths": { - "vipObjectType": "object", - "vipType": "ignore", - "vipValue": "false", - "vipVariableName": "omp_send_backup_paths" - }, - "discard-rejected": { - "vipObjectType": "object", - "vipType": "ignore", - "vipValue": "false", - "vipVariableName": "omp_discard_rejected" - }, - "shutdown": { - "vipObjectType": "object", - "vipType": "ignore", - "vipValue": "false", - "vipVariableName": "omp_shutdown" - }, - "timers": { - "advertisement-interval": { - "vipObjectType": "object", - "vipType": "ignore", - "vipValue": 1, - "vipVariableName": "omp_advertisement_interval" - }, - "graceful-restart-timer": { - "vipObjectType": "object", - "vipType": "ignore", - "vipValue": 43200, - "vipVariableName": "omp_graceful_restart_timer" - }, - "holdtime": { - "vipObjectType": "object", - "vipType": "ignore", - "vipValue": 60, - "vipVariableName": "omp_holdtime" - }, - "eor-timer": { - "vipObjectType": "object", - "vipType": "ignore", - "vipValue": 300, - "vipVariableName": "omp_eor_timer" - } - }, - "filter-route": { - "outbound": { - "affinity-group-preference": {} - } - } - }, - "factoryDefault": false -} \ No newline at end of file + "templateDefinition": {} +} diff --git a/vmngclient/tests/templates/definitions/omp_2.json b/vmngclient/tests/templates/definitions/omp_2.json index fc080211b..42a61c9aa 100644 --- a/vmngclient/tests/templates/definitions/omp_2.json +++ b/vmngclient/tests/templates/definitions/omp_2.json @@ -3,71 +3,32 @@ "templateDescription": "some changes", "templateType": "omp-vsmart", "deviceType": [ - "vsmart" + "vedge-C8000V" ], + "factoryDefault": false, "templateMinVersion": "15.0.0", "templateDefinition": { "graceful-restart": { "vipObjectType": "object", "vipType": "constant", - "vipValue": "false", - "vipVariableName": "omp_graceful_restart" - }, - "send-path-limit": { - "vipObjectType": "object", - "vipType": "ignore", - "vipValue": 4, - "vipVariableName": "omp_send_path_limit" + "vipValue": "false" }, "send-backup-paths": { "vipObjectType": "object", "vipType": "constant", - "vipValue": "false", - "vipVariableName": "omp_send_backup_paths" - }, - "discard-rejected": { - "vipObjectType": "object", - "vipType": "ignore", - "vipValue": "false", - "vipVariableName": "omp_discard_rejected" + "vipValue": "false" }, "shutdown": { "vipObjectType": "object", "vipType": "constant", - "vipValue": "true", - "vipVariableName": "omp_shutdown" + "vipValue": "true" }, "timers": { - "advertisement-interval": { - "vipObjectType": "object", - "vipType": "ignore", - "vipValue": 1, - "vipVariableName": "omp_advertisement_interval" - }, - "graceful-restart-timer": { - "vipObjectType": "object", - "vipType": "ignore", - "vipValue": 43200, - "vipVariableName": "omp_graceful_restart_timer" - }, "holdtime": { "vipObjectType": "object", "vipType": "constant", - "vipValue": 30, - "vipVariableName": "omp_holdtime" - }, - "eor-timer": { - "vipObjectType": "object", - "vipType": "ignore", - "vipValue": 300, - "vipVariableName": "omp_eor_timer" - } - }, - "filter-route": { - "outbound": { - "affinity-group-preference": {} + "vipValue": 30 } } - }, - "factoryDefault": false -} \ No newline at end of file + } +} diff --git a/vmngclient/tests/templates/definitions/omp_3.json b/vmngclient/tests/templates/definitions/omp_3.json index 6cf660b7e..4cefbe83a 100644 --- a/vmngclient/tests/templates/definitions/omp_3.json +++ b/vmngclient/tests/templates/definitions/omp_3.json @@ -3,71 +3,55 @@ "templateDescription": "advanced", "templateType": "omp-vsmart", "deviceType": [ - "vsmart" + "vedge-C8000V" ], + "factoryDefault": false, "templateMinVersion": "15.0.0", "templateDefinition": { "graceful-restart": { "vipObjectType": "object", "vipType": "constant", - "vipValue": "false", - "vipVariableName": "omp_graceful_restart" + "vipValue": "false" }, "send-path-limit": { - "vipObjectType": "object", - "vipType": "variableName", "vipValue": "", + "vipType": "variableName", + "vipObjectType": "object", "vipVariableName": "omp_send_path_limit" }, "send-backup-paths": { "vipObjectType": "object", "vipType": "constant", - "vipValue": "true", - "vipVariableName": "omp_send_backup_paths" + "vipValue": "true" }, "discard-rejected": { - "vipObjectType": "object", - "vipType": "variableName", "vipValue": "", + "vipType": "variableName", + "vipObjectType": "object", "vipVariableName": "omp_discard_rejected_custom" }, "shutdown": { "vipObjectType": "object", "vipType": "constant", - "vipValue": "false", - "vipVariableName": "omp_shutdown" + "vipValue": "false" }, "timers": { "advertisement-interval": { "vipObjectType": "object", "vipType": "constant", - "vipValue": 3, - "vipVariableName": "omp_advertisement_interval" + "vipValue": 3 }, "graceful-restart-timer": { - "vipObjectType": "object", - "vipType": "variableName", "vipValue": "", + "vipType": "variableName", + "vipObjectType": "object", "vipVariableName": "omp_graceful_restart_timer" }, "holdtime": { "vipObjectType": "object", - "vipType": "ignore", - "vipValue": 60, - "vipVariableName": "omp_holdtime" - }, - "eor-timer": { - "vipObjectType": "object", - "vipType": "ignore", - "vipValue": 300, - "vipVariableName": "omp_eor_timer" - } - }, - "filter-route": { - "outbound": { - "affinity-group-preference": {} + "vipType": "constant", + "vipValue": 30 } } - }, - "factoryDefault": false -} \ No newline at end of file + } +} diff --git a/vmngclient/tests/templates/models/__init__.py b/vmngclient/tests/templates/models/__init__.py index 3f035b081..965963d36 100644 --- a/vmngclient/tests/templates/models/__init__.py +++ b/vmngclient/tests/templates/models/__init__.py @@ -1,6 +1,18 @@ # type: ignore -from vmngclient.tests.templates.models.cisco_aaa import cisco_aaa -from vmngclient.tests.templates.models.cisco_vpn import basic_cisco_vpn +from vmngclient.tests.templates.models.cisco_aaa import cisco_aaa, complex_aaa_model +from vmngclient.tests.templates.models.cisco_banner import banner_model +from vmngclient.tests.templates.models.cisco_bfd import bfd_model +from vmngclient.tests.templates.models.cisco_vpn import basic_cisco_vpn, complex_vpn_model from vmngclient.tests.templates.models.omp_vsmart import default_omp, omp_2, omp_3 -__all__ = ["default_omp", "omp_2", "omp_3", "cisco_aaa", "basic_cisco_vpn"] +__all__ = [ + "default_omp", + "omp_2", + "omp_3", + "cisco_aaa", + "complex_aaa_model", + "basic_cisco_vpn", + "complex_vpn_model", + "banner_model", + "bfd_model", +] diff --git a/vmngclient/tests/templates/models/cisco_aaa.py b/vmngclient/tests/templates/models/cisco_aaa.py index c4e7888c2..9aa30a070 100644 --- a/vmngclient/tests/templates/models/cisco_aaa.py +++ b/vmngclient/tests/templates/models/cisco_aaa.py @@ -1,8 +1,11 @@ +# type: ignore from vmngclient.api.templates.models.cisco_aaa_model import ( CiscoAAAModel, DomainStripping, RadiusGroup, RadiusServer, + TacacsGroup, + TacacsServer, User, ) from vmngclient.utils.device_model import DeviceModel @@ -42,3 +45,43 @@ ], domain_stripping=DomainStripping.NO, ) + +complex_aaa_model = CiscoAAAModel( + template_name="complex_aaa", + template_description="na", + user=[ + User(name="test1", password="*****", secret="secret", privilege="1"), + User(name="test2", password="*****", secret="secret", privilege="15"), + ], + authentication_group=True, + accounting_group=False, + radius=[ + RadiusGroup( + group_name="group1", + vpn=10, + source_interface="Gig1", + server=[RadiusServer(address="1.1.1.1", key="test_key", secret_key="secret_key")], + ), + RadiusGroup( + group_name="group2", + vpn=11, + source_interface="Gig2", + server=[ + RadiusServer( + address="1.1.2.1", + key="test_key2", + secret_key="secret_key2", + ) + ], + ), + ], + domain_stripping=DomainStripping.RIGHT_TO_LEFT, + tacacs=[ + TacacsGroup( + group_name="group1", + vpn=0, + source_interface="Gig0", + server=[TacacsServer(address="1.1.1.1", key="key", secret_key="secret_key")], + ) + ], +) diff --git a/vmngclient/tests/templates/models/cisco_banner.py b/vmngclient/tests/templates/models/cisco_banner.py new file mode 100644 index 000000000..d923c0880 --- /dev/null +++ b/vmngclient/tests/templates/models/cisco_banner.py @@ -0,0 +1,5 @@ +from vmngclient.api.templates.models.cisco_banner_model import CiscoBannerModel + +banner_model = CiscoBannerModel( # type: ignore + template_name="banner_1", template_description="na", login_banner="login banner", motd_banner="motd_bnanner" +) diff --git a/vmngclient/tests/templates/models/cisco_bfd.py b/vmngclient/tests/templates/models/cisco_bfd.py new file mode 100644 index 000000000..ed3094104 --- /dev/null +++ b/vmngclient/tests/templates/models/cisco_bfd.py @@ -0,0 +1,15 @@ +from vmngclient.api.templates.models.cisco_bfd_model import CiscoBFDModel, Color, ColorType + +bfd_model = CiscoBFDModel( # type: ignore + template_name="cisco_bfd", + template_description="na", + multiplier=100, + poll_interval=50, + default_dscp=50, + color=[ + Color( # type: ignore + color=ColorType.BIZ_INTERNET, hello_interval=50, multipler=100, pmtu_discovery=False, dscp=100 + ), + Color(color=ColorType.SILVER, hello_interval=150, multipler=10, dscp=20), # type: ignore + ], +) diff --git a/vmngclient/tests/templates/models/cisco_vpn.py b/vmngclient/tests/templates/models/cisco_vpn.py index 6bca2c66d..bfc275d36 100644 --- a/vmngclient/tests/templates/models/cisco_vpn.py +++ b/vmngclient/tests/templates/models/cisco_vpn.py @@ -1,6 +1,54 @@ # type: ignore -from vmngclient.api.templates.models.cisco_vpn_model import CiscoVPNModel, Dns, DnsIpv6, Host, NextHop, Routev4, Routev6 +from vmngclient.api.templates.models.cisco_vpn_model import ( + Advertise, + AdvertiseProtocol, + AdvertiseProtocolSubType, + CiscoVPNModel, + Direction, + Dns, + DnsIpv6, + GreRoute, + Host, + IpsecRoute, + Ipv6Advertise, + Ipv6AdvertiseProtocol, + Ipv6AdvertiseProtocolSubType, + LeakFromGlobalProtocol, + Nat, + Natpool, + NextHop, + Overload, + Pool, + PortForward, + PrefixList, + Proto, + Region, + Role, + RouteExport, + RouteExportProtocol, + RouteExportProtocolSubType, + RouteExportRedistribute, + RouteExportRedistributeProtocol, + RouteImport, + RouteImportFrom, + RouteImportFromProtocol, + RouteImportFromProtocolSubType, + RouteImportFromRedistribute, + RouteImportFromRedistributeProtocol, + RouteImportProtocol, + RouteImportProtocolSubType, + RouteImportRedistribute, + RouteImportRedistributeProtocol, + Routev4, + Routev6, + Service, + ServiceRoute, + Static, + StaticNatDirection, + SubnetStatic, + SvcType, +) from vmngclient.utils.device_model import DeviceModel basic_cisco_vpn = CiscoVPNModel( @@ -8,19 +56,212 @@ ) # type: ignore -complex_cisco_vpn = CiscoVPNModel( - template_name="Complex_CiscoVPN_Model", - template_description="Complex", - device_models=[DeviceModel.VEDGE_C8000V], - vpn_id=123, - vpn_name="VPN", - layer4=True, - omp_admin_distance_ipv4=255, - dns=[Dns(dns_addr="255.255.255.0")], - host=[Host(hostname="random", ip=["1.1.1.1", "2.2.2.2"])], +complex_vpn_model = CiscoVPNModel( + template_name="complex_cisco_vpn", + template_description="NA", + device_models=[DeviceModel.VEDGE], + vpn_name="test_vpn_name", + omp_admin_distance_ipv4=10, + omp_admin_distance_ipv6=100, + route_v4=[Routev4(prefix="prefixv4", next_hop=[NextHop(address="1.1.1.1")])], + route_v6=[Routev6(prefix="prefixv6", next_hop=[NextHop(address="2.2.2.2")], nat=Nat.NAT64)], + dns=[Dns(dns_addr="1.1.1.1"), Dns(dns_addr="2.2.2.2", role=Role.SECONDARY)], dns_ipv6=[DnsIpv6(dns_addr="30a8:b25e:3db5:fe9f:231f:7478:4181:9234")], - route_v4=[Routev4(prefix="1.1.1.1/24", null0=True, distance=5, next_hop=[NextHop(address="1.1.1.1")])], - route_v6=[ - Routev6(prefix="2001:db8:1234::/48", next_hop=[NextHop(address="2001:db8:1234:0000:0000:0000:0000:0000")]) + host=[Host(hostname="test_hostname", ip=["1.1.1.1"])], + service=[ + Service( + svc_type=SvcType.APPQOE, + address=["1.1.1.1"], + interface="Gig0/0/1", + track_enable=False, + ), + Service( + svc_type=SvcType.FW, + address=["1.1.122.1", "2.2.2.2"], + interface="Gig0/0/2", + track_enable=True, + ), + Service( + svc_type=SvcType.IDP, + address=["1.1.122.2", "3.2.2.2"], + interface="Gig0/0/3", + track_enable=False, + ), + ], + service_route=[ + ServiceRoute(prefix="service_route", vpn=1), + ServiceRoute(prefix="service_route100", vpn=100), + ], + gre_route=[ + GreRoute(prefix="gre_route", vpn=100), + GreRoute(prefix="gre_route2", vpn=2, interface=["Gig0/0/1", "ge0/0"]), + ], + ipsec_route=[ + IpsecRoute(prefix="ipsec-prefix", vpn=10, interface=["ge0/0", "Gig0/0/1"]), + IpsecRoute(prefix="prefix-2", vpn=100), + ], + advertise=[ + Advertise( + protocol=AdvertiseProtocol.AGGREGATE, + route_policy="route-policy", + protocol_sub_type=[AdvertiseProtocolSubType.EXTERNAL], + prefix_list=[ + PrefixList( + prefix_entry="prefix_entry", + aggregate_only=True, + region=Region.ACCESS, + ) + ], + ) + ], + ipv6_advertise=[ + Ipv6Advertise( + protocol=Ipv6AdvertiseProtocol.AGGREGATE, + route_policy="route-policyv6", + protocol_sub_type=[Ipv6AdvertiseProtocolSubType.EXTERNAL], + prefix_list=[ + PrefixList( + prefix_entry="prefix_entryv6", + aggregate_only=False, + region=Region.CORE, + ) + ], + ), + Ipv6Advertise( + protocol=Ipv6AdvertiseProtocol.CONNECTED, + route_policy="route-policyv6-connected", + protocol_sub_type=[Ipv6AdvertiseProtocolSubType.EXTERNAL], + prefix_list=[ + PrefixList( + prefix_entry="prefix_entryv6-connected", + aggregate_only=True, + region=Region.ACCESS, + ) + ], + ), + ], + pool=[ + Pool( + name="pool", + start_address="1.1.1.1", + end_address="10.10.10.10", + overload=False, + leak_from_global=True, + leak_from_global_protocol=LeakFromGlobalProtocol.CONNECTED, + leak_to_global=False, + ) + ], + natpool=[ + Natpool( + name=1, + prefix_length=24, + range_start="10", + range_end="100", + overload=Overload.FALSE, + direction=Direction.INSIDE, + tracker_id=10, + ), + Natpool( + name=2, + prefix_length=24, + range_start="10", + range_end="100", + overload=Overload.TRUE, + direction=Direction.OUTSIDE, + ), + ], + static=[ + Static( + pool_name=1, + source_ip="1.1.1.1", + translate_ip="1.1.1.2", + static_nat_direction=StaticNatDirection.INSIDE, + tracker_id=1, + ), + Static( + pool_name=2, + source_ip="2.1.1.1", + translate_ip="2.1.1.2", + static_nat_direction=StaticNatDirection.OUTSIDE, + ), + ], + subnet_static=[ + SubnetStatic( + source_ip_subnet="1.1.1.1", + translate_ip_subnet="2.2.2.2", + prefix_length=24, + static_nat_direction=StaticNatDirection.OUTSIDE, + ), + SubnetStatic( + source_ip_subnet="1.1.2.1", + translate_ip_subnet="2.3.2.2", + prefix_length=24, + static_nat_direction=StaticNatDirection.INSIDE, + tracker_id=10, + ), + ], + port_forward=[ + PortForward( + pool_name=1, + source_port=1000, + translate_port=2000, + source_ip="1.1.1.1", + translate_ip="2.2.2.2", + proto=Proto.TCP, + ), + PortForward( + pool_name=2, + source_port=1000, + translate_port=2000, + source_ip="1.1.4.1", + translate_ip="2.2.3.2", + proto=Proto.UDP, + ), + ], + route_import=[ + RouteImport( + protocol=RouteImportProtocol.BGP, + protocol_sub_type=[RouteImportProtocolSubType.EXTERNAL], + route_policy="test_route_policy", + redistribute=[ + RouteImportRedistribute( + protocol=RouteImportRedistributeProtocol.EIGRP, + route_policy="test_route_policy", + ) + ], + ) + ], + route_import_from=[ + RouteImportFrom( + source_vpn=1, + protocol=RouteImportFromProtocol.CONNECTED, + protocol_sub_type=[RouteImportFromProtocolSubType.EXTERNAL], + route_policy="test_route_policy", + redistribute=[RouteImportFromRedistribute(protocol=RouteImportFromRedistributeProtocol.BGP)], + ), + RouteImportFrom( + source_vpn=100, + protocol=RouteImportFromProtocol.BGP, + protocol_sub_type=[RouteImportFromProtocolSubType.EXTERNAL], + route_policy="test_route_policy", + redistribute=[ + RouteImportFromRedistribute( + protocol=RouteImportFromRedistributeProtocol.EIGRP, + route_policy="test_route_policy", + ) + ], + ), + ], + route_export=[ + RouteExport( + protocol=RouteExportProtocol.STATIC, + protocol_sub_type=[RouteExportProtocolSubType.EXTERNAL], + redistribute=[ + RouteExportRedistribute( + protocol=RouteExportRedistributeProtocol.OSPF, + route_policy="test_route_policy", + ) + ], + ) ], ) diff --git a/vmngclient/tests/templates/schemas/basic/children.json b/vmngclient/tests/templates/schemas/basic/children.json index 750ebf208..d34d61f3e 100644 --- a/vmngclient/tests/templates/schemas/basic/children.json +++ b/vmngclient/tests/templates/schemas/basic/children.json @@ -50,7 +50,7 @@ "type": "passphrase", "maxLength": 32 }, - "dataPath": [], + "dataPath": ["list"], "objectType": "object" } ] diff --git a/vmngclient/tests/templates/schemas/basic/children_nested.json b/vmngclient/tests/templates/schemas/basic/children_nested.json index 599e9ee7e..a4476f234 100644 --- a/vmngclient/tests/templates/schemas/basic/children_nested.json +++ b/vmngclient/tests/templates/schemas/basic/children_nested.json @@ -50,7 +50,7 @@ "type": "passphrase", "maxLength": 32 }, - "dataPath": [], + "dataPath": ["list"], "objectType": "object" }, { @@ -101,7 +101,7 @@ "minLength": 1, "maxLength": 32 }, - "dataPath": [], + "dataPath": ["type", "RSA"], "objectType": "object" } ] diff --git a/vmngclient/tests/templates/schemas/cisco_banner.json b/vmngclient/tests/templates/schemas/cisco_banner.json new file mode 100644 index 000000000..f5eaea388 --- /dev/null +++ b/vmngclient/tests/templates/schemas/cisco_banner.json @@ -0,0 +1,44 @@ +{ + "name": "cisco_banner", + "xmlPath": [], + "xmlRootTag": "banner", + "nameSpace": "http://viptela.com/system", + "fields": [ + { + "key": "login", + "description": "Login Banner", + "details": "Set message to display before login prompt", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "string", + "minLength": 1, + "maxLength": 2048 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "motd", + "description": "MOTD Banner", + "details": "Set message to display after a user logs in", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "string", + "minLength": 1, + "maxLength": 2048 + }, + "dataPath": [], + "objectType": "object" + } + ] +} \ No newline at end of file diff --git a/vmngclient/tests/templates/schemas/cisco_bfd.json b/vmngclient/tests/templates/schemas/cisco_bfd.json new file mode 100644 index 000000000..d6376ceb5 --- /dev/null +++ b/vmngclient/tests/templates/schemas/cisco_bfd.json @@ -0,0 +1,266 @@ +{ + "name": "cisco_bfd", + "xmlPath": [], + "xmlRootTag": "bfd", + "nameSpace": "http://viptela.com/bfd", + "fields": [ + { + "key": "multiplier", + "description": "Multiplier", + "details": "Set the number of polling intervals used to determine tunnel SLA class", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 1, + "max": 6, + "default": 6 + }, + "dataPath": [ + "app-route" + ], + "objectType": "object" + }, + { + "key": "poll-interval", + "description": "Poll Interval (milliseconds)", + "details": "Set how often BFD polls tunnels to collect packet latency, loss, and statistics", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 1, + "max": 4294967295, + "default": 600000 + }, + "dataPath": [ + "app-route" + ], + "objectType": "object" + }, + { + "key": "default-dscp", + "description": "Default DSCP value for BFD packets", + "details": "Set default DSCP value for BFD packets", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 0, + "max": 63, + "default": 48 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "color", + "description": "Color", + "details": "Set color that identifies the WAN transport tunnel", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [], + "objectType": "tree", + "primaryKeys": [ + "color" + ], + "children": [ + { + "key": "color", + "description": "Color", + "details": "Set color that identifies the WAN transport tunnel", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "enum", + "values": [ + { + "key": "default", + "value": "Default" + }, + { + "key": "mpls", + "value": "MPLS" + }, + { + "key": "metro-ethernet", + "value": "Metro Ethernet" + }, + { + "key": "biz-internet", + "value": "Biz Internet" + }, + { + "key": "public-internet", + "value": "Public Internet" + }, + { + "key": "lte", + "value": "LTE" + }, + { + "key": "3g", + "value": "3G" + }, + { + "key": "red", + "value": "Red" + }, + { + "key": "green", + "value": "Green" + }, + { + "key": "blue", + "value": "Blue" + }, + { + "key": "gold", + "value": "Gold" + }, + { + "key": "silver", + "value": "Silver" + }, + { + "key": "bronze", + "value": "Bronze" + }, + { + "key": "custom1", + "value": "Custom 1" + }, + { + "key": "custom2", + "value": "Custom 2" + }, + { + "key": "custom3", + "value": "Custom 3" + }, + { + "key": "private1", + "value": "Private 1" + }, + { + "key": "private2", + "value": "Private 2" + }, + { + "key": "private3", + "value": "Private 3" + }, + { + "key": "private4", + "value": "Private 4" + }, + { + "key": "private5", + "value": "Private 5" + }, + { + "key": "private6", + "value": "Private 6" + } + ] + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "hello-interval", + "description": "Hello Interval (milliseconds)", + "details": "Set how often BFD sends Hello packets", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 100, + "max": 300000, + "default": 1000 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "multiplier", + "description": "Multiplier", + "details": "Set how many Hello packet intervals to wait before declaring that a tunnel has failed", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 1, + "max": 60, + "default": 7 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "pmtu-discovery", + "description": "Path MTU Discovery", + "details": "Control automatic path MTU discovery", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "boolean", + "default": "true" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "dscp", + "description": "BFD Default DSCP value for tloc color", + "details": "Set BFD Default DSCP value for tloc color", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 0, + "max": 63, + "default": 48 + }, + "dataPath": [], + "objectType": "object" + } + ] + } + ] +} \ No newline at end of file diff --git a/vmngclient/tests/templates/schemas/cisco_vpn.json b/vmngclient/tests/templates/schemas/cisco_vpn.json new file mode 100644 index 000000000..b4c0552aa --- /dev/null +++ b/vmngclient/tests/templates/schemas/cisco_vpn.json @@ -0,0 +1,2452 @@ +{ + "name": "cisco_vpn", + "xmlPath": [ + "vpn" + ], + "xmlRootTag": "vpn-instance", + "uniqueKey": "vpn-id", + "nameSpace": "http://viptela.com/vpn", + "fields": [ + { + "key": "vpn-id", + "description": "VPN", + "details": "List of VPN instances", + "optionType": [ + "constant" + ], + "defaultOption": "constant", + "dataType": { + "type": "number", + "min": 0, + "max": 65527, + "default": 0 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "name", + "description": "Name", + "details": "Name", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "string", + "minLength": 1, + "maxLength": 32 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "tenant-vpn-id", + "description": "Tenant VPN", + "details": "Tenant VPN", + "optionType": [ + "constant" + ], + "defaultOption": "constant", + "dataType": { + "type": "number", + "min": 0, + "max": 65527, + "default": 0 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "org-name", + "description": "Select Tenant", + "details": "Org Name selected", + "optionType": [ + "constant" + ], + "defaultOption": "constant", + "dataType": { + "type": "string" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "omp-admin-distance-ipv4", + "description": "OMP Admin Distance IPv4", + "details": "omp-admin-distance-ipv4", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 1, + "max": 255 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "omp-admin-distance-ipv6", + "description": "OMP Admin Distance IPv6", + "details": "omp-admin-distance-ipv6", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 1, + "max": 255 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "dns", + "description": "DNS", + "details": "DNS", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [], + "objectType": "tree", + "primaryKeys": [ + "dns-addr" + ], + "children": [ + { + "key": "dns-addr", + "description": "DNS Address", + "details": "DNS Address", + "optionType": [ + "constant" + ], + "defaultOption": "constant", + "dataType": { + "type": "ip" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "role", + "description": "Role", + "details": "Role", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "enum", + "values": [ + { + "key": "primary", + "value": "Primary" + }, + { + "key": "secondary", + "value": "Secondary" + } + ], + "default": "primary" + }, + "dataPath": [], + "objectType": "object" + } + ] + }, + { + "key": "dns-ipv6", + "description": "DNS", + "details": "DNS", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [], + "objectType": "tree", + "primaryKeys": [ + "dns-addr" + ], + "children": [ + { + "key": "dns-addr", + "description": "DNS Address", + "details": "DNS Address", + "optionType": [ + "constant" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv6" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "role", + "description": "Role", + "details": "Role", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "enum", + "values": [ + { + "key": "primary", + "value": "Primary" + }, + { + "key": "secondary", + "value": "Secondary" + } + ], + "default": "primary" + }, + "dataPath": [], + "objectType": "object" + } + ] + }, + { + "key": "layer4", + "description": "Enhance ECMP Keying", + "details": "Optional packet fields for ECMP keying", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "boolean", + "default": "false" + }, + "dataPath": [ + "ecmp-hash-key" + ], + "objectType": "object" + }, + { + "key": "host", + "description": "Static DNS Mapping", + "details": "Static DNS mapping", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [], + "objectType": "tree", + "primaryKeys": [ + "hostname" + ], + "children": [ + { + "key": "hostname", + "description": "Hostname", + "details": "Hostname", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "dnsHostName", + "minLength": 1, + "maxLength": 128 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "ip", + "description": "List of IP", + "details": "List of IP", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ip", + "max": 8 + }, + "dataPath": [], + "objectType": "list" + } + ] + }, + { + "key": "service", + "description": "Service", + "details": "Configure services", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [], + "objectType": "tree", + "primaryKeys": [ + "svc-type" + ], + "children": [ + { + "key": "svc-type", + "description": "Service Type", + "details": "Service Type", + "optionType": [ + "constant" + ], + "defaultOption": "constant", + "dataType": { + "type": "enum", + "values": [ + { + "key": "FW", + "value": "FW" + }, + { + "key": "IDS", + "value": "IDS" + }, + { + "key": "IDP", + "value": "IDP" + }, + { + "key": "netsvc1", + "value": "netsvc1" + }, + { + "key": "netsvc2", + "value": "netsvc2" + }, + { + "key": "netsvc3", + "value": "netsvc3" + }, + { + "key": "netsvc4", + "value": "netsvc4" + }, + { + "key": "TE", + "value": "TE" + }, + { + "key": "appqoe", + "value": "appqoe" + } + ] + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "address", + "description": "IPv4 address", + "details": "List of IPv4 address", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv4" + }, + "dataPath": [], + "objectType": "list", + "minChildren": "0", + "maxChildren": "4" + }, + { + "key": "interface", + "description": "Interface", + "details": "Tracking Service", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": "string", + "dataPath": [], + "objectType": "object" + }, + { + "key": "track-enable", + "description": "Tracking", + "details": "Tracking Service", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "boolean", + "default": "true" + }, + "dataPath": [], + "objectType": "object" + } + ] + }, + { + "key": "service-route", + "description": "IPv4 Static Service Route", + "details": "Configure IPv4 Static Service Routes", + "optionType": [ + "constant", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [ + "ip" + ], + "objectType": "tree", + "primaryKeys": [ + "prefix" + ], + "children": [ + { + "key": "prefix", + "description": "Prefix", + "details": "Prefix", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv4-prefix" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "vpn", + "description": "VPN", + "details": "Destination VPN to resolve the prefix", + "optionType": [ + "constant" + ], + "defaultOption": "constant", + "dataType": { + "type": "number", + "min": 0, + "max": 0, + "default": 0 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "service", + "description": "Service", + "details": "Service", + "optionType": [ + "constant", + "notIgnore" + ], + "defaultOption": "notIgnore", + "dataType": { + "type": "enum", + "values": [ + { + "key": "sig", + "value": "SIG" + } + ], + "default": "sig" + }, + "dataPath": [], + "objectType": "object" + } + ] + }, + { + "key": "route", + "description": "IPv4 Static Route", + "details": "Configure IPv4 Static Routes", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [ + "ip" + ], + "objectType": "tree", + "primaryKeys": [ + "prefix" + ], + "children": [ + { + "key": "prefix", + "description": "Prefix", + "details": "Prefix", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv4-prefix" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "next-hop", + "description": "IP Gateway", + "details": "IP gateway address", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [], + "objectType": "tree", + "primaryKeys": [ + "address" + ], + "children": [ + { + "key": "address", + "description": "Address", + "details": "IP Address", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "string" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "distance", + "description": "Distance", + "details": "Administrative distance", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 1, + "max": 255, + "default": 1 + }, + "dataPath": [], + "objectType": "object" + } + ] + }, + { + "key": "next-hop-with-track", + "description": "IP Gateway", + "details": "IP gateway address", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [], + "objectType": "tree", + "primaryKeys": [ + "address" + ], + "children": [ + { + "key": "address", + "description": "Address", + "details": "IP Address", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "string" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "distance", + "description": "Distance", + "details": "Administrative distance", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 1, + "max": 255, + "default": 1 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "tracker", + "description": "Tracker", + "details": "Static route tracker", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "string" + }, + "dataPath": [], + "objectType": "object" + } + ] + }, + { + "key": "null0", + "description": "null0", + "details": "null0", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "boolean", + "default": "false" + }, + "dataPath": [], + "objectType": "node-only" + }, + { + "key": "distance", + "description": "Distance", + "details": "Administrative distance", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 1, + "max": 255, + "default": 1 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "vpn", + "description": "VPN", + "details": "Destination VPN(!=0 or !=512) to resolve the prefix", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "range": "0", + "default": 0 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "dhcp", + "description": "DHCP", + "details": "Default Gateway obtained from DHCP", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "boolean", + "default": "false" + }, + "dataPath": [], + "objectType": "node-only" + } + ] + }, + { + "key": "route", + "description": "IPv6 Static Route", + "details": "Configure IPv6 Static Routes", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [ + "ipv6" + ], + "objectType": "tree", + "primaryKeys": [ + "prefix" + ], + "children": [ + { + "key": "prefix", + "description": "Prefix", + "details": "Prefix", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv6-prefix" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "next-hop", + "description": "IP Gateway", + "details": "IP gateway address", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [], + "objectType": "tree", + "primaryKeys": [ + "address" + ], + "children": [ + { + "key": "address", + "description": "Address", + "details": "IP Address", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv6" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "distance", + "description": "Distance", + "details": "Administrative distance", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 1, + "max": 255, + "default": 1 + }, + "dataPath": [], + "objectType": "object" + } + ] + }, + { + "key": "null0", + "description": "null0", + "details": "null0", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "boolean", + "default": "false" + }, + "dataPath": [], + "objectType": "node-only" + }, + { + "key": "vpn", + "description": "VPN", + "details": "Destination VPN(!=0 or !=512) to resolve the prefix", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "range": "0", + "default": 0 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "nat", + "description": "NAT", + "details": "NAT", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "constant", + "dataType": { + "type": "radioButtonList", + "default": "NAT64", + "values": [ + { + "label": "NAT64", + "value": "NAT64" + }, + { + "label": "NAT66", + "value": "NAT66" + } + ] + }, + "dataPath": [], + "objectType": "object" + } + ] + }, + { + "key": "gre-route", + "description": "IPv4 Static GRE Route", + "details": "Configure routes pointing to a GRE tunnel", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [ + "ip" + ], + "objectType": "tree", + "primaryKeys": [ + "prefix" + ], + "children": [ + { + "key": "prefix", + "description": "Prefix", + "details": "Prefix", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv4-prefix" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "vpn", + "description": "VPN", + "details": "Destination VPN to resolve the prefix", + "optionType": [ + "constant" + ], + "defaultOption": "constant", + "dataType": { + "type": "number", + "min": 0, + "max": 0, + "default": 0 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "interface", + "description": "GRE Interface (Maximum entries allowed: 2)", + "details": "List of GRE Interfaces", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "string" + }, + "minChildren": "0", + "maxChildren": "2", + "dataPath": [], + "objectType": "list" + } + ] + }, + { + "key": "ipsec-route", + "description": "IPv4 Static IPSEC Route", + "details": "Configure routes pointing to a IPSEC tunnel", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [ + "ip" + ], + "objectType": "tree", + "primaryKeys": [ + "prefix" + ], + "children": [ + { + "key": "prefix", + "description": "Prefix", + "details": "Prefix", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv4-prefix" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "vpn", + "description": "VPN", + "details": "Destination VPN to resolve the prefix", + "optionType": [ + "constant" + ], + "defaultOption": "constant", + "dataType": { + "type": "number", + "min": 0, + "max": 0, + "default": 0 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "interface", + "description": "IPSEC Interface (Maximum entries allowed: 2)", + "details": "List of IPSEC Interfaces (Separated by commas)", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "interfaceList" + }, + "minChildren": "0", + "maxChildren": "2", + "dataPath": [], + "objectType": "list" + } + ] + }, + { + "key": "advertise", + "description": "Advertise", + "details": "Advertise routes to OMP", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [ + "omp" + ], + "objectType": "tree", + "primaryKeys": [ + "protocol" + ], + "children": [ + { + "key": "protocol", + "description": "Protocol", + "details": "Advertised routes protocol", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "constant", + "dataType": { + "type": "enum", + "values": [ + { + "key": "bgp", + "value": "BGP" + }, + { + "key": "ospf", + "value": "OSPF" + }, + { + "key": "ospfv3", + "value": "OSPFV3" + }, + { + "key": "connected", + "value": "Connected" + }, + { + "key": "static", + "value": "Static" + }, + { + "key": "network", + "value": "Network" + }, + { + "key": "aggregate", + "value": "Aggregate" + }, + { + "key": "eigrp", + "value": "EIGRP" + }, + { + "key": "lisp", + "value": "LISP" + }, + { + "key": "isis", + "value": "ISIS" + } + ] + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "route-policy", + "description": "Route Policy", + "details": "Set Route Policy to OMP", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "string", + "minLength": 1, + "maxLength": 127 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "protocol-sub-type", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "minElements": 1, + "dataType": { + "type": "enum", + "values": [ + { + "key": "external", + "value": "External" + } + ] + }, + "dataPath": [], + "objectType": "list" + }, + { + "key": "prefix-list", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "minElements": 1, + "dataPath": [], + "objectType": "tree", + "primaryKeys": [ + "prefix-entry" + ], + "children": [ + { + "key": "prefix-entry", + "description": "Prefix", + "details": "Prefix", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv4-prefix" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "aggregate-only", + "description": "Aggregate Only", + "details": "Aggregate Only", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "boolean", + "default": "false" + }, + "dataPath": [], + "objectType": "object" + } + ] + } + ] + }, + { + "key": "ipv6-advertise", + "description": "Advertise", + "details": "Advertise routes to OMP", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [ + "omp" + ], + "objectType": "tree", + "primaryKeys": [ + "protocol" + ], + "children": [ + { + "key": "protocol", + "description": "Protocol", + "details": "Advertised routes protocol", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "constant", + "dataType": { + "type": "enum", + "values": [ + { + "key": "bgp", + "value": "BGP" + }, + { + "key": "ospf", + "value": "Ospf" + }, + { + "key": "connected", + "value": "Connected" + }, + { + "key": "static", + "value": "Static" + }, + { + "key": "network", + "value": "Network" + }, + { + "key": "aggregate", + "value": "Aggregate" + } + ] + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "route-policy", + "description": "Route Policy", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "string", + "minLength": 1, + "maxLength": 127 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "protocol-sub-type", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "minElements": 1, + "dataType": { + "type": "enum", + "values": [ + { + "key": "external", + "value": "External" + } + ] + }, + "dataPath": [], + "objectType": "list" + }, + { + "key": "prefix-list", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "minElements": 1, + "dataPath": [], + "objectType": "tree", + "primaryKeys": [ + "prefix-entry" + ], + "children": [ + { + "key": "prefix-entry", + "description": "Prefix", + "details": "Prefix", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv6-prefix" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "aggregate-only", + "description": "Aggregate Only", + "details": "Aggregate Only", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "boolean", + "default": "false" + }, + "dataPath": [], + "objectType": "object" + } + ] + } + ] + }, + { + "key": "pool", + "description": "NAT64 V4 Pool", + "details": "Set NAT64 v4 pool range", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [ + "nat64", + "v4" + ], + "objectType": "tree", + "primaryKeys": [ + "name" + ], + "children": [ + { + "key": "name", + "description": "NAT64 Pool name", + "details": "NAT64 Pool name", + "optionType": [ + "constant" + ], + "defaultOption": "constant", + "dataType": { + "type": "string", + "minLength": 1, + "maxLength": 32 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "start-address", + "description": "NAT 64 v4 Pool Range Start", + "details": "Starting IP address of NAT pool range", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv4" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "end-address", + "description": "NAT 64 v4 Pool Range End", + "details": "Ending IP address of NAT pool range", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv4" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "overload", + "description": "NAT 64 Overload", + "details": "NAT 64 Overload Option", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "boolean", + "default": "false" + }, + "dataPath": [], + "objectType": "node-only" + }, + { + "key": "leak_from_global", + "description": "Enable Route Leaking from Global VPN", + "details": "Enable Route Leaking from Global VPN to this Service VPN", + "optionType": [ + "constant" + ], + "defaultOption": "constant", + "dataType": { + "type": "boolean", + "default": "false" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "leak_from_global_protocol", + "description": "Protocol", + "details": "Select protocol for route leaking", + "optionType": [ + "constant" + ], + "defaultOption": "constant", + "dataType": { + "type": "enum", + "values": [ + { + "key": "all", + "value": "All" + }, + { + "key": "static", + "value": "Static" + }, + { + "key": "mobile", + "value": "Mobile" + }, + { + "key": "connected", + "value": "Connected" + }, + { + "key": "rip", + "value": "Rip" + }, + { + "key": "odr", + "value": "Odr" + } + ] + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "leak_to_global", + "description": "Enable Route Leaking to Global VPN", + "details": "Enable Route Leaking from this Service VPN to Global VPN", + "optionType": [ + "constant" + ], + "defaultOption": "constant", + "dataType": { + "type": "boolean", + "default": "false" + }, + "dataPath": [], + "objectType": "object" + } + ] + }, + { + "key": "natpool", + "description": "NAT Pool", + "details": "Configure NAT Pool entries", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [ + "nat" + ], + "objectType": "tree", + "primaryKeys": [ + "name" + ], + "children": [ + { + "key": "name", + "description": "NAT Pool Name", + "details": "NAT Pool Name, natpool1..31", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "number", + "min": 1, + "max": 31 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "prefix-length", + "description": "NAT Pool Prefix Length", + "details": "Ending IP address of NAT Pool Prefix Length", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "number", + "min": 1, + "max": 32 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "range-start", + "description": "NAT Pool Range Start", + "details": "Starting IP address of NAT pool range", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv4" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "range-end", + "description": "NAT Pool Range End", + "details": "Ending IP address of NAT pool range", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv4" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "overload", + "description": "NAT Overload", + "details": "Enable port translation(PAT)", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "boolean", + "default": "true" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "direction", + "description": "NAT Direction", + "details": "Direction of NAT translation", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "enum", + "values": [ + { + "key": "inside", + "value": "Inside" + }, + { + "key": "outside", + "value": "Outside" + } + ] + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "tracker-id", + "description": "Add Object/Object Group Tracker", + "details": "Add Object/Object Group Tracker", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 1, + "max": 1000 + }, + "dataPath": [], + "objectType": "object" + } + ] + }, + { + "key": "static", + "description": "Static NAT Rules", + "details": "Configure static NAT entries", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [ + "nat" + ], + "objectType": "tree", + "primaryKeys": [ + "source-ip", + "translate-ip" + ], + "children": [ + { + "key": "pool-name", + "description": "NAT Pool Name", + "details": "NAT Pool Name, natpool1..31", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "enum", + "values": [] + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "source-ip", + "description": "Source IP Address", + "details": "Source IP address to be translated", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv4" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "translate-ip", + "description": "Translated Source IP Address", + "details": "Statically translated source IP address", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv4" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "static-nat-direction", + "description": "Static NAT Direction", + "details": "Direction of static NAT translation", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "enum", + "values": [ + { + "key": "inside", + "value": "Inside" + }, + { + "key": "outside", + "value": "Outside" + } + ] + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "tracker-id", + "description": "Add Object/Object Group Tracker", + "details": "Add Object/Object Group Tracker", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 1, + "max": 1000 + }, + "dataPath": [], + "objectType": "object" + } + ] + }, + { + "key": "subnet-static", + "description": "Static NAT Subnet Rules", + "details": "Configure static NAT Subnet entries", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [ + "nat" + ], + "objectType": "tree", + "primaryKeys": [ + "source-ip-subnet", + "translate-ip-subnet" + ], + "children": [ + { + "key": "source-ip-subnet", + "description": "Source IP Subnet", + "details": "Source IP Subnet to be translated", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv4" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "translate-ip-subnet", + "description": "Translated Source IP Subnet", + "details": "Statically translated source IP Subnet", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv4" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "prefix-length", + "description": "Network Prefix Length", + "details": "Network Prefix Length", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "number", + "min": 1, + "max": 32 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "static-nat-direction", + "description": "Static NAT Direction", + "details": "Direction of static NAT translation", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "enum", + "values": [ + { + "key": "inside", + "value": "Inside" + }, + { + "key": "outside", + "value": "Outside" + } + ] + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "tracker-id", + "description": "Add Object/Object Group Tracker", + "details": "Add Object/Object Group Tracker", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 1, + "max": 1000 + }, + "dataPath": [], + "objectType": "object" + } + ] + }, + { + "key": "port-forward", + "description": "Port Forward", + "details": "Configure Port Forward entries", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [ + "nat" + ], + "objectType": "tree", + "primaryKeys": [ + "source-port", + "translate-port", + "source-ip", + "translate-ip", + "proto" + ], + "children": [ + { + "key": "pool-name", + "description": "NAT Pool Name", + "details": "NAT Pool Name, natpool1..31", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "enum", + "values": [] + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "source-port", + "description": "Source Port", + "details": "Source Port", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "number", + "default": 0 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "translate-port", + "description": "Translate Port", + "details": "Translate Port", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "number", + "default": 0 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "source-ip", + "description": "Source IP Address", + "details": "Source IP address to be translated", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv4" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "translate-ip", + "description": "Translated Source IP Address", + "details": "Statically translated source IP address", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "ipv4" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "proto", + "description": "Protocol", + "details": "Protocol", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "enum", + "values": [ + { + "key": "tcp", + "value": "TCP" + }, + { + "key": "udp", + "value": "UDP" + } + ] + }, + "dataPath": [], + "objectType": "object" + } + ] + }, + { + "key": "route-import", + "description": "Enable route leaking from Global VPN", + "details": "Enable route leaking from Global VPN to this Service VPN", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [], + "objectType": "tree", + "primaryKeys": [ + "protocol" + ], + "children": [ + { + "key": "protocol", + "description": "Route Protocol Leak from Global to Service", + "details": "Select a Route Protocol to enable route leaking from Global VPN to this Service VPN", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "enum", + "values": [ + { + "key": "static", + "value": "static" + }, + { + "key": "connected", + "value": "connected" + }, + { + "key": "bgp", + "value": "bgp" + }, + { + "key": "ospf", + "value": "ospf" + } + ] + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "protocol-sub-type", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "minElements": 1, + "dataType": { + "type": "enum", + "values": [ + { + "key": "external", + "value": "external" + } + ], + "default": "external" + }, + "dataPath": [], + "objectType": "list" + }, + { + "key": "route-policy", + "description": "Route Policy Leak from Global to Service", + "details": "Select a Route Policy to enable route leaking from Global VPN to this Service VPN", + "optionType": [ + "constant", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "enum", + "values": [], + "default": "" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "redistribute", + "description": "Redistribute To Protocol", + "details": "Enable redistribution of replicated route protocol", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [], + "objectType": "tree", + "primaryKeys": [ + "protocol" + ], + "children": [ + { + "key": "protocol", + "description": "Protocol", + "details": "Select a Route Protocol to enable redistribution", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "enum", + "values": [ + { + "key": "bgp", + "value": "bgp" + }, + { + "key": "eigrp", + "value": "eigrp" + }, + { + "key": "ospf", + "value": "ospf" + } + ] + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "route-policy", + "description": "Redistribution Policy", + "details": "Select a Route Policy to enable redistribution", + "optionType": [ + "constant", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "enum", + "values": [], + "default": "" + }, + "dataPath": [], + "objectType": "object" + } + ] + } + ] + }, + { + "key": "route-import-from", + "description": "Enable inter-service VPN route leak", + "details": "Enable route leak from Service VPN to current VPN", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [], + "objectType": "tree", + "primaryKeys": [ + "source-vpn", + "protocol" + ], + "children": [ + { + "key": "source-vpn", + "description": "Source VPN", + "details": "Select a Source VPN where route leaks from", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "number", + "min": 1, + "max": 65530, + "default": 1 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "protocol", + "description": "Route Protocol Leak to Current VPN", + "details": "Select a Route Protocol to enable route leaking to current VPN", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "enum", + "values": [ + { + "key": "static", + "value": "static" + }, + { + "key": "connected", + "value": "connected" + }, + { + "key": "bgp", + "value": "bgp" + }, + { + "key": "ospf", + "value": "ospf" + }, + { + "key": "eigrp", + "value": "eigrp" + } + ] + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "protocol-sub-type", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "minElements": 1, + "dataType": { + "type": "enum", + "values": [ + { + "key": "external", + "value": "external" + } + ], + "default": "external" + }, + "dataPath": [], + "objectType": "list" + }, + { + "key": "route-policy", + "description": "Route Policy Leak to Current VPN", + "details": "Select a Route Policy to enable route leaking to current VPN", + "optionType": [ + "constant", + "ignore", + "variable" + ], + "defaultOption": "ignore", + "dataType": { + "type": "enum", + "values": [], + "default": "" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "redistribute", + "description": "Redistribute To Protocol", + "details": "Enable redistribution of replicated route protocol", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [], + "objectType": "tree", + "primaryKeys": [ + "protocol" + ], + "children": [ + { + "key": "protocol", + "description": "Protocol", + "details": "Select a Route Protocol to enable redistribution", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "enum", + "values": [ + { + "key": "bgp", + "value": "bgp" + }, + { + "key": "eigrp", + "value": "eigrp" + }, + { + "key": "ospf", + "value": "ospf" + } + ] + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "route-policy", + "description": "Redistribution Policy", + "details": "Select a Route Policy to enable redistribution", + "optionType": [ + "constant", + "ignore", + "variable" + ], + "defaultOption": "ignore", + "dataType": { + "type": "enum", + "values": [], + "default": "" + }, + "dataPath": [], + "objectType": "object" + } + ] + } + ] + }, + { + "key": "route-export", + "description": "Enable route leaking to Global VPN", + "details": "Enable route leaking to Global VPN from this Service VPN", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [], + "objectType": "tree", + "primaryKeys": [ + "protocol" + ], + "children": [ + { + "key": "protocol", + "description": "Route Protocol Leak from Service to Global", + "details": "Select a Route Protocol to enable route leaking from this Service VPN to Global VPN", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "enum", + "values": [ + { + "key": "static", + "value": "static" + }, + { + "key": "connected", + "value": "connected" + }, + { + "key": "bgp", + "value": "bgp" + }, + { + "key": "eigrp", + "value": "eigrp" + }, + { + "key": "ospf", + "value": "ospf" + } + ] + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "protocol-sub-type", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "minElements": 1, + "dataType": { + "type": "enum", + "values": [ + { + "key": "external", + "value": "external" + } + ], + "default": "external" + }, + "dataPath": [], + "objectType": "list" + }, + { + "key": "route-policy", + "description": "Route Policy Leak from Service to Global", + "details": "Select a Route Policy to enable route leaking from this Service VPN to Global VPN", + "optionType": [ + "constant", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "enum", + "values": [], + "default": "" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "redistribute", + "description": "Redistribute To Protocol", + "details": "Enable redistribution of replicated route protocol", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataPath": [], + "objectType": "tree", + "primaryKeys": [ + "protocol" + ], + "children": [ + { + "key": "protocol", + "description": "Protocol", + "details": "Select a Route Protocol to enable redistribution", + "optionType": [ + "constant", + "variable" + ], + "defaultOption": "constant", + "dataType": { + "type": "enum", + "values": [ + { + "key": "bgp", + "value": "bgp" + }, + { + "key": "ospf", + "value": "ospf" + } + ] + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "route-policy", + "description": "Redistribution Policy", + "details": "Select a Route Policy to enable redistribution", + "optionType": [ + "constant", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "enum", + "values": [], + "default": "" + }, + "dataPath": [], + "objectType": "object" + } + ] + } + ] + } + ] +} diff --git a/vmngclient/tests/templates/schemas/omp-vsmart.json b/vmngclient/tests/templates/schemas/omp-vsmart.json new file mode 100644 index 000000000..5489450b0 --- /dev/null +++ b/vmngclient/tests/templates/schemas/omp-vsmart.json @@ -0,0 +1,202 @@ +{ + "name": "OMP", + "xmlPath": [], + "xmlRootTag": "omp", + "nameSpace": "http://viptela.com/omp", + "fields": [ + { + "key": "graceful-restart", + "description": "Graceful Restart for OMP", + "details": "Enable or disable OMP graceful restart", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "boolean", + "default": "true" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "send-path-limit", + "description": "Number of Paths Advertised per Prefix", + "details": "Set number of equal-cost routes advertised by vSmart to vEdge", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 1, + "max": 32, + "default": 4 + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "send-backup-paths", + "description": "Send Backup Paths", + "details": "Enable or disable advertisement of backup routes to vEdges", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "boolean", + "default": "false" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "discard-rejected", + "description": "Discard Rejected Routes", + "details": "Enable or disable discarding of routes rejected by policy", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "boolean", + "default": "false" + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "shutdown", + "description": "Shutdown", + "details": "Enable or disable OMP", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "boolean", + "default": "false", + "label": { + "on": "Yes", + "off": "No" + } + }, + "dataPath": [], + "objectType": "object" + }, + { + "key": "advertisement-interval", + "description": "Advertisement Interval (seconds)", + "details": "Set the time between OMP Update packets", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 0, + "max": 65535, + "default": 1 + }, + "dataPath": [ + "timers" + ], + "objectType": "object" + }, + { + "key": "graceful-restart-timer", + "description": "Graceful Restart Timer (seconds)", + "details": "Set the OMP graceful restart timer", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 1, + "max": 604800, + "default": 43200 + }, + "dataPath": [ + "timers" + ], + "objectType": "object" + }, + { + "key": "eor-timer", + "description": "EOR Timer", + "details": "End of RIB timer <1..604800> seconds", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "min": 1, + "max": 3600, + "default": 300 + }, + "dataPath": [ + "timers" + ], + "objectType": "object" + }, + { + "key": "holdtime", + "description": "Hold Time (seconds)", + "details": "Set how long to wait before closing OMP peer connection", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "number", + "range": "0,3-65535", + "default": 60 + }, + "dataPath": [ + "timers" + ], + "objectType": "object" + }, + { + "key": "affinity-group-preference", + "description": "Enable Filtering Route Updates Based on Affinity", + "details": "Filter routes based on affinity preference list", + "optionType": [ + "constant", + "variable", + "ignore" + ], + "defaultOption": "ignore", + "dataType": { + "type": "boolean", + "default": "false" + }, + "dataPath": [ + "filter-route", + "outbound" + ], + "objectType": "object" + } + ] +} diff --git a/vmngclient/tests/templates/test_deserialize_model.py b/vmngclient/tests/templates/test_deserialize_model.py index 69b28bbc2..e1b09e28c 100644 --- a/vmngclient/tests/templates/test_deserialize_model.py +++ b/vmngclient/tests/templates/test_deserialize_model.py @@ -6,6 +6,7 @@ from unittest import TestCase from unittest.mock import patch +import pytest from parameterized import parameterized import vmngclient.tests.templates.models as models @@ -49,6 +50,7 @@ def setUp(self): ) @parameterized.expand([(template,) for template in map(models.__dict__.get, models.__all__)]) + @pytest.mark.skip(reason="Deserialization to be refactored") @patch("vmngclient.session.vManageSession") def test_get(self, template: FeatureTemplate, mock_session): # Arrange diff --git a/vmngclient/tests/templates/test_generate_payload.py b/vmngclient/tests/templates/test_generate_payload.py index 877ca3fff..3ab5866e3 100644 --- a/vmngclient/tests/templates/test_generate_payload.py +++ b/vmngclient/tests/templates/test_generate_payload.py @@ -45,7 +45,7 @@ class Config: allow_population_by_field_name = True key: str = Field(alias="key-string") - key_type: str = Field(alias="key-type") + key_type: str = Field(alias="key-type", data_path=["type", "RSA"]) class User(BaseModel): @@ -54,7 +54,7 @@ class Config: allow_population_by_field_name = True name: str - password: str + password: str = Field(data_path=["list"]) pubkey_chain: List[RSA] = Field(default=[], alias="pubkey-chain") @@ -71,6 +71,19 @@ class Config: user: List[User] +class DataPathFeatureTemplate(FeatureTemplate): + class Config: + arbitrary_types_allowed = True + allow_population_by_field_name = True + + template_name: str = "test" + template_description: str = "test" + payload_path: ClassVar[Path] = Path(__file__).parent / "DEPRECATED" + type: ClassVar[str] = "test_type" + + as_num: str = Field(alias="as-num", data_path=["authentication", "dot1x", "default"]) + + mocked_feature_template_children_1 = MockedFeatureTemplateChildren( user=[User(name="user1", password="pass"), User(name="user2", password="pass")] ) @@ -86,10 +99,9 @@ class Config: class TestFeatureTemplate(TestCase): @parameterized.expand( [ - ("basic.json", "basic_no_value.json", None), ("basic.json", None, MockedFeatureTemplate(num="num")), ("alias.json", None, MockedFeatureTemplateAlias(num="12")), - ("data_path.json", None, MockedFeatureTemplateAlias(num="12")), + ("data_path.json", None, DataPathFeatureTemplate(as_num="12")), ("children.json", None, mocked_feature_template_children_1), ("children_nested.json", None, mocked_feature_template_children_2), ("children_nested_datapath.json", None, mocked_feature_template_children_2), diff --git a/vmngclient/tests/templates/test_serialize_model.py b/vmngclient/tests/templates/test_serialize_model.py index f3c0fa36a..3b729a3ef 100644 --- a/vmngclient/tests/templates/test_serialize_model.py +++ b/vmngclient/tests/templates/test_serialize_model.py @@ -4,7 +4,6 @@ from unittest import TestCase from unittest.mock import patch -import pytest # type: ignore from parameterized import parameterized # type: ignore import vmngclient.tests.templates.models as models @@ -17,7 +16,6 @@ # Compare payload with definition -@pytest.mark.skip() class TestFeatureTemplate2(TestCase): @parameterized.expand( [(template,) for template in map(models.__dict__.get, models.__all__)], # type: ignore diff --git a/vmngclient/tests/test_tenant_migration_api.py b/vmngclient/tests/test_tenant_migration_api.py index b20355868..610220dfd 100644 --- a/vmngclient/tests/test_tenant_migration_api.py +++ b/vmngclient/tests/test_tenant_migration_api.py @@ -6,7 +6,7 @@ from vmngclient.api.task_status_api import Task from vmngclient.api.tenant_migration_api import ImportTask, TenantMigrationAPI from vmngclient.endpoints.tenant_migration import ImportInfo, MigrationInfo -from vmngclient.model.tenant import Tenant +from vmngclient.model.tenant import MigrationTenant, Tenant class TestTenantMigrationAPI(unittest.TestCase): @@ -20,6 +20,17 @@ def test_export_tenant(self): task = self.api.export_tenant(tenant=tenant) self.assertIsInstance(task, Task) + def test_export_migration_tenant(self): + tenant = MigrationTenant( + desc="Test Tenant", + name="test_tenant", + subdomain="test_subdomain", + org_name="test_org", + is_destination_overlay_mt=False, + ) + task = self.api.export_tenant(tenant=tenant) + self.assertIsInstance(task, Task) + def test_download(self): content = b"\xFFtest_data" with tempfile.TemporaryDirectory() as tmpdir: