mirror of
				https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
				synced 2025-10-31 10:37:51 +00:00 
			
		
		
		
	APs running into Backoff shows as connected
Signed-off-by: Mike Hansen <mike.hansen@connectus.ai>
This commit is contained in:
		
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -209,9 +209,9 @@ public class OpensyncCloudGatewayController { | |||||||
|                     case CellSizeAttributesRequest: |                     case CellSizeAttributesRequest: | ||||||
|                         ret.add(sendCellSizeRequest(session, (CEGWCellSizeAttributesRequest) command)); |                         ret.add(sendCellSizeRequest(session, (CEGWCellSizeAttributesRequest) command)); | ||||||
|                         break; |                         break; | ||||||
|                     case MostRecentStatsTimestamp: | //                    case MostRecentStatsTimestamp: | ||||||
|                         ret.add(sendGetMostRecentStatsTimestampRequest(command, inventoryId)); | //                        ret.add(sendGetMostRecentStatsTimestampRequest(command, inventoryId)); | ||||||
|                         break; | //                        break; | ||||||
|                     default: |                     default: | ||||||
|                         LOG.warn("[{}] Failed to deliver command {}, unsupported command type", inventoryId, command); |                         LOG.warn("[{}] Failed to deliver command {}, unsupported command type", inventoryId, command); | ||||||
|                         ret.add(new EquipmentCommandResponse(CEGWCommandResultCode.UnsupportedCommand, |                         ret.add(new EquipmentCommandResponse(CEGWCommandResultCode.UnsupportedCommand, | ||||||
| @@ -250,32 +250,7 @@ public class OpensyncCloudGatewayController { | |||||||
|         return new GatewayDefaults(); |         return new GatewayDefaults(); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     private EquipmentCommandResponse sendGetMostRecentStatsTimestampRequest(CEGWBaseCommand command, String inventoryId) { |  | ||||||
|         Long ts = lastReceivedStatsTimestamp(inventoryId); |  | ||||||
|         if (ts == null) { |  | ||||||
|             return new EquipmentCommandResponse(CEGWCommandResultCode.NoRouteToCE, |  | ||||||
|                     null, command, |  | ||||||
|                     registeredGateway == null ? null : registeredGateway.getHostname(), |  | ||||||
|                             registeredGateway == null ? -1 : registeredGateway.getPort()); |  | ||||||
|         } else { |  | ||||||
|             return new EquipmentCommandResponse(CEGWCommandResultCode.Success, |  | ||||||
|                     ts.toString(), command, |  | ||||||
|                     registeredGateway == null ? null : registeredGateway.getHostname(), |  | ||||||
|                             registeredGateway == null ? -1 : registeredGateway.getPort()); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|      |  | ||||||
|     @RequestMapping(value = "/lastReceivedStatsTimestamp", method = RequestMethod.GET) |  | ||||||
|     public Long lastReceivedStatsTimestamp(@RequestParam String apId) { |  | ||||||
|         Long ret = null; |  | ||||||
|         if (ovsdbSessionMapInterface.getSession(apId) != null) { |  | ||||||
|             ret = ovsdbSessionMapInterface.getSession(apId).getMostRecentStatsTimestamp(); |  | ||||||
|             LOG.debug("lastReceivedStatsTimestamp for apId {} {}",apId,ret); |  | ||||||
|         } else { |  | ||||||
|             LOG.warn("lastReceivedStatsTimestamp found no session for {}, cannot get timestamp",apId); |  | ||||||
|         } |  | ||||||
|         return ret; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Verify a route to customer equipment |      * Verify a route to customer equipment | ||||||
|   | |||||||
| @@ -5,7 +5,6 @@ import java.net.Inet4Address; | |||||||
| import java.net.Inet6Address; | import java.net.Inet6Address; | ||||||
| import java.net.InetAddress; | import java.net.InetAddress; | ||||||
| import java.net.UnknownHostException; | import java.net.UnknownHostException; | ||||||
| import java.text.DecimalFormat; |  | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.Collections; | import java.util.Collections; | ||||||
| import java.util.Date; | import java.util.Date; | ||||||
| @@ -52,7 +51,6 @@ import com.telecominfraproject.wlan.equipment.EquipmentServiceInterface; | |||||||
| import com.telecominfraproject.wlan.equipment.models.Equipment; | import com.telecominfraproject.wlan.equipment.models.Equipment; | ||||||
| import com.telecominfraproject.wlan.opensync.external.integration.OvsdbSession; | import com.telecominfraproject.wlan.opensync.external.integration.OvsdbSession; | ||||||
| import com.telecominfraproject.wlan.opensync.external.integration.OvsdbSessionMapInterface; | import com.telecominfraproject.wlan.opensync.external.integration.OvsdbSessionMapInterface; | ||||||
| import com.telecominfraproject.wlan.opensync.external.integration.controller.OpensyncCloudGatewayController; |  | ||||||
| import com.telecominfraproject.wlan.opensync.util.OvsdbToWlanCloudTypeMappingUtility; | import com.telecominfraproject.wlan.opensync.util.OvsdbToWlanCloudTypeMappingUtility; | ||||||
| import com.telecominfraproject.wlan.profile.ProfileServiceInterface; | import com.telecominfraproject.wlan.profile.ProfileServiceInterface; | ||||||
| import com.telecominfraproject.wlan.profile.models.Profile; | import com.telecominfraproject.wlan.profile.models.Profile; | ||||||
| @@ -140,8 +138,6 @@ public class MqttStatsPublisher implements StatsPublisherInterface { | |||||||
|     private RealtimeEventPublisher realtimeEventPublisher; |     private RealtimeEventPublisher realtimeEventPublisher; | ||||||
|     @Autowired |     @Autowired | ||||||
|     private AlarmServiceInterface alarmServiceInterface; |     private AlarmServiceInterface alarmServiceInterface; | ||||||
|     @Autowired |  | ||||||
|     private OpensyncCloudGatewayController gatewayController; |  | ||||||
|      |      | ||||||
|     @Value("${tip.wlan.mqttStatsPublisher.temperatureThresholdInC:80}") |     @Value("${tip.wlan.mqttStatsPublisher.temperatureThresholdInC:80}") | ||||||
|     private int temperatureThresholdInC; |     private int temperatureThresholdInC; | ||||||
| @@ -171,23 +167,12 @@ public class MqttStatsPublisher implements StatsPublisherInterface { | |||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (apId != null) { |  | ||||||
|             OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(extractApIdFromTopic(topic)); |  | ||||||
|             if (ovsdbSession != null) { |  | ||||||
|                 ovsdbSession.setMostRecentStatsTimestamp(System.currentTimeMillis()); |  | ||||||
|                 LOG.debug("Last metrics received from AP updated to {}",ovsdbSession.toString()); |  | ||||||
|             } else { |  | ||||||
|                 LOG.debug("No ovsdb session exists for this AP {}",apId); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|          |  | ||||||
|         int customerId = ce.getCustomerId(); |         int customerId = ce.getCustomerId(); | ||||||
|         long equipmentId = ce.getId(); |         long equipmentId = ce.getId(); | ||||||
|         long locationId = ce.getLocationId(); |         long locationId = ce.getLocationId(); | ||||||
|         long profileId = ce.getProfileId(); |         long profileId = ce.getProfileId(); | ||||||
|          |          | ||||||
|         // update timestamp for active customer equipment |         // update timestamp for active customer equipment | ||||||
|         gatewayController.updateActiveCustomer(customerId); |  | ||||||
|         List<ServiceMetric> metricRecordList = new ArrayList<>(); |         List<ServiceMetric> metricRecordList = new ArrayList<>(); | ||||||
|  |  | ||||||
|         try { |         try { | ||||||
| @@ -277,7 +262,6 @@ public class MqttStatsPublisher implements StatsPublisherInterface { | |||||||
|     @Override |     @Override | ||||||
|     public void publishSystemEventFromTableStateMonitor(SystemEvent event) { |     public void publishSystemEventFromTableStateMonitor(SystemEvent event) { | ||||||
|         LOG.info("Publishing SystemEvent received by TableStateMonitor {}", event); |         LOG.info("Publishing SystemEvent received by TableStateMonitor {}", event); | ||||||
|         gatewayController.updateActiveCustomer(event.getCustomerId()); |  | ||||||
|         cloudEventDispatcherInterface.publishEvent(event); |         cloudEventDispatcherInterface.publishEvent(event); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -176,7 +176,7 @@ public class OpensyncExternalIntegrationCloudTest { | |||||||
|         location.setDetails(details); |         location.setDetails(details); | ||||||
|         location.setName("Location-UT"); |         location.setName("Location-UT"); | ||||||
|         location.setLocationType(LocationType.BUILDING); |         location.setLocationType(LocationType.BUILDING); | ||||||
|         Mockito.when(locationServiceInterface.get(8L)).thenReturn(location); |         Mockito.when(locationServiceInterface.getOrNull(Mockito.anyLong())).thenReturn(location); | ||||||
|         Customer customer = new Customer(); |         Customer customer = new Customer(); | ||||||
|         customer.setId(2); |         customer.setId(2); | ||||||
|         CustomerDetails customerDetails = new CustomerDetails(); |         CustomerDetails customerDetails = new CustomerDetails(); | ||||||
| @@ -232,7 +232,7 @@ public class OpensyncExternalIntegrationCloudTest { | |||||||
|         opensyncExternalIntegrationCloud.apConnected("Test_Client_21P10C68818122", createConnectNodeInfo()); |         opensyncExternalIntegrationCloud.apConnected("Test_Client_21P10C68818122", createConnectNodeInfo()); | ||||||
|  |  | ||||||
|         Mockito.verify(firmwareServiceInterface).getDefaultCustomerTrackSetting(); |         Mockito.verify(firmwareServiceInterface).getDefaultCustomerTrackSetting(); | ||||||
|         Mockito.verify(locationServiceInterface).get(8L); |         Mockito.verify(locationServiceInterface).getOrNull(ArgumentMatchers.anyLong()); | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -246,7 +246,7 @@ public class OpensyncExternalIntegrationCloudTest { | |||||||
|         location.setDetails(details); |         location.setDetails(details); | ||||||
|         location.setName("Location-UT"); |         location.setName("Location-UT"); | ||||||
|         location.setLocationType(LocationType.BUILDING); |         location.setLocationType(LocationType.BUILDING); | ||||||
|         Mockito.when(locationServiceInterface.get(8L)).thenReturn(location); |         Mockito.when(locationServiceInterface.getOrNull(8L)).thenReturn(location); | ||||||
|  |  | ||||||
|         Customer customer = new Customer(); |         Customer customer = new Customer(); | ||||||
|         customer.setId(2); |         customer.setId(2); | ||||||
| @@ -326,7 +326,7 @@ public class OpensyncExternalIntegrationCloudTest { | |||||||
|         Mockito.verify(customerServiceInterface).getOrNull(ArgumentMatchers.anyInt()); |         Mockito.verify(customerServiceInterface).getOrNull(ArgumentMatchers.anyInt()); | ||||||
|         Mockito.verify(equipmentServiceInterface).getByInventoryIdOrNull("Test_Client_21P10C68818122"); |         Mockito.verify(equipmentServiceInterface).getByInventoryIdOrNull("Test_Client_21P10C68818122"); | ||||||
|         Mockito.verify(firmwareServiceInterface).getDefaultCustomerTrackSetting(); |         Mockito.verify(firmwareServiceInterface).getDefaultCustomerTrackSetting(); | ||||||
|         Mockito.verify(locationServiceInterface, Mockito.times(2)).get(ArgumentMatchers.anyLong()); |         Mockito.verify(locationServiceInterface, Mockito.times(2)).getOrNull(ArgumentMatchers.anyLong()); | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -7,7 +7,6 @@ public class OvsdbSession { | |||||||
|     private String apId; |     private String apId; | ||||||
|     private long routingId; |     private long routingId; | ||||||
|     private long equipmentId; |     private long equipmentId; | ||||||
|     private long mostRecentStatsTimestamp; |  | ||||||
|      |      | ||||||
|     public OvsdbClient getOvsdbClient() { |     public OvsdbClient getOvsdbClient() { | ||||||
|         return ovsdbClient; |         return ovsdbClient; | ||||||
| @@ -33,11 +32,5 @@ public class OvsdbSession { | |||||||
|     public void setEquipmentId(long equipmentId) { |     public void setEquipmentId(long equipmentId) { | ||||||
|         this.equipmentId = equipmentId; |         this.equipmentId = equipmentId; | ||||||
|     } |     } | ||||||
|     public long getMostRecentStatsTimestamp() { |  | ||||||
|         return mostRecentStatsTimestamp; |  | ||||||
|     } |  | ||||||
|     public void setMostRecentStatsTimestamp(long mostRecentStatsTimestamp) { |  | ||||||
|         this.mostRecentStatsTimestamp = mostRecentStatsTimestamp; |  | ||||||
|     } |  | ||||||
|   |   | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Mike Hansen
					Mike Hansen