本文整理汇总了Python中modeling.createLinkOSH函数的典型用法代码示例。如果您正苦于以下问题:Python createLinkOSH函数的具体用法?Python createLinkOSH怎么用?Python createLinkOSH使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createLinkOSH函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()
示例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()
示例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)
示例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
示例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)
示例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
示例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
示例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
示例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)
示例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
示例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)
示例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')
示例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
示例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))
示例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