Skip to content

Commit

Permalink
[feature] Allowed defining VXLAN interface in VXLAN over WIreGuard ba…
Browse files Browse the repository at this point in the history
…ckend
  • Loading branch information
pandafy committed Jul 18, 2023
1 parent 9dbbbf0 commit 5207e08
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
46 changes: 46 additions & 0 deletions netjsonconfig/backends/vxlan/schema.py
@@ -0,0 +1,46 @@
from copy import deepcopy

from ..wireguard.schema import schema as base_schema

base_vxlan_properties = {
"vxlan": {
"type": "array",
"title": "VXLAN",
"uniqueItems": True,
"additionalItems": True,
"propertyOrder": 13,
"items": {
"type": "object",
"title": "VXLAN tunnel",
"additionalProperties": True,
"properties": {
"name": {
"title": "interface name",
"description": "VXLAN interface name",
"type": "string",
"minLength": 2,
"maxLength": 15,
"pattern": "^[^\\s]*$",
"propertyOrder": 1,
},
"vni": {
"type": "integer",
"title": "VNI",
"description": (
"VXLAN Network Identifier, if set to \"0\", each tunnel will have"
" different VNI. If a non-zero VNI is specified, then it will be"
" used for all VXLAN tunnels."
),
"propertyOrder": 2,
"default": 0,
"minimum": 0,
"maximum": 16777216,
},
},
},
}
}


schema = deepcopy(base_schema)
schema['properties'].update(base_vxlan_properties)
3 changes: 3 additions & 0 deletions netjsonconfig/backends/vxlan/vxlan_wireguard.py
@@ -1,7 +1,10 @@
from ..wireguard.wireguard import Wireguard
from .schema import schema


class VxlanWireguard(Wireguard):
schema = schema

@classmethod
def auto_client(cls, vni=0, server_ip_address='', **kwargs):
"""
Expand Down

0 comments on commit 5207e08

Please sign in to comment.