Kyuhwi Choi
Committed by Gerrit Code Review

[ONOS-4291] Implement skeleton of gateway load balancer

 - Implements scalable gateway service
 - Implements gateway node model

Change-Id: I3713c67edcff9b10ccb23a7ad3323f5c30c7d6a3
......@@ -75,7 +75,9 @@
<module>graphitemetrics</module>
<module>xosclient</module>
<module>cordconfig</module>
</modules>
<module>scalablegateway</module>
</modules>
<properties>
<web.context>default</web.context>
......
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,
)
COMPILE_DEPS = [
'//lib:CORE_DEPS',
]
osgi_jar_with_tests (
deps = COMPILE_DEPS,
)
\ No newline at end of file
<?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
/*
* 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));
}
}
}
/*
* 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
/*
* 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
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,
)
<?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>
/*
* 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;
}
}
/*
* 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
<?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>