mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-02 19:47:52 +00:00
OpensyncGatewayController:
Control LED off via Equipment AP profile and Show LED status in EQUIPMENT_ADMIN status Signed-off-by: Mike Hansen <mike.hansen@connectus.ai>
This commit is contained in:
@@ -103,6 +103,7 @@ import com.telecominfraproject.wlan.status.equipment.models.EquipmentProtocolSta
|
|||||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentUpgradeState;
|
import com.telecominfraproject.wlan.status.equipment.models.EquipmentUpgradeState;
|
||||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentUpgradeState.FailureReason;
|
import com.telecominfraproject.wlan.status.equipment.models.EquipmentUpgradeState.FailureReason;
|
||||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentUpgradeStatusData;
|
import com.telecominfraproject.wlan.status.equipment.models.EquipmentUpgradeStatusData;
|
||||||
|
import com.telecominfraproject.wlan.status.equipment.models.LedStatus;
|
||||||
import com.telecominfraproject.wlan.status.equipment.models.VLANStatusData;
|
import com.telecominfraproject.wlan.status.equipment.models.VLANStatusData;
|
||||||
import com.telecominfraproject.wlan.status.equipment.report.models.ActiveBSSID;
|
import com.telecominfraproject.wlan.status.equipment.report.models.ActiveBSSID;
|
||||||
import com.telecominfraproject.wlan.status.equipment.report.models.ActiveBSSIDs;
|
import com.telecominfraproject.wlan.status.equipment.report.models.ActiveBSSIDs;
|
||||||
@@ -115,12 +116,8 @@ import com.telecominfraproject.wlan.status.models.StatusCode;
|
|||||||
import com.telecominfraproject.wlan.status.models.StatusDataType;
|
import com.telecominfraproject.wlan.status.models.StatusDataType;
|
||||||
import com.telecominfraproject.wlan.status.network.models.NetworkAdminStatusData;
|
import com.telecominfraproject.wlan.status.network.models.NetworkAdminStatusData;
|
||||||
import com.telecominfraproject.wlan.systemevent.equipment.realtime.ApcElectionEvent;
|
import com.telecominfraproject.wlan.systemevent.equipment.realtime.ApcElectionEvent;
|
||||||
import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeEventType;
|
|
||||||
import com.telecominfraproject.wlan.systemevent.equipment.realtime.ApcElectionEvent.ApcMode;
|
import com.telecominfraproject.wlan.systemevent.equipment.realtime.ApcElectionEvent.ApcMode;
|
||||||
|
import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeEventType;
|
||||||
import sts.OpensyncStats.Report;
|
|
||||||
import traffic.NetworkMetadata.FlowReport;
|
|
||||||
import wc.stats.IpDnsTelemetry.WCStatsReport;
|
|
||||||
|
|
||||||
@org.springframework.context.annotation.Profile("opensync_cloud_config")
|
@org.springframework.context.annotation.Profile("opensync_cloud_config")
|
||||||
@Component
|
@Component
|
||||||
@@ -511,6 +508,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
|||||||
}
|
}
|
||||||
|
|
||||||
((EquipmentAdminStatusData) statusRecord.getDetails()).setStatusCode(StatusCode.normal);
|
((EquipmentAdminStatusData) statusRecord.getDetails()).setStatusCode(StatusCode.normal);
|
||||||
|
if (((EquipmentAdminStatusData) statusRecord.getDetails()).getLedStatus() == null) {
|
||||||
|
((EquipmentAdminStatusData) statusRecord.getDetails()).setLedStatus(LedStatus.UNKNOWN);
|
||||||
|
}
|
||||||
// Update the equipment admin status
|
// Update the equipment admin status
|
||||||
statusRecord = statusServiceInterface.update(statusRecord);
|
statusRecord = statusServiceInterface.update(statusRecord);
|
||||||
|
|
||||||
@@ -1088,7 +1088,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ApElementConfiguration apElementConfig = (ApElementConfiguration) apNode.getDetails();
|
ApElementConfiguration apElementConfig = (ApElementConfiguration) apNode.getDetails();
|
||||||
|
|
||||||
ProfileContainer profileContainer = new ProfileContainer(profileServiceInterface.getProfileWithChildren(apNode.getProfileId()));
|
ProfileContainer profileContainer = new ProfileContainer(profileServiceInterface.getProfileWithChildren(apNode.getProfileId()));
|
||||||
@@ -1225,8 +1224,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ApElementConfiguration apElementConfiguration = ((ApElementConfiguration) ce.getDetails());
|
ApElementConfiguration apElementConfiguration = ((ApElementConfiguration) ce.getDetails());
|
||||||
|
|
||||||
boolean configStateMismatch = false;
|
boolean configStateMismatch = false;
|
||||||
@@ -1452,8 +1449,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Status lanStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.LANINFO);
|
Status lanStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.LANINFO);
|
||||||
if (lanStatus == null) {
|
if (lanStatus == null) {
|
||||||
lanStatus = new Status();
|
lanStatus = new Status();
|
||||||
@@ -1583,8 +1578,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ((wifiAssociatedClients == null) || wifiAssociatedClients.isEmpty()) {
|
if ((wifiAssociatedClients == null) || wifiAssociatedClients.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1678,8 +1671,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int upgradeStatusFromAp = node.getUpgradeStatus();
|
int upgradeStatusFromAp = node.getUpgradeStatus();
|
||||||
EquipmentUpgradeState fwUpgradeState = null;
|
EquipmentUpgradeState fwUpgradeState = null;
|
||||||
FailureReason fwUpgradeFailureReason = null;
|
FailureReason fwUpgradeFailureReason = null;
|
||||||
@@ -2007,8 +1998,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
long locationId = ce.getLocationId();
|
long locationId = ce.getLocationId();
|
||||||
|
|
||||||
if (rowUpdateOperation.equals(RowUpdateOperation.INSERT) || rowUpdateOperation.equals(RowUpdateOperation.MODIFY)
|
if (rowUpdateOperation.equals(RowUpdateOperation.INSERT) || rowUpdateOperation.equals(RowUpdateOperation.MODIFY)
|
||||||
@@ -2432,4 +2421,59 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
|||||||
RealTimeEventType.APC_Election_event, customerId, ce.getLocationId(), equipmentId, System.currentTimeMillis());
|
RealTimeEventType.APC_Election_event, customerId, ce.getLocationId(), equipmentId, System.currentTimeMillis());
|
||||||
mqttMessageProcessor.publishSystemEventFromTableStateMonitor(electionEvent);
|
mqttMessageProcessor.publishSystemEventFromTableStateMonitor(electionEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void nodeStateDbTableUpdate(List<Map<String, String>> nodeStateAttributes, String apId) {
|
||||||
|
LOG.debug("start nodeStateDbTableUpdate for {}", apId);
|
||||||
|
if (LOG.isTraceEnabled())
|
||||||
|
LOG.trace("nodeStateDbTableUpdate tableAttributes {}", nodeStateAttributes);
|
||||||
|
|
||||||
|
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId);
|
||||||
|
if (ovsdbSession == null) {
|
||||||
|
LOG.warn("nodeStateDbTableUpdate::Cannot get Session for AP {}", apId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
long equipmentId = ovsdbSession.getEquipmentId();
|
||||||
|
Equipment ce = equipmentServiceInterface.getByInventoryIdOrNull(apId);
|
||||||
|
if (ce == null) {
|
||||||
|
LOG.warn("nodeStateDbTableUpdate::Cannot get Equipment for AP {}", apId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int customerId = ce.getCustomerId();
|
||||||
|
if ((customerId < 0) || (equipmentId < 0)) {
|
||||||
|
LOG.warn("nodeStateDbTableUpdate::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status eqAdminStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.EQUIPMENT_ADMIN);
|
||||||
|
|
||||||
|
LedStatus ledStatus = null;
|
||||||
|
for (Map<String, String> nsa : nodeStateAttributes) {
|
||||||
|
if (nsa.get("module").equals("led")) {
|
||||||
|
if (nsa.get("key").equals("led_blink") && nsa.get("value").equals("on")) {
|
||||||
|
ledStatus = LedStatus.led_blink;
|
||||||
|
} else if (nsa.get("key").equals("led_off") && nsa.get("value").equals("off")) {
|
||||||
|
ledStatus = LedStatus.led_off;
|
||||||
|
} else {
|
||||||
|
ledStatus = LedStatus.UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ledStatus != null) {
|
||||||
|
if (eqAdminStatus != null) {
|
||||||
|
if (((EquipmentAdminStatusData) eqAdminStatus.getDetails()).getLedStatus() == null
|
||||||
|
|| !((EquipmentAdminStatusData) eqAdminStatus.getDetails()).getLedStatus().equals(ledStatus)) {
|
||||||
|
((EquipmentAdminStatusData) eqAdminStatus.getDetails()).setLedStatus(ledStatus);
|
||||||
|
eqAdminStatus = statusServiceInterface.update(eqAdminStatus);
|
||||||
|
LOG.debug("nodeStateDbTableUpdate updated status {}", eqAdminStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.debug("finished nodeStateDbTableUpdate for {}", apId);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,5 +51,7 @@ public interface OpensyncExternalIntegrationInterface {
|
|||||||
void apcStateDbTableUpdate(Map<String, String> apcStateAttributes, String apId,
|
void apcStateDbTableUpdate(Map<String, String> apcStateAttributes, String apId,
|
||||||
RowUpdateOperation rowUpdateOperation);
|
RowUpdateOperation rowUpdateOperation);
|
||||||
|
|
||||||
|
void nodeStateDbTableUpdate(List<Map<String, String>> nodeStateAttributes, String apId);
|
||||||
|
|
||||||
void clearEquipmentStatus(String apId);
|
void clearEquipmentStatus(String apId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,4 +207,9 @@ public class OpensyncExternalIntegrationSimple implements OpensyncExternalIntegr
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void nodeStateDbTableUpdate(List<Map<String, String>> nodeStateAttributes, String apId) {
|
||||||
|
LOG.info("nodeStateDbTableUpdate for AP {}", apId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import com.vmware.ovsdb.callback.ConnectionCallback;
|
|||||||
import com.vmware.ovsdb.exception.OvsdbClientException;
|
import com.vmware.ovsdb.exception.OvsdbClientException;
|
||||||
import com.vmware.ovsdb.protocol.methods.*;
|
import com.vmware.ovsdb.protocol.methods.*;
|
||||||
import com.vmware.ovsdb.protocol.operation.notation.Row;
|
import com.vmware.ovsdb.protocol.operation.notation.Row;
|
||||||
|
import com.vmware.ovsdb.protocol.operation.notation.Value;
|
||||||
import com.vmware.ovsdb.service.OvsdbClient;
|
import com.vmware.ovsdb.service.OvsdbClient;
|
||||||
import com.vmware.ovsdb.service.OvsdbPassiveConnectionListener;
|
import com.vmware.ovsdb.service.OvsdbPassiveConnectionListener;
|
||||||
import io.netty.handler.ssl.SslContext;
|
import io.netty.handler.ssl.SslContext;
|
||||||
@@ -717,6 +718,14 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
|||||||
CompletableFuture<TableUpdates> nsCf = ovsdbClient.monitor(OvsdbDao.ovsdbName, OvsdbDao.nodeStateTable + "_" + key,
|
CompletableFuture<TableUpdates> nsCf = ovsdbClient.monitor(OvsdbDao.ovsdbName, OvsdbDao.nodeStateTable + "_" + key,
|
||||||
new MonitorRequests(ImmutableMap.of(OvsdbDao.nodeStateTable, new MonitorRequest(new MonitorSelect(true, true, true, true)))), tableUpdates -> {
|
new MonitorRequests(ImmutableMap.of(OvsdbDao.nodeStateTable, new MonitorRequest(new MonitorSelect(true, true, true, true)))), tableUpdates -> {
|
||||||
LOG.info(OvsdbDao.nodeStateTable + "_" + key + " monitor callback received {}");
|
LOG.info(OvsdbDao.nodeStateTable + "_" + key + " monitor callback received {}");
|
||||||
|
extIntegrationInterface.nodeStateDbTableUpdate(processNodeStateTableUpdate(key, tableUpdates), key);
|
||||||
|
|
||||||
|
});
|
||||||
|
extIntegrationInterface.nodeStateDbTableUpdate(processNodeStateTableUpdate(key, nsCf.join()), key);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Map<String,String>> processNodeStateTableUpdate(String key, TableUpdates tableUpdates) {
|
||||||
|
List<Map<String, String>> updates = new ArrayList<>();
|
||||||
tableUpdates.getTableUpdates().forEach((key1, value) -> {
|
tableUpdates.getTableUpdates().forEach((key1, value) -> {
|
||||||
LOG.info("TableUpdate for {}", key1);
|
LOG.info("TableUpdate for {}", key1);
|
||||||
value.getRowUpdates().values().forEach(r -> {
|
value.getRowUpdates().values().forEach(r -> {
|
||||||
@@ -725,12 +734,19 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
|||||||
}
|
}
|
||||||
if (r.getNew() != null) {
|
if (r.getNew() != null) {
|
||||||
LOG.info("Node_State new row {}", r.getNew().getColumns());
|
LOG.info("Node_State new row {}", r.getNew().getColumns());
|
||||||
|
Map<String, Value> columns = r.getNew().getColumns();
|
||||||
|
Map<String, String> update = new HashMap<>();
|
||||||
|
update.put("key", columns.get("key").toString());
|
||||||
|
update.put("module", columns.get("module").toString());
|
||||||
|
update.put("persist", columns.get("persist").toString());
|
||||||
|
update.put("value", columns.get("value").toString());
|
||||||
|
updates.add(update);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
nsCf.join();
|
return updates;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void monitorAPCStateTable(OvsdbClient ovsdbClient, String key) throws OvsdbClientException {
|
private void monitorAPCStateTable(OvsdbClient ovsdbClient, String key) throws OvsdbClientException {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
||||||
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
||||||
|
import com.telecominfraproject.wlan.equipment.models.ApElementConfiguration;
|
||||||
import com.telecominfraproject.wlan.equipment.models.CellSizeAttributes;
|
import com.telecominfraproject.wlan.equipment.models.CellSizeAttributes;
|
||||||
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.OpensyncAPConfig;
|
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPConfig;
|
||||||
@@ -86,7 +87,10 @@ public class OvsdbDao extends OvsdbDaoBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void configureNode(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncAPConfig) {
|
public void configureNode(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncAPConfig) {
|
||||||
configureNtpServer(ovsdbClient,opensyncAPConfig);configureSyslog(ovsdbClient, opensyncAPConfig);
|
configureNtpServer(ovsdbClient, opensyncAPConfig);
|
||||||
|
configureSyslog(ovsdbClient, opensyncAPConfig);
|
||||||
|
processBlinkRequest(ovsdbClient, opensyncAPConfig.getCustomerEquipment().getInventoryId(),
|
||||||
|
((ApElementConfiguration) opensyncAPConfig.getCustomerEquipment().getDetails()).isBlinkAllLEDs());
|
||||||
}
|
}
|
||||||
|
|
||||||
void configureNtpServer(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncAPConfig) {
|
void configureNtpServer(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncAPConfig) {
|
||||||
|
|||||||
Reference in New Issue
Block a user