Skip to content

Commit

Permalink
Merge pull request #194 from SUNET/feature.dist_intf_settings
Browse files Browse the repository at this point in the history
Detailed settings for dist port_template interfaces
  • Loading branch information
indy-independence authored Sep 14, 2021
2 parents 6acfe8a + 3227944 commit 221cc47
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/reporef/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,15 @@ Keys for interfaces.yml or interfaces_<model>.yml:
* ifclass: Interface class, one of: downlink, fabric, custom, port_template_*
* config: Optional. Raw CLI config used in case "custom" ifclass was selected

* Additional interface options for port_template type:

* untagged_vlan: Optional. Numeric VLAN ID for untagged frames.
* tagged_vlan_list: Optional. List of allowed numeric VLAN IDs for tagged frames.
* description: Optional. Description for the interface, this should be a string 0-64 characters.
* enabled: Optional. Set the administrative state of the interface. Defaults to true if not set.
* aggregate_id: Optional. Identifier for configuring LACP etc. Integer value.
Special value -1 means configure MLAG and use ID based on indexnum.

The "downlink" ifclass is used on DIST devices to specify that this interface
is used to connect access devices. The "fabric" ifclass is used to specify that
this interface is used to connect DIST or CORE devices with each other to form
Expand Down
6 changes: 6 additions & 0 deletions src/cnaas_nms/confpush/sync_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,12 @@ def populate_device_vars(session, dev: Device,
'peer_ip': None,
'peer_asn': None
})
else:
if_dict = {'indexnum': ifindexnum}
for key, value in intf.items():
if_dict[key] = value
fabric_device_variables['interfaces'].append(if_dict)

for local_if, data in fabric_interfaces.items():
logger.warn(f"Interface {local_if} on device {hostname} not "
"configured as linknet because of wrong ifclass")
Expand Down
11 changes: 11 additions & 0 deletions src/cnaas_nms/db/settings_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
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")
ifdescr_schema = Field(None, max_length=64, description="Interface description, 0-64 characters")
tcpudp_port_schema = Field(None, ge=0, lt=65536, description="TCP or UDP port number, 0-65535")
ebgp_multihop_schema = Field(None, ge=1, le=255, description="Numeric IP TTL, 1-255")
maximum_routes_schema = Field(None, ge=0, le=4294967294, description="Maximum number of routes to receive from peer")
Expand Down Expand Up @@ -111,6 +112,16 @@ class f_interface(BaseModel):
name: str = ifname_schema
ifclass: str = ifclass_schema
config: Optional[str] = None
description: Optional[str] = ifdescr_schema
enabled: Optional[bool] = None
untagged_vlan: Optional[int] = vlan_id_schema_optional
tagged_vlan_list: Optional[List[int]] = None
aggregate_id: Optional[int] = None

@validator("tagged_vlan_list", each_item=True)
def check_valid_vlan_ids(cls, v):
assert 0 < v < 4096
return v


class f_vrf(BaseModel):
Expand Down

0 comments on commit 221cc47

Please sign in to comment.