diff --git a/app/collins/controllers/actions/ipmi/GetPoolsAction.scala b/app/collins/controllers/actions/ipmi/GetPoolsAction.scala index 8aa2fffeb..26d76a02f 100644 --- a/app/collins/controllers/actions/ipmi/GetPoolsAction.scala +++ b/app/collins/controllers/actions/ipmi/GetPoolsAction.scala @@ -26,9 +26,9 @@ case class GetPoolsAction( override def validate(): Validation = { var pools: Set[String] = - IpmiInfo.AddressConfig.filter(_.poolNames.isEmpty) match { - case Set => IpmiInfo.AddressConfig.map(_.poolNames).getOrElse(Set("")) - case _ => Set(IpmiInfo.AddressConfig.flatMap(_.defaultPoolName).getOrElse("")) + IpmiInfo.AddressConfig.map(_.poolNames) match { + case x if !x.isEmpty => x.getOrElse(Set()) + case _ => Set(IpmiInfo.AddressConfig.flatMap(_.defaultPoolName).getOrElse("")) } Right(ActionDataHolder(pools)) diff --git a/conf/test_base.conf b/conf/test_base.conf index ba6aaaabe..2beec20c4 100644 --- a/conf/test_base.conf +++ b/conf/test_base.conf @@ -249,6 +249,11 @@ ipmi { gateway="172.16.32.1" startAddress="172.16.32.20" } + OOB-POD02 { + network="172.99.32.0/20" + gateway="172.99.32.1" + startAddress="172.99.32.20" + } } # to use with multiple OOB allocations, instead of the inline diff --git a/test/collins/controllers/IpmiApiSpec.scala b/test/collins/controllers/IpmiApiSpec.scala index a7c7954ee..2f9fa0376 100644 --- a/test/collins/controllers/IpmiApiSpec.scala +++ b/test/collins/controllers/IpmiApiSpec.scala @@ -13,7 +13,7 @@ class IpmiApiSpec extends mutable.Specification with ControllerSpec { args(sequential = true) "the REST API" should { - "Support getting ipmi pools" in new WithApplication with AssetApiHelper { + "Support getting multiple ipmi pools" in new WithApplication with AssetApiHelper { override val assetTag = "tumblrtag42" val getRequest = FakeRequest("GET", "/api/ipmi/pools") val getResult = Extract.from(api.getIpmiAddressPools.apply(getRequest)) @@ -24,6 +24,12 @@ class IpmiApiSpec extends mutable.Specification with ControllerSpec { s must /("data") */("POOLS") */ ("START_ADDRESS" -> "172.16.32.20") s must /("data") */("POOLS") */ ("BROADCAST" -> "172.16.47.255") s must /("data") */("POOLS") */ ("POSSIBLE_ADDRESSES" -> 4094) + + s must /("data") */("POOLS") */ ("NAME" -> "OOB-POD02") + s must /("data") */("POOLS") */ ("GATEWAY" -> "172.99.32.1") + s must /("data") */("POOLS") */ ("START_ADDRESS" -> "172.99.32.20") + s must /("data") */("POOLS") */ ("BROADCAST" -> "172.99.47.255") + s must /("data") */("POOLS") */ ("POSSIBLE_ADDRESSES" -> 4094) } } }