Verified Commit 801d5954 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

feat(ipam) Add IPAM plugin to store subnet and VLAN information

issue #6040
parent b037181f
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2019-2020 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class ipamManagement extends management
{
public static function plInfo (): array
{
return [
'plShortName' => _('IPAM'),
'plTitle' => _('IPAM management'),
'plDescription' => _('Manage VLANs and subnets'),
'plIcon' => 'geticon.php?context=applications&icon=ipam&size=48',
'plSection' => 'systems',
'plPriority' => 55,
'plManages' => ['ipamSubnet', 'ipamVlan'],
];
}
}
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org)
Copyright (C) 2019-2020 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class ipamSubnet extends simplePlugin
{
public static function plInfo (): array
{
return [
'plShortName' => _('Subnet'),
'plDescription' => _('Subnet IPAM object'),
'plObjectClass' => ['fdIpamSubnet'],
'plObjectType' => ['ipamSubnet' => [
'name' => _('Subnet'),
'ou' => get_ou('ipamSubnetRDN'),
'icon' => 'geticon.php?context=types&icon=subnet&size=16',
]],
'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo())
];
}
static function getAttributesInfo (): array
{
return [
'main' => [
'name' => _('General information'),
'attrs' => [
new BaseSelectorAttribute(get_ou('ipamSubnetRDN')),
new HostNameAttribute(
_('Name'), _('Subnet name'),
'cn', TRUE
),
new TextAreaAttribute(
_('Description'), _('Description of this simple security object'),
'description', FALSE
),
new BooleanAttribute(
_('Active'), _('Is this subnet active'),
'fdIpamActive', TRUE
),
new StringAttribute(
_('Organization'), _('Subnet organization'),
'o', FALSE
),
new StringAttribute(
_('Type'), _('Subnet type'),
'fdIpamType', FALSE
),
new StringAttribute(
_('Applicant'), _('Applicant'),
'fdIpamApplicant', FALSE
),
new GeneralizedTimeDateAttribute(
_('Allocation date'), _('Allocation date'),
'fdIpamAllocationDate', FALSE
),
new GeneralizedTimeDateAttribute(
_('Release date'), _('Release date'),
'fdIpamReleaseDate', FALSE,
''
),
]
],
'ip' => [
'name' => _('IP information'),
'attrs' => [
new IPAttribute(
_('IP'), _('Subnet IP'),
'ipHostNumber', FALSE
),
new IPAttribute(
_('Netmask'), _('Subnet netmask'),
'fdIpamNetmask', FALSE
),
new IPAttribute(
_('Gateway'), _('Gateway IP'),
'fdIpamGateway', FALSE
),
new IPAttribute(
_('Broadcast'), _('Broadcast IP'),
'fdIpamBroadcast', FALSE
),
]
]
];
}
}
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org)
Copyright (C) 2019-2020 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class ipamVlan extends simplePlugin
{
public static function plInfo (): array
{
return [
'plShortName' => _('VLAN'),
'plDescription' => _('VLAN IPAM object'),
'plObjectClass' => ['fdIpamVlan'],
'plObjectType' => ['ipamVlan' => [
'name' => _('VLAN'),
'ou' => get_ou('ipamVlanRDN'),
'icon' => 'geticon.php?context=types&icon=vlan&size=16',
]],
'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo())
];
}
static function getAttributesInfo (): array
{
return [
'main' => [
'name' => _('General information'),
'attrs' => [
new BaseSelectorAttribute(get_ou('ipamSubnetRDN')),
new HostNameAttribute(
_('Name'), _('Subnet name'),
'cn', TRUE
),
new TextAreaAttribute(
_('Description'), _('Description of this simple security object'),
'description', FALSE
),
new BooleanAttribute(
_('Active'), _('Is this subnet active'),
'fdIpamActive', TRUE
),
new StringAttribute(
_('Organization'), _('Subnet organization'),
'o', FALSE
),
new IntAttribute(
_('Inner ID'), _('Inner VLAN ID'),
'fdIpamVlanInnerId', FALSE,
1, 4096
),
new IntAttribute(
_('QinQ ID'), _('QinQ VLAN ID'),
'fdIpamVlanQinQId', FALSE,
1, 4096
),
new StringAttribute(
_('Applicant'), _('Applicant'),
'fdIpamApplicant', FALSE
),
]
],
];
}
}
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2012-2020 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class ipamConfig extends simplePlugin
{
static function plInfo (): array
{
return [
'plShortName' => _('IPAM configuration'),
'plDescription' => _('FusionDirectory ipam plugin configuration'),
'plObjectClass' => ['fdIpamPluginConf'],
'plCategory' => ['configuration'],
'plObjectType' => ['smallConfig'],
'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo())
];
}
static function getAttributesInfo (): array
{
return [
'main' => [
'name' => _('IPAM'),
'attrs' => [
new StringAttribute(
_('Subnet RDN'), _('Branch in which IPAM subnets info will be stored'),
'fdIpamSubnetRDN', TRUE,
'ou=ipam'
),
new StringAttribute(
_('VLAN RDN'), _('Branch in which IPAM VLAN info will be stored'),
'fdIpamVlanRDN', TRUE,
'ou=ipam'
),
]
],
];
}
}
##
## ipam-fd-conf.schema - Needed by Fusion Directory for ipam plugin configuration
##
# Attributes
attributetype ( 1.3.6.1.4.1.38414.79.1.1 NAME 'fdIpamSubnetRDN'
DESC 'FusionDirectory - IPAM subnet RDN'
EQUALITY caseExactIA5Match
SUBSTR caseExactIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.38414.79.1.2 NAME 'fdIpamVlanRDN'
DESC 'FusionDirectory - IPAM VLAN RDN'
EQUALITY caseExactIA5Match
SUBSTR caseExactIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE)
# Object Class
objectclass ( 1.3.6.1.4.1.38414.79.2.1 NAME 'fdIpamPluginConf'
DESC 'FusionDirectory ipam plugin configuration'
SUP top AUXILIARY
MUST ( cn )
MAY ( fdIpamSubnetRDN $ fdIpamVlanRDN ) )
##
## ipam-fd.schema - Needed by FusionDirectory for ipam plugin
##
## Maintained by the FusionDirectory Project <contact@fusiondirectory.org>
##
# Attributes
attributetype ( 1.3.6.1.4.1.38414.78.10.1 NAME 'fdIpamActive'
DESC 'FusionDirectory - IPAM Type'
EQUALITY booleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.78.10.2 NAME 'fdIpamType'
DESC 'FusionDirectory - IPAM Type'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.78.10.3 NAME 'fdIpamApplicant'
DESC 'FusionDirectory - IPAM Applicant'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.78.10.4 NAME 'fdIpamAllocationDate'
DESC 'FusionDirectory - IPAM Allocation date'
EQUALITY generalizedTimeMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.24
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.78.10.5 NAME 'fdIpamReleaseDate'
DESC 'FusionDirectory - IPAM Release date'
EQUALITY generalizedTimeMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.24
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.78.10.6 NAME 'fdIpamNetmask'
DESC 'FusionDirectory - IPAM Netmask'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{128}
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.78.10.7 NAME 'fdIpamGateway'
DESC 'FusionDirectory - IPAM Gateway'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{128}
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.78.10.8 NAME 'fdIpamBroadcast'
DESC 'FusionDirectory - IPAM Broadcast'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{128}
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.78.11.1 NAME 'fdIpamVlanInnerId'
DESC 'FusionDirectory - IPAM VLAN Inner Id'
EQUALITY integerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.78.11.2 NAME 'fdIpamVlanQinQId'
DESC 'FusionDirectory - IPAM VLAN QinQ Id'
EQUALITY integerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
SINGLE-VALUE )
# Objectclasses
objectclass ( 1.3.6.1.4.1.38414.78.2.1 NAME 'fdIpamSubnet'
DESC 'FusionDirectory - IPAM subnet object'
MUST ( cn )
MAY (
description $ o $
fdIpamActive $
fdIpamType $ fdIpamApplicant $ fdIpamAllocationDate $ fdIpamReleaseDate $
ipHostNumber $ fdIpamNetmask $ fdIpamGateway $ fdIpamBroadcast
) )
objectclass ( 1.3.6.1.4.1.38414.78.2.2 NAME 'fdIpamVlan'
DESC 'FusionDirectory - IPAM VLAN object'
MUST ( cn )
MAY ( description $ o $
fdIpamActive $
fdIpamVlanInnerId $ fdIpamVlanQinQId $ fdIpamApplicant
) )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment