Search in sources :

Example 1 with ConnectivityMemberType

use of com.emc.storageos.networkcontroller.impl.mds.ZoneMember.ConnectivityMemberType in project coprhd-controller by CoprHD.

the class BrocadeNetworkSMIS method getZoneOrAliasMembers.

/**
 * This function gets the member of a zone or an alias.
 *
 * @param client
 * @param path the path to the zone or alias
 * @param alias true if the object is of type alias
 * @return an instance of zonemember that has the WWN of the
 *         zone or alias member
 * @throws WBEMException
 */
@SuppressWarnings("unchecked")
public List<ZoneMember> getZoneOrAliasMembers(WBEMClient client, CIMObjectPath path, boolean alias) throws WBEMException {
    List<ZoneMember> members = new ArrayList<ZoneMember>();
    if (path != null) {
        CloseableIterator<CIMInstance> zoneItr = null;
        try {
            String association = alias ? _Brocade_ZoneMembershipSettingDataInZoneAlias : _Brocade_ZoneMembershipSettingDataInZone;
            zoneItr = client.associatorInstances(path, association, _Brocade_ZoneMembershipSettingData, null, null, false, null);
            while (zoneItr.hasNext()) {
                CIMInstance memberIns = zoneItr.next();
                String address = cimStringProperty(memberIns, _ConnectivityMemberID);
                ConnectivityMemberType type = ConnectivityMemberType.byValue(cimIntegerProperty(memberIns, _ConnectivityMemberType));
                if (// temporarily allow portgroup because of brocade issues
                type == ConnectivityMemberType.WWPN || type == ConnectivityMemberType.PORTGROUP) {
                    // where type is port group when wwnn=wwpn
                    address = formatWWN(address);
                }
                ZoneMember zoneMember = new ZoneMember(address, type);
                // This is the path of the association object
                zoneMember.setCimObjectPath(memberIns.getObjectPath());
                if (alias) {
                    zoneMember.setAlias(getPropertyValueFromInstanceId(path, SmisConstants.CP_NSNAME));
                    zoneMember.setAliasType(true);
                    // this is the path of the alias object
                    zoneMember.setCimAliasPath(path);
                }
                members.add(zoneMember);
            }
        } finally {
            if (zoneItr != null) {
                zoneItr.close();
            }
        }
    }
    return members;
}
Also used : ConnectivityMemberType(com.emc.storageos.networkcontroller.impl.mds.ZoneMember.ConnectivityMemberType) ArrayList(java.util.ArrayList) ZoneMember(com.emc.storageos.networkcontroller.impl.mds.ZoneMember) CIMInstance(javax.cim.CIMInstance)

Aggregations

ZoneMember (com.emc.storageos.networkcontroller.impl.mds.ZoneMember)1 ConnectivityMemberType (com.emc.storageos.networkcontroller.impl.mds.ZoneMember.ConnectivityMemberType)1 ArrayList (java.util.ArrayList)1 CIMInstance (javax.cim.CIMInstance)1