WIFI-1424: OSGW refactor and cleanup com.telecominfraproject.wlan.opensync.external.integration.models

This commit is contained in:
Mike Hansen
2021-02-04 17:14:30 -05:00
parent e7c288683f
commit 511f3c1253
15 changed files with 1773 additions and 1947 deletions

View File

@@ -46,13 +46,6 @@ public class ConnectNodeInfo implements Cloneable {
}
}
@Override
public int hashCode() {
return Objects.hash(country, firmwareVersion, ifName, ifType, ipV4Address, lanIfName, lanIfType, lanIpV4Address,
lanMacAddress, macAddress, managerAddr, model, mqttSettings, platformVersion, redirectorAddr, revision,
serialNumber, skuNumber, versionMatrix, wifiRadioStates);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -76,6 +69,13 @@ public class ConnectNodeInfo implements Cloneable {
&& Objects.equals(wifiRadioStates, other.wifiRadioStates);
}
@Override
public int hashCode() {
return Objects.hash(country, firmwareVersion, ifName, ifType, ipV4Address, lanIfName, lanIfType, lanIpV4Address,
lanMacAddress, macAddress, managerAddr, model, mqttSettings, platformVersion, redirectorAddr, revision,
serialNumber, skuNumber, versionMatrix, wifiRadioStates);
}
@Override
public String toString() {
return "ConnectNodeInfo [mqttSettings=" + mqttSettings + ", versionMatrix=" + versionMatrix
@@ -87,5 +87,4 @@ public class ConnectNodeInfo implements Cloneable {
+ ", lanIfName=" + lanIfName + ", lanIfType=" + lanIfType + ", lanMacAddress=" + lanMacAddress + "]";
}
}

View File

@@ -0,0 +1,30 @@
package com.telecominfraproject.wlan.opensync.external.integration.models;
import java.util.Set;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
import com.vmware.ovsdb.protocol.operation.notation.Row;
public abstract class OpensyncAPBase extends BaseJsonModel {
private static final long serialVersionUID = -68509242520818671L;
public static <T> T getSingleValueFromSet(Row row, String columnName) {
Set<T> set = row != null ? row.getSetColumn(columnName) : null;
T ret = (set != null) && !set.isEmpty() ? set.iterator().next() : null;
return ret;
}
public OpensyncAPBase() {
}
public <T> Set<T> getSet(Row row, String columnName) {
Set<T> set = row != null ? row.getSetColumn(columnName) : null;
return set;
}
}

View File

@@ -10,7 +10,6 @@ import com.telecominfraproject.wlan.core.model.entity.CountryCode;
import com.telecominfraproject.wlan.core.model.equipment.EquipmentType;
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
import com.telecominfraproject.wlan.equipment.models.ApElementConfiguration;
import com.telecominfraproject.wlan.equipment.models.Equipment;
import com.telecominfraproject.wlan.equipment.models.StateSetting;
@@ -24,10 +23,14 @@ import com.telecominfraproject.wlan.profile.ssid.models.SsidConfiguration.Secure
import com.telecominfraproject.wlan.routing.models.EquipmentGatewayRecord;
import com.telecominfraproject.wlan.routing.models.EquipmentRoutingRecord;
public class OpensyncAPConfig extends BaseJsonModel {
public class OpensyncAPConfig extends OpensyncAPBase {
private static final long serialVersionUID = 3917975477206236668L;
public static long getSerialversionuid() {
return serialVersionUID;
}
private Equipment customerEquipment;
private OpensyncAPHotspot20Config hotspotConfig;
private Profile apProfile;
@@ -40,8 +43,205 @@ public class OpensyncAPConfig extends BaseJsonModel {
private EquipmentGatewayRecord equipmentGateway;
private List<Profile> captiveProfiles;
private List<Profile> bonjourGatewayProfiles;
private List<MacAddress> blockedClients;
@Override
public OpensyncAPConfig clone() {
OpensyncAPConfig ret = (OpensyncAPConfig) super.clone();
if (customerEquipment != null) {
ret.customerEquipment = customerEquipment.clone();
}
if (hotspotConfig != null) {
ret.hotspotConfig = hotspotConfig.clone();
}
if (equipmentLocation != null) {
ret.equipmentLocation = equipmentLocation.clone();
}
if (ssidProfile != null) {
List<Profile> ssidList = new ArrayList<Profile>();
for (Profile profile : ssidProfile) {
ssidList.add(profile.clone());
}
ret.ssidProfile = ssidList;
}
if (metricsProfile != null) {
List<Profile> metricsList = new ArrayList<Profile>();
for (Profile profile : metricsProfile) {
metricsList.add(profile.clone());
}
ret.metricsProfile = metricsList;
}
if (bonjourGatewayProfiles != null) {
List<Profile> bonjourGatewayProfilesList = new ArrayList<Profile>();
for (Profile profile : bonjourGatewayProfiles) {
bonjourGatewayProfilesList.add(profile.clone());
}
ret.bonjourGatewayProfiles = bonjourGatewayProfilesList;
}
if (apProfile != null) {
ret.apProfile = apProfile.clone();
}
if (rfProfile != null) {
ret.rfProfile = rfProfile.clone();
}
if (equipmentRouting != null) {
ret.equipmentRouting = equipmentRouting.clone();
}
if (equipmentGateway != null) {
ret.equipmentGateway = equipmentGateway.clone();
}
if (radiusProfiles != null) {
ret.radiusProfiles = new ArrayList<>();
for (Profile radiusProfile : this.radiusProfiles) {
ret.radiusProfiles.add(radiusProfile);
}
}
if (captiveProfiles != null) {
ret.captiveProfiles = new ArrayList<>();
for (Profile cpConfig : this.captiveProfiles) {
ret.captiveProfiles.add(cpConfig);
}
}
if (blockedClients != null) {
ret.blockedClients = new ArrayList<MacAddress>();
for (MacAddress blockedClient : this.blockedClients) {
ret.blockedClients.add(blockedClient);
}
}
return ret;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
OpensyncAPConfig other = (OpensyncAPConfig) obj;
return Objects.equals(apProfile, other.apProfile) && Objects.equals(blockedClients, other.blockedClients)
&& Objects.equals(bonjourGatewayProfiles, other.bonjourGatewayProfiles)
&& Objects.equals(captiveProfiles, other.captiveProfiles)
&& Objects.equals(customerEquipment, other.customerEquipment)
&& Objects.equals(equipmentGateway, other.equipmentGateway)
&& Objects.equals(equipmentLocation, other.equipmentLocation)
&& Objects.equals(equipmentRouting, other.equipmentRouting)
&& Objects.equals(hotspotConfig, other.hotspotConfig)
&& Objects.equals(metricsProfile, other.metricsProfile)
&& Objects.equals(radiusProfiles, other.radiusProfiles) && Objects.equals(rfProfile, other.rfProfile)
&& Objects.equals(ssidProfile, other.ssidProfile);
}
public Profile getApProfile() {
return apProfile;
}
public List<MacAddress> getBlockedClients() {
return blockedClients;
}
public List<Profile> getBonjourGatewayProfiles() {
return bonjourGatewayProfiles;
}
public List<Profile> getCaptiveProfiles() {
return captiveProfiles;
}
public String getCountryCode() {
return Location.getCountryCode(this.equipmentLocation).toString();
}
public Equipment getCustomerEquipment() {
return customerEquipment;
}
public EquipmentGatewayRecord getEquipmentGateway() {
return equipmentGateway;
}
public Location getEquipmentLocation() {
return equipmentLocation;
}
public EquipmentRoutingRecord getEquipmentRouting() {
return equipmentRouting;
}
public OpensyncAPHotspot20Config getHotspotConfig() {
return hotspotConfig;
}
public List<Profile> getMetricsProfiles() {
return metricsProfile;
}
public List<Profile> getRadiusProfiles() {
return radiusProfiles;
}
public Profile getRfProfile() {
return rfProfile;
}
public List<Profile> getSsidProfile() {
return ssidProfile;
}
@Override
public int hashCode() {
return Objects.hash(apProfile, blockedClients, bonjourGatewayProfiles, captiveProfiles, customerEquipment,
equipmentGateway, equipmentLocation, equipmentRouting, hotspotConfig, metricsProfile, radiusProfiles,
rfProfile, ssidProfile);
}
public void setApProfile(Profile apProfile) {
this.apProfile = apProfile;
}
public void setBlockedClients(List<MacAddress> blockedClients) {
this.blockedClients = blockedClients;
}
public void setBonjourGatewayProfiles(List<Profile> bonjourGatewayProfiles) {
this.bonjourGatewayProfiles = bonjourGatewayProfiles;
}
public void setCaptiveProfiles(List<Profile> captiveProfiles) {
this.captiveProfiles = captiveProfiles;
}
public void setCustomerEquipment(Equipment customerEquipment) {
this.customerEquipment = customerEquipment;
}
public void setEquipmentGateway(EquipmentGatewayRecord equipmentGateway) {
this.equipmentGateway = equipmentGateway;
}
public void setEquipmentLocation(Location equipmentLocation) {
this.equipmentLocation = equipmentLocation;
}
public void setEquipmentRouting(EquipmentRoutingRecord equipmentRouting) {
this.equipmentRouting = equipmentRouting;
}
public void setHotspotConfig(OpensyncAPHotspot20Config hotspotConfig) {
this.hotspotConfig = hotspotConfig;
}
public void setMetricsProfiles(List<Profile> metricsProfileList) {
metricsProfile = metricsProfileList;
}
// Handle Legacy Config Support
public void setRadioConfig(OpensyncAPRadioConfig radioConfig) {
@@ -61,13 +261,21 @@ public class OpensyncAPConfig extends BaseJsonModel {
equipmentLocation = new Location();
equipmentLocation.setId(1);
equipmentLocation.setDetails(LocationDetails.createWithDefaults());
((LocationDetails) equipmentLocation.getDetails())
equipmentLocation.getDetails()
.setCountryCode(CountryCode.getByName(radioConfig.getCountry().toLowerCase()));
customerEquipment.setLocationId(equipmentLocation.getId());
}
}
public void setRadiusProfiles(List<Profile> radiusProfiles) {
this.radiusProfiles = radiusProfiles;
}
public void setRfProfile(Profile rfProfile) {
this.rfProfile = rfProfile;
}
// Handle Legacy Config Support
public void setSsidConfigs(List<OpensyncAPSsidConfig> ssidConfigs) {
@@ -89,16 +297,18 @@ public class OpensyncAPConfig extends BaseJsonModel {
appliedRadios.add(ssidConfig.getRadioType());
cfg.setAppliedRadios(appliedRadios);
cfg.setSsid(ssidConfig.getSsid());
if (ssidConfig.getEncryption().equals("WPA-PSK") && ssidConfig.getMode().equals("1"))
if (ssidConfig.getEncryption().equals("WPA-PSK") && ssidConfig.getMode().equals("1")) {
cfg.setSecureMode(SecureMode.wpaPSK);
else
} else {
cfg.setSecureMode(SecureMode.wpa2PSK);
}
cfg.setBroadcastSsid(ssidConfig.isBroadcast() ? StateSetting.enabled : StateSetting.disabled);
profile.setDetails(cfg);
profile.setId(ssidProfileId);
if (this.ssidProfile == null)
if (this.ssidProfile == null) {
this.ssidProfile = new ArrayList<Profile>();
}
this.ssidProfile.add(profile);
apProfile.getChildProfileIds().add(ssidProfileId);
ssidProfileId++;
@@ -111,206 +321,8 @@ public class OpensyncAPConfig extends BaseJsonModel {
}
public EquipmentGatewayRecord getEquipmentGateway() {
return equipmentGateway;
}
public void setEquipmentGateway(EquipmentGatewayRecord equipmentGateway) {
this.equipmentGateway = equipmentGateway;
}
public EquipmentRoutingRecord getEquipmentRouting() {
return equipmentRouting;
}
public void setEquipmentRouting(EquipmentRoutingRecord equipmentRouting) {
this.equipmentRouting = equipmentRouting;
}
public Equipment getCustomerEquipment() {
return customerEquipment;
}
public void setCustomerEquipment(Equipment customerEquipment) {
this.customerEquipment = customerEquipment;
}
public OpensyncAPHotspot20Config getHotspotConfig() {
return hotspotConfig;
}
public void setHotspotConfig(OpensyncAPHotspot20Config hotspotConfig) {
this.hotspotConfig = hotspotConfig;
}
public Profile getApProfile() {
return apProfile;
}
public void setApProfile(Profile apProfile) {
this.apProfile = apProfile;
}
public Profile getRfProfile() {
return rfProfile;
}
public void setRfProfile(Profile rfProfile) {
this.rfProfile = rfProfile;
}
public List<Profile> getSsidProfile() {
return ssidProfile;
}
public void setSsidProfile(List<Profile> ssidProfile) {
this.ssidProfile = ssidProfile;
}
public List<Profile> getBonjourGatewayProfiles() {
return bonjourGatewayProfiles;
}
public void setBonjourGatewayProfiles(List<Profile> bonjourGatewayProfiles) {
this.bonjourGatewayProfiles = bonjourGatewayProfiles;
}
public Location getEquipmentLocation() {
return equipmentLocation;
}
public void setEquipmentLocation(Location equipmentLocation) {
this.equipmentLocation = equipmentLocation;
}
public String getCountryCode() {
return Location.getCountryCode(this.equipmentLocation).toString();
}
public static long getSerialversionuid() {
return serialVersionUID;
}
@Override
public OpensyncAPConfig clone() {
OpensyncAPConfig ret = (OpensyncAPConfig) super.clone();
if (customerEquipment != null)
ret.customerEquipment = customerEquipment.clone();
if (hotspotConfig != null)
ret.hotspotConfig = hotspotConfig.clone();
if (equipmentLocation != null)
ret.equipmentLocation = equipmentLocation.clone();
if (ssidProfile != null) {
List<Profile> ssidList = new ArrayList<Profile>();
for (Profile profile : ssidProfile) {
ssidList.add(profile.clone());
}
ret.ssidProfile = ssidList;
}
if (metricsProfile != null) {
List<Profile> metricsList = new ArrayList<Profile>();
for (Profile profile : metricsProfile) {
metricsList.add(profile.clone());
}
ret.metricsProfile = metricsList;
}
if (bonjourGatewayProfiles != null) {
List<Profile> bonjourGatewayProfilesList = new ArrayList<Profile>();
for (Profile profile : bonjourGatewayProfiles) {
bonjourGatewayProfilesList.add(profile.clone());
}
ret.bonjourGatewayProfiles = bonjourGatewayProfilesList;
}
if (apProfile != null)
ret.apProfile = apProfile.clone();
if (rfProfile != null)
ret.rfProfile = rfProfile.clone();
if (equipmentRouting != null)
ret.equipmentRouting = equipmentRouting.clone();
if (equipmentGateway != null)
ret.equipmentGateway = equipmentGateway.clone();
if (radiusProfiles != null) {
ret.radiusProfiles = new ArrayList<>();
for (Profile radiusProfile : this.radiusProfiles) {
ret.radiusProfiles.add(radiusProfile);
}
}
if (captiveProfiles != null) {
ret.captiveProfiles = new ArrayList<>();
for (Profile cpConfig : this.captiveProfiles) {
ret.captiveProfiles.add(cpConfig);
}
}
if (blockedClients != null) {
ret.blockedClients = new ArrayList<MacAddress>();
for (MacAddress blockedClient : this.blockedClients) {
ret.blockedClients.add(blockedClient);
}
}
return ret;
}
public List<Profile> getRadiusProfiles() {
return radiusProfiles;
}
public void setRadiusProfiles(List<Profile> radiusProfiles) {
this.radiusProfiles = radiusProfiles;
}
public List<Profile> getCaptiveProfiles() {
return captiveProfiles;
}
public void setCaptiveProfiles(List<Profile> captiveProfiles) {
this.captiveProfiles = captiveProfiles;
}
public List<MacAddress> getBlockedClients() {
return blockedClients;
}
public void setBlockedClients(List<MacAddress> blockedClients) {
this.blockedClients = blockedClients;
}
public void setMetricsProfiles(List<Profile> metricsProfileList) {
metricsProfile = metricsProfileList;
}
public List<Profile> getMetricsProfiles() {
return metricsProfile;
}
@Override
public int hashCode() {
return Objects.hash(apProfile, blockedClients, bonjourGatewayProfiles, captiveProfiles, customerEquipment,
equipmentGateway, equipmentLocation, equipmentRouting, hotspotConfig, metricsProfile,
radiusProfiles, rfProfile, ssidProfile);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof OpensyncAPConfig)) {
return false;
}
OpensyncAPConfig other = (OpensyncAPConfig) obj;
return Objects.equals(apProfile, other.apProfile) && Objects.equals(blockedClients, other.blockedClients)
&& Objects.equals(bonjourGatewayProfiles, other.bonjourGatewayProfiles)
&& Objects.equals(captiveProfiles, other.captiveProfiles)
&& Objects.equals(customerEquipment, other.customerEquipment)
&& Objects.equals(equipmentGateway, other.equipmentGateway)
&& Objects.equals(equipmentLocation, other.equipmentLocation)
&& Objects.equals(equipmentRouting, other.equipmentRouting)
&& Objects.equals(hotspotConfig, other.hotspotConfig)
&& Objects.equals(metricsProfile, other.metricsProfile)
&& Objects.equals(radiusProfiles, other.radiusProfiles) && Objects.equals(rfProfile, other.rfProfile)
&& Objects.equals(ssidProfile, other.ssidProfile);
}
}

View File

@@ -4,10 +4,9 @@ import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
import com.telecominfraproject.wlan.profile.models.Profile;
public class OpensyncAPHotspot20Config extends BaseJsonModel {
public class OpensyncAPHotspot20Config extends OpensyncAPBase {
private static final long serialVersionUID = -8495473152523219578L;
@@ -20,40 +19,6 @@ public class OpensyncAPHotspot20Config extends BaseJsonModel {
private Set<Profile> hotspot20VenueSet;
private Set<Profile> hotspot20ProviderSet;
public Set<Profile> getHotspot20ProfileSet() {
return hotspot20ProfileSet;
}
public void setHotspot20ProfileSet(Set<Profile> hotspot20ProfileSet) {
this.hotspot20ProfileSet = hotspot20ProfileSet;
}
public Set<Profile> getHotspot20OperatorSet() {
return hotspot20OperatorSet;
}
public void setHotspot20OperatorSet(Set<Profile> hotspot20OperatorSet) {
this.hotspot20OperatorSet = hotspot20OperatorSet;
}
public Set<Profile> getHotspot20VenueSet() {
return hotspot20VenueSet;
}
public void setHotspot20VenueSet(Set<Profile> hotspot20VenueSet) {
this.hotspot20VenueSet = hotspot20VenueSet;
}
public Set<Profile> getHotspot20ProviderSet() {
return hotspot20ProviderSet;
}
public void setHotspot20ProviderSet(Set<Profile> hotspot20ProviderSet) {
this.hotspot20ProviderSet = hotspot20ProviderSet;
}
@Override
public OpensyncAPHotspot20Config clone() {
OpensyncAPHotspot20Config ret = (OpensyncAPHotspot20Config) super.clone();
@@ -77,17 +42,15 @@ public class OpensyncAPHotspot20Config extends BaseJsonModel {
return ret;
}
@Override
public int hashCode() {
return Objects.hash(hotspot20OperatorSet, hotspot20ProfileSet, hotspot20ProviderSet, hotspot20VenueSet);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof OpensyncAPHotspot20Config)) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
OpensyncAPHotspot20Config other = (OpensyncAPHotspot20Config) obj;
@@ -97,4 +60,41 @@ public class OpensyncAPHotspot20Config extends BaseJsonModel {
&& Objects.equals(hotspot20VenueSet, other.hotspot20VenueSet);
}
public Set<Profile> getHotspot20OperatorSet() {
return hotspot20OperatorSet;
}
public Set<Profile> getHotspot20ProfileSet() {
return hotspot20ProfileSet;
}
public Set<Profile> getHotspot20ProviderSet() {
return hotspot20ProviderSet;
}
public Set<Profile> getHotspot20VenueSet() {
return hotspot20VenueSet;
}
@Override
public int hashCode() {
return Objects.hash(hotspot20OperatorSet, hotspot20ProfileSet, hotspot20ProviderSet, hotspot20VenueSet);
}
public void setHotspot20OperatorSet(Set<Profile> hotspot20OperatorSet) {
this.hotspot20OperatorSet = hotspot20OperatorSet;
}
public void setHotspot20ProfileSet(Set<Profile> hotspot20ProfileSet) {
this.hotspot20ProfileSet = hotspot20ProfileSet;
}
public void setHotspot20ProviderSet(Set<Profile> hotspot20ProviderSet) {
this.hotspot20ProviderSet = hotspot20ProviderSet;
}
public void setHotspot20VenueSet(Set<Profile> hotspot20VenueSet) {
this.hotspot20VenueSet = hotspot20VenueSet;
}
}

View File

@@ -2,14 +2,20 @@ package com.telecominfraproject.wlan.opensync.external.integration.models;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
import com.vmware.ovsdb.protocol.operation.notation.Row;
import com.vmware.ovsdb.protocol.operation.notation.Uuid;
import com.vmware.ovsdb.protocol.operation.notation.Value;
public class OpensyncAPInetState extends BaseJsonModel {
public class OpensyncAPInetState extends OpensyncAPBase {
private static final long serialVersionUID = 1707053648715030173L;
public static long getSerialversionuid() {
return serialVersionUID;
}
public String ifName;
public Map<String, String> dhcpd;
public String unpnpMode;
@@ -37,224 +43,344 @@ public class OpensyncAPInetState extends BaseJsonModel {
public Uuid _uuid;
public Uuid version;
public String greLocalInetAddr;
public String greRemoteMacAddr;
public OpensyncAPInetState() {
super();
dns = new HashMap<>();
dhcpc = new HashMap<>();
}
public String getIfName() {
return ifName;
public OpensyncAPInetState(Row row) {
dns = new HashMap<>();
dhcpc = new HashMap<>();
Map<String, Value> map = row.getColumns();
if ((map.get("NAT") != null)
&& map.get("NAT").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setNat(row.getBooleanColumn("NAT"));
}
if ((map.get("enabled") != null)
&& map.get("enabled").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setEnabled(row.getBooleanColumn("enabled"));
}
if ((map.get("if_name") != null)
&& map.get("if_name").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setIfName(row.getStringColumn("if_name"));
}
if ((map.get("if_type") != null)
&& map.get("if_type").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setIfType(row.getStringColumn("if_type"));
}
public void setIfName(String ifName) {
this.ifName = ifName;
if (map.containsKey("dhcpc")) {
this.setDhcpc(row.getMapColumn("dhcpc"));
}
if (map.containsKey("dhcpd")) {
this.setDhcpd(row.getMapColumn("dhcpd"));
}
if (map.containsKey("dns")) {
this.setDns(row.getMapColumn("dns"));
}
if (map.get("inet_addr") != null
&& map.get("inet_addr").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setInetAddr(row.getStringColumn("inet_addr"));
}
if (map.containsKey("netmask")) {
this.setNetmask(getSingleValueFromSet(row, "netmask"));
}
if (map.get("vlan_id") != null
&& map.get("vlan_id").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setVlanId(row.getIntegerColumn("vlan_id").intValue());
}
if (map.get("gre_ifname") != null
&& map.get("gre_ifname").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setGreIfName(row.getStringColumn("gre_ifname"));
}
if (map.get("gre_remote_inet_addr") != null && map.get("gre_remote_inet_addr").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setGreRemoteInetAddr(row.getStringColumn("gre_remote_inet_addr"));
}
if (map.get("gre_local_inet_addr") != null && map.get("gre_local_inet_addr").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setGreLocalInetAddr(row.getStringColumn("gre_local_inet_addr"));
}
if (map.get("gre_remote_mac_addr") != null && map.get("gre_remote_mac_addr").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setGreRemoteMacAddr(row.getStringColumn("gre_remote_mac_addr"));
}
public Map<String, String> getDhcpd() {
return dhcpd;
if ((map.get("ip_assign_scheme") != null) && map.get("ip_assign_scheme").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setIpAssignScheme(row.getStringColumn("ip_assign_scheme"));
}
if ((map.get("network") != null)
&& map.get("network").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setNetwork(row.getBooleanColumn("network"));
}
if ((map.get("hwaddr") != null)
&& map.get("hwaddr").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setHwAddr(row.getStringColumn("hwaddr"));
}
if ((map.get("_version") != null)
&& map.get("_version").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setVersion(row.getUuidColumn("_version"));
}
if ((map.get("_uuid") != null)
&& map.get("_uuid").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setVersion(row.getUuidColumn("_uuid"));
}
}
public void setDhcpd(Map<String, String> dhcpd) {
this.dhcpd = dhcpd;
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
public String getUnpnpMode() {
return unpnpMode;
if (obj == null) {
return false;
}
public void setUnpnpMode(String unpnpMode) {
this.unpnpMode = unpnpMode;
if (getClass() != obj.getClass()) {
return false;
}
public String getIfType() {
return ifType;
OpensyncAPInetState other = (OpensyncAPInetState) obj;
if (!Objects.equals(_uuid, other._uuid)) {
return false;
}
public void setIfType(String ifType) {
this.ifType = ifType;
if (!Objects.equals(broadcast, other.broadcast)) {
return false;
}
public String getSoftwdsMacAddr() {
return softwdsMacAddr;
if (!Objects.equals(dhcpc, other.dhcpc)) {
return false;
}
public void setSoftwdsMacAddr(String softwdsMacAddr) {
this.softwdsMacAddr = softwdsMacAddr;
if (!Objects.equals(dhcpd, other.dhcpd)) {
return false;
}
public boolean isEnabled() {
return enabled;
if (!Objects.equals(dns, other.dns)) {
return false;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
if (enabled != other.enabled) {
return false;
}
public boolean isSofwdsWrap() {
return sofwdsWrap;
if (!Objects.equals(gateway, other.gateway)) {
return false;
}
public void setSofwdsWrap(boolean sofwdsWrap) {
this.sofwdsWrap = sofwdsWrap;
if (!Objects.equals(greIfName, other.greIfName)) {
return false;
}
public int getVlanId() {
return vlanId;
if (!Objects.equals(greLocalInetAddr, other.greLocalInetAddr)) {
return false;
}
public void setVlanId(int vlanId) {
this.vlanId = vlanId;
if (!Objects.equals(greRemoteInetAddr, other.greRemoteInetAddr)) {
return false;
}
public String getNetmask() {
return netmask;
if (!Objects.equals(hwAddr, other.hwAddr)) {
return false;
}
public void setNetmask(String netmask) {
this.netmask = netmask;
if (!Objects.equals(ifName, other.ifName)) {
return false;
}
public boolean isNat() {
return nat;
if (!Objects.equals(ifType, other.ifType)) {
return false;
}
public void setNat(boolean nat) {
this.nat = nat;
if (!Objects.equals(ifUuid, other.ifUuid)) {
return false;
}
public String getGreRemoteInetAddr() {
return greRemoteInetAddr;
if (!Objects.equals(inetAddr, other.inetAddr)) {
return false;
}
public void setGreRemoteInetAddr(String greRemoteInetAddr) {
this.greRemoteInetAddr = greRemoteInetAddr;
if (!Objects.equals(inetConfig, other.inetConfig)) {
return false;
}
public String getIfUuid() {
return ifUuid;
if (!Objects.equals(ipAssignScheme, other.ipAssignScheme)) {
return false;
}
public void setIfUuid(String ifUuid) {
this.ifUuid = ifUuid;
if (mtw != other.mtw) {
return false;
}
public String getInetAddr() {
return inetAddr;
if (nat != other.nat) {
return false;
}
public void setInetAddr(String inetAddr) {
this.inetAddr = inetAddr;
if (!Objects.equals(netmask, other.netmask)) {
return false;
}
public String getHwAddr() {
return hwAddr;
if (network != other.network) {
return false;
}
public void setHwAddr(String hwAddr) {
this.hwAddr = hwAddr;
if (!Objects.equals(parentIfName, other.parentIfName)) {
return false;
}
public int getMtw() {
return mtw;
if (!Objects.equals(greRemoteMacAddr, other.greRemoteMacAddr)) {
return false;
}
public void setMtw(int mtw) {
this.mtw = mtw;
if (!Objects.equals(softwdsMacAddr, other.softwdsMacAddr)) {
return false;
}
public boolean isNetwork() {
return network;
if (sofwdsWrap != other.sofwdsWrap) {
return false;
}
public void setNetwork(boolean network) {
this.network = network;
if (!Objects.equals(unpnpMode, other.unpnpMode)) {
return false;
}
public Map<String, String> getDns() {
return dns;
if (!Objects.equals(version, other.version)) {
return false;
}
public void setDns(Map<String, String> dns) {
this.dns = dns;
if (vlanId != other.vlanId) {
return false;
}
public String getParentIfName() {
return parentIfName;
}
public void setParentIfName(String parentIfName) {
this.parentIfName = parentIfName;
}
public String getGreIfName() {
return greIfName;
}
public void setGreIfName(String greIfName) {
this.greIfName = greIfName;
}
public String getBroadcast() {
return broadcast;
}
public void setBroadcast(String broadcast) {
this.broadcast = broadcast;
}
public Map<String, String> getDhcpc() {
return dhcpc;
}
public void setDhcpc(Map<String, String> dhcpc) {
this.dhcpc = dhcpc;
}
public String getGateway() {
return gateway;
}
public void setGateway(String gateway) {
this.gateway = gateway;
}
public String getIpAssignScheme() {
return ipAssignScheme;
}
public void setIpAssignScheme(String ipAssignScheme) {
this.ipAssignScheme = ipAssignScheme;
}
public String getInetConfig() {
return inetConfig;
}
public void setInetConfig(String inetConfig) {
this.inetConfig = inetConfig;
}
public static long getSerialversionuid() {
return serialVersionUID;
return true;
}
public Uuid get_uuid() {
return _uuid;
}
public void set_uuid(Uuid _uuid) {
this._uuid = _uuid;
public String getBroadcast() {
return broadcast;
}
public Map<String, String> getDhcpc() {
return dhcpc;
}
public Map<String, String> getDhcpd() {
return dhcpd;
}
public Map<String, String> getDns() {
return dns;
}
public String getGateway() {
return gateway;
}
public String getGreIfName() {
return greIfName;
}
public String getGreLocalInetAddr() {
return greLocalInetAddr;
}
public String getGreRemoteInetAddr() {
return greRemoteInetAddr;
}
public String getGreRemoteMacAddr() {
return this.greRemoteMacAddr;
}
public String getHwAddr() {
return hwAddr;
}
public String getIfName() {
return ifName;
}
public String getIfType() {
return ifType;
}
public String getIfUuid() {
return ifUuid;
}
public String getInetAddr() {
return inetAddr;
}
public String getInetConfig() {
return inetConfig;
}
public String getIpAssignScheme() {
return ipAssignScheme;
}
public int getMtw() {
return mtw;
}
public String getNetmask() {
return netmask;
}
public String getParentIfName() {
return parentIfName;
}
public String getSoftwdsMacAddr() {
return softwdsMacAddr;
}
public String getUnpnpMode() {
return unpnpMode;
}
public Uuid getVersion() {
return version;
}
public void setVersion(Uuid version) {
this.version = version;
public int getVlanId() {
return vlanId;
}
@Override
public int hashCode() {
return Objects.hash(_uuid, broadcast, dhcpc, dhcpd, dns, enabled, gateway, greIfName, greLocalInetAddr, greRemoteInetAddr,
hwAddr, ifName, ifType, ifUuid, inetAddr, inetConfig, ipAssignScheme, mtw, nat, netmask, network,
parentIfName, greRemoteMacAddr, softwdsMacAddr, sofwdsWrap, unpnpMode, version, vlanId);
}
public boolean isEnabled() {
return enabled;
}
public boolean isNat() {
return nat;
}
public boolean isNetwork() {
return network;
}
public boolean isSofwdsWrap() {
return sofwdsWrap;
}
public void set_uuid(Uuid _uuid) {
this._uuid = _uuid;
}
public void setBroadcast(String broadcast) {
this.broadcast = broadcast;
}
public void setDhcpc(Map<String, String> dhcpc) {
this.dhcpc = dhcpc;
}
public void setDhcpd(Map<String, String> dhcpd) {
this.dhcpd = dhcpd;
}
public void setDns(Map<String, String> dns) {
this.dns = dns;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public void setGateway(String gateway) {
this.gateway = gateway;
}
public void setGreIfName(String greIfName) {
this.greIfName = greIfName;
}
public void setGreLocalInetAddr(String greLocalInetAddr) {
@@ -262,184 +388,80 @@ public class OpensyncAPInetState extends BaseJsonModel {
}
public String getGreLocalInetAddr() {
return greLocalInetAddr;
public void setGreRemoteInetAddr(String greRemoteInetAddr) {
this.greRemoteInetAddr = greRemoteInetAddr;
}
public void setGreRemoteMacAddr(String greRemoteMacAddr) {
this.greRemoteMacAddr = greRemoteMacAddr;
}
public String getGreRemoteMacAddr(){
return this.greRemoteMacAddr;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((_uuid == null) ? 0 : _uuid.hashCode());
result = prime * result + ((broadcast == null) ? 0 : broadcast.hashCode());
result = prime * result + ((dhcpc == null) ? 0 : dhcpc.hashCode());
result = prime * result + ((dhcpd == null) ? 0 : dhcpd.hashCode());
result = prime * result + ((dns == null) ? 0 : dns.hashCode());
result = prime * result + (enabled ? 1231 : 1237);
result = prime * result + ((gateway == null) ? 0 : gateway.hashCode());
result = prime * result + ((greIfName == null) ? 0 : greIfName.hashCode());
result = prime * result + ((greLocalInetAddr == null) ? 0 : greLocalInetAddr.hashCode());
result = prime * result + ((greRemoteInetAddr == null) ? 0 : greRemoteInetAddr.hashCode());
result = prime * result + ((hwAddr == null) ? 0 : hwAddr.hashCode());
result = prime * result + ((ifName == null) ? 0 : ifName.hashCode());
result = prime * result + ((ifType == null) ? 0 : ifType.hashCode());
result = prime * result + ((ifUuid == null) ? 0 : ifUuid.hashCode());
result = prime * result + ((inetAddr == null) ? 0 : inetAddr.hashCode());
result = prime * result + ((inetConfig == null) ? 0 : inetConfig.hashCode());
result = prime * result + ((ipAssignScheme == null) ? 0 : ipAssignScheme.hashCode());
result = prime * result + mtw;
result = prime * result + (nat ? 1231 : 1237);
result = prime * result + ((netmask == null) ? 0 : netmask.hashCode());
result = prime * result + (network ? 1231 : 1237);
result = prime * result + ((parentIfName == null) ? 0 : parentIfName.hashCode());
result = prime * result + ((greRemoteMacAddr == null) ? 0 : greRemoteMacAddr.hashCode());
result = prime * result + ((softwdsMacAddr == null) ? 0 : softwdsMacAddr.hashCode());
result = prime * result + (sofwdsWrap ? 1231 : 1237);
result = prime * result + ((unpnpMode == null) ? 0 : unpnpMode.hashCode());
result = prime * result + ((version == null) ? 0 : version.hashCode());
result = prime * result + vlanId;
return result;
public void setHwAddr(String hwAddr) {
this.hwAddr = hwAddr;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
OpensyncAPInetState other = (OpensyncAPInetState) obj;
if (_uuid == null) {
if (other._uuid != null)
return false;
} else if (!_uuid.equals(other._uuid))
return false;
if (broadcast == null) {
if (other.broadcast != null)
return false;
} else if (!broadcast.equals(other.broadcast))
return false;
if (dhcpc == null) {
if (other.dhcpc != null)
return false;
} else if (!dhcpc.equals(other.dhcpc))
return false;
if (dhcpd == null) {
if (other.dhcpd != null)
return false;
} else if (!dhcpd.equals(other.dhcpd))
return false;
if (dns == null) {
if (other.dns != null)
return false;
} else if (!dns.equals(other.dns))
return false;
if (enabled != other.enabled)
return false;
if (gateway == null) {
if (other.gateway != null)
return false;
} else if (!gateway.equals(other.gateway))
return false;
if (greIfName == null) {
if (other.greIfName != null)
return false;
} else if (!greIfName.equals(other.greIfName))
return false;
if (greLocalInetAddr == null) {
if (other.greLocalInetAddr != null)
return false;
} else if (!greLocalInetAddr.equals(other.greLocalInetAddr))
return false;
if (greRemoteInetAddr == null) {
if (other.greRemoteInetAddr != null)
return false;
} else if (!greRemoteInetAddr.equals(other.greRemoteInetAddr))
return false;
if (hwAddr == null) {
if (other.hwAddr != null)
return false;
} else if (!hwAddr.equals(other.hwAddr))
return false;
if (ifName == null) {
if (other.ifName != null)
return false;
} else if (!ifName.equals(other.ifName))
return false;
if (ifType == null) {
if (other.ifType != null)
return false;
} else if (!ifType.equals(other.ifType))
return false;
if (ifUuid == null) {
if (other.ifUuid != null)
return false;
} else if (!ifUuid.equals(other.ifUuid))
return false;
if (inetAddr == null) {
if (other.inetAddr != null)
return false;
} else if (!inetAddr.equals(other.inetAddr))
return false;
if (inetConfig == null) {
if (other.inetConfig != null)
return false;
} else if (!inetConfig.equals(other.inetConfig))
return false;
if (ipAssignScheme == null) {
if (other.ipAssignScheme != null)
return false;
} else if (!ipAssignScheme.equals(other.ipAssignScheme))
return false;
if (mtw != other.mtw)
return false;
if (nat != other.nat)
return false;
if (netmask == null) {
if (other.netmask != null)
return false;
} else if (!netmask.equals(other.netmask))
return false;
if (network != other.network)
return false;
if (parentIfName == null) {
if (other.parentIfName != null)
return false;
} else if (!parentIfName.equals(other.parentIfName))
return false;
if (greRemoteMacAddr == null) {
if (other.greRemoteMacAddr != null)
return false;
} else if (!greRemoteMacAddr.equals(other.greRemoteMacAddr))
return false;
if (softwdsMacAddr == null) {
if (other.softwdsMacAddr != null)
return false;
} else if (!softwdsMacAddr.equals(other.softwdsMacAddr))
return false;
if (sofwdsWrap != other.sofwdsWrap)
return false;
if (unpnpMode == null) {
if (other.unpnpMode != null)
return false;
} else if (!unpnpMode.equals(other.unpnpMode))
return false;
if (version == null) {
if (other.version != null)
return false;
} else if (!version.equals(other.version))
return false;
if (vlanId != other.vlanId)
return false;
return true;
public void setIfName(String ifName) {
this.ifName = ifName;
}
public void setIfType(String ifType) {
this.ifType = ifType;
}
public void setIfUuid(String ifUuid) {
this.ifUuid = ifUuid;
}
public void setInetAddr(String inetAddr) {
this.inetAddr = inetAddr;
}
public void setInetConfig(String inetConfig) {
this.inetConfig = inetConfig;
}
public void setIpAssignScheme(String ipAssignScheme) {
this.ipAssignScheme = ipAssignScheme;
}
public void setMtw(int mtw) {
this.mtw = mtw;
}
public void setNat(boolean nat) {
this.nat = nat;
}
public void setNetmask(String netmask) {
this.netmask = netmask;
}
public void setNetwork(boolean network) {
this.network = network;
}
public void setParentIfName(String parentIfName) {
this.parentIfName = parentIfName;
}
public void setSoftwdsMacAddr(String softwdsMacAddr) {
this.softwdsMacAddr = softwdsMacAddr;
}
public void setSofwdsWrap(boolean sofwdsWrap) {
this.sofwdsWrap = sofwdsWrap;
}
public void setUnpnpMode(String unpnpMode) {
this.unpnpMode = unpnpMode;
}
public void setVersion(Uuid version) {
this.version = version;
}
public void setVlanId(int vlanId) {
this.vlanId = vlanId;
}
@Override

View File

@@ -1,8 +1,6 @@
package com.telecominfraproject.wlan.opensync.external.integration.models;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
public class OpensyncAPRadioConfig extends BaseJsonModel {
public class OpensyncAPRadioConfig extends OpensyncAPBase {
private static final long serialVersionUID = 5683558403622855381L;
@@ -11,40 +9,40 @@ public class OpensyncAPRadioConfig extends BaseJsonModel {
private int radioChannel5LG;
private int radioChannel5HG;
public int getRadioChannel24G() {
return radioChannel24G;
}
public void setRadioChannel24G(int radioChannel24G) {
this.radioChannel24G = radioChannel24G;
}
public int getRadioChannel5LG() {
return radioChannel5LG;
}
public void setRadioChannel5LG(int radioChannel5LG) {
this.radioChannel5LG = radioChannel5LG;
}
public int getRadioChannel5HG() {
return radioChannel5HG;
}
public void setRadioChannel5HG(int radioChannel5HG) {
this.radioChannel5HG = radioChannel5HG;
@Override
public OpensyncAPRadioConfig clone() {
return (OpensyncAPRadioConfig) super.clone();
}
public String getCountry() {
return country;
}
public int getRadioChannel24G() {
return radioChannel24G;
}
public int getRadioChannel5HG() {
return radioChannel5HG;
}
public int getRadioChannel5LG() {
return radioChannel5LG;
}
public void setCountry(String country) {
this.country = country;
}
@Override
public OpensyncAPRadioConfig clone() {
return (OpensyncAPRadioConfig)super.clone();
public void setRadioChannel24G(int radioChannel24G) {
this.radioChannel24G = radioChannel24G;
}
public void setRadioChannel5HG(int radioChannel5HG) {
this.radioChannel5HG = radioChannel5HG;
}
public void setRadioChannel5LG(int radioChannel5LG) {
this.radioChannel5LG = radioChannel5LG;
}
}

View File

@@ -3,25 +3,28 @@
*/
package com.telecominfraproject.wlan.opensync.external.integration.models;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
import com.vmware.ovsdb.protocol.operation.notation.Row;
import com.vmware.ovsdb.protocol.operation.notation.Uuid;
import com.vmware.ovsdb.protocol.operation.notation.Value;
/**
* @author mikehansen
*
*/
public class OpensyncAPRadioState extends BaseJsonModel {
public class OpensyncAPRadioState extends OpensyncAPBase {
private static final long serialVersionUID = 5003143778489404219L;
public static long getSerialversionuid() {
return serialVersionUID;
}
public int temperatureControl;
public boolean thermalDowngraded;
public boolean dfsDemo;
@@ -48,10 +51,15 @@ public class OpensyncAPRadioState extends BaseJsonModel {
public Map<String, String> hwParams;
public RadioType freqBand;
public int thermalIntegration;
public Set<Uuid> vifStates;
public String channelMode;
public Uuid _uuid;
public Uuid version;
public OpensyncAPRadioState() {
super();
allowedChannels = new HashSet<>();
hwConfig = new HashMap<>();
channels = new HashMap<>();
@@ -59,255 +67,334 @@ public class OpensyncAPRadioState extends BaseJsonModel {
vifStates = new HashSet<>();
}
public String channelMode;
public Uuid _uuid;
public Uuid version;
public OpensyncAPRadioState(Row row) {
this();
public int getTemperatureControl() {
return temperatureControl;
Map<String, Value> map = row.getColumns();
if ((map.get("mac") != null)
&& map.get("mac").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setMac(row.getStringColumn("mac"));
}
if ((map.get("channel") != null)
&& map.get("channel").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setChannel(row.getIntegerColumn("channel").intValue());
}
if ((map.get("freq_band") != null)
&& map.get("freq_band").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
String frequencyBand = row.getStringColumn("freq_band");
switch (frequencyBand) {
case "2.4G":
this.setFreqBand(RadioType.is2dot4GHz);
break;
case "5G":
this.setFreqBand(RadioType.is5GHz);
break;
case "5GL":
this.setFreqBand(RadioType.is5GHzL);
break;
case "5GU":
this.setFreqBand(RadioType.is5GHzU);
break;
default:
this.setFreqBand(RadioType.UNSUPPORTED);
}
}
if ((map.get("if_name") != null)
&& map.get("if_name").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setIfName(row.getStringColumn("if_name"));
}
if ((map.get("channel_mode") != null)
&& map.get("channel_mode").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setChannelMode(row.getStringColumn("channel_mode"));
}
if ((map.get("country") != null)
&& map.get("country").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setCountry(row.getStringColumn("country").toUpperCase());
}
if ((map.get("enabled") != null)
&& map.get("enabled").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setEnabled(row.getBooleanColumn("enabled"));
}
if ((map.get("ht_mode") != null)
&& map.get("ht_mode").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setHtMode(row.getStringColumn("ht_mode"));
}
if ((map.get("tx_power") != null)
&& map.get("tx_power").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.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)) {
this.setHwConfig(row.getMapColumn("hw_config"));
}
if ((map.get("_version") != null)
&& map.get("_version").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setVersion(row.getUuidColumn("_version"));
}
if ((map.get("_uuid") != null)
&& map.get("_uuid").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setVersion(row.getUuidColumn("_uuid"));
}
if (map.get("allowed_channels") != null) {
Set<Long> allowedChannels = getSet(row, "allowed_channels");
Set<Integer> allowed = new HashSet<>();
for (Long channel : allowedChannels) {
allowed.add(channel.intValue());
}
this.setAllowedChannels(allowed);
}
if (map.get("channels") != null) {
Map<String, String> channels = row.getMapColumn("channels");
this.setChannels(channels);
}
public void setTemperatureControl(int temperatureControl) {
this.temperatureControl = temperatureControl;
}
Set<Uuid> vifStates = row.getSetColumn("vif_states");
this.setVifStates(vifStates);
public boolean isThermalDowngraded() {
return thermalDowngraded;
}
public void setThermalDowngraded(boolean thermalDowngraded) {
this.thermalDowngraded = thermalDowngraded;
}
public boolean isDfsDemo() {
return dfsDemo;
}
public void setDfsDemo(boolean dfsDemo) {
this.dfsDemo = dfsDemo;
}
public String getIfName() {
return ifName;
}
public void setIfName(String ifName) {
this.ifName = ifName;
}
public String getMac() {
return mac;
}
public void setMac(String mac) {
this.mac = mac;
}
public Set<Uuid> getVifStates() {
return vifStates;
}
public void setVifStates(Set<Uuid> vifStates) {
this.vifStates = vifStates;
}
public int getBcnInt() {
return bcnInt;
}
public void setBcnInt(int bcnInt) {
this.bcnInt = bcnInt;
}
public int getThermalTxChainmask() {
return thermalTxChainmask;
}
public void setThermalTxChainmask(int thermalTxChainmask) {
this.thermalTxChainmask = thermalTxChainmask;
}
public Set<Integer> getAllowedChannels() {
return allowedChannels;
}
public void setAllowedChannels(Set<Integer> allowedChannels) {
this.allowedChannels = allowedChannels;
}
public int getThermalShutdown() {
return thermalShutdown;
}
public void setThermalShutdown(int thermalShutdown) {
this.thermalShutdown = thermalShutdown;
}
public int getChannelSync() {
return channelSync;
}
public void setChannelSync(int channelSync) {
this.channelSync = channelSync;
}
public int getHwType() {
return hwType;
}
public void setHwType(int hwType) {
this.hwType = hwType;
}
public int getTxChainmask() {
return txChainmask;
}
public void setTxChainmask(int txChainmask) {
this.txChainmask = txChainmask;
}
public String getRadar() {
return radar;
}
public void setRadar(String radar) {
this.radar = radar;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public Map<String, String> getHwConfig() {
return hwConfig;
}
public void setHwConfig(Map<String, String> hwConfig) {
this.hwConfig = hwConfig;
}
public int getChannel() {
return channel;
}
public void setChannel(int channel) {
this.channel = channel;
}
public int getTxPower() {
return txPower;
}
public void setTxPower(int txPower) {
this.txPower = txPower;
}
public String getHtMode() {
return htMode;
}
public void setHtMode(String htMode) {
this.htMode = htMode;
}
public int getThermalDowngradeTemp() {
return thermalDowngradeTemp;
}
public void setThermalDowngradeTemp(int thermalDowngradeTemp) {
this.thermalDowngradeTemp = thermalDowngradeTemp;
}
public String getHwMode() {
return hwMode;
}
public void setHwMode(String hwMode) {
this.hwMode = hwMode;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public Map<String, String> getChannels() {
return channels;
}
public void setChannels(Map<String, String> channels) {
this.channels = channels;
}
public int getThermalUpgradeTemp() {
return thermalUpgradeTemp;
}
public void setThermalUpgradeTemp(int thermalUpgradeTemp) {
this.thermalUpgradeTemp = thermalUpgradeTemp;
}
public Map<String, String> getHwParams() {
return hwParams;
}
public void setHwParams(Map<String, String> hwParams) {
this.hwParams = hwParams;
}
public RadioType getFreqBand() {
return freqBand;
}
public void setFreqBand(RadioType freqBand) {
this.freqBand = freqBand;
}
public int getThermalIntegration() {
return thermalIntegration;
}
public void setThermalIntegration(int thermalIntegration) {
this.thermalIntegration = thermalIntegration;
}
public String getChannelMode() {
return channelMode;
}
public void setChannelMode(String channelMode) {
this.channelMode = channelMode;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public Uuid get_uuid() {
return _uuid;
}
public void set_uuid(Uuid _uuid) {
this._uuid = _uuid;
public Set<Integer> getAllowedChannels() {
return allowedChannels;
}
public int getBcnInt() {
return bcnInt;
}
public int getChannel() {
return channel;
}
public String getChannelMode() {
return channelMode;
}
public Map<String, String> getChannels() {
return channels;
}
public int getChannelSync() {
return channelSync;
}
public String getCountry() {
return country;
}
public RadioType getFreqBand() {
return freqBand;
}
public String getHtMode() {
return htMode;
}
public Map<String, String> getHwConfig() {
return hwConfig;
}
public String getHwMode() {
return hwMode;
}
public Map<String, String> getHwParams() {
return hwParams;
}
public int getHwType() {
return hwType;
}
public String getIfName() {
return ifName;
}
public String getMac() {
return mac;
}
public String getRadar() {
return radar;
}
public int getTemperatureControl() {
return temperatureControl;
}
public int getThermalDowngradeTemp() {
return thermalDowngradeTemp;
}
public int getThermalIntegration() {
return thermalIntegration;
}
public int getThermalShutdown() {
return thermalShutdown;
}
public int getThermalTxChainmask() {
return thermalTxChainmask;
}
public int getThermalUpgradeTemp() {
return thermalUpgradeTemp;
}
public int getTxChainmask() {
return txChainmask;
}
public int getTxPower() {
return txPower;
}
public Uuid getVersion() {
return version;
}
public Set<Uuid> getVifStates() {
return vifStates;
}
public boolean isDfsDemo() {
return dfsDemo;
}
public boolean isEnabled() {
return enabled;
}
public boolean isThermalDowngraded() {
return thermalDowngraded;
}
public void set_uuid(Uuid _uuid) {
this._uuid = _uuid;
}
public void setAllowedChannels(Set<Integer> allowedChannels) {
this.allowedChannels = allowedChannels;
}
public void setBcnInt(int bcnInt) {
this.bcnInt = bcnInt;
}
public void setChannel(int channel) {
this.channel = channel;
}
public void setChannelMode(String channelMode) {
this.channelMode = channelMode;
}
public void setChannels(Map<String, String> channels) {
this.channels = channels;
}
public void setChannelSync(int channelSync) {
this.channelSync = channelSync;
}
public void setCountry(String country) {
this.country = country;
}
public void setDfsDemo(boolean dfsDemo) {
this.dfsDemo = dfsDemo;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public void setFreqBand(RadioType freqBand) {
this.freqBand = freqBand;
}
public void setHtMode(String htMode) {
this.htMode = htMode;
}
public void setHwConfig(Map<String, String> hwConfig) {
this.hwConfig = hwConfig;
}
public void setHwMode(String hwMode) {
this.hwMode = hwMode;
}
public void setHwParams(Map<String, String> hwParams) {
this.hwParams = hwParams;
}
public void setHwType(int hwType) {
this.hwType = hwType;
}
public void setIfName(String ifName) {
this.ifName = ifName;
}
public void setMac(String mac) {
this.mac = mac;
}
public void setRadar(String radar) {
this.radar = radar;
}
public void setTemperatureControl(int temperatureControl) {
this.temperatureControl = temperatureControl;
}
public void setThermalDowngraded(boolean thermalDowngraded) {
this.thermalDowngraded = thermalDowngraded;
}
public void setThermalDowngradeTemp(int thermalDowngradeTemp) {
this.thermalDowngradeTemp = thermalDowngradeTemp;
}
public void setThermalIntegration(int thermalIntegration) {
this.thermalIntegration = thermalIntegration;
}
public void setThermalShutdown(int thermalShutdown) {
this.thermalShutdown = thermalShutdown;
}
public void setThermalTxChainmask(int thermalTxChainmask) {
this.thermalTxChainmask = thermalTxChainmask;
}
public void setThermalUpgradeTemp(int thermalUpgradeTemp) {
this.thermalUpgradeTemp = thermalUpgradeTemp;
}
public void setTxChainmask(int txChainmask) {
this.txChainmask = txChainmask;
}
public void setTxPower(int txPower) {
this.txPower = txPower;
}
public void setVersion(Uuid version) {
this.version = version;
}
public void setVifStates(Set<Uuid> vifStates) {
this.vifStates = vifStates;
}
}

View File

@@ -1,9 +1,8 @@
package com.telecominfraproject.wlan.opensync.external.integration.models;
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
public class OpensyncAPSsidConfig extends BaseJsonModel {
public class OpensyncAPSsidConfig extends OpensyncAPBase {
private static final long serialVersionUID = -8540144450360788799L;
@@ -14,44 +13,29 @@ public class OpensyncAPSsidConfig extends BaseJsonModel {
private String mode;
private boolean broadcast;
public RadioType getRadioType() {
return radioType;
}
public void setRadioType(RadioType radioType) {
this.radioType = radioType;
}
public String getSsid() {
return ssid;
}
public void setSsid(String ssid) {
this.ssid = ssid;
@Override
public OpensyncAPSsidConfig clone() {
return (OpensyncAPSsidConfig) super.clone();
}
public String getEncryption() {
return encryption;
}
public void setEncryption(String encryption) {
this.encryption = encryption;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getMode() {
return mode;
}
public void setMode(String mode) {
this.mode = mode;
public RadioType getRadioType() {
return radioType;
}
public String getSsid() {
return ssid;
}
public boolean isBroadcast() {
@@ -62,9 +46,24 @@ public class OpensyncAPSsidConfig extends BaseJsonModel {
this.broadcast = broadcast;
}
@Override
public OpensyncAPSsidConfig clone() {
return (OpensyncAPSsidConfig)super.clone();
public void setEncryption(String encryption) {
this.encryption = encryption;
}
public void setKey(String key) {
this.key = key;
}
public void setMode(String mode) {
this.mode = mode;
}
public void setRadioType(RadioType radioType) {
this.radioType = radioType;
}
public void setSsid(String ssid) {
this.ssid = ssid;
}
}

View File

@@ -6,13 +6,18 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
import com.vmware.ovsdb.protocol.operation.notation.Row;
import com.vmware.ovsdb.protocol.operation.notation.Uuid;
import com.vmware.ovsdb.protocol.operation.notation.Value;
public class OpensyncAPVIFState extends BaseJsonModel {
public class OpensyncAPVIFState extends OpensyncAPBase {
private static final long serialVersionUID = -4916251246542770881L;
public static long getSerialversionuid() {
return serialVersionUID;
}
public String ifName;
public int vifRadioIdx;
public String parent;
@@ -24,8 +29,8 @@ public class OpensyncAPVIFState extends BaseJsonModel {
public String ssid;
public Map<String, String> security;
public String macList;
public List<Uuid> associatedClients;
public List<Uuid> associatedClients;
public boolean enabled;
public int vlanId;
public int btm;
@@ -40,232 +45,321 @@ public class OpensyncAPVIFState extends BaseJsonModel {
public boolean dynamicBeacon;
public int channel;
public Uuid _uuid;
public Uuid version;
public String getIfName() {
return ifName;
}
public OpensyncAPVIFState() {
super();
security = new HashMap<>();
associatedClients = new ArrayList<>();
}
public void setIfName(String ifName) {
this.ifName = ifName;
public OpensyncAPVIFState(Row row) {
Map<String, Value> map = row.getColumns();
if ((map.get("mac") != null)
&& map.get("mac").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setMac(row.getStringColumn("mac"));
}
if ((map.get("bridge") != null)
&& map.get("bridge").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setBridge(row.getStringColumn("bridge"));
}
if ((map.get("btm") != null)
&& map.get("btm").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setBtm(row.getIntegerColumn("btm").intValue());
}
public int getVifRadioIdx() {
return vifRadioIdx;
if ((map.get("channel") != null)
&& map.get("channel").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setChannel(row.getIntegerColumn("channel").intValue());
}
public void setVifRadioIdx(int vifRadioIdx) {
this.vifRadioIdx = vifRadioIdx;
if ((map.get("enabled") != null)
&& map.get("enabled").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setEnabled(row.getBooleanColumn("enabled"));
}
public String getParent() {
return parent;
Long ftPsk = getSingleValueFromSet(row, "ft_psk");
if (ftPsk != null) {
this.setFtPsk(ftPsk.intValue());
}
public void setParent(String parent) {
this.parent = parent;
Long ftMobilityDomain = getSingleValueFromSet(row, "ft_mobility_domain");
if (ftMobilityDomain != null) {
this.setFtMobilityDomain(ftMobilityDomain.intValue());
}
public String getState() {
return state;
if ((map.get("group_rekey") != null)
&& map.get("group_rekey").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.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)) {
this.setIfName(row.getStringColumn("if_name"));
}
public void setState(String state) {
this.state = state;
if ((map.get("mode") != null)
&& map.get("mode").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setMode(row.getStringColumn("mode"));
}
public String getMac() {
return mac;
if ((map.get("rrm") != null)
&& map.get("rrm").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setRrm(row.getIntegerColumn("rrm").intValue());
}
if ((map.get("ssid") != null)
&& map.get("ssid").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setSsid(row.getStringColumn("ssid"));
}
public void setMac(String mac) {
this.mac = mac;
if ((map.get("ssid_broadcast") != null) && map.get("ssid_broadcast").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.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)) {
this.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)) {
this.setVifRadioIdx(row.getIntegerColumn("vif_radio_idx").intValue());
}
public boolean isApBridge() {
return apBridge;
List<Uuid> associatedClientsList = new ArrayList<>();
Set<Uuid> clients = row.getSetColumn("associated_clients");
associatedClientsList.addAll(clients);
this.setAssociatedClients(associatedClientsList);
if (map.get("security") != null) {
this.setSecurity(row.getMapColumn("security"));
}
public void setApBridge(boolean apBridge) {
this.apBridge = apBridge;
if ((map.get("_version") != null)
&& map.get("_version").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setVersion(row.getUuidColumn("_version"));
}
public boolean isUapsdEnable() {
return uapsdEnable;
if ((map.get("_uuid") != null)
&& map.get("_uuid").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setVersion(row.getUuidColumn("_uuid"));
}
public void setUapsdEnable(boolean uapsdEnable) {
this.uapsdEnable = uapsdEnable;
}
public boolean isWds() {
return wds;
}
public void setWds(boolean wds) {
this.wds = wds;
}
public String getSsid() {
return ssid;
}
public void setSsid(String ssid) {
this.ssid = ssid;
}
public Map<String, String> getSecurity() {
return security;
}
public void setSecurity(Map<String, String> security) {
this.security = security;
}
public String getMacList() {
return macList;
}
public void setMacList(String macList) {
this.macList = macList;
}
public List<Uuid> getAssociatedClients() {
return associatedClients;
}
public void setAssociatedClients(List<Uuid> list) {
this.associatedClients = list;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public int getVlanId() {
return vlanId;
}
public void setVlanId(int vlanId) {
this.vlanId = vlanId;
}
public int getBtm() {
return btm;
}
public void setBtm(int btm) {
this.btm = btm;
}
public String getMinHwMode() {
return minHwMode;
}
public void setMinHwMode(String minHwMode) {
this.minHwMode = minHwMode;
}
public String getSsidBroadcast() {
return ssidBroadcast;
}
public void setSsidBroadcast(String ssidBroadcast) {
this.ssidBroadcast = ssidBroadcast;
}
public String getMode() {
return mode;
}
public void setMode(String mode) {
this.mode = mode;
}
public String getBridge() {
return bridge;
}
public void setBridge(String bridge) {
this.bridge = bridge;
}
public int getGroupRekey() {
return groupRekey;
}
public void setGroupRekey(int groupRekey) {
this.groupRekey = groupRekey;
}
public int getFtMobilityDomain() {
return ftMobilityDomain;
}
public void setFtMobilityDomain(int ftMobilityDomain) {
this.ftMobilityDomain = ftMobilityDomain;
}
public int getFtPsk() {
return ftPsk;
}
public void setFtPsk(int ftPsk) {
this.ftPsk = ftPsk;
}
public int getRrm() {
return rrm;
}
public void setRrm(int rrm) {
this.rrm = rrm;
}
public boolean isDynamicBeacon() {
return dynamicBeacon;
}
public void setDynamicBeacon(boolean dynamicBeacon) {
this.dynamicBeacon = dynamicBeacon;
}
public int getChannel() {
return channel;
}
public void setChannel(int channel) {
this.channel = channel;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public Uuid get_uuid() {
return _uuid;
}
public void set_uuid(Uuid _uuid) {
this._uuid = _uuid;
public List<Uuid> getAssociatedClients() {
return associatedClients;
}
public String getBridge() {
return bridge;
}
public int getBtm() {
return btm;
}
public int getChannel() {
return channel;
}
public int getFtMobilityDomain() {
return ftMobilityDomain;
}
public int getFtPsk() {
return ftPsk;
}
public int getGroupRekey() {
return groupRekey;
}
public String getIfName() {
return ifName;
}
public String getMac() {
return mac;
}
public String getMacList() {
return macList;
}
public String getMinHwMode() {
return minHwMode;
}
public String getMode() {
return mode;
}
public String getParent() {
return parent;
}
public int getRrm() {
return rrm;
}
public Map<String, String> getSecurity() {
return security;
}
public String getSsid() {
return ssid;
}
public String getSsidBroadcast() {
return ssidBroadcast;
}
public String getState() {
return state;
}
public Uuid getVersion() {
return version;
}
public int getVifRadioIdx() {
return vifRadioIdx;
}
public int getVlanId() {
return vlanId;
}
public boolean isApBridge() {
return apBridge;
}
public boolean isDynamicBeacon() {
return dynamicBeacon;
}
public boolean isEnabled() {
return enabled;
}
public boolean isUapsdEnable() {
return uapsdEnable;
}
public boolean isWds() {
return wds;
}
public void set_uuid(Uuid _uuid) {
this._uuid = _uuid;
}
public void setApBridge(boolean apBridge) {
this.apBridge = apBridge;
}
public void setAssociatedClients(List<Uuid> list) {
this.associatedClients = list;
}
public void setBridge(String bridge) {
this.bridge = bridge;
}
public void setBtm(int btm) {
this.btm = btm;
}
public void setChannel(int channel) {
this.channel = channel;
}
public void setDynamicBeacon(boolean dynamicBeacon) {
this.dynamicBeacon = dynamicBeacon;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public void setFtMobilityDomain(int ftMobilityDomain) {
this.ftMobilityDomain = ftMobilityDomain;
}
public void setFtPsk(int ftPsk) {
this.ftPsk = ftPsk;
}
public void setGroupRekey(int groupRekey) {
this.groupRekey = groupRekey;
}
public void setIfName(String ifName) {
this.ifName = ifName;
}
public void setMac(String mac) {
this.mac = mac;
}
public void setMacList(String macList) {
this.macList = macList;
}
public void setMinHwMode(String minHwMode) {
this.minHwMode = minHwMode;
}
public void setMode(String mode) {
this.mode = mode;
}
public void setParent(String parent) {
this.parent = parent;
}
public void setRrm(int rrm) {
this.rrm = rrm;
}
public void setSecurity(Map<String, String> security) {
this.security = security;
}
public void setSsid(String ssid) {
this.ssid = ssid;
}
public void setSsidBroadcast(String ssidBroadcast) {
this.ssidBroadcast = ssidBroadcast;
}
public void setState(String state) {
this.state = state;
}
public void setUapsdEnable(boolean uapsdEnable) {
this.uapsdEnable = uapsdEnable;
}
public void setVersion(Uuid version) {
this.version = version;
}
public void setVifRadioIdx(int vifRadioIdx) {
this.vifRadioIdx = vifRadioIdx;
}
public void setVlanId(int vlanId) {
this.vlanId = vlanId;
}
public void setWds(boolean wds) {
this.wds = wds;
}
}

View File

@@ -6,17 +6,22 @@ package com.telecominfraproject.wlan.opensync.external.integration.models;
import java.util.HashMap;
import java.util.Map;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
import com.vmware.ovsdb.protocol.operation.notation.Row;
import com.vmware.ovsdb.protocol.operation.notation.Uuid;
import com.vmware.ovsdb.protocol.operation.notation.Value;
/**
* @author mikehansen
*
*/
public class OpensyncAWLANNode extends BaseJsonModel {
public class OpensyncAWLANNode extends OpensyncAPBase {
private static final long serialVersionUID = -6172956297643126710L;
public static long getSerialversionuid() {
return serialVersionUID;
}
public Map<Object, Object> mqttSettings;
public String model;
public String skuNumber;
@@ -41,10 +46,10 @@ public class OpensyncAWLANNode extends BaseJsonModel {
public String managerAddr;
public boolean factoryReset;
public Uuid _uuid;
public Uuid version;
public OpensyncAWLANNode() {
super();
mqttSettings = new HashMap<>();
versionMatrix = new HashMap<>();
ledConfig = new HashMap<>();
@@ -52,208 +57,308 @@ public class OpensyncAWLANNode extends BaseJsonModel {
mqttTopics = new HashMap<>();
}
public Map<Object, Object> getMqttSettings() {
return mqttSettings;
public OpensyncAWLANNode(Row row) {
this();
Map<String, Value> map = row.getColumns();
if (map.get("mqtt_settings") != null) {
this.setMqttSettings(row.getMapColumn("mqtt_settings"));
}
if (map.get("mqtt_headers") != null) {
this.setMqttHeaders(row.getMapColumn("mqtt_headers"));
}
if (map.get("mqtt_topics") != null) {
this.setMqttHeaders(row.getMapColumn("mqtt_topics"));
}
public void setMqttSettings(Map<Object, Object> map) {
this.mqttSettings = map;
if ((map.get("model") != null)
&& map.get("model").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setModel(row.getStringColumn("model"));
}
if ((map.get("sku_number") != null)
&& map.get("sku_number").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setSkuNumber(row.getStringColumn("sku_number"));
}
if ((map.get("id") != null)
&& map.get("id").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setId(row.getStringColumn("id"));
}
public String getModel() {
return model;
if (map.get("version_matrix") != null) {
this.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)) {
this.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)) {
this.setFirmwareUrl(row.getStringColumn("firmware_url"));
}
public void setModel(String model) {
this.model = model;
if ((map.get("_uuid") != null)
&& map.get("_uuid").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.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)) {
this.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)) {
this.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)) {
this.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)) {
this.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)) {
this.setMaxBackoff(row.getIntegerColumn("max_backoff").intValue());
}
if (map.get("led_config") != null) {
this.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)) {
this.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)) {
this.setSerialNumber(row.getStringColumn("serial_number"));
}
if ((map.get("_version") != null)
&& map.get("_version").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setVersion(row.getUuidColumn("_version"));
}
public String getSkuNumber() {
return skuNumber;
this.setUpgradeStatus(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)) {
this.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)) {
this.setMinBackoff(row.getIntegerColumn("min_backoff").intValue());
}
public void setSkuNumber(String skuNumber) {
this.skuNumber = skuNumber;
if ((map.get("revision") != null)
&& map.get("revision").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setRevision(row.getStringColumn("revision"));
}
public String getId() {
return id;
if ((map.get("manager_addr") != null)
&& map.get("manager_addr").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setManagerAddr(row.getStringColumn("manager_addr"));
}
public void setId(String id) {
this.id = id;
if ((map.get("factory_reset") != null) && map.get("factory_reset").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setFactoryReset(row.getBooleanColumn("factory_reset"));
}
public Map<String, String> getVersionMatrix() {
return versionMatrix;
}
public void setVersionMatrix(Map<String, String> versionMatrix) {
this.versionMatrix = versionMatrix;
}
public String getFirmwareVersion() {
return firmwareVersion;
}
public void setFirmwareVersion(String firmwareVersion) {
this.firmwareVersion = firmwareVersion;
}
public String getFirmwareUrl() {
return firmwareUrl;
}
public void setFirmwareUrl(String firmwareUrl) {
this.firmwareUrl = firmwareUrl;
}
public int getUpgradeDlTimer() {
return upgradeDlTimer;
}
public void setUpgradeDlTimer(int upgradeDlTimer) {
this.upgradeDlTimer = upgradeDlTimer;
}
public String getPlatformVersion() {
return platformVersion;
}
public void setPlatformVersion(String platformVersion) {
this.platformVersion = platformVersion;
}
public String getFirmwarePass() {
return firmwarePass;
}
public void setFirmwarePass(String firmwarePass) {
this.firmwarePass = firmwarePass;
}
public int getUpgradeTimer() {
return upgradeTimer;
}
public void setUpgradeTimer(int upgradeTimer) {
this.upgradeTimer = upgradeTimer;
}
public int getMaxBackoff() {
return maxBackoff;
}
public void setMaxBackoff(int maxBackoff) {
this.maxBackoff = maxBackoff;
}
public Map<String, String> getLedConfig() {
return ledConfig;
}
public void setLedConfig(Map<String, String> ledConfig) {
this.ledConfig = ledConfig;
}
public String getRedirectorAddr() {
return redirectorAddr;
}
public void setRedirectorAddr(String redirectorAddr) {
this.redirectorAddr = redirectorAddr;
}
public Map<String, String> getMqttHeaders() {
return mqttHeaders;
}
public void setMqttHeaders(Map<String, String> mqttHeaders) {
this.mqttHeaders = mqttHeaders;
}
public String getSerialNumber() {
return serialNumber;
}
public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
public int getUpgradeStatus() {
return upgradeStatus;
}
public void setUpgradeStatus(int upgradeStatus) {
this.upgradeStatus = upgradeStatus;
}
public String getDeviceMode() {
return deviceMode;
}
public void setDeviceMode(String deviceMode) {
this.deviceMode = deviceMode;
}
public int getMinBackoff() {
return minBackoff;
}
public void setMinBackoff(int minBackoff) {
this.minBackoff = minBackoff;
}
public Map<String, String> getMqttTopics() {
return mqttTopics;
}
public void setMqttTopics(Map<String, String> mqttTopics) {
this.mqttTopics = mqttTopics;
}
public String getRevision() {
return revision;
}
public void setRevision(String revision) {
this.revision = revision;
}
public String getManagerAddr() {
return managerAddr;
}
public void setManagerAddr(String managerAddr) {
this.managerAddr = managerAddr;
}
public boolean isFactoryReset() {
return factoryReset;
}
public void setFactoryReset(boolean factoryReset) {
this.factoryReset = factoryReset;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public Uuid get_uuid() {
return _uuid;
}
public void set_uuid(Uuid _uuid) {
this._uuid = _uuid;
public String getDeviceMode() {
return deviceMode;
}
public String getFirmwarePass() {
return firmwarePass;
}
public String getFirmwareUrl() {
return firmwareUrl;
}
public String getFirmwareVersion() {
return firmwareVersion;
}
public String getId() {
return id;
}
public Map<String, String> getLedConfig() {
return ledConfig;
}
public String getManagerAddr() {
return managerAddr;
}
public int getMaxBackoff() {
return maxBackoff;
}
public int getMinBackoff() {
return minBackoff;
}
public String getModel() {
return model;
}
public Map<String, String> getMqttHeaders() {
return mqttHeaders;
}
public Map<Object, Object> getMqttSettings() {
return mqttSettings;
}
public Map<String, String> getMqttTopics() {
return mqttTopics;
}
public String getPlatformVersion() {
return platformVersion;
}
public String getRedirectorAddr() {
return redirectorAddr;
}
public String getRevision() {
return revision;
}
public String getSerialNumber() {
return serialNumber;
}
public String getSkuNumber() {
return skuNumber;
}
public int getUpgradeDlTimer() {
return upgradeDlTimer;
}
public int getUpgradeStatus() {
return upgradeStatus;
}
public int getUpgradeTimer() {
return upgradeTimer;
}
public Uuid getVersion() {
return version;
}
public Map<String, String> getVersionMatrix() {
return versionMatrix;
}
public boolean isFactoryReset() {
return factoryReset;
}
public void set_uuid(Uuid _uuid) {
this._uuid = _uuid;
}
public void setDeviceMode(String deviceMode) {
this.deviceMode = deviceMode;
}
public void setFactoryReset(boolean factoryReset) {
this.factoryReset = factoryReset;
}
public void setFirmwarePass(String firmwarePass) {
this.firmwarePass = firmwarePass;
}
public void setFirmwareUrl(String firmwareUrl) {
this.firmwareUrl = firmwareUrl;
}
public void setFirmwareVersion(String firmwareVersion) {
this.firmwareVersion = firmwareVersion;
}
public void setId(String id) {
this.id = id;
}
public void setLedConfig(Map<String, String> ledConfig) {
this.ledConfig = ledConfig;
}
public void setManagerAddr(String managerAddr) {
this.managerAddr = managerAddr;
}
public void setMaxBackoff(int maxBackoff) {
this.maxBackoff = maxBackoff;
}
public void setMinBackoff(int minBackoff) {
this.minBackoff = minBackoff;
}
public void setModel(String model) {
this.model = model;
}
public void setMqttHeaders(Map<String, String> mqttHeaders) {
this.mqttHeaders = mqttHeaders;
}
public void setMqttSettings(Map<Object, Object> map) {
this.mqttSettings = map;
}
public void setMqttTopics(Map<String, String> mqttTopics) {
this.mqttTopics = mqttTopics;
}
public void setPlatformVersion(String platformVersion) {
this.platformVersion = platformVersion;
}
public void setRedirectorAddr(String redirectorAddr) {
this.redirectorAddr = redirectorAddr;
}
public void setRevision(String revision) {
this.revision = revision;
}
public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
public void setSkuNumber(String skuNumber) {
this.skuNumber = skuNumber;
}
public void setUpgradeDlTimer(int upgradeDlTimer) {
this.upgradeDlTimer = upgradeDlTimer;
}
public void setUpgradeStatus(int upgradeStatus) {
this.upgradeStatus = upgradeStatus;
}
public void setUpgradeTimer(int upgradeTimer) {
this.upgradeTimer = upgradeTimer;
}
public void setVersion(Uuid version) {
this.version = version;
}
public void setVersionMatrix(Map<String, String> versionMatrix) {
this.versionMatrix = versionMatrix;
}
}

View File

@@ -4,19 +4,25 @@
package com.telecominfraproject.wlan.opensync.external.integration.models;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
import com.vmware.ovsdb.protocol.operation.notation.Row;
import com.vmware.ovsdb.protocol.operation.notation.Uuid;
import com.vmware.ovsdb.protocol.operation.notation.Value;
/**
* @author mikehansen
*
*/
public class OpensyncWifiAssociatedClients extends BaseJsonModel {
public class OpensyncWifiAssociatedClients extends OpensyncAPBase {
private static final long serialVersionUID = -7088651136971662138L;
public static long getSerialversionuid() {
return serialVersionUID;
}
public String keyId;
public String mac;
public String state;
@@ -25,85 +31,107 @@ public class OpensyncWifiAssociatedClients extends BaseJsonModel {
public String kick;
public String oftag;
public Uuid _uuid;
public Uuid version;
public OpensyncWifiAssociatedClients() {
super();
capabilities = new HashSet<>();
}
public String getKeyId() {
return keyId;
}
public OpensyncWifiAssociatedClients(Row row) {
this();
public void setKeyId(String keyId) {
this.keyId = keyId;
}
Map<String, Value> map = row.getColumns();
public String getMac() {
return mac;
if ((map.get("mac") != null)
&& map.get("mac").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setMac(row.getStringColumn("mac"));
}
public void setMac(String mac) {
this.mac = mac;
if (row.getSetColumn("capabilities") != null) {
this.setCapabilities(row.getSetColumn("capabilities"));
}
public String getState() {
return state;
if ((map.get("state") != null)
&& map.get("state").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setState(row.getStringColumn("state"));
}
public void setState(String state) {
this.state = state;
if ((map.get("_version") != null)
&& map.get("_version").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setVersion(row.getUuidColumn("_version"));
}
public Set<String> getCapabilities() {
return capabilities;
if ((map.get("_uuid") != null)
&& map.get("_uuid").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.setVersion(row.getUuidColumn("_uuid"));
}
public void setCapabilities(Set<String> set) {
this.capabilities = set;
}
public int getUapsd() {
return uapsd;
}
public void setUapsd(int uapsd) {
this.uapsd = uapsd;
}
public String getKick() {
return kick;
}
public void setKick(String kick) {
this.kick = kick;
}
public String getOftag() {
return oftag;
}
public void setOftag(String oftag) {
this.oftag = oftag;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public Uuid get_uuid() {
return _uuid;
}
public void set_uuid(Uuid _uuid) {
this._uuid = _uuid;
public Set<String> getCapabilities() {
return capabilities;
}
public String getKeyId() {
return keyId;
}
public String getKick() {
return kick;
}
public String getMac() {
return mac;
}
public String getOftag() {
return oftag;
}
public String getState() {
return state;
}
public int getUapsd() {
return uapsd;
}
public Uuid getVersion() {
return version;
}
public void set_uuid(Uuid _uuid) {
this._uuid = _uuid;
}
public void setCapabilities(Set<String> set) {
this.capabilities = set;
}
public void setKeyId(String keyId) {
this.keyId = keyId;
}
public void setKick(String kick) {
this.kick = kick;
}
public void setMac(String mac) {
this.mac = mac;
}
public void setOftag(String oftag) {
this.oftag = oftag;
}
public void setState(String state) {
this.state = state;
}
public void setUapsd(int uapsd) {
this.uapsd = uapsd;
}
public void setVersion(Uuid version) {
this.version = version;
}

View File

@@ -7,7 +7,6 @@ import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.vmware.ovsdb.protocol.operation.Operation;
@@ -21,12 +20,8 @@ import com.vmware.ovsdb.service.OvsdbClient;
@Component
public class OvsdbFirmwareConfig extends OvsdbDaoBase {
@Autowired
OvsdbGet ovsdbGet;
void configureFirmwareDownload(OvsdbClient ovsdbClient, String apId, String firmwareUrl, String firmwareVersion,
String username, String validationCode) throws Exception {
try {
LOG.debug("configureFirmwareDownload for {} to version {} url {} validationCode {} username {}", apId,
firmwareVersion, firmwareUrl, validationCode, username);
@@ -36,48 +31,36 @@ public class OvsdbFirmwareConfig extends OvsdbDaoBase {
updateColumns.put("firmware_pass", new Atom<>(validationCode));
updateColumns.put("firmware_url", new Atom<>(firmwareUrl));
updateColumns.put("upgrade_timer", new Atom<>(upgradeTimerSeconds));
Row row = new Row(updateColumns);
operations.add(new Update(awlanNodeDbTable, row));
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
for (OperationResult r : result) {
LOG.debug("Op Result {}", r);
}
} catch (Exception e) {
LOG.error("Could not download firmware {} to AP {}", firmwareVersion, apId, e);
throw new RuntimeException(e);
}
}
void configureFirmwareFlash(OvsdbClient ovsdbClient, String apId, String firmwareVersion, String username) {
try {
LOG.debug("configureFirmwareFlash on AP {} to load {} setting timer for {} seconds.", apId, firmwareVersion,
upgradeTimerSeconds);
List<Operation> operations = new ArrayList<>();
Map<String, Value> updateColumns = new HashMap<>();
updateColumns.put("upgrade_timer", new Atom<>(upgradeTimerSeconds));
Row row = new Row(updateColumns);
operations.add(new Update(awlanNodeDbTable, row));
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.join();
for (OperationResult r : result) {
LOG.debug("Op Result {}", r);
}
} catch (Exception e) {
LOG.error("Could not configure timer for flashing firmware {} on AP {}", firmwareVersion, apId, e);
throw new RuntimeException(e);
}
}

View File

@@ -17,7 +17,6 @@ import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.CommandConfigInfo;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.Hotspot20Config;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.Hotspot20IconConfig;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.Hotspot20OsuProviders;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.InterfaceInfo;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiInetConfigInfo;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiRadioConfigInfo;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiStatsConfigInfo;
@@ -110,16 +109,6 @@ public class OvsdbGet extends OvsdbDaoBase {
return ret;
}
@Deprecated
Map<String, InterfaceInfo> getProvisionedInterfaces(OvsdbClient ovsdbClient) {
Map<String, InterfaceInfo> ret = new HashMap<>();
for (Row row : getOvsdbTableRowsForCondition(ovsdbClient, interfaceDbTable, null)) {
InterfaceInfo interfaceInfo = new InterfaceInfo(row);
ret.put(interfaceInfo.name, interfaceInfo);
}
return ret;
}
Map<String, WifiInetConfigInfo> getProvisionedWifiInetConfigs(OvsdbClient ovsdbClient) {
Map<String, WifiInetConfigInfo> ret = new HashMap<>();
for (Row row : getOvsdbTableRowsForCondition(ovsdbClient, wifiInetConfigDbTable, null)) {

View File

@@ -1,17 +1,12 @@
package com.telecominfraproject.wlan.opensync.ovsdb.dao;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
import java.util.function.Consumer;
import org.springframework.stereotype.Component;
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPInetState;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPRadioState;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPVIFState;
@@ -21,72 +16,55 @@ import com.vmware.ovsdb.protocol.methods.RowUpdate;
import com.vmware.ovsdb.protocol.methods.TableUpdate;
import com.vmware.ovsdb.protocol.methods.TableUpdates;
import com.vmware.ovsdb.protocol.operation.notation.Row;
import com.vmware.ovsdb.protocol.operation.notation.Uuid;
import com.vmware.ovsdb.protocol.operation.notation.Value;
import com.vmware.ovsdb.service.OvsdbClient;
@Component
public class OvsdbMonitor extends OvsdbDaoBase {
List<OpensyncAPInetState> getInitialOpensyncApInetStateForRowUpdate(TableUpdates tableUpdates, String apId,
OvsdbClient ovsdbClient) {
LOG.info("getInitialOpensyncApInetStateForRowUpdate:");
LOG.debug("getInitialOpensyncApInetStateForRowUpdate:");
List<OpensyncAPInetState> ret = new ArrayList<>();
try {
LOG.info(wifiInetStateDbTable + "_" + apId + " initial monitor table state received {}", tableUpdates);
LOG.debug(wifiInetStateDbTable + "_" + apId + " initial monitor table state received {}", tableUpdates);
for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) {
for (RowUpdate rowUpdate : tableUpdate.getRowUpdates().values()) {
if (rowUpdate.getNew() != null) {
ret.addAll(getOpensyncApInetStateForRowUpdate(rowUpdate, apId, ovsdbClient));
}
}
}
} catch (Exception e) {
throw (e);
}
return ret;
}
List<OpensyncAPVIFState> getInitialOpensyncApVifStateForTableUpdates(TableUpdates tableUpdates, String apId,
OvsdbClient ovsdbClient) {
LOG.info("getInitialOpensyncApVifStateForTableUpdates:");
LOG.debug("getInitialOpensyncApVifStateForTableUpdates:");
List<OpensyncAPVIFState> ret = new ArrayList<>();
try {
LOG.info(wifiVifStateDbTable + "_" + apId + " initial monitor table state received {}", tableUpdates);
LOG.debug(wifiVifStateDbTable + "_" + apId + " initial monitor table state received {}", tableUpdates);
for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) {
for (RowUpdate rowUpdate : tableUpdate.getRowUpdates().values()) {
if (rowUpdate.getNew() != null) {
OpensyncAPVIFState tableState = processWifiVIFStateColumn(ovsdbClient, rowUpdate.getNew());
ret.add(tableState);
ret.add(new OpensyncAPVIFState(rowUpdate.getNew()));
}
}
}
} catch (Exception e) {
throw (e);
}
return ret;
}
List<OpensyncWifiAssociatedClients> getInitialOpensyncWifiAssociatedClients(TableUpdates tableUpdates, String apId,
OvsdbClient ovsdbClient) {
LOG.info("getInitialOpensyncWifiAssociatedClients:");
LOG.debug("getInitialOpensyncWifiAssociatedClients:");
List<OpensyncWifiAssociatedClients> ret = new ArrayList<>();
try {
LOG.info(wifiAssociatedClientsDbTable + "_" + apId + " initial monitor table state received {}",
LOG.debug(wifiAssociatedClientsDbTable + "_" + apId + " initial monitor table state received {}",
tableUpdates);
for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) {
@@ -97,237 +75,48 @@ public class OvsdbMonitor extends OvsdbDaoBase {
ret.addAll(getOpensyncWifiAssociatedClients(rowUpdate, apId, ovsdbClient));
}
}
}
} catch (Exception e) {
throw (e);
}
return ret;
}
List<OpensyncAPInetState> getOpensyncApInetStateForRowUpdate(RowUpdate rowUpdate, String apId,
OvsdbClient ovsdbClient) {
List<OpensyncAPInetState> ret = new ArrayList<>();
LOG.info("OvsdbDao::getOpensyncApInetStateForRowUpdate {} for apId {}", rowUpdate, apId);
try {
Row row = rowUpdate.getNew();
if (row == null) {
LOG.debug("OvsdbDao::getOpensyncApInetStateForRowUpdate {} for apId {}", rowUpdate, apId);
Row row = null;
if (rowUpdate.getNew() != null) {
if (rowUpdate.getOld() != null) {
row = rowUpdate.getOld();
row.getColumns().putAll(rowUpdate.getNew().getColumns());
}
} else {
row = rowUpdate.getOld();
}
OpensyncAPInetState tableState = new OpensyncAPInetState();
Map<String, Value> map = row.getColumns();
if ((map.get("NAT") != null)
&& map.get("NAT").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setNat(row.getBooleanColumn("NAT"));
}
if ((map.get("enabled") != null)
&& map.get("enabled").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setEnabled(row.getBooleanColumn("enabled"));
}
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"));
}
if ((map.get("if_type") != null)
&& map.get("if_type").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setIfType(row.getStringColumn("if_type"));
}
if (map.containsKey("dhcpc")) {
tableState.setDhcpc(row.getMapColumn("dhcpc"));
}
if (map.containsKey("dhcpd")) {
tableState.setDhcpd(row.getMapColumn("dhcpd"));
}
if (map.containsKey("dns")) {
tableState.setDns(row.getMapColumn("dns"));
}
if (map.get("inet_addr") != null && map.get("inet_addr").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setInetAddr(row.getStringColumn("inet_addr"));
}
if (map.containsKey("netmask")) {
tableState.setNetmask(getSingleValueFromSet(row, "netmask"));
}
if (map.get("vlan_id") != null
&& map.get("vlan_id").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setVlanId(row.getIntegerColumn("vlan_id").intValue());
}
if (map.get("gre_ifname") != null && map.get("gre_ifname").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setGreIfName(row.getStringColumn("gre_ifname"));
}
if (map.get("gre_remote_inet_addr") != null && map.get("gre_remote_inet_addr").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setGreRemoteInetAddr(row.getStringColumn("gre_remote_inet_addr"));
}
if (map.get("gre_local_inet_addr") != null && map.get("gre_local_inet_addr").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setGreLocalInetAddr(row.getStringColumn("gre_local_inet_addr"));
}
if (map.get("gre_remote_mac_addr") != null && map.get("gre_remote_mac_addr").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setGreRemoteMacAddr(row.getStringColumn("gre_remote_mac_addr"));
}
if ((map.get("ip_assign_scheme") != null) && map.get("ip_assign_scheme").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setIpAssignScheme(row.getStringColumn("ip_assign_scheme"));
}
if ((map.get("network") != null)
&& map.get("network").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setNetwork(row.getBooleanColumn("network"));
}
if ((map.get("hwaddr") != null)
&& map.get("hwaddr").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setHwAddr(row.getStringColumn("hwaddr"));
}
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);
} catch (Exception e) {
LOG.error("Could not parse update for Wifi_Inet_State", e);
throw new RuntimeException(e);
if (row != null) {
ret.add(new OpensyncAPInetState(row));
}
return ret;
}
List<OpensyncAPRadioState> getOpensyncAPRadioState(TableUpdates tableUpdates, String apId,
OvsdbClient ovsdbClient) {
List<OpensyncAPRadioState> ret = new ArrayList<>();
try {
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) {
OpensyncAPRadioState tableState = new OpensyncAPRadioState();
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 ((map.get("channel") != null) && map.get("channel").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setChannel(row.getIntegerColumn("channel").intValue());
}
if ((map.get("freq_band") != null) && map.get("freq_band").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
String frequencyBand = row.getStringColumn("freq_band");
switch (frequencyBand) {
case "2.4G":
tableState.setFreqBand(RadioType.is2dot4GHz);
break;
case "5G":
tableState.setFreqBand(RadioType.is5GHz);
break;
case "5GL":
tableState.setFreqBand(RadioType.is5GHzL);
break;
case "5GU":
tableState.setFreqBand(RadioType.is5GHzU);
break;
default:
tableState.setFreqBand(RadioType.UNSUPPORTED);
}
}
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"));
}
if ((map.get("channel_mode") != null) && map.get("channel_mode").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setChannelMode(row.getStringColumn("channel_mode"));
}
if ((map.get("country") != null) && map.get("country").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setCountry(row.getStringColumn("country").toUpperCase());
}
if ((map.get("enabled") != null) && map.get("enabled").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setEnabled(row.getBooleanColumn("enabled"));
}
if ((map.get("ht_mode") != null) && map.get("ht_mode").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setHtMode(row.getStringColumn("ht_mode"));
}
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"));
}
if (map.get("allowed_channels") != null) {
Set<Long> allowedChannels = getSet(row, "allowed_channels");
Set<Integer> allowed = new HashSet<>();
for (Long channel : allowedChannels) {
allowed.add(channel.intValue());
}
tableState.setAllowedChannels(allowed);
}
if (map.get("channels") != null) {
Map<String, String> channels = row.getMapColumn("channels");
tableState.setChannels(channels);
}
Set<Uuid> vifStates = row.getSetColumn("vif_states");
tableState.setVifStates(vifStates);
ret.add(tableState);
ret.add(new OpensyncAPRadioState(row));
}
}
}
ret.stream().forEach(new Consumer<OpensyncAPRadioState>() {
@Override
public void accept(OpensyncAPRadioState wrs) {
LOG.debug("Wifi_Radio_State row {}", wrs);
}
});
} catch (Exception e) {
LOG.error("Could not parse update for Wifi_Radio_State", e);
throw new RuntimeException(e);
}
return ret;
}
@@ -335,16 +124,13 @@ public class OvsdbMonitor extends OvsdbDaoBase {
OvsdbClient ovsdbClient) {
List<OpensyncAPVIFState> ret = new ArrayList<>();
try {
Row row = rowUpdate.getNew(); // add/modify/init
if (row == null) {
row = rowUpdate.getOld(); // delete/modify
}
OpensyncAPVIFState tableState = processWifiVIFStateColumn(ovsdbClient, row);
ret.add(tableState);
if (row != null) {
ret.add(new OpensyncAPVIFState(row));
}
} catch (Exception e) {
LOG.error("Could not parse update for Wifi_VIF_State", e);
throw new RuntimeException(e);
@@ -355,271 +141,32 @@ public class OvsdbMonitor extends OvsdbDaoBase {
OpensyncAWLANNode getOpensyncAWLANNode(TableUpdates tableUpdates, String apId, OvsdbClient ovsdbClient) {
OpensyncAWLANNode tableState = new OpensyncAWLANNode();
try {
for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) {
for (RowUpdate rowUpdate : tableUpdate.getRowUpdates().values()) {
Row row = rowUpdate.getNew();
if (row != null) {
Map<String, Value> map = row.getColumns();
if (map.get("mqtt_settings") != null) {
tableState.setMqttSettings(row.getMapColumn("mqtt_settings"));
}
if (map.get("mqtt_headers") != null) {
tableState.setMqttHeaders(row.getMapColumn("mqtt_headers"));
}
if (map.get("mqtt_topics") != null) {
tableState.setMqttHeaders(row.getMapColumn("mqtt_topics"));
}
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"));
}
tableState.setUpgradeStatus(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"));
tableState = new OpensyncAWLANNode(row);
}
}
}
}
} catch (Exception e) {
LOG.error("Failed to handle AWLAN_Node update", e);
throw new RuntimeException(e);
}
return tableState;
}
List<OpensyncWifiAssociatedClients> getOpensyncWifiAssociatedClients(RowUpdate rowUpdate, String apId,
OvsdbClient ovsdbClient) {
List<OpensyncWifiAssociatedClients> ret = new ArrayList<>();
Row row = rowUpdate.getNew();
if (row == null) {
row = rowUpdate.getOld();
}
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 != null) {
return List.of(new OpensyncWifiAssociatedClients(row));
} else {
return List.of();
}
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.getStringColumn("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(new Consumer<OpensyncWifiAssociatedClients>() {
@Override
public void accept(OpensyncWifiAssociatedClients wrs) {
LOG.debug("Wifi_Associated_Clients row {}", wrs);
}
});
return ret;
}
OpensyncAPVIFState processWifiVIFStateColumn(OvsdbClient ovsdbClient, Row row) {
OpensyncAPVIFState tableState = new OpensyncAPVIFState();
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 ((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());
}
if ((map.get("channel") != null)
&& map.get("channel").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setChannel(row.getIntegerColumn("channel").intValue());
}
if ((map.get("enabled") != null)
&& map.get("enabled").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setEnabled(row.getBooleanColumn("enabled"));
}
Long ftPsk = getSingleValueFromSet(row, "ft_psk");
if (ftPsk != null) {
tableState.setFtPsk(ftPsk.intValue());
}
Long ftMobilityDomain = getSingleValueFromSet(row, "ft_mobility_domain");
if (ftMobilityDomain != null) {
tableState.setFtMobilityDomain(ftMobilityDomain.intValue());
}
if ((map.get("group_rekey") != null)
&& map.get("group_rekey").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
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"));
}
if ((map.get("mode") != null)
&& map.get("mode").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setMode(row.getStringColumn("mode"));
}
if ((map.get("rrm") != null)
&& map.get("rrm").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
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"));
}
if ((map.get("ssid_broadcast") != null) && map.get("ssid_broadcast").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
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());
}
List<Uuid> associatedClientsList = new ArrayList<>();
Set<Uuid> clients = row.getSetColumn("associated_clients");
associatedClientsList.addAll(clients);
tableState.setAssociatedClients(associatedClientsList);
if (map.get("security") != null) {
tableState.setSecurity(row.getMapColumn("security"));
}
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"));
}
return tableState;
}
}

View File

@@ -48,14 +48,6 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
OvsdbGet ovsdbGet;
void configureGreTunnel(OvsdbClient ovsdbClient, Profile apNetworkConfiguration) {
// NAT false
// if_name gre1
// if_type gre
// gre_local_inet_addr (Not needed): WAN IP shall be used
// gre_remote_inet_addr <Tunnel end point IP address>
// gre_ifname: Not needed
try {
LOG.debug("Configure Gre Tunnel {}", apNetworkConfiguration);
List<Operation> operations = new ArrayList<>();
@@ -189,7 +181,6 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
void configureInetVifInterface(OvsdbClient ovsdbClient, String vifInterfaceName, boolean enabled,
NetworkForwardMode networkForwardMode) {
Map<String, WifiInetConfigInfo> inetConfigs = ovsdbGet.getProvisionedWifiInetConfigs(ovsdbClient);
if (inetConfigs.containsKey(vifInterfaceName)) {
configureInetInterface(ovsdbClient, vifInterfaceName, enabled, "vif", true,
(networkForwardMode == NetworkForwardMode.NAT));
@@ -209,44 +200,28 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
void createVlanInterfaceInGreTunnel(OvsdbClient ovsdbClient, int vlanId, String greTunnel) {
try {
// if_name gre_<vlan id>
// if_type vlan
// parent_ifname gre
// vlan_id <vlan id>
List<Operation> operations = new ArrayList<>();
Map<String, Value> tableColumns = new HashMap<>();
Map<String, WifiInetConfigInfo> inetConfigMap = ovsdbGet.getProvisionedWifiInetConfigs(ovsdbClient);
WifiInetConfigInfo parentTunnel = inetConfigMap.get(greTunnel);
if (parentTunnel == null) {
throw new RuntimeException("Cannot get tunnel interface " + parentTunnel + " for vlan " + vlanId);
}
tableColumns = new HashMap<>();
tableColumns.put("if_type", new Atom<>("bridge"));
tableColumns.put("vlan_id", new Atom<>(vlanId));
tableColumns.put("if_name", new Atom<>(parentTunnel.ifName + "_" + Integer.toString(vlanId)));
tableColumns.put("parent_ifname", new Atom<>(parentTunnel.ifName));
tableColumns.put("enabled", new Atom<>(true));
tableColumns.put("network", new Atom<>(true));
Row row = new Row(tableColumns);
operations.add(new Insert(wifiInetConfigDbTable, row));
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
for (OperationResult res : result) {
if (res instanceof InsertResult) {
LOG.info("createVlanNetworkInterfaces {}", ((InsertResult) res).toString());
} else if (res instanceof UpdateResult) {
LOG.info("createVlanNetworkInterfaces {}", ((UpdateResult) res).toString());
} else if (res instanceof ErrorResult) {
LOG.error("createVlanNetworkInterfaces error {}", (res));
@@ -254,12 +229,9 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
+ ((ErrorResult) res).getDetails());
}
}
inetConfigMap = ovsdbGet.getProvisionedWifiInetConfigs(ovsdbClient);
LOG.debug("Provisioned vlan on greTunnel {}",
inetConfigMap.get(parentTunnel.ifName + "_" + Integer.toString(vlanId)));
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in provisioning Vlan", e);
throw new RuntimeException(e);
@@ -269,18 +241,14 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
void createVlanNetworkInterfaces(OvsdbClient ovsdbClient, int vlanId) {
try {
List<Operation> operations = new ArrayList<>();
Map<String, Value> tableColumns = new HashMap<>();
Map<String, WifiInetConfigInfo> inetConfigMap = ovsdbGet.getProvisionedWifiInetConfigs(ovsdbClient);
WifiInetConfigInfo parentLanInterface = inetConfigMap.get(defaultLanInterfaceName);
if (parentLanInterface == null) {
throw new RuntimeException(
"Cannot get lan interface " + defaultLanInterfaceName + " for vlan " + vlanId);
}
tableColumns.put("if_type", new Atom<>("vlan"));
tableColumns.put("vlan_id", new Atom<>(vlanId));
tableColumns.put("if_name", new Atom<>(parentLanInterface.ifName + "_" + Integer.toString(vlanId)));
@@ -290,33 +258,26 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
tableColumns.put("ip_assign_scheme", new Atom<>(parentLanInterface.ipAssignScheme));
tableColumns.put("NAT", new Atom<>(parentLanInterface.nat));
tableColumns.put("mtu", new Atom<>(1500));
String[] inetAddress = parentLanInterface.inetAddr.split("\\.");
String vlanAddress = inetAddress[0] + "." + inetAddress[1] + "." + vlanId + "." + inetAddress[3];
tableColumns.put("inet_addr", new Atom<>(vlanAddress));
tableColumns.put("netmask", new Atom<>(parentLanInterface.netmask));
tableColumns.put("dhcpd", com.vmware.ovsdb.protocol.operation.notation.Map.of(parentLanInterface.dhcpd));
Row row = new Row(tableColumns);
if (inetConfigMap.containsKey(parentLanInterface.ifName + "_" + Integer.toString(vlanId))) {
List<Condition> conditions = new ArrayList<>();
conditions.add(new Condition("vlan_id", Function.EQUALS, new Atom<>(vlanId)));
conditions.add(new Condition("parent_ifname", Function.EQUALS, new Atom<>(parentLanInterface.ifName)));
operations.add(new Update(wifiInetConfigDbTable, conditions, row));
} else {
operations.add(new Insert(wifiInetConfigDbTable, row));
}
WifiInetConfigInfo parentWanInterface = inetConfigMap.get(defaultWanInterfaceName);
if (parentWanInterface == null) {
throw new RuntimeException(
"Cannot get wan interface " + defaultWanInterfaceName + " for vlan " + vlanId);
}
tableColumns = new HashMap<>();
tableColumns.put("if_type", new Atom<>("vlan"));
tableColumns.put("vlan_id", new Atom<>(vlanId));
tableColumns.put("if_name", new Atom<>(parentWanInterface.ifName + "_" + Integer.toString(vlanId)));
@@ -325,11 +286,8 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
tableColumns.put("network", new Atom<>(true));
tableColumns.put("ip_assign_scheme", new Atom<>(parentWanInterface.ipAssignScheme));
tableColumns.put("NAT", new Atom<>(parentWanInterface.nat));
tableColumns.put("mtu", new Atom<>(1500));
row = new Row(tableColumns);
if (inetConfigMap.containsKey(parentWanInterface.ifName + "_" + Integer.toString(vlanId))) {
List<Condition> conditions = new ArrayList<>();
conditions.add(new Condition("vlan_id", Function.EQUALS, new Atom<>(vlanId)));
@@ -337,16 +295,12 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
} else {
operations.add(new Insert(wifiInetConfigDbTable, row));
}
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
for (OperationResult res : result) {
if (res instanceof InsertResult) {
LOG.info("createVlanNetworkInterfaces {}", ((InsertResult) res).toString());
} else if (res instanceof UpdateResult) {
LOG.info("createVlanNetworkInterfaces {}", ((UpdateResult) res).toString());
} else if (res instanceof ErrorResult) {
LOG.error("createVlanNetworkInterfaces error {}", (res));
@@ -354,18 +308,14 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
+ ((ErrorResult) res).getDetails());
}
}
inetConfigMap = ovsdbGet.getProvisionedWifiInetConfigs(ovsdbClient);
LOG.debug("Provisioned vlan on wan {} and lan {}",
inetConfigMap.get(parentWanInterface.ifName + "_" + Integer.toString(vlanId)),
inetConfigMap.get(parentLanInterface.ifName + "_" + Integer.toString(vlanId)));
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in provisioning Vlan", e);
throw new RuntimeException(e);
}
}
void createVlanNetworkInterfaces(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) {
@@ -377,25 +327,19 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
}
}
for (Integer vlanId : vlans) {
Optional<GreTunnelConfiguration> tunnelConfiguration = ((ApNetworkConfiguration) opensyncApConfig
.getApProfile().getDetails()).getGreTunnelConfigurations().stream()
.filter(new Predicate<GreTunnelConfiguration>() {
@Override
public boolean test(GreTunnelConfiguration t) {
return t.getVlanIdsInGreTunnel().contains(vlanId);
}
}).findFirst();
if (tunnelConfiguration.isPresent()) {
createVlanInterfaceInGreTunnel(ovsdbClient, vlanId, tunnelConfiguration.get().getGreTunnelName());
} else {
createVlanNetworkInterfaces(ovsdbClient, vlanId);
}
}
}
@@ -405,9 +349,7 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
.getProvisionedWifiInetConfigs(ovsdbClient).values();
List<Operation> operations = new ArrayList<>();
List<Condition> conditions = new ArrayList<>();
for (WifiInetConfigInfo wifiInetConfigInfo : provisionedWifiInetConfigs) {
if (wifiInetConfigInfo.vlanId > 1 || wifiInetConfigInfo.ifType.equals("vif")
|| wifiInetConfigInfo.ifName.startsWith("gre") || wifiInetConfigInfo.ifType.equals("gre")) {
conditions = new ArrayList<>();
@@ -417,21 +359,16 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
}
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
LOG.info("Removed all existing vif, vlan, and gre interface configs from {}:", wifiInetConfigDbTable);
for (OperationResult res : result) {
LOG.info("Op Result {}", res);
}
provisionedWifiInetConfigs = ovsdbGet.getProvisionedWifiInetConfigs(ovsdbClient).values();
for (WifiInetConfigInfo inetConfigInfo : provisionedWifiInetConfigs) {
if (inetConfigInfo.ifType.equals("vif") || inetConfigInfo.ifType.equals("gre")) {
throw new RuntimeException(
"Failed to remove all vif and gre interface configurations from Wifi_Inet_Config dbTable, still has "
+ provisionedWifiInetConfigs.stream().filter(new Predicate<WifiInetConfigInfo>() {
@Override
public boolean test(WifiInetConfigInfo t) {
if ((t.ifType.equals("vif")) || (t.ifType.equals("gre"))) {
@@ -439,17 +376,13 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase {
}
return false;
}
}).collect(Collectors.toList()));
}
}
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in removeAllInetConfigs", e);
throw new RuntimeException(e);
}
}
}