Committed by
Gerrit Code Review
[ONOS-2112]Create an application used to manage virtual network subnet and
virtualPort resource. Change the same of onos app as vtnrsc meaning that the virtual resource. Change-Id: Ia6057acdb39a6f51c1e67c0b143df8320dbcb224
Showing
20 changed files
with
1584 additions
and
0 deletions
... | @@ -53,6 +53,7 @@ | ... | @@ -53,6 +53,7 @@ |
53 | <module>pcep-api</module> | 53 | <module>pcep-api</module> |
54 | <module>olt</module> | 54 | <module>olt</module> |
55 | <module>flowanalyzer</module> | 55 | <module>flowanalyzer</module> |
56 | + <module>vtnrsc</module> | ||
56 | </modules> | 57 | </modules> |
57 | 58 | ||
58 | <properties> | 59 | <properties> | ... | ... |
apps/vtnrsc/pom.xml
0 → 100644
1 | +<?xml version="1.0"?> | ||
2 | +<project | ||
3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" | ||
4 | + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
5 | + <modelVersion>4.0.0</modelVersion> | ||
6 | + <parent> | ||
7 | + <groupId>org.onosproject</groupId> | ||
8 | + <artifactId>onos-apps</artifactId> | ||
9 | + <version>1.3.0-SNAPSHOT</version> | ||
10 | + <relativePath>../pom.xml</relativePath> | ||
11 | + </parent> | ||
12 | + | ||
13 | + | ||
14 | + <artifactId>onos-app-vtnrsc</artifactId> | ||
15 | + <packaging>bundle</packaging> | ||
16 | + | ||
17 | + | ||
18 | + <properties> | ||
19 | + <onos.app.name>org.onosproject.vtnrsc</onos.app.name> | ||
20 | + <web.context>/onos/vtn</web.context> | ||
21 | + </properties> | ||
22 | + <dependencies> | ||
23 | + <dependency> | ||
24 | + <groupId>javax.ws.rs</groupId> | ||
25 | + <artifactId>jsr311-api</artifactId> | ||
26 | + <version>1.1.1</version> | ||
27 | + </dependency> | ||
28 | + <dependency> | ||
29 | + <groupId>org.onosproject</groupId> | ||
30 | + <artifactId>onos-api</artifactId> | ||
31 | + </dependency> | ||
32 | + <dependency> | ||
33 | + <groupId>org.onosproject</groupId> | ||
34 | + <artifactId>onos-cli</artifactId> | ||
35 | + <version>${project.version}</version> | ||
36 | + </dependency> | ||
37 | + <dependency> | ||
38 | + <groupId>org.apache.felix</groupId> | ||
39 | + <artifactId>org.apache.felix.scr.annotations</artifactId> | ||
40 | + </dependency> | ||
41 | + <dependency> | ||
42 | + <groupId>org.apache.karaf.shell</groupId> | ||
43 | + <artifactId>org.apache.karaf.shell.console</artifactId> | ||
44 | + </dependency> | ||
45 | + </dependencies> | ||
46 | + | ||
47 | + <build> | ||
48 | + <plugins> | ||
49 | + <plugin> | ||
50 | + <groupId>org.apache.felix</groupId> | ||
51 | + <artifactId>maven-bundle-plugin</artifactId> | ||
52 | + <extensions>true</extensions> | ||
53 | + <configuration> | ||
54 | + <instructions> | ||
55 | + <_wab>src/main/webapp/</_wab> | ||
56 | + <Bundle-SymbolicName> | ||
57 | + ${project.groupId}.${project.artifactId} | ||
58 | + </Bundle-SymbolicName> | ||
59 | + <Import-Package> | ||
60 | + org.slf4j, | ||
61 | + org.osgi.framework, | ||
62 | + javax.ws.rs, | ||
63 | + javax.ws.rs.core, | ||
64 | + com.sun.jersey.api.core, | ||
65 | + com.sun.jersey.spi.container.servlet, | ||
66 | + com.sun.jersey.server.impl.container.servlet, | ||
67 | + com.fasterxml.jackson.databind, | ||
68 | + com.fasterxml.jackson.databind.node, | ||
69 | + com.fasterxml.jackson.core, | ||
70 | + org.apache.karaf.shell.commands, | ||
71 | + org.apache.commons.lang.math.*, | ||
72 | + com.google.common.*, | ||
73 | + org.onlab.packet.*, | ||
74 | + org.onlab.rest.*, | ||
75 | + org.onosproject.*, | ||
76 | + org.onlab.util.*, | ||
77 | + org.jboss.netty.util.* | ||
78 | + </Import-Package> | ||
79 | + <Web-ContextPath>${web.context}</Web-ContextPath> | ||
80 | + </instructions> | ||
81 | + </configuration> | ||
82 | + </plugin> | ||
83 | + </plugins> | ||
84 | + </build> | ||
85 | + | ||
86 | +</project> |
1 | +/* | ||
2 | + * Copyright 2015 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.app.vtnrsc; | ||
17 | + | ||
18 | +import org.onlab.packet.IpAddress; | ||
19 | + | ||
20 | +/** | ||
21 | + * The continuous IP address range between the start address and the end address for the allocation pools. | ||
22 | + */ | ||
23 | +public interface AllocationPool { | ||
24 | + | ||
25 | + /** | ||
26 | + * The start address for the allocation pool. | ||
27 | + * | ||
28 | + * @return startIp | ||
29 | + */ | ||
30 | + IpAddress startIP(); | ||
31 | + | ||
32 | + /** | ||
33 | + * The end address for the allocation pool. | ||
34 | + * | ||
35 | + * @return endIp | ||
36 | + */ | ||
37 | + IpAddress endIP(); | ||
38 | +} |
1 | +/* | ||
2 | + * Copyright 2015 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.app.vtnrsc; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
20 | + | ||
21 | +import java.util.Objects; | ||
22 | + | ||
23 | +import org.onlab.packet.IpAddress; | ||
24 | +import org.onlab.packet.MacAddress; | ||
25 | + | ||
26 | +/** | ||
27 | + * Immutable representation of a allowed address pair. | ||
28 | + */ | ||
29 | +public final class AllowedAddressPair { | ||
30 | + private final IpAddress ip; | ||
31 | + private final MacAddress mac; | ||
32 | + // Public construction is prohibited | ||
33 | + private AllowedAddressPair(IpAddress ip, MacAddress mac) { | ||
34 | + checkNotNull(ip, "IpAddress cannot be null"); | ||
35 | + checkNotNull(mac, "MacAddress cannot be null"); | ||
36 | + this.ip = ip; | ||
37 | + this.mac = mac; | ||
38 | + } | ||
39 | + /** | ||
40 | + * Returns the AllowedAddressPair ip address. | ||
41 | + * | ||
42 | + * @return ip address | ||
43 | + */ | ||
44 | + public IpAddress ip() { | ||
45 | + return ip; | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * Returns the AllowedAddressPair MAC address. | ||
50 | + * | ||
51 | + * @return MAC address | ||
52 | + */ | ||
53 | + public MacAddress mac() { | ||
54 | + return mac; | ||
55 | + } | ||
56 | + | ||
57 | + | ||
58 | + /** | ||
59 | + * Creates a allowedAddressPair using the supplied ipAddress & | ||
60 | + * macAddress. | ||
61 | + * | ||
62 | + * @param ip IP address | ||
63 | + * @param mac MAC address | ||
64 | + * @return AllowedAddressPair | ||
65 | + */ | ||
66 | + public static AllowedAddressPair allowedAddressPair(IpAddress ip, | ||
67 | + MacAddress mac) { | ||
68 | + return new AllowedAddressPair(ip, mac); | ||
69 | + } | ||
70 | + | ||
71 | + @Override | ||
72 | + public int hashCode() { | ||
73 | + return Objects.hash(ip, mac); | ||
74 | + } | ||
75 | + | ||
76 | + @Override | ||
77 | + public boolean equals(Object obj) { | ||
78 | + if (this == obj) { | ||
79 | + return true; | ||
80 | + } | ||
81 | + if (obj instanceof AllowedAddressPair) { | ||
82 | + final AllowedAddressPair that = (AllowedAddressPair) obj; | ||
83 | + return Objects.equals(this.ip, that.ip) | ||
84 | + && Objects.equals(this.mac, that.mac); | ||
85 | + } | ||
86 | + return false; | ||
87 | + } | ||
88 | + | ||
89 | + @Override | ||
90 | + public String toString() { | ||
91 | + return toStringHelper(this).add("ip", ip).add("mac", mac).toString(); | ||
92 | + } | ||
93 | + | ||
94 | +} |
1 | +/* | ||
2 | + * Copyright 2015 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.app.vtnrsc; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
20 | + | ||
21 | +import java.util.Objects; | ||
22 | + | ||
23 | +import org.onlab.packet.IpAddress; | ||
24 | + | ||
25 | +/** | ||
26 | + * Immutable representation of a IP address for the port, Include the IP address | ||
27 | + * and subnet identity. | ||
28 | + */ | ||
29 | +public final class FixedIp { | ||
30 | + private final SubnetId subnetId; | ||
31 | + private final IpAddress ip; | ||
32 | + // Public construction is prohibited | ||
33 | + private FixedIp(SubnetId subnetId, IpAddress ip) { | ||
34 | + checkNotNull(subnetId, "SubnetId cannot be null"); | ||
35 | + checkNotNull(ip, "IpAddress cannot be null"); | ||
36 | + this.subnetId = subnetId; | ||
37 | + this.ip = ip; | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * Returns the FixedIp subnet identifier. | ||
42 | + * | ||
43 | + * @return subnet identifier | ||
44 | + */ | ||
45 | + public SubnetId subnetId() { | ||
46 | + return subnetId; | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * Returns the FixedIp IP address. | ||
51 | + * | ||
52 | + * @return IP address | ||
53 | + */ | ||
54 | + public IpAddress ip() { | ||
55 | + return ip; | ||
56 | + } | ||
57 | + | ||
58 | + /** | ||
59 | + * Creates a fixed ip using the supplied fixedIp. | ||
60 | + * | ||
61 | + * @param subnetId subnet identity | ||
62 | + * @param ip IP address | ||
63 | + * @return FixedIp | ||
64 | + */ | ||
65 | + public static FixedIp fixedIp(SubnetId subnetId, IpAddress ip) { | ||
66 | + return new FixedIp(subnetId, ip); | ||
67 | + } | ||
68 | + | ||
69 | + @Override | ||
70 | + public int hashCode() { | ||
71 | + return Objects.hash(subnetId, ip); | ||
72 | + } | ||
73 | + | ||
74 | + @Override | ||
75 | + public boolean equals(Object obj) { | ||
76 | + if (this == obj) { | ||
77 | + return true; | ||
78 | + } | ||
79 | + if (obj instanceof FixedIp) { | ||
80 | + final FixedIp that = (FixedIp) obj; | ||
81 | + return Objects.equals(this.subnetId, that.subnetId) | ||
82 | + && Objects.equals(this.ip, that.ip); | ||
83 | + } | ||
84 | + return false; | ||
85 | + } | ||
86 | + | ||
87 | + @Override | ||
88 | + public String toString() { | ||
89 | + return toStringHelper(this).add("subnetId", subnetId).add("ip", ip) | ||
90 | + .toString(); | ||
91 | + } | ||
92 | + | ||
93 | +} |
1 | +/* | ||
2 | + * Copyright 2015 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.app.vtnrsc; | ||
17 | + | ||
18 | +import org.onlab.packet.IpAddress; | ||
19 | +import org.onlab.packet.IpPrefix; | ||
20 | + | ||
21 | +/** | ||
22 | + * Host route dictionaries for the subnet. | ||
23 | + */ | ||
24 | +public interface HostRoute { | ||
25 | + | ||
26 | + /** | ||
27 | + * Returns the next hop address. | ||
28 | + * | ||
29 | + * @return next hop address | ||
30 | + */ | ||
31 | + IpAddress nexthop(); | ||
32 | + | ||
33 | + /** | ||
34 | + * Returns the destination address. | ||
35 | + * | ||
36 | + * @return destination address | ||
37 | + */ | ||
38 | + IpPrefix destination(); | ||
39 | +} |
1 | +/* | ||
2 | + * Copyright 2015 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.app.vtnrsc; | ||
17 | + | ||
18 | +import java.util.Objects; | ||
19 | + | ||
20 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
21 | + | ||
22 | +/** | ||
23 | + * Immutable representation of a physicalnetwork identity. | ||
24 | + */ | ||
25 | +public final class PhysicalNetwork { | ||
26 | + | ||
27 | + private final String physicalnetwork; | ||
28 | + | ||
29 | + // Public construction is prohibited | ||
30 | + private PhysicalNetwork(String physicalnetwork) { | ||
31 | + checkNotNull(physicalnetwork, "Physicalnetwork cannot be null"); | ||
32 | + this.physicalnetwork = physicalnetwork; | ||
33 | + } | ||
34 | + | ||
35 | + /** | ||
36 | + * Creates a network id using the physicalnetwork. | ||
37 | + * | ||
38 | + * @param physicalnetwork network String | ||
39 | + * @return physicalnetwork | ||
40 | + */ | ||
41 | + public static PhysicalNetwork physicalNetwork(String physicalnetwork) { | ||
42 | + return new PhysicalNetwork(physicalnetwork); | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * | ||
47 | + * @return physicalnetwork | ||
48 | + */ | ||
49 | + public String physicalnetwork() { | ||
50 | + return physicalnetwork; | ||
51 | + } | ||
52 | + | ||
53 | + @Override | ||
54 | + public int hashCode() { | ||
55 | + return Objects.hash(physicalnetwork); | ||
56 | + } | ||
57 | + | ||
58 | + @Override | ||
59 | + public boolean equals(Object obj) { | ||
60 | + if (this == obj) { | ||
61 | + return true; | ||
62 | + } | ||
63 | + if (obj instanceof PhysicalNetwork) { | ||
64 | + final PhysicalNetwork that = (PhysicalNetwork) obj; | ||
65 | + return this.getClass() == that.getClass() | ||
66 | + && Objects.equals(this.physicalnetwork, | ||
67 | + that.physicalnetwork); | ||
68 | + } | ||
69 | + return false; | ||
70 | + } | ||
71 | + | ||
72 | + @Override | ||
73 | + public String toString() { | ||
74 | + return physicalnetwork; | ||
75 | + } | ||
76 | + | ||
77 | +} |
1 | +/* | ||
2 | + * Copyright 2015 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.app.vtnrsc; | ||
17 | + | ||
18 | +import java.util.Objects; | ||
19 | + | ||
20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
22 | + | ||
23 | +/** | ||
24 | + * Immutable representation of a security group. | ||
25 | + */ | ||
26 | +public final class SecurityGroup { | ||
27 | + private final String securityGroup; | ||
28 | + | ||
29 | + /** | ||
30 | + * Returns the securityGroup. | ||
31 | + * | ||
32 | + * @return securityGroup | ||
33 | + */ | ||
34 | + public String securityGroup() { | ||
35 | + return securityGroup; | ||
36 | + } | ||
37 | + // Public construction is prohibited | ||
38 | + private SecurityGroup(String securityGroup) { | ||
39 | + checkNotNull(securityGroup, "SecurityGroup cannot be null"); | ||
40 | + this.securityGroup = securityGroup; | ||
41 | + } | ||
42 | + | ||
43 | + /** | ||
44 | + * Creates a securityGroup using the supplied securityGroup. | ||
45 | + * | ||
46 | + * @param securityGroup security group | ||
47 | + * @return securityGroup | ||
48 | + */ | ||
49 | + public static SecurityGroup securityGroup(String securityGroup) { | ||
50 | + return new SecurityGroup(securityGroup); | ||
51 | + } | ||
52 | + | ||
53 | + @Override | ||
54 | + public int hashCode() { | ||
55 | + return Objects.hash(securityGroup); | ||
56 | + } | ||
57 | + | ||
58 | + @Override | ||
59 | + public boolean equals(Object obj) { | ||
60 | + if (this == obj) { | ||
61 | + return true; | ||
62 | + } | ||
63 | + if (obj instanceof SecurityGroup) { | ||
64 | + final SecurityGroup that = (SecurityGroup) obj; | ||
65 | + return this.getClass() == that.getClass() | ||
66 | + && Objects.equals(this.securityGroup, that.securityGroup); | ||
67 | + } | ||
68 | + return false; | ||
69 | + } | ||
70 | + | ||
71 | + @Override | ||
72 | + public String toString() { | ||
73 | + return toStringHelper(this).add("securityGroup", securityGroup) | ||
74 | + .toString(); | ||
75 | + } | ||
76 | + | ||
77 | +} |
1 | +/* | ||
2 | + * Copyright 2015 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.app.vtnrsc; | ||
17 | + | ||
18 | +import java.util.Objects; | ||
19 | + | ||
20 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
21 | + | ||
22 | +/** | ||
23 | + * Immutable representation of a Segmentation identity. | ||
24 | + */ | ||
25 | +public final class SegmentationId { | ||
26 | + | ||
27 | + private final String segmentationid; | ||
28 | + | ||
29 | + // Public construction is prohibited | ||
30 | + private SegmentationId(String segmentationid) { | ||
31 | + checkNotNull(segmentationid, "Segmentationid cannot be null"); | ||
32 | + this.segmentationid = segmentationid; | ||
33 | + } | ||
34 | + | ||
35 | + /** | ||
36 | + * Creates a network id using the segmentationid. | ||
37 | + * | ||
38 | + * @param segmentationid network String | ||
39 | + * @return SegmentationId | ||
40 | + */ | ||
41 | + public static SegmentationId segmentationID(String segmentationid) { | ||
42 | + return new SegmentationId(segmentationid); | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * | ||
47 | + * @return segmentationid | ||
48 | + */ | ||
49 | + public String segmentationid() { | ||
50 | + return segmentationid; | ||
51 | + } | ||
52 | + | ||
53 | + @Override | ||
54 | + public int hashCode() { | ||
55 | + return Objects.hash(segmentationid); | ||
56 | + } | ||
57 | + | ||
58 | + @Override | ||
59 | + public boolean equals(Object obj) { | ||
60 | + if (this == obj) { | ||
61 | + return true; | ||
62 | + } | ||
63 | + if (obj instanceof SegmentationId) { | ||
64 | + final SegmentationId that = (SegmentationId) obj; | ||
65 | + return this.getClass() == that.getClass() | ||
66 | + && Objects.equals(this.segmentationid, that.segmentationid); | ||
67 | + } | ||
68 | + return false; | ||
69 | + } | ||
70 | + | ||
71 | + @Override | ||
72 | + public String toString() { | ||
73 | + return segmentationid; | ||
74 | + } | ||
75 | + | ||
76 | +} |
1 | +/* | ||
2 | + *Copyright 2014 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.app.vtnrsc; | ||
17 | + | ||
18 | +import org.onlab.packet.IpAddress; | ||
19 | +import org.onlab.packet.IpAddress.Version; | ||
20 | +import org.onlab.packet.IpPrefix; | ||
21 | + | ||
22 | +/** | ||
23 | + * Representation of a subnet. | ||
24 | + */ | ||
25 | +public interface Subnet { | ||
26 | + | ||
27 | + /** | ||
28 | + * Coarse classification of the type of the ipV6Mode. | ||
29 | + */ | ||
30 | + public enum Mode { | ||
31 | + DHCPV6_STATEFUL, DHCPV6_STATELESS, SLAAC | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * Returns the ID of the subnet. | ||
36 | + * | ||
37 | + * @return id | ||
38 | + */ | ||
39 | + SubnetId id(); | ||
40 | + | ||
41 | + /** | ||
42 | + * Returns the name of the subnet. | ||
43 | + * | ||
44 | + * @return subnetName | ||
45 | + */ | ||
46 | + String subnetName(); | ||
47 | + | ||
48 | + /** | ||
49 | + * Returns the ID of the attached network. | ||
50 | + * | ||
51 | + * @return networkID | ||
52 | + */ | ||
53 | + TenantNetworkId networkId(); | ||
54 | + | ||
55 | + /** | ||
56 | + * Returns the The ID of the tenant who owns the network. Only | ||
57 | + * administrative users can specify a tenant ID other than their own. You | ||
58 | + * cannot change this value through authorization policies. | ||
59 | + * | ||
60 | + * @return tenantID | ||
61 | + */ | ||
62 | + TenantId tenantId(); | ||
63 | + | ||
64 | + /** | ||
65 | + * Returns the IP version, which is 4 or 6. | ||
66 | + * | ||
67 | + * @return ipVersion | ||
68 | + */ | ||
69 | + Version ipVersion(); | ||
70 | + | ||
71 | + /** | ||
72 | + * Returns the cidr. | ||
73 | + * | ||
74 | + * @return cidr | ||
75 | + */ | ||
76 | + IpPrefix cidr(); | ||
77 | + | ||
78 | + /** | ||
79 | + * Returns the gateway IP address.. | ||
80 | + * | ||
81 | + * @return gatewayIP | ||
82 | + */ | ||
83 | + IpAddress gatewayIp(); | ||
84 | + | ||
85 | + /** | ||
86 | + * Returns true if DHCP is enabled and return false if DHCP is disabled. | ||
87 | + * | ||
88 | + * @return dhcpEnabled | ||
89 | + */ | ||
90 | + boolean dhcpEnabled(); | ||
91 | + | ||
92 | + /** | ||
93 | + * Indicates whether this tenantNetwork is shared across all tenants. By | ||
94 | + * default,only administrative user can change this value. | ||
95 | + * | ||
96 | + * @return shared | ||
97 | + */ | ||
98 | + boolean shared(); | ||
99 | + | ||
100 | + /** | ||
101 | + * Returns an iterable collections of hostRoutes. | ||
102 | + * | ||
103 | + * @return hostRoutes collection | ||
104 | + */ | ||
105 | + Iterable<HostRoute> hostRoutes(); | ||
106 | + | ||
107 | + /** | ||
108 | + * Returns the ipV6AddressMode. A valid value is dhcpv6-stateful, | ||
109 | + * dhcpv6-stateless, or slaac. | ||
110 | + * | ||
111 | + * @return ipV6AddressMode | ||
112 | + */ | ||
113 | + Mode ipV6AddressMode(); | ||
114 | + | ||
115 | + /** | ||
116 | + * Returns the ipV6RaMode.A valid value is dhcpv6-stateful, | ||
117 | + * dhcpv6-stateless, or slaac. | ||
118 | + * | ||
119 | + * @return ipV6RaMode | ||
120 | + */ | ||
121 | + Mode ipV6RaMode(); | ||
122 | + | ||
123 | + /** | ||
124 | + * Returns an iterable collection of allocation_pools. | ||
125 | + * | ||
126 | + * @return allocationPools collection | ||
127 | + */ | ||
128 | + | ||
129 | + Iterable<AllocationPool> allocationPools(); | ||
130 | +} |
1 | +/* | ||
2 | + * Copyright 2015 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.app.vtnrsc; | ||
17 | + | ||
18 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Immutable representation of a subnet identity. | ||
24 | + */ | ||
25 | +public final class SubnetId { | ||
26 | + | ||
27 | + private final String subnetId; | ||
28 | + | ||
29 | + // Public construction is prohibited | ||
30 | + private SubnetId(String subnetId) { | ||
31 | + checkNotNull(subnetId, "SubnetId cannot be null"); | ||
32 | + this.subnetId = subnetId; | ||
33 | + } | ||
34 | + | ||
35 | + /** | ||
36 | + * Creates a subnet identifier. | ||
37 | + * | ||
38 | + * @param subnetId subnet identifier | ||
39 | + * @return SubnetId SubnetId | ||
40 | + */ | ||
41 | + public static SubnetId subnetId(String subnetId) { | ||
42 | + return new SubnetId(subnetId); | ||
43 | + } | ||
44 | + | ||
45 | + @Override | ||
46 | + public int hashCode() { | ||
47 | + return Objects.hash(subnetId); | ||
48 | + } | ||
49 | + | ||
50 | + @Override | ||
51 | + public boolean equals(Object obj) { | ||
52 | + if (this == obj) { | ||
53 | + return true; | ||
54 | + } | ||
55 | + if (obj instanceof SubnetId) { | ||
56 | + final SubnetId that = (SubnetId) obj; | ||
57 | + return this.getClass() == that.getClass() | ||
58 | + && Objects.equals(this.subnetId, that.subnetId); | ||
59 | + } | ||
60 | + return false; | ||
61 | + } | ||
62 | + | ||
63 | + @Override | ||
64 | + public String toString() { | ||
65 | + return subnetId; | ||
66 | + } | ||
67 | + | ||
68 | +} |
1 | +/* | ||
2 | + * Copyright 2015 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.app.vtnrsc; | ||
17 | + | ||
18 | +import java.util.Objects; | ||
19 | + | ||
20 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
21 | + | ||
22 | +/** | ||
23 | + * Immutable representation of a network identity. | ||
24 | + */ | ||
25 | +public final class TenantId { | ||
26 | + | ||
27 | + private final String tenantid; | ||
28 | + | ||
29 | + // Public construction is prohibited | ||
30 | + private TenantId(String tenantid) { | ||
31 | + this.tenantid = tenantid; | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * Creates a network id using the tenantid. | ||
36 | + * | ||
37 | + * @param tenantid network String | ||
38 | + * @return TenantId | ||
39 | + */ | ||
40 | + public static TenantId tenantId(String tenantid) { | ||
41 | + checkNotNull(tenantid, "Tenantid can not be null"); | ||
42 | + return new TenantId(tenantid); | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * | ||
47 | + * @return tenantid | ||
48 | + */ | ||
49 | + public String tenantid() { | ||
50 | + return tenantid; | ||
51 | + } | ||
52 | + | ||
53 | + @Override | ||
54 | + public int hashCode() { | ||
55 | + return Objects.hash(tenantid); | ||
56 | + } | ||
57 | + | ||
58 | + @Override | ||
59 | + public boolean equals(Object obj) { | ||
60 | + if (this == obj) { | ||
61 | + return true; | ||
62 | + } | ||
63 | + if (obj instanceof TenantId) { | ||
64 | + final TenantId that = (TenantId) obj; | ||
65 | + return this.getClass() == that.getClass() | ||
66 | + && Objects.equals(this.tenantid, that.tenantid); | ||
67 | + } | ||
68 | + return false; | ||
69 | + } | ||
70 | + | ||
71 | + @Override | ||
72 | + public String toString() { | ||
73 | + return tenantid; | ||
74 | + } | ||
75 | + | ||
76 | +} |
1 | +/* | ||
2 | + * Copyright 2015 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.app.vtnrsc; | ||
17 | + | ||
18 | +/** | ||
19 | + * Representation of the tenantNetwork. | ||
20 | + */ | ||
21 | +public interface TenantNetwork { | ||
22 | + | ||
23 | + /** | ||
24 | + * Coarse classification of the state of the tenantNetwork. | ||
25 | + */ | ||
26 | + public enum State { | ||
27 | + /** | ||
28 | + * Signifies that a tenantNetwork is currently active.This state means | ||
29 | + * that this network is available. | ||
30 | + */ | ||
31 | + ACTIVE, | ||
32 | + /** | ||
33 | + * Signifies that a tenantNetwork is currently built. | ||
34 | + */ | ||
35 | + BUILD, | ||
36 | + /** | ||
37 | + * Signifies that a tenantNetwork is currently unavailable. | ||
38 | + */ | ||
39 | + DOWN, | ||
40 | + /** | ||
41 | + * Signifies that a tenantNetwork is currently error. | ||
42 | + */ | ||
43 | + ERROR | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * Coarse classification of the type of the tenantNetwork. | ||
48 | + */ | ||
49 | + public enum Type { | ||
50 | + /** | ||
51 | + * Signifies that a tenantNetwork is local. | ||
52 | + */ | ||
53 | + LOCAL | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * Returns the tenantNetwork identifier. | ||
58 | + * | ||
59 | + * @return tenantNetwork identifier | ||
60 | + */ | ||
61 | + TenantNetworkId id(); | ||
62 | + | ||
63 | + /** | ||
64 | + * Returns the tenantNetwork name. | ||
65 | + * | ||
66 | + * @return tenantNetwork name | ||
67 | + */ | ||
68 | + String name(); | ||
69 | + | ||
70 | + /** | ||
71 | + * Returns the administrative state of the tenantNetwork,which is up(true) | ||
72 | + * or down(false). | ||
73 | + * | ||
74 | + * @return network admin state up | ||
75 | + */ | ||
76 | + boolean adminStateUp(); | ||
77 | + | ||
78 | + /** | ||
79 | + * Returns the tenantNetwork state. | ||
80 | + * | ||
81 | + * @return tenantNetwork state | ||
82 | + */ | ||
83 | + State state(); | ||
84 | + | ||
85 | + /** | ||
86 | + * Indicates whether this tenantNetwork is shared across all tenants. By | ||
87 | + * default,only administrative user can change this value. | ||
88 | + * | ||
89 | + * @return tenantNetwork shared | ||
90 | + */ | ||
91 | + boolean shared(); | ||
92 | + | ||
93 | + /** | ||
94 | + * Returns the UUID of the tenant that will own the tenantNetwork. This | ||
95 | + * tenant can be different from the tenant that makes the create | ||
96 | + * tenantNetwork request. | ||
97 | + * | ||
98 | + * @return tenantNetwork tenant identifier | ||
99 | + */ | ||
100 | + TenantId tenantId(); | ||
101 | + | ||
102 | + /** | ||
103 | + * Returns the routerExternal.Indicates whether this network is externally | ||
104 | + * accessible. | ||
105 | + * | ||
106 | + * @return true if tenantNetwork router external | ||
107 | + */ | ||
108 | + boolean routerExternal(); | ||
109 | + | ||
110 | + /** | ||
111 | + * Returns the tenantNetwork Type. | ||
112 | + * | ||
113 | + * @return tenantNetwork Type | ||
114 | + */ | ||
115 | + Type type(); | ||
116 | + | ||
117 | + /** | ||
118 | + * Returns the tenantNetwork physical network. | ||
119 | + * | ||
120 | + * @return tenantNetwork physical network | ||
121 | + */ | ||
122 | + PhysicalNetwork physicalNetwork(); | ||
123 | + | ||
124 | + /** | ||
125 | + * Returns the tenantNetwork segmentation id. | ||
126 | + * | ||
127 | + * @return tenantNetwork segmentation id | ||
128 | + */ | ||
129 | + SegmentationId segmentationId(); | ||
130 | +} |
1 | +/* | ||
2 | + * Copyright 2015 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.app.vtnrsc; | ||
17 | + | ||
18 | +import java.util.Objects; | ||
19 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
20 | + | ||
21 | +/** | ||
22 | + * Immutable representation of a tenantNetwork identity. | ||
23 | + */ | ||
24 | +public final class TenantNetworkId { | ||
25 | + | ||
26 | + private final String networkid; | ||
27 | + | ||
28 | + // Public construction is prohibited | ||
29 | + private TenantNetworkId(String networkid) { | ||
30 | + this.networkid = networkid; | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * Creates a tenantNetwork id using the networkid. | ||
35 | + * | ||
36 | + * @param networkid tenantnetwork String | ||
37 | + * @return NetworkId | ||
38 | + */ | ||
39 | + public static TenantNetworkId networkId(String networkid) { | ||
40 | + checkNotNull(networkid, "Networkid cannot be null"); | ||
41 | + return new TenantNetworkId(networkid); | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * | ||
46 | + * @return tenantNetworkid | ||
47 | + */ | ||
48 | + public String networkid() { | ||
49 | + return networkid; | ||
50 | + } | ||
51 | + | ||
52 | + @Override | ||
53 | + public int hashCode() { | ||
54 | + return Objects.hash(networkid); | ||
55 | + } | ||
56 | + | ||
57 | + @Override | ||
58 | + public boolean equals(Object obj) { | ||
59 | + if (this == obj) { | ||
60 | + return true; | ||
61 | + } | ||
62 | + if (obj instanceof TenantNetworkId) { | ||
63 | + final TenantNetworkId that = (TenantNetworkId) obj; | ||
64 | + return this.getClass() == that.getClass() | ||
65 | + && Objects.equals(this.networkid, that.networkid); | ||
66 | + } | ||
67 | + return false; | ||
68 | + } | ||
69 | + | ||
70 | + @Override | ||
71 | + public String toString() { | ||
72 | + return networkid; | ||
73 | + } | ||
74 | + | ||
75 | +} |
1 | +/* | ||
2 | + * Copyright 2015 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.app.vtnrsc; | ||
17 | + | ||
18 | +import java.util.Collection; | ||
19 | + | ||
20 | +import org.onlab.packet.MacAddress; | ||
21 | +import org.onosproject.net.DeviceId; | ||
22 | +import org.onosproject.net.HostId; | ||
23 | + | ||
24 | +/** | ||
25 | + * Representation of a virtual port. | ||
26 | + */ | ||
27 | +public interface VirtualPort { | ||
28 | + /** | ||
29 | + * Coarse classification of the type of the virtual port. | ||
30 | + */ | ||
31 | + public enum State { | ||
32 | + /** | ||
33 | + * Signifies that a virtualPort is currently active,This state mean that | ||
34 | + * this virtualPort is available. | ||
35 | + */ | ||
36 | + ACTIVE, | ||
37 | + /** | ||
38 | + * Signifies that a virtualPort is currently unavailable. | ||
39 | + */ | ||
40 | + DOWN; | ||
41 | + } | ||
42 | + | ||
43 | + /** | ||
44 | + * Returns the virtualPort identifier. | ||
45 | + * | ||
46 | + * @return virtualPort identifier | ||
47 | + */ | ||
48 | + VirtualPortId portId(); | ||
49 | + | ||
50 | + /** | ||
51 | + * Returns the network identifier. | ||
52 | + * | ||
53 | + * @return tenantNetwork ID | ||
54 | + */ | ||
55 | + TenantNetworkId networkId(); | ||
56 | + | ||
57 | + /** | ||
58 | + * Returns the symbolic name for the virtualPort. | ||
59 | + * | ||
60 | + * @return virtualPort name | ||
61 | + */ | ||
62 | + String name(); | ||
63 | + | ||
64 | + /** | ||
65 | + * Returns the administrative status of the port,which is up(true) or | ||
66 | + * down(false). | ||
67 | + * | ||
68 | + * @return true or false | ||
69 | + */ | ||
70 | + Boolean adminStateUp(); | ||
71 | + | ||
72 | + /** | ||
73 | + * Returns the state. | ||
74 | + * | ||
75 | + * @return state | ||
76 | + */ | ||
77 | + State state(); | ||
78 | + | ||
79 | + /** | ||
80 | + * Returns the MAC address. | ||
81 | + * | ||
82 | + * @return MAC Address | ||
83 | + */ | ||
84 | + MacAddress macAddress(); | ||
85 | + | ||
86 | + /** | ||
87 | + * Returns the port tenantId. | ||
88 | + * | ||
89 | + * @return port tenantId | ||
90 | + */ | ||
91 | + TenantId tenantId(); | ||
92 | + | ||
93 | + /** | ||
94 | + * Returns the device identifier. | ||
95 | + * | ||
96 | + * @return deviceId | ||
97 | + */ | ||
98 | + DeviceId deviceId(); | ||
99 | + | ||
100 | + /** | ||
101 | + * Returns the identifier of the entity that uses this port. | ||
102 | + * | ||
103 | + * @return deviceOwner | ||
104 | + */ | ||
105 | + String deviceOwner(); | ||
106 | + | ||
107 | + /** | ||
108 | + * Returns the virtualPort allowedAddressPairs. | ||
109 | + * | ||
110 | + * @return virtualPort allowedAddressPairs | ||
111 | + */ | ||
112 | + Collection<AllowedAddressPair> allowedAddressPairs(); | ||
113 | + | ||
114 | + /** | ||
115 | + * Returns the IP address for the port, Include the IP address and subnet | ||
116 | + * identity. | ||
117 | + * | ||
118 | + * @return port fixedIps | ||
119 | + */ | ||
120 | + FixedIp fixedIps(); | ||
121 | + | ||
122 | + /** | ||
123 | + * Returns the virtualPort bindinghostId. | ||
124 | + * | ||
125 | + * @return virtualPort bindinghostId | ||
126 | + */ | ||
127 | + HostId bindingHostId(); | ||
128 | + | ||
129 | + /** | ||
130 | + * Returns the virtualPort bindingVnicType. | ||
131 | + * | ||
132 | + * @return virtualPort bindingVnicType | ||
133 | + */ | ||
134 | + String bindingVnicType(); | ||
135 | + | ||
136 | + /** | ||
137 | + * Returns the virtualPort bindingVifType. | ||
138 | + * | ||
139 | + * @return virtualPort bindingVifType | ||
140 | + */ | ||
141 | + String bindingVifType(); | ||
142 | + | ||
143 | + /** | ||
144 | + * Returns the virtualPort bindingvifDetail. | ||
145 | + * | ||
146 | + * @return virtualPort bindingvifDetail | ||
147 | + */ | ||
148 | + String bindingvifDetails(); | ||
149 | + | ||
150 | + /** | ||
151 | + * Returns the security groups. | ||
152 | + * | ||
153 | + * @return port security groups | ||
154 | + */ | ||
155 | + Iterable<SecurityGroup> securityGroups(); | ||
156 | +} |
1 | +/* | ||
2 | + * Copyright 2015 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.app.vtnrsc; | ||
17 | + | ||
18 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Immutable representation of a virtual port identifier. | ||
24 | + */ | ||
25 | +public final class VirtualPortId { | ||
26 | + private final String portId; | ||
27 | + // Public construction is prohibited | ||
28 | + private VirtualPortId(String virtualPortId) { | ||
29 | + checkNotNull(virtualPortId, "VirtualPortId cannot be null"); | ||
30 | + this.portId = virtualPortId; | ||
31 | + } | ||
32 | + | ||
33 | + public String portId() { | ||
34 | + return portId; | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Creates a virtualPort id using the supplied portId. | ||
39 | + * | ||
40 | + * @param portId virtualport identifier | ||
41 | + * @return VirtualPortId | ||
42 | + */ | ||
43 | + public static VirtualPortId portId(String portId) { | ||
44 | + return new VirtualPortId(portId); | ||
45 | + } | ||
46 | + | ||
47 | + @Override | ||
48 | + public int hashCode() { | ||
49 | + return Objects.hash(portId); | ||
50 | + } | ||
51 | + | ||
52 | + @Override | ||
53 | + public boolean equals(Object obj) { | ||
54 | + if (this == obj) { | ||
55 | + return true; | ||
56 | + } | ||
57 | + if (obj instanceof VirtualPortId) { | ||
58 | + final VirtualPortId that = (VirtualPortId) obj; | ||
59 | + return this.getClass() == that.getClass() | ||
60 | + && Objects.equals(this.portId, that.portId); | ||
61 | + } | ||
62 | + return false; | ||
63 | + } | ||
64 | + | ||
65 | + @Override | ||
66 | + public String toString() { | ||
67 | + return portId; | ||
68 | + } | ||
69 | + | ||
70 | +} |
1 | +/* | ||
2 | + * Copyright 2015 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.app.vtnrsc.subnet; | ||
17 | + | ||
18 | +import org.onosproject.app.vtnrsc.Subnet; | ||
19 | +import org.onosproject.app.vtnrsc.SubnetId; | ||
20 | + | ||
21 | + | ||
22 | +/** | ||
23 | + * Service for interacting with the inventory of subnets. | ||
24 | + */ | ||
25 | +public interface SubnetService { | ||
26 | + /** | ||
27 | + * Returns the subnet with the specified identifier. | ||
28 | + * | ||
29 | + * @param subnetId subnet identifier | ||
30 | + * @return true or false | ||
31 | + */ | ||
32 | + boolean exists(SubnetId subnetId); | ||
33 | + /** | ||
34 | + * Returns a collection of the currently known subnets. | ||
35 | + * | ||
36 | + * @return iterable collection of subnets | ||
37 | + */ | ||
38 | + Iterable<Subnet> getSubnets(); | ||
39 | + | ||
40 | + /** | ||
41 | + * Returns the subnet with the specified identifier. | ||
42 | + * | ||
43 | + * @param subnetId subnet identifier | ||
44 | + * @return subnet or null if one with the given identifier is not known | ||
45 | + */ | ||
46 | + Subnet getSubnet(SubnetId subnetId); | ||
47 | + /** | ||
48 | + * Creates new subnets. | ||
49 | + * | ||
50 | + * @param subnets the iterable collection of subnets | ||
51 | + * @return true if the identifier subnet has been created right | ||
52 | + */ | ||
53 | + boolean createSubnets(Iterable<Subnet> subnets); | ||
54 | + | ||
55 | + /** | ||
56 | + * Updates existing subnets. | ||
57 | + * | ||
58 | + * @param subnets the iterable collection of subnets | ||
59 | + * @return true if all subnets were updated successfully | ||
60 | + */ | ||
61 | + boolean updateSubnets(Iterable<Subnet> subnets); | ||
62 | + | ||
63 | + /** | ||
64 | + * Administratively removes the specified subnets from the store. | ||
65 | + * | ||
66 | + * @param subnetIds the iterable collection of subnets identifier | ||
67 | + * @return true if remove identifier subnets successfully | ||
68 | + */ | ||
69 | + boolean removeSubnets(Iterable<SubnetId> subnetIds); | ||
70 | + | ||
71 | + | ||
72 | +} |
apps/vtnrsc/src/main/java/org/onosproject/app/vtnrsc/tenantnetwork/TenantNetworkService.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2015 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.app.vtnrsc.tenantnetwork; | ||
17 | + | ||
18 | +import org.onosproject.app.vtnrsc.TenantNetwork; | ||
19 | +import org.onosproject.app.vtnrsc.TenantNetworkId; | ||
20 | + | ||
21 | +/** | ||
22 | + * Service for interacting with the inventory of tenantNetwork. | ||
23 | + */ | ||
24 | +public interface TenantNetworkService { | ||
25 | + | ||
26 | + /** | ||
27 | + * Returns if the tenantNetwork is existed. | ||
28 | + * | ||
29 | + * @param networkId tenantNetwork identifier | ||
30 | + * @return true or false if one with the given identifier exists. | ||
31 | + */ | ||
32 | + boolean exists(TenantNetworkId networkId); | ||
33 | + | ||
34 | + /** | ||
35 | + * Returns the number of tenantNetwork known to the system. | ||
36 | + * | ||
37 | + * @return number of tenantNetwork. | ||
38 | + */ | ||
39 | + int getNetworkCount(); | ||
40 | + | ||
41 | + /** | ||
42 | + * Returns an iterable collection of the currently known tenantNetwork. | ||
43 | + * | ||
44 | + * @return collection of tenantNetwork. | ||
45 | + */ | ||
46 | + Iterable<TenantNetwork> getNetworks(); | ||
47 | + | ||
48 | + /** | ||
49 | + * Returns the tenantNetwork with the identifier. | ||
50 | + * | ||
51 | + * @param networkId TenantNetwork identifier | ||
52 | + * @return TenantNetwork or null if one with the given identifier is not | ||
53 | + * known. | ||
54 | + */ | ||
55 | + TenantNetwork getNetwork(TenantNetworkId networkId); | ||
56 | + | ||
57 | + /** | ||
58 | + * Creates tenantNetworks by networks. | ||
59 | + * | ||
60 | + * @param networks the collection of tenantNetworks | ||
61 | + * @return true if all given identifiers created successfully. | ||
62 | + */ | ||
63 | + boolean createNetworks(Iterable<TenantNetwork> networks); | ||
64 | + | ||
65 | + /** | ||
66 | + * Updates tenantNetworks by tenantNetworks. | ||
67 | + * | ||
68 | + * @param networks the collection of tenantNetworks | ||
69 | + * @return true if all given identifiers updated successfully. | ||
70 | + */ | ||
71 | + boolean updateNetworks(Iterable<TenantNetwork> networks); | ||
72 | + | ||
73 | + /** | ||
74 | + * Deletes tenantNetwork by tenantNetworkIds. | ||
75 | + * | ||
76 | + * @param networksId the collection of tenantNetworkIds | ||
77 | + * @return true if the specified tenantNetwork deleted successfully. | ||
78 | + */ | ||
79 | + boolean removeNetworks(Iterable<TenantNetworkId> networksId); | ||
80 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Porting 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.app.vtnrsc.virtualport; | ||
17 | + | ||
18 | +import java.util.Collection; | ||
19 | + | ||
20 | +import org.onosproject.app.vtnrsc.TenantNetworkId; | ||
21 | +import org.onosproject.app.vtnrsc.TenantId; | ||
22 | +import org.onosproject.app.vtnrsc.VirtualPort; | ||
23 | +import org.onosproject.app.vtnrsc.VirtualPortId; | ||
24 | +import org.onosproject.net.DeviceId; | ||
25 | + | ||
26 | +/** | ||
27 | + * Service for interacting with the inventory of virtualPort. | ||
28 | + */ | ||
29 | +public interface VirtualPortService { | ||
30 | + /** | ||
31 | + * Returns if the virtualPort is existed. | ||
32 | + * | ||
33 | + * @param virtualPortId virtualPort identifier | ||
34 | + * @return true or false if one with the given identifier is not existed. | ||
35 | + */ | ||
36 | + boolean exists(VirtualPortId virtualPortId); | ||
37 | + | ||
38 | + /** | ||
39 | + * Returns the virtualPort with the identifier. | ||
40 | + * | ||
41 | + * @param virtualPortId virtualPort ID | ||
42 | + * @return VirtualPort or null if one with the given ID is not know. | ||
43 | + */ | ||
44 | + VirtualPort getPort(VirtualPortId virtualPortId); | ||
45 | + | ||
46 | + /** | ||
47 | + * Returns the collection of the currently known virtualPort. | ||
48 | + * | ||
49 | + * @return virtualPort. | ||
50 | + */ | ||
51 | + Collection<VirtualPort> getPorts(); | ||
52 | + | ||
53 | + /** | ||
54 | + * Returns the collection of the virtualPorts associated with the networkId. | ||
55 | + * | ||
56 | + * @param networkId | ||
57 | + * @return collection of virtualPort. | ||
58 | + */ | ||
59 | + Collection<VirtualPort> getPorts(TenantNetworkId networkId); | ||
60 | + | ||
61 | + /** | ||
62 | + * Returns the collection of the virtualPorts associated with the tenantId. | ||
63 | + * | ||
64 | + * @param tenantId | ||
65 | + * @return collection of virtualPort. | ||
66 | + */ | ||
67 | + Collection<VirtualPort> getPorts(TenantId tenantId); | ||
68 | + | ||
69 | + /** | ||
70 | + * Returns the collection of the virtualPorts associated with the deviceId. | ||
71 | + * | ||
72 | + * @param deviceId | ||
73 | + * @return collection of virtualPort. | ||
74 | + */ | ||
75 | + Collection<VirtualPort> getPorts(DeviceId deviceId); | ||
76 | + | ||
77 | + /** | ||
78 | + * Creates virtualPorts by virtualPorts. | ||
79 | + * | ||
80 | + * @param virtualPorts the iterable collection of virtualPorts | ||
81 | + * @return true if all given identifiers created successfully. | ||
82 | + */ | ||
83 | + boolean createPorts(Iterable<VirtualPort> virtualPorts); | ||
84 | + | ||
85 | + /** | ||
86 | + * Updates virtualPorts by virtualPorts. | ||
87 | + * | ||
88 | + * @param virtualPorts the iterable collection of virtualPorts | ||
89 | + * @return true if all given identifiers updated successfully. | ||
90 | + */ | ||
91 | + boolean updatePorts(Iterable<VirtualPort> virtualPorts); | ||
92 | + | ||
93 | + /** | ||
94 | + * Deletes virtualPortIds by virtualPortIds. | ||
95 | + * | ||
96 | + * @param virtualPortIds the iterable collection of virtualPort identifiers | ||
97 | + * @return true or false if one with the given identifier to delete is | ||
98 | + * successfully. | ||
99 | + */ | ||
100 | + boolean removePorts(Iterable<VirtualPortId> virtualPortIds); | ||
101 | +} |
apps/vtnrsc/src/main/webapp/WEB-INF/web.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2015 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 | +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" | ||
18 | + xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | ||
19 | + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | ||
20 | + id="ONOS" version="2.5"> | ||
21 | + <display-name>Vtnrsc Routing REST API v1.0</display-name> | ||
22 | + | ||
23 | + <servlet> | ||
24 | + <servlet-name>JAX-RS Service</servlet-name> | ||
25 | + <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class> | ||
26 | + <init-param> | ||
27 | + <param-name>com.sun.jersey.config.property.resourceConfigClass</param-name> | ||
28 | + <param-value>com.sun.jersey.api.core.ClassNamesResourceConfig</param-value> | ||
29 | + </init-param> | ||
30 | + <init-param> | ||
31 | + <param-name>com.sun.jersey.config.property.classnames</param-name> | ||
32 | + <param-value> | ||
33 | + org.onosproject.app.vtnrsc.web.SubnetWebResource, | ||
34 | + org.onosproject.app.vtnrsc.web.NeutronNetworkWebResource, | ||
35 | + org.onosproject.app.vtnrsc.web.VirtualPortWebResource | ||
36 | + </param-value> | ||
37 | + </init-param> | ||
38 | + <load-on-startup>1</load-on-startup> | ||
39 | + </servlet> | ||
40 | + | ||
41 | + <servlet-mapping> | ||
42 | + <servlet-name>JAX-RS Service</servlet-name> | ||
43 | + <url-pattern>/*</url-pattern> | ||
44 | + </servlet-mapping> | ||
45 | +</web-app> |
-
Please register or login to post a comment