mirror of
https://github.com/Telecominfraproject/wlan-cloud-rrm.git
synced 2025-11-01 02:58:04 +00:00
Compare commits
3 Commits
v2.7.0-RC2
...
v2.7.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d09e399d09 | ||
|
|
a25b28e7a7 | ||
|
|
c3b51aeafd |
@@ -9,7 +9,7 @@ fullnameOverride: ""
|
|||||||
images:
|
images:
|
||||||
owrrm:
|
owrrm:
|
||||||
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owrrm
|
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owrrm
|
||||||
tag: v2.7.0-RC2
|
tag: v2.7.0
|
||||||
pullPolicy: Always
|
pullPolicy: Always
|
||||||
# regcred:
|
# regcred:
|
||||||
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io
|
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io
|
||||||
|
|||||||
@@ -234,8 +234,9 @@ public abstract class ChannelOptimizer {
|
|||||||
// the difference of 8 means it is consecutive
|
// the difference of 8 means it is consecutive
|
||||||
int channelDiff =
|
int channelDiff =
|
||||||
Math.abs(vhtOperObj.channel1 - vhtOperObj.channel2);
|
Math.abs(vhtOperObj.channel1 - vhtOperObj.channel2);
|
||||||
// the "8080" below does not mean 8080 MHz wide, it refers to 80+80 MHz channel
|
// TODO it will currently return just 80 for 80p80 - it should be dealt
|
||||||
return channelDiff == 8 ? 160 : 8080;
|
// with properly.
|
||||||
|
return channelDiff == 8 ? 160 : 80;
|
||||||
} else {
|
} else {
|
||||||
return MIN_CHANNEL_WIDTH;
|
return MIN_CHANNEL_WIDTH;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,9 +130,24 @@ public class UCentralUtils {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compare vs. existing value
|
// Compare vs. existing value.
|
||||||
int currentValue = radioConfig.get(fieldName).getAsInt();
|
// not all values are int so override those values
|
||||||
if (currentValue == newValue) {
|
Integer currentValue = null;
|
||||||
|
JsonElement fieldValue = radioConfig.get(fieldName);
|
||||||
|
if (
|
||||||
|
fieldValue.isJsonPrimitive() &&
|
||||||
|
fieldValue.getAsJsonPrimitive().isNumber()
|
||||||
|
) {
|
||||||
|
currentValue = fieldValue.getAsInt();
|
||||||
|
} else {
|
||||||
|
logger.debug(
|
||||||
|
"Unable to get field '{}' as int, value was {}",
|
||||||
|
fieldName,
|
||||||
|
fieldValue.toString()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentValue != null && currentValue == newValue) {
|
||||||
logger.info(
|
logger.info(
|
||||||
"Device {}: {} {} is already {}",
|
"Device {}: {} {} is already {}",
|
||||||
serialNumber,
|
serialNumber,
|
||||||
@@ -150,7 +165,7 @@ public class UCentralUtils {
|
|||||||
operationalBand,
|
operationalBand,
|
||||||
fieldName,
|
fieldName,
|
||||||
newValue,
|
newValue,
|
||||||
currentValue
|
currentValue != null ? currentValue : fieldValue.toString()
|
||||||
);
|
);
|
||||||
wasModified = true;
|
wasModified = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,12 @@
|
|||||||
|
|
||||||
package com.facebook.openwifirrm.ucentral;
|
package com.facebook.openwifirrm.ucentral;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
@@ -17,4 +22,60 @@ public class UCentralUtilsTest {
|
|||||||
void test_placeholder() throws Exception {
|
void test_placeholder() throws Exception {
|
||||||
assertEquals(3, 1 + 2);
|
assertEquals(3, 1 + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test_setRadioConfigFieldChannel() throws Exception {
|
||||||
|
final String serialNumber = "aaaaaaaaaaaa";
|
||||||
|
final int expectedChannel = 1;
|
||||||
|
final Map<String, Integer> newValueList = Collections
|
||||||
|
.singletonMap(UCentralConstants.BAND_5G, expectedChannel);
|
||||||
|
|
||||||
|
// test case where channel value is a string and not an integer
|
||||||
|
UCentralApConfiguration config = new UCentralApConfiguration(
|
||||||
|
"{\"interfaces\": [], \"radios\": [{\"band\": \"5G\", \"channel\": \"auto\"}]}"
|
||||||
|
);
|
||||||
|
boolean modified = UCentralUtils
|
||||||
|
.setRadioConfigField(serialNumber, config, "channel", newValueList);
|
||||||
|
assertTrue(modified);
|
||||||
|
assertEquals(
|
||||||
|
config.getRadioConfig(0).get("channel").getAsInt(),
|
||||||
|
expectedChannel
|
||||||
|
);
|
||||||
|
|
||||||
|
// field doesn't exist
|
||||||
|
config = new UCentralApConfiguration(
|
||||||
|
"{\"interfaces\": [], \"radios\": [{\"band\": \"5G\"}]}"
|
||||||
|
);
|
||||||
|
modified = UCentralUtils
|
||||||
|
.setRadioConfigField(serialNumber, config, "channel", newValueList);
|
||||||
|
assertTrue(modified);
|
||||||
|
assertEquals(
|
||||||
|
config.getRadioConfig(0).get("channel").getAsInt(),
|
||||||
|
expectedChannel
|
||||||
|
);
|
||||||
|
|
||||||
|
// normal field, not modified
|
||||||
|
config = new UCentralApConfiguration(
|
||||||
|
"{\"interfaces\": [], \"radios\": [{\"band\": \"5G\", \"channel\": 1}]}"
|
||||||
|
);
|
||||||
|
modified = UCentralUtils
|
||||||
|
.setRadioConfigField(serialNumber, config, "channel", newValueList);
|
||||||
|
assertFalse(modified);
|
||||||
|
assertEquals(
|
||||||
|
config.getRadioConfig(0).get("channel").getAsInt(),
|
||||||
|
expectedChannel
|
||||||
|
);
|
||||||
|
|
||||||
|
// normal field, modified
|
||||||
|
config = new UCentralApConfiguration(
|
||||||
|
"{\"interfaces\": [], \"radios\": [{\"band\": \"5G\", \"channel\": 15}]}"
|
||||||
|
);
|
||||||
|
modified = UCentralUtils
|
||||||
|
.setRadioConfigField(serialNumber, config, "channel", newValueList);
|
||||||
|
assertTrue(modified);
|
||||||
|
assertEquals(
|
||||||
|
config.getRadioConfig(0).get("channel").getAsInt(),
|
||||||
|
expectedChannel
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user