Committed by
Gerrit Code Review
ONOS-2622
Fix error of north app and update onos-app-vtnrsc package Change-Id: I375002ff26d2ab3ada879a92a1d47bcdb8980054
Showing
41 changed files
with
409 additions
and
310 deletions
... | @@ -33,12 +33,6 @@ import org.apache.felix.scr.annotations.Service; | ... | @@ -33,12 +33,6 @@ import org.apache.felix.scr.annotations.Service; |
33 | import org.onlab.packet.IpAddress; | 33 | import org.onlab.packet.IpAddress; |
34 | import org.onlab.packet.MacAddress; | 34 | import org.onlab.packet.MacAddress; |
35 | import org.onlab.util.KryoNamespace; | 35 | import org.onlab.util.KryoNamespace; |
36 | -import org.onosproject.app.vtnrsc.SegmentationId; | ||
37 | -import org.onosproject.app.vtnrsc.TenantNetwork; | ||
38 | -import org.onosproject.app.vtnrsc.VirtualPort; | ||
39 | -import org.onosproject.app.vtnrsc.VirtualPortId; | ||
40 | -import org.onosproject.app.vtnrsc.tenantnetwork.TenantNetworkService; | ||
41 | -import org.onosproject.app.vtnrsc.virtualport.VirtualPortService; | ||
42 | import org.onosproject.core.ApplicationId; | 36 | import org.onosproject.core.ApplicationId; |
43 | import org.onosproject.core.CoreService; | 37 | import org.onosproject.core.CoreService; |
44 | import org.onosproject.net.Device; | 38 | import org.onosproject.net.Device; |
... | @@ -79,6 +73,12 @@ import org.onosproject.store.service.EventuallyConsistentMap; | ... | @@ -79,6 +73,12 @@ import org.onosproject.store.service.EventuallyConsistentMap; |
79 | import org.onosproject.store.service.StorageService; | 73 | import org.onosproject.store.service.StorageService; |
80 | import org.onosproject.store.service.WallClockTimestamp; | 74 | import org.onosproject.store.service.WallClockTimestamp; |
81 | import org.onosproject.vtn.VTNService; | 75 | import org.onosproject.vtn.VTNService; |
76 | +import org.onosproject.vtnrsc.SegmentationId; | ||
77 | +import org.onosproject.vtnrsc.TenantNetwork; | ||
78 | +import org.onosproject.vtnrsc.VirtualPort; | ||
79 | +import org.onosproject.vtnrsc.VirtualPortId; | ||
80 | +import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService; | ||
81 | +import org.onosproject.vtnrsc.virtualport.VirtualPortService; | ||
82 | import org.slf4j.Logger; | 82 | import org.slf4j.Logger; |
83 | 83 | ||
84 | import com.google.common.collect.Sets; | 84 | import com.google.common.collect.Sets; | ... | ... |
apps/vtnrsc/features.xml
deleted
100644 → 0
1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
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 | -<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}"> | ||
18 | - <repository>mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features</repository> | ||
19 | - <feature name="onos-app-vtnrsc" version="@FEATURE-VERSION" | ||
20 | - description="ONOS app vtnrsc components"> | ||
21 | - <feature>onos-api</feature> | ||
22 | - <bundle>mvn:org.onosproject/onos-app-vtnrsc/@ONOS-VERSION | ||
23 | - </bundle> | ||
24 | - </feature> | ||
25 | -</features> |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import org.onlab.packet.IpAddress; | 18 | import org.onlab.packet.IpAddress; |
19 | 19 | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import static com.google.common.base.MoreObjects.toStringHelper; | 18 | import static com.google.common.base.MoreObjects.toStringHelper; |
19 | import static com.google.common.base.Preconditions.checkNotNull; | 19 | import static com.google.common.base.Preconditions.checkNotNull; | ... | ... |
1 | +package org.onosproject.vtnrsc; | ||
2 | + | ||
3 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
4 | + | ||
5 | +import java.util.Objects; | ||
6 | + | ||
7 | +public final class BindingHostId { | ||
8 | + private final String bindingHostId; | ||
9 | + | ||
10 | + // Public construction is prohibited | ||
11 | + private BindingHostId(String bindingHostId) { | ||
12 | + checkNotNull(bindingHostId, "BindingHosttId cannot be null"); | ||
13 | + this.bindingHostId = bindingHostId; | ||
14 | + } | ||
15 | + | ||
16 | + /** | ||
17 | + * Creates a BindingHostId identifier. | ||
18 | + * | ||
19 | + * @param bindingHostId the bindingHostId identifier | ||
20 | + * @return the bindingHostId identifier | ||
21 | + */ | ||
22 | + public static BindingHostId bindingHostId(String bindingHostId) { | ||
23 | + return new BindingHostId(bindingHostId); | ||
24 | + } | ||
25 | + | ||
26 | + /** | ||
27 | + * Returns the bindingHostId identifier. | ||
28 | + * | ||
29 | + * @return the bindingHostId identifier | ||
30 | + */ | ||
31 | + public String bindingHostId() { | ||
32 | + return bindingHostId; | ||
33 | + } | ||
34 | + | ||
35 | + @Override | ||
36 | + public int hashCode() { | ||
37 | + return Objects.hash(bindingHostId); | ||
38 | + } | ||
39 | + | ||
40 | + @Override | ||
41 | + public boolean equals(Object obj) { | ||
42 | + if (this == obj) { | ||
43 | + return true; | ||
44 | + } | ||
45 | + if (obj instanceof BindingHostId) { | ||
46 | + final BindingHostId that = (BindingHostId) obj; | ||
47 | + return this.getClass() == that.getClass() | ||
48 | + && Objects.equals(this.bindingHostId, that.bindingHostId); | ||
49 | + } | ||
50 | + return false; | ||
51 | + } | ||
52 | + | ||
53 | + @Override | ||
54 | + public String toString() { | ||
55 | + return bindingHostId; | ||
56 | + } | ||
57 | +} |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import static com.google.common.base.MoreObjects.toStringHelper; | 18 | import static com.google.common.base.MoreObjects.toStringHelper; |
19 | import static com.google.common.base.Preconditions.checkNotNull; | 19 | import static com.google.common.base.Preconditions.checkNotNull; | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import static com.google.common.base.MoreObjects.toStringHelper; | 18 | import static com.google.common.base.MoreObjects.toStringHelper; |
19 | 19 | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import static com.google.common.base.MoreObjects.toStringHelper; | 18 | import static com.google.common.base.MoreObjects.toStringHelper; |
19 | 19 | ||
... | @@ -48,6 +48,7 @@ public final class DefaultSubnet implements Subnet { | ... | @@ -48,6 +48,7 @@ public final class DefaultSubnet implements Subnet { |
48 | * @param subnetName the name of subnet | 48 | * @param subnetName the name of subnet |
49 | * @param networkId network identifier | 49 | * @param networkId network identifier |
50 | * @param tenantId tenant identifier | 50 | * @param tenantId tenant identifier |
51 | + * @param ipVersion Version of ipv4 or ipv6 | ||
51 | * @param cidr the cidr | 52 | * @param cidr the cidr |
52 | * @param gatewayIp gateway ip | 53 | * @param gatewayIp gateway ip |
53 | * @param dhcpEnabled dhcp enabled or not | 54 | * @param dhcpEnabled dhcp enabled or not | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import static com.google.common.base.MoreObjects.toStringHelper; | 18 | import static com.google.common.base.MoreObjects.toStringHelper; |
19 | 19 | ... | ... |
... | @@ -13,17 +13,17 @@ | ... | @@ -13,17 +13,17 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import static com.google.common.base.MoreObjects.toStringHelper; | 18 | import static com.google.common.base.MoreObjects.toStringHelper; |
19 | 19 | ||
20 | import java.util.Collection; | 20 | import java.util.Collection; |
21 | import java.util.Map; | 21 | import java.util.Map; |
22 | import java.util.Objects; | 22 | import java.util.Objects; |
23 | +import java.util.Set; | ||
23 | 24 | ||
24 | import org.onlab.packet.MacAddress; | 25 | import org.onlab.packet.MacAddress; |
25 | import org.onosproject.net.DeviceId; | 26 | import org.onosproject.net.DeviceId; |
26 | -import org.onosproject.net.HostId; | ||
27 | 27 | ||
28 | /** | 28 | /** |
29 | * Default implementation of VirtualPort interface . | 29 | * Default implementation of VirtualPort interface . |
... | @@ -38,8 +38,8 @@ public final class DefaultVirtualPort implements VirtualPort { | ... | @@ -38,8 +38,8 @@ public final class DefaultVirtualPort implements VirtualPort { |
38 | private final TenantId tenantId; | 38 | private final TenantId tenantId; |
39 | private final String deviceOwner; | 39 | private final String deviceOwner; |
40 | private final DeviceId deviceId; | 40 | private final DeviceId deviceId; |
41 | - private final FixedIp fixedIp; | 41 | + private final Set<FixedIp> fixedIps; |
42 | - private final HostId bindingHostId; | 42 | + private final BindingHostId bindingHostId; |
43 | private final String bindingVnicType; | 43 | private final String bindingVnicType; |
44 | private final String bindingVifType; | 44 | private final String bindingVifType; |
45 | private final String bindingVifDetails; | 45 | private final String bindingVifDetails; |
... | @@ -57,7 +57,7 @@ public final class DefaultVirtualPort implements VirtualPort { | ... | @@ -57,7 +57,7 @@ public final class DefaultVirtualPort implements VirtualPort { |
57 | * @param macAddress the MAC address | 57 | * @param macAddress the MAC address |
58 | * @param tenantId the tenant identifier | 58 | * @param tenantId the tenant identifier |
59 | * @param deviceId the device identifier | 59 | * @param deviceId the device identifier |
60 | - * @param fixedIp the fixed IP | 60 | + * @param fixedIps set of fixed IP |
61 | * @param bindingHostId the binding host identifier | 61 | * @param bindingHostId the binding host identifier |
62 | * @param allowedAddressPairs the collection of allowdeAddressPairs | 62 | * @param allowedAddressPairs the collection of allowdeAddressPairs |
63 | * @param securityGroups the collection of securityGroups | 63 | * @param securityGroups the collection of securityGroups |
... | @@ -70,8 +70,8 @@ public final class DefaultVirtualPort implements VirtualPort { | ... | @@ -70,8 +70,8 @@ public final class DefaultVirtualPort implements VirtualPort { |
70 | MacAddress macAddress, | 70 | MacAddress macAddress, |
71 | TenantId tenantId, | 71 | TenantId tenantId, |
72 | DeviceId deviceId, | 72 | DeviceId deviceId, |
73 | - FixedIp fixedIp, | 73 | + Set<FixedIp> fixedIps, |
74 | - HostId bindingHostId, | 74 | + BindingHostId bindingHostId, |
75 | Collection<AllowedAddressPair> allowedAddressPairs, | 75 | Collection<AllowedAddressPair> allowedAddressPairs, |
76 | Collection<SecurityGroup> securityGroups) { | 76 | Collection<SecurityGroup> securityGroups) { |
77 | this.id = id; | 77 | this.id = id; |
... | @@ -83,7 +83,7 @@ public final class DefaultVirtualPort implements VirtualPort { | ... | @@ -83,7 +83,7 @@ public final class DefaultVirtualPort implements VirtualPort { |
83 | this.tenantId = tenantId; | 83 | this.tenantId = tenantId; |
84 | this.deviceOwner = strMap.get("deviceOwner"); | 84 | this.deviceOwner = strMap.get("deviceOwner"); |
85 | this.deviceId = deviceId; | 85 | this.deviceId = deviceId; |
86 | - this.fixedIp = fixedIp; | 86 | + this.fixedIps = fixedIps; |
87 | this.bindingHostId = bindingHostId; | 87 | this.bindingHostId = bindingHostId; |
88 | this.bindingVnicType = strMap.get("bindingVnicType"); | 88 | this.bindingVnicType = strMap.get("bindingVnicType"); |
89 | this.bindingVifType = strMap.get("bindingVifType"); | 89 | this.bindingVifType = strMap.get("bindingVifType"); |
... | @@ -143,12 +143,12 @@ public final class DefaultVirtualPort implements VirtualPort { | ... | @@ -143,12 +143,12 @@ public final class DefaultVirtualPort implements VirtualPort { |
143 | } | 143 | } |
144 | 144 | ||
145 | @Override | 145 | @Override |
146 | - public FixedIp fixedIps() { | 146 | + public Set<FixedIp> fixedIps() { |
147 | - return fixedIp; | 147 | + return fixedIps; |
148 | } | 148 | } |
149 | 149 | ||
150 | @Override | 150 | @Override |
151 | - public HostId bindingHostId() { | 151 | + public BindingHostId bindingHostId() { |
152 | return bindingHostId; | 152 | return bindingHostId; |
153 | } | 153 | } |
154 | 154 | ||
... | @@ -176,7 +176,7 @@ public final class DefaultVirtualPort implements VirtualPort { | ... | @@ -176,7 +176,7 @@ public final class DefaultVirtualPort implements VirtualPort { |
176 | public int hashCode() { | 176 | public int hashCode() { |
177 | return Objects.hash(id, networkId, adminStateUp, name, state, | 177 | return Objects.hash(id, networkId, adminStateUp, name, state, |
178 | macAddress, tenantId, deviceId, deviceOwner, | 178 | macAddress, tenantId, deviceId, deviceOwner, |
179 | - allowedAddressPairs, fixedIp, bindingHostId, | 179 | + allowedAddressPairs, fixedIps, bindingHostId, |
180 | bindingVnicType, bindingVifType, bindingVifDetails, | 180 | bindingVnicType, bindingVifType, bindingVifDetails, |
181 | securityGroups); | 181 | securityGroups); |
182 | } | 182 | } |
... | @@ -199,7 +199,7 @@ public final class DefaultVirtualPort implements VirtualPort { | ... | @@ -199,7 +199,7 @@ public final class DefaultVirtualPort implements VirtualPort { |
199 | && Objects.equals(this.deviceOwner, that.deviceOwner) | 199 | && Objects.equals(this.deviceOwner, that.deviceOwner) |
200 | && Objects.equals(this.allowedAddressPairs, | 200 | && Objects.equals(this.allowedAddressPairs, |
201 | that.allowedAddressPairs) | 201 | that.allowedAddressPairs) |
202 | - && Objects.equals(this.fixedIp, that.fixedIp) | 202 | + && Objects.equals(this.fixedIps, that.fixedIps) |
203 | && Objects.equals(this.bindingHostId, that.bindingHostId) | 203 | && Objects.equals(this.bindingHostId, that.bindingHostId) |
204 | && Objects.equals(this.bindingVifDetails, | 204 | && Objects.equals(this.bindingVifDetails, |
205 | that.bindingVifDetails) | 205 | that.bindingVifDetails) |
... | @@ -219,7 +219,7 @@ public final class DefaultVirtualPort implements VirtualPort { | ... | @@ -219,7 +219,7 @@ public final class DefaultVirtualPort implements VirtualPort { |
219 | .add("macAddress", macAddress).add("tenantId", tenantId) | 219 | .add("macAddress", macAddress).add("tenantId", tenantId) |
220 | .add("deviced", deviceId).add("deviceOwner", deviceOwner) | 220 | .add("deviced", deviceId).add("deviceOwner", deviceOwner) |
221 | .add("allowedAddressPairs", allowedAddressPairs) | 221 | .add("allowedAddressPairs", allowedAddressPairs) |
222 | - .add("fixedIp", fixedIp).add("bindingHostId", bindingHostId) | 222 | + .add("fixedIp", fixedIps).add("bindingHostId", bindingHostId) |
223 | .add("bindingVnicType", bindingVnicType) | 223 | .add("bindingVnicType", bindingVnicType) |
224 | .add("bindingVifDetails", bindingVifDetails) | 224 | .add("bindingVifDetails", bindingVifDetails) |
225 | .add("bindingVifType", bindingVifType) | 225 | .add("bindingVifType", bindingVifType) | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import static com.google.common.base.MoreObjects.toStringHelper; | 18 | import static com.google.common.base.MoreObjects.toStringHelper; |
19 | import static com.google.common.base.Preconditions.checkNotNull; | 19 | import static com.google.common.base.Preconditions.checkNotNull; | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import org.onlab.packet.IpAddress; | 18 | import org.onlab.packet.IpAddress; |
19 | import org.onlab.packet.IpPrefix; | 19 | import org.onlab.packet.IpPrefix; | ... | ... |
... | @@ -13,46 +13,47 @@ | ... | @@ -13,46 +13,47 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ||
20 | import static com.google.common.base.Preconditions.checkNotNull; | 20 | import static com.google.common.base.Preconditions.checkNotNull; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | - * Immutable representation of a physicalnetwork identity. | 23 | + * Immutable representation of a physical network identity. |
24 | */ | 24 | */ |
25 | public final class PhysicalNetwork { | 25 | public final class PhysicalNetwork { |
26 | 26 | ||
27 | - private final String physicalnetwork; | 27 | + private final String physicalNetwork; |
28 | 28 | ||
29 | // Public construction is prohibited | 29 | // Public construction is prohibited |
30 | - private PhysicalNetwork(String physicalnetwork) { | 30 | + private PhysicalNetwork(String physicalNetwork) { |
31 | - checkNotNull(physicalnetwork, "Physicalnetwork cannot be null"); | 31 | + checkNotNull(physicalNetwork, "PhysicalNetwork cannot be null"); |
32 | - this.physicalnetwork = physicalnetwork; | 32 | + this.physicalNetwork = physicalNetwork; |
33 | } | 33 | } |
34 | 34 | ||
35 | /** | 35 | /** |
36 | - * Creates a network id using the physicalnetwork. | 36 | + * Creates a PhysicalNetwork object. |
37 | * | 37 | * |
38 | - * @param physicalnetwork network String | 38 | + * @param physicalNetwork physical network |
39 | - * @return physicalnetwork | 39 | + * @return physical network |
40 | */ | 40 | */ |
41 | - public static PhysicalNetwork physicalNetwork(String physicalnetwork) { | 41 | + public static PhysicalNetwork physicalNetwork(String physicalNetwork) { |
42 | - return new PhysicalNetwork(physicalnetwork); | 42 | + return new PhysicalNetwork(physicalNetwork); |
43 | } | 43 | } |
44 | 44 | ||
45 | /** | 45 | /** |
46 | + * Returns a physicalNetwork. | ||
46 | * | 47 | * |
47 | - * @return physicalnetwork | 48 | + * @return physical network |
48 | */ | 49 | */ |
49 | - public String physicalnetwork() { | 50 | + public String physicalNetwork() { |
50 | - return physicalnetwork; | 51 | + return physicalNetwork; |
51 | } | 52 | } |
52 | 53 | ||
53 | @Override | 54 | @Override |
54 | public int hashCode() { | 55 | public int hashCode() { |
55 | - return Objects.hash(physicalnetwork); | 56 | + return Objects.hash(physicalNetwork); |
56 | } | 57 | } |
57 | 58 | ||
58 | @Override | 59 | @Override |
... | @@ -63,15 +64,15 @@ public final class PhysicalNetwork { | ... | @@ -63,15 +64,15 @@ public final class PhysicalNetwork { |
63 | if (obj instanceof PhysicalNetwork) { | 64 | if (obj instanceof PhysicalNetwork) { |
64 | final PhysicalNetwork that = (PhysicalNetwork) obj; | 65 | final PhysicalNetwork that = (PhysicalNetwork) obj; |
65 | return this.getClass() == that.getClass() | 66 | return this.getClass() == that.getClass() |
66 | - && Objects.equals(this.physicalnetwork, | 67 | + && Objects.equals(this.physicalNetwork, |
67 | - that.physicalnetwork); | 68 | + that.physicalNetwork); |
68 | } | 69 | } |
69 | return false; | 70 | return false; |
70 | } | 71 | } |
71 | 72 | ||
72 | @Override | 73 | @Override |
73 | public String toString() { | 74 | public String toString() { |
74 | - return physicalnetwork; | 75 | + return physicalNetwork; |
75 | } | 76 | } |
76 | 77 | ||
77 | } | 78 | } | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ... | ... |
1 | /* | 1 | /* |
2 | - *Copyright 2014 Open Networking Laboratory | 2 | + *Copyright 2015 Open Networking Laboratory |
3 | * | 3 | * |
4 | *Licensed under the Apache License, Version 2.0 (the "License"); | 4 | *Licensed under the Apache License, Version 2.0 (the "License"); |
5 | *you may not use this file except in compliance with the License. | 5 | *you may not use this file except in compliance with the License. |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | *See the License for the specific language governing permissions and | 13 | *See the License for the specific language governing permissions and |
14 | *limitations under the License. | 14 | *limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import org.onlab.packet.IpAddress; | 18 | import org.onlab.packet.IpAddress; |
19 | import org.onlab.packet.IpAddress.Version; | 19 | import org.onlab.packet.IpAddress.Version; | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | 19 | ... | ... |
... | @@ -13,22 +13,22 @@ | ... | @@ -13,22 +13,22 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ||
20 | import static com.google.common.base.Preconditions.checkNotNull; | 20 | import static com.google.common.base.Preconditions.checkNotNull; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | - * Immutable representation of a network identity. | 23 | + * Immutable representation of a tenant identifier. |
24 | */ | 24 | */ |
25 | public final class TenantId { | 25 | public final class TenantId { |
26 | 26 | ||
27 | - private final String tenantid; | 27 | + private final String tenantId; |
28 | 28 | ||
29 | // Public construction is prohibited | 29 | // Public construction is prohibited |
30 | - private TenantId(String tenantid) { | 30 | + private TenantId(String tenantId) { |
31 | - this.tenantid = tenantid; | 31 | + this.tenantId = tenantId; |
32 | } | 32 | } |
33 | 33 | ||
34 | /** | 34 | /** |
... | @@ -43,16 +43,17 @@ public final class TenantId { | ... | @@ -43,16 +43,17 @@ public final class TenantId { |
43 | } | 43 | } |
44 | 44 | ||
45 | /** | 45 | /** |
46 | + * Returns the tenant identifier. | ||
46 | * | 47 | * |
47 | - * @return tenantid | 48 | + * @return the tenant identifier |
48 | */ | 49 | */ |
49 | - public String tenantid() { | 50 | + public String tenantId() { |
50 | - return tenantid; | 51 | + return tenantId; |
51 | } | 52 | } |
52 | 53 | ||
53 | @Override | 54 | @Override |
54 | public int hashCode() { | 55 | public int hashCode() { |
55 | - return Objects.hash(tenantid); | 56 | + return Objects.hash(tenantId); |
56 | } | 57 | } |
57 | 58 | ||
58 | @Override | 59 | @Override |
... | @@ -63,14 +64,14 @@ public final class TenantId { | ... | @@ -63,14 +64,14 @@ public final class TenantId { |
63 | if (obj instanceof TenantId) { | 64 | if (obj instanceof TenantId) { |
64 | final TenantId that = (TenantId) obj; | 65 | final TenantId that = (TenantId) obj; |
65 | return this.getClass() == that.getClass() | 66 | return this.getClass() == that.getClass() |
66 | - && Objects.equals(this.tenantid, that.tenantid); | 67 | + && Objects.equals(this.tenantId, that.tenantId); |
67 | } | 68 | } |
68 | return false; | 69 | return false; |
69 | } | 70 | } |
70 | 71 | ||
71 | @Override | 72 | @Override |
72 | public String toString() { | 73 | public String toString() { |
73 | - return tenantid; | 74 | + return tenantId; |
74 | } | 75 | } |
75 | 76 | ||
76 | } | 77 | } | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * Representation of the tenantNetwork. | 19 | * Representation of the tenantNetwork. |
... | @@ -95,7 +95,7 @@ public interface TenantNetwork { | ... | @@ -95,7 +95,7 @@ public interface TenantNetwork { |
95 | * tenant can be different from the tenant that makes the create | 95 | * tenant can be different from the tenant that makes the create |
96 | * tenantNetwork request. | 96 | * tenantNetwork request. |
97 | * | 97 | * |
98 | - * @return tenantNetwork tenant identifier | 98 | + * @return the tenant identifier |
99 | */ | 99 | */ |
100 | TenantId tenantId(); | 100 | TenantId tenantId(); |
101 | 101 | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | import static com.google.common.base.Preconditions.checkNotNull; | 19 | import static com.google.common.base.Preconditions.checkNotNull; | ... | ... |
... | @@ -13,13 +13,13 @@ | ... | @@ -13,13 +13,13 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import java.util.Collection; | 18 | import java.util.Collection; |
19 | +import java.util.Set; | ||
19 | 20 | ||
20 | import org.onlab.packet.MacAddress; | 21 | import org.onlab.packet.MacAddress; |
21 | import org.onosproject.net.DeviceId; | 22 | import org.onosproject.net.DeviceId; |
22 | -import org.onosproject.net.HostId; | ||
23 | 23 | ||
24 | /** | 24 | /** |
25 | * Representation of the VirtualPort. | 25 | * Representation of the VirtualPort. |
... | @@ -112,19 +112,19 @@ public interface VirtualPort { | ... | @@ -112,19 +112,19 @@ public interface VirtualPort { |
112 | Collection<AllowedAddressPair> allowedAddressPairs(); | 112 | Collection<AllowedAddressPair> allowedAddressPairs(); |
113 | 113 | ||
114 | /** | 114 | /** |
115 | - * Returns the IP address for the port, Include the IP address and subnet | 115 | + * Returns set of IP addresses for the port, include the IP addresses and subnet |
116 | * identity. | 116 | * identity. |
117 | * | 117 | * |
118 | - * @return port fixedIps | 118 | + * @return FixedIps Set of fixedIp |
119 | */ | 119 | */ |
120 | - FixedIp fixedIps(); | 120 | + Set<FixedIp> fixedIps(); |
121 | 121 | ||
122 | /** | 122 | /** |
123 | * Returns the virtualPort bindinghostId. | 123 | * Returns the virtualPort bindinghostId. |
124 | * | 124 | * |
125 | * @return virtualPort bindinghostId | 125 | * @return virtualPort bindinghostId |
126 | */ | 126 | */ |
127 | - HostId bindingHostId(); | 127 | + BindingHostId bindingHostId(); |
128 | 128 | ||
129 | /** | 129 | /** |
130 | * Returns the virtualPort bindingVnicType. | 130 | * Returns the virtualPort bindingVnicType. | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc; | 16 | +package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | 19 | ... | ... |
... | @@ -13,10 +13,10 @@ | ... | @@ -13,10 +13,10 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc.subnet; | 16 | +package org.onosproject.vtnrsc.subnet; |
17 | 17 | ||
18 | -import org.onosproject.app.vtnrsc.Subnet; | 18 | +import org.onosproject.vtnrsc.Subnet; |
19 | -import org.onosproject.app.vtnrsc.SubnetId; | 19 | +import org.onosproject.vtnrsc.SubnetId; |
20 | 20 | ||
21 | 21 | ||
22 | /** | 22 | /** | ... | ... |
... | @@ -13,12 +13,13 @@ | ... | @@ -13,12 +13,13 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc.subnet.impl; | 16 | +package org.onosproject.vtnrsc.subnet.impl; |
17 | 17 | ||
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | import static org.slf4j.LoggerFactory.getLogger; | 19 | import static org.slf4j.LoggerFactory.getLogger; |
20 | 20 | ||
21 | import java.util.Collections; | 21 | import java.util.Collections; |
22 | +import java.util.concurrent.ConcurrentHashMap; | ||
22 | 23 | ||
23 | import org.apache.felix.scr.annotations.Activate; | 24 | import org.apache.felix.scr.annotations.Activate; |
24 | import org.apache.felix.scr.annotations.Component; | 25 | import org.apache.felix.scr.annotations.Component; |
... | @@ -26,15 +27,11 @@ import org.apache.felix.scr.annotations.Deactivate; | ... | @@ -26,15 +27,11 @@ import org.apache.felix.scr.annotations.Deactivate; |
26 | import org.apache.felix.scr.annotations.Reference; | 27 | import org.apache.felix.scr.annotations.Reference; |
27 | import org.apache.felix.scr.annotations.ReferenceCardinality; | 28 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
28 | import org.apache.felix.scr.annotations.Service; | 29 | import org.apache.felix.scr.annotations.Service; |
29 | -import org.onlab.util.KryoNamespace; | ||
30 | -import org.onosproject.app.vtnrsc.Subnet; | ||
31 | -import org.onosproject.app.vtnrsc.SubnetId; | ||
32 | -import org.onosproject.app.vtnrsc.subnet.SubnetService; | ||
33 | -import org.onosproject.app.vtnrsc.tenantnetwork.TenantNetworkService; | ||
34 | -import org.onosproject.store.service.EventuallyConsistentMap; | ||
35 | -import org.onosproject.store.service.MultiValuedTimestamp; | ||
36 | import org.onosproject.store.service.StorageService; | 30 | import org.onosproject.store.service.StorageService; |
37 | -import org.onosproject.store.service.WallClockTimestamp; | 31 | +import org.onosproject.vtnrsc.Subnet; |
32 | +import org.onosproject.vtnrsc.SubnetId; | ||
33 | +import org.onosproject.vtnrsc.subnet.SubnetService; | ||
34 | +import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService; | ||
38 | import org.slf4j.Logger; | 35 | import org.slf4j.Logger; |
39 | 36 | ||
40 | /** | 37 | /** |
... | @@ -49,8 +46,8 @@ public class SubnetManager implements SubnetService { | ... | @@ -49,8 +46,8 @@ public class SubnetManager implements SubnetService { |
49 | 46 | ||
50 | private final Logger log = getLogger(getClass()); | 47 | private final Logger log = getLogger(getClass()); |
51 | 48 | ||
52 | - private EventuallyConsistentMap<SubnetId, Subnet> subnetStore; | 49 | + protected ConcurrentHashMap<SubnetId, Subnet> subnetStore = |
53 | - | 50 | + new ConcurrentHashMap<>(); |
54 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 51 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
55 | protected StorageService storageService; | 52 | protected StorageService storageService; |
56 | 53 | ||
... | @@ -59,20 +56,12 @@ public class SubnetManager implements SubnetService { | ... | @@ -59,20 +56,12 @@ public class SubnetManager implements SubnetService { |
59 | 56 | ||
60 | @Activate | 57 | @Activate |
61 | public void activate() { | 58 | public void activate() { |
62 | - KryoNamespace.Builder serializer = KryoNamespace.newBuilder() | ||
63 | - .register(MultiValuedTimestamp.class); | ||
64 | - subnetStore = storageService | ||
65 | - .<SubnetId, Subnet>eventuallyConsistentMapBuilder() | ||
66 | - .withName("all_subnet").withSerializer(serializer) | ||
67 | - .withTimestampProvider((k, v) -> new WallClockTimestamp()) | ||
68 | - .build(); | ||
69 | - | ||
70 | log.info("SubnetManager started"); | 59 | log.info("SubnetManager started"); |
71 | } | 60 | } |
72 | 61 | ||
73 | @Deactivate | 62 | @Deactivate |
74 | public void deactivate() { | 63 | public void deactivate() { |
75 | - subnetStore.destroy(); | 64 | + subnetStore.clear(); |
76 | log.info("SubnetManager stopped"); | 65 | log.info("SubnetManager stopped"); |
77 | } | 66 | } |
78 | 67 | ... | ... |
... | @@ -13,10 +13,10 @@ | ... | @@ -13,10 +13,10 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc.tenantnetwork; | 16 | +package org.onosproject.vtnrsc.tenantnetwork; |
17 | 17 | ||
18 | -import org.onosproject.app.vtnrsc.TenantNetwork; | 18 | +import org.onosproject.vtnrsc.TenantNetwork; |
19 | -import org.onosproject.app.vtnrsc.TenantNetworkId; | 19 | +import org.onosproject.vtnrsc.TenantNetworkId; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * Service for interacting with the inventory of tenantNetwork. | 22 | * Service for interacting with the inventory of tenantNetwork. |
... | @@ -73,8 +73,8 @@ public interface TenantNetworkService { | ... | @@ -73,8 +73,8 @@ public interface TenantNetworkService { |
73 | /** | 73 | /** |
74 | * Deletes tenantNetwork by tenantNetworkIds. | 74 | * Deletes tenantNetwork by tenantNetworkIds. |
75 | * | 75 | * |
76 | - * @param networksId the collection of tenantNetworkIds | 76 | + * @param networksIds the collection of tenantNetworkIds |
77 | - * @return true if the specified tenantNetwork deleted successfully. | 77 | + * @return true if the specified tenantNetworks deleted successfully. |
78 | */ | 78 | */ |
79 | - boolean removeNetworks(Iterable<TenantNetworkId> networksId); | 79 | + boolean removeNetworks(Iterable<TenantNetworkId> networksIds); |
80 | } | 80 | } | ... | ... |
... | @@ -13,27 +13,21 @@ | ... | @@ -13,27 +13,21 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc.tenantnetwork.impl; | 16 | +package org.onosproject.vtnrsc.tenantnetwork.impl; |
17 | 17 | ||
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | import static org.slf4j.LoggerFactory.getLogger; | 19 | import static org.slf4j.LoggerFactory.getLogger; |
20 | 20 | ||
21 | import java.util.Collections; | 21 | import java.util.Collections; |
22 | +import java.util.concurrent.ConcurrentHashMap; | ||
22 | 23 | ||
23 | import org.apache.felix.scr.annotations.Activate; | 24 | import org.apache.felix.scr.annotations.Activate; |
24 | import org.apache.felix.scr.annotations.Component; | 25 | import org.apache.felix.scr.annotations.Component; |
25 | import org.apache.felix.scr.annotations.Deactivate; | 26 | import org.apache.felix.scr.annotations.Deactivate; |
26 | -import org.apache.felix.scr.annotations.Reference; | ||
27 | -import org.apache.felix.scr.annotations.ReferenceCardinality; | ||
28 | import org.apache.felix.scr.annotations.Service; | 27 | import org.apache.felix.scr.annotations.Service; |
29 | -import org.onlab.util.KryoNamespace; | 28 | +import org.onosproject.vtnrsc.TenantNetwork; |
30 | -import org.onosproject.app.vtnrsc.TenantNetwork; | 29 | +import org.onosproject.vtnrsc.TenantNetworkId; |
31 | -import org.onosproject.app.vtnrsc.TenantNetworkId; | 30 | +import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService; |
32 | -import org.onosproject.app.vtnrsc.tenantnetwork.TenantNetworkService; | ||
33 | -import org.onosproject.store.service.EventuallyConsistentMap; | ||
34 | -import org.onosproject.store.service.MultiValuedTimestamp; | ||
35 | -import org.onosproject.store.service.StorageService; | ||
36 | -import org.onosproject.store.service.WallClockTimestamp; | ||
37 | import org.slf4j.Logger; | 31 | import org.slf4j.Logger; |
38 | 32 | ||
39 | /** | 33 | /** |
... | @@ -46,26 +40,19 @@ public class TenantNetworkManager implements TenantNetworkService { | ... | @@ -46,26 +40,19 @@ public class TenantNetworkManager implements TenantNetworkService { |
46 | private static final String NETWORK_ID_NULL = "Network ID cannot be null"; | 40 | private static final String NETWORK_ID_NULL = "Network ID cannot be null"; |
47 | private static final String NETWORK_NOT_NULL = "Network ID cannot be null"; | 41 | private static final String NETWORK_NOT_NULL = "Network ID cannot be null"; |
48 | 42 | ||
49 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 43 | + protected ConcurrentHashMap<TenantNetworkId, TenantNetwork> networkIdAsKeyStore = |
50 | - protected StorageService storageService; | 44 | + new ConcurrentHashMap<>(); |
51 | - private EventuallyConsistentMap<TenantNetworkId, TenantNetwork> networkIdAsKeyStore; | 45 | + |
52 | private final Logger log = getLogger(getClass()); | 46 | private final Logger log = getLogger(getClass()); |
53 | 47 | ||
54 | @Activate | 48 | @Activate |
55 | public void activate() { | 49 | public void activate() { |
56 | - KryoNamespace.Builder serializer = KryoNamespace.newBuilder() | ||
57 | - .register(MultiValuedTimestamp.class); | ||
58 | - networkIdAsKeyStore = storageService | ||
59 | - .<TenantNetworkId, TenantNetwork>eventuallyConsistentMapBuilder() | ||
60 | - .withName("all_network").withSerializer(serializer) | ||
61 | - .withTimestampProvider((k, v) -> new WallClockTimestamp()) | ||
62 | - .build(); | ||
63 | log.info("Started"); | 50 | log.info("Started"); |
64 | } | 51 | } |
65 | 52 | ||
66 | @Deactivate | 53 | @Deactivate |
67 | public void deactivate() { | 54 | public void deactivate() { |
68 | - networkIdAsKeyStore.destroy(); | 55 | + networkIdAsKeyStore.clear(); |
69 | log.info("Stopped"); | 56 | log.info("Stopped"); |
70 | } | 57 | } |
71 | 58 | ||
... | @@ -97,7 +84,7 @@ public class TenantNetworkManager implements TenantNetworkService { | ... | @@ -97,7 +84,7 @@ public class TenantNetworkManager implements TenantNetworkService { |
97 | for (TenantNetwork network : networks) { | 84 | for (TenantNetwork network : networks) { |
98 | networkIdAsKeyStore.put(network.id(), network); | 85 | networkIdAsKeyStore.put(network.id(), network); |
99 | if (!networkIdAsKeyStore.containsKey(network.id())) { | 86 | if (!networkIdAsKeyStore.containsKey(network.id())) { |
100 | - log.debug("the network created failed which identifier was {}", network.id() | 87 | + log.debug("The tenantNetwork is created failed which identifier was {}", network.id() |
101 | .toString()); | 88 | .toString()); |
102 | return false; | 89 | return false; |
103 | } | 90 | } |
... | @@ -110,15 +97,15 @@ public class TenantNetworkManager implements TenantNetworkService { | ... | @@ -110,15 +97,15 @@ public class TenantNetworkManager implements TenantNetworkService { |
110 | checkNotNull(networks, NETWORK_NOT_NULL); | 97 | checkNotNull(networks, NETWORK_NOT_NULL); |
111 | for (TenantNetwork network : networks) { | 98 | for (TenantNetwork network : networks) { |
112 | if (!networkIdAsKeyStore.containsKey(network.id())) { | 99 | if (!networkIdAsKeyStore.containsKey(network.id())) { |
113 | - log.debug("the tenantNetwork did not exist whose identifier was {} ", | 100 | + log.debug("The tenantNetwork is not exist whose identifier was {} ", |
114 | network.id().toString()); | 101 | network.id().toString()); |
115 | return false; | 102 | return false; |
116 | } | 103 | } |
117 | 104 | ||
118 | networkIdAsKeyStore.put(network.id(), network); | 105 | networkIdAsKeyStore.put(network.id(), network); |
119 | 106 | ||
120 | - if (network.equals(networkIdAsKeyStore.get(network.id()))) { | 107 | + if (!network.equals(networkIdAsKeyStore.get(network.id()))) { |
121 | - log.debug("the network updated failed whose identifier was {} ", | 108 | + log.debug("The tenantNetwork is updated failed whose identifier was {} ", |
122 | network.id().toString()); | 109 | network.id().toString()); |
123 | return false; | 110 | return false; |
124 | } | 111 | } |
... | @@ -133,7 +120,7 @@ public class TenantNetworkManager implements TenantNetworkService { | ... | @@ -133,7 +120,7 @@ public class TenantNetworkManager implements TenantNetworkService { |
133 | for (TenantNetworkId networkId : networkIds) { | 120 | for (TenantNetworkId networkId : networkIds) { |
134 | networkIdAsKeyStore.remove(networkId); | 121 | networkIdAsKeyStore.remove(networkId); |
135 | if (networkIdAsKeyStore.containsKey(networkId)) { | 122 | if (networkIdAsKeyStore.containsKey(networkId)) { |
136 | - log.debug("the network removed failed whose identifier was {}", | 123 | + log.debug("The tenantNetwork is removed failed whose identifier was {}", |
137 | networkId.toString()); | 124 | networkId.toString()); |
138 | return false; | 125 | return false; |
139 | } | 126 | } | ... | ... |
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.vtnrsc.tunnel; | ||
17 | + | ||
18 | +import org.onosproject.vtnrsc.Subnet; | ||
19 | +import org.onosproject.vtnrsc.SubnetId; | ||
20 | + | ||
21 | + | ||
22 | +/** | ||
23 | + * Service for interacting with the inventory of subnets. | ||
24 | + */ | ||
25 | +public interface TunnelConfigService { | ||
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 | +} |
... | @@ -13,15 +13,15 @@ | ... | @@ -13,15 +13,15 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc.virtualport; | 16 | +package org.onosproject.vtnrsc.virtualport; |
17 | 17 | ||
18 | import java.util.Collection; | 18 | import java.util.Collection; |
19 | 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; | 20 | import org.onosproject.net.DeviceId; |
21 | +import org.onosproject.vtnrsc.TenantId; | ||
22 | +import org.onosproject.vtnrsc.TenantNetworkId; | ||
23 | +import org.onosproject.vtnrsc.VirtualPort; | ||
24 | +import org.onosproject.vtnrsc.VirtualPortId; | ||
25 | 25 | ||
26 | /** | 26 | /** |
27 | * Service for interacting with the inventory of virtualPort. | 27 | * Service for interacting with the inventory of virtualPort. |
... | @@ -45,6 +45,7 @@ public interface VirtualPortService { | ... | @@ -45,6 +45,7 @@ public interface VirtualPortService { |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Returns the collection of the currently known virtualPort. | 47 | * Returns the collection of the currently known virtualPort. |
48 | + * @return collection of VirtualPort. | ||
48 | */ | 49 | */ |
49 | Collection<VirtualPort> getPorts(); | 50 | Collection<VirtualPort> getPorts(); |
50 | 51 | ... | ... |
... | @@ -13,12 +13,13 @@ | ... | @@ -13,12 +13,13 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc.virtualport.impl; | 16 | +package org.onosproject.vtnrsc.virtualport.impl; |
17 | 17 | ||
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | 19 | ||
20 | import java.util.Collection; | 20 | import java.util.Collection; |
21 | import java.util.Collections; | 21 | import java.util.Collections; |
22 | +import java.util.concurrent.ConcurrentHashMap; | ||
22 | 23 | ||
23 | import org.apache.felix.scr.annotations.Activate; | 24 | import org.apache.felix.scr.annotations.Activate; |
24 | import org.apache.felix.scr.annotations.Component; | 25 | import org.apache.felix.scr.annotations.Component; |
... | @@ -26,18 +27,14 @@ import org.apache.felix.scr.annotations.Deactivate; | ... | @@ -26,18 +27,14 @@ import org.apache.felix.scr.annotations.Deactivate; |
26 | import org.apache.felix.scr.annotations.Reference; | 27 | import org.apache.felix.scr.annotations.Reference; |
27 | import org.apache.felix.scr.annotations.ReferenceCardinality; | 28 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
28 | import org.apache.felix.scr.annotations.Service; | 29 | import org.apache.felix.scr.annotations.Service; |
29 | -import org.onlab.util.KryoNamespace; | ||
30 | import org.onosproject.net.DeviceId; | 30 | import org.onosproject.net.DeviceId; |
31 | -import org.onosproject.store.service.EventuallyConsistentMap; | ||
32 | -import org.onosproject.store.service.MultiValuedTimestamp; | ||
33 | import org.onosproject.store.service.StorageService; | 31 | import org.onosproject.store.service.StorageService; |
34 | -import org.onosproject.store.service.WallClockTimestamp; | 32 | +import org.onosproject.vtnrsc.TenantId; |
35 | -import org.onosproject.app.vtnrsc.TenantId; | 33 | +import org.onosproject.vtnrsc.TenantNetworkId; |
36 | -import org.onosproject.app.vtnrsc.TenantNetworkId; | 34 | +import org.onosproject.vtnrsc.VirtualPort; |
37 | -import org.onosproject.app.vtnrsc.VirtualPort; | 35 | +import org.onosproject.vtnrsc.VirtualPortId; |
38 | -import org.onosproject.app.vtnrsc.VirtualPortId; | 36 | +import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService; |
39 | -import org.onosproject.app.vtnrsc.tenantnetwork.TenantNetworkService; | 37 | +import org.onosproject.vtnrsc.virtualport.VirtualPortService; |
40 | -import org.onosproject.app.vtnrsc.virtualport.VirtualPortService; | ||
41 | import org.slf4j.Logger; | 38 | import org.slf4j.Logger; |
42 | import org.slf4j.LoggerFactory; | 39 | import org.slf4j.LoggerFactory; |
43 | 40 | ||
... | @@ -56,8 +53,8 @@ public class VirtualPortManager implements VirtualPortService { | ... | @@ -56,8 +53,8 @@ public class VirtualPortManager implements VirtualPortService { |
56 | private static final String NETWORKID_NOT_NULL = "NetworkId cannot be null"; | 53 | private static final String NETWORKID_NOT_NULL = "NetworkId cannot be null"; |
57 | private static final String DEVICEID_NOT_NULL = "DeviceId cannot be null"; | 54 | private static final String DEVICEID_NOT_NULL = "DeviceId cannot be null"; |
58 | 55 | ||
59 | - private EventuallyConsistentMap<VirtualPortId, VirtualPort> vPortStore; | 56 | + protected ConcurrentHashMap<VirtualPortId, VirtualPort> vPortStore = |
60 | - | 57 | + new ConcurrentHashMap<>(); |
61 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 58 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
62 | protected StorageService storageService; | 59 | protected StorageService storageService; |
63 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 60 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
... | @@ -65,19 +62,12 @@ public class VirtualPortManager implements VirtualPortService { | ... | @@ -65,19 +62,12 @@ public class VirtualPortManager implements VirtualPortService { |
65 | 62 | ||
66 | @Activate | 63 | @Activate |
67 | public void activate() { | 64 | public void activate() { |
68 | - KryoNamespace.Builder seriallizer = KryoNamespace.newBuilder() | ||
69 | - .register(MultiValuedTimestamp.class); | ||
70 | - vPortStore = storageService | ||
71 | - .<VirtualPortId, VirtualPort>eventuallyConsistentMapBuilder() | ||
72 | - .withName("vPortId_vPort").withSerializer(seriallizer) | ||
73 | - .withTimestampProvider((k, v) -> new WallClockTimestamp()) | ||
74 | - .build(); | ||
75 | log.info("Started"); | 65 | log.info("Started"); |
76 | } | 66 | } |
77 | 67 | ||
78 | @Deactivate | 68 | @Deactivate |
79 | public void deactivate() { | 69 | public void deactivate() { |
80 | - vPortStore.destroy(); | 70 | + vPortStore.clear(); |
81 | log.info("Stoppped"); | 71 | log.info("Stoppped"); |
82 | } | 72 | } |
83 | 73 | ||
... | @@ -141,7 +131,7 @@ public class VirtualPortManager implements VirtualPortService { | ... | @@ -141,7 +131,7 @@ public class VirtualPortManager implements VirtualPortService { |
141 | log.debug("vPortId is {} ", vPort.portId().toString()); | 131 | log.debug("vPortId is {} ", vPort.portId().toString()); |
142 | vPortStore.put(vPort.portId(), vPort); | 132 | vPortStore.put(vPort.portId(), vPort); |
143 | if (!vPortStore.containsKey(vPort.portId())) { | 133 | if (!vPortStore.containsKey(vPort.portId())) { |
144 | - log.debug("the virtualPort created failed whose identifier was {} ", | 134 | + log.debug("The virtualPort is created failed whose identifier is {} ", |
145 | vPort.portId().toString()); | 135 | vPort.portId().toString()); |
146 | return false; | 136 | return false; |
147 | } | 137 | } |
... | @@ -156,7 +146,7 @@ public class VirtualPortManager implements VirtualPortService { | ... | @@ -156,7 +146,7 @@ public class VirtualPortManager implements VirtualPortService { |
156 | for (VirtualPort vPort : vPorts) { | 146 | for (VirtualPort vPort : vPorts) { |
157 | vPortStore.put(vPort.portId(), vPort); | 147 | vPortStore.put(vPort.portId(), vPort); |
158 | if (!vPortStore.containsKey(vPort.portId())) { | 148 | if (!vPortStore.containsKey(vPort.portId())) { |
159 | - log.debug("the virtualPort did not exist whose identifier was {}", | 149 | + log.debug("The virtualPort is not exist whose identifier is {}", |
160 | vPort.portId().toString()); | 150 | vPort.portId().toString()); |
161 | return false; | 151 | return false; |
162 | } | 152 | } |
... | @@ -164,7 +154,7 @@ public class VirtualPortManager implements VirtualPortService { | ... | @@ -164,7 +154,7 @@ public class VirtualPortManager implements VirtualPortService { |
164 | vPortStore.put(vPort.portId(), vPort); | 154 | vPortStore.put(vPort.portId(), vPort); |
165 | 155 | ||
166 | if (!vPort.equals(vPortStore.get(vPort.portId()))) { | 156 | if (!vPort.equals(vPortStore.get(vPort.portId()))) { |
167 | - log.debug("the virtualPort updated failed whose identifier was {}", | 157 | + log.debug("The virtualPort is updated failed whose identifier is {}", |
168 | vPort.portId().toString()); | 158 | vPort.portId().toString()); |
169 | return false; | 159 | return false; |
170 | } | 160 | } |
... | @@ -180,7 +170,7 @@ public class VirtualPortManager implements VirtualPortService { | ... | @@ -180,7 +170,7 @@ public class VirtualPortManager implements VirtualPortService { |
180 | for (VirtualPortId vPortId : vPortIds) { | 170 | for (VirtualPortId vPortId : vPortIds) { |
181 | vPortStore.remove(vPortId); | 171 | vPortStore.remove(vPortId); |
182 | if (vPortStore.containsKey(vPortId)) { | 172 | if (vPortStore.containsKey(vPortId)) { |
183 | - log.debug("the virtualPort removed failed whose identifier was {}", | 173 | + log.debug("The virtualPort is removed failed whose identifier is {}", |
184 | vPortId.toString()); | 174 | vPortId.toString()); |
185 | return false; | 175 | return false; |
186 | } | 176 | } | ... | ... |
... | @@ -13,13 +13,13 @@ | ... | @@ -13,13 +13,13 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc.web; | 16 | +package org.onosproject.vtnrsc.web; |
17 | 17 | ||
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | 19 | ||
20 | -import org.onosproject.app.vtnrsc.AllocationPool; | ||
21 | import org.onosproject.codec.CodecContext; | 20 | import org.onosproject.codec.CodecContext; |
22 | import org.onosproject.codec.JsonCodec; | 21 | import org.onosproject.codec.JsonCodec; |
22 | +import org.onosproject.vtnrsc.AllocationPool; | ||
23 | 23 | ||
24 | import com.fasterxml.jackson.databind.node.ObjectNode; | 24 | import com.fasterxml.jackson.databind.node.ObjectNode; |
25 | 25 | ... | ... |
... | @@ -13,13 +13,13 @@ | ... | @@ -13,13 +13,13 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc.web; | 16 | +package org.onosproject.vtnrsc.web; |
17 | 17 | ||
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | 19 | ||
20 | -import org.onosproject.app.vtnrsc.AllowedAddressPair; | ||
21 | import org.onosproject.codec.CodecContext; | 20 | import org.onosproject.codec.CodecContext; |
22 | import org.onosproject.codec.JsonCodec; | 21 | import org.onosproject.codec.JsonCodec; |
22 | +import org.onosproject.vtnrsc.AllowedAddressPair; | ||
23 | 23 | ||
24 | import com.fasterxml.jackson.databind.node.ObjectNode; | 24 | import com.fasterxml.jackson.databind.node.ObjectNode; |
25 | 25 | ... | ... |
... | @@ -13,13 +13,13 @@ | ... | @@ -13,13 +13,13 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc.web; | 16 | +package org.onosproject.vtnrsc.web; |
17 | 17 | ||
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | 19 | ||
20 | -import org.onosproject.app.vtnrsc.FixedIp; | ||
21 | import org.onosproject.codec.CodecContext; | 20 | import org.onosproject.codec.CodecContext; |
22 | import org.onosproject.codec.JsonCodec; | 21 | import org.onosproject.codec.JsonCodec; |
22 | +import org.onosproject.vtnrsc.FixedIp; | ||
23 | 23 | ||
24 | import com.fasterxml.jackson.databind.node.ObjectNode; | 24 | import com.fasterxml.jackson.databind.node.ObjectNode; |
25 | 25 | ... | ... |
... | @@ -13,13 +13,13 @@ | ... | @@ -13,13 +13,13 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc.web; | 16 | +package org.onosproject.vtnrsc.web; |
17 | 17 | ||
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | 19 | ||
20 | import org.onosproject.codec.CodecContext; | 20 | import org.onosproject.codec.CodecContext; |
21 | import org.onosproject.codec.JsonCodec; | 21 | import org.onosproject.codec.JsonCodec; |
22 | -import org.onosproject.app.vtnrsc.HostRoute; | 22 | +import org.onosproject.vtnrsc.HostRoute; |
23 | 23 | ||
24 | import com.fasterxml.jackson.databind.node.ObjectNode; | 24 | import com.fasterxml.jackson.databind.node.ObjectNode; |
25 | 25 | ... | ... |
... | @@ -13,13 +13,13 @@ | ... | @@ -13,13 +13,13 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc.web; | 16 | +package org.onosproject.vtnrsc.web; |
17 | 17 | ||
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | 19 | ||
20 | -import org.onosproject.app.vtnrsc.SecurityGroup; | ||
21 | import org.onosproject.codec.CodecContext; | 20 | import org.onosproject.codec.CodecContext; |
22 | import org.onosproject.codec.JsonCodec; | 21 | import org.onosproject.codec.JsonCodec; |
22 | +import org.onosproject.vtnrsc.SecurityGroup; | ||
23 | 23 | ||
24 | import com.fasterxml.jackson.databind.node.ObjectNode; | 24 | import com.fasterxml.jackson.databind.node.ObjectNode; |
25 | 25 | ... | ... |
... | @@ -13,13 +13,13 @@ | ... | @@ -13,13 +13,13 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc.web; | 16 | +package org.onosproject.vtnrsc.web; |
17 | 17 | ||
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | 19 | ||
20 | -import org.onosproject.app.vtnrsc.Subnet; | ||
21 | import org.onosproject.codec.CodecContext; | 20 | import org.onosproject.codec.CodecContext; |
22 | import org.onosproject.codec.JsonCodec; | 21 | import org.onosproject.codec.JsonCodec; |
22 | +import org.onosproject.vtnrsc.Subnet; | ||
23 | 23 | ||
24 | import com.fasterxml.jackson.databind.node.ObjectNode; | 24 | import com.fasterxml.jackson.databind.node.ObjectNode; |
25 | 25 | ... | ... |
... | @@ -13,13 +13,13 @@ | ... | @@ -13,13 +13,13 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc.web; | 16 | +package org.onosproject.vtnrsc.web; |
17 | 17 | ||
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | 19 | ||
20 | import org.onosproject.codec.CodecContext; | 20 | import org.onosproject.codec.CodecContext; |
21 | import org.onosproject.codec.JsonCodec; | 21 | import org.onosproject.codec.JsonCodec; |
22 | -import org.onosproject.app.vtnrsc.TenantNetwork; | 22 | +import org.onosproject.vtnrsc.TenantNetwork; |
23 | 23 | ||
24 | import com.fasterxml.jackson.databind.node.ObjectNode; | 24 | import com.fasterxml.jackson.databind.node.ObjectNode; |
25 | 25 | ... | ... |
... | @@ -13,13 +13,13 @@ | ... | @@ -13,13 +13,13 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.app.vtnrsc.web; | 16 | +package org.onosproject.vtnrsc.web; |
17 | 17 | ||
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | 19 | ||
20 | import org.onosproject.codec.CodecContext; | 20 | import org.onosproject.codec.CodecContext; |
21 | import org.onosproject.codec.JsonCodec; | 21 | import org.onosproject.codec.JsonCodec; |
22 | -import org.onosproject.app.vtnrsc.VirtualPort; | 22 | +import org.onosproject.vtnrsc.VirtualPort; |
23 | 23 | ||
24 | import com.fasterxml.jackson.databind.node.ObjectNode; | 24 | import com.fasterxml.jackson.databind.node.ObjectNode; |
25 | 25 | ||
... | @@ -44,7 +44,7 @@ public final class VirtualPortCodec extends JsonCodec<VirtualPort> { | ... | @@ -44,7 +44,7 @@ public final class VirtualPortCodec extends JsonCodec<VirtualPort> { |
44 | .put("device_owner", vPort.deviceOwner().toString()) | 44 | .put("device_owner", vPort.deviceOwner().toString()) |
45 | .put("binding:vnic_type", vPort.bindingVnicType().toString()) | 45 | .put("binding:vnic_type", vPort.bindingVnicType().toString()) |
46 | .put("binding:Vif_type", vPort.bindingVifType().toString()) | 46 | .put("binding:Vif_type", vPort.bindingVifType().toString()) |
47 | - .put("binding:host_id", vPort.bindingHostId().mac().toString()) | 47 | + .put("binding:host_id", vPort.bindingHostId().toString()) |
48 | .put("binding:vif_details", vPort.bindingVifDetails().toString()); | 48 | .put("binding:vif_details", vPort.bindingVifDetails().toString()); |
49 | result.set("allowed_address_pairs", new AllowedAddressPairCodec().encode( | 49 | result.set("allowed_address_pairs", new AllowedAddressPairCodec().encode( |
50 | vPort.allowedAddressPairs(), context)); | 50 | vPort.allowedAddressPairs(), context)); | ... | ... |
apps/vtnweb/features.xml
deleted
100644 → 0
1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
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 | -<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}"> | ||
18 | - <repository>mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features</repository> | ||
19 | - <feature name="onos-app-vtnweb" version="@FEATURE-VERSION" | ||
20 | - description="ONOS app vtnweb components"> | ||
21 | - <feature>onos-app-vtnrsc</feature> | ||
22 | - <bundle>mvn:org.onosproject/vtnweb/@ONOS-VERSION | ||
23 | - </bundle> | ||
24 | - </feature> | ||
25 | -</features> |
... | @@ -42,19 +42,19 @@ import org.onlab.packet.IpAddress; | ... | @@ -42,19 +42,19 @@ import org.onlab.packet.IpAddress; |
42 | import org.onlab.packet.IpAddress.Version; | 42 | import org.onlab.packet.IpAddress.Version; |
43 | import org.onlab.packet.IpPrefix; | 43 | import org.onlab.packet.IpPrefix; |
44 | import org.onlab.util.ItemNotFoundException; | 44 | import org.onlab.util.ItemNotFoundException; |
45 | -import org.onosproject.app.vtnrsc.AllocationPool; | ||
46 | -import org.onosproject.app.vtnrsc.DefaultAllocationPool; | ||
47 | -import org.onosproject.app.vtnrsc.DefaultHostRoute; | ||
48 | -import org.onosproject.app.vtnrsc.DefaultSubnet; | ||
49 | -import org.onosproject.app.vtnrsc.HostRoute; | ||
50 | -import org.onosproject.app.vtnrsc.Subnet; | ||
51 | -import org.onosproject.app.vtnrsc.Subnet.Mode; | ||
52 | -import org.onosproject.app.vtnrsc.SubnetId; | ||
53 | -import org.onosproject.app.vtnrsc.TenantId; | ||
54 | -import org.onosproject.app.vtnrsc.TenantNetworkId; | ||
55 | -import org.onosproject.app.vtnrsc.subnet.SubnetService; | ||
56 | -import org.onosproject.app.vtnrsc.web.SubnetCodec; | ||
57 | import org.onosproject.rest.AbstractWebResource; | 45 | import org.onosproject.rest.AbstractWebResource; |
46 | +import org.onosproject.vtnrsc.AllocationPool; | ||
47 | +import org.onosproject.vtnrsc.DefaultAllocationPool; | ||
48 | +import org.onosproject.vtnrsc.DefaultHostRoute; | ||
49 | +import org.onosproject.vtnrsc.DefaultSubnet; | ||
50 | +import org.onosproject.vtnrsc.HostRoute; | ||
51 | +import org.onosproject.vtnrsc.Subnet; | ||
52 | +import org.onosproject.vtnrsc.SubnetId; | ||
53 | +import org.onosproject.vtnrsc.TenantId; | ||
54 | +import org.onosproject.vtnrsc.TenantNetworkId; | ||
55 | +import org.onosproject.vtnrsc.Subnet.Mode; | ||
56 | +import org.onosproject.vtnrsc.subnet.SubnetService; | ||
57 | +import org.onosproject.vtnrsc.web.SubnetCodec; | ||
58 | import org.slf4j.Logger; | 58 | import org.slf4j.Logger; |
59 | import org.slf4j.LoggerFactory; | 59 | import org.slf4j.LoggerFactory; |
60 | 60 | ||
... | @@ -85,7 +85,7 @@ public class SubnetWebResource extends AbstractWebResource { | ... | @@ -85,7 +85,7 @@ public class SubnetWebResource extends AbstractWebResource { |
85 | public Response getSubnet(@PathParam("subnetUUID") String id) { | 85 | public Response getSubnet(@PathParam("subnetUUID") String id) { |
86 | 86 | ||
87 | if (!get(SubnetService.class).exists(SubnetId.subnetId(id))) { | 87 | if (!get(SubnetService.class).exists(SubnetId.subnetId(id))) { |
88 | - return ok("the subnet does not exists").build(); | 88 | + return ok("The subnet does not exists").build(); |
89 | } | 89 | } |
90 | Subnet sub = nullIsNotFound(get(SubnetService.class) | 90 | Subnet sub = nullIsNotFound(get(SubnetService.class) |
91 | .getSubnet(SubnetId.subnetId(id)), | 91 | .getSubnet(SubnetId.subnetId(id)), |
... | @@ -183,30 +183,30 @@ public class SubnetWebResource extends AbstractWebResource { | ... | @@ -183,30 +183,30 @@ public class SubnetWebResource extends AbstractWebResource { |
183 | checkNotNull(subnetNodes, JSON_NOT_NULL); | 183 | checkNotNull(subnetNodes, JSON_NOT_NULL); |
184 | Map<SubnetId, Subnet> subMap = new HashMap<SubnetId, Subnet>(); | 184 | Map<SubnetId, Subnet> subMap = new HashMap<SubnetId, Subnet>(); |
185 | for (JsonNode subnetNode : subnetNodes) { | 185 | for (JsonNode subnetNode : subnetNodes) { |
186 | - if (subnetNode.hasNonNull("id")) { | 186 | + if (!subnetNode.hasNonNull("id")) { |
187 | return null; | 187 | return null; |
188 | } | 188 | } |
189 | SubnetId id = SubnetId.subnetId(subnetNode.get("id").asText()); | 189 | SubnetId id = SubnetId.subnetId(subnetNode.get("id").asText()); |
190 | String subnetName = subnetNode.get("name").asText(); | 190 | String subnetName = subnetNode.get("name").asText(); |
191 | - TenantId tenantId = TenantId.tenantId(subnetNode.get("tenant_id") | 191 | + TenantId tenantId = TenantId |
192 | - .asText()); | 192 | + .tenantId(subnetNode.get("tenant_id").asText()); |
193 | - TenantNetworkId networkId = TenantNetworkId.networkId(subnetNode | 193 | + TenantNetworkId networkId = TenantNetworkId |
194 | - .get("network_id").asText()); | 194 | + .networkId(subnetNode.get("network_id").asText()); |
195 | - Version ipVersion = Version.valueOf(subnetNode.get("ip_version") | 195 | + Version ipVersion = Version |
196 | - .asText()); | 196 | + .valueOf(subnetNode.get("ip_version").asText()); |
197 | IpPrefix cidr = IpPrefix.valueOf(subnetNode.get("cidr").asText()); | 197 | IpPrefix cidr = IpPrefix.valueOf(subnetNode.get("cidr").asText()); |
198 | - IpAddress gatewayIp = IpAddress.valueOf(subnetNode | 198 | + IpAddress gatewayIp = IpAddress |
199 | - .get("gateway_ip").asText()); | 199 | + .valueOf(subnetNode.get("gateway_ip").asText()); |
200 | Boolean dhcpEnabled = subnetNode.get("enable_dhcp").asBoolean(); | 200 | Boolean dhcpEnabled = subnetNode.get("enable_dhcp").asBoolean(); |
201 | Boolean shared = subnetNode.get("shared").asBoolean(); | 201 | Boolean shared = subnetNode.get("shared").asBoolean(); |
202 | JsonNode hostRoutes = subnetNode.get("host_routes"); | 202 | JsonNode hostRoutes = subnetNode.get("host_routes"); |
203 | Iterable<HostRoute> hostRoutesIt = jsonNodeToHostRoutes(hostRoutes); | 203 | Iterable<HostRoute> hostRoutesIt = jsonNodeToHostRoutes(hostRoutes); |
204 | JsonNode allocationPools = subnetNode.get("allocation_pools"); | 204 | JsonNode allocationPools = subnetNode.get("allocation_pools"); |
205 | Iterable<AllocationPool> allocationPoolsIt = jsonNodeToAllocationPools(allocationPools); | 205 | Iterable<AllocationPool> allocationPoolsIt = jsonNodeToAllocationPools(allocationPools); |
206 | - Mode ipV6AddressMode = Mode.valueOf(subnetNode | 206 | + Mode ipV6AddressMode = Mode |
207 | - .get("ipv6_address_mode").asText()); | 207 | + .valueOf(subnetNode.get("ipv6_address_mode").asText()); |
208 | - Mode ipV6RaMode = Mode.valueOf(subnetNode.get("ipv6_ra_mode") | 208 | + Mode ipV6RaMode = Mode |
209 | - .asText()); | 209 | + .valueOf(subnetNode.get("ipv6_ra_mode").asText()); |
210 | Subnet subnet = new DefaultSubnet(id, subnetName, networkId, | 210 | Subnet subnet = new DefaultSubnet(id, subnetName, networkId, |
211 | tenantId, ipVersion, cidr, | 211 | tenantId, ipVersion, cidr, |
212 | gatewayIp, dhcpEnabled, shared, | 212 | gatewayIp, dhcpEnabled, shared, |
... | @@ -226,27 +226,42 @@ public class SubnetWebResource extends AbstractWebResource { | ... | @@ -226,27 +226,42 @@ public class SubnetWebResource extends AbstractWebResource { |
226 | public Iterable<Subnet> changeJsonToSub(JsonNode subnetNodes) { | 226 | public Iterable<Subnet> changeJsonToSub(JsonNode subnetNodes) { |
227 | checkNotNull(subnetNodes, JSON_NOT_NULL); | 227 | checkNotNull(subnetNodes, JSON_NOT_NULL); |
228 | Map<SubnetId, Subnet> subMap = new HashMap<SubnetId, Subnet>(); | 228 | Map<SubnetId, Subnet> subMap = new HashMap<SubnetId, Subnet>(); |
229 | + if (!subnetNodes.hasNonNull("id")) { | ||
230 | + return null; | ||
231 | + } | ||
229 | SubnetId id = SubnetId.subnetId(subnetNodes.get("id").asText()); | 232 | SubnetId id = SubnetId.subnetId(subnetNodes.get("id").asText()); |
230 | String subnetName = subnetNodes.get("name").asText(); | 233 | String subnetName = subnetNodes.get("name").asText(); |
231 | - TenantId tenantId = TenantId.tenantId(subnetNodes.get("tenant_id") | 234 | + TenantId tenantId = TenantId |
232 | - .asText()); | 235 | + .tenantId(subnetNodes.get("tenant_id").asText()); |
233 | - TenantNetworkId networkId = TenantNetworkId.networkId(subnetNodes | 236 | + TenantNetworkId networkId = TenantNetworkId |
234 | - .get("network_id").asText()); | 237 | + .networkId(subnetNodes.get("network_id").asText()); |
235 | - Version ipVersion = Version.valueOf(subnetNodes.get("ip_version") | 238 | + String version = subnetNodes.get("ip_version").asText(); |
236 | - .asText()); | 239 | + Version ipVersion; |
240 | + switch (version) { | ||
241 | + case "4": | ||
242 | + ipVersion = Version.INET; | ||
243 | + break; | ||
244 | + case "6": | ||
245 | + ipVersion = Version.INET; | ||
246 | + break; | ||
247 | + default: | ||
248 | + ipVersion = null; | ||
249 | + } | ||
250 | + | ||
237 | IpPrefix cidr = IpPrefix.valueOf(subnetNodes.get("cidr").asText()); | 251 | IpPrefix cidr = IpPrefix.valueOf(subnetNodes.get("cidr").asText()); |
238 | - IpAddress gatewayIp = IpAddress.valueOf(subnetNodes.get("gateway_ip") | 252 | + IpAddress gatewayIp = IpAddress |
239 | - .asText()); | 253 | + .valueOf(subnetNodes.get("gateway_ip").asText()); |
240 | Boolean dhcpEnabled = subnetNodes.get("enable_dhcp").asBoolean(); | 254 | Boolean dhcpEnabled = subnetNodes.get("enable_dhcp").asBoolean(); |
241 | Boolean shared = subnetNodes.get("shared").asBoolean(); | 255 | Boolean shared = subnetNodes.get("shared").asBoolean(); |
242 | JsonNode hostRoutes = subnetNodes.get("host_routes"); | 256 | JsonNode hostRoutes = subnetNodes.get("host_routes"); |
243 | Iterable<HostRoute> hostRoutesIt = jsonNodeToHostRoutes(hostRoutes); | 257 | Iterable<HostRoute> hostRoutesIt = jsonNodeToHostRoutes(hostRoutes); |
244 | JsonNode allocationPools = subnetNodes.get("allocation_pools"); | 258 | JsonNode allocationPools = subnetNodes.get("allocation_pools"); |
245 | Iterable<AllocationPool> allocationPoolsIt = jsonNodeToAllocationPools(allocationPools); | 259 | Iterable<AllocationPool> allocationPoolsIt = jsonNodeToAllocationPools(allocationPools); |
246 | - Mode ipV6AddressMode = Mode.valueOf(subnetNodes | 260 | + |
247 | - .get("ipv6_address_mode").asText()); | 261 | + Mode ipV6AddressMode = getMode(subnetNodes.get("ipv6_address_mode") |
248 | - Mode ipV6RaMode = Mode | 262 | + .asText()); |
249 | - .valueOf(subnetNodes.get("ipv6_ra_mode").asText()); | 263 | + Mode ipV6RaMode = getMode(subnetNodes.get("ipv6_ra_mode").asText()); |
264 | + | ||
250 | Subnet subnet = new DefaultSubnet(id, subnetName, networkId, tenantId, | 265 | Subnet subnet = new DefaultSubnet(id, subnetName, networkId, tenantId, |
251 | ipVersion, cidr, gatewayIp, | 266 | ipVersion, cidr, gatewayIp, |
252 | dhcpEnabled, shared, hostRoutesIt, | 267 | dhcpEnabled, shared, hostRoutesIt, |
... | @@ -257,6 +272,33 @@ public class SubnetWebResource extends AbstractWebResource { | ... | @@ -257,6 +272,33 @@ public class SubnetWebResource extends AbstractWebResource { |
257 | } | 272 | } |
258 | 273 | ||
259 | /** | 274 | /** |
275 | + * Gets ipv6_address_mode or ipv6_ra_mode type. | ||
276 | + * | ||
277 | + * @param mode the String value in JsonNode | ||
278 | + * @return ipV6Mode Mode of the ipV6Mode | ||
279 | + */ | ||
280 | + private Mode getMode(String mode) { | ||
281 | + Mode ipV6Mode; | ||
282 | + if (mode == null) { | ||
283 | + return null; | ||
284 | + } | ||
285 | + switch (mode) { | ||
286 | + case "dhcpv6-stateful": | ||
287 | + ipV6Mode = Mode.DHCPV6_STATEFUL; | ||
288 | + break; | ||
289 | + case "dhcpv6-stateless": | ||
290 | + ipV6Mode = Mode.DHCPV6_STATELESS; | ||
291 | + break; | ||
292 | + case "slaac": | ||
293 | + ipV6Mode = Mode.SLAAC; | ||
294 | + break; | ||
295 | + default: | ||
296 | + ipV6Mode = null; | ||
297 | + } | ||
298 | + return ipV6Mode; | ||
299 | + } | ||
300 | + | ||
301 | + /** | ||
260 | * Changes JsonNode alocPools to a collection of the alocPools. | 302 | * Changes JsonNode alocPools to a collection of the alocPools. |
261 | * | 303 | * |
262 | * @param allocationPools the allocationPools JsonNode | 304 | * @param allocationPools the allocationPools JsonNode | ... | ... |
... | @@ -39,17 +39,17 @@ import javax.ws.rs.core.MediaType; | ... | @@ -39,17 +39,17 @@ import javax.ws.rs.core.MediaType; |
39 | import javax.ws.rs.core.Response; | 39 | import javax.ws.rs.core.Response; |
40 | 40 | ||
41 | import org.onlab.util.ItemNotFoundException; | 41 | import org.onlab.util.ItemNotFoundException; |
42 | -import org.onosproject.app.vtnrsc.DefaultTenantNetwork; | ||
43 | -import org.onosproject.app.vtnrsc.PhysicalNetwork; | ||
44 | -import org.onosproject.app.vtnrsc.SegmentationId; | ||
45 | -import org.onosproject.app.vtnrsc.TenantId; | ||
46 | -import org.onosproject.app.vtnrsc.TenantNetwork; | ||
47 | -import org.onosproject.app.vtnrsc.TenantNetwork.State; | ||
48 | -import org.onosproject.app.vtnrsc.TenantNetwork.Type; | ||
49 | -import org.onosproject.app.vtnrsc.TenantNetworkId; | ||
50 | -import org.onosproject.app.vtnrsc.tenantnetwork.TenantNetworkService; | ||
51 | -import org.onosproject.app.vtnrsc.web.TenantNetworkCodec; | ||
52 | import org.onosproject.rest.AbstractWebResource; | 42 | import org.onosproject.rest.AbstractWebResource; |
43 | +import org.onosproject.vtnrsc.DefaultTenantNetwork; | ||
44 | +import org.onosproject.vtnrsc.PhysicalNetwork; | ||
45 | +import org.onosproject.vtnrsc.SegmentationId; | ||
46 | +import org.onosproject.vtnrsc.TenantId; | ||
47 | +import org.onosproject.vtnrsc.TenantNetwork; | ||
48 | +import org.onosproject.vtnrsc.TenantNetworkId; | ||
49 | +import org.onosproject.vtnrsc.TenantNetwork.State; | ||
50 | +import org.onosproject.vtnrsc.TenantNetwork.Type; | ||
51 | +import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService; | ||
52 | +import org.onosproject.vtnrsc.web.TenantNetworkCodec; | ||
53 | import org.slf4j.Logger; | 53 | import org.slf4j.Logger; |
54 | import org.slf4j.LoggerFactory; | 54 | import org.slf4j.LoggerFactory; |
55 | 55 | ... | ... |
... | @@ -43,20 +43,20 @@ import org.onlab.packet.IpAddress; | ... | @@ -43,20 +43,20 @@ import org.onlab.packet.IpAddress; |
43 | import org.onlab.packet.MacAddress; | 43 | import org.onlab.packet.MacAddress; |
44 | import org.onlab.util.ItemNotFoundException; | 44 | import org.onlab.util.ItemNotFoundException; |
45 | import org.onosproject.net.DeviceId; | 45 | import org.onosproject.net.DeviceId; |
46 | -import org.onosproject.net.HostId; | ||
47 | import org.onosproject.rest.AbstractWebResource; | 46 | import org.onosproject.rest.AbstractWebResource; |
48 | -import org.onosproject.app.vtnrsc.AllowedAddressPair; | 47 | +import org.onosproject.vtnrsc.AllowedAddressPair; |
49 | -import org.onosproject.app.vtnrsc.DefaultVirtualPort; | 48 | +import org.onosproject.vtnrsc.BindingHostId; |
50 | -import org.onosproject.app.vtnrsc.FixedIp; | 49 | +import org.onosproject.vtnrsc.DefaultVirtualPort; |
51 | -import org.onosproject.app.vtnrsc.SecurityGroup; | 50 | +import org.onosproject.vtnrsc.FixedIp; |
52 | -import org.onosproject.app.vtnrsc.SubnetId; | 51 | +import org.onosproject.vtnrsc.SecurityGroup; |
53 | -import org.onosproject.app.vtnrsc.TenantId; | 52 | +import org.onosproject.vtnrsc.SubnetId; |
54 | -import org.onosproject.app.vtnrsc.TenantNetworkId; | 53 | +import org.onosproject.vtnrsc.TenantId; |
55 | -import org.onosproject.app.vtnrsc.VirtualPort; | 54 | +import org.onosproject.vtnrsc.TenantNetworkId; |
56 | -import org.onosproject.app.vtnrsc.VirtualPortId; | 55 | +import org.onosproject.vtnrsc.VirtualPort; |
57 | -import org.onosproject.app.vtnrsc.VirtualPort.State; | 56 | +import org.onosproject.vtnrsc.VirtualPortId; |
58 | -import org.onosproject.app.vtnrsc.virtualport.VirtualPortService; | 57 | +import org.onosproject.vtnrsc.VirtualPort.State; |
59 | -import org.onosproject.app.vtnrsc.web.VirtualPortCodec; | 58 | +import org.onosproject.vtnrsc.virtualport.VirtualPortService; |
59 | +import org.onosproject.vtnrsc.web.VirtualPortCodec; | ||
60 | import org.slf4j.Logger; | 60 | import org.slf4j.Logger; |
61 | import org.slf4j.LoggerFactory; | 61 | import org.slf4j.LoggerFactory; |
62 | 62 | ||
... | @@ -216,10 +216,15 @@ public class VirtualPortWebResource extends AbstractWebResource { | ... | @@ -216,10 +216,15 @@ public class VirtualPortWebResource extends AbstractWebResource { |
216 | DeviceId deviceId = DeviceId.deviceId(vPortnode.get("device_id") | 216 | DeviceId deviceId = DeviceId.deviceId(vPortnode.get("device_id") |
217 | .asText()); | 217 | .asText()); |
218 | String deviceOwner = vPortnode.get("device_owner").asText(); | 218 | String deviceOwner = vPortnode.get("device_owner").asText(); |
219 | - JsonNode fixedIpNode = vPortnode.get("fixed_ips"); | 219 | + JsonNode fixedIpNodes = vPortNodes.get("fixed_ips"); |
220 | + Set<FixedIp> fixedIps = new HashSet<FixedIp>(); | ||
221 | + for (JsonNode fixedIpNode : fixedIpNodes) { | ||
220 | FixedIp fixedIp = jsonNodeToFixedIps(fixedIpNode); | 222 | FixedIp fixedIp = jsonNodeToFixedIps(fixedIpNode); |
221 | - HostId bindingHostId = HostId.hostId(MacAddress.valueOf(vPortnode | 223 | + fixedIps.add(fixedIp); |
222 | - .get("binding:host_id").asText())); | 224 | + } |
225 | + | ||
226 | + BindingHostId bindingHostId = BindingHostId | ||
227 | + .bindingHostId(vPortnode.get("binding:host_id").asText()); | ||
223 | String bindingVnicType = vPortnode.get("binding:vnic_type") | 228 | String bindingVnicType = vPortnode.get("binding:vnic_type") |
224 | .asText(); | 229 | .asText(); |
225 | String bindingVifType = vPortnode.get("binding:vif_type").asText(); | 230 | String bindingVifType = vPortnode.get("binding:vif_type").asText(); |
... | @@ -230,18 +235,17 @@ public class VirtualPortWebResource extends AbstractWebResource { | ... | @@ -230,18 +235,17 @@ public class VirtualPortWebResource extends AbstractWebResource { |
230 | Collection<AllowedAddressPair> allowedAddressPairs = | 235 | Collection<AllowedAddressPair> allowedAddressPairs = |
231 | jsonNodeToAllowedAddressPair(allowedAddressPairJsonNode); | 236 | jsonNodeToAllowedAddressPair(allowedAddressPairJsonNode); |
232 | JsonNode securityGroupNode = vPortnode.get("security_groups"); | 237 | JsonNode securityGroupNode = vPortnode.get("security_groups"); |
233 | - Collection<SecurityGroup> securityGroups = | 238 | + Collection<SecurityGroup> securityGroups = jsonNodeToSecurityGroup(securityGroupNode); |
234 | - jsonNodeToSecurityGroup(securityGroupNode); | 239 | + strMap.put("name", name); |
235 | - strMap.putIfAbsent("name", name); | 240 | + strMap.put("deviceOwner", deviceOwner); |
236 | - strMap.putIfAbsent("deviceOwner", deviceOwner); | 241 | + strMap.put("bindingVnicType", bindingVnicType); |
237 | - strMap.putIfAbsent("bindingVnicType", bindingVnicType); | 242 | + strMap.put("bindingVifType", bindingVifType); |
238 | - strMap.putIfAbsent("bindingVifType", bindingVifType); | 243 | + strMap.put("bindingVifDetails", bindingVifDetails); |
239 | - strMap.putIfAbsent("bindingVifDetails", bindingVifDetails); | ||
240 | VirtualPort vPort = new DefaultVirtualPort(id, networkId, | 244 | VirtualPort vPort = new DefaultVirtualPort(id, networkId, |
241 | adminStateUp, strMap, | 245 | adminStateUp, strMap, |
242 | isState(state), | 246 | isState(state), |
243 | macAddress, tenantId, | 247 | macAddress, tenantId, |
244 | - deviceId, fixedIp, | 248 | + deviceId, fixedIps, |
245 | bindingHostId, | 249 | bindingHostId, |
246 | allowedAddressPairs, | 250 | allowedAddressPairs, |
247 | securityGroups); | 251 | securityGroups); |
... | @@ -273,10 +277,15 @@ public class VirtualPortWebResource extends AbstractWebResource { | ... | @@ -273,10 +277,15 @@ public class VirtualPortWebResource extends AbstractWebResource { |
273 | DeviceId deviceId = DeviceId.deviceId(vPortNodes.get("device_id") | 277 | DeviceId deviceId = DeviceId.deviceId(vPortNodes.get("device_id") |
274 | .asText()); | 278 | .asText()); |
275 | String deviceOwner = vPortNodes.get("device_owner").asText(); | 279 | String deviceOwner = vPortNodes.get("device_owner").asText(); |
276 | - JsonNode fixedIpNode = vPortNodes.get("fixed_ips"); | 280 | + JsonNode fixedIpNodes = vPortNodes.get("fixed_ips"); |
281 | + Set<FixedIp> fixedIps = new HashSet<FixedIp>(); | ||
282 | + for (JsonNode fixedIpNode : fixedIpNodes) { | ||
277 | FixedIp fixedIp = jsonNodeToFixedIps(fixedIpNode); | 283 | FixedIp fixedIp = jsonNodeToFixedIps(fixedIpNode); |
278 | - HostId bindingHostId = HostId.hostId(MacAddress.valueOf(vPortNodes | 284 | + fixedIps.add(fixedIp); |
279 | - .get("binding:host_id").asText())); | 285 | + } |
286 | + | ||
287 | + BindingHostId bindingHostId = BindingHostId | ||
288 | + .bindingHostId(vPortNodes.get("binding:host_id").asText()); | ||
280 | String bindingVnicType = vPortNodes.get("binding:vnic_type").asText(); | 289 | String bindingVnicType = vPortNodes.get("binding:vnic_type").asText(); |
281 | String bindingVifType = vPortNodes.get("binding:vif_type").asText(); | 290 | String bindingVifType = vPortNodes.get("binding:vif_type").asText(); |
282 | String bindingVifDetails = vPortNodes.get("binding:vif_details") | 291 | String bindingVifDetails = vPortNodes.get("binding:vif_details") |
... | @@ -286,17 +295,16 @@ public class VirtualPortWebResource extends AbstractWebResource { | ... | @@ -286,17 +295,16 @@ public class VirtualPortWebResource extends AbstractWebResource { |
286 | Collection<AllowedAddressPair> allowedAddressPairs = | 295 | Collection<AllowedAddressPair> allowedAddressPairs = |
287 | jsonNodeToAllowedAddressPair(allowedAddressPairJsonNode); | 296 | jsonNodeToAllowedAddressPair(allowedAddressPairJsonNode); |
288 | JsonNode securityGroupNode = vPortNodes.get("security_groups"); | 297 | JsonNode securityGroupNode = vPortNodes.get("security_groups"); |
289 | - Collection<SecurityGroup> securityGroups = | 298 | + Collection<SecurityGroup> securityGroups = jsonNodeToSecurityGroup(securityGroupNode); |
290 | - jsonNodeToSecurityGroup(securityGroupNode); | 299 | + strMap.put("name", name); |
291 | - strMap.putIfAbsent("name", name); | 300 | + strMap.put("deviceOwner", deviceOwner); |
292 | - strMap.putIfAbsent("deviceOwner", deviceOwner); | 301 | + strMap.put("bindingVnicType", bindingVnicType); |
293 | - strMap.putIfAbsent("bindingVnicType", bindingVnicType); | 302 | + strMap.put("bindingVifType", bindingVifType); |
294 | - strMap.putIfAbsent("bindingVifType", bindingVifType); | 303 | + strMap.put("bindingVifDetails", bindingVifDetails); |
295 | - strMap.putIfAbsent("bindingVifDetails", bindingVifDetails); | ||
296 | VirtualPort vPort = new DefaultVirtualPort(id, networkId, adminStateUp, | 304 | VirtualPort vPort = new DefaultVirtualPort(id, networkId, adminStateUp, |
297 | strMap, isState(state), | 305 | strMap, isState(state), |
298 | macAddress, tenantId, | 306 | macAddress, tenantId, |
299 | - deviceId, fixedIp, | 307 | + deviceId, fixedIps, |
300 | bindingHostId, | 308 | bindingHostId, |
301 | allowedAddressPairs, | 309 | allowedAddressPairs, |
302 | securityGroups); | 310 | securityGroups); |
... | @@ -342,8 +350,8 @@ public class VirtualPortWebResource extends AbstractWebResource { | ... | @@ -342,8 +350,8 @@ public class VirtualPortWebResource extends AbstractWebResource { |
342 | .newConcurrentMap(); | 350 | .newConcurrentMap(); |
343 | int i = 0; | 351 | int i = 0; |
344 | for (JsonNode node : securityGroups) { | 352 | for (JsonNode node : securityGroups) { |
345 | - SecurityGroup securityGroup = SecurityGroup.securityGroup(node | 353 | + SecurityGroup securityGroup = SecurityGroup |
346 | - .get("security_group").asText()); | 354 | + .securityGroup(node.asText()); |
347 | securMaps.put(i, securityGroup); | 355 | securMaps.put(i, securityGroup); |
348 | i++; | 356 | i++; |
349 | } | 357 | } | ... | ... |
-
Please register or login to post a comment