Merge branch 'master' of github.com:Telecominfraproject/wlan-cloud-opensync-controller

This commit is contained in:
Rahul Sharma
2020-05-12 16:13:32 -04:00
4 changed files with 29 additions and 38 deletions

View File

@@ -22,9 +22,6 @@ import com.telecominfraproject.wlan.cloudeventdispatcher.CloudEventDispatcherInt
import com.telecominfraproject.wlan.core.model.entity.CountryCode;
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
import com.telecominfraproject.wlan.core.model.pagination.ColumnAndSort;
import com.telecominfraproject.wlan.core.model.pagination.PaginationContext;
import com.telecominfraproject.wlan.core.model.pagination.PaginationResponse;
import com.telecominfraproject.wlan.customer.models.Customer;
import com.telecominfraproject.wlan.customer.service.CustomerServiceInterface;
import com.telecominfraproject.wlan.equipment.EquipmentServiceInterface;
@@ -34,7 +31,6 @@ import com.telecominfraproject.wlan.equipment.models.Equipment;
import com.telecominfraproject.wlan.equipment.models.StateSetting;
import com.telecominfraproject.wlan.location.models.Location;
import com.telecominfraproject.wlan.location.service.LocationServiceInterface;
import com.telecominfraproject.wlan.opensync.experiment.OpenSyncConnectusController;
import com.telecominfraproject.wlan.opensync.external.integration.controller.OpensyncCloudGatewayController;
import com.telecominfraproject.wlan.opensync.external.integration.models.ConnectNodeInfo;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPConfig;
@@ -46,8 +42,6 @@ import com.telecominfraproject.wlan.opensync.external.integration.models.Opensyn
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAWLANNode;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncWifiAssociatedClients;
import com.telecominfraproject.wlan.profile.ProfileServiceInterface;
import com.telecominfraproject.wlan.profile.models.Profile;
import com.telecominfraproject.wlan.profile.models.ProfileContainer;
import com.telecominfraproject.wlan.profile.models.ProfileType;
import com.telecominfraproject.wlan.profile.ssid.models.SsidConfiguration;
import com.telecominfraproject.wlan.profile.ssid.models.SsidConfiguration.SecureMode;
@@ -147,16 +141,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
try {
ce = getCustomerEquipment(apId);
LOG.debug("Got Equipment {} for apId {}", ce.toPrettyString());
ce.setName(apId);
//TODO: dtop - this needs to be cleaned up - no need for empty update
ce = equipmentServiceInterface.update(ce);
LOG.debug("Updated equipment {} for apId {}", ce.toPrettyString(), apId);
} catch (Exception e) {
LOG.error("Caught exception getting equipment for Id {} for apId {}", apId, apId, e);
}
List<Location> locationList = locationServiceInterface.getAllForCustomer(ce.getCustomerId());
@@ -164,21 +150,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
LOG.debug("Location {} for Customer {}", location.toPrettyString(), ce.getCustomerId());
}
//TODO: dtop - there's a better way:
// ProfileContainer profileContainer = new ProfileContainer(profileServiceInterface.getProfileWithChildren(ce.getProfileId()));
// List<Profile> ssidProfiles = profileContainer.getChildrenOfType(ce.getProfileId(), ProfileType.ssid);
// List<SsidConfiguration> ssidConfigs = new ArrayList<>();
// ssidProfiles.forEach(p -> ssidConfigs.add((SsidConfiguration)p.getDetails()));
// LOG.info("SSID configs: {}", ssidConfigs);
PaginationResponse<Profile> paginationResponse = profileServiceInterface
.getForCustomer(ce.getCustomerId(), new ArrayList<ColumnAndSort>(),
new PaginationContext<com.telecominfraproject.wlan.profile.models.Profile>(10));
for (com.telecominfraproject.wlan.profile.models.Profile profile : paginationResponse.getItems()) {
LOG.debug("Profile {} for Customer {}", profile.toPrettyString(), ce.getCustomerId());
}
// register equipment routing record
EquipmentRoutingRecord equipmentRoutingRecord = new EquipmentRoutingRecord();
equipmentRoutingRecord.setGatewayId(gatewayController.getRegisteredGwId());
@@ -229,12 +200,12 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
if (ovsdbSession == null) {
throw new IllegalStateException("AP is not connected " + apId);
}
long equipmentId = ovsdbSession.getEquipmentId();
Equipment resolvedEqCfg = equipmentServiceInterface.get(equipmentId);
Equipment resolvedEqCfg = equipmentServiceInterface.getByInventoryIdOrNull(apId);
if (resolvedEqCfg == null) {
throw new IllegalStateException("Cannot retrieve configuration for " + apId);
}
ret = new OpensyncAPConfig();
Location eqLocation = locationServiceInterface.get(resolvedEqCfg.getLocationId());
@@ -326,10 +297,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
ret.setSsidConfigs(ssidConfigs);
for (OpensyncAPSsidConfig osSsidCfg : ssidConfigs) {
LOG.debug("Mike OpensyncAPSsidConfig {}", osSsidCfg.toPrettyString());
}
} catch (Exception e) {
LOG.error("Cannot read config for AP {}", apId, e);
}

View File

@@ -119,6 +119,9 @@ public class OpensyncCloudGatewayController {
}
switch (command.getCommandType()) {
case ConfigChangeNotification:
return sendConfigChangeNotification(session, (CEGWConfigChangeNotification)command);
default:
LOG.warn("[{}] Failed to deliver command {}, unsupported command type", qrCode, command);

View File

@@ -237,7 +237,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
OvsdbClient ovsdbClient = ovsdbSession.getOvsdbClient();
OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId);
if (opensyncAPConfig != null) {
ovsdbDao.removeAllSsids(ovsdbClient);
ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig.getRadioConfig());

View File

@@ -967,6 +967,8 @@ public class OvsdbDao {
public static final String homeAp24 = "home-ap-24";
public static final String homeApL50 = "home-ap-l50";
public static final String homeApU50 = "home-ap-u50";
public static final String brHome = "br-home";
public static final String brWan = "br-wan";
@@ -995,8 +997,12 @@ public class OvsdbDao {
provisionSingleBridgePortInterface(ovsdbClient, patchW2h, brWan, "patch", patchW2hOptions,
provisionedInterfaces, provisionedPorts, provisionedBridges);
provisionSingleBridgePortInterface(ovsdbClient, homeApU50, brHome, null, null, provisionedInterfaces,
provisionedPorts, provisionedBridges);
provisionSingleBridgePortInterface(ovsdbClient, homeApL50, brHome, null, null, provisionedInterfaces,
provisionedPorts, provisionedBridges);
provisionSingleBridgePortInterface(ovsdbClient, homeAp24, brHome, null, null, provisionedInterfaces,
provisionedPorts, provisionedBridges);
@@ -1701,8 +1707,18 @@ public class OvsdbDao {
for (OpensyncAPSsidConfig ssidCfg : ssidConfigs) {
String bridge = brHome;
String ifName = (ssidCfg.getRadioType() == RadioType.is2dot4GHz) ? homeAp24 : homeApL50;
String radioIfName = (ssidCfg.getRadioType() == RadioType.is2dot4GHz) ? "wifi0" : "wifi1";
String ifName = null;
String radioIfName = null;
if (ssidCfg.getRadioType() == RadioType.is2dot4GHz) {
ifName = homeAp24;
radioIfName = "wifi0";
} else if (ssidCfg.getRadioType() == RadioType.is5GHzL) {
ifName = homeApL50;
radioIfName = "wifi1";
} else if (ssidCfg.getRadioType() == RadioType.is5GHzU) {
ifName = homeApU50;
radioIfName = "wifi2";
}
String ssid = ssidCfg.getSsid();
boolean ssidBroadcast = ssidCfg.isBroadcast();
Map<String, String> security = new HashMap<>();
@@ -1804,6 +1820,11 @@ public class OvsdbDao {
if (!provisionedWifiInetConfigs.containsKey(ifName)) {
configureWifiInet(ovsdbClient, provisionedWifiInetConfigs, ifName);
}
ifName = homeApU50;
if (!provisionedWifiInetConfigs.containsKey(ifName)) {
configureWifiInet(ovsdbClient, provisionedWifiInetConfigs, ifName);
}
if (!provisionedWifiInetConfigs.containsKey(brHome) || !provisionedWifiInetConfigs.get(brHome).network) {
// set network flag on brHome in wifiInetConfig table