From 30a28b2a11c223b36e697857da90c28c4ad2bf26 Mon Sep 17 00:00:00 2001 From: Mike Hansen Date: Tue, 28 Jul 2020 16:01:43 -0400 Subject: [PATCH] Revert back to using VIF if mapping based on radio band vs radio number until AP changes to support otherwise are present --- ...yncProcess (local, KDC certs) cloud.launch | 2 +- .../app/run.sh | 21 +-- .../src/main/docker/app/run.sh | 7 +- ...ncProcess (local, KDC certs) static.launch | 2 +- .../opensync/ovsdb/TipWlanOvsdbClient.java | 4 +- .../wlan/opensync/ovsdb/dao/OvsdbDao.java | 129 +++++++----------- 6 files changed, 68 insertions(+), 97 deletions(-) diff --git a/opensync-gateway-cloud-process/src/main/resources/launchers/OpenSyncProcess (local, KDC certs) cloud.launch b/opensync-gateway-cloud-process/src/main/resources/launchers/OpenSyncProcess (local, KDC certs) cloud.launch index 8f829ff..be3ee28 100644 --- a/opensync-gateway-cloud-process/src/main/resources/launchers/OpenSyncProcess (local, KDC certs) cloud.launch +++ b/opensync-gateway-cloud-process/src/main/resources/launchers/OpenSyncProcess (local, KDC certs) cloud.launch @@ -21,5 +21,5 @@ - + diff --git a/opensync-gateway-static-docker/src/main/docker-opensync-gateway-and-mqtt/app/run.sh b/opensync-gateway-static-docker/src/main/docker-opensync-gateway-and-mqtt/app/run.sh index 1f4944c..6b163c1 100755 --- a/opensync-gateway-static-docker/src/main/docker-opensync-gateway-and-mqtt/app/run.sh +++ b/opensync-gateway-static-docker/src/main/docker-opensync-gateway-and-mqtt/app/run.sh @@ -39,12 +39,14 @@ OVSDB_RADIUSPROFILE_CONFIG_FILE="${OVSDB_RADIUSPROFILE_CONFIG_FILE:=/app/opensyn OVSDB_IF_DEFAULT_BRIDGE="${OVSDB_IF_DEFAULT_BRIDGE:=br-home}" echo $OVSDB_IF_DEFAULT_BRIDGE -OVSDB_IF_DEFAULT_RADIO_0="${OVSDB_IF_DEFAULT_RADIO_0:=home-ap-24}" -echo $OVSDB_IF_DEFAULT_RADIO_0 -OVSDB_IF_DEFAULT_RADIO_1="${OVSDB_IF_DEFAULT_RADIO_1:=home-ap-l50}" -echo $OVSDB_IF_DEFAULT_RADIO_1 -OVSDB_IF_DEFAULT_RADIO_2="${OVSDB_IF_DEFAULT_RADIO_2:=home-ap-u50}" -echo $OVSDB_IF_DEFAULT_RADIO_2 +OVSDB_IF_DEFAULT_RADIO_2G="${OVSDB_IF_DEFAULT_RADIO_2G:=home-ap-24}" +echo $OVSDB_IF_DEFAULT_RADIO_2G +OVSDB_IF_DEFAULT_RADIO_5GL="${OVSDB_IF_DEFAULT_RADIO_5GL:=home-ap-l50}" +echo $OVSDB_IF_DEFAULT_RADIO_5GL +OVSDB_IF_DEFAULT_RADIO_5GU="${OVSDB_IF_DEFAULT_RADIO_5GU:=home-ap-u50}" +echo $OVSDB_IF_DEFAULT_RADIO_5GU +OVSDB_IF_DEFAULT_RADIO_5G="${OVSDB_IF_DEFAULT_RADIO_5GU:=home-ap-50}" +echo $OVSDB_IF_DEFAULT_RADIO_5G OVSDB_DEVICE_DEFAULT_WAN_TYPE="${OVSDB_DEVICE_DEFAULT_WAN_TYPE:=eth}" echo $OVSDB_DEVICE_DEFAULT_WAN_TYPE OVSDB_DEVICE_DEFAULT_WAN_NAME="${OVSDB_DEVICE_DEFAULT_WAN_NAME:=eth1}" @@ -136,9 +138,10 @@ OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_wan_type=$OVSDB_DE OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_wan_name=$OVSDB_DEVICE_DEFAULT_WAN_NAME" OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_lan_type=$OVSDB_DEVICE_DEFAULT_LAN_TYPE" OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_lan_name=$OVSDB_DEVICE_DEFAULT_LAN_NAME" -OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_radio0=$OVSDB_IF_DEFAULT_RADIO_0" -OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_radio1=$OVSDB_IF_DEFAULT_RADIO_1" -OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_radio2=$OVSDB_IF_DEFAULT_RADIO_2" +OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_radio2g=$OVSDB_IF_DEFAULT_RADIO_2G" +OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_radio5gl=$OVSDB_IF_DEFAULT_RADIO_5GL" +OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_radio5gu=$OVSDB_IF_DEFAULT_RADIO_5GU" +OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_radio5g=$OVSDB_IF_DEFAULT_RADIO_5G" echo OVSDB_PROPS $OVSDB_PROPS diff --git a/opensync-gateway-static-docker/src/main/docker/app/run.sh b/opensync-gateway-static-docker/src/main/docker/app/run.sh index 9845bca..48bce17 100755 --- a/opensync-gateway-static-docker/src/main/docker/app/run.sh +++ b/opensync-gateway-static-docker/src/main/docker/app/run.sh @@ -29,9 +29,10 @@ OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-iface.default_wan_type=$OVSDB_DEVICE_DEFAUL OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-iface.default_wan_name=$OVSDB_DEVICE_DEFAULT_WAN_NAME" OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-iface.default_lan_type=$OVSDB_DEVICE_DEFAULT_LAN_TYPE" OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-iface.default_lan_name=$OVSDB_DEVICE_DEFAULT_LAN_NAME" -OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-iface.default_radio0=$OVSDB_IF_DEFAULT_RADIO_0" -OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-iface.default_radio1=$OVSDB_IF_DEFAULT_RADIO_1" -OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-iface.default_radio2=$OVSDB_IF_DEFAULT_RADIO_2" +OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-iface.default_radio2g=$OVSDB_IF_DEFAULT_RADIO_2G" +OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-iface.default_radio5gl=$OVSDB_IF_DEFAULT_RADIO_5GL" +OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-iface.default_radio5gu=$OVSDB_IF_DEFAULT_RADIO_5GU" +OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-iface.default_radio5g=$OVSDB_IF_DEFAULT_RADIO_5G" echo OVSDB_PROPS $OVSDB_PROPS diff --git a/opensync-gateway-static-process/src/main/resources/launchers/OpenSyncProcess (local, KDC certs) static.launch b/opensync-gateway-static-process/src/main/resources/launchers/OpenSyncProcess (local, KDC certs) static.launch index a2a63e3..df2c465 100644 --- a/opensync-gateway-static-process/src/main/resources/launchers/OpenSyncProcess (local, KDC certs) static.launch +++ b/opensync-gateway-static-process/src/main/resources/launchers/OpenSyncProcess (local, KDC certs) static.launch @@ -14,5 +14,5 @@ - + diff --git a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/TipWlanOvsdbClient.java b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/TipWlanOvsdbClient.java index c5bd47c..d55c694 100644 --- a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/TipWlanOvsdbClient.java +++ b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/TipWlanOvsdbClient.java @@ -565,9 +565,7 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface { }); - List vifStates = ovsdbDao.getOpensyncAPVIFState(vsCf.join(), key, ovsdbClient); - LOG.info("Calling wifiVIFStateDbTableUpdate init for {}, {}", vifStates, key); - extIntegrationInterface.wifiVIFStateDbTableUpdate(vifStates, key); + extIntegrationInterface.wifiVIFStateDbTableUpdate(ovsdbDao.getOpensyncAPVIFState(vsCf.join(), key, ovsdbClient), key); } diff --git a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDao.java b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDao.java index 8b8521e..9441005 100644 --- a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDao.java +++ b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDao.java @@ -108,18 +108,20 @@ public class OvsdbDao { public String defaultLanInterfaceType; @org.springframework.beans.factory.annotation.Value("${tip.wlan.ovsdb.wifi-iface.default_lan_type:lan}") public String defaultLanInterfaceName; - + @org.springframework.beans.factory.annotation.Value("${tip.wlan.ovsdb.wifi-iface.default_wan_type:eth}") public String defaultWanInterfaceType; @org.springframework.beans.factory.annotation.Value("${tip.wlan.ovsdb.wifi-iface.default_wan_name:eth1}") public String defaultWanInterfaceName; - - @org.springframework.beans.factory.annotation.Value("${tip.wlan.ovsdb.wifi-iface.default_radio0:home-ap-24}") - public String defaultRadio0; - @org.springframework.beans.factory.annotation.Value("${tip.wlan.ovsdb.wifi-iface.default_radio1:home-ap-l50}") - public String defaultRadio1; - @org.springframework.beans.factory.annotation.Value("${tip.wlan.ovsdb.wifi-iface.default_radio2:home-ap-u50}") - public String defaultRadio2; + + @org.springframework.beans.factory.annotation.Value("${tip.wlan.ovsdb.wifi-iface.default_radio2g:home-ap-24}") + public String defaultRadio2g; + @org.springframework.beans.factory.annotation.Value("${tip.wlan.ovsdb.wifi-iface.default_radio5gl:home-ap-l50}") + public String defaultRadio5gl; + @org.springframework.beans.factory.annotation.Value("${tip.wlan.ovsdb.wifi-iface.default_radio5gu:home-ap-u50}") + public String defaultRadio5gu; + @org.springframework.beans.factory.annotation.Value("${tip.wlan.ovsdb.wifi-iface.default_radio5g:home-ap-50}") + public String defaultRadio5g; @org.springframework.beans.factory.annotation.Value("${tip.wlan.ovsdb.wifi-device.radio0:wifi0}") public String radio0; @@ -135,7 +137,7 @@ public class OvsdbDao { public long upgradeDlTimerSeconds; @org.springframework.beans.factory.annotation.Value("${tip.wlan.ovsdb.awlan-node.upgrade_timer:90}") public long upgradeTimerSeconds; - + @org.springframework.beans.factory.annotation.Value("${tip.wlan.fileStoreDirectory:/tmp/tip-wlan-filestore}") private String fileStoreDirectory; @org.springframework.beans.factory.annotation.Value("${tip.wlan.externalFileStoreURL:https://localhost:9096}") @@ -486,7 +488,7 @@ public class OvsdbDao { if ((ret.mqttSettings == null) || !ret.mqttSettings.equals(newMqttSettings)) { @SuppressWarnings("unchecked") com.vmware.ovsdb.protocol.operation.notation.Map mgttSettings = com.vmware.ovsdb.protocol.operation.notation.Map - .of(newMqttSettings); + .of(newMqttSettings); ret.mqttSettings = newMqttSettings; updateColumns.put("mqtt_settings", mgttSettings); } @@ -1140,7 +1142,7 @@ public class OvsdbDao { if (ftPsk != null) { wifiVifConfigInfo.ftPsk = ftPsk.intValue(); } - + Long ftMobilityDomain = getSingleValueFromSet(row, "ft_mobility_domain"); if (ftMobilityDomain != null) { wifiVifConfigInfo.ftMobilityDomain = ftMobilityDomain.intValue(); @@ -1358,7 +1360,7 @@ public class OvsdbDao { String interfaceType, Map interfaceOptions, Map provisionedInterfaces, Map provisionedPorts, Map provisionedBridges) - throws OvsdbClientException, TimeoutException, ExecutionException, InterruptedException { + throws OvsdbClientException, TimeoutException, ExecutionException, InterruptedException { LOG.debug("InterfaceName {} BridgeName {} InterfaceType {}", interfaceName, bridgeName, interfaceType); if (!provisionedInterfaces.containsKey(interfaceName)) { @@ -1380,7 +1382,7 @@ public class OvsdbDao { if (interfaceOptions != null) { @SuppressWarnings("unchecked") com.vmware.ovsdb.protocol.operation.notation.Map ifOptions = com.vmware.ovsdb.protocol.operation.notation.Map - .of(interfaceOptions); + .of(interfaceOptions); updateColumns.put("options", ifOptions); } @@ -1562,11 +1564,13 @@ public class OvsdbDao { provisionedInterfaces, provisionedPorts, provisionedBridges); provisionSingleBridgePortInterface(ovsdbClient, patchW2h, defaultWanInterfaceType, "patch", patchW2hOptions, provisionedInterfaces, provisionedPorts, provisionedBridges); - provisionSingleBridgePortInterface(ovsdbClient, defaultRadio0, bridgeNameVifInterfaces, "vif", null, + provisionSingleBridgePortInterface(ovsdbClient, defaultRadio2g, bridgeNameVifInterfaces, "vif", null, provisionedInterfaces, provisionedPorts, provisionedBridges); - provisionSingleBridgePortInterface(ovsdbClient, defaultRadio1, bridgeNameVifInterfaces, "vif", null, + provisionSingleBridgePortInterface(ovsdbClient, defaultRadio5gl, bridgeNameVifInterfaces, "vif", null, provisionedInterfaces, provisionedPorts, provisionedBridges); - provisionSingleBridgePortInterface(ovsdbClient, defaultRadio2, bridgeNameVifInterfaces, "vif", null, + provisionSingleBridgePortInterface(ovsdbClient, defaultRadio5gu, bridgeNameVifInterfaces, "vif", null, + provisionedInterfaces, provisionedPorts, provisionedBridges); + provisionSingleBridgePortInterface(ovsdbClient, defaultRadio5g, bridgeNameVifInterfaces, "vif", null, provisionedInterfaces, provisionedPorts, provisionedBridges); } catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { @@ -1653,9 +1657,9 @@ public class OvsdbDao { public void configureWifiRadios(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncAPConfig) { String country = opensyncAPConfig.getCountryCode(); // should be the - // same for all - // radios on this AP - // ;-) + // same for all + // radios on this AP + // ;-) ApElementConfiguration apElementConfiguration = (ApElementConfiguration) opensyncAPConfig.getCustomerEquipment() .getDetails(); @@ -2180,7 +2184,7 @@ public class OvsdbDao { public void configureWifiRadios(OvsdbClient ovsdbClient, String freqBand, int channel, Map hwConfig, String country, int beaconInterval, boolean enabled, String ht_mode, int txPower) - throws OvsdbClientException, TimeoutException, ExecutionException, InterruptedException { + throws OvsdbClientException, TimeoutException, ExecutionException, InterruptedException { List operations = new ArrayList<>(); Map updateColumns = new HashMap<>(); @@ -2191,7 +2195,7 @@ public class OvsdbDao { updateColumns.put("country", new Atom<>(country)); @SuppressWarnings("unchecked") com.vmware.ovsdb.protocol.operation.notation.Map hwConfigMap = com.vmware.ovsdb.protocol.operation.notation.Map - .of(hwConfig); + .of(hwConfig); updateColumns.put("hw_config", hwConfigMap); updateColumns.put("bcn_int", new Atom<>(beaconInterval)); updateColumns.put("enabled", new Atom<>(enabled)); @@ -2272,7 +2276,7 @@ public class OvsdbDao { @SuppressWarnings("unchecked") com.vmware.ovsdb.protocol.operation.notation.Map securityMap = com.vmware.ovsdb.protocol.operation.notation.Map - .of(security); + .of(security); updateColumns.put("security", securityMap); updateBlockList(updateColumns, macBlockList); @@ -2351,7 +2355,7 @@ public class OvsdbDao { Row row = new Row(updateColumns); List conditions = new ArrayList<>(); // No condition, - // apply all ssid + // apply all ssid operations.add(new Update(wifiVifConfigDbTable, conditions, row)); CompletableFuture fResult = ovsdbClient.transact(ovsdbName, operations); @@ -2371,7 +2375,7 @@ public class OvsdbDao { private void updateVifConfigsSetForRadio(OvsdbClient ovsdbClient, String ssid, String radioFreqBand, List operations, Map updateColumns, Uuid vifConfigUuid) - throws OvsdbClientException, InterruptedException, ExecutionException, TimeoutException { + throws OvsdbClientException, InterruptedException, ExecutionException, TimeoutException { Row row; CompletableFuture fResult; OperationResult[] result; @@ -2441,58 +2445,23 @@ public class OvsdbDao { ApElementConfiguration apElementConfig = (ApElementConfiguration) opensyncApConfig.getCustomerEquipment() .getDetails(); for (RadioType radioType : ssidConfig.getAppliedRadios()) { - // Still put profiles on disabled radios for now. - // - // if (!enabledRadiosFromAp.contains(radioType)) { - // // Not on this AP - // LOG.debug( - // "AP {} does not have a radio where frequency band is {}. - // Cannot provision this radio profile on AP.", - // opensyncApConfig.getCustomerEquipment().getInventoryId(), - // radioType); - // continue; - // } - - Map provisionedRadioConfigs = getProvisionedWifiRadioConfigs(ovsdbClient); String freqBand = null; String ifName = null; - String radioName = null; - for (Entry entry : provisionedRadioConfigs.entrySet()) { - if (radioType == RadioType.is2dot4GHz && entry.getValue().freqBand.equals("2.4G")) { - freqBand = "2.4G"; - radioName = entry.getKey(); - break; - } else if (radioType == RadioType.is5GHzL && entry.getValue().freqBand.equals("5GL")) { - freqBand = "5GL"; - radioName = entry.getKey(); - break; - } else if (radioType == RadioType.is5GHzU && entry.getValue().freqBand.equals("5GU")) { - freqBand = "5GU"; - radioName = entry.getKey(); - break; - } else if (radioType == RadioType.is5GHz && entry.getValue().freqBand.equals("5G")) { - freqBand = "5G"; - radioName = entry.getKey(); - break; - } - } - if (radioName == null || freqBand == null) { - LOG.debug("Cannot provision SSID with radio if_name {} and freqBand {}", radioName, freqBand); - continue; - } - if (radioName.equals(radio0)) { - ifName = defaultRadio0; - } else if (radioName.equals(radio1)) { - ifName = defaultRadio1; - } else if (radioName.equals(radio2)) { - ifName = defaultRadio2; - } - if (ifName == null) { - LOG.debug("Cannot provision SSID for radio {} freqBand {} with VIF if_name {}", radioName, freqBand, - ifName); - continue; + if (radioType == RadioType.is2dot4GHz) { + freqBand = "2.4G"; + ifName = defaultRadio2g; + } else if (radioType == RadioType.is5GHzL) { + freqBand = "5GL"; + ifName = defaultRadio5gl; + } else if (radioType == RadioType.is5GHzU) { + freqBand = "5GU"; + ifName = defaultRadio5gu; + } else if (radioType == RadioType.is5GHz) { + freqBand = "5G"; + ifName = defaultRadio5g; } + int keyRefresh = ssidConfig.getKeyRefresh(); boolean ssidBroadcast = ssidConfig.getBroadcastSsid() == StateSetting.enabled; @@ -2598,7 +2567,7 @@ public class OvsdbDao { security.put("mode", "1"); } } - + // TODO put into AP captive parameter Map captiveMap = new HashMap<>(); List walledGardenAllowlist = new ArrayList<>(); @@ -2665,13 +2634,13 @@ public class OvsdbDao { } } } - + private void getCaptiveConfiguration(OpensyncAPConfig opensyncApConfig, SsidConfiguration ssidConfig, - Map captiveMap, List walledGardenAllowlist) { + Map captiveMap, List walledGardenAllowlist) { if (ssidConfig.getCaptivePortalId() != null && opensyncApConfig.getCaptiveProfiles() != null) { for (Profile profileCaptive : opensyncApConfig.getCaptiveProfiles()) { if (ssidConfig.getCaptivePortalId() == profileCaptive.getId() && - profileCaptive.getDetails() != null) { + profileCaptive.getDetails() != null) { CaptivePortalConfiguration captiveProfileDetails = ((CaptivePortalConfiguration) profileCaptive.getDetails()); captiveMap.put("sessionTimeoutInMinutes", String.valueOf(captiveProfileDetails.getSessionTimeoutInMinutes())); captiveMap.put("redirectURL", captiveProfileDetails.getRedirectURL()); @@ -2692,10 +2661,10 @@ public class OvsdbDao { } } } - + private String getCaptiveFileUrl(String fileDesc, ManagedFileInfo fileInfo) { if (fileInfo == null || fileInfo.getApExportUrl() == null) { - return ""; + return ""; } if (fileInfo.getApExportUrl().startsWith(HTTP)) { return fileInfo.getApExportUrl(); @@ -2705,7 +2674,7 @@ public class OvsdbDao { return ""; } LOG.debug("Captive file {}: {}", fileDesc, externalFileStoreURL + fileStoreDirectory + "/" + - fileInfo.getApExportUrl()); + fileInfo.getApExportUrl()); return externalFileStoreURL + fileStoreDirectory + "/" + fileInfo.getApExportUrl(); } @@ -2885,7 +2854,7 @@ public class OvsdbDao { @SuppressWarnings("unchecked") com.vmware.ovsdb.protocol.operation.notation.Map thresholds = com.vmware.ovsdb.protocol.operation.notation.Map - .of(thresholdMap); + .of(thresholdMap); Map radioConfigs = getProvisionedWifiRadioConfigs(ovsdbClient);