mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-26 14:55:09 +00:00
WIFI-900: add global property for toggling mutation of clientCn handle mqttSettings clientCn in AWLAN_Node
This commit is contained in:
@@ -104,6 +104,7 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
|||||||
|
|
||||||
// successfully connected - register it in our
|
// successfully connected - register it in our
|
||||||
// connectedClients table
|
// connectedClients table
|
||||||
|
|
||||||
String key = alterClientCnIfRequired(clientCn, connectNodeInfo);
|
String key = alterClientCnIfRequired(clientCn, connectNodeInfo);
|
||||||
ovsdbSessionMapInterface.newSession(key, ovsdbClient);
|
ovsdbSessionMapInterface.newSession(key, ovsdbClient);
|
||||||
|
|
||||||
@@ -184,7 +185,8 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
|||||||
ConnectNodeInfo connectNodeInfo) {
|
ConnectNodeInfo connectNodeInfo) {
|
||||||
|
|
||||||
LOG.debug("Starting Client connect");
|
LOG.debug("Starting Client connect");
|
||||||
connectNodeInfo = ovsdbDao.updateConnectNodeInfoOnConnect(ovsdbClient, clientCn, connectNodeInfo);
|
connectNodeInfo = ovsdbDao.updateConnectNodeInfoOnConnect(ovsdbClient, clientCn, connectNodeInfo,
|
||||||
|
preventClientCnAlteration);
|
||||||
|
|
||||||
// successfully connected - register it in our
|
// successfully connected - register it in our
|
||||||
// connectedClients table
|
// connectedClients table
|
||||||
@@ -868,7 +870,8 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
|||||||
LOG.debug("TipWlanOvsdbClient::processNewChannelsRequest change backup channels for AP {}", apId);
|
LOG.debug("TipWlanOvsdbClient::processNewChannelsRequest change backup channels for AP {}", apId);
|
||||||
return "Triggered a factory reset of AP " + apId;
|
return "Triggered a factory reset of AP " + apId;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("TipWlanOvsdbClient::processNewChannelsRequest failed to change backup channels for AP {}", apId, e);
|
LOG.error("TipWlanOvsdbClient::processNewChannelsRequest failed to change backup channels for AP {}", apId,
|
||||||
|
e);
|
||||||
return " failed to change backup channels for AP " + apId;
|
return " failed to change backup channels for AP " + apId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -539,7 +539,7 @@ public class OvsdbDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ConnectNodeInfo updateConnectNodeInfoOnConnect(OvsdbClient ovsdbClient, String clientCn,
|
public ConnectNodeInfo updateConnectNodeInfoOnConnect(OvsdbClient ovsdbClient, String clientCn,
|
||||||
ConnectNodeInfo incomingConnectNodeInfo) {
|
ConnectNodeInfo incomingConnectNodeInfo, boolean preventCnAlteration) {
|
||||||
ConnectNodeInfo ret = incomingConnectNodeInfo.clone();
|
ConnectNodeInfo ret = incomingConnectNodeInfo.clone();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -560,7 +560,8 @@ public class OvsdbDao {
|
|||||||
// mqtt_settings:ins:'["map",[["broker","testportal.123wlan.com"],["topics","/ap/dev-ap-0300/opensync"],["qos","0"],["port","1883"],["remote_log","1"]]]'
|
// mqtt_settings:ins:'["map",[["broker","testportal.123wlan.com"],["topics","/ap/dev-ap-0300/opensync"],["qos","0"],["port","1883"],["remote_log","1"]]]'
|
||||||
Map<String, String> newMqttSettings = new HashMap<>();
|
Map<String, String> newMqttSettings = new HashMap<>();
|
||||||
newMqttSettings.put("broker", mqttBrokerAddress);
|
newMqttSettings.put("broker", mqttBrokerAddress);
|
||||||
newMqttSettings.put("topics", "/ap/" + clientCn + "/opensync");
|
String mqttClientName = OvsdbToWlanCloudTypeMappingUtility.getAlteredClientCnIfRequired(clientCn, incomingConnectNodeInfo, preventCnAlteration);
|
||||||
|
newMqttSettings.put("topics", "/ap/" + mqttClientName + "/opensync");
|
||||||
newMqttSettings.put("port", "" + mqttBrokerListenPort);
|
newMqttSettings.put("port", "" + mqttBrokerListenPort);
|
||||||
newMqttSettings.put("compress", "zlib");
|
newMqttSettings.put("compress", "zlib");
|
||||||
newMqttSettings.put("qos", "0");
|
newMqttSettings.put("qos", "0");
|
||||||
@@ -803,7 +804,7 @@ public class OvsdbDao {
|
|||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T getSingleValueFromSet(Row row, String columnName) {
|
public static <T> T getSingleValueFromSet(Row row, String columnName) {
|
||||||
|
|
||||||
Set<T> set = row != null ? row.getSetColumn(columnName) : null;
|
Set<T> set = row != null ? row.getSetColumn(columnName) : null;
|
||||||
T ret = (set != null) && !set.isEmpty() ? set.iterator().next() : null;
|
T ret = (set != null) && !set.isEmpty() ? set.iterator().next() : null;
|
||||||
@@ -2596,8 +2597,9 @@ public class OvsdbDao {
|
|||||||
String vlanIfName = bridge + vlanId;
|
String vlanIfName = bridge + vlanId;
|
||||||
if (!wifiInetConfigInfoMap.containsKey(vlanIfName)) {
|
if (!wifiInetConfigInfoMap.containsKey(vlanIfName)) {
|
||||||
// we need to make a VLAN, before we do anything else
|
// we need to make a VLAN, before we do anything else
|
||||||
createInetConfigForVlan(ovsdbClient, bridge, (networkForwardMode == NetworkForwardMode.NAT),
|
boolean isNAT = wifiInetConfigInfoMap.get(bridge).nat;
|
||||||
vlanIfName, vlanId, gateway, inet, ipAssignScheme, dns);
|
createInetConfigForVlan(ovsdbClient, bridge, isNAT, vlanIfName, vlanId, gateway, inet,
|
||||||
|
ipAssignScheme, dns);
|
||||||
}
|
}
|
||||||
|
|
||||||
bridge = vlanIfName;
|
bridge = vlanIfName;
|
||||||
@@ -2718,15 +2720,15 @@ public class OvsdbDao {
|
|||||||
updateVifConfigsSetForRadio(ovsdbClient, ssid, radioFreqBand, operations, updateColumns, vifConfigUuid);
|
updateVifConfigsSetForRadio(ovsdbClient, ssid, radioFreqBand, operations, updateColumns, vifConfigUuid);
|
||||||
|
|
||||||
Map<String, WifiInetConfigInfo> inetConfigs = getProvisionedWifiInetConfigs(ovsdbClient);
|
Map<String, WifiInetConfigInfo> inetConfigs = getProvisionedWifiInetConfigs(ovsdbClient);
|
||||||
|
boolean isNAT = inetConfigs.get(bridge).nat;
|
||||||
|
|
||||||
if (inetConfigs.containsKey(ifName)) {
|
if (inetConfigs.containsKey(ifName)) {
|
||||||
updateWifiInetConfig(ovsdbClient, vlanId, ifName, enabled, networkForwardMode == NetworkForwardMode.NAT,
|
updateWifiInetConfig(ovsdbClient, vlanId, ifName, enabled, isNAT, "vif", bridge, gateway, inet, dns,
|
||||||
"vif", gateway, inet, dns, ipAssignScheme, vifConfigUuid);
|
ipAssignScheme, vifConfigUuid);
|
||||||
} else {
|
} else {
|
||||||
LOG.debug("No corresponding WifiInetConfig for this Interface");
|
LOG.debug("No corresponding WifiInetConfig for this Interface");
|
||||||
insertWifiInetConfigForVif(ovsdbClient, vlanId, ifName, enabled,
|
insertWifiInetConfigForVif(ovsdbClient, vlanId, ifName, enabled, isNAT, "vif", bridge, gateway, inet,
|
||||||
networkForwardMode == NetworkForwardMode.NAT, "vif", gateway, inet, dns, ipAssignScheme,
|
dns, ipAssignScheme, vifConfigUuid);
|
||||||
vifConfigUuid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.info("Provisioned SSID {} on interface {} / {}", ssid, ifName, radioFreqBand);
|
LOG.info("Provisioned SSID {} on interface {} / {}", ssid, ifName, radioFreqBand);
|
||||||
@@ -3320,7 +3322,7 @@ public class OvsdbDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateWifiInetConfig(OvsdbClient ovsdbClient, int vlanId, String ifName, boolean enabled,
|
private void updateWifiInetConfig(OvsdbClient ovsdbClient, int vlanId, String ifName, boolean enabled,
|
||||||
boolean isNAT, String ifType, String gateway, String inet, Map<String, String> dns, String ipAssignScheme,
|
boolean isNAT, String ifType, String gateway, String inet, String parentIfName, Map<String, String> dns, String ipAssignScheme,
|
||||||
Uuid vifConfigUuid) {
|
Uuid vifConfigUuid) {
|
||||||
|
|
||||||
List<Operation> operations = new ArrayList<>();
|
List<Operation> operations = new ArrayList<>();
|
||||||
@@ -3329,31 +3331,34 @@ public class OvsdbDao {
|
|||||||
conditions.add(new Condition("if_name", Function.EQUALS, new Atom<>(ifName)));
|
conditions.add(new Condition("if_name", Function.EQUALS, new Atom<>(ifName)));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// /usr/plume/tools/ovsh i Wifi_Inet_Config NAT:=false enabled:=true if_name:=home-ap-24 if_type:=vif ip_assign_scheme:=none network:=true
|
||||||
|
|
||||||
|
|
||||||
/// usr/plume/tools/ovsh i Wifi_Inet_Config NAT:=false enabled:=true
|
/// usr/plume/tools/ovsh i Wifi_Inet_Config NAT:=false enabled:=true
|
||||||
/// if_name:=home-ap-24 if_type:=vif ip_assign_scheme:=none
|
/// if_name:=home-ap-24 if_type:=vif ip_assign_scheme:=none
|
||||||
/// network:=true
|
/// network:=true
|
||||||
// dhcpd
|
// dhcpd
|
||||||
updateColumns.put("if_name", new Atom<>(ifName));
|
updateColumns.put("if_name", new Atom<>(ifName));
|
||||||
updateColumns.put("if_type", new Atom<>(ifType));
|
updateColumns.put("if_type", new Atom<>(ifType));
|
||||||
updateColumns.put("if_uuid", new Atom<>(vifConfigUuid.toString()));
|
// updateColumns.put("if_uuid", new Atom<>(vifConfigUuid.toString()));
|
||||||
updateColumns.put("enabled", new Atom<>(enabled));
|
updateColumns.put("enabled", new Atom<>(enabled));
|
||||||
updateColumns.put("NAT", new Atom<>(isNAT));
|
updateColumns.put("NAT", new Atom<>(isNAT));
|
||||||
|
// updateColumns.put("parent_ifname", new Atom<>(parentIfName));
|
||||||
// mtu // specified in interface, should take that value when
|
// mtu // specified in interface, should take that value when
|
||||||
// implemented
|
// implemented
|
||||||
updateColumns.put("mtu", new Atom<>(1500));
|
// updateColumns.put("mtu", new Atom<>(1500));
|
||||||
updateColumns.put("network", new Atom<>(true));
|
updateColumns.put("network", new Atom<>(true));
|
||||||
|
|
||||||
updateColumns.put("ip_assign_scheme", new Atom<>(ipAssignScheme));
|
updateColumns.put("ip_assign_scheme", new Atom<>("none"));
|
||||||
updateColumns.put("dhcp_sniff", new Atom<>(true));
|
// updateColumns.put("dhcp_sniff", new Atom<>(true));
|
||||||
|
|
||||||
if (ipAssignScheme.equals("static")) {
|
// if (ipAssignScheme.equals("static")) {
|
||||||
updateColumns.put("dns", com.vmware.ovsdb.protocol.operation.notation.Map.of(dns));
|
// updateColumns.put("dns", com.vmware.ovsdb.protocol.operation.notation.Map.of(dns));
|
||||||
updateColumns.put("inet_addr", new Atom<>(inet));
|
// updateColumns.put("inet_addr", new Atom<>(inet));
|
||||||
updateColumns.put("gateway", new Atom<>(gateway));
|
// updateColumns.put("gateway", new Atom<>(gateway));
|
||||||
// netmask
|
// // netmask
|
||||||
// broadcast
|
// // broadcast
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
Row row = new Row(updateColumns);
|
Row row = new Row(updateColumns);
|
||||||
@@ -3376,7 +3381,7 @@ public class OvsdbDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void insertWifiInetConfigForVif(OvsdbClient ovsdbClient, int vlanId, String ifName, boolean enabled,
|
private void insertWifiInetConfigForVif(OvsdbClient ovsdbClient, int vlanId, String ifName, boolean enabled,
|
||||||
boolean isNAT, String ifType, String gateway, String inet, Map<String, String> dns, String ipAssignScheme,
|
boolean isNAT, String ifType, String gateway, String inet, String parentIfName, Map<String, String> dns, String ipAssignScheme,
|
||||||
Uuid vifConfigUuid) {
|
Uuid vifConfigUuid) {
|
||||||
|
|
||||||
List<Operation> operations = new ArrayList<>();
|
List<Operation> operations = new ArrayList<>();
|
||||||
@@ -3389,27 +3394,28 @@ public class OvsdbDao {
|
|||||||
// dhcpd
|
// dhcpd
|
||||||
insertColumns.put("if_name", new Atom<>(ifName));
|
insertColumns.put("if_name", new Atom<>(ifName));
|
||||||
insertColumns.put("if_type", new Atom<>(ifType));
|
insertColumns.put("if_type", new Atom<>(ifType));
|
||||||
insertColumns.put("if_uuid", new Atom<>(vifConfigUuid.toString()));
|
// insertColumns.put("if_uuid", new Atom<>(vifConfigUuid.toString()));
|
||||||
insertColumns.put("enabled", new Atom<>(enabled));
|
insertColumns.put("enabled", new Atom<>(enabled));
|
||||||
insertColumns.put("NAT", new Atom<>(isNAT));
|
insertColumns.put("NAT", new Atom<>(isNAT));
|
||||||
|
// insertColumns.put("parent_ifname", new Atom<>(parentIfName));
|
||||||
|
|
||||||
// mtu // specified in interface, should take that value when
|
// mtu // specified in interface, should take that value when
|
||||||
// implemented
|
// implemented
|
||||||
insertColumns.put("mtu", new Atom<>(1500));
|
// insertColumns.put("mtu", new Atom<>(1500));
|
||||||
insertColumns.put("network", new Atom<>(true));
|
insertColumns.put("network", new Atom<>(true));
|
||||||
insertColumns.put("dhcp_sniff", new Atom<>(true));
|
// insertColumns.put("dhcp_sniff", new Atom<>(true));
|
||||||
|
|
||||||
insertColumns.put("ip_assign_scheme", new Atom<>(ipAssignScheme));
|
insertColumns.put("ip_assign_scheme", new Atom<>("none"));
|
||||||
|
|
||||||
if (ipAssignScheme.equals("static")) {
|
// if (ipAssignScheme.equals("static")) {
|
||||||
|
//
|
||||||
if (inet != null) {
|
// if (inet != null) {
|
||||||
insertColumns.put("inet_addr", new Atom<>(inet));
|
// insertColumns.put("inet_addr", new Atom<>(inet));
|
||||||
}
|
// }
|
||||||
insertColumns.put("netmask", new Atom<>("255.255.255.0"));
|
// insertColumns.put("netmask", new Atom<>("255.255.255.0"));
|
||||||
// netmask
|
// // netmask
|
||||||
// broadcast
|
// // broadcast
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
Row row = new Row(insertColumns);
|
Row row = new Row(insertColumns);
|
||||||
@@ -4145,10 +4151,9 @@ public class OvsdbDao {
|
|||||||
provisionWifiStatsConfigFromProfile("client", radioType, reportingInterval,
|
provisionWifiStatsConfigFromProfile("client", radioType, reportingInterval,
|
||||||
samplingInterval, operations);
|
samplingInterval, operations);
|
||||||
|
|
||||||
// TODO: add when schema supports
|
provisionWifiStatsConfigFromProfile("event",
|
||||||
// provisionWifiStatsConfigFromProfile("event",
|
reportingInterval,
|
||||||
// reportingInterval,
|
samplingInterval, operations);
|
||||||
// samplingInterval, operations);
|
|
||||||
|
|
||||||
provisionWifiStatsConfigFromProfile("video_voice", reportingInterval, samplingInterval,
|
provisionWifiStatsConfigFromProfile("video_voice", reportingInterval, samplingInterval,
|
||||||
operations);
|
operations);
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
package com.telecominfraproject.wlan.opensync.ovsdb.dao.utilities;
|
package com.telecominfraproject.wlan.opensync.ovsdb.dao.utilities;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import com.telecominfraproject.wlan.client.models.ClientType;
|
import com.telecominfraproject.wlan.client.models.ClientType;
|
||||||
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
||||||
import com.telecominfraproject.wlan.core.model.equipment.SecurityType;
|
import com.telecominfraproject.wlan.core.model.equipment.SecurityType;
|
||||||
|
import com.telecominfraproject.wlan.opensync.external.integration.models.ConnectNodeInfo;
|
||||||
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.enumerations.DhcpFpDeviceType;
|
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.enumerations.DhcpFpDeviceType;
|
||||||
import com.telecominfraproject.wlan.profile.metrics.ChannelUtilizationSurveyType;
|
import com.telecominfraproject.wlan.profile.metrics.ChannelUtilizationSurveyType;
|
||||||
import com.telecominfraproject.wlan.servicemetric.apnode.models.StateUpDownError;
|
import com.telecominfraproject.wlan.servicemetric.apnode.models.StateUpDownError;
|
||||||
@@ -305,4 +303,22 @@ public class OvsdbToWlanCloudTypeMappingUtility {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getAlteredClientCnIfRequired(String clientCn, ConnectNodeInfo connectNodeInfo, boolean preventClientCnAlteration) {
|
||||||
|
String key;
|
||||||
|
// can clientCn be altered
|
||||||
|
if (preventClientCnAlteration) {
|
||||||
|
key = clientCn;
|
||||||
|
} else {
|
||||||
|
// does clientCn already end with the AP serial number, if so, use
|
||||||
|
// this
|
||||||
|
if (clientCn.endsWith("_" + connectNodeInfo.serialNumber)) {
|
||||||
|
key = clientCn;
|
||||||
|
} else {
|
||||||
|
// append the serial number
|
||||||
|
key = clientCn + "_" + connectNodeInfo.serialNumber;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user