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;
}
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);
}
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;
}
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;
}
Aggregations