From a031db8c53e3cc4440f8072cad1f536a85432efd Mon Sep 17 00:00:00 2001 From: Johan Marcusson Date: Mon, 6 Sep 2021 14:54:21 +0200 Subject: [PATCH 1/2] Allow ifclass port_template_esx for exmaple. Has to be defined by user in jinja template --- src/cnaas_nms/db/settings_fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cnaas_nms/db/settings_fields.py b/src/cnaas_nms/db/settings_fields.py index 3ced11d1..2bbfdf14 100644 --- a/src/cnaas_nms/db/settings_fields.py +++ b/src/cnaas_nms/db/settings_fields.py @@ -53,7 +53,7 @@ IFNAME_REGEX = r'([a-zA-Z0-9\/\.:-])+' ifname_schema = Field(None, regex=f"^{IFNAME_REGEX}$", description="Interface name") -IFCLASS_REGEX = r'(custom|downlink|fabric)' +IFCLASS_REGEX = r'(custom|downlink|fabric|port_template_[a-zA-Z0-9_]+)' ifclass_schema = Field(None, regex=f"^{IFCLASS_REGEX}$", description="Interface class: custom, downlink or uplink") tcpudp_port_schema = Field(None, ge=0, lt=65536, description="TCP or UDP port number, 0-65535") From 22656d590f98df59d6d8c49286ee27b26dff369f Mon Sep 17 00:00:00 2001 From: Johan Marcusson Date: Tue, 7 Sep 2021 10:01:06 +0200 Subject: [PATCH 2/2] Docs for port_template --- docs/reporef/index.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/reporef/index.rst b/docs/reporef/index.rst index 33dd68e0..7b228f69 100644 --- a/docs/reporef/index.rst +++ b/docs/reporef/index.rst @@ -285,7 +285,7 @@ Keys for interfaces.yml or interfaces_.yml: * interfaces: List of dicctionaries with keys: * name: Interface name, like "Ethernet1" - * ifclass: Interface class, one of: downlink, fabric, custom + * ifclass: Interface class, one of: downlink, fabric, custom, port_template_* * config: Optional. Raw CLI config used in case "custom" ifclass was selected The "downlink" ifclass is used on DIST devices to specify that this interface @@ -295,6 +295,10 @@ the switch (vxlan) fabric. Linknet data will only be configured on interfaces specified as "fabric". If no linknet data is available in the database then the fabric interface will be configured for ZTP of DIST/CORE devices by providing DHCP (relay) access. +"port_template_*" is used to specify a user defined port template. This can then +be used to apply some site-specific configuration via Jinja templates. For +example specify "port_template_hypervisor" and build a corresponding Jinja +template by matching on that ifclass. base_system.yml: