Commit 0d5cc679 by Tomasz Ciesielczyk

deployment update, node type simplified

parent 8b6898c2
1. models/type.map.json
1. conf/resources.conf
\ No newline at end of file
......@@ -4,50 +4,10 @@ xeon.e.p40_gpu=xeon_e_p40_gpu
xeonnode_default=xeon_rapl_node_auto
xeonnode.ipmi_default=xeon_rapl_node_auto
Express-KL.IntelR.XeonR.CPU.E3-1505M.v6.@.3.00GHz_default=default
Express-BD7.IntelR.XeonR.CPU.D-1548.@.2.00GHz_default=default
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
fd:36:5e:47:60:fe:f1:04:2e:06:b2:31:88:45:ec:af.
Please contact your system administrator.
Add correct host key in /home/tomaszc/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/tomaszc/.ssh/known_hosts:43
ECDSA host key for 10.12.1.26 has changed and you have requested strict checking.
Host key verification failed._default=default
Express-BD7.IntelR.XeonR.CPU.D-1548.@.2.00GHz_default=default
default_default=default
default_cpubound=default
xeon.e.v100_default=default
xeon.e.v100_gpu=xeon_e_v100_gpu
Host key verification failed._default=default
xeon.e.cpu_default=xeon_e_cpu
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
fd:36:5e:47:60:fe:f1:04:2e:06:b2:31:88:45:ec:af.
Please contact your system administrator.
Add correct host key in /home/tomaszc/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/tomaszc/.ssh/known_hosts:44
ECDSA host key for 10.12.1.32 has changed and you have requested strict checking.
Host key verification failed._default=default
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
fd:36:5e:47:60:fe:f1:04:2e:06:b2:31:88:45:ec:af.
Please contact your system administrator.
Add correct host key in /home/tomaszc/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/tomaszc/.ssh/known_hosts:42
ECDSA host key for 10.12.1.25 has changed and you have requested strict checking.
Host key verification failed._default=default
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ WARNING: REMOTE HOST IDENTIFICATION _default=default
xeon.e.cpu_default=xeon_e_cpu
......@@ -9,7 +9,7 @@
#$[null] -> empty value##
##API map file location
api_map_file = $[basePath]/api_map.json
api_map_file = $[basePath]/conf/api_map.json
##keystone, no_auth, basic (username,password), token - @see token_auth section for more details
auth_type = no_auth
......
package psnc.m2dc.rtm.fm
import org.slf4j.LoggerFactory
import psnc.m2dc.rtm.StorageKeys
import psnc.m2dc.rtm.dao.DAO
......@@ -51,7 +52,6 @@ class FMApi {
}
fun setTemperatureLimit(limit: TemperatureLimit) {
// val temperatureLimit = Values.temperatureLimit(limit.temperature)
StorageKeys.TEMPERATURE_LIMIT[limit.resourceId, limit.sensorId] = limit//=(v mapOf(limit.resourceId to limit))
}
......@@ -79,11 +79,6 @@ class FMApi {
}
}
}
// fun setTemperatureLimit(nodeList: ArrayList<String>, temperature: Float) {
// nodeList.forEach({
// StorageKeys.TEMPERATURE_LIMIT.set(it, temperature)
// })
// }
fun getPredictedPower(nodeList: List<String>,
timeInterval: List<TimeInterval>): Map<TimeInterval, Map<String, Double>> {
......@@ -118,7 +113,7 @@ class FMApi {
check if temperature limit is not exceeded
return exceeded values
*/
fun checkTemperatureLimit(): List<TemperatureLimit> {
private fun checkTemperatureLimit(): List<TemperatureLimit> {
val result = ArrayList<TemperatureLimit>()
val map = StorageKeys.TEMPERATURE_LIMIT.getMap()
map.values.forEach({ limit ->
......
package psnc.m2dc.rtm.commands.java
val APP_VERSION = "1.0.440_83706"
\ No newline at end of file
val APP_VERSION = "1.0.453_46352"
\ No newline at end of file
......@@ -147,7 +147,7 @@ class ResourceHandler : Handlers() {
map["is_node"] = resource.get<Boolean>(Resource.Property.is_node)
map["ssh_host"] = resource.get<String>(Resource.Property.ssh_host)
map["ipmi_host"] = resource.get<String>(Resource.Property.ipmi_host)
map["resourceType"] = resource.resourceType?.type.toString()
// map["resourceType"] = resource.resourceType?.type.toString()
map["models"] = DAO.ResourcesManagerApi.getAllComponentPowerModel(resource.typeId)
}
val jsonBuilder = JsonBuilder()
......@@ -198,11 +198,11 @@ class ResourceHandler : Handlers() {
req.logDebug()
val jsonBuilder = JsonBuilder()
val resource = URLHelper.getResource(req)
if (resource.resourceType != null) {
jsonBuilder.addObj(RESTKeys.resource_type, resource.resourceType)
} else {
jsonBuilder.addObj(RESTKeys.resource_type, DAO.ResourcesManagerApi.getResourceType(resource))
}
// if (resource.resourceType != null) {
// jsonBuilder.addObj(RESTKeys.resource_type, resource.resourceType)
// } else {
jsonBuilder.addObj(RESTKeys.resource_type, DAO.ResourcesManagerApi.getResourceType(resource))
// }
jsonBuilder.toJson()
} catch (e: Exception) {
res.status(400)
......@@ -216,7 +216,7 @@ class ResourceHandler : Handlers() {
val resource = URLHelper.getResource(req)
val resourceType = URLHelper.getResourceType(req)
resource.typeId = resourceType.id
resource.resourceType = resourceType
// resource.resourceType = resourceType
throw NotImplementedError()
......@@ -471,7 +471,7 @@ class ResourceHandler : Handlers() {
fun getNodeUtil(req: Request, res: Response): String {
return try {
req.logDebug()
val timeInterval =req.getJson()?.let { jo -> this.getTimeInterval(jo) }
val timeInterval = req.getJson()?.let { jo -> this.getTimeInterval(jo) }
val nodeUtil = if (timeInterval != null) {
DAO.Chassis.getNodeUtil(timeInterval)
} else
......@@ -491,11 +491,9 @@ class ResourceHandler : Handlers() {
req.logDebug()
val jo = RTMApi.getJsonObj(req.body())
val nodeUtils = this.getNodeUtil(jo)
nodeUtils.forEach {
it->
if(DAO.Resource.getResource(it.nodeId)==null){
return "Resource not found: ${it.nodeId}"
}
nodeUtils.forEach { it ->
//check if all resources exists
DAO.Resource.getResource(it.nodeId)
}
DAO.Chassis.addNodeUtil(nodeUtils)
JsonBuilder().addOK().toJson()
......
package psnc.m2dc.rtm.client
const val APP_VERSION = "1.1.440_83707"
\ No newline at end of file
const val APP_VERSION = "1.1.453_46352"
\ No newline at end of file
......@@ -5,7 +5,6 @@ import com.thoughtworks.xstream.XStream
import org.slf4j.LoggerFactory
import psnc.m2dc.rtm.properties.RTMProperties
import psnc.m2dc.rtm.properties.keys.Keys
import psnc.m2dc.rtm.rpm.nativeapi.LDAPApi
import psnc.m2dc.rtm.rpm.nativeapi.RECSApi
import java.util.*
import kotlin.collections.HashSet
......@@ -131,7 +130,7 @@ class RECSApiMock(parser: XStream) : RECSApi(parser) {
log.info("Loading recs hosts")
Keys.RTM.recs_host_src_list.get().forEach { src ->
when (src) {
"LDAP" -> LDAPApi.instance().listRecsNodes("*").recsNodeMap.values.forEach { res.add(it.ipHostNumber) }
// "LDAP" -> LDAPApi.instance().listRecsNodes("*").recsNodeMap.values.forEach { res.add(it.ipHostNumber) }
"CONF", "CONFIG" -> {
log.info("Loading recs hosts from config file")
Keys.RTM.recs_hosts.get().forEach {
......
//package psnc.m2dc.rtm.model.rest
//
//public enum class AggregationMethod {
// AVG, MAX, MIN, MEDIAN;
//
// public companion object {
// fun get(aggregationMethod: String?): AggregationMethod {
// try {
// val method = aggregationMethod as String
// return AggregationMethod.valueOf(method)
// } catch(e: Exception) {
// return AggregationMethod.AVG
// }
// }
// }
//
//
//}
//
//
//
\ No newline at end of file
//package psnc.m2dc.rtm.model.rest
//data class UtilDetails(val requiredNode: NodeModel, val timeInterval: TimeInterval, val load: Float,
// val diskUsage: Long? = null, val subcomponentLoad: HashMap<String, Float> = HashMap()) {
//
//
//}
\ No newline at end of file
......@@ -2,6 +2,8 @@ package psnc.m2dc.rtm.model.rest
import java.util.*
private val TYPE_NAME_PATTERN = Regex("^[a-zA-Z|.|-|\$|@|!|&|*]*\$")
/**
* value validators
*/
......@@ -54,11 +56,30 @@ class Values {
// throw IllegalArgumentException("powerUsageLevel must be between 0 and 100 ")
// else powerUsageLevel
// }
val typeName = { tn: String ->
if (tn.length < 3 || !TYPE_NAME_PATTERN.matches(tn))
throw IllegalArgumentException("Inappropriate type name")
else tn
}
}
}
fun String.containsAny(vararg chars: Char): Boolean {
return this.containsAny(*chars)
}
fun String.containsAny(characters: Collection<Char>): Boolean {
this.forEach { char ->
if (characters.contains(char)) {
return true
}
}
return false
}
fun NodePriority.validate(): NodePriority {
Values.nodeWeight(this.weight)
this.validIn?.let {
......
......@@ -659,6 +659,7 @@ object ModelMap {
out.write("#resource_type_profile=model\n")
this.map.forEach { type, typeMap ->
typeMap.forEach { profile, model ->
out.write("${type}_$profile=${model.name}\n")
}
......
package psnc.m2dc.rtm.model.rpm
import com.google.gson.annotations.SerializedName
import psnc.m2dc.rtm.utils.toJson
data class LDAPRECSNode(val ipHostNumber: String, val cn: String? = null, val description: String? = null,
val objectClass: String? = null, val nodeDecription: LDAPRECSNodeDecription? = null)
data class LDAPRECSNodeDecription(@SerializedName("node") val nodeId: String, val api: String)
data class LDAPRECSNodeWrapper(val node: LDAPRECSNode) {
override fun hashCode(): Int {
if (node.nodeDecription?.nodeId != null) {
return node.nodeDecription.nodeId.hashCode()
}
if (node.cn != null) {
return node.cn.hashCode()
}
return node.hashCode()
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as LDAPRECSNodeWrapper
if (node != other.node) return false
return true
}
//
// override fun equals(LDAPRECSNodeWrapper): Boolean {
//
// }
}
data class LDAPRECSDictionary(
val recsNodeMap: /*<node recs id /cn, LDAPRECSNode>*/HashMap<String, LDAPRECSNode> = HashMap(),
private val hostMap: /*<managementHostIp,list of cn names>*/
HashMap<String, HashSet<LDAPRECSNodeWrapper>> = HashMap()) {
fun addNode(node: LDAPRECSNode) {
if (node.nodeDecription != null && node.cn != null) {
this.recsNodeMap[node.nodeDecription.nodeId] = node
this.hostMap.getOrPut(node.ipHostNumber) { HashSet() }.add(
LDAPRECSNodeWrapper(node))
} else if (node.cn != null && node.cn == "") {
this.hostMap.getOrPut(node.ipHostNumber) { HashSet() }
} else {
throw IllegalArgumentException("unsupported node${node.toJson()}")
}
}
}
\ No newline at end of file
//package psnc.m2dc.rtm.model.rpm
//
//import com.google.gson.annotations.SerializedName
//import psnc.m2dc.rtm.utils.toJson
//
//data class LDAPRECSNode(val ipHostNumber: String, val cn: String? = null, val description: String? = null,
// val objectClass: String? = null, val nodeDecription: LDAPRECSNodeDecription? = null)
//
//data class LDAPRECSNodeDecription(@SerializedName("node") val nodeId: String, val api: String)
//
//
//data class LDAPRECSNodeWrapper(val node: LDAPRECSNode) {
// override fun hashCode(): Int {
// if (node.nodeDecription?.nodeId != null) {
// return node.nodeDecription.nodeId.hashCode()
// }
// if (node.cn != null) {
// return node.cn.hashCode()
// }
// return node.hashCode()
// }
//
// override fun equals(other: Any?): Boolean {
// if (this === other) return true
// if (javaClass != other?.javaClass) return false
//
// other as LDAPRECSNodeWrapper
//
// if (node != other.node) return false
//
// return true
// }
// //
// // override fun equals(LDAPRECSNodeWrapper): Boolean {
// //
// // }
//}
//
//data class LDAPRECSDictionary(
// val recsNodeMap: /*<node recs id /cn, LDAPRECSNode>*/HashMap<String, LDAPRECSNode> = HashMap(),
// private val hostMap: /*<managementHostIp,list of cn names>*/
// HashMap<String, HashSet<LDAPRECSNodeWrapper>> = HashMap()) {
// fun addNode(node: LDAPRECSNode) {
// if (node.nodeDecription != null && node.cn != null) {
// this.recsNodeMap[node.nodeDecription.nodeId] = node
// this.hostMap.getOrPut(node.ipHostNumber) { HashSet() }.add(
// LDAPRECSNodeWrapper(node))
// } else if (node.cn != null && node.cn == "") {
// this.hostMap.getOrPut(node.ipHostNumber) { HashSet() }
// } else {
// throw IllegalArgumentException("unsupported node${node.toJson()}")
// }
// }
//}
\ No newline at end of file
......@@ -10,13 +10,11 @@ import psnc.m2dc.rtm.utils.logError
*/
data class Resource(val id: String, var typeId: String, val parentId: String?,
var childResources: MutableList<Resource>? = null,
val properties: HashMap<String, Any> = HashMap<String, Any>(),
var resourceType: ResourceType? = null) {
constructor() : this("", "", null, null, HashMap<String, Any>(), null)
val properties: HashMap<String, Any> = HashMap<String, Any>()
/*, var resourceType: ResourceType? = null*/) {
constructor() : this("", "", null, null, HashMap<String, Any>())
enum class Type {
recs_node, node, cpu_core, cpu, gpu, rcu, recs_backplane, recs_baseboard, unknown
}
enum class Property {
is_node, tag, ipmi_host, recs_host, ssh_host, ssh_username, action_power_details, node_id
......@@ -34,11 +32,11 @@ data class Resource(val id: String, var typeId: String, val parentId: String?,
}
fun getChildren(maxDepth: Int = 1, parent: Resource = this): HashMap<String, Resource> {
try {
return getChildren(maxDepth, parent, HashMap())
return try {
getChildren(maxDepth, parent, HashMap())
} catch (e: Exception) {
logError("Cannot getChildren, cause: ${e.message}, parent: ${parent.id}")
return HashMap()
HashMap()
}
}
......@@ -162,150 +160,21 @@ data class Resource(val id: String, var typeId: String, val parentId: String?,
}
// /**
// * @param other less important resource's details
// */
// fun extend(other: Resource): Resource {
//
// if (this.typeId.isEmpty())
// this.typeId = other.typeId
// this.childResources?.let {
// other.childResources?.forEach { otherChild ->
// it.find { it.id == otherChild.id }?.extend(otherChild) ?: it.add(otherChild)
// }
// } ?: { this.childResources = other.childResources }.invoke()
// this.parentResource ?: { this.parentResource == other.parentResource }.invoke()
// this.properties.let {
// other.properties.forEach { otherProperty ->
// it.putIfAbsent(otherProperty.key, otherProperty.value)
// }
// }
// return this
// }
//#endregion
}
data class ResourceType(val id: String, val type: Resource.Type,
data class ResourceType(val id: String, /*val type: Resource.Type*/
val apiMap: HashMap<String, List<ApiDetails>> = HashMap(),
/*var powerModel: PowerModel? = null,*/ var properties: HashMap<String, Any>? = null) {
//fun getSensors(type: String): List<ResourceApi> = sensorMap.values.filter { it.type == type }
// fun getApis(typeName: String) = apiMap[typeName] ?: throw NullPointerException(
//
//
// fun getApiDetails(sensorName: String): ApiDetails? {
// //TO
// DO: not very efffective
// var api: ApiDetails? = null
// for (list in this.apiMap.values) {
// api = list.find({ it.name == sensorName })
// if (api == null) continue
// break
// }
// return api
// }
//
// fun findApiDetails(sensorKey: String, api: ManagementApi): ApiDetails? {
// //TO DO: not very efffective
// var apiDetails: ApiDetails? = null
//
// for (list in this.apiMap.values) {
// apiDetails = list.find({ it.name == sensorKey && it.api == api || it.id == sensorKey })
// if (apiDetails == null) continue
// break
// }
// return apiDetails
// }
//
// fun getApiDetailsById(sensorId: String): ApiDetails? {
// //T ODO: not very efffective
// var api: ApiDetails? = null
// for (list in this.apiMap.values) {
// api = list.find({ it.id == sensorId })
// if (api == null) continue
// break
// }
// return api
// }
fun contains(typeName: String) = this.apiMap[typeName]?.size ?: 0 > 0
var properties: HashMap<String, Any>? = null) {
// fun getSensorNames(type: String): List<String> = sensorMap.filter { it.value.type == type }.keys.toList()
//fun getSensor(type: String): ResourceApi? = sensorMap.values.filter { it.type == type }.firstOrNull()
fun contains(typeName: String) = this.apiMap[typeName]?.size ?: 0 > 0
// enum class Type {
// recs_node, node, cpu_core, cpu, gpu, rcu, recs_backplane, recs_baseboard, unknown
// }
// fun getTypePowerModel(): PowerModel {
// return powerModel ?: {
// _print("No power model for type:${id}:${type} use default"); 100f
// PowerModel.default()
// }.invoke()
// }
}
//companion
/*
fun getAction(key: String): ActionPowerDetails? {
try {
return this.get<java.util.HashMap<String, ActionPowerDetails>>(
Property.action_power_details)?.get(key)
} catch (ex: Exception) {
ex.printStackTrace()
return null
}
}
fun getAction(): HashMap<String, ActionPowerDetails>? {
try {
return this.get<java.util.HashMap<String, ActionPowerDetails>>(
Property.action_power_details)
} catch (ex: Exception) {
ex.printStackTrace()
return null
}
}
// fun listAllChildren(maxDepth: Int = 1, parent: Resource,
// result: HashMap<String, Resource> = HashMap()): HashMap<String, Resource> {
// if (maxDepth <= 0) {
// return result
// }
// var _result = result
// if (parent.childResources == null || parent.childResources!!.isEmpty()) {
// return _result
// }
// parent!!.childResources!!.forEach { child ->
// if (_result.containsKey(child.id)) {
// throw Exception(
// "Duplicate child !!! child:${child.id} parent:${parent.id} node_id:${parent.get<String>
// (Property.node_id)}")
// }
// _result.put(child.id, child)
// _result = listAllChildren(maxDepth - 1, child, _result)
// }
// return _result
// }
// fun getMeta(): NodeApiDetails {
// try {
// //
// return this.get<NodeApiDetails>() ?: NodeApiDetails()//this.id
// } catch (ex: Exception) {
// // to do : log error
// ex.printStackTrace()
// return NodeApiDetails()//this.id
// }
// }
// fun <NodeApiDetails> getProperty(): NodeApiDetails? {
// try {
// if (properties != null) {
// return properties[Property.node_resource_meta.toString()] as NodeApiDetails ?: defaultValue
// }
// return defaultValue
// } catch (e: Exception) {
// return defaultValue
// }
// }
*/
\ No newline at end of file
......@@ -16,21 +16,6 @@ class StateDefinition(val model: ComponentPowerModel, val util: Double, val perf
}
return this.savingsVector[settingIndex]
}
// companion object {
// fun fromPower(model: ComponentPowerModel, powerUsage: Double, perfLevel: Double = 100.0, priority: Double = 0.5)
// : StateDefinition {
//
// val util = model.getUtil(powerUsage, perfLevel)
// return StateDefinition(model, util, powerUsage, perfLevel, priority)
// }
//
// fun fromUtil(model: ComponentPowerModel, util: Double, perfLevel: Double = 100.0, priority: Double =
// 0.5)
// : StateDefinition {
// val powerUsage = model.getPower(util, perfLevel)
// return StateDefinition(model, util, powerUsage, perfLevel, priority)
// }
// }
}
\ No newline at end of file
......@@ -33,7 +33,7 @@ $[null] -> empty value"""
val mock_list = RTMProperty(Default + "mock_list", Array<String>(0,{""}), description = "availalable mock items: SSH, IPMI, RECS")
//val test_resource_list = Default + "test_resource_list"
val debug = RTMProperty(Default + "debug", false, description = "turn debug mode on/off")
val api_map_file = RTMProperty(Default + "api_map_file", "\$[basePath]/api_map.json", description = "API map file location")
val api_map_file = RTMProperty(Default + "api_map_file", "\$[basePath]/conf/api_map.json", description = "API map file location")
//val test_mode = Default + "test_mode"
val min_active_load = RTMProperty(Default + "min_active_load", 5.0, description = "load border")
val min_active_component_load = RTMProperty(Default + "min_active_component_load", 10.0, description = "load border")
......
......@@ -45,7 +45,7 @@ interface RPMApi {
*/
fun suspend(resource: Resource)
fun suspendComponent(resourceId: String, node: Resource)
// fun suspendComponent(resourceId: String, node: Resource)
/**
......@@ -58,15 +58,15 @@ interface RPMApi {
*/
fun turnOn(nodeId: String)
/**
* turn off resource within node
*/
fun turnOffComponent(nodeId: String, resourceId: String)
// /**
// * turn off resource within node
// */
// fun turnOffComponent(nodeId: String, resourceId: String)
/**
* turn on resource within node
*/
fun turnOnComponent(nodeId: String, resourceId: String)
// /**
// * turn on resource within node
// */
// fun turnOnComponent(nodeId: String, resourceId: String)
fun setProperty(resourceId: String, propertyName: String, value: String, isSubcomponent: Boolean)
......
......@@ -221,10 +221,10 @@ class RECSApiImpl private constructor(parser: XStream = initXMLParser() ) : RECS
//println("load recs res")
Keys.RTM.recs_host_src_list.get().forEach { src ->
when (src) {
"LDAP" -> LDAPApi.instance().listRecsNodes("*").recsNodeMap.values.forEach {
res.add(it.ipHostNumber)
/*res.addNode(it)*/
}
// "LDAP" -> LDAPApi.instance().listRecsNodes("*").recsNodeMap.values.forEach {
// res.add(it.ipHostNumber)
// /*res.addNode(it)*/
// }
"CONFIG" -> {
Keys.RTM.recs_hosts.get().forEach {
res.add(it)
......
......@@ -158,7 +158,7 @@ class RECSMonitoringApi private constructor(/*storage: IStorage<String>? = null*
* @param typeId -> type name received via ssh api or "recsnode"
*/
fun getRecsResourceType(typeId: String = "recsnode"): ResourceType {
val type = ResourceType(typeId, Resource.Type.recs_node)
val type = ResourceType(typeId)//, Resource.Type.recs_node)
type.apiMap["current_power_usage"] = listOf(ApiDetails("current_power_usage", "actualPowerUsage", "current_power_usage", ManagementApi.recs))
type.apiMap["current_util"] = listOf(ApiDetails("current_util", "current_util", "current_util", ManagementApi.ssh))
type.apiMap["current_temperature"] = listOf(ApiDetails("current_temperature", "outletTemperature", "current_temperature", ManagementApi.recs))
......
......@@ -3,6 +3,7 @@ package psnc.m2dc.rtm.rpm.nativeapi
import com.google.gson.reflect.TypeToken
import org.slf4j.LoggerFactory
import psnc.m2dc.mock.rtm.rpm.SSHApiMock
import psnc.m2dc.rtm.model.rest.Values
import psnc.m2dc.rtm.model.rpm.Resource
import psnc.m2dc.rtm.model.rpm.SSHCommand
import psnc.m2dc.rtm.properties.RTMProperties
......@@ -154,7 +155,7 @@ open class SSHApiImpl private constructor(val resource: Resource) : SSHApi {
printConsole("get type for :${resource.id} ")
// val type = object : TypeToken<HashMap<String, String>>() {
// }.type
val type = runScript("resource_type")
val type = Values.typeName(runScript("resource_type"))
return mapOf("resource_type" to type)
// return RTMProperties.parseJson(runScript("resource_type"), type)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment