WIFI-1007: AP is reported as WiFi clients

This commit is contained in:
Mike Hansen
2020-10-28 15:19:29 -04:00
parent 10b3a6227d
commit 0e80415e52
14 changed files with 2275 additions and 3116 deletions

View File

@@ -6,13 +6,12 @@ import java.util.Map;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel; import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
import com.vmware.ovsdb.protocol.operation.notation.Uuid; import com.vmware.ovsdb.protocol.operation.notation.Uuid;
public class OpensyncAPInetState extends BaseJsonModel { public class OpensyncAPInetState extends BaseJsonModel {
private static final long serialVersionUID = 1707053648715030173L; private static final long serialVersionUID = 1707053648715030173L;
public String ifName; public String ifName;
public String dhcpd; public Map<String, String> dhcpd;
public String unpnpMode; public String unpnpMode;
public String ifType; public String ifType;
public String softwdsMacAddr; public String softwdsMacAddr;
@@ -37,175 +36,423 @@ public class OpensyncAPInetState extends BaseJsonModel {
public String inetConfig; public String inetConfig;
public Uuid _uuid; public Uuid _uuid;
public Uuid version; public Uuid version;
public String greLocalInetAddr;
public String greRemoteMacAddr;
public OpensyncAPInetState() { public OpensyncAPInetState() {
super(); super();
dns = new HashMap<>(); dns = new HashMap<>();
dhcpc = new HashMap<>(); dhcpc = new HashMap<>();
} }
public String getIfName() {
public String getIfName() {
return ifName; return ifName;
} }
public void setIfName(String ifName) { public void setIfName(String ifName) {
this.ifName = ifName; this.ifName = ifName;
} }
public String getDhcpd() {
public Map<String, String> getDhcpd() {
return dhcpd; return dhcpd;
} }
public void setDhcpd(String dhcpd) {
public void setDhcpd(Map<String, String> dhcpd) {
this.dhcpd = dhcpd; this.dhcpd = dhcpd;
} }
public String getUnpnpMode() { public String getUnpnpMode() {
return unpnpMode; return unpnpMode;
} }
public void setUnpnpMode(String unpnpMode) { public void setUnpnpMode(String unpnpMode) {
this.unpnpMode = unpnpMode; this.unpnpMode = unpnpMode;
} }
public String getIfType() { public String getIfType() {
return ifType; return ifType;
} }
public void setIfType(String ifType) { public void setIfType(String ifType) {
this.ifType = ifType; this.ifType = ifType;
} }
public String getSoftwdsMacAddr() { public String getSoftwdsMacAddr() {
return softwdsMacAddr; return softwdsMacAddr;
} }
public void setSoftwdsMacAddr(String softwdsMacAddr) { public void setSoftwdsMacAddr(String softwdsMacAddr) {
this.softwdsMacAddr = softwdsMacAddr; this.softwdsMacAddr = softwdsMacAddr;
} }
public boolean isEnabled() { public boolean isEnabled() {
return enabled; return enabled;
} }
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
this.enabled = enabled; this.enabled = enabled;
} }
public boolean isSofwdsWrap() { public boolean isSofwdsWrap() {
return sofwdsWrap; return sofwdsWrap;
} }
public void setSofwdsWrap(boolean sofwdsWrap) { public void setSofwdsWrap(boolean sofwdsWrap) {
this.sofwdsWrap = sofwdsWrap; this.sofwdsWrap = sofwdsWrap;
} }
public int getVlanId() { public int getVlanId() {
return vlanId; return vlanId;
} }
public void setVlanId(int vlanId) { public void setVlanId(int vlanId) {
this.vlanId = vlanId; this.vlanId = vlanId;
} }
public String getNetmask() { public String getNetmask() {
return netmask; return netmask;
} }
public void setNetmask(String netmask) { public void setNetmask(String netmask) {
this.netmask = netmask; this.netmask = netmask;
} }
public boolean isNat() { public boolean isNat() {
return nat; return nat;
} }
public void setNat(boolean nat) { public void setNat(boolean nat) {
this.nat = nat; this.nat = nat;
} }
public String getGreRemoteInetAddr() { public String getGreRemoteInetAddr() {
return greRemoteInetAddr; return greRemoteInetAddr;
} }
public void setGreRemoteInetAddr(String greRemoteInetAddr) { public void setGreRemoteInetAddr(String greRemoteInetAddr) {
this.greRemoteInetAddr = greRemoteInetAddr; this.greRemoteInetAddr = greRemoteInetAddr;
} }
public String getIfUuid() { public String getIfUuid() {
return ifUuid; return ifUuid;
} }
public void setIfUuid(String ifUuid) { public void setIfUuid(String ifUuid) {
this.ifUuid = ifUuid; this.ifUuid = ifUuid;
} }
public String getInetAddr() { public String getInetAddr() {
return inetAddr; return inetAddr;
} }
public void setInetAddr(String inetAddr) { public void setInetAddr(String inetAddr) {
this.inetAddr = inetAddr; this.inetAddr = inetAddr;
} }
public String getHwAddr() { public String getHwAddr() {
return hwAddr; return hwAddr;
} }
public void setHwAddr(String hwAddr) { public void setHwAddr(String hwAddr) {
this.hwAddr = hwAddr; this.hwAddr = hwAddr;
} }
public int getMtw() { public int getMtw() {
return mtw; return mtw;
} }
public void setMtw(int mtw) { public void setMtw(int mtw) {
this.mtw = mtw; this.mtw = mtw;
} }
public boolean isNetwork() { public boolean isNetwork() {
return network; return network;
} }
public void setNetwork(boolean network) { public void setNetwork(boolean network) {
this.network = network; this.network = network;
} }
public Map<String, String> getDns() { public Map<String, String> getDns() {
return dns; return dns;
} }
public void setDns(Map<String, String> dns) { public void setDns(Map<String, String> dns) {
this.dns = dns; this.dns = dns;
} }
public String getParentIfName() { public String getParentIfName() {
return parentIfName; return parentIfName;
} }
public void setParentIfName(String parentIfName) { public void setParentIfName(String parentIfName) {
this.parentIfName = parentIfName; this.parentIfName = parentIfName;
} }
public String getGreIfName() { public String getGreIfName() {
return greIfName; return greIfName;
} }
public void setGreIfName(String greIfName) { public void setGreIfName(String greIfName) {
this.greIfName = greIfName; this.greIfName = greIfName;
} }
public String getBroadcast() { public String getBroadcast() {
return broadcast; return broadcast;
} }
public void setBroadcast(String broadcast) { public void setBroadcast(String broadcast) {
this.broadcast = broadcast; this.broadcast = broadcast;
} }
public Map<String, String> getDhcpc() { public Map<String, String> getDhcpc() {
return dhcpc; return dhcpc;
} }
public void setDhcpc(Map<String, String> dhcpc) { public void setDhcpc(Map<String, String> dhcpc) {
this.dhcpc = dhcpc; this.dhcpc = dhcpc;
} }
public String getGateway() { public String getGateway() {
return gateway; return gateway;
} }
public void setGateway(String gateway) { public void setGateway(String gateway) {
this.gateway = gateway; this.gateway = gateway;
} }
public String getIpAssignScheme() { public String getIpAssignScheme() {
return ipAssignScheme; return ipAssignScheme;
} }
public void setIpAssignScheme(String ipAssignScheme) { public void setIpAssignScheme(String ipAssignScheme) {
this.ipAssignScheme = ipAssignScheme; this.ipAssignScheme = ipAssignScheme;
} }
public String getInetConfig() { public String getInetConfig() {
return inetConfig; return inetConfig;
} }
public void setInetConfig(String inetConfig) { public void setInetConfig(String inetConfig) {
this.inetConfig = inetConfig; this.inetConfig = inetConfig;
} }
public static long getSerialversionuid() { public static long getSerialversionuid() {
return serialVersionUID; return serialVersionUID;
} }
public Uuid get_uuid() { public Uuid get_uuid() {
return _uuid; return _uuid;
} }
public void set_uuid(Uuid _uuid) { public void set_uuid(Uuid _uuid) {
this._uuid = _uuid; this._uuid = _uuid;
} }
public Uuid getVersion() { public Uuid getVersion() {
return version; return version;
} }
public void setVersion(Uuid version) { public void setVersion(Uuid version) {
this.version = version; this.version = version;
} }
public void setGreLocalInetAddr(String greLocalInetAddr) {
this.greLocalInetAddr = greLocalInetAddr;
}
public String getGreLocalInetAddr() {
return greLocalInetAddr;
}
public void setGreRemoteMacAddr(String greRemoteMacAddr) {
this.greRemoteMacAddr = greRemoteMacAddr;
}
public String getGreRemoteMacAddr(){
return this.greRemoteMacAddr;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((_uuid == null) ? 0 : _uuid.hashCode());
result = prime * result + ((broadcast == null) ? 0 : broadcast.hashCode());
result = prime * result + ((dhcpc == null) ? 0 : dhcpc.hashCode());
result = prime * result + ((dhcpd == null) ? 0 : dhcpd.hashCode());
result = prime * result + ((dns == null) ? 0 : dns.hashCode());
result = prime * result + (enabled ? 1231 : 1237);
result = prime * result + ((gateway == null) ? 0 : gateway.hashCode());
result = prime * result + ((greIfName == null) ? 0 : greIfName.hashCode());
result = prime * result + ((greLocalInetAddr == null) ? 0 : greLocalInetAddr.hashCode());
result = prime * result + ((greRemoteInetAddr == null) ? 0 : greRemoteInetAddr.hashCode());
result = prime * result + ((hwAddr == null) ? 0 : hwAddr.hashCode());
result = prime * result + ((ifName == null) ? 0 : ifName.hashCode());
result = prime * result + ((ifType == null) ? 0 : ifType.hashCode());
result = prime * result + ((ifUuid == null) ? 0 : ifUuid.hashCode());
result = prime * result + ((inetAddr == null) ? 0 : inetAddr.hashCode());
result = prime * result + ((inetConfig == null) ? 0 : inetConfig.hashCode());
result = prime * result + ((ipAssignScheme == null) ? 0 : ipAssignScheme.hashCode());
result = prime * result + mtw;
result = prime * result + (nat ? 1231 : 1237);
result = prime * result + ((netmask == null) ? 0 : netmask.hashCode());
result = prime * result + (network ? 1231 : 1237);
result = prime * result + ((parentIfName == null) ? 0 : parentIfName.hashCode());
result = prime * result + ((greRemoteMacAddr == null) ? 0 : greRemoteMacAddr.hashCode());
result = prime * result + ((softwdsMacAddr == null) ? 0 : softwdsMacAddr.hashCode());
result = prime * result + (sofwdsWrap ? 1231 : 1237);
result = prime * result + ((unpnpMode == null) ? 0 : unpnpMode.hashCode());
result = prime * result + ((version == null) ? 0 : version.hashCode());
result = prime * result + vlanId;
return result;
}
@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;
}
@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 + "]";
}
} }

View File

@@ -196,11 +196,11 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId); OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId);
try { // try {
ovsdbDao.provisionBridgePortInterface(ovsdbClient); // ovsdbDao.provisionBridgePortInterface(ovsdbClient);
} catch (Exception e) { // } catch (Exception e) {
LOG.warn("Could not provision Bridge->Port->Interface mapping.", e); // LOG.warn("Could not provision Bridge->Port->Interface mapping.", e);
} // }
ovsdbDao.removeAllStatsConfigs(ovsdbClient); // always ovsdbDao.removeAllStatsConfigs(ovsdbClient); // always
ovsdbDao.removeAllSsids(ovsdbClient); // always ovsdbDao.removeAllSsids(ovsdbClient); // always
ovsdbDao.removeWifiRrm(ovsdbClient); ovsdbDao.removeWifiRrm(ovsdbClient);
@@ -360,7 +360,7 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
CompletableFuture<TableUpdates> awCf = ovsdbClient.monitor(OvsdbDao.ovsdbName, CompletableFuture<TableUpdates> awCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
OvsdbDao.dhcpLeasedIpDbTable + "_" + key, OvsdbDao.dhcpLeasedIpDbTable + "_" + key,
new MonitorRequests(ImmutableMap.of(OvsdbDao.dhcpLeasedIpDbTable, new MonitorRequest())), new MonitorRequests(ImmutableMap.of(OvsdbDao.dhcpLeasedIpDbTable, new MonitorRequest(new MonitorSelect(true, true, true, true)))),
new MonitorCallback() { new MonitorCallback() {
@Override @Override
@@ -581,7 +581,7 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
CompletableFuture<TableUpdates> isCf = ovsdbClient CompletableFuture<TableUpdates> isCf = ovsdbClient
.monitor(OvsdbDao.ovsdbName, OvsdbDao.wifiInetStateDbTable + "_" + key, .monitor(OvsdbDao.ovsdbName, OvsdbDao.wifiInetStateDbTable + "_" + key,
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiInetStateDbTable, new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiInetStateDbTable,
new MonitorRequest(new MonitorSelect(false, true, true, true)))), new MonitorRequest(new MonitorSelect(true, true, true, true)))),
new MonitorCallback() { new MonitorCallback() {
@Override @Override
@@ -729,14 +729,10 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
@Override @Override
public String processFirmwareFlash(String apId, String firmwareVersion, String username) { public String processFirmwareFlash(String apId, String firmwareVersion, String username) {
OvsdbSession session = ovsdbSessionMapInterface.getSession(apId); OvsdbSession session = ovsdbSessionMapInterface.getSession(apId);
OvsdbClient ovsdbClient = session.getOvsdbClient();
try { try {
ovsdbDao.configureFirmwareFlash(session.getOvsdbClient(), apId, firmwareVersion, username); ovsdbDao.configureFirmwareFlash(session.getOvsdbClient(), apId, firmwareVersion, username);
} catch (Exception e) { } catch (Exception e) {
LOG.error("Failed to flash firmware for " + apId + " " + e.getLocalizedMessage()); LOG.error("Failed to flash firmware for " + apId + " " + e.getLocalizedMessage());
monitorOvsdbStateTables(ovsdbClient, apId); // turn back on so we
// can go forward and
// recover
return "Failed to flash firmware for " + apId + " " + e.getLocalizedMessage(); return "Failed to flash firmware for " + apId + " " + e.getLocalizedMessage();
} }

View File

@@ -1,5 +1,8 @@
package com.telecominfraproject.wlan.opensync.ovsdb.dao; package com.telecominfraproject.wlan.opensync.ovsdb.dao;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@@ -1836,26 +1839,13 @@ public class OvsdbDao {
List<Operation> operations = new ArrayList<>(); List<Operation> operations = new ArrayList<>();
operations.add(new Delete(wifiVifConfigDbTable));
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
if (LOG.isDebugEnabled()) {
LOG.debug("Removed all existing SSIDs from {}:", wifiVifConfigDbTable);
for (OperationResult res : result) {
LOG.debug("Op Result {}", res);
}
}
operations = new ArrayList<>(); operations = new ArrayList<>();
List<Condition> conditions = new ArrayList<>(); List<Condition> conditions = new ArrayList<>();
conditions.add(new Condition("if_type", Function.EQUALS, new Atom<>("vif"))); conditions.add(new Condition("if_type", Function.EQUALS, new Atom<>("vif")));
operations.add(new Delete(wifiInetConfigDbTable, conditions)); operations.add(new Delete(wifiInetConfigDbTable, conditions));
fResult = ovsdbClient.transact(ovsdbName, operations); CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS); OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Removed all existing vif interfaces configs from {}:", wifiInetConfigDbTable); LOG.debug("Removed all existing vif interfaces configs from {}:", wifiInetConfigDbTable);
@@ -1865,9 +1855,23 @@ public class OvsdbDao {
} }
} }
operations = new ArrayList<>();
operations.add(new Delete(wifiVifConfigDbTable));
fResult = ovsdbClient.transact(ovsdbName, operations);
result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
if (LOG.isDebugEnabled()) {
LOG.debug("Removed all existing SSIDs from {}:", wifiVifConfigDbTable);
for (OperationResult res : result) {
LOG.debug("Op Result {}", res);
}
}
operations = new ArrayList<>(); operations = new ArrayList<>();
conditions = new ArrayList<>(); conditions = new ArrayList<>();
conditions.add(new Condition("if_type", Function.EQUALS, new Atom<>("vlan"))); conditions.add(new Condition("vlan_id", Function.GREATER_THAN, new Atom<>(1)));
operations.add(new Delete(wifiInetConfigDbTable, conditions)); operations.add(new Delete(wifiInetConfigDbTable, conditions));
fResult = ovsdbClient.transact(ovsdbName, operations); fResult = ovsdbClient.transact(ovsdbName, operations);
@@ -2223,6 +2227,8 @@ public class OvsdbDao {
OvsdbClient ovsdbClient) { OvsdbClient ovsdbClient) {
List<OpensyncAPInetState> ret = new ArrayList<>(); List<OpensyncAPInetState> ret = new ArrayList<>();
LOG.info("OvsdbDao::getOpensyncApInetStateForRowUpdate {} for apId {}", rowUpdate, apId);
try { try {
Row row = rowUpdate.getNew(); Row row = rowUpdate.getNew();
@@ -2249,6 +2255,44 @@ public class OvsdbDao {
&& map.get("if_type").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { && map.get("if_type").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setIfType(row.getStringColumn("if_type")); 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() if ((map.get("ip_assign_scheme") != null) && map.get("ip_assign_scheme").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
tableState.setIpAssignScheme(row.getStringColumn("ip_assign_scheme")); tableState.setIpAssignScheme(row.getStringColumn("ip_assign_scheme"));
@@ -2561,14 +2605,15 @@ public class OvsdbDao {
} }
} }
private void configureSingleSsid(OvsdbClient ovsdbClient, String ifName, String ssid, boolean ssidBroadcast, private void configureSingleSsid(OvsdbClient ovsdbClient, String vifInterfaceName, String ssid,
Map<String, String> security, String radioFreqBand, int vlanId, boolean rrmEnabled, boolean enable80211r, boolean ssidBroadcast, Map<String, String> security, String radioFreqBand, int vlanId, boolean rrmEnabled,
int mobilityDomain, boolean enable80211v, boolean enable80211k, String minHwMode, boolean enabled, boolean enable80211r, int mobilityDomain, boolean enable80211v, boolean enable80211k, String minHwMode,
int keyRefresh, boolean uapsdEnabled, boolean apBridge, NetworkForwardMode networkForwardMode, boolean enabled, int keyRefresh, boolean uapsdEnabled, boolean apBridge,
String gateway, String inet, Map<String, String> dns, String ipAssignScheme, List<MacAddress> macBlockList, NetworkForwardMode networkForwardMode, String gateway, String inet, Map<String, String> dns,
boolean rateLimitEnable, int ssidDlLimit, int ssidUlLimit, int clientDlLimit, int clientUlLimit, String ipAssignScheme, List<MacAddress> macBlockList, boolean rateLimitEnable, int ssidDlLimit,
int rtsCtsThreshold, int fragThresholdBytes, int dtimPeriod, Map<String, String> captiveMap, int ssidUlLimit, int clientDlLimit, int clientUlLimit, int rtsCtsThreshold, int fragThresholdBytes,
List<String> walledGardenAllowlist, Map<Short, Set<String>> bonjourServiceMap) { int dtimPeriod, Map<String, String> captiveMap, List<String> walledGardenAllowlist,
Map<Short, Set<String>> bonjourServiceMap) {
List<Operation> operations = new ArrayList<>(); List<Operation> operations = new ArrayList<>();
Map<String, Value> updateColumns = new HashMap<>(); Map<String, Value> updateColumns = new HashMap<>();
@@ -2576,9 +2621,9 @@ public class OvsdbDao {
try { try {
// If we are doing a NAT SSID, no bridge, else yes // If we are doing a NAT SSID, no bridge, else yes
String bridge = defaultWanInterfaceName; String bridgeInterfaceName = defaultWanInterfaceName;
if (networkForwardMode == NetworkForwardMode.NAT) { if (networkForwardMode == NetworkForwardMode.NAT) {
bridge = defaultLanInterfaceName; bridgeInterfaceName = defaultLanInterfaceName;
} }
if (vlanId > 1) { if (vlanId > 1) {
@@ -2586,26 +2631,20 @@ public class OvsdbDao {
// question // question
Map<String, WifiInetConfigInfo> wifiInetConfigInfoMap = getProvisionedWifiInetConfigs(ovsdbClient); Map<String, WifiInetConfigInfo> wifiInetConfigInfoMap = getProvisionedWifiInetConfigs(ovsdbClient);
String vlanIfName = bridge + "_" + vlanId; String vlanIfName = bridgeInterfaceName + "_" + vlanId;
if (!wifiInetConfigInfoMap.containsKey(vlanIfName)) { if (!wifiInetConfigInfoMap.containsKey(vlanIfName)) {
// we need to make a VLAN, before we do anything else // we need to make a VLAN, before we do anything else
createInetConfigForVlan(ovsdbClient, bridge, (networkForwardMode == NetworkForwardMode.NAT), createInetConfigForVlan(ovsdbClient, bridgeInterfaceName, vlanIfName, vlanId, false);
vlanIfName, vlanId, gateway, inet, ipAssignScheme, dns, false);
} else { } else {
createInetConfigForVlan(ovsdbClient, bridge, (networkForwardMode == NetworkForwardMode.NAT), createInetConfigForVlan(ovsdbClient, bridgeInterfaceName, vlanIfName, vlanId, true);
vlanIfName, vlanId, gateway, inet, ipAssignScheme, dns, true);
} }
bridge = vlanIfName;
updateColumns.put("vlan_id", new Atom<>(vlanId)); updateColumns.put("vlan_id", new Atom<>(vlanId));
updateColumns.put("mode", new Atom<>("ap"));
} else {
updateColumns.put("mode", new Atom<>("ap"));
updateColumns.put("vlan_id", new com.vmware.ovsdb.protocol.operation.notation.Set());
} }
updateColumns.put("mode", new Atom<>("ap"));
// TODO: remove when captive portal support available in AP load // TODO: remove when captive portal support available in AP load
DatabaseSchema dbSchema = ovsdbClient.getSchema(ovsdbName).join(); DatabaseSchema dbSchema = ovsdbClient.getSchema(ovsdbName).join();
TableSchema tableSchema = dbSchema.getTables().get(wifiVifConfigDbTable); TableSchema tableSchema = dbSchema.getTables().get(wifiVifConfigDbTable);
@@ -2632,7 +2671,7 @@ public class OvsdbDao {
LOG.debug("SSID {} Bonjour Services per vlan {}", ssid, bonjourServiceMap); LOG.debug("SSID {} Bonjour Services per vlan {}", ssid, bonjourServiceMap);
} }
updateColumns.put("bridge", new Atom<>(bridge)); updateColumns.put("bridge", new Atom<>(bridgeInterfaceName));
if (enable80211v) { if (enable80211v) {
updateColumns.put("btm", new Atom<>(1)); updateColumns.put("btm", new Atom<>(1));
@@ -2647,7 +2686,7 @@ public class OvsdbDao {
updateColumns.put("ft_psk", new Atom<>(0)); updateColumns.put("ft_psk", new Atom<>(0));
updateColumns.put("ft_mobility_domain", new com.vmware.ovsdb.protocol.operation.notation.Set()); updateColumns.put("ft_mobility_domain", new com.vmware.ovsdb.protocol.operation.notation.Set());
} }
updateColumns.put("if_name", new Atom<>(ifName)); updateColumns.put("if_name", new Atom<>(vifInterfaceName));
updateColumns.put("rrm", new Atom<>(rrmEnabled ? 1 : 0)); updateColumns.put("rrm", new Atom<>(rrmEnabled ? 1 : 0));
updateColumns.put("ssid", new Atom<>(ssid)); updateColumns.put("ssid", new Atom<>(ssid));
updateColumns.put("ssid_broadcast", new Atom<>(ssidBroadcast ? "enabled" : "disabled")); updateColumns.put("ssid_broadcast", new Atom<>(ssidBroadcast ? "enabled" : "disabled"));
@@ -2687,14 +2726,13 @@ public class OvsdbDao {
updateColumns.put("custom_options", customMap); updateColumns.put("custom_options", customMap);
updateBlockList(updateColumns, macBlockList); updateBlockList(updateColumns, macBlockList);
Row row = new Row(updateColumns); Row row = new Row(updateColumns);
operations.add(new Insert(wifiVifConfigDbTable, row)); operations.add(new Insert(wifiVifConfigDbTable, row));
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations); CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS); OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
LOG.debug("Provisioned SSID {} on {}", ssid, ifName); LOG.debug("Provisioned SSID {} on {}", ssid, vifInterfaceName);
Uuid vifConfigUuid = null; Uuid vifConfigUuid = null;
for (OperationResult res : result) { for (OperationResult res : result) {
@@ -2713,19 +2751,14 @@ public class OvsdbDao {
updateVifConfigsSetForRadio(ovsdbClient, ssid, radioFreqBand, operations, updateColumns, vifConfigUuid); updateVifConfigsSetForRadio(ovsdbClient, ssid, radioFreqBand, operations, updateColumns, vifConfigUuid);
Map<String, WifiInetConfigInfo> inetConfigs = getProvisionedWifiInetConfigs(ovsdbClient); Map<String, WifiInetConfigInfo> inetConfigs = getProvisionedWifiInetConfigs(ovsdbClient);
boolean isNAT = inetConfigs.get(bridge).nat;
ipAssignScheme = inetConfigs.get(bridge).ipAssignScheme;
if (inetConfigs.containsKey(ifName)) { if (inetConfigs.containsKey(vifInterfaceName)) {
updateWifiInetConfig(ovsdbClient, vlanId, ifName, enabled, isNAT, "vif", bridge, gateway, inet, dns, configureInetInterface(ovsdbClient, vifInterfaceName, enabled, "vif", true);
ipAssignScheme, vifConfigUuid);
} else { } else {
LOG.debug("No corresponding WifiInetConfig for this Interface"); configureInetInterface(ovsdbClient, vifInterfaceName, enabled, "vif", false);
insertWifiInetConfigForVif(ovsdbClient, vlanId, ifName, enabled, isNAT, "vif", bridge, gateway, inet,
dns, ipAssignScheme, vifConfigUuid);
} }
LOG.info("Provisioned SSID {} on interface {} / {}", ssid, ifName, radioFreqBand); LOG.info("Provisioned SSID {} on interface {} / {}", ssid, vifInterfaceName, radioFreqBand);
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { } catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in configureSingleSsid", e); LOG.error("Error in configureSingleSsid", e);
@@ -2937,25 +2970,26 @@ public class OvsdbDao {
boolean ssidBroadcast = ssidConfig.getBroadcastSsid() == StateSetting.enabled; boolean ssidBroadcast = ssidConfig.getBroadcastSsid() == StateSetting.enabled;
String ipAssignScheme = null; String ipAssignScheme = apElementConfig.getGettingIP().toString();
// the following 5 attributes only applicable to static config, // the following 5 attributes only applicable to static config,
// else they are // else they are
// ignored // ignored
String gateway = null; String gateway = null;
String inet = null; String inet = null;
Map<String, String> dns = null; Map<String, String> dns = null;
if (apElementConfig.getStaticIP() != null) { if (ipAssignScheme.equals("manual")) {
ipAssignScheme = "static"; if (apElementConfig.getStaticIP() != null) {
inet = apElementConfig.getStaticIP().getHostAddress(); ipAssignScheme = "static";
gateway = apElementConfig.getStaticIpGw().getHostAddress(); inet = apElementConfig.getStaticIP().getHostAddress();
dns = new HashMap<>(); gateway = apElementConfig.getStaticIpGw().getHostAddress();
dns.put(apElementConfig.getStaticDnsIp1().getHostName(), dns = new HashMap<>();
apElementConfig.getStaticDnsIp1().getHostAddress()); dns.put(apElementConfig.getStaticDnsIp1().getHostName(),
dns.put(apElementConfig.getStaticDnsIp2().getHostName(), apElementConfig.getStaticDnsIp1().getHostAddress());
apElementConfig.getStaticDnsIp2().getHostAddress()); dns.put(apElementConfig.getStaticDnsIp2().getHostName(),
} else if (apElementConfig.getGettingIP().equals(GettingIP.dhcp) apElementConfig.getStaticDnsIp2().getHostAddress());
|| apElementConfig.getGettingDNS().equals(GettingDNS.dhcp)) { } else {
ipAssignScheme = "dhcp"; ipAssignScheme = "none";
}
} }
RadioConfiguration radioConfiguration = apElementConfig.getAdvancedRadioMap().get(radioType); RadioConfiguration radioConfiguration = apElementConfig.getAdvancedRadioMap().get(radioType);
@@ -3113,13 +3147,10 @@ public class OvsdbDao {
} }
private void createInetConfigForVlan(OvsdbClient ovsdbClient, String parentIfName, boolean isNAT, String vlanIfName, private void createInetConfigForVlan(OvsdbClient ovsdbClient, String parentIfName, String vlanIfName, int vlanId,
int vlanId, String gateway, String inet, String ipAssignScheme, Map<String, String> dns, boolean isUpdate) { boolean isUpdate) {
try { try {
Map<String, WifiInetConfigInfo> wifiInetConfigsMap = getProvisionedWifiInetConfigs(ovsdbClient);
WifiInetConfigInfo parentWifiInetConfig = wifiInetConfigsMap.get(parentIfName);
List<Operation> operations = new ArrayList<>(); List<Operation> operations = new ArrayList<>();
Map<String, Value> tableColumns = new HashMap<>(); Map<String, Value> tableColumns = new HashMap<>();
@@ -3127,37 +3158,14 @@ public class OvsdbDao {
tableColumns.put("vlan_id", new Atom<>(vlanId)); tableColumns.put("vlan_id", new Atom<>(vlanId));
tableColumns.put("if_name", new Atom<>(vlanIfName)); tableColumns.put("if_name", new Atom<>(vlanIfName));
tableColumns.put("parent_ifname", new Atom<>(parentIfName)); tableColumns.put("parent_ifname", new Atom<>(parentIfName));
tableColumns.put("NAT", new Atom<>(isNAT));
tableColumns.put("enabled", new Atom<>(true)); tableColumns.put("enabled", new Atom<>(true));
tableColumns.put("network", new Atom<>(true)); tableColumns.put("network", new Atom<>(true));
tableColumns.put("mtu", new Atom<>(1500)); if (parentIfName.equals(defaultLanInterfaceName)) {
tableColumns.put("dhcp_sniff", new Atom<>(true)); tableColumns.put("ip_assign_scheme", new Atom<>("static"));
if (parentWifiInetConfig != null) {
tableColumns.put("ip_assign_scheme", new Atom<>(parentWifiInetConfig.ipAssignScheme));
if (parentWifiInetConfig.ipAssignScheme.equals("static")) {
tableColumns.put("dns",
com.vmware.ovsdb.protocol.operation.notation.Map.of(parentWifiInetConfig.dns));
tableColumns.put("dhcpd",
com.vmware.ovsdb.protocol.operation.notation.Map.of(parentWifiInetConfig.dhcpd));
if (parentWifiInetConfig.gateway != null) {
tableColumns.put("gateway", new Atom<>(parentWifiInetConfig.gateway));
}
if (parentWifiInetConfig.netmask != null) {
tableColumns.put("netmask", new Atom<>(parentWifiInetConfig.netmask));
}
if (parentWifiInetConfig.inetAddr != null) {
String[] inetAddrOctets = parentWifiInetConfig.inetAddr.split("\\.");
if (inetAddrOctets.length == 4) {
// change the subnet octet to be the vlan
tableColumns.put("inet_addr", new Atom<>(inetAddrOctets[0] + "." + inetAddrOctets[1] + "."
+ vlanId + "." + inetAddrOctets[3]));
}
}
}
} else { } else {
tableColumns.put("ip_assign_scheme", new Atom<>(ipAssignScheme)); tableColumns.put("ip_assign_scheme", new Atom<>("dhcp"));
} }
tableColumns.put("dhcp_sniff", new Atom<>(true));
Row row = new Row(tableColumns); Row row = new Row(tableColumns);
operations.clear(); operations.clear();
@@ -3328,114 +3336,41 @@ public class OvsdbDao {
return externalFileStoreURL + FILESTORE + "/" + fileInfo.getApExportUrl(); return externalFileStoreURL + FILESTORE + "/" + fileInfo.getApExportUrl();
} }
private void updateWifiInetConfig(OvsdbClient ovsdbClient, int vlanId, String ifName, boolean enabled, private void configureInetInterface(OvsdbClient ovsdbClient, String ifName, boolean enabled, String ifType,
boolean isNAT, String ifType, String gateway, String inet, String parentIfName, Map<String, String> dns, boolean isUpdate) {
String ipAssignScheme, Uuid vifConfigUuid) {
List<Operation> operations = new ArrayList<>();
Map<String, Value> updateColumns = new HashMap<>();
List<Condition> conditions = new ArrayList<>();
conditions.add(new Condition("if_name", Function.EQUALS, new Atom<>(ifName)));
try { try {
// /usr/plume/tools/ovsh i Wifi_Inet_Config NAT:=false enabled:=true if_name:=home-ap-24 if_type:=vif ip_assign_scheme:=none network:=true
/// usr/plume/tools/ovsh i Wifi_Inet_Config NAT:=false enabled:=true List<Operation> operations = new ArrayList<>();
/// if_name:=home-ap-24 if_type:=vif ip_assign_scheme:=none Map<String, Value> tableColumns = new HashMap<>();
/// network:=true
// dhcpd
updateColumns.put("if_name", new Atom<>(ifName));
updateColumns.put("if_type", new Atom<>(ifType));
updateColumns.put("if_uuid", new Atom<>(vifConfigUuid.toString()));
updateColumns.put("enabled", new Atom<>(enabled));
updateColumns.put("NAT", new Atom<>(isNAT));
// updateColumns.put("parent_ifname", new Atom<>(parentIfName));
// mtu // specified in interface, should take that value when
// implemented
// updateColumns.put("mtu", new Atom<>(1500));
updateColumns.put("network", new Atom<>(true));
updateColumns.put("ip_assign_scheme", new Atom<>(ipAssignScheme));
updateColumns.put("dhcp_sniff", new Atom<>(true));
// if (ipAssignScheme.equals("static")) {
// updateColumns.put("dns", com.vmware.ovsdb.protocol.operation.notation.Map.of(dns));
// updateColumns.put("inet_addr", new Atom<>(inet));
// updateColumns.put("gateway", new Atom<>(gateway));
// // netmask
// // broadcast
// }
Row row = new Row(updateColumns);
operations.add(new Update(wifiInetConfigDbTable, conditions, row));
tableColumns.put("if_type", new Atom<>(ifType));
tableColumns.put("enabled", new Atom<>(enabled));
tableColumns.put("network", new Atom<>(true));
tableColumns.put("if_name", new Atom<>(ifName));
tableColumns.put("dhcp_sniff", new Atom<>(true));
tableColumns.put("ip_assign_scheme", new Atom<>("dhcp"));
tableColumns.put("NAT", new Atom<>(false));
Row row = new Row(tableColumns);
if (isUpdate) {
List<Condition> conditions = new ArrayList<>();
conditions.add(new Condition("if_name", Function.EQUALS, new Atom<>(ifName)));
operations.add(new Update(wifiInetConfigDbTable, conditions, row));
} else {
operations.add(new Insert(wifiInetConfigDbTable, row));
}
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations); CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS); OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
LOG.debug("Provisioned WifiInetConfig {}", ifName); LOG.debug("Updated Inet {}", ifName);
for (OperationResult res : result) { for (OperationResult res : result) {
LOG.debug("Op Result {}", res); LOG.debug("Op Result {}", res);
} }
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { } catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in configureWifiInet", e); LOG.error("Error in updateWifiInetConfig", e);
throw new RuntimeException(e);
}
}
private void insertWifiInetConfigForVif(OvsdbClient ovsdbClient, int vlanId, String ifName, boolean enabled,
boolean isNAT, String ifType, String gateway, String inet, String parentIfName, Map<String, String> dns,
String ipAssignScheme, Uuid vifConfigUuid) {
List<Operation> operations = new ArrayList<>();
Map<String, Value> insertColumns = new HashMap<>();
try {
/// usr/plume/tools/ovsh i Wifi_Inet_Config NAT:=false enabled:=true
/// if_name:=home-ap-24 if_type:=vif ip_assign_scheme:=none
/// network:=true
// dhcpd
insertColumns.put("if_name", new Atom<>(ifName));
insertColumns.put("if_type", new Atom<>(ifType));
insertColumns.put("if_uuid", new Atom<>(vifConfigUuid.toString()));
insertColumns.put("enabled", new Atom<>(enabled));
insertColumns.put("NAT", new Atom<>(isNAT));
// insertColumns.put("parent_ifname", new Atom<>(parentIfName));
// mtu // specified in interface, should take that value when
// implemented
// insertColumns.put("mtu", new Atom<>(1500));
insertColumns.put("network", new Atom<>(true));
insertColumns.put("dhcp_sniff", new Atom<>(true));
insertColumns.put("ip_assign_scheme", new Atom<>(ipAssignScheme));
// if (ipAssignScheme.equals("static")) {
//
// if (inet != null) {
// insertColumns.put("inet_addr", new Atom<>(inet));
// }
// insertColumns.put("netmask", new Atom<>("255.255.255.0"));
// // netmask
// // broadcast
// }
Row row = new Row(insertColumns);
operations.add(new Insert(wifiInetConfigDbTable, row));
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
LOG.debug("Provisioned WifiInetConfig {}", ifName);
for (OperationResult res : result) {
LOG.debug("Op Result {}", res);
}
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
LOG.error("Error in configureWifiInet", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@@ -3,7 +3,6 @@ package com.telecominfraproject.wlan.opensync.ovsdb.dao;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@@ -27,21 +26,11 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.ResourceUtils;
import com.fasterxml.jackson.databind.JsonNode;
import com.github.fge.jackson.JsonLoader;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.telecominfraproject.wlan.opensync.external.integration.models.ConnectNodeInfo; import com.telecominfraproject.wlan.opensync.external.integration.models.ConnectNodeInfo;
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;
import com.vmware.ovsdb.exception.OvsdbClientException; import com.vmware.ovsdb.exception.OvsdbClientException;
import com.vmware.ovsdb.jsonrpc.v1.util.JsonUtil;
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.Atom; import com.vmware.ovsdb.protocol.operation.notation.Atom;
import com.vmware.ovsdb.protocol.operation.notation.Row; import com.vmware.ovsdb.protocol.operation.notation.Row;
import com.vmware.ovsdb.protocol.operation.notation.Uuid; import com.vmware.ovsdb.protocol.operation.notation.Uuid;
@@ -387,94 +376,6 @@ public class OvsdbDaoTest {
} }
@Test
public void testOvsdbDaoGetOpensyncAPVIFState() throws Exception {
String path = "src/test/resources/Wifi_VIF_State-home-ap-24.json";
File file = new File(path);
String absolutePath = file.getAbsolutePath();
File jsonFile = ResourceUtils.getFile(absolutePath);
JsonNode jn = JsonLoader.fromFile(jsonFile);
Row row = JsonUtil.deserializeNoException(jn.toString(), Row.class);
RowUpdate rowUpdate = new RowUpdate();
rowUpdate.setNew(row);
path = "src/test/resources/Wifi_VIF_State-home-ap-l50.json";
file = new File(path);
absolutePath = file.getAbsolutePath();
jsonFile = ResourceUtils.getFile(absolutePath);
jn = JsonLoader.fromFile(jsonFile);
Row row1 = JsonUtil.deserializeNoException(jn.toString(), Row.class);
RowUpdate rowUpdate1 = new RowUpdate();
rowUpdate1.setNew(row1);
path = "src/test/resources/Wifi_VIF_State-home-ap-u50.json";
file = new File(path);
absolutePath = file.getAbsolutePath();
jsonFile = ResourceUtils.getFile(absolutePath);
jn = JsonLoader.fromFile(jsonFile);
Row row2 = JsonUtil.deserializeNoException(jn.toString(), Row.class);
RowUpdate rowUpdate2 = new RowUpdate();
rowUpdate2.setNew(row2);
List<OpensyncAPVIFState> vifStateList = ovsdbDao.getOpensyncApVifStateForRowUpdate(rowUpdate, "SomeAPId", ovsdbClient);
assert (vifStateList.size() == 1);
vifStateList.addAll(ovsdbDao.getOpensyncApVifStateForRowUpdate(rowUpdate1, "SomeAPId", ovsdbClient));
assert (vifStateList.size() == 2);
vifStateList.addAll(ovsdbDao.getOpensyncApVifStateForRowUpdate(rowUpdate2, "SomeAPId", ovsdbClient));
assert (vifStateList.size() == 3);
}
@Test
public void testOvsdbDaoGetOpensyncAPRadioState() throws Exception {
String path = "src/test/resources/Wifi_Radio_State-home-ap-24.json";
File file = new File(path);
String absolutePath = file.getAbsolutePath();
File jsonFile = ResourceUtils.getFile(absolutePath);
JsonNode jn = JsonLoader.fromFile(jsonFile);
Row row = JsonUtil.deserializeNoException(jn.toString(), Row.class);
RowUpdate rowUpdate = new RowUpdate();
rowUpdate.setNew(row);
path = "src/test/resources/Wifi_Radio_State-home-ap-l50.json";
file = new File(path);
absolutePath = file.getAbsolutePath();
jsonFile = ResourceUtils.getFile(absolutePath);
jn = JsonLoader.fromFile(jsonFile);
Row row1 = JsonUtil.deserializeNoException(jn.toString(), Row.class);
RowUpdate rowUpdate1 = new RowUpdate();
rowUpdate1.setNew(row1);
path = "src/test/resources/Wifi_Radio_State-home-ap-u50.json";
file = new File(path);
absolutePath = file.getAbsolutePath();
jsonFile = ResourceUtils.getFile(absolutePath);
jn = JsonLoader.fromFile(jsonFile);
Row row2 = JsonUtil.deserializeNoException(jn.toString(), Row.class);
RowUpdate rowUpdate2 = new RowUpdate();
rowUpdate2.setNew(row2);
TableUpdate tableUpdate = new TableUpdate(ImmutableMap.of(row.getUuidColumn("_uuid").getUuid(), rowUpdate,
row1.getUuidColumn("_uuid").getUuid(), rowUpdate1, row2.getUuidColumn("_uuid").getUuid(), rowUpdate2));
TableUpdates tableUpdates = new TableUpdates(ImmutableMap.of(OvsdbDao.wifiRadioStateDbTable, tableUpdate));
List<OpensyncAPRadioState> radioStateList = ovsdbDao.getOpensyncAPRadioState(tableUpdates, "SomeAPId",
ovsdbClient);
assert (radioStateList.size() == 3);
}
@Test @Test
public void testObsdbDaoEnableNetworkProbe() throws Exception { public void testObsdbDaoEnableNetworkProbe() throws Exception {
@@ -521,48 +422,5 @@ public class OvsdbDaoTest {
} }
@Test
public void testOvsdbDaoGetOpensyncAPInetState() throws Exception {
String path = "src/test/resources/Wifi_Inet_State-home-ap-24.json";
File file = new File(path);
String absolutePath = file.getAbsolutePath();
File jsonFile = ResourceUtils.getFile(absolutePath);
JsonNode jn = JsonLoader.fromFile(jsonFile);
Row row = JsonUtil.deserializeNoException(jn.toString(), Row.class);
RowUpdate rowUpdate = new RowUpdate();
rowUpdate.setNew(row);
path = "src/test/resources/Wifi_Inet_State-home-ap-l50.json";
file = new File(path);
absolutePath = file.getAbsolutePath();
jsonFile = ResourceUtils.getFile(absolutePath);
jn = JsonLoader.fromFile(jsonFile);
Row row1 = JsonUtil.deserializeNoException(jn.toString(), Row.class);
RowUpdate rowUpdate1 = new RowUpdate();
rowUpdate1.setNew(row1);
path = "src/test/resources/Wifi_Inet_State-home-ap-u50.json";
file = new File(path);
absolutePath = file.getAbsolutePath();
jsonFile = ResourceUtils.getFile(absolutePath);
jn = JsonLoader.fromFile(jsonFile);
Row row2 = JsonUtil.deserializeNoException(jn.toString(), Row.class);
RowUpdate rowUpdate2 = new RowUpdate();
rowUpdate2.setNew(row2);
List<OpensyncAPInetState> inetStateList = ovsdbDao.getOpensyncApInetStateForRowUpdate(rowUpdate, "SomeAPId", ovsdbClient);
assert (inetStateList.size() == 1);
inetStateList.addAll(ovsdbDao.getOpensyncApInetStateForRowUpdate(rowUpdate1, "SomeAPId", ovsdbClient));
assert (inetStateList.size() == 2);
inetStateList.addAll(ovsdbDao.getOpensyncApInetStateForRowUpdate(rowUpdate2, "SomeAPId", ovsdbClient));
assert (inetStateList.size() == 3);
}
} }

View File

@@ -1,110 +0,0 @@
{
"vif_radio_idx": [
"set",
[
]
],
"if_name": "home-ap-24",
"state": [
"set",
[
]
],
"mac": "24:f5:a2:ef:2e:54",
"ssid": "TipWlan-cloud-3-radios",
"uapsd_enable": true,
"ap_bridge": false,
"wps_pbc": [
"set",
[
]
],
"mac_list": [
"set",
[
]
],
"associated_clients": [
"set",
[
]
],
"btm": 1,
"_uuid": [
"uuid",
"a007d865-fe4b-4265-a9a1-69d4b309e939"
],
"ssid_broadcast": "enabled",
"wps": [
"set",
[
]
],
"mcast2ucast": [
"set",
[
]
],
"mode": "ap",
"mac_list_type": "none",
"wps_pbc_key_id": "",
"ft_psk": 0,
"channel": [
"set",
[
]
],
"parent": [
"set",
[
]
],
"multi_ap": [
"set",
[
]
],
"ap_vlan_sta_addr": [
"set",
[
]
],
"security": [
"map",
[
[
"encryption",
"OPEN"
]
]
],
"wds": [
"set",
[
]
],
"enabled": true,
"vlan_id": 1,
"min_hw_mode": "11n",
"vif_config": [
"uuid",
"fc3de7db-ee6c-452c-859c-1be81b0b5b24"
],
"_version": [
"uuid",
"a96bff45-29bd-423b-9014-10a418683e5d"
],
"bridge": "lan",
"group_rekey": 0,
"ft_mobility_domain": [
"set",
[
]
],
"dynamic_beacon": [
"set",
[
]
],
"rrm": 1
}

View File

@@ -1,109 +0,0 @@
{
"vif_radio_idx": [
"set",
[
]
],
"if_name": "home-ap-l50",
"state": [
"set",
[
]
],
"mac": "24:f5:a2:ef:2e:55",
"ssid": "TipWlan-cloud-3-radios",
"uapsd_enable": true,
"ap_bridge": false,
"wps_pbc": [
"set",
[
]
],
"mac_list": [
"set",
[
]
],
"associated_clients": [
"uuid",
"073c3961-33fe-4054-abc6-ae2e8b91c914"
],
"btm": 1,
"_uuid": [
"uuid",
"7ebfab8d-0962-4af3-a45b-b5a9d68c86c8"
],
"ssid_broadcast": "enabled",
"wps": [
"set",
[
]
],
"mcast2ucast": [
"set",
[
]
],
"mode": "ap",
"mac_list_type": "none",
"wps_pbc_key_id": "",
"ft_psk": 0,
"channel": [
"set",
[
]
],
"parent": [
"set",
[
]
],
"multi_ap": [
"set",
[
]
],
"ap_vlan_sta_addr": [
"set",
[
]
],
"security": [
"map",
[
[
"encryption",
"OPEN"
]
]
],
"wds": [
"set",
[
]
],
"enabled": true,
"vlan_id": 1,
"min_hw_mode": "11ac",
"vif_config": [
"uuid",
"54c01e8b-4d67-456e-ab18-cbc89c784c2a"
],
"_version": [
"uuid",
"faec64fb-fbc1-417a-9ff4-f30ff2c5be94"
],
"bridge": "lan",
"group_rekey": 0,
"ft_mobility_domain": [
"set",
[
]
],
"dynamic_beacon": [
"set",
[
]
],
"rrm": 1
}

View File

@@ -1,109 +0,0 @@
{
"vif_radio_idx": [
"set",
[
]
],
"if_name": "home-ap-u50",
"state": [
"set",
[
]
],
"mac": "26:f5:a2:ef:2e:56",
"ssid": "TipWlan-cloud-3-radios",
"uapsd_enable": true,
"ap_bridge": false,
"wps_pbc": [
"set",
[
]
],
"mac_list": [
"set",
[
]
],
"associated_clients": [
"uuid",
"c9f5a30d-7ccf-406f-a0d8-f108b377584e"
],
"btm": 1,
"_uuid": [
"uuid",
"009e6ee9-d687-4201-9c55-f42d26cbd7b5"
],
"ssid_broadcast": "enabled",
"wps": [
"set",
[
]
],
"mcast2ucast": [
"set",
[
]
],
"mode": "ap",
"mac_list_type": "none",
"wps_pbc_key_id": "",
"ft_psk": 0,
"channel": [
"set",
[
]
],
"parent": [
"set",
[
]
],
"multi_ap": [
"set",
[
]
],
"ap_vlan_sta_addr": [
"set",
[
]
],
"security": [
"map",
[
[
"encryption",
"OPEN"
]
]
],
"wds": [
"set",
[
]
],
"enabled": true,
"vlan_id": 1,
"min_hw_mode": "11ac",
"vif_config": [
"uuid",
"4aeefd3b-b86f-45e4-a9a1-c734363be9c8"
],
"_version": [
"uuid",
"e70c7842-6257-46d1-94d3-350a55733fc4"
],
"bridge": "lan",
"group_rekey": 0,
"ft_mobility_domain": [
"set",
[
]
],
"dynamic_beacon": [
"set",
[
]
],
"rrm": 1
}

View File

@@ -1,110 +0,0 @@
{
"vif_radio_idx": [
"set",
[
]
],
"if_name": "home-ap-24",
"state": [
"set",
[
]
],
"mac": "24:f5:a2:ef:2e:54",
"ssid": "TipWlan-cloud-3-radios",
"uapsd_enable": true,
"ap_bridge": false,
"wps_pbc": [
"set",
[
]
],
"mac_list": [
"set",
[
]
],
"associated_clients": [
"set",
[
]
],
"btm": 1,
"_uuid": [
"uuid",
"a007d865-fe4b-4265-a9a1-69d4b309e939"
],
"ssid_broadcast": "enabled",
"wps": [
"set",
[
]
],
"mcast2ucast": [
"set",
[
]
],
"mode": "ap",
"mac_list_type": "none",
"wps_pbc_key_id": "",
"ft_psk": 0,
"channel": [
"set",
[
]
],
"parent": [
"set",
[
]
],
"multi_ap": [
"set",
[
]
],
"ap_vlan_sta_addr": [
"set",
[
]
],
"security": [
"map",
[
[
"encryption",
"OPEN"
]
]
],
"wds": [
"set",
[
]
],
"enabled": true,
"vlan_id": 1,
"min_hw_mode": "11n",
"vif_config": [
"uuid",
"fc3de7db-ee6c-452c-859c-1be81b0b5b24"
],
"_version": [
"uuid",
"a96bff45-29bd-423b-9014-10a418683e5d"
],
"bridge": "lan",
"group_rekey": 0,
"ft_mobility_domain": [
"set",
[
]
],
"dynamic_beacon": [
"set",
[
]
],
"rrm": 1
}

View File

@@ -1,109 +0,0 @@
{
"vif_radio_idx": [
"set",
[
]
],
"if_name": "home-ap-l50",
"state": [
"set",
[
]
],
"mac": "24:f5:a2:ef:2e:55",
"ssid": "TipWlan-cloud-3-radios",
"uapsd_enable": true,
"ap_bridge": false,
"wps_pbc": [
"set",
[
]
],
"mac_list": [
"set",
[
]
],
"associated_clients": [
"uuid",
"073c3961-33fe-4054-abc6-ae2e8b91c914"
],
"btm": 1,
"_uuid": [
"uuid",
"7ebfab8d-0962-4af3-a45b-b5a9d68c86c8"
],
"ssid_broadcast": "enabled",
"wps": [
"set",
[
]
],
"mcast2ucast": [
"set",
[
]
],
"mode": "ap",
"mac_list_type": "none",
"wps_pbc_key_id": "",
"ft_psk": 0,
"channel": [
"set",
[
]
],
"parent": [
"set",
[
]
],
"multi_ap": [
"set",
[
]
],
"ap_vlan_sta_addr": [
"set",
[
]
],
"security": [
"map",
[
[
"encryption",
"OPEN"
]
]
],
"wds": [
"set",
[
]
],
"enabled": true,
"vlan_id": 1,
"min_hw_mode": "11ac",
"vif_config": [
"uuid",
"54c01e8b-4d67-456e-ab18-cbc89c784c2a"
],
"_version": [
"uuid",
"faec64fb-fbc1-417a-9ff4-f30ff2c5be94"
],
"bridge": "lan",
"group_rekey": 0,
"ft_mobility_domain": [
"set",
[
]
],
"dynamic_beacon": [
"set",
[
]
],
"rrm": 1
}

View File

@@ -1,109 +0,0 @@
{
"vif_radio_idx": [
"set",
[
]
],
"if_name": "home-ap-u50",
"state": [
"set",
[
]
],
"mac": "26:f5:a2:ef:2e:56",
"ssid": "TipWlan-cloud-3-radios",
"uapsd_enable": true,
"ap_bridge": false,
"wps_pbc": [
"set",
[
]
],
"mac_list": [
"set",
[
]
],
"associated_clients": [
"uuid",
"c9f5a30d-7ccf-406f-a0d8-f108b377584e"
],
"btm": 1,
"_uuid": [
"uuid",
"009e6ee9-d687-4201-9c55-f42d26cbd7b5"
],
"ssid_broadcast": "enabled",
"wps": [
"set",
[
]
],
"mcast2ucast": [
"set",
[
]
],
"mode": "ap",
"mac_list_type": "none",
"wps_pbc_key_id": "",
"ft_psk": 0,
"channel": [
"set",
[
]
],
"parent": [
"set",
[
]
],
"multi_ap": [
"set",
[
]
],
"ap_vlan_sta_addr": [
"set",
[
]
],
"security": [
"map",
[
[
"encryption",
"OPEN"
]
]
],
"wds": [
"set",
[
]
],
"enabled": true,
"vlan_id": 1,
"min_hw_mode": "11ac",
"vif_config": [
"uuid",
"4aeefd3b-b86f-45e4-a9a1-c734363be9c8"
],
"_version": [
"uuid",
"e70c7842-6257-46d1-94d3-350a55733fc4"
],
"bridge": "lan",
"group_rekey": 0,
"ft_mobility_domain": [
"set",
[
]
],
"dynamic_beacon": [
"set",
[
]
],
"rrm": 1
}

View File

@@ -1,110 +0,0 @@
{
"vif_radio_idx": [
"set",
[
]
],
"if_name": "home-ap-24",
"state": [
"set",
[
]
],
"mac": "24:f5:a2:ef:2e:54",
"ssid": "TipWlan-cloud-3-radios",
"uapsd_enable": true,
"ap_bridge": false,
"wps_pbc": [
"set",
[
]
],
"mac_list": [
"set",
[
]
],
"associated_clients": [
"set",
[
]
],
"btm": 1,
"_uuid": [
"uuid",
"a007d865-fe4b-4265-a9a1-69d4b309e939"
],
"ssid_broadcast": "enabled",
"wps": [
"set",
[
]
],
"mcast2ucast": [
"set",
[
]
],
"mode": "ap",
"mac_list_type": "none",
"wps_pbc_key_id": "",
"ft_psk": 0,
"channel": [
"set",
[
]
],
"parent": [
"set",
[
]
],
"multi_ap": [
"set",
[
]
],
"ap_vlan_sta_addr": [
"set",
[
]
],
"security": [
"map",
[
[
"encryption",
"OPEN"
]
]
],
"wds": [
"set",
[
]
],
"enabled": true,
"vlan_id": 1,
"min_hw_mode": "11n",
"vif_config": [
"uuid",
"fc3de7db-ee6c-452c-859c-1be81b0b5b24"
],
"_version": [
"uuid",
"a96bff45-29bd-423b-9014-10a418683e5d"
],
"bridge": "lan",
"group_rekey": 0,
"ft_mobility_domain": [
"set",
[
]
],
"dynamic_beacon": [
"set",
[
]
],
"rrm": 1
}

View File

@@ -1,109 +0,0 @@
{
"vif_radio_idx": [
"set",
[
]
],
"if_name": "home-ap-l50",
"state": [
"set",
[
]
],
"mac": "24:f5:a2:ef:2e:55",
"ssid": "TipWlan-cloud-3-radios",
"uapsd_enable": true,
"ap_bridge": false,
"wps_pbc": [
"set",
[
]
],
"mac_list": [
"set",
[
]
],
"associated_clients": [
"uuid",
"073c3961-33fe-4054-abc6-ae2e8b91c914"
],
"btm": 1,
"_uuid": [
"uuid",
"7ebfab8d-0962-4af3-a45b-b5a9d68c86c8"
],
"ssid_broadcast": "enabled",
"wps": [
"set",
[
]
],
"mcast2ucast": [
"set",
[
]
],
"mode": "ap",
"mac_list_type": "none",
"wps_pbc_key_id": "",
"ft_psk": 0,
"channel": [
"set",
[
]
],
"parent": [
"set",
[
]
],
"multi_ap": [
"set",
[
]
],
"ap_vlan_sta_addr": [
"set",
[
]
],
"security": [
"map",
[
[
"encryption",
"OPEN"
]
]
],
"wds": [
"set",
[
]
],
"enabled": true,
"vlan_id": 1,
"min_hw_mode": "11ac",
"vif_config": [
"uuid",
"54c01e8b-4d67-456e-ab18-cbc89c784c2a"
],
"_version": [
"uuid",
"faec64fb-fbc1-417a-9ff4-f30ff2c5be94"
],
"bridge": "lan",
"group_rekey": 0,
"ft_mobility_domain": [
"set",
[
]
],
"dynamic_beacon": [
"set",
[
]
],
"rrm": 1
}

View File

@@ -1,96 +0,0 @@
{
"vif_radio_idx": [
"set",
[]
],
"if_name": "home-ap-u50",
"state": [
"set",
[]
],
"mac": "26:f5:a2:ef:2e:56",
"ssid": "TipWlan-cloud-3-radios",
"uapsd_enable": true,
"ap_bridge": false,
"wps_pbc": [
"set",
[]
],
"mac_list": [
"set",
[]
],
"associated_clients": [
"uuid",
"c9f5a30d-7ccf-406f-a0d8-f108b377584e"
],
"btm": 1,
"_uuid": [
"uuid",
"009e6ee9-d687-4201-9c55-f42d26cbd7b5"
],
"ssid_broadcast": "enabled",
"wps": [
"set",
[]
],
"mcast2ucast": [
"set",
[]
],
"mode": "ap",
"mac_list_type": "none",
"wps_pbc_key_id": "",
"ft_psk": 0,
"channel": [
"set",
[]
],
"parent": [
"set",
[]
],
"multi_ap": [
"set",
[]
],
"ap_vlan_sta_addr": [
"set",
[]
],
"security": [
"map",
[
[
"encryption",
"OPEN"
]
]
],
"wds": [
"set",
[]
],
"enabled": true,
"vlan_id": 1,
"min_hw_mode": "11ac",
"vif_config": [
"uuid",
"4aeefd3b-b86f-45e4-a9a1-c734363be9c8"
],
"_version": [
"uuid",
"e70c7842-6257-46d1-94d3-350a55733fc4"
],
"bridge": "lan",
"group_rekey": 0,
"ft_mobility_domain": [
"set",
[]
],
"dynamic_beacon": [
"set",
[]
],
"rrm": 1
}