Opensync AP State Tables row parsing

This commit is contained in:
Mike Hansen
2020-04-23 19:57:59 -04:00
parent c8b9438d5f
commit 92fbec7d4a
3 changed files with 346 additions and 231 deletions

View File

@@ -17,7 +17,7 @@ public class OpensyncAWLANNode extends BaseJsonModel {
private static final long serialVersionUID = -6172956297643126710L; private static final long serialVersionUID = -6172956297643126710L;
public String mqttSettings; public Map<Object, Object> mqttSettings;
public String model; public String model;
public String skuNumber; public String skuNumber;
public String id; public String id;
@@ -43,12 +43,12 @@ public class OpensyncAWLANNode extends BaseJsonModel {
public Uuid _uuid; public Uuid _uuid;
public Uuid version; public Uuid version;
public String getMqttSettings() { public Map<Object, Object> getMqttSettings() {
return mqttSettings; return mqttSettings;
} }
public void setMqttSettings(String mqttSettings) { public void setMqttSettings(Map<Object, Object> map) {
this.mqttSettings = mqttSettings; this.mqttSettings = map;
} }
public String getModel() { public String getModel() {

View File

@@ -19,7 +19,7 @@ public class OpensyncWifiAssociatedClients extends BaseJsonModel {
public String keyId; public String keyId;
public String mac; public String mac;
public String state; public Boolean state;
public Set<String> capabilities; public Set<String> capabilities;
public int uapsd; public int uapsd;
public String kick; public String kick;
@@ -43,11 +43,11 @@ public class OpensyncWifiAssociatedClients extends BaseJsonModel {
this.mac = mac; this.mac = mac;
} }
public String getState() { public Boolean getState() {
return state; return state;
} }
public void setState(String state) { public void setState(Boolean state) {
this.state = state; this.state = state;
} }

View File

@@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@@ -22,8 +23,8 @@ import com.telecominfraproject.wlan.opensync.external.integration.models.Opensyn
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPRadioConfig; import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPRadioConfig;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPRadioState; import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPRadioState;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPSsidConfig; import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPSsidConfig;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAWLANNode;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPVIFState; import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPVIFState;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAWLANNode;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncWifiAssociatedClients; import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncWifiAssociatedClients;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.BridgeInfo; import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.BridgeInfo;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.InterfaceInfo; import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.InterfaceInfo;
@@ -1114,57 +1115,82 @@ public class OvsdbDao {
public List<OpensyncAPRadioState> getOpensyncAPRadioState(TableUpdates tableUpdates, String apId, public List<OpensyncAPRadioState> getOpensyncAPRadioState(TableUpdates tableUpdates, String apId,
OvsdbClient ovsdbClient) { OvsdbClient ovsdbClient) {
List<OpensyncAPRadioState> ret = new ArrayList<OpensyncAPRadioState>(); List<OpensyncAPRadioState> ret = new ArrayList<OpensyncAPRadioState>();
try { try {
tableUpdates.getTableUpdates().values().stream().forEach(tu -> {
tu.getRowUpdates().values().stream().forEach(ru -> {
Row row = ru.getNew(); for (Entry<String, TableUpdate> tableUpdate : tableUpdates.getTableUpdates().entrySet()) {
for (Entry<UUID, RowUpdate> rowUpdate : tableUpdate.getValue().getRowUpdates().entrySet()) {
Row row = rowUpdate.getValue().getNew();
// Row old = rowUpdate.getOld();
if (row != null) { if (row != null) {
OpensyncAPRadioState apRadioState = new OpensyncAPRadioState(); OpensyncAPRadioState tableState = new OpensyncAPRadioState();
String mac = getSingleValueFromSet(row, "mac"); Map<String, Value> map = row.getColumns();
if (mac != null)
apRadioState.setMac(mac); if (map.get("mac") != null && map.get("mac").getClass()
Long channelTmp = getSingleValueFromSet(row, "channel"); .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
if (channelTmp != null) tableState.setMac(row.getStringColumn("mac"));
apRadioState.setChannel(channelTmp.intValue()); }
String freq_band = getSingleValueFromSet(row, "freq_band"); if (map.get("channel") != null && map.get("channel").getClass()
if (freq_band != null) .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
apRadioState.setFreqBand(freq_band); tableState.setChannel(row.getIntegerColumn("channel").intValue());
String ifName = getSingleValueFromSet(row, "if_name"); }
if (ifName != null) if (map.get("freq_band") != null && map.get("freq_band").getClass()
apRadioState.setIfName(ifName); .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
String channelMode = getSingleValueFromSet(row, "channel_mode"); tableState.setFreqBand(row.getStringColumn("freq_band"));
if (channelMode != null) }
apRadioState.setChannelMode(channelMode); if (map.get("if_name") != null && map.get("if_name").getClass()
String country = getSingleValueFromSet(row, "country"); .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
if (country != null) tableState.setIfName(row.getStringColumn("if_name"));
apRadioState.setCountry(country); }
Boolean tmp = getSingleValueFromSet(row, "enabled"); if (map.get("channel_mode") != null && map.get("channel_mode").getClass()
if (tmp != null) .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
apRadioState.setEnabled(tmp); tableState.setChannelMode(row.getStringColumn("channel_mode"));
String htMode = getSingleValueFromSet(row, "ht_mode"); }
if (htMode != null) if (map.get("country") != null && map.get("country").getClass()
apRadioState.setHtMode(htMode); .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
Long txPower = getSingleValueFromSet(row, "tx_power"); tableState.setCountry(row.getStringColumn("country"));
if (txPower != null) }
apRadioState.setTxPower(txPower.intValue()); if (map.get("enabled") != null && map.get("enabled").getClass()
apRadioState.setHwConfig(row.getMapColumn("hw_config")); .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
Uuid version = getSingleValueFromSet(row, "_version"); tableState.setEnabled(row.getBooleanColumn("enabled"));
if (version != null) }
apRadioState.setVersion(version); if (map.get("ht_mode") != null && map.get("ht_mode").getClass()
Uuid uuid = getSingleValueFromSet(row, "_uuid"); .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
if (uuid != null) tableState.setHtMode(row.getStringColumn("ht_mode"));
apRadioState.set_uuid(uuid); }
ret.add(apRadioState); if (map.get("tx_power") != null && map.get("tx_power").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setTxPower(row.getIntegerColumn("tx_power").intValue());
}
if (map.get("hw_config") != null && map.get("hw_config").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Map.class)) {
tableState.setHwConfig(row.getMapColumn("hw_config"));
}
if (map.get("_version") != null && map.get("_version").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setVersion(row.getUuidColumn("_version"));
}
if (map.get("_uuid") != null && map.get("_uuid").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setVersion(row.getUuidColumn("_uuid"));
}
ret.add(tableState);
} }
}
}
}); ret.stream().forEach(wrs -> {
LOG.debug("Wifi_Radio_State row {}", wrs.toPrettyString());
}); });
} catch (Exception e) { } catch (Exception e) {
LOG.error("Could not parse update for Wifi_Radio_State", e); LOG.error("Could not parse update for Wifi_Radio_State", e);
} }
@@ -1177,48 +1203,65 @@ public class OvsdbDao {
List<OpensyncAPInetState> ret = new ArrayList<OpensyncAPInetState>(); List<OpensyncAPInetState> ret = new ArrayList<OpensyncAPInetState>();
try { try {
tableUpdates.getTableUpdates().values().stream().forEach(tu -> {
tu.getRowUpdates().values().stream().forEach(ru -> {
Row row = ru.getNew(); for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) {
for (RowUpdate rowUpdate : tableUpdate.getRowUpdates().values()) {
Row row = rowUpdate.getNew();
// Row old = rowUpdate.getOld();
if (row != null) { if (row != null) {
OpensyncAPInetState apInetState = new OpensyncAPInetState(); OpensyncAPInetState tableState = new OpensyncAPInetState();
Map<String, Value> map = row.getColumns();
Boolean natTmp = getSingleValueFromSet(row, "NAT"); if (map.get("NAT") != null && map.get("NAT").getClass()
if (natTmp != null) .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
apInetState.setNat(natTmp); tableState.setNat(row.getBooleanColumn("NAT"));
Boolean enabled = getSingleValueFromSet(row, "enabled"); }
if (enabled != null) if (map.get("enabled") != null && map.get("enabled").getClass()
apInetState.setEnabled(enabled); .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
String ifName = getSingleValueFromSet(row, "if_name"); tableState.setEnabled(row.getBooleanColumn("enabled"));
if (ifName != null) }
apInetState.setIfName(ifName); if (map.get("if_name") != null && map.get("if_name").getClass()
String ifType = getSingleValueFromSet(row, "if_type"); .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
if (ifType != null) tableState.setIfName(row.getStringColumn("if_name"));
apInetState.setIfType(ifType); }
String ipScheme = getSingleValueFromSet(row, "ip_assign_scheme"); if (map.get("if_type") != null && map.get("if_type").getClass()
if (ipScheme != null) .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
apInetState.setIpAssignScheme(ipScheme); tableState.setIfType(row.getStringColumn("if_type"));
Boolean network = getSingleValueFromSet(row, "network"); }
if (network != null) if (map.get("ip_assign_scheme") != null && map.get("ip_assign_scheme").getClass()
apInetState.setNetwork(network); .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
String hwAddr = getSingleValueFromSet(row, "hwaddr"); tableState.setIpAssignScheme(row.getStringColumn("ip_assign_scheme"));
if (hwAddr != null) }
apInetState.setHwAddr(hwAddr); if (map.get("network") != null && map.get("network").getClass()
Uuid version = getSingleValueFromSet(row, "_version"); .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
if (version != null) tableState.setNetwork(row.getBooleanColumn("network"));
apInetState.setVersion(version); }
Uuid uuid = getSingleValueFromSet(row, "_uuid"); if (map.get("hwaddr") != null && map.get("hwaddr").getClass()
if (uuid != null) .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
apInetState.set_uuid(uuid); tableState.setHwAddr(row.getStringColumn("hwaddr"));
}
ret.add(apInetState); if (map.get("_version") != null && map.get("_version").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setVersion(row.getUuidColumn("_version"));
}
if (map.get("_uuid") != null && map.get("_uuid").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setVersion(row.getUuidColumn("_uuid"));
}
ret.add(tableState);
} }
}); }
}
ret.stream().forEach(wrs -> {
LOG.debug("Wifi_Inet_State row {}", wrs.toPrettyString());
}); });
} catch (Exception e) { } catch (Exception e) {
LOG.error("Could not parse update for Wifi_Inet_State", e); LOG.error("Could not parse update for Wifi_Inet_State", e);
} }
@@ -1229,80 +1272,103 @@ public class OvsdbDao {
OvsdbClient ovsdbClient) { OvsdbClient ovsdbClient) {
List<OpensyncAPVIFState> ret = new ArrayList<OpensyncAPVIFState>(); List<OpensyncAPVIFState> ret = new ArrayList<OpensyncAPVIFState>();
try { try {
tableUpdates.getTableUpdates().values().stream().forEach(tu -> {
tu.getRowUpdates().values().stream().forEach(ru -> {
Row row = ru.getNew(); for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) {
for (RowUpdate rowUpdate : tableUpdate.getRowUpdates().values()) {
Row row = rowUpdate.getNew();
// Row old = rowUpdate.getOld();
if (row != null) { if (row != null) {
OpensyncAPVIFState apVifState = new OpensyncAPVIFState(); OpensyncAPVIFState tableState = new OpensyncAPVIFState();
String tmpBridge = getSingleValueFromSet(row, "bridge"); Map<String, Value> map = row.getColumns();
if (tmpBridge != null)
apVifState.setBridge(getSingleValueFromSet(row, "bridge"));
Long btmTmp = getSingleValueFromSet(row, "btm");
if (btmTmp != null)
apVifState.setBtm(btmTmp.intValue());
Long channelTmp = getSingleValueFromSet(row, "channel"); if (map.get("mac") != null && map.get("mac").getClass()
if (channelTmp != null) .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
apVifState.setChannel(channelTmp.intValue()); tableState.setMac(row.getStringColumn("mac"));
}
if (map.get("bridge") != null && map.get("bridge").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setBridge(row.getStringColumn("bridge"));
}
if (map.get("btm") != null && map.get("btm").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setBtm(row.getIntegerColumn("btm").intValue());
}
Boolean enabledTmp = getSingleValueFromSet(row, "enabled"); if (map.get("channel") != null && map.get("channel").getClass()
if (enabledTmp != null) .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
apVifState.setEnabled(enabledTmp); tableState.setChannel(row.getIntegerColumn("channel").intValue());
}
Long tmpFtPsk = getSingleValueFromSet(row, "ft_psk"); if (map.get("enabled") != null && map.get("enabled").getClass()
if (tmpFtPsk != null) .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
apVifState.setFtPsk(tmpFtPsk.intValue()); tableState.setEnabled(row.getBooleanColumn("enabled"));
}
Long groupRekey = getSingleValueFromSet(row, "group_rekey"); if (map.get("group_rekey") != null && map.get("group_rekey").getClass()
if (groupRekey != null) .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
apVifState.setGroupRekey(groupRekey.intValue()); tableState.setGroupRekey(row.getIntegerColumn("group_rekey").intValue());
}
if (map.get("if_name") != null && map.get("if_name").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setIfName(row.getStringColumn("if_name"));
}
String ifName = getSingleValueFromSet(row, "if_name"); if (map.get("mode") != null && map.get("mode").getClass()
if (ifName != null) .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
apVifState.setIfName(ifName); tableState.setMode(row.getStringColumn("mode"));
}
String mode = getSingleValueFromSet(row, "mode"); if (map.get("rrm") != null && map.get("rrm").getClass()
if (mode != null) .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
apVifState.setMode(mode); tableState.setRrm(row.getIntegerColumn("rrm").intValue());
}
if (map.get("ssid") != null && map.get("ssid").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setSsid(row.getStringColumn("ssid"));
}
Long rrm = getSingleValueFromSet(row, "rrm"); if (map.get("ssid_broadcast") != null && map.get("ssid_broadcast").getClass()
if (rrm != null) .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
apVifState.setRrm(rrm.intValue()); tableState.setSsidBroadcast(row.getStringColumn("ssid_broadcast"));
}
if (map.get("uapsd_enable") != null && map.get("uapsd_enable").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setUapsdEnable(row.getBooleanColumn("uapsd_enable"));
}
if (map.get("vif_radio_idx") != null && map.get("vif_radio_idx").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setVifRadioIdx(row.getIntegerColumn("vif_radio_idx").intValue());
}
String ssid = getSingleValueFromSet(row, "ssid"); if (map.get("associated_clients") != null)
if (ssid != null) tableState.setAssociatedClients(row.getSetColumn("associated_clients"));
apVifState.setSsid(ssid);
String ssidBroadcast = getSingleValueFromSet(row, "ssid_broadcast"); if (map.get("security") != null)
if (ssidBroadcast != null) tableState.setSecurity(row.getMapColumn("security"));
apVifState.setSsidBroadcast(ssidBroadcast);
Boolean uapsdEnable = getSingleValueFromSet(row, "uapsd_enable"); if (map.get("_version") != null && map.get("_version").getClass()
if (uapsdEnable != null) .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
apVifState.setUapsdEnable(uapsdEnable); tableState.setVersion(row.getUuidColumn("_version"));
}
Long vifRadioIdx = getSingleValueFromSet(row, "vif_radio_idx"); if (map.get("_uuid") != null && map.get("_uuid").getClass()
if (vifRadioIdx != null) .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
apVifState.setVifRadioIdx(vifRadioIdx.intValue()); tableState.setVersion(row.getUuidColumn("_uuid"));
}
apVifState.setAssociatedClients(row.getSetColumn("associated_clients"));
apVifState.setSecurity(row.getMapColumn("security"));
Uuid version = getSingleValueFromSet(row, "_version");
if (version != null)
apVifState.setVersion(version);
Uuid uuid = getSingleValueFromSet(row, "_uuid");
if (uuid != null)
apVifState.set_uuid(uuid);
} }
}); }
}
ret.stream().forEach(wrs -> {
LOG.debug("Wifi_VIF_State row {}", wrs.toPrettyString());
}); });
} catch (Exception e) { } catch (Exception e) {
LOG.error("Could not parse update for Wifi_VIF_State", e); LOG.error("Could not parse update for Wifi_VIF_State", e);
@@ -1315,30 +1381,44 @@ public class OvsdbDao {
List<OpensyncWifiAssociatedClients> ret = new ArrayList<OpensyncWifiAssociatedClients>(); List<OpensyncWifiAssociatedClients> ret = new ArrayList<OpensyncWifiAssociatedClients>();
try { try {
tableUpdates.getTableUpdates().values().stream().forEach(tu -> {
tu.getRowUpdates().values().stream().forEach(ru -> {
Row row = ru.getNew(); for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) {
for (RowUpdate rowUpdate : tableUpdate.getRowUpdates().values()) {
Row row = rowUpdate.getNew();
if (row != null) { if (row != null) {
OpensyncWifiAssociatedClients wifiClient = new OpensyncWifiAssociatedClients();
String mac = getSingleValueFromSet(row, "mac");
if (mac != null)
wifiClient.setMac(mac);
wifiClient.setCapabilities(row.getSetColumn("capabilities"));
String state = getSingleValueFromSet(row, "state");
if (state != null)
wifiClient.setState(state);
Uuid version = getSingleValueFromSet(row, "_version");
if (version != null)
wifiClient.setVersion(version);
Uuid uuid = getSingleValueFromSet(row, "_uuid");
if (uuid != null)
wifiClient.set_uuid(uuid);
ret.add(wifiClient); OpensyncWifiAssociatedClients tableState = new OpensyncWifiAssociatedClients();
Map<String, Value> map = row.getColumns();
if (map.get("mac") != null && map.get("mac").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setMac(row.getStringColumn("mac"));
}
if (row.getSetColumn("capabilities") != null)
tableState.setCapabilities(row.getSetColumn("capabilities"));
if (map.get("state") != null && map.get("state").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setState(row.getBooleanColumn("state"));
}
if (map.get("_version") != null && map.get("_version").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setVersion(row.getUuidColumn("_version"));
}
if (map.get("_uuid") != null && map.get("_uuid").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setVersion(row.getUuidColumn("_uuid"));
}
ret.add(tableState);
} }
}); }
}
ret.stream().forEach(wrs -> {
LOG.debug("Wifi_Associated_Clients row {}", wrs.toPrettyString());
}); });
} catch (Exception e) { } catch (Exception e) {
LOG.error("Could not get Wifi_Associated_Clients list from table update", e); LOG.error("Could not get Wifi_Associated_Clients list from table update", e);
@@ -1348,92 +1428,127 @@ public class OvsdbDao {
} }
public OpensyncAWLANNode getOpensyncAWLANNode(TableUpdates tableUpdates, String apId, OvsdbClient ovsdbClient) { public OpensyncAWLANNode getOpensyncAWLANNode(TableUpdates tableUpdates, String apId, OvsdbClient ovsdbClient) {
OpensyncAWLANNode ret = new OpensyncAWLANNode(); OpensyncAWLANNode tableState = new OpensyncAWLANNode();
Map<String, TableUpdate> updates = tableUpdates.getTableUpdates(); try {
for (TableUpdate update : updates.values()) { for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) {
Map<UUID, RowUpdate> rowUpdates = update.getRowUpdates(); for (RowUpdate rowUpdate : tableUpdate.getRowUpdates().values()) {
for (RowUpdate rowUpdate : rowUpdates.values()) { Row row = rowUpdate.getNew();
Row row = rowUpdate.getNew(); if (row != null) {
if (row != null) { Map<String, Value> map = row.getColumns();
ret.setMqttSettings(row.getMapColumn("mqtt_settings").toString());
String model = getSingleValueFromSet(row, "model"); if (map.get("mqtt_settings") != null) {
if (model != null) tableState.setMqttSettings(row.getMapColumn("mqtt_settings"));
ret.setModel(model); }
String skuNumber = getSingleValueFromSet(row, "sku_number"); if (map.get("mqtt_headers") != null) {
if (skuNumber != null) tableState.setMqttHeaders(row.getMapColumn("mqtt_headers"));
ret.setSkuNumber(skuNumber); }
String id = getSingleValueFromSet(row, "id"); if (map.get("mqtt_topics") != null) {
if (id != null) tableState.setMqttHeaders(row.getMapColumn("mqtt_topics"));
ret.setId(id); }
if (map.get("model") != null && map.get("model").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setModel(row.getStringColumn("model"));
}
if (map.get("sku_number") != null && map.get("sku_number").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setSkuNumber(row.getStringColumn("sku_number"));
}
if (map.get("id") != null && map.get("id").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setId(row.getStringColumn("id"));
}
if (map.get("version_matrix") != null)
tableState.setVersionMatrix(row.getMapColumn("version_matrix"));
if (map.get("firmware_version") != null && map.get("firmware_version").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setFirmwareVersion(row.getStringColumn("firmware_version"));
}
if (map.get("firmware_url") != null && map.get("firmware_url").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setFirmwareUrl(row.getStringColumn("firmware_url"));
}
if (map.get("_uuid") != null && map.get("_uuid").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setVersion(row.getUuidColumn("_uuid"));
}
if (map.get("upgrade_dl_timer") != null && map.get("upgrade_dl_timer").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setUpgradeDlTimer(row.getIntegerColumn("upgrade_dl_timer").intValue());
}
if (map.get("platform_version") != null && map.get("platform_version").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setPlatformVersion(row.getStringColumn("platform_version"));
}
if (map.get("firmware_pass") != null && map.get("firmware_pass").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setFirmwarePass(row.getStringColumn("firmware_pass"));
}
if (map.get("upgrade_timer") != null && map.get("upgrade_timer").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setUpgradeTimer(row.getIntegerColumn("upgrade_timer").intValue());
}
if (map.get("max_backoff") != null && map.get("max_backoff").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setMaxBackoff(row.getIntegerColumn("max_backoff").intValue());
}
if (map.get("led_config") != null)
tableState.setLedConfig(row.getMapColumn("led_config"));
if (map.get("redirector_addr") != null && map.get("redirector_addr").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setRedirectorAddr(row.getStringColumn("redirector_addr"));
}
if (map.get("serial_number") != null && map.get("serial_number").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setSerialNumber(row.getStringColumn("serial_number"));
}
if (map.get("_version") != null && map.get("_version").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setVersion(row.getUuidColumn("_version"));
}
if (map.get("upgrade_status") != null && map.get("upgrade_status").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setUpgradeTimer(row.getIntegerColumn("upgrade_status").intValue());
}
if (map.get("device_mode") != null && map.get("device_mode").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setDeviceMode(row.getStringColumn("device_mode"));
}
if (map.get("min_backoff") != null && map.get("min_backoff").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setMinBackoff(row.getIntegerColumn("min_backoff").intValue());
}
if (map.get("revision") != null && map.get("revision").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setRevision(row.getStringColumn("revision"));
}
if (map.get("manager_addr") != null && map.get("manager_addr").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setManagerAddr(row.getStringColumn("manager_addr"));
}
if (map.get("factory_reset") != null && map.get("factory_reset").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setFactoryReset(row.getBooleanColumn("factory_reset"));
}
}
ret.setVersionMatrix(row.getMapColumn("version_matrix"));
String fwVersion = getSingleValueFromSet(row, "firmware_version");
if (fwVersion != null)
ret.setFirmwareVersion(fwVersion);
String fwUrl = getSingleValueFromSet(row, "firmware_url");
if (fwUrl != null)
ret.setFirmwareUrl(fwUrl);
Uuid uuid = getSingleValueFromSet(row, "_uuid");
if (uuid != null)
ret.set_uuid(uuid);
Long ugDlTimer = getSingleValueFromSet(row, "upgrade_dl_timer");
if (ugDlTimer != null)
ret.setUpgradeDlTimer(ugDlTimer.intValue());
String platform = getSingleValueFromSet(row, "platform_version");
if (platform != null)
ret.setPlatformVersion(platform);
String fwPass = getSingleValueFromSet(row, "firmware_pass");
if (fwPass != null)
ret.setFirmwarePass(fwPass);
Long ugTimer = getSingleValueFromSet(row, "upgrade_timer");
if (ugTimer != null)
ret.setUpgradeTimer(ugTimer.intValue());
Long maxBackoff = getSingleValueFromSet(row, "max_backoff");
if (maxBackoff != null)
ret.setMaxBackoff(maxBackoff.intValue());
ret.setLedConfig(row.getMapColumn("led_config"));
String redirector = getSingleValueFromSet(row, "redirector_addr");
if (redirector != null)
ret.setRedirectorAddr(redirector);
ret.setMqttHeaders(row.getMapColumn("mqtt_headers"));
String serial = getSingleValueFromSet(row, "serial_number");
if (serial != null)
ret.setSerialNumber(serial);
Uuid version = getSingleValueFromSet(row, "_version");
if (version != null)
ret.setVersion(version);
Long ugStatus = getSingleValueFromSet(row, "upgrade_status");
if (ugStatus != null)
ret.setUpgradeStatus(ugStatus.intValue());
String deviceMode = getSingleValueFromSet(row, "device_mode");
if (deviceMode != null)
ret.setDeviceMode(deviceMode);
Long minBackoff = getSingleValueFromSet(row, "min_backoff");
if (minBackoff != null)
ret.setMinBackoff(minBackoff.intValue());
ret.setMqttTopics(row.getMapColumn("mqtt_topics"));
String revision = getSingleValueFromSet(row, "revision");
if (revision != null)
ret.setRevision(revision);
String mgrAddress = getSingleValueFromSet(row, "manager_addr");
if (mgrAddress != null)
ret.setManagerAddr(mgrAddress);
Boolean factoryReset = getSingleValueFromSet(row, "factory_reset");
if (factoryReset != null)
ret.setFactoryReset(factoryReset);
} }
} }
} catch (Exception e) {
LOG.error("Failed to handle AWLAN_Node update", e);
} }
return ret; return tableState;
} }