# (c) cavaliba.com

#  IPAM

# --------------------------------------------
# ipam permissions
# --------------------------------------------


- classname: _permission
  keyname: p_ipam_access
  description: "IPAM access"
  
- classname: _permission
  keyname: p_ipam_read
  description: "IPAM read"
  
- classname: _permission
  keyname: p_ipam_write
  description: "IPAM write"
  
- classname: _permission
  keyname: p_ipam_admin
  description: "IPAM admin"
  



# ---------------------------------------
# IPAM enumerate
# ---------------------------------------

- classname: _enumerate
  keyname: ipam_vlan_family
  is_enabled: True
  displayname: IPAM VLAN Family
  description: IAPM VLAN Family enumerate
  content: |
    - value: "N/A"
    - value: "Unknown"
    - value: "Other"

# ---------------------------------
# IPAM subnet schema
# ---------------------------------

- classname: _schema
  keyname: ipam_subnet
  displayname: IPAM IPv4 Subnet
  is_enabled: yes
  order: 290
  page: Asset Management

  _options:
      icon: fa-map-marker
      p_admin: p_ipam_admin
      p_create: p_ipam_write
      p_read: p_ipam_read
      p_update: p_ipam_write
      p_delete: p_ipam_write

  description:
      displayname: Description
      dataformat: string

  subnet:
      displayname: IPv4 Subnet
      description: 'Format A.B.C.D/E valid IP V4 subnet'
      dataformat: ipv4
      dataformat_ext: ipv4
      dataformat_ext: subnet strict

# ---------------------------------
# IPAM vlan schema
# ---------------------------------

- classname: _schema
  keyname: ipam_vlan
  displayname: IPAM VLANs
  is_enabled: yes
  order: 291
  page: Asset Management

  _options:
      icon: fa-street-view
      p_admin: p_ipam_admin
      p_create: p_ipam_write
      p_read: p_ipam_read
      p_update: p_ipam_write
      p_delete: p_ipam_write

  description:
      displayname: Description
      dataformat: string

  vlan_id:
      displayname: VLAN ID
      description: VLAN ID (integer)
      dataformat: int

  vlan_family:
      displayname: VLAN Family
      description: VLAN Family
      dataformat: enumerate
      dataformat_ext: ipam_vlan_family

  subnet:
      displayname: IP Subnet
      description: 0 or more IP subnets
      dataformat: schema
      dataformat_ext: ipam_subnet
      cardinal_max: 0


# ---------------------------------------- 
# dataview IPAM
# ---------------------------------------- 

- classname: _dataview
  keyname: ipam_vlan_default
  target_class: ipam_vlan
  displayname: Default
  is_enabled: true
  _action: init
  description: Default DataView for IPAM VLANs
  content: |
    columns:
       - keyname
       - displayname
       - description
       - vlan_family
       - vlan_id
       - subnet

- classname: _dataview
  keyname: ipam_subnet
  target_class: ipam_subnet
  displayname: Default
  is_enabled: true
  _action: init
  description: Default DataView for IPAM IP Subnets
  content: |
    columns:
       - keyname
       - subnet
       - description



# ---------------------------------------- 
# IPAM dashboard
# ---------------------------------------- 


- classname: _home
  keyname: ipam
  displayname: IPAM
  description: IP & VLAN Management
  icon: fa-map-marker
  url: /ipam/private/
  dashboard_section: Services
  sidebar_section: Services
  order: 40
  permission: p_ipam_access
  _action: init



# ---------------------------------------- 
# IPAM builtin data
# ---------------------------------------- 

- classname: ipam_subnet
  keyname: 0.0.0.0/0
  displayname: 0.0.0.0/0
  description: all
  subnet: 0.0.0.0/0
  _action: init

- classname: ipam_subnet
  keyname: 10.0.0.0/8
  displayname: 10.0.0.0/8
  description: RFC 1918 10.*
  subnet: 10.0.0.0/8
  _action: init

- classname: ipam_subnet
  keyname: 192.168.0.0/16
  displayname: 192.168.0.0/16
  description: RFC 1918 192.168.*
  subnet: 192.168.0.0/16
  _action: init

- classname: ipam_subnet
  keyname: 172.16.0.0/12
  displayname: 172.16.0.0/12
  description: RFC 1918 172.16.0.0/12 (-> 172.31.255.255)
  subnet: 172.16.0.0/12
  _action: init
