[ONOS-4291] Implement skeleton of gateway load balancer
- Implements scalable gateway service
- Implements gateway node model
Change-Id: I3713c67edcff9b10ccb23a7ad3323f5c30c7d6a3
diff --git a/apps/scalablegateway/BUCK b/apps/scalablegateway/BUCK
new file mode 100644
index 0000000..796b21f
--- /dev/null
+++ b/apps/scalablegateway/BUCK
@@ -0,0 +1,11 @@
+BUNDLES = [
+ '//apps/scalablegateway/api:onos-app-scalablegateway-api',
+ '//apps/scalablegateway/app:onos-app-scalablegateway-app',
+]
+
+onos_app (
+ title = 'Scalable GW App',
+ category = 'Utility',
+ url = 'http://onosproject.org',
+ included_bundles = BUNDLES,
+)
diff --git a/apps/scalablegateway/api/BUCK b/apps/scalablegateway/api/BUCK
new file mode 100644
index 0000000..ee55792
--- /dev/null
+++ b/apps/scalablegateway/api/BUCK
@@ -0,0 +1,7 @@
+COMPILE_DEPS = [
+ '//lib:CORE_DEPS',
+]
+
+osgi_jar_with_tests (
+ deps = COMPILE_DEPS,
+)
\ No newline at end of file
diff --git a/apps/scalablegateway/api/pom.xml b/apps/scalablegateway/api/pom.xml
new file mode 100644
index 0000000..353f424
--- /dev/null
+++ b/apps/scalablegateway/api/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2016-present Open Networking Laboratory
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-scalablegateway</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>onos-app-scalablegateway-api</artifactId>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-api</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/apps/scalablegateway/api/src/main/java/org/onosproject/scalablegateway/GatewayNode.java b/apps/scalablegateway/api/src/main/java/org/onosproject/scalablegateway/GatewayNode.java
new file mode 100644
index 0000000..1e2a5ed
--- /dev/null
+++ b/apps/scalablegateway/api/src/main/java/org/onosproject/scalablegateway/GatewayNode.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.scalablegateway;
+
+import com.google.common.collect.ImmutableList;
+import org.onlab.packet.Ip4Address;
+import org.onosproject.net.DeviceId;
+
+import java.util.List;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Represents SONA GatewayNode information.
+ */
+public final class GatewayNode {
+ private final DeviceId gatewayDeviceId;
+ private final List<String> gatewayExternalInterfaceNames;
+ private final Ip4Address dataIpAddress;
+
+ private GatewayNode(DeviceId gatewayDeviceId, List<String> gatewayExternalInterfaceNames,
+ Ip4Address dataIpAddress) {
+ this.gatewayDeviceId = gatewayDeviceId;
+ this.gatewayExternalInterfaceNames = gatewayExternalInterfaceNames;
+ this.dataIpAddress = dataIpAddress;
+ }
+
+ /**
+ * Returns the device id of gateway node.
+ *
+ * @return The device id of gateway node
+ */
+ public DeviceId getGatewayDeviceId() {
+ return gatewayDeviceId;
+ }
+
+ /**
+ * Returns the list of gateway`s interface names.
+ *
+ * @return The list of interface names
+ */
+ public List<String> getGatewayExternalInterfaceNames() {
+ return ImmutableList.copyOf(gatewayExternalInterfaceNames);
+ }
+
+ /**
+ * Returns the data ip address of gateway node.
+ *
+ * @return The data ip address of gateway node
+ */
+ public Ip4Address getDataIpAddress() {
+ return dataIpAddress;
+ }
+
+ /**
+ * GatewayNode Builder class.
+ */
+ public static final class Builder {
+
+ private DeviceId gatewayDeviceId;
+ private List<String> gatewayExternalInterfaceNames;
+ private Ip4Address dataIpAddress;
+
+ /**
+ * Sets the device id of gateway node.
+ *
+ * @param deviceId The device id of gateway node
+ * @return Builder object
+ */
+ public Builder gatewayDeviceId(DeviceId deviceId) {
+ this.gatewayDeviceId = deviceId;
+ return this;
+ }
+
+ /**
+ * Sets the list of gateway`s interface names.
+ *
+ * @param names The list of gateway`s interface name
+ * @return Builder object
+ */
+ public Builder gatewayExternalInterfaceNames(List<String> names) {
+ this.gatewayExternalInterfaceNames = names;
+ return this;
+ }
+
+ /**
+ * Sets the ip address of gateway node for data plain.
+ *
+ * @param address The ip address of gateway node
+ * @return Builder object
+ */
+ public Builder dataIpAddress(Ip4Address address) {
+ this.dataIpAddress = address;
+ return this;
+ }
+
+ /**
+ * Builds a GatewayNode object.
+ *
+ * @return GatewayNode object
+ */
+ public GatewayNode build() {
+ return new GatewayNode(checkNotNull(gatewayDeviceId), checkNotNull(gatewayExternalInterfaceNames),
+ checkNotNull(dataIpAddress));
+ }
+ }
+}
diff --git a/apps/scalablegateway/api/src/main/java/org/onosproject/scalablegateway/ScalableGatewayService.java b/apps/scalablegateway/api/src/main/java/org/onosproject/scalablegateway/ScalableGatewayService.java
new file mode 100644
index 0000000..403855b
--- /dev/null
+++ b/apps/scalablegateway/api/src/main/java/org/onosproject/scalablegateway/ScalableGatewayService.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.scalablegateway;
+
+import org.onosproject.core.GroupId;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+
+import java.util.List;
+
+/**
+ * ScalableGateWay Service Interface.
+ */
+public interface ScalableGatewayService {
+
+ /**
+ * Returns gateway node with the given device identifier.
+ *
+ * @param deviceId The gateway node deviceId
+ * @return The gateway node information
+ */
+ GatewayNode getGatewayNode(DeviceId deviceId);
+
+ /**
+ * Returns the list of gateway`s port numbers with the given device identifier.
+ *
+ * @param deviceId The gateway node deviceId
+ * @return The list of external interface port number
+ */
+ List<PortNumber> getGatewayExternalPorts(DeviceId deviceId);
+
+ /**
+ * Returns group id for gateway load balance.
+ *
+ * @return The group id
+ */
+ GroupId getGroupIdForGatewayLoadBalance(DeviceId srcDeviceId);
+
+ /**
+ * Returns the list of gateway node information with the given device identifier.
+ *
+ * @return The list of gateway node information
+ */
+ List<GatewayNode> getGatewayNodes();
+
+ /**
+ * Returns the list of gateway`s device identifiers.
+ *
+ * @return The list of device identifier]
+ */
+ List<DeviceId> getGatewayDeviceIds();
+
+ /**
+ * Adds gateway node in scalableGW application.
+ *
+ * @param gatewayNode Target gateway node
+ * @return Result of method call
+ */
+ boolean addGatewayNode(GatewayNode gatewayNode);
+
+ /**
+ * Removes gateway node in scalableGW application.
+ *
+ * @param gatewayNode Target gateway node
+ * @return Result of method call
+ */
+ boolean deleteGatewayNode(GatewayNode gatewayNode);
+}
\ No newline at end of file
diff --git a/apps/scalablegateway/api/src/main/java/org/onosproject/scalablegateway/package-info.java b/apps/scalablegateway/api/src/main/java/org/onosproject/scalablegateway/package-info.java
new file mode 100644
index 0000000..1768150
--- /dev/null
+++ b/apps/scalablegateway/api/src/main/java/org/onosproject/scalablegateway/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Application for ScaleableGateway management.
+ */
+package org.onosproject.scalablegateway;
\ No newline at end of file
diff --git a/apps/scalablegateway/app/BUCK b/apps/scalablegateway/app/BUCK
new file mode 100644
index 0000000..81a0dad
--- /dev/null
+++ b/apps/scalablegateway/app/BUCK
@@ -0,0 +1,13 @@
+COMPILE_DEPS = [
+ '//lib:CORE_DEPS',
+ '//apps/scalablegateway/api:onos-app-scalablegateway-api',
+]
+
+TEST_DEPS = [
+ '//lib:TEST_ADAPTERS',
+]
+
+osgi_jar_with_tests (
+ deps = COMPILE_DEPS
+ test_deps = TEST_DEPS,
+)
diff --git a/apps/scalablegateway/app/pom.xml b/apps/scalablegateway/app/pom.xml
new file mode 100644
index 0000000..23105ac
--- /dev/null
+++ b/apps/scalablegateway/app/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2016-present Open Networking Laboratory
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-scalablegateway</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>onos-app-scalablegateway-app</artifactId>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-app-scalablegateway-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/apps/scalablegateway/app/src/main/java/org/onosproject/scalablegateway/ScalableGatewayManager.java b/apps/scalablegateway/app/src/main/java/org/onosproject/scalablegateway/ScalableGatewayManager.java
new file mode 100644
index 0000000..eba3de8
--- /dev/null
+++ b/apps/scalablegateway/app/src/main/java/org/onosproject/scalablegateway/ScalableGatewayManager.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.scalablegateway;
+
+import org.onosproject.core.GroupId;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+
+import java.util.List;
+
+/**
+ * Manages gateway node for gateway scalability.
+ */
+public class ScalableGatewayManager implements ScalableGatewayService {
+
+ @Override
+ public GatewayNode getGatewayNode(DeviceId deviceId) {
+ return null;
+ }
+
+ @Override
+ public List<PortNumber> getGatewayExternalPorts(DeviceId deviceId) {
+ return null;
+ }
+
+ @Override
+ public GroupId getGroupIdForGatewayLoadBalance(DeviceId srcDeviceId) {
+ return null;
+ }
+
+ @Override
+ public List<GatewayNode> getGatewayNodes() {
+ return null;
+ }
+
+ @Override
+ public List<DeviceId> getGatewayDeviceIds() {
+ return null;
+ }
+
+ @Override
+ public boolean addGatewayNode(GatewayNode gatewayNode) {
+ return false;
+ }
+
+ @Override
+ public boolean deleteGatewayNode(GatewayNode gatewayNode) {
+ return false;
+ }
+}
diff --git a/apps/scalablegateway/app/src/main/java/org/onosproject/scalablegateway/package-info.java b/apps/scalablegateway/app/src/main/java/org/onosproject/scalablegateway/package-info.java
new file mode 100644
index 0000000..1768150
--- /dev/null
+++ b/apps/scalablegateway/app/src/main/java/org/onosproject/scalablegateway/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Application for ScaleableGateway management.
+ */
+package org.onosproject.scalablegateway;
\ No newline at end of file
diff --git a/apps/scalablegateway/pom.xml b/apps/scalablegateway/pom.xml
new file mode 100644
index 0000000..b68a0c5
--- /dev/null
+++ b/apps/scalablegateway/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2016-present Open Networking Laboratory
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-apps</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>onos-scalablegateway</artifactId>
+ <packaging>pom</packaging>
+
+ <description>ONOS ScalableGateway applications</description>
+
+ <modules>
+ <module>api</module>
+ <module>app</module>
+ </modules>
+
+</project>