Search in sources :

Example 71 with CIMProperty

use of javax.cim.CIMProperty in project coprhd-controller by CoprHD.

the class CIMPropertyFactory method getPropertyArray.

public static String[] getPropertyArray(CIMInstance instance, String propertyName) {
    _log.debug("instance :{}", instance);
    _log.debug("propertyName :{}", propertyName);
    String[] propertyValue = { SmisConstants.EMPTY_STRING };
    if (instance != null && propertyName != null) {
        CIMProperty property = instance.getProperty(propertyName);
        if (property != null) {
            Object value = property.getValue();
            if (value != null && value instanceof String[]) {
                propertyValue = (String[]) value;
            } else {
                _log.warn(String.format("CIMInstance %s does not have a '%s' property or the property value is null", instance.toString(), propertyName));
            }
        }
    }
    return propertyValue;
}
Also used : CIMProperty(javax.cim.CIMProperty)

Example 72 with CIMProperty

use of javax.cim.CIMProperty in project coprhd-controller by CoprHD.

the class BrocadeNetworkSMIS method processTopologyViewInstance.

/**
 * generate port connections from the Topology details
 * @param client
 *            WBEMClient
 * @param topins
 *            toplogy instance
 * @param portConnections
 *            port connections
 * @param routedConnections
 *            routed connections
 * @param fabricName
 *            fabric name
 * @param fabricWwn
 *            fabric WWN
 * @param deviceNameCache
 *            a map to cache switch names
 * @param logicalToPhysicalSwitchMap
 *            a map to cache logical switches and container physical switch
 * @throws WBEMException
 */
private void processTopologyViewInstance(WBEMClient client, CIMInstance topins, Map<String, FCEndpoint> portConnections, Map<String, Set<String>> routedConnections, String fabricName, String fabricWwn, Map<String, String> deviceNameCache, Map<String, String> logicalToPhysicalSwitchMap) throws WBEMException {
    if (_XlatePhantomPort.equals(cimStringProperty(topins, _AntecedentFCPortElementName))) {
        Set<String> fabricRoutedEndpoints = routedConnections.get(fabricWwn);
        if (fabricRoutedEndpoints == null) {
            fabricRoutedEndpoints = new HashSet<String>();
            routedConnections.put(fabricWwn, fabricRoutedEndpoints);
        }
        fabricRoutedEndpoints.add(formatWWN(cimStringProperty(topins, _DependentFCPortWWN)));
        // if this is a routed endpoint, collect and move on
        return;
    }
    // skip things that are not fiber links e.g. eport links
    if (cimIntegerProperty(topins, _AntecedentFCPortType) != _clientPort) {
        return;
    }
    String remotePortName = formatWWN(cimStringProperty(topins, _DependentFCPortWWN));
    String remoteNodeName = formatWWN(cimStringProperty(topins, _DependentElementWWN));
    String switchPortName = formatWWN(cimStringProperty(topins, _AntecedentFCPortWWN));
    String switchInterfaceName = cimStringProperty(topins, _AntecedentFCPortElementName);
    String switchWwn = formatWWN(cimStringProperty(topins, _AntecedentElementWWN));
    String switchName = switchWwn;
    if (deviceNameCache.get(switchWwn) != null) {
        switchName = deviceNameCache.get(switchWwn);
    } else {
        CIMProperty switchPathProperty = topins.getProperty(_AntecedentSystem);
        CIMObjectPath switchPath = null;
        if (switchPathProperty.getValue() instanceof String) {
            switchPath = new CIMObjectPath((String) switchPathProperty.getValue());
        } else {
            switchPath = (CIMObjectPath) switchPathProperty.getValue();
        }
        CloseableIterator<CIMInstance> switchIt = client.enumerateInstances(switchPath, false, true, true, null);
        while (switchIt.hasNext()) {
            CIMInstance swins = switchIt.next();
            String namex = formatWWN(cimStringProperty(swins, _name));
            String enamex = cimStringProperty(swins, _element_name);
            if (namex.equals(switchWwn)) {
                switchName = enamex;
                deviceNameCache.put(switchWwn, switchName);
            }
        }
    }
    // Get the Physcial Switch Name for the Logical Switch
    String physicalSwitchName = logicalToPhysicalSwitchMap.get(switchName);
    _log.info("Switch Name : {} Physical SwitchName {}", switchName, physicalSwitchName);
    if (physicalSwitchName != null) {
        switchName = physicalSwitchName;
    }
    FCEndpoint conn = new FCEndpoint();
    conn.setFabricId(fabricName);
    conn.setRemotePortName(remotePortName);
    conn.setRemoteNodeName(remoteNodeName);
    conn.setSwitchPortName(switchPortName);
    conn.setSwitchInterface(switchInterfaceName);
    conn.setSwitchName(switchName);
    conn.setFabricWwn(fabricWwn);
    portConnections.put(remotePortName, conn);
}
Also used : CIMProperty(javax.cim.CIMProperty) CIMObjectPath(javax.cim.CIMObjectPath) FCEndpoint(com.emc.storageos.db.client.model.FCEndpoint) CIMInstance(javax.cim.CIMInstance)

Example 73 with CIMProperty

use of javax.cim.CIMProperty in project coprhd-controller by CoprHD.

the class DCNMDialog method getZonesets.

/**
 * Returns all zonesets in the desiredVsan. Active zoneset is at the front of the returned list.
 * This generates the nested objects Zone and ZoneMember in the Zonesets.
 *
 * @param desiredVsan Integer
 * @return List<Zoneset>
 * @throws WBEMException
 */
public List<Zoneset> getZonesets(Integer desiredVsan) throws WBEMException {
    List<Zoneset> zonesets = new ArrayList<Zoneset>();
    CIMObjectPath path = CimObjectPathCreator.createInstance("Cisco_Vsan", _namespace);
    CloseableIterator<CIMInstance> vsanIt = null;
    try {
        vsanIt = _client.enumerateInstances(path, false, true, true, null);
        while (vsanIt.hasNext()) {
            CIMInstance vsanIns = null;
            String vsanId = null;
            vsanIns = vsanIt.next();
            CIMProperty prop = vsanIns.getProperty("OtherIdentifyingInfo");
            String[] idinfoValue = (String[]) prop.getValue();
            if (idinfoValue.length == 2 && idinfoValue[0].equals("Fabric")) {
                vsanId = idinfoValue[1];
                if (desiredVsan.toString().equals(vsanId)) {
                    List<Zoneset> znsets = getZonesetsInVsan(vsanIns);
                    zonesets.addAll(znsets);
                }
            }
        }
    } finally {
        if (vsanIt != null) {
            vsanIt.close();
        }
    }
    return zonesets;
}
Also used : CIMProperty(javax.cim.CIMProperty) ArrayList(java.util.ArrayList) CIMObjectPath(javax.cim.CIMObjectPath) CIMInstance(javax.cim.CIMInstance)

Example 74 with CIMProperty

use of javax.cim.CIMProperty in project coprhd-controller by CoprHD.

the class DCNMDialog method getVsanInstance.

/**
 * Returns the Cisco_Vsan Instance for a specified Vsan.
 *
 * @param desiredVsan
 * @return
 * @throws WBEMException
 */
private CIMInstance getVsanInstance(Integer desiredVsan) throws WBEMException {
    CIMObjectPath path = CimObjectPathCreator.createInstance("Cisco_Vsan", _namespace);
    CloseableIterator<CIMInstance> vsanIt = null;
    try {
        vsanIt = _client.enumerateInstances(path, false, true, true, null);
        while (vsanIt.hasNext()) {
            CIMInstance vsanIns = null;
            String vsanId = null;
            vsanIns = vsanIt.next();
            CIMProperty prop = vsanIns.getProperty("OtherIdentifyingInfo");
            String[] idinfoValue = (String[]) prop.getValue();
            if (idinfoValue.length == 2 && idinfoValue[0].equals("Fabric")) {
                vsanId = idinfoValue[1];
                if (desiredVsan.toString().equals(vsanId)) {
                    return vsanIns;
                }
            }
        }
    } finally {
        if (vsanIt != null) {
            vsanIt.close();
        }
    }
    // not found
    return null;
}
Also used : CIMProperty(javax.cim.CIMProperty) CIMObjectPath(javax.cim.CIMObjectPath) CIMInstance(javax.cim.CIMInstance)

Aggregations

CIMProperty (javax.cim.CIMProperty)74 CIMObjectPath (javax.cim.CIMObjectPath)57 CIMInstance (javax.cim.CIMInstance)37 ArrayList (java.util.ArrayList)26 WBEMException (javax.wbem.WBEMException)25 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)18 CIMArgument (javax.cim.CIMArgument)16 WBEMClient (javax.wbem.client.WBEMClient)14 IOException (java.io.IOException)11 Volume (com.emc.storageos.db.client.model.Volume)10 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)10 URI (java.net.URI)9 ServiceCodeException (com.emc.storageos.svcs.errorhandling.resources.ServiceCodeException)8 UnsignedInteger16 (javax.cim.UnsignedInteger16)8 DbClient (com.emc.storageos.db.client.DbClient)7 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)7 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)6 HashMap (java.util.HashMap)6 ExportMask (com.emc.storageos.db.client.model.ExportMask)5 Initiator (com.emc.storageos.db.client.model.Initiator)5