diff --git a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/ConnectNodeInfo.java b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/ConnectNodeInfo.java index e628816..a2f26a9 100644 --- a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/ConnectNodeInfo.java +++ b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/ConnectNodeInfo.java @@ -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 + "]"; } - } diff --git a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPBase.java b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPBase.java new file mode 100644 index 0000000..76f84f1 --- /dev/null +++ b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPBase.java @@ -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 getSingleValueFromSet(Row row, String columnName) { + + Set set = row != null ? row.getSetColumn(columnName) : null; + T ret = (set != null) && !set.isEmpty() ? set.iterator().next() : null; + + return ret; + } + + public OpensyncAPBase() { + } + + public Set getSet(Row row, String columnName) { + + Set set = row != null ? row.getSetColumn(columnName) : null; + + return set; + } + +} \ No newline at end of file diff --git a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPConfig.java b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPConfig.java index 2186ba8..69d6f24 100644 --- a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPConfig.java +++ b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPConfig.java @@ -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 captiveProfiles; private List bonjourGatewayProfiles; + private List 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 ssidList = new ArrayList(); + for (Profile profile : ssidProfile) { + ssidList.add(profile.clone()); + } + ret.ssidProfile = ssidList; + } + if (metricsProfile != null) { + List metricsList = new ArrayList(); + for (Profile profile : metricsProfile) { + metricsList.add(profile.clone()); + } + ret.metricsProfile = metricsList; + } + if (bonjourGatewayProfiles != null) { + List bonjourGatewayProfilesList = new ArrayList(); + 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(); + 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 getBlockedClients() { + return blockedClients; + } + + public List getBonjourGatewayProfiles() { + return bonjourGatewayProfiles; + } + + public List 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 getMetricsProfiles() { + return metricsProfile; + } + + public List getRadiusProfiles() { + return radiusProfiles; + } + + public Profile getRfProfile() { + return rfProfile; + } + + public List 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 blockedClients) { + this.blockedClients = blockedClients; + } + + public void setBonjourGatewayProfiles(List bonjourGatewayProfiles) { + this.bonjourGatewayProfiles = bonjourGatewayProfiles; + } + + public void setCaptiveProfiles(List 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 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 radiusProfiles) { + this.radiusProfiles = radiusProfiles; + } + + public void setRfProfile(Profile rfProfile) { + this.rfProfile = rfProfile; + } + // Handle Legacy Config Support public void setSsidConfigs(List 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(); + } 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 getSsidProfile() { - return ssidProfile; - } - public void setSsidProfile(List ssidProfile) { this.ssidProfile = ssidProfile; } - public List getBonjourGatewayProfiles() { - return bonjourGatewayProfiles; - } - - public void setBonjourGatewayProfiles(List 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 ssidList = new ArrayList(); - for (Profile profile : ssidProfile) { - ssidList.add(profile.clone()); - } - ret.ssidProfile = ssidList; - } - if (metricsProfile != null) { - List metricsList = new ArrayList(); - for (Profile profile : metricsProfile) { - metricsList.add(profile.clone()); - } - ret.metricsProfile = metricsList; - } - if (bonjourGatewayProfiles != null) { - List bonjourGatewayProfilesList = new ArrayList(); - 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(); - for (MacAddress blockedClient : this.blockedClients) { - ret.blockedClients.add(blockedClient); - } - } - - return ret; - } - - public List getRadiusProfiles() { - return radiusProfiles; - } - - public void setRadiusProfiles(List radiusProfiles) { - this.radiusProfiles = radiusProfiles; - } - - public List getCaptiveProfiles() { - return captiveProfiles; - } - - public void setCaptiveProfiles(List captiveProfiles) { - this.captiveProfiles = captiveProfiles; - } - - public List getBlockedClients() { - return blockedClients; - } - - public void setBlockedClients(List blockedClients) { - this.blockedClients = blockedClients; - } - - public void setMetricsProfiles(List metricsProfileList) { - metricsProfile = metricsProfileList; - } - - public List 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); - } - } diff --git a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPHotspot20Config.java b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPHotspot20Config.java index 0c15397..4ecb730 100644 --- a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPHotspot20Config.java +++ b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPHotspot20Config.java @@ -4,13 +4,12 @@ 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; - + public static long getSerialversionuid() { return serialVersionUID; } @@ -20,40 +19,6 @@ public class OpensyncAPHotspot20Config extends BaseJsonModel { private Set hotspot20VenueSet; private Set hotspot20ProviderSet; - - - public Set getHotspot20ProfileSet() { - return hotspot20ProfileSet; - } - - public void setHotspot20ProfileSet(Set hotspot20ProfileSet) { - this.hotspot20ProfileSet = hotspot20ProfileSet; - } - - public Set getHotspot20OperatorSet() { - return hotspot20OperatorSet; - } - - public void setHotspot20OperatorSet(Set hotspot20OperatorSet) { - this.hotspot20OperatorSet = hotspot20OperatorSet; - } - - public Set getHotspot20VenueSet() { - return hotspot20VenueSet; - } - - public void setHotspot20VenueSet(Set hotspot20VenueSet) { - this.hotspot20VenueSet = hotspot20VenueSet; - } - - public Set getHotspot20ProviderSet() { - return hotspot20ProviderSet; - } - - public void setHotspot20ProviderSet(Set 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 getHotspot20OperatorSet() { + return hotspot20OperatorSet; + } + + public Set getHotspot20ProfileSet() { + return hotspot20ProfileSet; + } + + public Set getHotspot20ProviderSet() { + return hotspot20ProviderSet; + } + + public Set getHotspot20VenueSet() { + return hotspot20VenueSet; + } + + @Override + public int hashCode() { + return Objects.hash(hotspot20OperatorSet, hotspot20ProfileSet, hotspot20ProviderSet, hotspot20VenueSet); + } + + public void setHotspot20OperatorSet(Set hotspot20OperatorSet) { + this.hotspot20OperatorSet = hotspot20OperatorSet; + } + + public void setHotspot20ProfileSet(Set hotspot20ProfileSet) { + this.hotspot20ProfileSet = hotspot20ProfileSet; + } + + public void setHotspot20ProviderSet(Set hotspot20ProviderSet) { + this.hotspot20ProviderSet = hotspot20ProviderSet; + } + + public void setHotspot20VenueSet(Set hotspot20VenueSet) { + this.hotspot20VenueSet = hotspot20VenueSet; + } + } diff --git a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPInetState.java b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPInetState.java index 6be5b8a..1c18f5f 100644 --- a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPInetState.java +++ b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPInetState.java @@ -2,457 +2,479 @@ 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; + private static final long serialVersionUID = 1707053648715030173L; - public String ifName; - public Map dhcpd; - public String unpnpMode; - public String ifType; - public String softwdsMacAddr; - public boolean enabled; - public boolean sofwdsWrap; - public int vlanId; - public String netmask; - public boolean nat; - public String greRemoteInetAddr; - public String ifUuid; - public String inetAddr; - public String hwAddr; - public int mtw; - public boolean network; - public Map dns; - public String parentIfName; - public String greIfName; - public String broadcast; - public Map dhcpc; - public String gateway; - public String ipAssignScheme; - public String inetConfig; - public Uuid _uuid; - public Uuid version; - public String greLocalInetAddr; - public String greRemoteMacAddr; + public static long getSerialversionuid() { + return serialVersionUID; + } - public OpensyncAPInetState() { - super(); - dns = new HashMap<>(); - dhcpc = new HashMap<>(); - } + public String ifName; + public Map dhcpd; + public String unpnpMode; + public String ifType; + public String softwdsMacAddr; + public boolean enabled; + public boolean sofwdsWrap; + public int vlanId; + public String netmask; + public boolean nat; + public String greRemoteInetAddr; + public String ifUuid; + public String inetAddr; + public String hwAddr; + public int mtw; + public boolean network; + public Map dns; + public String parentIfName; + public String greIfName; + public String broadcast; + public Map dhcpc; + public String gateway; + public String ipAssignScheme; + public String inetConfig; + public Uuid _uuid; + public Uuid version; + public String greLocalInetAddr; - public String getIfName() { - return ifName; - } + public String greRemoteMacAddr; - public void setIfName(String ifName) { - this.ifName = ifName; - } + public OpensyncAPInetState() { + dns = new HashMap<>(); + dhcpc = new HashMap<>(); + } - public Map getDhcpd() { - return dhcpd; - } + public OpensyncAPInetState(Row row) { + dns = new HashMap<>(); + dhcpc = new HashMap<>(); - public void setDhcpd(Map dhcpd) { - this.dhcpd = dhcpd; - } + Map map = row.getColumns(); - public String getUnpnpMode() { - return unpnpMode; - } + 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 setUnpnpMode(String unpnpMode) { - this.unpnpMode = unpnpMode; - } + 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 String getIfType() { - return ifType; - } + 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 setIfType(String ifType) { - this.ifType = ifType; - } + @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 (!Objects.equals(_uuid, other._uuid)) { + return false; + } + if (!Objects.equals(broadcast, other.broadcast)) { + return false; + } + if (!Objects.equals(dhcpc, other.dhcpc)) { + return false; + } + if (!Objects.equals(dhcpd, other.dhcpd)) { + return false; + } + if (!Objects.equals(dns, other.dns)) { + return false; + } + if (enabled != other.enabled) { + return false; + } + if (!Objects.equals(gateway, other.gateway)) { + return false; + } + if (!Objects.equals(greIfName, other.greIfName)) { + return false; + } + if (!Objects.equals(greLocalInetAddr, other.greLocalInetAddr)) { + return false; + } + if (!Objects.equals(greRemoteInetAddr, other.greRemoteInetAddr)) { + return false; + } + if (!Objects.equals(hwAddr, other.hwAddr)) { + return false; + } + if (!Objects.equals(ifName, other.ifName)) { + return false; + } + if (!Objects.equals(ifType, other.ifType)) { + return false; + } + if (!Objects.equals(ifUuid, other.ifUuid)) { + return false; + } + if (!Objects.equals(inetAddr, other.inetAddr)) { + return false; + } + if (!Objects.equals(inetConfig, other.inetConfig)) { + return false; + } + if (!Objects.equals(ipAssignScheme, other.ipAssignScheme)) { + return false; + } + if (mtw != other.mtw) { + return false; + } + if (nat != other.nat) { + return false; + } + if (!Objects.equals(netmask, other.netmask)) { + return false; + } + if (network != other.network) { + return false; + } + if (!Objects.equals(parentIfName, other.parentIfName)) { + return false; + } + if (!Objects.equals(greRemoteMacAddr, other.greRemoteMacAddr)) { + return false; + } + if (!Objects.equals(softwdsMacAddr, other.softwdsMacAddr)) { + return false; + } + if (sofwdsWrap != other.sofwdsWrap) { + return false; + } + if (!Objects.equals(unpnpMode, other.unpnpMode)) { + return false; + } + if (!Objects.equals(version, other.version)) { + return false; + } + if (vlanId != other.vlanId) { + return false; + } + return true; + } - public String getSoftwdsMacAddr() { - return softwdsMacAddr; - } + public Uuid get_uuid() { + return _uuid; + } - public void setSoftwdsMacAddr(String softwdsMacAddr) { - this.softwdsMacAddr = softwdsMacAddr; - } + public String getBroadcast() { + return broadcast; + } - public boolean isEnabled() { - return enabled; - } + public Map getDhcpc() { + return dhcpc; + } - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } + public Map getDhcpd() { + return dhcpd; + } - public boolean isSofwdsWrap() { - return sofwdsWrap; - } + public Map getDns() { + return dns; + } - public void setSofwdsWrap(boolean sofwdsWrap) { - this.sofwdsWrap = sofwdsWrap; - } + public String getGateway() { + return gateway; + } - public int getVlanId() { - return vlanId; - } + public String getGreIfName() { + return greIfName; + } - public void setVlanId(int vlanId) { - this.vlanId = vlanId; - } + public String getGreLocalInetAddr() { + return greLocalInetAddr; + } - public String getNetmask() { - return netmask; - } + public String getGreRemoteInetAddr() { + return greRemoteInetAddr; + } - public void setNetmask(String netmask) { - this.netmask = netmask; - } + public String getGreRemoteMacAddr() { + return this.greRemoteMacAddr; + } - public boolean isNat() { - return nat; - } + public String getHwAddr() { + return hwAddr; + } - public void setNat(boolean nat) { - this.nat = nat; - } + public String getIfName() { + return ifName; + } - public String getGreRemoteInetAddr() { - return greRemoteInetAddr; - } + public String getIfType() { + return ifType; + } - public void setGreRemoteInetAddr(String greRemoteInetAddr) { - this.greRemoteInetAddr = greRemoteInetAddr; - } + public String getIfUuid() { + return ifUuid; + } - public String getIfUuid() { - return ifUuid; - } + public String getInetAddr() { + return inetAddr; + } - public void setIfUuid(String ifUuid) { - this.ifUuid = ifUuid; - } + public String getInetConfig() { + return inetConfig; + } - public String getInetAddr() { - return inetAddr; - } + public String getIpAssignScheme() { + return ipAssignScheme; + } - public void setInetAddr(String inetAddr) { - this.inetAddr = inetAddr; - } + public int getMtw() { + return mtw; + } - public String getHwAddr() { - return hwAddr; - } + public String getNetmask() { + return netmask; + } - public void setHwAddr(String hwAddr) { - this.hwAddr = hwAddr; - } + public String getParentIfName() { + return parentIfName; + } - public int getMtw() { - return mtw; - } + public String getSoftwdsMacAddr() { + return softwdsMacAddr; + } - public void setMtw(int mtw) { - this.mtw = mtw; - } + public String getUnpnpMode() { + return unpnpMode; + } - public boolean isNetwork() { - return network; - } + public Uuid getVersion() { + return version; + } - public void setNetwork(boolean network) { - this.network = network; - } + public int getVlanId() { + return vlanId; + } - public Map getDns() { - return dns; - } + @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 void setDns(Map dns) { - this.dns = dns; - } + public boolean isEnabled() { + return enabled; + } - public String getParentIfName() { - return parentIfName; - } + public boolean isNat() { + return nat; + } - public void setParentIfName(String parentIfName) { - this.parentIfName = parentIfName; - } + public boolean isNetwork() { + return network; + } - public String getGreIfName() { - return greIfName; - } + public boolean isSofwdsWrap() { + return sofwdsWrap; + } - public void setGreIfName(String greIfName) { - this.greIfName = greIfName; - } + public void set_uuid(Uuid _uuid) { + this._uuid = _uuid; + } - public String getBroadcast() { - return broadcast; - } + public void setBroadcast(String broadcast) { + this.broadcast = broadcast; + } - public void setBroadcast(String broadcast) { - this.broadcast = broadcast; - } + public void setDhcpc(Map dhcpc) { + this.dhcpc = dhcpc; + } - public Map getDhcpc() { - return dhcpc; - } + public void setDhcpd(Map dhcpd) { + this.dhcpd = dhcpd; + } - public void setDhcpc(Map dhcpc) { - this.dhcpc = dhcpc; - } + public void setDns(Map dns) { + this.dns = dns; + } - public String getGateway() { - return gateway; - } + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } - public void setGateway(String gateway) { - this.gateway = gateway; - } + public void setGateway(String gateway) { + this.gateway = gateway; + } - public String getIpAssignScheme() { - return ipAssignScheme; - } + public void setGreIfName(String greIfName) { + this.greIfName = greIfName; + } - public void setIpAssignScheme(String ipAssignScheme) { - this.ipAssignScheme = ipAssignScheme; - } + public void setGreLocalInetAddr(String greLocalInetAddr) { + this.greLocalInetAddr = greLocalInetAddr; - public String getInetConfig() { - return inetConfig; - } + } - public void setInetConfig(String inetConfig) { - this.inetConfig = inetConfig; - } + public void setGreRemoteInetAddr(String greRemoteInetAddr) { + this.greRemoteInetAddr = greRemoteInetAddr; + } - public static long getSerialversionuid() { - return serialVersionUID; - } + public void setGreRemoteMacAddr(String greRemoteMacAddr) { + this.greRemoteMacAddr = greRemoteMacAddr; + } - public Uuid get_uuid() { - return _uuid; - } + public void setHwAddr(String hwAddr) { + this.hwAddr = hwAddr; + } - public void set_uuid(Uuid _uuid) { - this._uuid = _uuid; - } + public void setIfName(String ifName) { + this.ifName = ifName; + } - public Uuid getVersion() { - return version; - } + public void setIfType(String ifType) { + this.ifType = ifType; + } - public void setVersion(Uuid version) { - this.version = version; - } + public void setIfUuid(String ifUuid) { + this.ifUuid = ifUuid; + } - public void setGreLocalInetAddr(String greLocalInetAddr) { - this.greLocalInetAddr = greLocalInetAddr; + public void setInetAddr(String inetAddr) { + this.inetAddr = inetAddr; + } - } + public void setInetConfig(String inetConfig) { + this.inetConfig = inetConfig; + } - public String getGreLocalInetAddr() { - return greLocalInetAddr; - } + public void setIpAssignScheme(String ipAssignScheme) { + this.ipAssignScheme = ipAssignScheme; + } - public void setGreRemoteMacAddr(String greRemoteMacAddr) { - this.greRemoteMacAddr = greRemoteMacAddr; - } + public void setMtw(int mtw) { + this.mtw = mtw; + } - 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 setNat(boolean nat) { + this.nat = nat; + } - @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 setNetmask(String netmask) { + this.netmask = netmask; + } - @Override - public String toString() { - return "OpensyncAPInetState [ifName=" + ifName + ", dhcpd=" + dhcpd + ", unpnpMode=" + unpnpMode + ", ifType=" - + ifType + ", softwdsMacAddr=" + softwdsMacAddr + ", enabled=" + enabled + ", sofwdsWrap=" + sofwdsWrap - + ", vlanId=" + vlanId + ", netmask=" + netmask + ", nat=" + nat + ", greRemoteInetAddr=" - + greRemoteInetAddr + ", ifUuid=" + ifUuid + ", inetAddr=" + inetAddr + ", hwAddr=" + hwAddr + ", mtw=" - + mtw + ", network=" + network + ", dns=" + dns + ", parentIfName=" + parentIfName + ", greIfName=" - + greIfName + ", broadcast=" + broadcast + ", dhcpc=" + dhcpc + ", gateway=" + gateway - + ", ipAssignScheme=" + ipAssignScheme + ", inetConfig=" + inetConfig + ", _uuid=" + _uuid - + ", version=" + version + ", greLocalInetAddr=" + greLocalInetAddr + ", greRemoteMacAddr=" - + greRemoteMacAddr + "]"; - } + 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 + public String toString() { + return "OpensyncAPInetState [ifName=" + ifName + ", dhcpd=" + dhcpd + ", unpnpMode=" + unpnpMode + ", ifType=" + + ifType + ", softwdsMacAddr=" + softwdsMacAddr + ", enabled=" + enabled + ", sofwdsWrap=" + sofwdsWrap + + ", vlanId=" + vlanId + ", netmask=" + netmask + ", nat=" + nat + ", greRemoteInetAddr=" + + greRemoteInetAddr + ", ifUuid=" + ifUuid + ", inetAddr=" + inetAddr + ", hwAddr=" + hwAddr + ", mtw=" + + mtw + ", network=" + network + ", dns=" + dns + ", parentIfName=" + parentIfName + ", greIfName=" + + greIfName + ", broadcast=" + broadcast + ", dhcpc=" + dhcpc + ", gateway=" + gateway + + ", ipAssignScheme=" + ipAssignScheme + ", inetConfig=" + inetConfig + ", _uuid=" + _uuid + + ", version=" + version + ", greLocalInetAddr=" + greLocalInetAddr + ", greRemoteMacAddr=" + + greRemoteMacAddr + "]"; + } } diff --git a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPRadioConfig.java b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPRadioConfig.java index 9f72580..668b378 100644 --- a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPRadioConfig.java +++ b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPRadioConfig.java @@ -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; @@ -10,41 +8,41 @@ public class OpensyncAPRadioConfig extends BaseJsonModel { private int radioChannel24G; 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; } } \ No newline at end of file diff --git a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPRadioState.java b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPRadioState.java index 75aa5a3..11e77a5 100644 --- a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPRadioState.java +++ b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPRadioState.java @@ -1,27 +1,30 @@ /** - * + * */ 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 hwParams; public RadioType freqBand; public int thermalIntegration; + public Set 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 map = row.getColumns(); - public void setTemperatureControl(int temperatureControl) { - this.temperatureControl = temperatureControl; - } + 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) { - public boolean isThermalDowngraded() { - return thermalDowngraded; - } + Set allowedChannels = getSet(row, "allowed_channels"); - public void setThermalDowngraded(boolean thermalDowngraded) { - this.thermalDowngraded = thermalDowngraded; - } + Set allowed = new HashSet<>(); + for (Long channel : allowedChannels) { + allowed.add(channel.intValue()); + } + this.setAllowedChannels(allowed); + } + if (map.get("channels") != null) { - public boolean isDfsDemo() { - return dfsDemo; - } + Map channels = row.getMapColumn("channels"); + this.setChannels(channels); + } - public void setDfsDemo(boolean dfsDemo) { - this.dfsDemo = dfsDemo; - } + Set vifStates = row.getSetColumn("vif_states"); + this.setVifStates(vifStates); - 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 getVifStates() { - return vifStates; - } - - public void setVifStates(Set 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 getAllowedChannels() { - return allowedChannels; - } - - public void setAllowedChannels(Set 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 getHwConfig() { - return hwConfig; - } - - public void setHwConfig(Map 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 getChannels() { - return channels; - } - - public void setChannels(Map channels) { - this.channels = channels; - } - - public int getThermalUpgradeTemp() { - return thermalUpgradeTemp; - } - - public void setThermalUpgradeTemp(int thermalUpgradeTemp) { - this.thermalUpgradeTemp = thermalUpgradeTemp; - } - - public Map getHwParams() { - return hwParams; - } - - public void setHwParams(Map 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 getAllowedChannels() { + return allowedChannels; + } + + public int getBcnInt() { + return bcnInt; + } + + public int getChannel() { + return channel; + } + + public String getChannelMode() { + return channelMode; + } + + public Map 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 getHwConfig() { + return hwConfig; + } + + public String getHwMode() { + return hwMode; + } + + public Map 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 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 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 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 hwConfig) { + this.hwConfig = hwConfig; + } + + public void setHwMode(String hwMode) { + this.hwMode = hwMode; + } + + public void setHwParams(Map 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 vifStates) { + this.vifStates = vifStates; + } } diff --git a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPSsidConfig.java b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPSsidConfig.java index c28d384..d9eb017 100644 --- a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPSsidConfig.java +++ b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPSsidConfig.java @@ -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; @@ -13,45 +12,30 @@ public class OpensyncAPSsidConfig extends BaseJsonModel { private String key; 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; } } \ No newline at end of file diff --git a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPVIFState.java b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPVIFState.java index 22279f7..b22cd51 100644 --- a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPVIFState.java +++ b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPVIFState.java @@ -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 security; public String macList; - public List associatedClients; + public List 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 map = row.getColumns(); - public int getVifRadioIdx() { - return vifRadioIdx; - } + 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 void setVifRadioIdx(int vifRadioIdx) { - this.vifRadioIdx = 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 String getParent() { - return parent; - } + if ((map.get("enabled") != null) + && map.get("enabled").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { + this.setEnabled(row.getBooleanColumn("enabled")); + } - public void setParent(String parent) { - this.parent = parent; - } + Long ftPsk = getSingleValueFromSet(row, "ft_psk"); + if (ftPsk != null) { + this.setFtPsk(ftPsk.intValue()); + } - public String getState() { - return state; - } + Long ftMobilityDomain = getSingleValueFromSet(row, "ft_mobility_domain"); + if (ftMobilityDomain != null) { + this.setFtMobilityDomain(ftMobilityDomain.intValue()); + } - public void setState(String state) { - this.state = 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 String getMac() { - return mac; - } + if ((map.get("mode") != null) + && map.get("mode").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { + this.setMode(row.getStringColumn("mode")); + } - public void setMac(String mac) { - this.mac = 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 boolean isApBridge() { - return apBridge; - } + 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 void setApBridge(boolean apBridge) { - this.apBridge = apBridge; - } + List associatedClientsList = new ArrayList<>(); - public boolean isUapsdEnable() { - return uapsdEnable; - } + Set clients = row.getSetColumn("associated_clients"); + associatedClientsList.addAll(clients); - public void setUapsdEnable(boolean uapsdEnable) { - this.uapsdEnable = uapsdEnable; - } + this.setAssociatedClients(associatedClientsList); - public boolean isWds() { - return wds; - } + if (map.get("security") != null) { + this.setSecurity(row.getMapColumn("security")); + } - public void setWds(boolean wds) { - this.wds = wds; - } - - public String getSsid() { - return ssid; - } - - public void setSsid(String ssid) { - this.ssid = ssid; - } - - public Map getSecurity() { - return security; - } - - public void setSecurity(Map security) { - this.security = security; - } - - public String getMacList() { - return macList; - } - - public void setMacList(String macList) { - this.macList = macList; - } - - public List getAssociatedClients() { - return associatedClients; - } - - public void setAssociatedClients(List 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; + 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 Uuid get_uuid() { return _uuid; } - public void set_uuid(Uuid _uuid) { - this._uuid = _uuid; + public List 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 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 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 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; + } } diff --git a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAWLANNode.java b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAWLANNode.java index 22b2890..4b91ac8 100644 --- a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAWLANNode.java +++ b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAWLANNode.java @@ -1,22 +1,27 @@ /** - * + * */ 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 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 getMqttSettings() { - return mqttSettings; - } + public OpensyncAWLANNode(Row row) { + this(); + Map map = row.getColumns(); - public void setMqttSettings(Map map) { - this.mqttSettings = map; - } + 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 String getModel() { - return model; - } + 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 void setModel(String model) { - this.model = 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 String getSkuNumber() { - return skuNumber; - } + 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 void setSkuNumber(String skuNumber) { - this.skuNumber = skuNumber; - } + this.setUpgradeStatus(row.getIntegerColumn("upgrade_status").intValue()); - public String getId() { - return id; - } + 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 setId(String id) { - this.id = id; - } - - public Map getVersionMatrix() { - return versionMatrix; - } - - public void setVersionMatrix(Map 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 getLedConfig() { - return ledConfig; - } - - public void setLedConfig(Map ledConfig) { - this.ledConfig = ledConfig; - } - - public String getRedirectorAddr() { - return redirectorAddr; - } - - public void setRedirectorAddr(String redirectorAddr) { - this.redirectorAddr = redirectorAddr; - } - - public Map getMqttHeaders() { - return mqttHeaders; - } - - public void setMqttHeaders(Map 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 getMqttTopics() { - return mqttTopics; - } - - public void setMqttTopics(Map 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; + if ((map.get("revision") != null) + && map.get("revision").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { + this.setRevision(row.getStringColumn("revision")); + } + 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")); + } + 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 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 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 getMqttHeaders() { + return mqttHeaders; + } + + public Map getMqttSettings() { + return mqttSettings; + } + + public Map 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 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 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 mqttHeaders) { + this.mqttHeaders = mqttHeaders; + } + + public void setMqttSettings(Map map) { + this.mqttSettings = map; + } + + public void setMqttTopics(Map 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 versionMatrix) { + this.versionMatrix = versionMatrix; + } + } diff --git a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncWifiAssociatedClients.java b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncWifiAssociatedClients.java index a80a7bd..fb9717e 100644 --- a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncWifiAssociatedClients.java +++ b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncWifiAssociatedClients.java @@ -1,22 +1,28 @@ /** - * + * */ 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 map = row.getColumns(); - public String getMac() { - return mac; - } - - public void setMac(String mac) { - this.mac = mac; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public Set getCapabilities() { - return capabilities; - } - - public void setCapabilities(Set 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; + if ((map.get("mac") != null) + && map.get("mac").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { + this.setMac(row.getStringColumn("mac")); + } + if (row.getSetColumn("capabilities") != null) { + this.setCapabilities(row.getSetColumn("capabilities")); + } + if ((map.get("state") != null) + && map.get("state").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { + this.setState(row.getStringColumn("state")); + } + 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 Uuid get_uuid() { return _uuid; } - public void set_uuid(Uuid _uuid) { - this._uuid = _uuid; + public Set 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 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; } diff --git a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbFirmwareConfig.java b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbFirmwareConfig.java index e095e8b..9485d16 100644 --- a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbFirmwareConfig.java +++ b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbFirmwareConfig.java @@ -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 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 operations = new ArrayList<>(); Map updateColumns = new HashMap<>(); updateColumns.put("upgrade_timer", new Atom<>(upgradeTimerSeconds)); - Row row = new Row(updateColumns); operations.add(new Update(awlanNodeDbTable, row)); - CompletableFuture 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); - } } diff --git a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbGet.java b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbGet.java index af41a71..977d6e6 100644 --- a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbGet.java +++ b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbGet.java @@ -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 getProvisionedInterfaces(OvsdbClient ovsdbClient) { - Map ret = new HashMap<>(); - for (Row row : getOvsdbTableRowsForCondition(ovsdbClient, interfaceDbTable, null)) { - InterfaceInfo interfaceInfo = new InterfaceInfo(row); - ret.put(interfaceInfo.name, interfaceInfo); - } - return ret; - } - Map getProvisionedWifiInetConfigs(OvsdbClient ovsdbClient) { Map ret = new HashMap<>(); for (Row row : getOvsdbTableRowsForCondition(ovsdbClient, wifiInetConfigDbTable, null)) { diff --git a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbMonitor.java b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbMonitor.java index 84678e3..eec3891 100644 --- a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbMonitor.java +++ b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbMonitor.java @@ -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 getInitialOpensyncApInetStateForRowUpdate(TableUpdates tableUpdates, String apId, OvsdbClient ovsdbClient) { - - LOG.info("getInitialOpensyncApInetStateForRowUpdate:"); + LOG.debug("getInitialOpensyncApInetStateForRowUpdate:"); List 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 getInitialOpensyncApVifStateForTableUpdates(TableUpdates tableUpdates, String apId, OvsdbClient ovsdbClient) { - - LOG.info("getInitialOpensyncApVifStateForTableUpdates:"); + LOG.debug("getInitialOpensyncApVifStateForTableUpdates:"); List 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 getInitialOpensyncWifiAssociatedClients(TableUpdates tableUpdates, String apId, OvsdbClient ovsdbClient) { - - LOG.info("getInitialOpensyncWifiAssociatedClients:"); + LOG.debug("getInitialOpensyncWifiAssociatedClients:"); List 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 getOpensyncApInetStateForRowUpdate(RowUpdate rowUpdate, String apId, OvsdbClient ovsdbClient) { List 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()); } - - OpensyncAPInetState tableState = new OpensyncAPInetState(); - Map 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); - + } else { + row = rowUpdate.getOld(); + } + if (row != null) { + ret.add(new OpensyncAPInetState(row)); } return ret; } List getOpensyncAPRadioState(TableUpdates tableUpdates, String apId, OvsdbClient ovsdbClient) { - List ret = new ArrayList<>(); - try { - for (Entry tableUpdate : tableUpdates.getTableUpdates().entrySet()) { - for (Entry rowUpdate : tableUpdate.getValue().getRowUpdates().entrySet()) { - Row row = rowUpdate.getValue().getNew(); - // Row old = rowUpdate.getOld(); - if (row != null) { - - OpensyncAPRadioState tableState = new OpensyncAPRadioState(); - - Map 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 allowedChannels = getSet(row, "allowed_channels"); - - Set allowed = new HashSet<>(); - for (Long channel : allowedChannels) { - allowed.add(channel.intValue()); - } - tableState.setAllowedChannels(allowed); - } - if (map.get("channels") != null) { - - Map channels = row.getMapColumn("channels"); - tableState.setChannels(channels); - } - - Set vifStates = row.getSetColumn("vif_states"); - tableState.setVifStates(vifStates); - - ret.add(tableState); + ret.add(new OpensyncAPRadioState(row)); } } } - - ret.stream().forEach(new Consumer() { - - @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 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 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 getOpensyncWifiAssociatedClients(RowUpdate rowUpdate, String apId, OvsdbClient ovsdbClient) { - List ret = new ArrayList<>(); - Row row = rowUpdate.getNew(); if (row == null) { row = rowUpdate.getOld(); } - - OpensyncWifiAssociatedClients tableState = new OpensyncWifiAssociatedClients(); - Map 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() { - - @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 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 associatedClientsList = new ArrayList<>(); - - Set 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; - } - } diff --git a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbNetworkConfig.java b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbNetworkConfig.java index 6eadd07..3afdc29 100644 --- a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbNetworkConfig.java +++ b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbNetworkConfig.java @@ -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 - // gre_ifname: Not needed - try { LOG.debug("Configure Gre Tunnel {}", apNetworkConfiguration); List operations = new ArrayList<>(); @@ -189,7 +181,6 @@ public class OvsdbNetworkConfig extends OvsdbDaoBase { void configureInetVifInterface(OvsdbClient ovsdbClient, String vifInterfaceName, boolean enabled, NetworkForwardMode networkForwardMode) { Map 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_ - // if_type vlan - // parent_ifname gre - // vlan_id - List operations = new ArrayList<>(); Map tableColumns = new HashMap<>(); - Map 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 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 operations = new ArrayList<>(); Map tableColumns = new HashMap<>(); - Map 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 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 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 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 tunnelConfiguration = ((ApNetworkConfiguration) opensyncApConfig .getApProfile().getDetails()).getGreTunnelConfigurations().stream() .filter(new Predicate() { - @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 operations = new ArrayList<>(); List 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 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() { - @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); } - } - }