diff --git a/cloud-services-build/pom.xml b/cloud-services-build/pom.xml
index a3eaa968..0d9b1509 100644
--- a/cloud-services-build/pom.xml
+++ b/cloud-services-build/pom.xml
@@ -170,6 +170,11 @@
../manufacturer-service-local
../manufacturer-service-remote
+ ../equipment-gateway-models
+ ../equipment-gateway-service-interface
+ ../equipment-gateway-service-local
+ ../equipment-gateway-service-remote
+
../provisioning-sp
../single-process-streams
diff --git a/equipment-gateway-models/pom.xml b/equipment-gateway-models/pom.xml
new file mode 100644
index 00000000..3dc2ab7f
--- /dev/null
+++ b/equipment-gateway-models/pom.xml
@@ -0,0 +1,24 @@
+
+ 4.0.0
+
+ com.telecominfraproject.wlan
+ tip-wlan-cloud-root-pom
+ 0.0.1-SNAPSHOT
+ ../../wlan-cloud-root
+
+
+ equipment-gateway-models
+ equipment-gateway-models
+ Data structures that define equipment-gateway-related objects.
+
+
+
+ com.telecominfraproject.wlan
+ base-models
+ ${tip-wlan-cloud.release.version}
+
+
+
+
+
diff --git a/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWBaseCommand.java b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWBaseCommand.java
new file mode 100644
index 00000000..35c50154
--- /dev/null
+++ b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWBaseCommand.java
@@ -0,0 +1,161 @@
+package com.telecominfraproject.wlan.equipmentgateway.models;
+
+import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
+import com.telecominfraproject.wlan.core.model.role.PortalUserRole;
+
+public class CEGWBaseCommand extends BaseJsonModel {
+
+ private static final long serialVersionUID = 1369966637498613810L;
+
+ /**
+ * Command Type
+ */
+ private CEGWCommandType commandType;
+
+ /**
+ * Equipment Identifier
+ */
+ private long equipmentId;
+
+ /**
+ * Equipment inventory Id
+ */
+ private String inventoryId;
+ /**
+ * Portal user name
+ */
+ private String userName;
+
+ /**
+ * Portal user role
+ */
+ private PortalUserRole userRole;
+
+ /**
+ * Only used to JSON decoding
+ */
+ protected CEGWBaseCommand() {
+ this.commandType = CEGWCommandType.Unknown;
+ }
+
+ protected CEGWBaseCommand(CEGWCommandType commandType, String inventoryId, long equipmentId) {
+ this(commandType, inventoryId, equipmentId, null, null);
+ }
+
+ protected CEGWBaseCommand(CEGWCommandType commandType, String inventoryId, long equipmentId,
+ PortalUserRole userRole, String userName) {
+ this.commandType = commandType;
+ this.inventoryId = inventoryId;
+ this.equipmentId = equipmentId;
+ this.userRole = userRole;
+ this.userName = userName;
+ }
+
+ @Override
+ public CEGWBaseCommand clone() {
+ return (CEGWBaseCommand) super.clone();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof CEGWBaseCommand)) {
+ return false;
+ }
+ CEGWBaseCommand other = (CEGWBaseCommand) obj;
+ if (this.commandType != other.commandType) {
+ return false;
+ }
+ if (this.equipmentId != other.equipmentId) {
+ return false;
+ }
+ if (this.inventoryId == null) {
+ if (other.inventoryId != null) {
+ return false;
+ }
+ } else if (!this.inventoryId.equals(other.inventoryId)) {
+ return false;
+ }
+ if (this.userRole != other.userRole) {
+ return false;
+ }
+ if (this.userName == null) {
+ if (other.userName != null) {
+ return false;
+ }
+ } else if (!this.userName.equals(other.userName)) {
+ return false;
+ }
+ return true;
+ }
+
+ public CEGWCommandType getCommandType() {
+ return commandType;
+ }
+
+ public long getEquipmentId() {
+ return this.equipmentId;
+ }
+
+ public String getInventoryId() {
+ return inventoryId;
+ }
+
+ public String getUsername() {
+ return userName;
+ }
+
+ public PortalUserRole getUserRole() {
+ return userRole;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((this.commandType == null) ? 0 : this.commandType.hashCode());
+ result = prime * result + (int) (this.equipmentId ^ (this.equipmentId >>> 32));
+ result = prime * result + ((this.inventoryId == null) ? 0 : this.inventoryId.hashCode());
+ result = prime * result + ((this.userRole == null) ? 0 : this.userRole.hashCode());
+ result = prime * result + ((this.userName == null) ? 0 : this.userName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean hasUnsupportedValue() {
+ if (super.hasUnsupportedValue()) {
+ return true;
+ }
+
+ if (CEGWCommandType.isUnsupported(commandType) || PortalUserRole.isUnsupported(userRole)) {
+ return true;
+ }
+ return false;
+ }
+
+ public void setCommandType(CEGWCommandType commandType) {
+ this.commandType = commandType;
+ }
+
+ public void setEquipmentId(long equipmentId) {
+ this.equipmentId = equipmentId;
+ }
+
+ public void setInventoryId(String inventoryId) {
+ this.inventoryId = inventoryId;
+ }
+
+ public void setUsername(String portalUsername) {
+ this.userName = portalUsername;
+ }
+
+ public void setUserRole(PortalUserRole portalRole) {
+ this.userRole = portalRole;
+ }
+
+}
diff --git a/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWBlinkRequest.java b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWBlinkRequest.java
new file mode 100644
index 00000000..21438dea
--- /dev/null
+++ b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWBlinkRequest.java
@@ -0,0 +1,82 @@
+package com.telecominfraproject.wlan.equipmentgateway.models;
+
+import com.telecominfraproject.wlan.core.model.equipment.LEDColour;
+
+public class CEGWBlinkRequest extends EquipmentCommand {
+
+ private static final long serialVersionUID = 3464950479960821571L;
+
+ private int numCycles;
+ private int colour1DurationMs;
+ private int colour2DurationMs;
+ private LEDColour colour1;
+ private LEDColour colour2;
+
+ /**
+ * Constructor
+ *
+ * @param inventoryId
+ * @param equipmentId
+ */
+ public CEGWBlinkRequest(String inventoryId, long equipmentId) {
+ super(CEGWCommandType.BlinkRequest, inventoryId, equipmentId);
+ }
+
+ /**
+ * Constructor used by JSON
+ */
+ public CEGWBlinkRequest() {
+ super(CEGWCommandType.BlinkRequest, null, 0);
+ }
+
+ public int getNumCycles() {
+ return numCycles;
+ }
+
+ public void setNumCycles(int numCycles) {
+ this.numCycles = numCycles;
+ }
+
+ public int getColour1DurationMs() {
+ return colour1DurationMs;
+ }
+
+ public void setColour1DurationMs(int colourDurationMs) {
+ this.colour1DurationMs = colourDurationMs;
+ }
+
+ public int getColour2DurationMs() {
+ return colour2DurationMs;
+ }
+
+ public void setColour2DurationMs(int colourDurationMs) {
+ this.colour2DurationMs = colourDurationMs;
+ }
+
+ public LEDColour getColour1() {
+ return colour1;
+ }
+
+ public void setColour1(LEDColour colour1) {
+ this.colour1 = colour1;
+ }
+
+ public LEDColour getColour2() {
+ return colour2;
+ }
+
+ public void setColour2(LEDColour colour2) {
+ this.colour2 = colour2;
+ }
+
+ @Override
+ public boolean hasUnsupportedValue() {
+ if (super.hasUnsupportedValue()) {
+ return true;
+ }
+ if (LEDColour.isUnsupported(colour1) || LEDColour.isUnsupported(colour2)) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWCloseSessionRequest.java b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWCloseSessionRequest.java
new file mode 100644
index 00000000..3f72b384
--- /dev/null
+++ b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWCloseSessionRequest.java
@@ -0,0 +1,24 @@
+package com.telecominfraproject.wlan.equipmentgateway.models;
+
+public class CEGWCloseSessionRequest extends CEGatewayCommand {
+
+
+ private static final long serialVersionUID = -263965970528271895L;
+
+ public CEGWCloseSessionRequest(String inventoryId, long equipmentId) {
+ super(CEGWCommandType.CloseSessionRequest, inventoryId, equipmentId);
+ }
+
+ /**
+ * Constructor used by JSON
+ */
+ public CEGWCloseSessionRequest() {
+ super(CEGWCommandType.CloseSessionRequest, null, 0);
+ }
+
+ @Override
+ public CEGWCloseSessionRequest clone() {
+ return (CEGWCloseSessionRequest) super.clone();
+ }
+
+}
diff --git a/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWCommandResultCode.java b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWCommandResultCode.java
new file mode 100644
index 00000000..7f2949f2
--- /dev/null
+++ b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWCommandResultCode.java
@@ -0,0 +1,30 @@
+package com.telecominfraproject.wlan.equipmentgateway.models;
+
+public enum CEGWCommandResultCode {
+ /**
+ * Successfully delivered to CE
+ */
+ Success,
+ /**
+ * No route to CE.
+ */
+ NoRouteToCE,
+ /**
+ * Failed to deliver the message to CE.
+ */
+ FailedToSend,
+ /**
+ * Timed out waiting for CE to response. CEGW will not return this code because
+ * communication is asynchronous.
+ */
+ TimedOut,
+ /**
+ * Failure reported by customer equipment CEGW will not return this code because
+ * communication is asynchronous.
+ */
+ FailedOnCE,
+ /**
+ * Command code not supported
+ */
+ UnsupportedCommand;
+}
diff --git a/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWCommandType.java b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWCommandType.java
new file mode 100644
index 00000000..efb3f72a
--- /dev/null
+++ b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWCommandType.java
@@ -0,0 +1,91 @@
+package com.telecominfraproject.wlan.equipmentgateway.models;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+
+public enum CEGWCommandType {
+ /**
+ * Notification to CE for configuration change
+ */
+ Unknown, ConfigChangeNotification, FirmwareDownloadRequest, StartDebugEngine, StopDebugEngine, FirmwareFlashRequest,
+ RebootRequest, BlinkRequest, CloseSessionRequest, NeighbourhoodReport, ClientDeauthRequest, CellSizeRequest,
+ NewChannelRequest, ReportCurrentAPCRequest, FileUpdateRequest, InterferenceThresholdUpdateRequest,
+ BestApConfigurationUpdateRequest,
+
+ /**
+ * Will tell the AP to monitor these macs filters for hardwired traffic (aka:
+ * Rogue AP)
+ */
+ BSSIDToMacMonitoringRequest,
+
+ // Will tell the AP to dynamically change channels
+ ChannelChangeAnnouncementRequest,
+
+ /**
+ * Start packet capture into file
+ */
+ StartPacketFileCapture,
+ /**
+ * Stop packet capture
+ */
+ StopPacketCapture,
+ /**
+ * Check for routing record
+ */
+ CheckRouting, ReportCurrentVLANRequest,
+
+ /**
+ * Log file upload
+ */
+ UploadLogFile,
+
+ /**
+ * For toggle PoE port on switch.
+ */
+ TogglePoERequest,
+
+ /**
+ * Reset radio
+ */
+ RadioReset,
+
+ /**
+ * Clear scan table
+ */
+ ClearScanTable,
+
+ /**
+ * For commands related to wds link of Mesh.
+ */
+ WdsRequest,
+
+ UNSUPPORTED;
+
+ @JsonCreator
+ public static CEGWCommandType getByName(String value) {
+ return deserializEnum(value, CEGWCommandType.class, UNSUPPORTED);
+ }
+
+ public static boolean isUnsupported(Object value) {
+ return UNSUPPORTED.equals(value);
+ }
+
+ /**
+ * Deserialize enumeration with default value when it's unknown.
+ *
+ * @param jsonValue
+ * @param enumType
+ * @param defaultValue
+ * @return decoded value
+ */
+ public static > E deserializEnum(String jsonValue, Class enumType, E defaultValue) {
+ if (null == jsonValue) {
+ return null;
+ }
+ try {
+ E result = E.valueOf(enumType, jsonValue);
+ return result;
+ } catch (IllegalArgumentException e) {
+ return defaultValue;
+ }
+ }
+}
diff --git a/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWConfigChangeNotification.java b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWConfigChangeNotification.java
new file mode 100644
index 00000000..3abea7fa
--- /dev/null
+++ b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWConfigChangeNotification.java
@@ -0,0 +1,24 @@
+package com.telecominfraproject.wlan.equipmentgateway.models;
+
+public class CEGWConfigChangeNotification extends EquipmentCommand {
+
+
+ private static final long serialVersionUID = 4401284478686864193L;
+
+ /**
+ * Constructor
+ *
+ * @param inventoryId
+ * @param equipmentId
+ */
+ public CEGWConfigChangeNotification(String inventoryId, long equipmentId) {
+ super(CEGWCommandType.ConfigChangeNotification, inventoryId, equipmentId);
+ }
+
+ /**
+ * Constructor used by JSON
+ */
+ protected CEGWConfigChangeNotification() {
+ super(CEGWCommandType.ConfigChangeNotification, null, 0);
+ }
+}
diff --git a/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWRouteCheck.java b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWRouteCheck.java
new file mode 100644
index 00000000..5773a4cb
--- /dev/null
+++ b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWRouteCheck.java
@@ -0,0 +1,12 @@
+package com.telecominfraproject.wlan.equipmentgateway.models;
+
+public class CEGWRouteCheck extends EquipmentCommand {
+
+ private static final long serialVersionUID = 8778460868381668813L;
+
+ public Object getRoutingId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWStartDebugEngine.java b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWStartDebugEngine.java
new file mode 100644
index 00000000..49b7e73d
--- /dev/null
+++ b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGWStartDebugEngine.java
@@ -0,0 +1,60 @@
+package com.telecominfraproject.wlan.equipmentgateway.models;
+
+public class CEGWStartDebugEngine extends EquipmentCommand {
+
+ private static final long serialVersionUID = -6768986657458247552L;
+
+ /**
+ * Gateway hostname
+ */
+ private String gatewayHostname;
+ /**
+ * Gateway port
+ */
+ private Integer gatewayPort;
+
+ /**
+ * Constructor
+ *
+ * @param inventoryId
+ * @param equipmentId
+ * @param gatewayHostname
+ * @param gatewayPort
+ */
+ public CEGWStartDebugEngine(String inventoryId, long equipmentId, String gatewayHostname, Integer gatewayPort) {
+ super(CEGWCommandType.StartDebugEngine, inventoryId, equipmentId);
+ this.setGatewayHostname(gatewayHostname);
+ this.setGatewayPort(gatewayPort);
+ }
+
+ /**
+ * Constructor used by JSON
+ */
+ public CEGWStartDebugEngine() {
+ super(CEGWCommandType.StartDebugEngine, null, 0);
+ }
+
+ public String getGatewayHostname() {
+ return gatewayHostname;
+ }
+
+ public void setGatewayHostname(String gatewayHostname) {
+ this.gatewayHostname = gatewayHostname;
+ }
+
+ public Integer getGatewayPort() {
+ return gatewayPort;
+ }
+
+ public void setGatewayPort(Integer gatewayPort) {
+ this.gatewayPort = gatewayPort;
+ }
+
+ @Override
+ public boolean hasUnsupportedValue() {
+ if (super.hasUnsupportedValue()) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGatewayCommand.java b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGatewayCommand.java
new file mode 100644
index 00000000..d14dd496
--- /dev/null
+++ b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/CEGatewayCommand.java
@@ -0,0 +1,13 @@
+package com.telecominfraproject.wlan.equipmentgateway.models;
+
+public class CEGatewayCommand extends CEGWBaseCommand {
+
+ private static final long serialVersionUID = 4545056375390115226L;
+
+ protected CEGatewayCommand() {
+ }
+
+ protected CEGatewayCommand(CEGWCommandType commandType, String inventoryId, long equipmentId) {
+ super(commandType, inventoryId, equipmentId);
+ }
+}
diff --git a/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/EquipmentCommand.java b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/EquipmentCommand.java
new file mode 100644
index 00000000..a5e5f065
--- /dev/null
+++ b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/EquipmentCommand.java
@@ -0,0 +1,21 @@
+package com.telecominfraproject.wlan.equipmentgateway.models;
+
+import com.telecominfraproject.wlan.core.model.role.PortalUserRole;
+
+public class EquipmentCommand extends CEGWBaseCommand {
+
+ private static final long serialVersionUID = -1981617366942595011L;
+
+ protected EquipmentCommand() {
+ }
+
+ protected EquipmentCommand(CEGWCommandType commandType, String inventoryId, long equipmentId) {
+ this(commandType, inventoryId, equipmentId, null, null);
+ }
+
+ protected EquipmentCommand(CEGWCommandType commandType, String inventoryId, long equipmentId,
+ PortalUserRole userRole, final String userName) {
+ super(commandType, inventoryId, equipmentId, userRole, userName);
+ }
+
+}
diff --git a/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/EquipmentCommandResponse.java b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/EquipmentCommandResponse.java
new file mode 100644
index 00000000..5d1c22e1
--- /dev/null
+++ b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/EquipmentCommandResponse.java
@@ -0,0 +1,83 @@
+package com.telecominfraproject.wlan.equipmentgateway.models;
+
+import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
+
+public class EquipmentCommandResponse extends BaseJsonModel {
+
+ private static final long serialVersionUID = 5977811650122183402L;
+
+ private CEGWCommandResultCode resultCode;
+
+ /**
+ * Detail for the result
+ */
+ private String resultDetail;
+
+ private CEGWBaseCommand command;
+
+ private String gatewayHost;
+ private int gatewayPort;
+
+ /**
+ * @param resultCode
+ * @param resultDetail
+ * @param command - equipment command for which this response is generated
+ */
+ public EquipmentCommandResponse(CEGWCommandResultCode resultCode, String resultDetail, CEGWBaseCommand command, String gatewayHost, int gatewayPort) {
+ this.resultCode = resultCode;
+ this.resultDetail = resultDetail;
+ this.command = command;
+ this.gatewayHost = gatewayHost;
+ this.gatewayPort = gatewayPort;
+ }
+
+ public EquipmentCommandResponse() {
+ }
+
+
+ public CEGWCommandResultCode getResultCode() {
+ return resultCode;
+ }
+
+ @Override
+ public EquipmentCommandResponse clone() {
+ return (EquipmentCommandResponse) super.clone();
+ }
+
+ public String getResultDetail() {
+ return resultDetail;
+ }
+
+ public void setResultDetail(String resultDetail) {
+ this.resultDetail = resultDetail;
+ }
+
+ public CEGWBaseCommand getCommand() {
+ return command;
+ }
+
+ public void setCommand(CEGWBaseCommand command) {
+ this.command = command;
+ }
+
+ public void setResultCode(CEGWCommandResultCode resultCode) {
+ this.resultCode = resultCode;
+ }
+
+ public String getGatewayHost() {
+ return gatewayHost;
+ }
+
+ public void setGatewayHost(String gatewayHost) {
+ this.gatewayHost = gatewayHost;
+ }
+
+ public int getGatewayPort() {
+ return gatewayPort;
+ }
+
+ public void setGatewayPort(int gatewayPort) {
+ this.gatewayPort = gatewayPort;
+ }
+
+}
diff --git a/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/GatewayDefaults.java b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/GatewayDefaults.java
new file mode 100644
index 00000000..03c0ad4f
--- /dev/null
+++ b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/GatewayDefaults.java
@@ -0,0 +1,35 @@
+package com.telecominfraproject.wlan.equipmentgateway.models;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.telecominfraproject.wlan.core.model.equipment.RadioType;
+import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
+
+public class GatewayDefaults extends BaseJsonModel {
+
+ private static final long serialVersionUID = 1781633756875649610L;
+
+ private Map defaults = new HashMap();
+ private Boolean default11w;
+
+ public GatewayDefaults() {
+
+ }
+
+ public Map getDefaults() {
+ return defaults;
+ }
+
+ public void setDefaults(Map defaults) {
+ this.defaults = defaults;
+ }
+
+ public Boolean getDefault11w() {
+ return default11w;
+ }
+
+ public void setDefault11w(Boolean default11w) {
+ this.default11w = default11w;
+ }
+}
diff --git a/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/GatewayRadioDefaults.java b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/GatewayRadioDefaults.java
new file mode 100644
index 00000000..c9cf66d5
--- /dev/null
+++ b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/GatewayRadioDefaults.java
@@ -0,0 +1,40 @@
+package com.telecominfraproject.wlan.equipmentgateway.models;
+
+import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
+
+public class GatewayRadioDefaults extends BaseJsonModel {
+
+ private static final long serialVersionUID = 8302320644769648937L;
+
+ private Boolean default11k;
+ private Boolean default11v;
+ private Boolean default11r;
+
+ public GatewayRadioDefaults() {
+ //
+ }
+
+ public Boolean getDefault11k() {
+ return default11k;
+ }
+
+ public void setDefault11k(Boolean default11k) {
+ this.default11k = default11k;
+ }
+
+ public Boolean getDefault11v() {
+ return default11v;
+ }
+
+ public void setDefault11v(Boolean default11v) {
+ this.default11v = default11v;
+ }
+
+ public Boolean getDefault11r() {
+ return default11r;
+ }
+
+ public void setDefault11r(Boolean default11r) {
+ this.default11r = default11r;
+ }
+}
diff --git a/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/ServiceDeploymentInfo.java b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/ServiceDeploymentInfo.java
new file mode 100644
index 00000000..3608197e
--- /dev/null
+++ b/equipment-gateway-models/src/main/java/com/telecominfraproject/wlan/equipmentgateway/models/ServiceDeploymentInfo.java
@@ -0,0 +1,157 @@
+package com.telecominfraproject.wlan.equipmentgateway.models;
+
+import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
+import com.telecominfraproject.wlan.core.model.service.GatewayType;
+
+public class ServiceDeploymentInfo extends BaseJsonModel {
+
+ private static final long serialVersionUID = 3075868930647536783L;
+
+ /**
+ * Deployment Identifier
+ */
+ private int deploymentId;
+
+ /**
+ * Type of cloud service
+ */
+ private GatewayType serviceType;
+ /**
+ * External host name
+ */
+ private String serviceHostname;
+ /**
+ * External port
+ */
+ private int servicePort;
+ /**
+ * Last time record is modified
+ */
+ private long lastModifiedTimestamp;
+
+ public ServiceDeploymentInfo() {
+ }
+
+ /**
+ * Constructor
+ *
+ * @param serivceType
+ * @param deploymentId
+ * @param serviceHostname
+ * @param servicePort
+ */
+ public ServiceDeploymentInfo(GatewayType serivceType, int deploymentId, String serviceHostname, int servicePort) {
+ this.serviceType = serivceType;
+ this.deploymentId = deploymentId;
+ this.serviceHostname = serviceHostname;
+ this.servicePort = servicePort;
+ }
+
+ @Override
+ public ServiceDeploymentInfo clone() {
+ return (ServiceDeploymentInfo) super.clone();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof ServiceDeploymentInfo)) {
+ return false;
+ }
+ ServiceDeploymentInfo other = (ServiceDeploymentInfo) obj;
+ if (deploymentId != other.deploymentId) {
+ return false;
+ }
+ if (serviceHostname == null) {
+ if (other.serviceHostname != null) {
+ return false;
+ }
+ } else if (!serviceHostname.equals(other.serviceHostname)) {
+ return false;
+ }
+ if (servicePort != other.servicePort) {
+ return false;
+ }
+ if (serviceType != other.serviceType) {
+ return false;
+ }
+ return true;
+ }
+
+ public int getDeploymentId() {
+ return deploymentId;
+ }
+
+ public long getLastModifiedTimestamp() {
+ return lastModifiedTimestamp;
+ }
+
+ public String getServiceHostname() {
+ return serviceHostname;
+ }
+
+ public int getServicePort() {
+ return servicePort;
+ }
+
+ public GatewayType getServiceType() {
+ return serviceType;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + deploymentId;
+ result = prime * result + ((serviceHostname == null) ? 0 : serviceHostname.hashCode());
+ result = prime * result + servicePort;
+ result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode());
+ return result;
+ }
+
+ public void setDeploymentId(int deploymentId) {
+ this.deploymentId = deploymentId;
+ }
+
+ public void setLastModifiedTimestamp(long lastModifiedTimestamp) {
+ this.lastModifiedTimestamp = lastModifiedTimestamp;
+ }
+
+ public void setServiceHostname(String serviceHostname) {
+ this.serviceHostname = serviceHostname;
+ }
+
+ public void setServicePort(int servicePort) {
+ this.servicePort = servicePort;
+ }
+
+ public void setServiceType(GatewayType serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ @Override
+ public boolean hasUnsupportedValue() {
+ if (super.hasUnsupportedValue()) {
+ return true;
+ }
+ if (GatewayType.isUnsupported(serviceType)) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/equipment-gateway-service-interface/pom.xml b/equipment-gateway-service-interface/pom.xml
new file mode 100644
index 00000000..970e8fc1
--- /dev/null
+++ b/equipment-gateway-service-interface/pom.xml
@@ -0,0 +1,24 @@
+
+ 4.0.0
+
+ com.telecominfraproject.wlan
+ tip-wlan-cloud-root-pom
+ 0.0.1-SNAPSHOT
+ ../../wlan-cloud-root
+
+
+ equipment-gateway-service-interface
+ equipment-gateway-service-interface
+ Interface definitions for the Equipment Gateway.
+
+
+
+ equipment-gateway-models
+ com.telecominfraproject.wlan
+ ${tip-wlan-cloud.release.version}
+
+
+
+
+
+
diff --git a/equipment-gateway-service-interface/src/main/java/com/telecominfraproject/wlan/equipmentgateway/service/EquipmentGatewayServiceInterface.java b/equipment-gateway-service-interface/src/main/java/com/telecominfraproject/wlan/equipmentgateway/service/EquipmentGatewayServiceInterface.java
new file mode 100644
index 00000000..bfc0acb9
--- /dev/null
+++ b/equipment-gateway-service-interface/src/main/java/com/telecominfraproject/wlan/equipmentgateway/service/EquipmentGatewayServiceInterface.java
@@ -0,0 +1,32 @@
+package com.telecominfraproject.wlan.equipmentgateway.service;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.telecominfraproject.wlan.equipmentgateway.models.CEGWBaseCommand;
+import com.telecominfraproject.wlan.equipmentgateway.models.EquipmentCommandResponse;
+
+/**
+ * @author dtop
+ *
Use this interface to deliver commands to the equipment.
+ * Each equipment command identifies a target equipment; routing service is used to determine host/port of the gateway that is managing the connected equipment.
+ * Method sendCommands accepts a batch of commands, each command in there can be for a different equipment, they will be routed accordingly.
+ */
+public interface EquipmentGatewayServiceInterface {
+
+ /**
+ * Send a batch of commands to the specified equipment gateway
+ * @param commands - list of commands to send to equipment
+ * @return list of command responses - one for each command in the incoming batch, in the same order as the incoming commands.
+ */
+ List sendCommands(List commands);
+
+ /**
+ * Convenience method to send a single command to the equipment gateway
+ * @param command
+ * @return command response
+ */
+ default EquipmentCommandResponse sendCommand(CEGWBaseCommand command) {
+ return sendCommands(Arrays.asList(command)).get(0);
+ }
+}
diff --git a/equipment-gateway-service-local/pom.xml b/equipment-gateway-service-local/pom.xml
new file mode 100644
index 00000000..50685367
--- /dev/null
+++ b/equipment-gateway-service-local/pom.xml
@@ -0,0 +1,29 @@
+
+ 4.0.0
+
+ com.telecominfraproject.wlan
+ tip-wlan-cloud-root-pom
+ 0.0.1-SNAPSHOT
+ ../../wlan-cloud-root
+
+
+ equipment-gateway-service-local
+ equipment-gateway-service-local
+ Local client for accessing equipment gateway, uses direct java calls within current JVM process.
+
+
+
+ equipment-gateway-service-interface
+ com.telecominfraproject.wlan
+ ${tip-wlan-cloud.release.version}
+
+
+ opensync-ext-cloud
+ com.telecominfraproject.wlan
+ ${tip-wlan-cloud.release.version}
+
+
+
+
+
+
diff --git a/equipment-gateway-service-local/src/main/java/com/telecominfraproject/wlan/equipmentgateway/service/EquipmentGatewayServiceLocal.java b/equipment-gateway-service-local/src/main/java/com/telecominfraproject/wlan/equipmentgateway/service/EquipmentGatewayServiceLocal.java
new file mode 100644
index 00000000..f8424ef2
--- /dev/null
+++ b/equipment-gateway-service-local/src/main/java/com/telecominfraproject/wlan/equipmentgateway/service/EquipmentGatewayServiceLocal.java
@@ -0,0 +1,23 @@
+package com.telecominfraproject.wlan.equipmentgateway.service;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.telecominfraproject.wlan.equipmentgateway.models.CEGWBaseCommand;
+import com.telecominfraproject.wlan.equipmentgateway.models.EquipmentCommandResponse;
+import com.telecominfraproject.wlan.opensync.external.integration.controller.OpensyncCloudGatewayController;
+
+@Component
+public class EquipmentGatewayServiceLocal implements EquipmentGatewayServiceInterface {
+
+ @Autowired OpensyncCloudGatewayController gatewayController;
+
+ @Override
+ public List sendCommands(List commands) {
+ return gatewayController.sendCommands(commands);
+ }
+
+
+}
diff --git a/equipment-gateway-service-remote/pom.xml b/equipment-gateway-service-remote/pom.xml
new file mode 100644
index 00000000..a34a54ff
--- /dev/null
+++ b/equipment-gateway-service-remote/pom.xml
@@ -0,0 +1,72 @@
+
+ 4.0.0
+
+ com.telecominfraproject.wlan
+ tip-wlan-cloud-root-pom
+ 0.0.1-SNAPSHOT
+ ../../wlan-cloud-root
+
+
+ equipment-gateway-service-remote
+ equipment-gateway-service-remote
+ Remote client for accessing equipment gateway, uses REST API calls.
+
+
+
+ equipment-gateway-service-interface
+ com.telecominfraproject.wlan
+ ${tip-wlan-cloud.release.version}
+
+
+
+ routing-service-interface
+ com.telecominfraproject.wlan
+ ${tip-wlan-cloud.release.version}
+
+
+
+ base-client
+ com.telecominfraproject.wlan
+ ${tip-wlan-cloud.release.version}
+
+
+
+
+ base-remote-tests
+ com.telecominfraproject.wlan
+ ${tip-wlan-cloud.release.version}
+ test
+
+
+
+ routing-service
+ com.telecominfraproject.wlan
+ ${tip-wlan-cloud.release.version}
+ test
+
+
+
+ routing-service-remote
+ com.telecominfraproject.wlan
+ ${tip-wlan-cloud.release.version}
+ test
+
+
+
+ routing-datastore-inmemory
+ com.telecominfraproject.wlan
+ ${tip-wlan-cloud.release.version}
+ test
+
+
+
+ cloud-event-dispatcher-empty
+ com.telecominfraproject.wlan
+ ${tip-wlan-cloud.release.version}
+ test
+
+
+
+
+
+
diff --git a/equipment-gateway-service-remote/src/main/java/com/telecominfraproject/wlan/equipmentgateway/service/EquipmentGatewayServiceRemote.java b/equipment-gateway-service-remote/src/main/java/com/telecominfraproject/wlan/equipmentgateway/service/EquipmentGatewayServiceRemote.java
new file mode 100644
index 00000000..33da3588
--- /dev/null
+++ b/equipment-gateway-service-remote/src/main/java/com/telecominfraproject/wlan/equipmentgateway/service/EquipmentGatewayServiceRemote.java
@@ -0,0 +1,121 @@
+package com.telecominfraproject.wlan.equipmentgateway.service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+
+import com.telecominfraproject.wlan.core.client.BaseRemoteClient;
+import com.telecominfraproject.wlan.equipmentgateway.models.CEGWBaseCommand;
+import com.telecominfraproject.wlan.equipmentgateway.models.EquipmentCommandResponse;
+import com.telecominfraproject.wlan.routing.RoutingServiceInterface;
+import com.telecominfraproject.wlan.routing.models.EquipmentGatewayRecord;
+
+@Component
+public class EquipmentGatewayServiceRemote extends BaseRemoteClient implements EquipmentGatewayServiceInterface {
+
+ private static final Logger LOG = LoggerFactory.getLogger(EquipmentGatewayServiceRemote.class);
+
+ private static final ParameterizedTypeReference> EquipmentCommandResponse_LIST_CLASS_TOKEN = new ParameterizedTypeReference>() {};
+
+ @Autowired RoutingServiceInterface routingServiceInterface;
+
+ private String protocol;
+
+ @Override
+ public List sendCommands(List commands) {
+ List ret = new ArrayList<>();
+
+ if(commands == null) {
+ return ret;
+ }
+
+ // split the incoming batch of commands into sub-batches per equipment id
+ Map> equipmentIdToCommandsMap = new HashMap<>();
+ commands.forEach(c -> {
+ List cmds = equipmentIdToCommandsMap.get(c.getEquipmentId() );
+ if(cmds == null) {
+ cmds = new ArrayList<>();
+ equipmentIdToCommandsMap.put(c.getEquipmentId(), cmds);
+ }
+
+ cmds.add(c);
+ });
+
+ // for each equipmentId find out EquipmentGatewayRecords (may be multiple)
+ Map> equipmentIdToGatewaysMap = new HashMap<>();
+ equipmentIdToCommandsMap.keySet().forEach(eqId -> {
+ List gateways = equipmentIdToGatewaysMap.get(eqId);
+ if(gateways == null) {
+ gateways = new ArrayList<>();
+ equipmentIdToGatewaysMap.put(eqId, gateways);
+ }
+
+ List gwList = routingServiceInterface.getRegisteredGatewayRecordList(eqId);
+ if(gwList.isEmpty()) {
+ LOG.debug("Equipment {} is offline, command not delivered", eqId);
+ }
+
+ gateways.addAll(gwList);
+
+ });
+
+ //create a map of EquipmentGatewayRecord to a batch of command for that gateway
+ Map> gatewayToCommandsMap = new HashMap<>();
+ equipmentIdToGatewaysMap.forEach( (eqId, gwList) -> gwList.forEach( gw -> {
+ List cmds = gatewayToCommandsMap.get(gw);
+ if(cmds == null) {
+ cmds = new ArrayList<>();
+ gatewayToCommandsMap.put(gw, cmds);
+ }
+
+ cmds.addAll(equipmentIdToCommandsMap.get(eqId));
+
+ }) );
+
+ // for each EquipmentGatewayRecords send the corresponding sub-batch of commands
+ gatewayToCommandsMap.forEach( (gw, cmds) -> {
+ ret.addAll(sendCommands(gw.getHostname(), gw.getPort(), cmds));
+ } );
+
+ // TODO resolve multiple responses per-command, if any
+ // (i.e. if one GW replied that equipment route is not found, and another GW replied with success, then the result should be success)
+
+ return ret;
+ }
+
+
+ public List sendCommands(String gatewayHost, int gatewayPort, List commands) {
+
+ HttpEntity request = new HttpEntity<>(commands.toString(), headers);
+
+ LOG.debug("Sending to gateway {}:{} commands {}", gatewayHost, gatewayPort, commands);
+
+ ResponseEntity> responseEntity = restTemplate.exchange(
+ getProtocol() + "://" + gatewayHost + ":" + gatewayPort + "/commands",
+ HttpMethod.POST, request, EquipmentCommandResponse_LIST_CLASS_TOKEN);
+
+ List ret = responseEntity.getBody();
+
+ LOG.debug("Response from gateway {}:{} {}", gatewayHost, gatewayPort, ret);
+
+ return ret;
+ }
+
+ public String getProtocol() {
+ if (protocol == null) {
+ protocol = environment.getProperty("tip.wlan.equipmentGatewayProtocol", "https").trim();
+ }
+ return protocol;
+ }
+
+}
diff --git a/equipment-gateway-service-remote/src/test/java/com/telecominfraproject/wlan/equipmentgateway/service/EquipmentGatewayServiceRemoteTest.java b/equipment-gateway-service-remote/src/test/java/com/telecominfraproject/wlan/equipmentgateway/service/EquipmentGatewayServiceRemoteTest.java
new file mode 100644
index 00000000..00403bb9
--- /dev/null
+++ b/equipment-gateway-service-remote/src/test/java/com/telecominfraproject/wlan/equipmentgateway/service/EquipmentGatewayServiceRemoteTest.java
@@ -0,0 +1,164 @@
+package com.telecominfraproject.wlan.equipmentgateway.service;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ActiveProfiles;
+
+import com.telecominfraproject.wlan.core.model.service.GatewayType;
+import com.telecominfraproject.wlan.equipmentgateway.models.CEGWBaseCommand;
+import com.telecominfraproject.wlan.equipmentgateway.models.CEGWBlinkRequest;
+import com.telecominfraproject.wlan.equipmentgateway.models.CEGWCommandResultCode;
+import com.telecominfraproject.wlan.equipmentgateway.models.CEGWConfigChangeNotification;
+import com.telecominfraproject.wlan.equipmentgateway.models.CEGWStartDebugEngine;
+import com.telecominfraproject.wlan.equipmentgateway.models.EquipmentCommandResponse;
+import com.telecominfraproject.wlan.remote.tests.BaseRemoteTest;
+import com.telecominfraproject.wlan.routing.RoutingServiceInterface;
+import com.telecominfraproject.wlan.routing.models.EquipmentGatewayRecord;
+import com.telecominfraproject.wlan.routing.models.EquipmentRoutingRecord;
+
+//NOTE: these profiles will be ADDED to the list of active profiles
+@ActiveProfiles(profiles = {
+ "integration_test",
+ "no_ssl","http_digest_auth","rest-template-single-user-per-service-digest-auth",
+ })
+public class EquipmentGatewayServiceRemoteTest extends BaseRemoteTest {
+
+ @Autowired EquipmentGatewayServiceInterface testInterface;
+ @Autowired RoutingServiceInterface routingInterface;
+
+ @Before public void urlSetup(){
+ configureBaseUrl("tip.wlan.routingServiceBaseUrl");
+ addProperties("tip.wlan.equipmentGatewayProtocol", "http");
+ }
+
+ @Test
+ public void testEquipmentGateway_SingleCommand() {
+ long equipmentId = getNextEquipmentId();
+ int customerId = getNextCustomerId();
+ String inventoryId = "ap-"+ equipmentId;
+
+ //create gateway record
+ EquipmentGatewayRecord equipmentGwRecord = new EquipmentGatewayRecord(GatewayType.CEGW);
+ equipmentGwRecord.setHostname("localhost");
+ equipmentGwRecord.setIpAddr("127.0.0.1");
+ equipmentGwRecord.setPort(server.getWebServer().getPort());
+
+ equipmentGwRecord = routingInterface.registerGateway(equipmentGwRecord );
+
+ //create equipment routing record
+ EquipmentRoutingRecord eqRoutingRec = new EquipmentRoutingRecord();
+ eqRoutingRec.setCustomerId(customerId);
+ eqRoutingRec.setEquipmentId(equipmentId);
+ eqRoutingRec.setGatewayId(equipmentGwRecord.getId());
+
+ eqRoutingRec = routingInterface.create(eqRoutingRec);
+
+ //now we can send a command that uses the routing info we set up earlier
+ EquipmentCommandResponse ret = testInterface.sendCommand(new CEGWBlinkRequest(inventoryId , equipmentId ));
+ assertEquals(CEGWCommandResultCode.Success, ret.getResultCode());
+ }
+
+
+ @Test
+ public void testEquipmentGateway_BulkCommands() {
+
+ int customerId = getNextCustomerId();
+
+ //create gateway record
+ EquipmentGatewayRecord equipmentGwRecord = new EquipmentGatewayRecord(GatewayType.CEGW);
+ equipmentGwRecord.setHostname("localhost");
+ equipmentGwRecord.setIpAddr("127.0.0.1");
+ equipmentGwRecord.setPort(server.getWebServer().getPort());
+
+ equipmentGwRecord = routingInterface.registerGateway(equipmentGwRecord );
+
+ List equipmentIds = new ArrayList<>();
+ long eqId;
+ for(int i=0; i<10; i++) {
+ eqId = getNextEquipmentId();
+ equipmentIds.add(eqId);
+
+ //create equipment routing records
+ EquipmentRoutingRecord eqRoutingRec = new EquipmentRoutingRecord();
+ eqRoutingRec.setCustomerId(customerId);
+ eqRoutingRec.setEquipmentId(eqId);
+ eqRoutingRec.setGatewayId(equipmentGwRecord.getId());
+
+ eqRoutingRec = routingInterface.create(eqRoutingRec);
+ }
+
+ //now we can send a batch of commands that uses the routing info we set up earlier
+ //we'll prepare 3 commands per equipment Id
+ List cmdBatch = new ArrayList<>();
+ equipmentIds.forEach(equipmentId -> {
+ cmdBatch.add(new CEGWBlinkRequest("ap-" + equipmentId, equipmentId));
+ cmdBatch.add(new CEGWConfigChangeNotification("ap-" + equipmentId, equipmentId));
+ cmdBatch.add(new CEGWStartDebugEngine("ap-" + equipmentId, equipmentId, "testDebug", 4242 ));
+ });
+
+ List ret = testInterface.sendCommands(cmdBatch);
+ assertEquals(cmdBatch.size(), ret.size());
+ ret.forEach(r -> assertEquals(CEGWCommandResultCode.Success, r.getResultCode()));
+
+ }
+
+ @Test
+ public void testEquipmentGateway_BulkCommands_multipleGateways() {
+
+ int customerId = getNextCustomerId();
+
+ // Create two gateway records.
+ // In real life only one GW record is valid per host/port, the other ones are considered stale.
+ // But in this test we are verifying that all the commands will be delivered to all the equipment across many gateways,
+ // so we are not concerned that several gateway records are created for the same host/port.
+ EquipmentGatewayRecord equipmentGwRecord1 = new EquipmentGatewayRecord(GatewayType.CEGW);
+ equipmentGwRecord1.setHostname("localhost");
+ equipmentGwRecord1.setIpAddr("127.0.0.1");
+ equipmentGwRecord1.setPort(server.getWebServer().getPort());
+
+ equipmentGwRecord1 = routingInterface.registerGateway(equipmentGwRecord1 );
+
+ EquipmentGatewayRecord equipmentGwRecord2 = new EquipmentGatewayRecord(GatewayType.CEGW);
+ equipmentGwRecord2.setHostname("localhost");
+ equipmentGwRecord2.setIpAddr("127.0.0.1");
+ equipmentGwRecord2.setPort(server.getWebServer().getPort());
+
+ equipmentGwRecord2 = routingInterface.registerGateway(equipmentGwRecord2 );
+
+ List equipmentIds = new ArrayList<>();
+ long eqId;
+ for(int i=0; i<10; i++) {
+ eqId = getNextEquipmentId();
+ equipmentIds.add(eqId);
+
+ //create equipment routing records even ones will use equipmentGwRecord1, odd ones will use equipmentGwRecord2
+ EquipmentRoutingRecord eqRoutingRec = new EquipmentRoutingRecord();
+ eqRoutingRec.setCustomerId(customerId);
+ eqRoutingRec.setEquipmentId(eqId);
+ eqRoutingRec.setGatewayId( (i%2==0) ? equipmentGwRecord1.getId() : equipmentGwRecord2.getId());
+
+ eqRoutingRec = routingInterface.create(eqRoutingRec);
+ }
+
+ //now we can send a batch of commands that uses the routing info we set up earlier
+ //we'll prepare 3 commands per equipment Id
+ List cmdBatch = new ArrayList<>();
+ equipmentIds.forEach(equipmentId -> {
+ cmdBatch.add(new CEGWBlinkRequest("ap-" + equipmentId, equipmentId));
+ cmdBatch.add(new CEGWConfigChangeNotification("ap-" + equipmentId, equipmentId));
+ cmdBatch.add(new CEGWStartDebugEngine("ap-" + equipmentId, equipmentId, "testDebug", 4242 ));
+ });
+
+ List ret = testInterface.sendCommands(cmdBatch);
+ assertEquals(cmdBatch.size(), ret.size());
+ ret.forEach(r -> assertEquals(CEGWCommandResultCode.Success, r.getResultCode()));
+
+ }
+
+}
diff --git a/equipment-gateway-service-remote/src/test/java/com/telecominfraproject/wlan/opensync/external/integration/controller/OpensyncCloudGatewayController.java b/equipment-gateway-service-remote/src/test/java/com/telecominfraproject/wlan/opensync/external/integration/controller/OpensyncCloudGatewayController.java
new file mode 100644
index 00000000..dd5f1546
--- /dev/null
+++ b/equipment-gateway-service-remote/src/test/java/com/telecominfraproject/wlan/opensync/external/integration/controller/OpensyncCloudGatewayController.java
@@ -0,0 +1,45 @@
+package com.telecominfraproject.wlan.opensync.external.integration.controller;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.telecominfraproject.wlan.equipmentgateway.models.CEGWBaseCommand;
+import com.telecominfraproject.wlan.equipmentgateway.models.CEGWCommandResultCode;
+import com.telecominfraproject.wlan.equipmentgateway.models.EquipmentCommandResponse;
+
+@RestController
+public class OpensyncCloudGatewayController {
+
+ private static final Logger LOG = LoggerFactory.getLogger(OpensyncCloudGatewayController.class);
+
+ public static class ListOfEquipmentCommandResponses extends ArrayList {
+ private static final long serialVersionUID = 3070319062835500930L;
+ }
+
+ {
+ LOG.info("***** Using mock OpensyncCloudGatewayController");
+ }
+
+ @RequestMapping(value = "/commands", method = RequestMethod.POST)
+ public ListOfEquipmentCommandResponses sendCommands(@RequestBody List commands) {
+ ListOfEquipmentCommandResponses ret = new ListOfEquipmentCommandResponses();
+ if(commands == null) {
+ return ret;
+ }
+
+ commands.forEach(command -> {
+ LOG.debug("sendCommands - processing {}", command);
+ ret.add(new EquipmentCommandResponse(CEGWCommandResultCode.Success, "", command, "mockGw", 4242) );
+ });
+
+ return ret;
+ }
+
+}
diff --git a/equipment-gateway-service-remote/src/test/resources/application.properties b/equipment-gateway-service-remote/src/test/resources/application.properties
new file mode 100644
index 00000000..1cd55782
--- /dev/null
+++ b/equipment-gateway-service-remote/src/test/resources/application.properties
@@ -0,0 +1,32 @@
+app.name=EquipmentGatewayService-Test
+# Note: this property is additive, its value is always added to the list of active profiles
+spring.profiles.include=no_ssl,http_digest_auth,rest-template-single-user-per-service-digest-auth,use_single_ds,test-email-sender
+
+spring.main.show-banner=false
+server.port=9084
+
+#this server only supports REST requests, CSRF would get in the way
+tip.wlan.csrf-enabled=false
+
+#this user/password is used together with http_digest_auth spring profile
+tip.wlan.serviceUser=user
+tip.wlan.servicePassword=password
+
+
+#used by *-remote client classes when they authenticate their requests
+tip.wlan.httpClientConfig=classpath:httpClientConfig.json
+
+#server.session-timeout= # session timeout in seconds
+#server.tomcat.max-threads = 0 # number of threads in protocol handler
+
+#server.context-path= # the context path, defaults to '/'
+#server.servlet-path= # the servlet path, defaults to '/'
+#server.tomcat.access-log-pattern= # log pattern of the access log
+#server.tomcat.access-log-enabled=false # is access logging enabled
+
+# pretty print JSON
+spring.jackson.serialization.INDENT_OUTPUT=TRUE
+# sort keys
+#http.mappers.json-sort-keys=false
+
+#spring.jmx.enabled=true # Expose MBeans from Spring
diff --git a/equipment-gateway-service-remote/src/test/resources/httpClientConfig.json b/equipment-gateway-service-remote/src/test/resources/httpClientConfig.json
new file mode 100644
index 00000000..a0af82f5
--- /dev/null
+++ b/equipment-gateway-service-remote/src/test/resources/httpClientConfig.json
@@ -0,0 +1,12 @@
+{
+"maxConnectionsTotal":100,
+"maxConnectionsPerRoute":10,
+"truststoreType":"",
+"truststoreProvider":"",
+"truststoreFile":"",
+"truststorePass":"",
+"credentialsList":[
+ {"host":"localhost","port":-1,"user":"user","password":"password"}
+ ]
+
+}
diff --git a/equipment-gateway-service-remote/src/test/resources/logback-test.xml b/equipment-gateway-service-remote/src/test/resources/logback-test.xml
new file mode 100644
index 00000000..c92f0166
--- /dev/null
+++ b/equipment-gateway-service-remote/src/test/resources/logback-test.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n%filteredStack%nopex
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+