cmdbAbstractObject
bizmodel,searchable
true
autoincrement
functionalci
id
finalclass
name
false
description
true
org_id
Organization
false
DEL_MANUAL
org_id
name
high
medium
low
business_criticity
low
true
list
move2production
true
lnkContactToFunctionalCI
functionalci_id
0
0
contact_id
false
lnkDocumentToFunctionalCI
functionalci_id
0
0
document_id
false
lnkApplicationSolutionToFunctionalCI
functionalci_id
0
0
applicationsolution_id
false
SoftwareInstance
system_id
in_place
all
0
0
property
false
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
90
-
10
-
30
-
10
-
20
-
30
-
40
-
10
-
20
-
30
-
40
false
public
Overload-cmdbAbstractObject
GetLinkedClass();
$sExtKeyToMe = $oAttDef->GetExtKeyToMe();
$sExtKeyToRemote = $oAttDef->GetExtKeyToRemote();
$iTotal = 0;
$aSearches = array();
foreach (MetaModel::EnumChildClasses('Ticket') as $sSubClass)
{
if (!MetaModel::HasChildrenClasses($sSubClass))
{
$sStateAttCode = MetaModel::GetStateAttributeCode($sSubClass);
if ($sStateAttCode != '')
{
// Todo: base the search condition on operational_status = 'ongoing' for a more flexible behavior
$oSearch = DBSearch::FromOQL("SELECT $sSubClass AS t JOIN $sLnkClass AS lnk ON lnk.$sExtKeyToRemote = t.id WHERE lnk.$sExtKeyToMe = :myself AND t.$sStateAttCode NOT IN ('rejected', 'resolved', 'closed') AND lnk.impact_code != 'not_impacted'", array('myself' => $this->GetKey()));
$aSearches[$sSubClass] = $oSearch;
$oSet = new DBObjectSet($oSearch);
$oSet->SetShowObsoleteData(utils::ShowObsoleteData());
$iTotal += $oSet->Count();
}
}
}
$sCount = ($iTotal > 0) ? ' ('.$iTotal.')' : '';
$oPage->SetCurrentTab('Class:FunctionalCI/Tab:OpenedTickets', Dict::S('Class:FunctionalCI/Tab:OpenedTickets').$sCount);
foreach ($aSearches as $sSubClass => $oSearch)
{
$sBlockId = __class__.'_opened_'.$sSubClass;
$oBlock = new DisplayBlock($oSearch, 'list', false);
$oBlock->Display($oPage, $sBlockId, array(
'menu' => false,
'panel_title' => MetaModel::GetName($sSubClass),
'panel_icon' => MetaModel::GetClassIcon($sSubClass, false)
)
);
}
}
}]]>
contacts_list
down
applicationsolution_list
softwares_list
FunctionalCI
bizmodel,searchable
true
autoincrement
physicaldevice
id
status
serialnumber
true
org_id]]>
location_id
Location
true
DEL_MANUAL
false
location_id
name
production
implementation
stock
obsolete
status
production
true
list
brand_id
Brand
true
DEL_MANUAL
brand_id
name
brand_id AND type=:this->finalclass]]>
model_id
Model
true
DEL_MANUAL
model_id
name
asset_number
true
purchase_date
true
end_of_warranty
true
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
90
-
100
-
110
-
120
-
130
-
140
-
150
-
10
-
20
-
30
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
90
-
100
-
110
-
120
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
PhysicalDevice
bizmodel,searchable
true
autoincrement
connectableci
id
lnkConnectableCIToNetworkDevice
connectableci_id
0
0
networkdevice_id
true
false
PhysicalInterface
connectableci_id
in_place
all
0
0
property
false
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
90
-
100
-
110
-
120
-
130
-
140
-
150
-
160
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
90
-
100
-
110
-
120
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
ConnectableCI
bizmodel,searchable
true
autoincrement
datacenterdevice
id
location_id]]>
rack_id
Rack
true
DEL_MANUAL
false
rack_id
name
rack_id]]>
enclosure_id
Enclosure
true
DEL_MANUAL
false
enclosure_id
name
nb_u
true
managementip
true
location_id]]>
powera_id
PowerConnection
true
DEL_MANUAL
false
powerA_id
name
location_id]]>
powerB_id
PowerConnection
true
DEL_MANUAL
false
powerB_id
name
FiberChannelInterface
datacenterdevice_id
in_place
all
0
0
property
false
lnkSanToDatacenterDevice
datacenterdevice_id
0
0
san_id
false
redundancy
impacts
PowerConnection
datacenterdevice
true
fixed
1
count
fixed
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
90
-
100
-
110
-
120
-
130
-
140
-
150
-
160
-
170
-
180
-
190
-
200
-
210
-
220
-
10
-
20
-
30
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
90
-
100
-
110
-
120
-
130
-
140
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
DatacenterDevice
bizmodel,searchable
false
autoincrement
networkdevice
id
networkdevicetype_id
NetworkDeviceType
false
DEL_MANUAL
networkdevicetype_id
name
lnkConnectableCIToNetworkDevice
networkdevice_id
0
0
connectableci_id
true
false
iosversion_id
IOSVersion
true
DEL_MANUAL
iosversion_id
name
ram
true
-
10
-
20
-
35
-
40
-
50
-
80
-
10
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
20
-
10
-
20
-
30
-
40
-
45
-
50
-
60
-
70
-
80
-
90
-
10
-
10
-
20
-
30
-
20
-
10
-
20
-
30
-
30
-
10
-
10
-
20
-
30
-
40
-
50
-
55
-
60
-
70
-
80
-
90
-
100
-
110
-
120
-
130
-
140
-
10
-
20
-
30
-
40
-
50
-
60
-
70
SELECT ConnectableCI AS d JOIN lnkConnectableCIToNetworkDevice AS l1 ON l1.connectableci_id = d.id WHERE
l1.networkdevice_id = :this->id AND l1.connection_type='downlink'
SELECT NetworkDevice AS nw JOIN lnkConnectableCIToNetworkDevice AS l1 ON l1.networkdevice_id = nw.id WHERE
l1.connectableci_id = :this->id AND l1.connection_type='downlink'
DatacenterDevice
bizmodel,searchable
false
autoincrement
server
id
osfamily_id
OSFamily
true
DEL_MANUAL
osfamily_id
name
osfamily_id]]>
osversion_id
OSVersion
true
DEL_MANUAL
osversion_id
name
osversion_id]]>
oslicence_id
OSLicence
true
DEL_MANUAL
oslicence_id
name
cpu
true
ram
true
lnkServerToVolume
server_id
0
0
volume_id
false
-
10
-
20
-
30
-
45
-
50
-
60
-
70
-
80
-
90
-
120
-
10
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
20
-
10
-
20
-
30
-
40
-
45
-
50
-
60
-
70
-
80
-
90
-
100
-
130
-
10
-
10
-
20
-
30
-
20
-
10
-
20
-
30
-
30
-
10
-
10
-
20
-
30
-
40
-
50
-
55
-
60
-
70
-
80
-
90
-
100
-
110
-
120
-
130
-
140
-
10
-
20
-
30
-
40
-
50
-
60
-
70
FunctionalCI
bizmodel,searchable
false
autoincrement
applicationsolution
id
status
lnkApplicationSolutionToFunctionalCI
applicationsolution_id
0
0
functionalci_id
false
lnkApplicationSolutionToBusinessProcess
applicationsolution_id
0
0
businessprocess_id
false
active
inactive
status
active
true
list
redundancy
impacts
FunctionalCI
applicationsolution
false
user
1
user
count
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
100
-
110
-
10
-
20
-
30
-
40
-
10
-
20
-
30
businessprocess_list
FunctionalCI
bizmodel,searchable
false
autoincrement
businessprocess
id
status
lnkApplicationSolutionToBusinessProcess
businessprocess_id
0
0
applicationsolution_id
false
active
inactive
status
active
true
list
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
100
-
10
-
20
-
30
-
40
-
10
-
20
-
30
FunctionalCI
bizmodel,searchable
true
autoincrement
softwareinstance
id
status
functionalci_id
FunctionalCI
false
DEL_AUTO
false
system_id
name
finalclass]]>
software_id
Software
true
DEL_MANUAL
software_id
name
software_id]]>
softwarelicence_id
SoftwareLicence
true
DEL_MANUAL
false
softwarelicence_id
name
path
true
active
inactive
status
true
list
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
90
-
100
-
110
-
120
-
130
-
10
-
20
-
30
-
10
-
20
-
30
-
40
-
10
-
20
-
30
-
40
-
50
SoftwareInstance
bizmodel,searchable
false
autoincrement
middleware
id
MiddlewareInstance
middleware_id
in_place
all
0
0
property
false
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
90
-
100
-
110
-
120
-
140
-
150
-
10
-
20
-
30
-
40
-
10
-
20
-
30
-
40
middlewareinstance_list
SoftwareInstance
bizmodel,searchable
false
autoincrement
dbserver
id
DatabaseSchema
dbserver_id
in_place
all
0
0
property
false
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
90
-
100
-
110
-
120
-
140
-
150
-
10
-
20
-
30
-
40
-
10
-
20
-
30
-
40
dbschema_list
SoftwareInstance
bizmodel,searchable
false
autoincrement
webserver
id
WebApplication
webserver_id
in_place
all
0
0
property
false
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
90
-
100
-
110
-
120
-
140
-
150
-
10
-
20
-
30
-
40
-
10
-
20
-
30
-
40
webapp_list
SoftwareInstance
bizmodel,searchable
false
autoincrement
pcsoftware
id
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
90
-
100
-
110
-
120
-
140
-
10
-
20
-
30
-
40
-
10
-
20
-
30
-
40
SoftwareInstance
bizmodel,searchable
false
autoincrement
othersoftware
id
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
90
-
100
-
110
-
120
-
140
-
10
-
20
-
30
-
40
-
10
-
20
-
30
-
40
FunctionalCI
bizmodel,searchable
false
autoincrement
middlewareinstance
id
middleware_id_obsolescence_flag
middleware_id
Middleware
false
DEL_MANUAL
middleware_id
name
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
100
-
10
-
20
-
30
-
10
-
20
-
30
-
40
-
10
-
20
-
30
FunctionalCI
bizmodel,searchable
false
autoincrement
databaseschema
id
dbserver_id_obsolescence_flag
dbserver_id
DBServer
false
DEL_MANUAL
dbserver_id
name
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
100
-
10
-
20
-
30
-
10
-
20
-
30
-
40
-
10
-
20
-
30
FunctionalCI
bizmodel,searchable
false
autoincrement
webapplication
id
webserver_id_obsolescence_flag
webserver_id
WebServer
false
DEL_MANUAL
webserver_id
name
url
true
_blank
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
90
-
110
-
10
-
20
-
30
-
10
-
20
-
30
-
40
-
10
-
20
-
30
cmdbAbstractObject
bizmodel,searchable
false
autoincrement
software
id
name
false
vendor
false
version
false
lnkDocumentToSoftware
software_id
0
0
document_id
false
Middleware
DBServer
PCSoftware
OtherSoftware
WebServer
type
true
list
SoftwareInstance
software_id
add_only
0
0
link
false
SoftwarePatch
software_id
add_only
0
0
link
false
SoftwareLicence
software_id
add_only
0
0
link
false
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
10
-
20
-
30
-
10
-
20
-
30
-
40
-
10
-
20
-
30
cmdbAbstractObject
bizmodel,searchable
true
autoincrement
patch
id
finalclass
name
false
lnkDocumentToPatch
patch_id
0
0
document_id
false
description
true
-
10
-
20
-
30
-
10
-
20
-
10
-
10
-
20
Patch
bizmodel,searchable
false
autoincrement
ospatch
id
lnkFunctionalCIToOSPatch
ospatch_id
0
0
functionalci_id
false
osversion_id
OSVersion
false
DEL_MANUAL
osversion_id
name
-
10
-
20
-
30
-
40
-
50
-
10
-
20
-
30
-
10
-
20
Patch
bizmodel,searchable
false
autoincrement
softwarepatch
id
software_id
Software
false
DEL_MANUAL
software_id
name
lnkSoftwareInstanceToSoftwarePatch
softwarepatch_id
0
0
softwareinstance_id
false
-
10
-
20
-
30
-
40
-
50
-
10
-
20
-
30
-
10
-
20
cmdbAbstractObject
bizmodel,searchable
true
autoincrement
licence
id
finalclass
name
false
lnkDocumentToLicence
licence_id
0
0
document_id
false
org_id
Organization
false
DEL_MANUAL
org_id
name
usage_limit
true
description
true
start_date
true
end_date
true
licence_key
true
yes
no
perpetual
no
false
list
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
90
-
10
-
20
-
30
-
10
-
15
-
20
-
30
-
40
-
10
-
20
-
30
-
40
-
50
-
60
-
70
Licence
bizmodel,searchable
false
autoincrement
oslicence
id
osversion_id
OSVersion
false
DEL_MANUAL
osversion_id
name
VirtualMachine
oslicence_id
none
0
0
link
true
Server
oslicence_id
none
0
0
link
true
-
10
-
20
-
30
-
40
-
50
-
60
-
65
-
70
-
80
-
90
-
100
-
110
-
10
-
15
-
20
-
30
-
40
-
10
-
20
-
30
-
40
-
50
-
60
-
70
Licence
bizmodel,searchable
false
autoincrement
softwarelicence
id
software_id
Software
false
DEL_MANUAL
software_id
name
SoftwareInstance
softwarelicence_id
none
0
0
link
true
-
10
-
20
-
30
-
40
-
50
-
60
-
65
-
70
-
80
-
90
-
100
-
10
-
15
-
20
-
30
-
40
-
10
-
20
-
30
-
40
-
50
-
60
-
70
cmdbAbstractObject
1
bizmodel
false
autoincrement
lnkdocumenttolicence
id
false
true
licence_id
Licence
false
DEL_AUTO
licence_id
name
document_id
Document
false
DEL_AUTO
document_id
name
-
10
-
20
-
10
-
20
-
10
-
20
20
Typology
bizmodel,searchable
false
autoincrement
osversion
id
osfamily_id
OSFamily
false
DEL_MANUAL
osfamily_id
name
-
10
-
20
-
10
-
10
-
20
Typology
bizmodel,searchable
false
autoincrement
osfamily
id
-
10
-
10
-
10
Typology
bizmodel,searchable
false
autoincrement
brand
id
true
PhysicalDevice
brand_id
add_only
0
0
link
false
-
10
-
20
-
10
-
10
Typology
bizmodel,searchable
false
autoincrement
model
id
true
brand_id
Brand
false
DEL_MANUAL
brand_id
name
NetworkDevice
Server
SANSwitch
StorageSystem
Rack
Enclosure
PC
Tablet
Phone
MobilePhone
Printer
DiskArray
NAS
TapeLibrary
IPPhone
Peripheral
PowerSource
PDU
type
false
list
PhysicalDevice
model_id
add_only
0
0
link
false
-
10
-
20
-
30
-
40
-
10
-
20
-
10
-
20
-
30
Typology
bizmodel,searchable
false
autoincrement
networkdevicetype
id
NetworkDevice
networkdevicetype_id
add_only
0
0
link
false
-
10
-
20
-
10
-
10
Typology
bizmodel,searchable
false
autoincrement
iosversion
id
brand_id
Brand
false
DEL_MANUAL
brand_id
name
-
10
-
20
-
10
-
10
-
20
cmdbAbstractObject
1
bizmodel
false
autoincrement
lnkcontacttofunctionalci
id
false
true
functionalci_id
FunctionalCI
false
DEL_AUTO
functionalci_id
name
contact_id
Contact
false
DEL_AUTO
contact_id
name
-
10
-
20
-
10
-
20
-
10
-
20
cmdbAbstractObject
1
bizmodel
false
autoincrement
lnkdocumenttopatch
id
false
true
patch_id
Patch
false
DEL_AUTO
patch_id
name
document_id
Document
false
DEL_AUTO
document_id
name
-
10
-
20
-
10
-
20
-
10
-
20
cmdbAbstractObject
1
bizmodel
false
autoincrement
lnksoftwareinstancetosoftwarepatch
id
false
true
softwarepatch_id
SoftwarePatch
false
DEL_AUTO
softwarepatch_id
name
softwareinstance_id
SoftwareInstance
false
DEL_AUTO
softwareinstance_id
name
-
10
-
20
-
10
-
20
-
10
-
20
cmdbAbstractObject
1
bizmodel
false
autoincrement
lnkfunctionalcitoospatch
id
false
true
ospatch_id
OSPatch
false
DEL_AUTO
ospatch_id
name
functionalci_id
FunctionalCI
false
DEL_AUTO
functionalci_id
name
-
10
-
20
-
10
-
20
-
10
-
20
cmdbAbstractObject
1
bizmodel
false
autoincrement
lnkdocumenttosoftware
id
false
true
software_id
Software
false
DEL_AUTO
software_id
name
document_id
Document
false
DEL_AUTO
document_id
name
-
10
-
20
-
10
-
20
-
10
-
20
cmdbAbstractObject
1
bizmodel
false
autoincrement
lnkdocumenttofunctionalci
id
false
true
functionalci_id
FunctionalCI
false
DEL_AUTO
functionalci_id
name
document_id
Document
false
DEL_AUTO
document_id
name
-
10
-
20
-
10
-
20
-
10
-
20
cmdbAbstractObject
bizmodel,searchable,configmgmt
false
autoincrement
subnet
id
description
true
subnet_name
true
org_id
Organization
false
DEL_MANUAL
org_id
name
ip
false
ip_mask
false
lnkSubnetToVLAN
subnet_id
0
0
vlan_id
false
false
public
Overload-cmdbAbstractObject
GetKey() != -1)? false : true;
if (!$bIsCreation) {
$oPage->SetCurrentTab('Class:Subnet/Tab:IPUsage');
$bit_ip = ip2long($this->Get('ip'));
$bit_mask = ip2long($this->Get('ip_mask'));
$iIPMin = sprintf('%u', ($bit_ip & $bit_mask) | 1); // exclude the first one: identifies the subnet itself
$iIPMax = sprintf('%u', (($bit_ip | (~$bit_mask))) & 0xfffffffe); // exclude the last one : broadcast address
$sIPMin = long2ip($iIPMin);
$sIPMax = long2ip($iIPMax);
$oPage->p(Dict::Format('Class:Subnet/Tab:IPUsage-explain', $sIPMin, $sIPMax));
$oIfFilter = DBObjectSearch::FromOQL("SELECT IPInterface AS if WHERE INET_ATON(if.ipaddress) >= INET_ATON('$sIPMin') AND INET_ATON(if.ipaddress) <= INET_ATON('$sIPMax')");
$oIfSet = new CMDBObjectSet($oIfFilter);
$oBlock = new DisplayBlock($oIfFilter, 'list', false);
$oBlock->Display($oPage, 'nwif', array(
'menu' => false,
'panel_title' => MetaModel::GetName('IPInterface'),
'panel_icon' => MetaModel::GetClassIcon('IPInterface', false)
)
);
$iCountUsed = $oIfSet->Count();
$iCountRange = $iIPMax - $iIPMin; // On 32-bit systems the substraction will be computed using floats for values greater than PHP_MAX_INT;
$iFreeCount = $iCountRange - $iCountUsed;
$oPage->SetCurrentTab('Class:Subnet/Tab:FreeIPs');
$oPage->p(Dict::Format('Class:Subnet/Tab:FreeIPs-count', $iFreeCount));
$oPage->p(Dict::S('Class:Subnet/Tab:FreeIPs-explain'));
$aUsedIPs = $oIfSet->GetColumnAsArray('ipaddress', false);
$iAnIP = $iIPMin;
$iFound = 0;
while (($iFound < min($iFreeCount, 10)) && ($iAnIP <= $iIPMax))
{
$sAnIP = long2ip($iAnIP);
if (!in_array($sAnIP, $aUsedIPs))
{
$iFound++;
$oPage->p($sAnIP);
}
$iAnIP++;
}
}
}]]>
-
10
-
20
-
25
-
30
-
40
-
50
-
10
-
20
-
30
-
10
-
20
-
25
-
30
-
40
-
10
-
20
-
25
-
30
-
40
cmdbAbstractObject
bizmodel,searchable,configmgmt
false
autoincrement
vlan
id
vlan_tag
false
description
true
org_id
Organization
false
DEL_MANUAL
org_id
name
lnkSubnetToVLAN
vlan_id
0
0
subnet_id
false
lnkPhysicalInterfaceToVLAN
vlan_id
0
0
physicalinterface_id
false
-
10
-
20
-
30
-
40
-
50
-
10
-
30
-
10
-
20
-
30
-
10
cmdbAbstractObject
1
bizmodel
false
autoincrement
lnksubnettovlan
id
false
true
subnet_id
Subnet
false
DEL_AUTO
subnet_id
ip
subnet_id
subnet_name
vlan_id
VLAN
false
DEL_AUTO
vlan_id
vlan_tag
-
10
-
20
-
10
-
20
-
10
-
20
-
30
cmdbAbstractObject
bizmodel,searchable
true
autoincrement
networkinterface
id
finalclass
name
false
-
10
-
10
-
10
-
10
NetworkInterface
bizmodel,searchable
true
autoincrement
ipinterface
id
ipaddress
true
macaddress
true
ipgateway
true
ipmask
true
speed
true
12
2
-
10
-
20
-
30
-
50
-
60
-
70
-
10
-
20
-
30
-
10
-
20
-
30
-
40
-
50
-
10
-
20
-
30
-
50
-
60
-
70
IPInterface
bizmodel,searchable
false
autoincrement
physicalinterface
id
connectableci_id_obsolescence_flag
connectableci_id
ConnectableCI
false
DEL_AUTO
connectableci_id
name
lnkPhysicalInterfaceToVLAN
physicalinterface_id
0
0
vlan_id
false
-
10
-
20
-
30
-
40
-
60
-
70
-
80
-
90
-
10
-
20
-
30
-
40
-
10
-
20
-
40
-
50
-
60
cmdbAbstractObject
1
bizmodel
false
autoincrement
lnkphysicalinterfacetovlan
id
false
true
physicalinterface_id
PhysicalInterface
false
DEL_AUTO
physicalinterface_id
name
physicalinterface_id
connectableci_id
physicalinterface_id
connectableci_name
vlan_id
VLAN
false
DEL_AUTO
vlan_id
vlan_tag
-
10
-
20
-
10
-
20
-
10
-
20
cmdbAbstractObject
1
bizmodel
false
autoincrement
lnkconnectablecitonetworkdevice
id
false
true
networkdevice_id
NetworkDevice
false
DEL_AUTO
networkdevice_id
name
connectableci_id
ConnectableCI
false
DEL_AUTO
connectableci_id
name
network_port
true
device_port
true
uplink
downlink
type
downlink
false
list
false
protected
Overload-cmdbAbstractObject
Get('connectableci_id'));
if (is_object($oDevice) && (get_class($oDevice) == 'NetworkDevice'))
{
$sOQL = "SELECT lnkConnectableCIToNetworkDevice WHERE connectableci_id = :device AND networkdevice_id = :network AND network_port = :nwport AND device_port = :devport";
$oConnectionSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL),
array(),
array(
'network' => $this->Get('connectableci_id'),
'device' => $this->Get('networkdevice_id'),
'devport' => $this->Get('network_port'),
'nwport' => $this->Get('device_port'),
)
);
if ($oConnectionSet->Count() == 0)
{
$sLink = $this->Get('connection_type');
$sConnLink = ($sLink == 'uplink') ? 'downlink' : 'uplink';
$oNewLink = new lnkConnectableCIToNetworkDevice();
$oNewLink->Set('networkdevice_id', $this->Get('connectableci_id'));
$oNewLink->Set('connectableci_id', $this->Get('networkdevice_id'));
$oNewLink->Set('network_port', $this->Get('device_port'));
$oNewLink->Set('device_port', $this->Get('network_port'));
$oNewLink->Set('connection_type', $sConnLink);
$oNewLink->DBInsert();
}
}
}]]>
false
protected
Overload-cmdbAbstractObject
ListPreviousValuesForUpdatedAttributes();
$aPrev = array(); // Previous values of the current link object before it was modified
foreach ($aFields as $sFieldCode) {
$aPrev[$sFieldCode] = array_key_exists($sFieldCode, $aChanges) ? $aChanges[$sFieldCode] : $this->Get($sFieldCode);
}
$sPrevLink = ($aPrev['connection_type'] == 'uplink') ? 'downlink' : 'uplink';
$sConnLink = ($this->Get('connection_type') == 'uplink') ? 'downlink' : 'uplink';
$oNewDevice = MetaModel::GetObject('ConnectableCI', $this->Get('connectableci_id'), false);
$oPrevDevice = MetaModel::GetObject('ConnectableCI', $aPrev['connectableci_id'], false);
$bNew = (is_object($oNewDevice) && (get_class($oNewDevice) == 'NetworkDevice'));
$bPrev = (is_object($oPrevDevice) && (get_class($oPrevDevice) == 'NetworkDevice'));
$sOQL = "SELECT lnkConnectableCIToNetworkDevice WHERE connectableci_id = :device AND networkdevice_id = :network AND network_port = :nwport AND device_port = :devport AND connection_type = :link";
if ($bPrev) { // There was a twin
// Retrieve twin link using previous values of the current link
$oConnectionSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL),
array(),
array(
'network' => $aPrev['connectableci_id'],
'device' => $aPrev['networkdevice_id'],
'devport' => $aPrev['network_port'],
'nwport' => $aPrev['device_port'],
'link' => $sPrevLink,
)
);
if ($bNew) { // and a twin must still exist, so update the existing
while ($oConnection = $oConnectionSet->Fetch()) {
$oConnection->Set('networkdevice_id', $this->Get('connectableci_id'));
$oConnection->Set('connectableci_id', $this->Get('networkdevice_id'));
$oConnection->Set('network_port', $this->Get('device_port'));
$oConnection->Set('device_port', $this->Get('network_port'));
$oConnection->Set('connection_type',$sConnLink);
$oConnection->DBUpdate();
}
}
else { // and no twin is needed anymore, so delete the existing
while ($oConnection = $oConnectionSet->Fetch()) {
$oConnection->DBDelete();
}
}
}
elseif ($bNew) { // There was no twin but a twin must exist now
// Search for a twin link using current values inverted
$oConnectionSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL),
array(),
array(
'network' => $this->Get('connectableci_id'),
'device' => $this->Get('networkdevice_id'),
'devport' => $this->Get('device_port'),
'nwport' => $this->Get('network_port'),
'link' => $sConnLink,
)
);
if ($oConnectionSet->Count() == 0) {
$oNewLink = new lnkConnectableCIToNetworkDevice();
$oNewLink->Set('networkdevice_id', $this->Get('connectableci_id'));
$oNewLink->Set('connectableci_id', $this->Get('networkdevice_id'));
$oNewLink->Set('network_port', $this->Get('device_port'));
$oNewLink->Set('device_port', $this->Get('network_port'));
$oNewLink->Set('connection_type', $sConnLink);
$oNewLink->DBInsert();
}
}
}]]>
false
protected
Overload-cmdbAbstractObject
Get('connectableci_id'), false);
if (is_object($oDevice) && (get_class($oDevice) == 'NetworkDevice'))
{
// Track and delete the counterpart link
$sOQL = "SELECT lnkConnectableCIToNetworkDevice WHERE connectableci_id = :device AND networkdevice_id = :network AND network_port = :nwport AND device_port = :devport";
$oConnectionSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL),
array(),
array(
'network' => $this->Get('connectableci_id'),
'device' => $this->Get('networkdevice_id'),
'devport' => $this->Get('network_port'),
'nwport' => $this->Get('device_port'),
)
);
// There should be one link - do it in a safe manner anyway
while ($oConnection = $oConnectionSet->Fetch())
{
$oConnection->DBDelete();
}
}
}]]>
false
protected
Overload-DBObject
AddConnectedNetworkDevice();
parent::AfterInsert();
}]]>
false
protected
Overload-DBObject
UpdateConnectedNetworkDevice();
parent::AfterUpdate();
}]]>
false
protected
Overload-DBObject
DeleteConnectedNetworkDevice();
parent::AfterDelete();
}]]>
-
10
-
20
-
30
-
40
-
50
-
10
-
20
-
30
-
40
-
50
-
10
-
20
-
30
-
40
-
50
cmdbAbstractObject
1
bizmodel
false
autoincrement
lnkapplicationsolutiontofunctionalci
id
false
true
applicationsolution_id
ApplicationSolution
false
DEL_AUTO
applicationsolution_id
name
functionalci_id
FunctionalCI
false
DEL_AUTO
functionalci_id
name
-
10
-
20
-
10
-
20
-
10
-
20
cmdbAbstractObject
1
bizmodel
false
autoincrement
lnkapplicationsolutiontobusinessprocess
id
false
true
businessprocess_id
BusinessProcess
false
DEL_AUTO
businessprocess_id
name
applicationsolution_id
ApplicationSolution
false
DEL_AUTO
applicationsolution_id
name
-
10
-
20
-
10
-
20
-
10
-
20
cmdbAbstractObject
bizmodel,searchable,configmgmt
false
autoincrement
group
id
status
status='obsolete'
name
false
production
implementation
obsolete
status
implementation
false
list
org_id
Organization
false
DEL_MANUAL
org_id
name
description
true
type
true
parent_id
true
DEL_MANUAL
parent_id
name
lnkGroupToCI
group_id
0
0
ci_id
false
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
10
-
20
-
30
-
10
-
20
-
30
-
40
-
10
-
20
-
30
-
40
cmdbAbstractObject
1
bizmodel,configmgmt
false
autoincrement
lnkgrouptoci
id
false
true
group_id
Group
false
DEL_AUTO
group_id
name
ci_id
FunctionalCI
false
DEL_AUTO
ci_id
name
reason
true
-
10
-
20
-
30
-
10
-
20
-
30
-
10
-
20
-
30
lnkDocumentToFunctionalCI
document_id
0
0
functionalci_id
false
-
60
PhysicalDevice
location_id
add_only
0
0
link
false
-
90
lnkContactToFunctionalCI
contact_id
0
0
functionalci_id
false
-
30
-
90
- 70
>
-
60
-
70