3 Commits

Author SHA1 Message Date
TIP Automation User
d09e399d09 Chg: update image tag in helm values to v2.7.0 2022-10-05 11:33:13 +00:00
TIP Automation User
a25b28e7a7 Chg: update image tag in helm values to v2.7.0-RC3 2022-10-01 00:58:23 +00:00
RockyMandayam2
c3b51aeafd [WIFI-10943] Deal with "auto" value for channel and fix 80p80 representation (#92) (#93)
Co-authored-by: Jun Woo Shin <jwoos@users.noreply.github.com>
2022-09-30 18:23:26 -04:00
4 changed files with 84 additions and 7 deletions

View File

@@ -9,7 +9,7 @@ fullnameOverride: ""
images:
owrrm:
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owrrm
tag: v2.7.0-RC2
tag: v2.7.0
pullPolicy: Always
# regcred:
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io

View File

@@ -234,8 +234,9 @@ public abstract class ChannelOptimizer {
// the difference of 8 means it is consecutive
int channelDiff =
Math.abs(vhtOperObj.channel1 - vhtOperObj.channel2);
// the "8080" below does not mean 8080 MHz wide, it refers to 80+80 MHz channel
return channelDiff == 8 ? 160 : 8080;
// TODO it will currently return just 80 for 80p80 - it should be dealt
// with properly.
return channelDiff == 8 ? 160 : 80;
} else {
return MIN_CHANNEL_WIDTH;
}

View File

@@ -130,9 +130,24 @@ public class UCentralUtils {
continue;
}
// Compare vs. existing value
int currentValue = radioConfig.get(fieldName).getAsInt();
if (currentValue == newValue) {
// Compare vs. existing value.
// not all values are int so override those values
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(
"Device {}: {} {} is already {}",
serialNumber,
@@ -150,7 +165,7 @@ public class UCentralUtils {
operationalBand,
fieldName,
newValue,
currentValue
currentValue != null ? currentValue : fieldValue.toString()
);
wasModified = true;
}

View File

@@ -8,7 +8,12 @@
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.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import org.junit.jupiter.api.Test;
@@ -17,4 +22,60 @@ public class UCentralUtilsTest {
void test_placeholder() throws Exception {
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
);
}
}