本文整理汇总了Python中modeling.createLinkOSH函数的典型用法代码示例。如果您正苦于以下问题:Python createLinkOSH函数的具体用法?Python createLinkOSH怎么用?Python createLinkOSH使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createLinkOSH函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: buildHosts
def buildHosts(self):
for host in self.hosts.values():
hostOSHV = ObjectStateHolderVector()
hostOsh, hostVector = host.buildOshAndIps()
hostOSHV.addAll(hostVector)
hbaIdToOsh = {}
for hba in host.hbas.values():
hbaOsh = hba.build()
hbaOsh.setContainer(hostOsh)
hbaIdToOsh[hba.hbaId] = hbaOsh
self.addWwnOsh(hba.wwn, hbaOsh)
hostOSHV.add(hbaOsh)
for port in host.ports.values():
portOsh = port.build()
portOsh.setContainer(hostOsh)
self.portIdToOsh[port.portId] = portOsh
if port.nodeId and port.nodeId in hbaIdToOsh.keys():
containmentLinkOsh = modeling.createLinkOSH('containment', hbaIdToOsh[port.nodeId], portOsh)
hostOSHV.add(containmentLinkOsh)
hostOSHV.add(portOsh)
self.addWwnOsh(port.wwn, portOsh)
for path in host.paths.values():
localVolumeOsh = self.storageArrays[self.volumeIdToStorageId[path.volumeId]].volumes[path.volumeId].build()
localVolumeOsh.setContainer(hostOsh)
dependencyLink = modeling.createLinkOSH('dependency', localVolumeOsh, self.volumeIdToOsh[path.volumeId])
hostOSHV.add(dependencyLink)
hostOSHV.add(localVolumeOsh)
hostOSHV.add(self.volumeIdToOsh[path.volumeId])
self.framework.sendObjects(hostOSHV)
self.framework.flushObjects()
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:30,代码来源:SANscreen_Discovery.py
示例2: buildSwitches
def buildSwitches(self):
for switch in self.switches.values():
switchOSHV = ObjectStateHolderVector()
switchOsh, switchVector = switch.buildOshAndIps()
switchOSHV.addAll(switchVector)
hbaIdToOsh = {}
for hba in switch.fcHBAs.values():
hbaOsh = hba.build()
hbaOsh.setContainer(switchOsh)
hbaIdToOsh[hba.hbaId] = hbaOsh
self.addWwnOsh(hba.wwn, hbaOsh)
switchOSHV.add(hbaOsh)
for port in switch.fcPorts.values():
portOsh = port.build()
portOsh.setContainer(switchOsh)
self.portIdToOsh[port.portId] = portOsh
if port.nodeId and port.nodeId in hbaIdToOsh.keys():
containmentLinkOsh = modeling.createLinkOSH('containment', hbaIdToOsh[port.nodeId], portOsh)
self.OSHVResult.add(containmentLinkOsh)
self.addWwnOsh(port.wwn, portOsh)
switchOSHV.add(portOsh)
if not (str(switch.fabricId) == str(-1)):
fabricMembership = modeling.createLinkOSH('membership', self.fabrics[switch.fabricId].build(), switchOsh)
switchOSHV.add(fabricMembership)
self.framework.sendObjects(switchOSHV)
self.framework.flushObjects()
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:26,代码来源:SANscreen_Discovery.py
示例3: buildFabrics
def buildFabrics(self):
for fabric in self.fabrics.values():
fabricOsh = fabric.build()
for zoneSet in fabric.zoneSets.values():
zoneSetOsh = zoneSet.build()
zoneSetOsh.setContainer(fabricOsh)
compositionLink = modeling.createLinkOSH('composition', fabricOsh, zoneSetOsh)
if zoneSet.zoneSetId == fabric.activeZoneSet:
compositionLink.setAttribute('name', 'Active Zone Set')
else:
compositionLink.setAttribute('name', 'Inactive Zone Set')
for zone in zoneSet.zones:
zoneOsh = zone.build()
zoneOsh.setContainer(fabricOsh)
logger.debug('Have [%s] Members on the Zone [%s] - Processing' % (len(zone.members), zone.name))
for zoneMember in zone.members.values():
memberOsh = self.memberWwnToOsh.get(zoneMember.wwn.lower())
if memberOsh is None:
logger.warn("Found ZoneMember with WWN:[%s] on Zone[%s] which doesn't belong to discovered entities" % (zoneMember.wwn, zone.name))
continue
memberLink = modeling.createLinkOSH('membership', zoneOsh, memberOsh)
self.OSHVResult.add(memberOsh)
self.OSHVResult.add(memberLink)
self.OSHVResult.add(zoneOsh)
self.OSHVResult.add(zoneSetOsh)
self.OSHVResult.add(compositionLink)
for switch in fabric.switches.values():
switchOsh = switch.build()
membershipLink = modeling.createLinkOSH('membership', fabricOsh, switchOsh)
self.OSHVResult.add(membershipLink)
self.OSHVResult.add(fabricOsh)
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:31,代码来源:SANscreen_Discovery.py
示例4: osh_createIpOsh
def osh_createIpOsh(lparOsh, tcpStacks):
ipstoexclude = ['127.0.0.1']
# tcpStacks [ip, network, mask, interface name, status, type, mac address]str_name = 'name'
str_name = 'name'
str_mac_address = 'mac_address'
_vector = ObjectStateHolderVector()
for mac, tcpentry in tcpStacks.items():
ipAddress = tcpentry[0].strip()
if ipAddress not in ipstoexclude:
ipOsh = modeling.createIpOSH(ipAddress)
probeName = CollectorsParameters.getValue(CollectorsParameters.KEY_COLLECTORS_PROBE_NAME)
if isNotNull(probeName):
ipOsh.setAttribute('ip_probename', probeName)
containedOsh = modeling.createLinkOSH('contained', lparOsh, ipOsh)
_vector.add(lparOsh)
_vector.add(ipOsh)
_vector.add(containedOsh)
# create interface ----------------------------------------------------
ifOsh = ObjectStateHolder('interface')
interfacename = tcpentry[3].strip()
ifOsh.setAttribute(str_name, interfacename)
# default the mac address attribute to linkName and update later if MAC found
ifOsh.setAttribute(str_mac_address, mac) # if MAC not found for set #linkName as key
ifOsh.setContainer(lparOsh)
_vector.add(ifOsh)
if tcpStacks.has_key(mac):
parentLinkOsh = modeling.createLinkOSH('containment', ifOsh, ipOsh)
_vector.add(parentLinkOsh)
return _vector
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:32,代码来源:eview400_resources.py
示例5: build
def build(self):
lbcOsh = ObjectStateHolder('loadbalancecluster')
lbcOsh.setStringAttribute('name', self.vServer.name)
containment_link = modeling.createLinkOSH('containment', lbcOsh, self.crgOsh)
membershipLink = modeling.createLinkOSH('membership', lbcOsh, self.netscaler_software_osh)
self.osh = lbcOsh
return self.newVector(lbcOsh, containment_link, membershipLink)
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:7,代码来源:Citrix_NetScaler_by_SNMP.py
示例6: build_layer2_connection
def build_layer2_connection(layer2_connection):
'''
Build Layer 2 connection topology.
@type param: SNMP_CDP_LLDP.Laer2Connwction -> OSHV
'''
oshv = ObjectStateHolderVector()
(local_device_osh,
local_device_ip_address_osh,
local_device_interface_osh,
local_device_member_ip_osh) = build_network_device(layer2_connection.local_device)
(remote_device_osh,
remote_device_ip_address_osh,
remote_device_interface_osh,
remote_device_member_ip_osh) = build_network_device(layer2_connection.remote_device)
if local_device_osh and local_device_interface_osh and remote_device_osh and remote_device_interface_osh:
layer2_osh = ObjectStateHolder('layer2_connection')
layer2_osh.setAttribute('layer2_connection_id',str(hash(layer2_connection.local_device.address_id + layer2_connection.remote_device.address_id)))
layer2_member_local_interface_osh = modeling.createLinkOSH('member', layer2_osh, local_device_interface_osh)
layer2_member_remote_interface_osh = modeling.createLinkOSH('member', layer2_osh, remote_device_interface_osh)
oshv.add(local_device_osh)
oshv.add(local_device_interface_osh)
if (local_device_ip_address_osh):
oshv.add(local_device_ip_address_osh)
oshv.add(local_device_member_ip_osh)
oshv.add(remote_device_osh)
oshv.add(remote_device_interface_osh)
if (remote_device_ip_address_osh):
oshv.add(remote_device_ip_address_osh)
oshv.add(remote_device_member_ip_osh)
oshv.add(layer2_osh)
oshv.add(layer2_member_local_interface_osh)
oshv.add(layer2_member_remote_interface_osh)
return oshv
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:35,代码来源:SNMP_CDP_LLDP.py
示例7: processIpsAndSubnets
def processIpsAndSubnets(_vector, hostIpMap, hostId, ipMap, nwMap, hostOSH):
if hostIpMap.has_key(hostId):
iplist = hostIpMap[hostId]
for ip in iplist:
if ipMap.has_key(ip):
ipObj = ipMap[ip]
## create IPs and contained links for the rest of the IPs of that host
ipOSH = modeling.createIpOSH(ipObj.ipValue)
containedLink = modeling.createLinkOSH('contained', hostOSH, ipOSH)
_vector.add(ipOSH)
_vector.add(containedLink)
## create the network for each IP
ipSubnetId = ipObj.ipSubnetId
if nwMap.has_key(ipSubnetId):
netmaskPrefixLength = nwMap[ipSubnetId].prefixLength
if notNull(netmaskPrefixLength):
netOSH = modeling.createNetworkOSH(ipObj.ipValue, computeStringNetmaskFromPrefix(netmaskPrefixLength))
_vector.add(netOSH)
## create member link between ip and network
memberLink = modeling.createLinkOSH('member', netOSH, ipOSH)
_vector.add(memberLink)
## create member link between host and network
memberLink = modeling.createLinkOSH('member', netOSH, hostOSH)
_vector.add(memberLink)
return _vector
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:28,代码来源:NNM_Integration_Utils_9.py
示例8: build_layer2_connection
def build_layer2_connection(net_device_osh, net_device_interface_name, net_device_ip_address, end_node_osh, end_node_mac_address, end_node_interface_osh):
'''
Build Layer 2 connection topology.
@type param: str,str,osh,str -> OSHV
'''
net_device_id = net_device_ip_address or net_device_osh.getCmdbId().toString()
end_node_id = end_node_mac_address
#is it enough data to build Layer 2 topology
if net_device_id and end_node_id and net_device_osh and net_device_interface_name and end_node_osh and end_node_interface_osh:
oshv = ObjectStateHolderVector()
net_device_interface_osh = ObjectStateHolder('interface')
net_device_interface_osh.setContainer(net_device_osh)
net_device_interface_osh.setAttribute('interface_name', net_device_interface_name)
layer2_osh = ObjectStateHolder('layer2_connection')
layer2_osh.setAttribute('layer2_connection_id',str(hash(net_device_id + end_node_id)))
layer2_member_net_device_interface_osh = modeling.createLinkOSH('member', layer2_osh, net_device_interface_osh)
layer2_member_end_node_interface_osh = modeling.createLinkOSH('member', layer2_osh, end_node_interface_osh)
oshv.add(net_device_osh)
oshv.add(net_device_interface_osh)
oshv.add(end_node_osh)
oshv.add(end_node_interface_osh)
oshv.add(layer2_osh)
oshv.add(layer2_member_net_device_interface_osh)
oshv.add(layer2_member_end_node_interface_osh)
return oshv
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:27,代码来源:CiscoWorks_Layer2.py
示例9: createTransportPathObjects
def createTransportPathObjects(cluster, hostOshByName, resultsVector, framework):
for tPath in cluster.transportPaths:
sourceInterfaceResult = createTransportInterfaceObject(tPath.fromNode, tPath.fromInterface, cluster, hostOshByName)
targetInterfaceResult = createTransportInterfaceObject(tPath.toNode, tPath.toInterface, cluster, hostOshByName)
if sourceInterfaceResult and targetInterfaceResult:
(sourceInterfaceOsh, sourceAdapter) = sourceInterfaceResult
(targetInterfaceOsh, targetAdapter) = targetInterfaceResult
resultsVector.add(sourceInterfaceOsh)
resultsVector.add(targetInterfaceOsh)
versionAsDouble = logger.Version().getVersion(framework)
if versionAsDouble >= 9:
layer2Osh = ObjectStateHolder('layer2_connection')
linkId = "%s:%s" % (sourceAdapter.mac, targetAdapter.mac)
linkId = str(hash(linkId))
layer2Osh.setAttribute('layer2_connection_id', linkId)
sourceMemberLink = modeling.createLinkOSH('member', layer2Osh, sourceInterfaceOsh)
targetMemberLink = modeling.createLinkOSH('member', layer2Osh, targetInterfaceOsh)
resultsVector.add(layer2Osh)
resultsVector.add(sourceMemberLink)
resultsVector.add(targetMemberLink)
else:
layer2Link = modeling.createLinkOSH('layertwo', sourceInterfaceOsh, targetInterfaceOsh)
resultsVector.add(layer2Link)
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:26,代码来源:sun_cluster_by_shell.py
示例10: report
def report(self, region_osh, event_osh=None):
vector = ObjectStateHolderVector()
osh = ObjectStateHolder('host_node')
osh.setAttribute('name', self.name)
logger.debug("self.id:", self.id)
vector.add(osh)
if self.ips:
for ip in self.ips:
ip_osh = modeling.createIpOSH(str(ip))
vector.add(ip_osh)
vector.add(modeling.createLinkOSH('contained', osh, ip_osh))
if self.image:
imageOsh, image_vector = self.image.report(region_osh)
vector.addAll(image_vector)
vector.add(modeling.createLinkOSH('dependency', osh, imageOsh))
if self.hypervisorHostName:
hypervisorOsh, hypervisor_vector = Hypervisor(self.hypervisorHostName).report(region_osh)
vector.addAll(hypervisor_vector)
vector.add(modeling.createLinkOSH('execution_environment', hypervisorOsh, osh))
if self.flavor:
flavorOsh, flavor_vector = self.flavor.report(region_osh)
vector.addAll(flavor_vector)
vector.add(modeling.createLinkOSH('dependency', osh, flavorOsh))
if event_osh:
vector.add(modeling.createLinkOSH('dependency', osh, event_osh))
return osh, vector
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:27,代码来源:openstack.py
示例11: report
def report(self, oshVector, interaction):
if self.acceptorEngine.accepts(interaction.srcNode) and\
self.acceptorEngine.accepts(interaction.dstNode) and interaction.isClientServerRelationDefined():
client, server, connection = interaction.getClient(), interaction.getServer(), interaction.connection
server.serviceAddressOsh = server.serviceAddressOsh or self._buildAndReportServiceAddress(server, connection, self.knownPortsConfigFile, oshVector)
client.processOsh = client.processOsh or self._buildAndReportProcess(client, oshVector)
serverPortNames = self.getPortNamesByPortNr(server.port, server.ip, connection.protocol, self.knownPortsConfigFile)
csLink = None
if client.processOsh is not None and server.serviceAddressOsh is not None:
csLink = modeling.createLinkOSH('client_server', client.processOsh, server.serviceAddressOsh)
elif client.hostOsh is not None and server.serviceAddressOsh is not None:
csLink = modeling.createLinkOSH('client_server', client.hostOsh, server.serviceAddressOsh)
if not csLink:
return
csLink.setStringAttribute('clientserver_protocol', connection.protocol == modeling.TCP_PROTOCOL and 'TCP' or 'UDP')
if serverPortNames:
csLink.setStringAttribute('data_name', first(serverPortNames))
csLink.setLongAttribute('clientserver_destport', int(server.port))
if self.reportTrafficDetails:
connection.dPkgs and csLink.setLongAttribute('clientserver_pkts', connection.dPkgs)
connection.dOctets and csLink.setLongAttribute('clientserver_octets', connection.dOctets)
oshVector.add(csLink)
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:30,代码来源:tcp_reporter_plugin.py
示例12: getServers
def getServers(client, username, enterprise, gatewayOSH, siteOSH, Framework, OSHVResult):
#serverListing = srvrmgr.sendCommand('list servers')
serverListing = client.executeCmd('list servers show SBLSRVR_NAME, HOST_NAME, INSTALL_DIR, SBLMGR_PID, SV_DISP_STATE, SBLSRVR_STATE, START_TIME, END_TIME, SBLSRVR_STATUS, SV_SRVRID')#@@CMD_PERMISION siebel protocol execution
serverTbl = siebel_common.makeTable(serverListing)
# sample output
#SBLSRVR_NAME HOST_NAME INSTALL_DIR SBLMGR_PID SV_DISP_STATE SBLSRVR_STATE START_TIME END_TIME SBLSRVR_STATUS
#------------ --------- ------------------ ---------- ------------- ------------- ------------------- -------- --------------------------------
#sblapp1_AS sblapp1 d:\sea752\siebsrvr 1904 Running Running 2004-08-10 15:43:46 7.5.3.3 [16172] LANG_INDEPENDENT
#sblapp2 sblapp2 d:\sea752\siebsrvr 1336 Running Running 2004-08-01 03:29:42 7.5.3.3 [16172] LANG_INDEPENDENT
#sblapp1 sblapp1 d:\sea752\siebsrvr LIBMsg: No strings available for this language setting
#
#3 rows returned.
svrcount = 0
for serverEntry in serverTbl:
try:
# jython doesn't have out parameters, so this is a bypass with
# and ArrayList return value that has 2 items.
serverObj = serverEntry[0]
serverDataRow = serverEntry[1]
serverOSH = makeAppServer(client, username, enterprise, serverObj, serverDataRow, siteOSH, Framework, OSHVResult)
if serverOSH != None:
OSHVResult.add(modeling.createLinkOSH('depend', serverOSH,gatewayOSH))
OSHVResult.add(modeling.createLinkOSH('member', siteOSH,serverOSH))
svrcount += 1
except:
logger.errorException('Failed to get server')
logger.debug('parsed ', str(svrcount), 'app servers')
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:28,代码来源:siebel_discover_enterprise.py
示例13: discoverContentRules
def discoverContentRules(self):
contentRuleQueryBuilder = SnmpQueryBuilder(CNT_OID_OFFSET)
contentRuleQueryBuilder.addQueryElement(2, 'cnt_name')
contentRuleQueryBuilder.addQueryElement(4, 'ipserver_address')
contentRuleQueryBuilder.addQueryElement(5, 'ipport_type')
contentRuleQueryBuilder.addQueryElement(6, 'ipport_number')
contentRuleQueryBuilder.addQueryElement(68, 'ip_range')
snmpRowElements = self.snmpAgent.getSnmpData(contentRuleQueryBuilder)
for snmpRowElement in snmpRowElements:
virtualServer = modeling.createHostOSH(snmpRowElement.ipserver_address, 'clusteredservice')
virtualServerHostKey = virtualServer.getAttributeValue('host_key')
virtualServer.setAttribute('data_name', virtualServerHostKey)
self.OSHVResult.add(modeling.createLinkOSH('owner', self.css, virtualServer))
self.OSHVResult.add(virtualServer)
resourcePool = ObjectStateHolder('loadbalancecluster')
resourcePool.setStringAttribute('data_name', snmpRowElement.cnt_name)
self.OSHVResult.add(modeling.createLinkOSH('contained', resourcePool, virtualServer))
self.OSHVResult.add(resourcePool)
self.resourcePools[snmpRowElement.cnt_name] = resourcePool
serviceAddress = modeling.createServiceAddressOsh(virtualServer,
snmpRowElement.ipserver_address,
snmpRowElement.ipport_number,
CNT_PROTOCOL_MAP[snmpRowElement.ipport_type])
serviceAddress.setContainer(virtualServer)
self.OSHVResult.add(serviceAddress)
# KB specific: fix of port translations
self.resourcePoolsToServiceAddress[snmpRowElement.cnt_name] = serviceAddress
for i in range(int(snmpRowElement.ip_range)):
#TODO: Add all IPs from range
pass
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:35,代码来源:Cisco_CSS_by_SNMP.py
示例14: createOAMRunningSoftwareOsh
def createOAMRunningSoftwareOsh(scpId, ip, port, protocolId, version, apacheOsh, vector):
"""
Create OAM osh on oam endpoint, oam node & client server relation
"""
logger.debug('submit OAM endpoint: %s:%s' % (ip, port))
endpoint = netutils.createTcpEndpoint(ip, port)
builder = netutils.ServiceEndpointBuilder()
reporter = netutils.EndpointReporter(builder)
nodeOsh = reporter.reportHostFromEndpoint(endpoint)
endpointOsh = reporter.reportEndpoint(endpoint, nodeOsh)
linkOsh = modeling.createLinkOSH('client_server', apacheOsh, endpointOsh)
linkOsh.setStringAttribute('clientserver_protocol', 'tcp')
oamServerOsh = modeling.createApplicationOSH('running_software', 'Oracle Access Management', nodeOsh, None, 'oracle_corp')
oamServerOsh.setStringAttribute('credentials_id', protocolId)
oamServerOsh.setStringAttribute('version', version)
usageOsh = modeling.createLinkOSH('usage', oamServerOsh, endpointOsh)
vector.add(nodeOsh)
vector.add(endpointOsh)
vector.add(linkOsh)
vector.add(oamServerOsh)
vector.add(usageOsh)
logger.debug("create ownership between runningsoftware and scp")
vector.addAll(scp.createOwnerShip(scpId, oamServerOsh))
logger.debug("create consumer-provider link between apache and runningsoftware")
reference = 'connection_type=oam, server_host=%s, server_ip=%s, server_port=%s' % (ip, ip, port)
vector.addAll(scp.createCPLinkByOsh(apacheOsh, oamServerOsh, scpId, reference))
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:26,代码来源:oam_tunnel_job.py
示例15: reporterMSCluster
def reporterMSCluster(self, vector, ms_cluster, groups, ipDictByGroupName, nodesWithIP):
clusterOsh = ms_cluster.create_osh()
vector.add(clusterOsh)
vector.add(modeling.createLinkOSH('membership', clusterOsh, self.applicationOsh))
for node in nodesWithIP:
ips = nodesWithIP[node]
hostOsh = (modeling.createHostOSH(str(ips[0]), 'nt')
or ObjectStateHolder('nt'))
hostOsh.setStringAttribute('name', node)
hostOsh.setStringAttribute('os_family', 'windows')
for ip_obj in ips:
ipOSH = modeling.createIpOSH(ip_obj)
vector.add(ipOSH)
vector.add(modeling.createLinkOSH('containment', hostOsh, ipOSH))
softwareOsh = modeling.createClusterSoftwareOSH(hostOsh,
'Microsoft Cluster SW', ms_cluster.version)
softwareOsh.setAttribute("application_version_number", ms_cluster.version)
vector.add(softwareOsh)
vector.add(modeling.createLinkOSH('membership', clusterOsh, softwareOsh))
for group in groups:
ips = ipDictByGroupName.get(group.name, None)
if ips:
for ip in ips:
groupOsh = group.create_osh()
vector.add(groupOsh)
vector.add(modeling.createLinkOSH('contained', clusterOsh, groupOsh))
ipOsh = modeling.createIpOSH(ip)
vector.add(modeling.createLinkOSH('contained', groupOsh, ipOsh))
vector.add(ipOsh)
self.__crgMap[str(ip)] = groupOsh
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:33,代码来源:plugin_mscluster_ntcmd_version.py
示例16: reportServerWithDatabases
def reportServerWithDatabases(self, hana_instance, container, dependants=None):
r""" Report database server with specified container used databases
and service end-points
@types: db_buidler.HanaDb.InstancePdo, ObjectStateHolder, seq[ObjectStateHolder] -> ObjectStateHolderVector"""
if not hana_instance:
raise ValueError("Hana instance pdo is not specified")
if not container:
raise ValueError("Container for database server is not specified")
oshs = []
server_osh = self._builder.buildDatabaseServerOsh(sid=hana_instance.instance)
oshs.append(server_osh)
ipseOsh = None
instance_osh, oshs_ = self.report_database_instance(hana_instance, container)
oshs.extend(oshs_)
linkosh = modeling.createLinkOSH("membership", server_osh, instance_osh)
oshs.append(linkosh)
if hana_instance.address and hana_instance.getPort():
ipseOsh, oshs_ = self.reportServerIpServiceEndpoint(
hana_instance.address, hana_instance.getPort(), instance_osh, container
)
oshs.extend(oshs_)
for slave in dependants or ():
for master in (server_osh,):
link = modeling.createLinkOSH("dependency", slave, master)
oshs.append(link)
return server_osh, ipseOsh, instance_osh, oshs
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:33,代码来源:db.py
示例17: StepMain
def StepMain(Framework):
logger.debug('Start dependency mapping')
# get result from workflow state
workflowState = Framework.getWorkflowState()
searchResult = workflowState.getProperty(DependenciesDiscoveryConsts.DEPENDENCIES_DISCOVERY_RESULT)
oshv = ObjectStateHolderVector()
dependencyCount = 0
if searchResult:
providerServiceOsh = None
providerDeployable = searchResult.getProviderDeployable()
if providerDeployable:
providerServiceOsh = providerDeployable.getDeployable()
if providerServiceOsh:
logger.debug('The search result does not contain a provider object, generate one from destination data instead')
triggerId = Framework.getCurrentDestination().getId()
providerType = Framework.getDestinationAttribute('PROVIDERTYPE')
providerServiceOsh = ObjectStateHolder(providerType, CmdbObjectID.Factory.restoreObjectID(triggerId))
moreProviderOshs = createOtherProviderOshsIfNeed(Framework)
for index in range(0, searchResult.size()):
deployable = searchResult.get(index)
deployableOsh = deployable.getDeployable()
if providerServiceOsh.compareTo(deployableOsh):
dependencyNames = []
references = []
for dependency in deployable.getDependencies():
dependencyName = dependency.getDependencyName()
variables = dependency.getExportVariables()
logger.debug('%s export variables found by dependency %s' % (variables.size(), dependencyName))
dependencyNames.append(dependencyName)
for var in variables:
varName = var.getName()
values = var.getValues()
logger.debug('Variable %s:%s' % (varName, values))
if varName.lower() == REFERENCES:
references += list(values)
reference = references and ','.join(references)
logger.debug('Found %s link from %s(%s) to %s(%s) by dependency [%s] with reference %s' % (
CONSUMER_PROVIDER_LINK_TYPE, deployableOsh.getObjectClass(),
deployableOsh.getCmdbId(),
providerServiceOsh.getObjectClass(),
providerServiceOsh.getCmdbId(),
'/'.join(dependencyNames),
reference))
consumerProviderLink = modeling.createLinkOSH(CONSUMER_PROVIDER_LINK_TYPE, deployableOsh, providerServiceOsh)
if reference:
consumerProviderLink.setAttribute(REFERENCES, reference)
oshv.add(consumerProviderLink)
dependencyCount += 1
for otherProviderOsh in moreProviderOshs:
oshv.add(modeling.createLinkOSH(CONSUMER_PROVIDER_LINK_TYPE, deployableOsh, otherProviderOsh))
else:
logger.debug('Ignore self link found on %s(%s)' % (deployableOsh.getObjectClass(), deployableOsh.getCmdbId()))
logger.debug('%s consumer-provider link(s) found' % dependencyCount)
if dependencyCount:
Framework.sendObjects(oshv)
Framework.flushObjects()
logger.debug("Finished sending results")
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:58,代码来源:AccurateDependencyMapping.py
示例18: report
def report(self, vector, hostOsh=None, ipOsh=None):
if self.osh is not None:
vector.add(self.osh)
if hostOsh is not None:
vector.add(modeling.createLinkOSH("member", self.osh, hostOsh))
if ipOsh is not None:
vector.add(modeling.createLinkOSH("member", self.osh, ipOsh))
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:9,代码来源:networking.py
示例19: buildTopology
def buildTopology(self):
'''
Construct as400 node topology
@types AS400Client -> ObjectStateHolderVector
'''
myvec = ObjectStateHolderVector()
ip_address = self.__client.getIpAddress()
# create as400 agent OSH
interfaceList = self.__interfacesInfo
as400HostOsh = None
if interfaceList and len(interfaceList) > 0:
# Create as400 CIT
try:
# Get the host_key - lowest mac address of the valid interface list
as400HostOsh = modeling.createCompleteHostOSHByInterfaceList('as400_node', interfaceList, 'OS400', self.__sysInfo.hostName)
as400HostOsh.setAttribute('host_model', self.__sysInfo.hostModel)
as400HostOsh.setAttribute('host_serialnumber', self.__sysInfo.hostSerialNum)
as400HostOsh.setAttribute('host_osversion', self.__sysInfo.hostOSVersion)
as400HostOsh.setAttribute('host_vendor', 'IBM')
myvec.add(as400HostOsh)
as400Osh = self.__createAS400AgentOSH(ip_address)
as400Osh.setAttribute('credentials_id', self.__client.getCredentialId())
as400Osh.setContainer(as400HostOsh)
myvec.add(as400Osh)
except:
logger.warn('Could not find a valid MAC addresses for key on ip : ', self.__client.getIpAddress())
# add all interfaces to the host
if as400HostOsh is not None:
for interface in interfaceList:
interfaceOsh = modeling.createInterfaceOSH(interface.macAddress, as400HostOsh, interface.description, interface.interfaceIndex, interface.type, interface.adminStatus, interface.adminStatus, interface.speed, interface.name, interface.alias, interface.className)
ips = interface.ips
masks = interface.masks
if interfaceOsh:
myvec.add(interfaceOsh)
if ips and masks:
for i in xrange(len(ips)):
ipAddress = ips[i]
ipMask = masks[i]
ipProp = modeling.getIpAddressPropertyValue(ipAddress, ipMask, interface.dhcpEnabled, interface.description)
ipOSH = modeling.createIpOSH(ipAddress, ipMask, ipProp)
myvec.add(ipOSH)
myvec.add(modeling.createLinkOSH('containment', as400HostOsh, ipOSH))
netOSH = modeling.createNetworkOSH(ipAddress, ipMask)
myvec.add(netOSH)
myvec.add(modeling.createLinkOSH('member', netOSH, as400HostOsh))
myvec.add(modeling.createLinkOSH('member', netOSH, ipOSH))
myvec.add(modeling.createLinkOSH('containment', interfaceOsh, ipOSH))
else:
logger.warn('Parent host wasn\'t created. No interfaces will be reported.')
return myvec
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:57,代码来源:AS400_Connection.py
示例20: report
def report(self, cloud):
vector = ObjectStateHolderVector()
vcloudDirectorOsh = self.reportVcloudDirector(cloud, vector)
vcloudRootOsh = None
systemOrganizationOsh = None
if cloud.systemOrganization is not None:
if cloud.companyName:
vcloudRootOsh = self.reportVcloudRoot(cloud, vector)
self.reportVcloudUri(cloud, vcloudRootOsh, vector)
systemOrganizationOsh = self.reportSystemOrganization(cloud.systemOrganization, vcloudRootOsh, vector)
manageLink = modeling.createLinkOSH('manage', vcloudDirectorOsh, systemOrganizationOsh)
vector.add(manageLink)
for providerVdc in cloud.providerVdcByName.values():
self.reportProviderVdc(providerVdc, systemOrganizationOsh, vector)
for organization in cloud.organizationsByName.values():
organizationOsh = self.reportOrganization(organization, vcloudRootOsh, vector)
manageLink = modeling.createLinkOSH('manage', vcloudDirectorOsh, organizationOsh)
vector.add(manageLink)
for vdc in organization.vdcByName.values():
vdcOsh = self.reportVdc(vdc, organizationOsh, cloud, vector)
for vapp in vdc.vappsByName.values():
vappOsh = self.reportVapp(vapp, organizationOsh, vector)
for vm in vapp.vmsByName.values():
self.reportVm(vm, vappOsh, vector)
for catalog in organization.catalogsByName.values():
catalogOsh = self.reportCatalog(catalog, organizationOsh, vector)
for media in catalog.mediaByName.values():
mediaOsh = self.reportMedia(media, catalogOsh, vector)
if media._parentVdcReference is not None:
mediaParentVdc = organization._vdcByHref.get(media._parentVdcReference.getHref())
if mediaParentVdc is not None:
vdcOsh = mediaParentVdc.getOsh()
if vdcOsh is not None:
usageLink = modeling.createLinkOSH('usage', mediaOsh, vdcOsh)
vector.add(usageLink)
for vappTemplate in catalog.vappTemplatesByName.values():
self.reportVappTemplate(vappTemplate, catalogOsh, vector)
return vector
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:55,代码来源:vcloud_report.py
注:本文中的modeling.createLinkOSH函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论