Committed by
Gerrit Code Review
[ONOS-4291] Implement skeleton of gateway load balancer
- Implements scalable gateway service - Implements gateway node model Change-Id: I3713c67edcff9b10ccb23a7ad3323f5c30c7d6a3
Showing
12 changed files
with
460 additions
and
0 deletions
... | @@ -75,8 +75,10 @@ | ... | @@ -75,8 +75,10 @@ |
75 | <module>graphitemetrics</module> | 75 | <module>graphitemetrics</module> |
76 | <module>xosclient</module> | 76 | <module>xosclient</module> |
77 | <module>cordconfig</module> | 77 | <module>cordconfig</module> |
78 | + <module>scalablegateway</module> | ||
78 | </modules> | 79 | </modules> |
79 | 80 | ||
81 | + | ||
80 | <properties> | 82 | <properties> |
81 | <web.context>default</web.context> | 83 | <web.context>default</web.context> |
82 | </properties> | 84 | </properties> | ... | ... |
apps/scalablegateway/BUCK
0 → 100644
apps/scalablegateway/api/BUCK
0 → 100644
apps/scalablegateway/api/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2016-present Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
18 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
19 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
20 | + <modelVersion>4.0.0</modelVersion> | ||
21 | + | ||
22 | + <parent> | ||
23 | + <groupId>org.onosproject</groupId> | ||
24 | + <artifactId>onos-scalablegateway</artifactId> | ||
25 | + <version>1.6.0-SNAPSHOT</version> | ||
26 | + <relativePath>../pom.xml</relativePath> | ||
27 | + </parent> | ||
28 | + | ||
29 | + <artifactId>onos-app-scalablegateway-api</artifactId> | ||
30 | + <packaging>bundle</packaging> | ||
31 | + | ||
32 | + <dependencies> | ||
33 | + <dependency> | ||
34 | + <groupId>org.onosproject</groupId> | ||
35 | + <artifactId>onos-api</artifactId> | ||
36 | + </dependency> | ||
37 | + </dependencies> | ||
38 | + | ||
39 | +</project> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2016-present Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.scalablegateway; | ||
17 | + | ||
18 | +import com.google.common.collect.ImmutableList; | ||
19 | +import org.onlab.packet.Ip4Address; | ||
20 | +import org.onosproject.net.DeviceId; | ||
21 | + | ||
22 | +import java.util.List; | ||
23 | + | ||
24 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
25 | + | ||
26 | +/** | ||
27 | + * Represents SONA GatewayNode information. | ||
28 | + */ | ||
29 | +public final class GatewayNode { | ||
30 | + private final DeviceId gatewayDeviceId; | ||
31 | + private final List<String> gatewayExternalInterfaceNames; | ||
32 | + private final Ip4Address dataIpAddress; | ||
33 | + | ||
34 | + private GatewayNode(DeviceId gatewayDeviceId, List<String> gatewayExternalInterfaceNames, | ||
35 | + Ip4Address dataIpAddress) { | ||
36 | + this.gatewayDeviceId = gatewayDeviceId; | ||
37 | + this.gatewayExternalInterfaceNames = gatewayExternalInterfaceNames; | ||
38 | + this.dataIpAddress = dataIpAddress; | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
42 | + * Returns the device id of gateway node. | ||
43 | + * | ||
44 | + * @return The device id of gateway node | ||
45 | + */ | ||
46 | + public DeviceId getGatewayDeviceId() { | ||
47 | + return gatewayDeviceId; | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * Returns the list of gateway`s interface names. | ||
52 | + * | ||
53 | + * @return The list of interface names | ||
54 | + */ | ||
55 | + public List<String> getGatewayExternalInterfaceNames() { | ||
56 | + return ImmutableList.copyOf(gatewayExternalInterfaceNames); | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * Returns the data ip address of gateway node. | ||
61 | + * | ||
62 | + * @return The data ip address of gateway node | ||
63 | + */ | ||
64 | + public Ip4Address getDataIpAddress() { | ||
65 | + return dataIpAddress; | ||
66 | + } | ||
67 | + | ||
68 | + /** | ||
69 | + * GatewayNode Builder class. | ||
70 | + */ | ||
71 | + public static final class Builder { | ||
72 | + | ||
73 | + private DeviceId gatewayDeviceId; | ||
74 | + private List<String> gatewayExternalInterfaceNames; | ||
75 | + private Ip4Address dataIpAddress; | ||
76 | + | ||
77 | + /** | ||
78 | + * Sets the device id of gateway node. | ||
79 | + * | ||
80 | + * @param deviceId The device id of gateway node | ||
81 | + * @return Builder object | ||
82 | + */ | ||
83 | + public Builder gatewayDeviceId(DeviceId deviceId) { | ||
84 | + this.gatewayDeviceId = deviceId; | ||
85 | + return this; | ||
86 | + } | ||
87 | + | ||
88 | + /** | ||
89 | + * Sets the list of gateway`s interface names. | ||
90 | + * | ||
91 | + * @param names The list of gateway`s interface name | ||
92 | + * @return Builder object | ||
93 | + */ | ||
94 | + public Builder gatewayExternalInterfaceNames(List<String> names) { | ||
95 | + this.gatewayExternalInterfaceNames = names; | ||
96 | + return this; | ||
97 | + } | ||
98 | + | ||
99 | + /** | ||
100 | + * Sets the ip address of gateway node for data plain. | ||
101 | + * | ||
102 | + * @param address The ip address of gateway node | ||
103 | + * @return Builder object | ||
104 | + */ | ||
105 | + public Builder dataIpAddress(Ip4Address address) { | ||
106 | + this.dataIpAddress = address; | ||
107 | + return this; | ||
108 | + } | ||
109 | + | ||
110 | + /** | ||
111 | + * Builds a GatewayNode object. | ||
112 | + * | ||
113 | + * @return GatewayNode object | ||
114 | + */ | ||
115 | + public GatewayNode build() { | ||
116 | + return new GatewayNode(checkNotNull(gatewayDeviceId), checkNotNull(gatewayExternalInterfaceNames), | ||
117 | + checkNotNull(dataIpAddress)); | ||
118 | + } | ||
119 | + } | ||
120 | +} |
apps/scalablegateway/api/src/main/java/org/onosproject/scalablegateway/ScalableGatewayService.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016-present Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.scalablegateway; | ||
17 | + | ||
18 | +import org.onosproject.core.GroupId; | ||
19 | +import org.onosproject.net.DeviceId; | ||
20 | +import org.onosproject.net.PortNumber; | ||
21 | + | ||
22 | +import java.util.List; | ||
23 | + | ||
24 | +/** | ||
25 | + * ScalableGateWay Service Interface. | ||
26 | + */ | ||
27 | +public interface ScalableGatewayService { | ||
28 | + | ||
29 | + /** | ||
30 | + * Returns gateway node with the given device identifier. | ||
31 | + * | ||
32 | + * @param deviceId The gateway node deviceId | ||
33 | + * @return The gateway node information | ||
34 | + */ | ||
35 | + GatewayNode getGatewayNode(DeviceId deviceId); | ||
36 | + | ||
37 | + /** | ||
38 | + * Returns the list of gateway`s port numbers with the given device identifier. | ||
39 | + * | ||
40 | + * @param deviceId The gateway node deviceId | ||
41 | + * @return The list of external interface port number | ||
42 | + */ | ||
43 | + List<PortNumber> getGatewayExternalPorts(DeviceId deviceId); | ||
44 | + | ||
45 | + /** | ||
46 | + * Returns group id for gateway load balance. | ||
47 | + * | ||
48 | + * @return The group id | ||
49 | + */ | ||
50 | + GroupId getGroupIdForGatewayLoadBalance(DeviceId srcDeviceId); | ||
51 | + | ||
52 | + /** | ||
53 | + * Returns the list of gateway node information with the given device identifier. | ||
54 | + * | ||
55 | + * @return The list of gateway node information | ||
56 | + */ | ||
57 | + List<GatewayNode> getGatewayNodes(); | ||
58 | + | ||
59 | + /** | ||
60 | + * Returns the list of gateway`s device identifiers. | ||
61 | + * | ||
62 | + * @return The list of device identifier] | ||
63 | + */ | ||
64 | + List<DeviceId> getGatewayDeviceIds(); | ||
65 | + | ||
66 | + /** | ||
67 | + * Adds gateway node in scalableGW application. | ||
68 | + * | ||
69 | + * @param gatewayNode Target gateway node | ||
70 | + * @return Result of method call | ||
71 | + */ | ||
72 | + boolean addGatewayNode(GatewayNode gatewayNode); | ||
73 | + | ||
74 | + /** | ||
75 | + * Removes gateway node in scalableGW application. | ||
76 | + * | ||
77 | + * @param gatewayNode Target gateway node | ||
78 | + * @return Result of method call | ||
79 | + */ | ||
80 | + boolean deleteGatewayNode(GatewayNode gatewayNode); | ||
81 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2016-present Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | + | ||
17 | +/** | ||
18 | + * Application for ScaleableGateway management. | ||
19 | + */ | ||
20 | +package org.onosproject.scalablegateway; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
apps/scalablegateway/app/BUCK
0 → 100644
apps/scalablegateway/app/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2016-present Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
18 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
19 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
20 | + <modelVersion>4.0.0</modelVersion> | ||
21 | + | ||
22 | + <parent> | ||
23 | + <groupId>org.onosproject</groupId> | ||
24 | + <artifactId>onos-scalablegateway</artifactId> | ||
25 | + <version>1.6.0-SNAPSHOT</version> | ||
26 | + <relativePath>../pom.xml</relativePath> | ||
27 | + </parent> | ||
28 | + | ||
29 | + <artifactId>onos-app-scalablegateway-app</artifactId> | ||
30 | + <packaging>bundle</packaging> | ||
31 | + | ||
32 | + <dependencies> | ||
33 | + <dependency> | ||
34 | + <groupId>org.onosproject</groupId> | ||
35 | + <artifactId>onos-api</artifactId> | ||
36 | + </dependency> | ||
37 | + <dependency> | ||
38 | + <groupId>org.onosproject</groupId> | ||
39 | + <artifactId>onos-app-scalablegateway-api</artifactId> | ||
40 | + <version>${project.version}</version> | ||
41 | + </dependency> | ||
42 | + </dependencies> | ||
43 | + | ||
44 | +</project> |
apps/scalablegateway/app/src/main/java/org/onosproject/scalablegateway/ScalableGatewayManager.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016-present Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | + | ||
17 | +package org.onosproject.scalablegateway; | ||
18 | + | ||
19 | +import org.onosproject.core.GroupId; | ||
20 | +import org.onosproject.net.DeviceId; | ||
21 | +import org.onosproject.net.PortNumber; | ||
22 | + | ||
23 | +import java.util.List; | ||
24 | + | ||
25 | +/** | ||
26 | + * Manages gateway node for gateway scalability. | ||
27 | + */ | ||
28 | +public class ScalableGatewayManager implements ScalableGatewayService { | ||
29 | + | ||
30 | + @Override | ||
31 | + public GatewayNode getGatewayNode(DeviceId deviceId) { | ||
32 | + return null; | ||
33 | + } | ||
34 | + | ||
35 | + @Override | ||
36 | + public List<PortNumber> getGatewayExternalPorts(DeviceId deviceId) { | ||
37 | + return null; | ||
38 | + } | ||
39 | + | ||
40 | + @Override | ||
41 | + public GroupId getGroupIdForGatewayLoadBalance(DeviceId srcDeviceId) { | ||
42 | + return null; | ||
43 | + } | ||
44 | + | ||
45 | + @Override | ||
46 | + public List<GatewayNode> getGatewayNodes() { | ||
47 | + return null; | ||
48 | + } | ||
49 | + | ||
50 | + @Override | ||
51 | + public List<DeviceId> getGatewayDeviceIds() { | ||
52 | + return null; | ||
53 | + } | ||
54 | + | ||
55 | + @Override | ||
56 | + public boolean addGatewayNode(GatewayNode gatewayNode) { | ||
57 | + return false; | ||
58 | + } | ||
59 | + | ||
60 | + @Override | ||
61 | + public boolean deleteGatewayNode(GatewayNode gatewayNode) { | ||
62 | + return false; | ||
63 | + } | ||
64 | +} |
1 | +/* | ||
2 | + * Copyright 2016-present Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | + | ||
17 | +/** | ||
18 | + * Application for ScaleableGateway management. | ||
19 | + */ | ||
20 | +package org.onosproject.scalablegateway; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
apps/scalablegateway/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2016-present Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
18 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
19 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
20 | + <modelVersion>4.0.0</modelVersion> | ||
21 | + | ||
22 | + <parent> | ||
23 | + <groupId>org.onosproject</groupId> | ||
24 | + <artifactId>onos-apps</artifactId> | ||
25 | + <version>1.6.0-SNAPSHOT</version> | ||
26 | + <relativePath>../pom.xml</relativePath> | ||
27 | + </parent> | ||
28 | + | ||
29 | + <artifactId>onos-scalablegateway</artifactId> | ||
30 | + <packaging>pom</packaging> | ||
31 | + | ||
32 | + <description>ONOS ScalableGateway applications</description> | ||
33 | + | ||
34 | + <modules> | ||
35 | + <module>api</module> | ||
36 | + <module>app</module> | ||
37 | + </modules> | ||
38 | + | ||
39 | +</project> |
-
Please register or login to post a comment