Sho SHIMIZU
Committed by Ray Milkey

Use LF as line separator

Change-Id: I99e78013813e85ea69acb35c8b74252a7b5d7329
Showing 34 changed files with 3166 additions and 3166 deletions
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.vtnrsc; 16 +package org.onosproject.vtnrsc;
17 - 17 +
18 -import org.onlab.packet.IpAddress; 18 +import org.onlab.packet.IpAddress;
19 - 19 +
20 -/** 20 +/**
21 - * The continuous IP address range between the start address and the end address for the allocation pools. 21 + * The continuous IP address range between the start address and the end address for the allocation pools.
22 - */ 22 + */
23 -public interface AllocationPool { 23 +public interface AllocationPool {
24 - 24 +
25 - /** 25 + /**
26 - * The start address for the allocation pool. 26 + * The start address for the allocation pool.
27 - * 27 + *
28 - * @return startIp 28 + * @return startIp
29 - */ 29 + */
30 - IpAddress startIp(); 30 + IpAddress startIp();
31 - 31 +
32 - /** 32 + /**
33 - * The end address for the allocation pool. 33 + * The end address for the allocation pool.
34 - * 34 + *
35 - * @return endIp 35 + * @return endIp
36 - */ 36 + */
37 - IpAddress endIp(); 37 + IpAddress endIp();
38 -} 38 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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;
20 - 20 +
21 -import java.util.Objects; 21 +import java.util.Objects;
22 - 22 +
23 -import org.onlab.packet.IpAddress; 23 +import org.onlab.packet.IpAddress;
24 -import org.onlab.packet.MacAddress; 24 +import org.onlab.packet.MacAddress;
25 - 25 +
26 -/** 26 +/**
27 - * Immutable representation of a allowed address pair. 27 + * Immutable representation of a allowed address pair.
28 - */ 28 + */
29 -public final class AllowedAddressPair { 29 +public final class AllowedAddressPair {
30 - private final IpAddress ip; 30 + private final IpAddress ip;
31 - private final MacAddress mac; 31 + private final MacAddress mac;
32 - // Public construction is prohibited 32 + // Public construction is prohibited
33 - private AllowedAddressPair(IpAddress ip, MacAddress mac) { 33 + private AllowedAddressPair(IpAddress ip, MacAddress mac) {
34 - checkNotNull(ip, "IpAddress cannot be null"); 34 + checkNotNull(ip, "IpAddress cannot be null");
35 - checkNotNull(mac, "MacAddress cannot be null"); 35 + checkNotNull(mac, "MacAddress cannot be null");
36 - this.ip = ip; 36 + this.ip = ip;
37 - this.mac = mac; 37 + this.mac = mac;
38 - } 38 + }
39 - /** 39 + /**
40 - * Returns the AllowedAddressPair ip address. 40 + * Returns the AllowedAddressPair ip address.
41 - * 41 + *
42 - * @return ip address 42 + * @return ip address
43 - */ 43 + */
44 - public IpAddress ip() { 44 + public IpAddress ip() {
45 - return ip; 45 + return ip;
46 - } 46 + }
47 - 47 +
48 - /** 48 + /**
49 - * Returns the AllowedAddressPair MAC address. 49 + * Returns the AllowedAddressPair MAC address.
50 - * 50 + *
51 - * @return MAC address 51 + * @return MAC address
52 - */ 52 + */
53 - public MacAddress mac() { 53 + public MacAddress mac() {
54 - return mac; 54 + return mac;
55 - } 55 + }
56 - 56 +
57 - 57 +
58 - /** 58 + /**
59 - * Creates a allowedAddressPair using the supplied ipAddress & 59 + * Creates a allowedAddressPair using the supplied ipAddress &
60 - * macAddress. 60 + * macAddress.
61 - * 61 + *
62 - * @param ip IP address 62 + * @param ip IP address
63 - * @param mac MAC address 63 + * @param mac MAC address
64 - * @return AllowedAddressPair 64 + * @return AllowedAddressPair
65 - */ 65 + */
66 - public static AllowedAddressPair allowedAddressPair(IpAddress ip, 66 + public static AllowedAddressPair allowedAddressPair(IpAddress ip,
67 - MacAddress mac) { 67 + MacAddress mac) {
68 - return new AllowedAddressPair(ip, mac); 68 + return new AllowedAddressPair(ip, mac);
69 - } 69 + }
70 - 70 +
71 - @Override 71 + @Override
72 - public int hashCode() { 72 + public int hashCode() {
73 - return Objects.hash(ip, mac); 73 + return Objects.hash(ip, mac);
74 - } 74 + }
75 - 75 +
76 - @Override 76 + @Override
77 - public boolean equals(Object obj) { 77 + public boolean equals(Object obj) {
78 - if (this == obj) { 78 + if (this == obj) {
79 - return true; 79 + return true;
80 - } 80 + }
81 - if (obj instanceof AllowedAddressPair) { 81 + if (obj instanceof AllowedAddressPair) {
82 - final AllowedAddressPair that = (AllowedAddressPair) obj; 82 + final AllowedAddressPair that = (AllowedAddressPair) obj;
83 - return Objects.equals(this.ip, that.ip) 83 + return Objects.equals(this.ip, that.ip)
84 - && Objects.equals(this.mac, that.mac); 84 + && Objects.equals(this.mac, that.mac);
85 - } 85 + }
86 - return false; 86 + return false;
87 - } 87 + }
88 - 88 +
89 - @Override 89 + @Override
90 - public String toString() { 90 + public String toString() {
91 - return toStringHelper(this).add("ip", ip).add("mac", mac).toString(); 91 + return toStringHelper(this).add("ip", ip).add("mac", mac).toString();
92 - } 92 + }
93 - 93 +
94 -} 94 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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 +
20 -import java.util.Objects; 20 +import java.util.Objects;
21 - 21 +
22 -public final class BindingHostId { 22 +public final class BindingHostId {
23 - private final String bindingHostId; 23 + private final String bindingHostId;
24 - 24 +
25 - // Public construction is prohibited 25 + // Public construction is prohibited
26 - private BindingHostId(String bindingHostId) { 26 + private BindingHostId(String bindingHostId) {
27 - checkNotNull(bindingHostId, "BindingHosttId cannot be null"); 27 + checkNotNull(bindingHostId, "BindingHosttId cannot be null");
28 - this.bindingHostId = bindingHostId; 28 + this.bindingHostId = bindingHostId;
29 - } 29 + }
30 - 30 +
31 - /** 31 + /**
32 - * Creates a BindingHostId identifier. 32 + * Creates a BindingHostId identifier.
33 - * 33 + *
34 - * @param bindingHostId the bindingHostId identifier 34 + * @param bindingHostId the bindingHostId identifier
35 - * @return the bindingHostId identifier 35 + * @return the bindingHostId identifier
36 - */ 36 + */
37 - public static BindingHostId bindingHostId(String bindingHostId) { 37 + public static BindingHostId bindingHostId(String bindingHostId) {
38 - return new BindingHostId(bindingHostId); 38 + return new BindingHostId(bindingHostId);
39 - } 39 + }
40 - 40 +
41 - /** 41 + /**
42 - * Returns the bindingHostId identifier. 42 + * Returns the bindingHostId identifier.
43 - * 43 + *
44 - * @return the bindingHostId identifier 44 + * @return the bindingHostId identifier
45 - */ 45 + */
46 - public String bindingHostId() { 46 + public String bindingHostId() {
47 - return bindingHostId; 47 + return bindingHostId;
48 - } 48 + }
49 - 49 +
50 - @Override 50 + @Override
51 - public int hashCode() { 51 + public int hashCode() {
52 - return Objects.hash(bindingHostId); 52 + return Objects.hash(bindingHostId);
53 - } 53 + }
54 - 54 +
55 - @Override 55 + @Override
56 - public boolean equals(Object obj) { 56 + public boolean equals(Object obj) {
57 - if (this == obj) { 57 + if (this == obj) {
58 - return true; 58 + return true;
59 - } 59 + }
60 - if (obj instanceof BindingHostId) { 60 + if (obj instanceof BindingHostId) {
61 - final BindingHostId that = (BindingHostId) obj; 61 + final BindingHostId that = (BindingHostId) obj;
62 - return this.getClass() == that.getClass() 62 + return this.getClass() == that.getClass()
63 - && Objects.equals(this.bindingHostId, that.bindingHostId); 63 + && Objects.equals(this.bindingHostId, that.bindingHostId);
64 - } 64 + }
65 - return false; 65 + return false;
66 - } 66 + }
67 - 67 +
68 - @Override 68 + @Override
69 - public String toString() { 69 + public String toString() {
70 - return bindingHostId; 70 + return bindingHostId;
71 - } 71 + }
72 -} 72 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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;
20 -import java.util.Objects; 20 +import java.util.Objects;
21 - 21 +
22 -import org.onlab.packet.IpAddress; 22 +import org.onlab.packet.IpAddress;
23 - 23 +
24 -/** 24 +/**
25 - * The continuous IP address range between the start address and the end address 25 + * The continuous IP address range between the start address and the end address
26 - * for the allocation pools. 26 + * for the allocation pools.
27 - */ 27 + */
28 -public final class DefaultAllocationPool implements AllocationPool { 28 +public final class DefaultAllocationPool implements AllocationPool {
29 - 29 +
30 - private final IpAddress startIp; 30 + private final IpAddress startIp;
31 - private final IpAddress endIp; 31 + private final IpAddress endIp;
32 - 32 +
33 - /** 33 + /**
34 - * Creates an AllocationPool by using the start IP address and the end IP 34 + * Creates an AllocationPool by using the start IP address and the end IP
35 - * address. 35 + * address.
36 - * 36 + *
37 - * @param startIp the start IP address of the allocation pool 37 + * @param startIp the start IP address of the allocation pool
38 - * @param endIp the end IP address of the allocation pool 38 + * @param endIp the end IP address of the allocation pool
39 - */ 39 + */
40 - public DefaultAllocationPool(IpAddress startIp, IpAddress endIp) { 40 + public DefaultAllocationPool(IpAddress startIp, IpAddress endIp) {
41 - checkNotNull(startIp, "StartIp cannot be null"); 41 + checkNotNull(startIp, "StartIp cannot be null");
42 - checkNotNull(endIp, "EndIp cannot be null"); 42 + checkNotNull(endIp, "EndIp cannot be null");
43 - this.startIp = startIp; 43 + this.startIp = startIp;
44 - this.endIp = endIp; 44 + this.endIp = endIp;
45 - } 45 + }
46 - 46 +
47 - @Override 47 + @Override
48 - public IpAddress startIp() { 48 + public IpAddress startIp() {
49 - return startIp; 49 + return startIp;
50 - } 50 + }
51 - 51 +
52 - @Override 52 + @Override
53 - public IpAddress endIp() { 53 + public IpAddress endIp() {
54 - return endIp; 54 + return endIp;
55 - } 55 + }
56 - 56 +
57 - @Override 57 + @Override
58 - public int hashCode() { 58 + public int hashCode() {
59 - return Objects.hash(startIp, endIp); 59 + return Objects.hash(startIp, endIp);
60 - } 60 + }
61 - 61 +
62 - @Override 62 + @Override
63 - public boolean equals(Object obj) { 63 + public boolean equals(Object obj) {
64 - if (this == obj) { 64 + if (this == obj) {
65 - return true; 65 + return true;
66 - } 66 + }
67 - if (obj instanceof DefaultAllocationPool) { 67 + if (obj instanceof DefaultAllocationPool) {
68 - final DefaultAllocationPool other = (DefaultAllocationPool) obj; 68 + final DefaultAllocationPool other = (DefaultAllocationPool) obj;
69 - return Objects.equals(this.startIp, other.startIp) 69 + return Objects.equals(this.startIp, other.startIp)
70 - && Objects.equals(this.endIp, other.endIp); 70 + && Objects.equals(this.endIp, other.endIp);
71 - } 71 + }
72 - return false; 72 + return false;
73 - } 73 + }
74 - 74 +
75 - @Override 75 + @Override
76 - public String toString() { 76 + public String toString() {
77 - return toStringHelper(this).add("startIp", startIp).add("endIp", endIp) 77 + return toStringHelper(this).add("startIp", startIp).add("endIp", endIp)
78 - .toString(); 78 + .toString();
79 - } 79 + }
80 -} 80 +}
81 - 81 +
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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.Objects; 20 +import java.util.Objects;
21 - 21 +
22 -import org.onlab.packet.IpAddress; 22 +import org.onlab.packet.IpAddress;
23 -import org.onlab.packet.IpPrefix; 23 +import org.onlab.packet.IpPrefix;
24 - 24 +
25 -/** 25 +/**
26 - * Host route dictionaries for the subnet. 26 + * Host route dictionaries for the subnet.
27 - */ 27 + */
28 -public final class DefaultHostRoute implements HostRoute { 28 +public final class DefaultHostRoute implements HostRoute {
29 - 29 +
30 - private final IpAddress nexthop; 30 + private final IpAddress nexthop;
31 - private final IpPrefix destination; 31 + private final IpPrefix destination;
32 - 32 +
33 - /** 33 + /**
34 - * 34 + *
35 - * Creates a DefaultHostRoute by using the next hop and the destination. 35 + * Creates a DefaultHostRoute by using the next hop and the destination.
36 - * 36 + *
37 - * @param nexthop of the DefaultHostRoute 37 + * @param nexthop of the DefaultHostRoute
38 - * @param destination of the DefaultHostRoute 38 + * @param destination of the DefaultHostRoute
39 - */ 39 + */
40 - public DefaultHostRoute(IpAddress nexthop, IpPrefix destination) { 40 + public DefaultHostRoute(IpAddress nexthop, IpPrefix destination) {
41 - this.nexthop = nexthop; 41 + this.nexthop = nexthop;
42 - this.destination = destination; 42 + this.destination = destination;
43 - } 43 + }
44 - 44 +
45 - @Override 45 + @Override
46 - public IpAddress nexthop() { 46 + public IpAddress nexthop() {
47 - return nexthop; 47 + return nexthop;
48 - } 48 + }
49 - 49 +
50 - @Override 50 + @Override
51 - public IpPrefix destination() { 51 + public IpPrefix destination() {
52 - return destination; 52 + return destination;
53 - } 53 + }
54 - 54 +
55 - @Override 55 + @Override
56 - public String toString() { 56 + public String toString() {
57 - return toStringHelper(this).add("nexthop", nexthop) 57 + return toStringHelper(this).add("nexthop", nexthop)
58 - .add("destination", destination).toString(); 58 + .add("destination", destination).toString();
59 - } 59 + }
60 - 60 +
61 - @Override 61 + @Override
62 - public int hashCode() { 62 + public int hashCode() {
63 - return Objects.hash(nexthop, destination); 63 + return Objects.hash(nexthop, destination);
64 - } 64 + }
65 - 65 +
66 - @Override 66 + @Override
67 - public boolean equals(Object obj) { 67 + public boolean equals(Object obj) {
68 - if (this == obj) { 68 + if (this == obj) {
69 - return true; 69 + return true;
70 - } 70 + }
71 - if (obj instanceof DefaultHostRoute) { 71 + if (obj instanceof DefaultHostRoute) {
72 - final DefaultHostRoute other = (DefaultHostRoute) obj; 72 + final DefaultHostRoute other = (DefaultHostRoute) obj;
73 - return Objects.equals(this.nexthop, other.nexthop) 73 + return Objects.equals(this.nexthop, other.nexthop)
74 - && Objects.equals(this.destination, other.destination); 74 + && Objects.equals(this.destination, other.destination);
75 - } 75 + }
76 - return false; 76 + return false;
77 - } 77 + }
78 - 78 +
79 -} 79 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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.Objects; 20 +import java.util.Objects;
21 -import java.util.Set; 21 +import java.util.Set;
22 - 22 +
23 -import org.onlab.packet.IpAddress; 23 +import org.onlab.packet.IpAddress;
24 -import org.onlab.packet.IpAddress.Version; 24 +import org.onlab.packet.IpAddress.Version;
25 -import org.onlab.packet.IpPrefix; 25 +import org.onlab.packet.IpPrefix;
26 - 26 +
27 -/** 27 +/**
28 - * Default implementation of Subnet interface . 28 + * Default implementation of Subnet interface .
29 - */ 29 + */
30 -public final class DefaultSubnet implements Subnet { 30 +public final class DefaultSubnet implements Subnet {
31 - private final SubnetId id; 31 + private final SubnetId id;
32 - private final String subnetName; 32 + private final String subnetName;
33 - private final TenantNetworkId networkId; 33 + private final TenantNetworkId networkId;
34 - private final TenantId tenantId; 34 + private final TenantId tenantId;
35 - private final Version ipVersion; 35 + private final Version ipVersion;
36 - private final IpPrefix cidr; 36 + private final IpPrefix cidr;
37 - private final IpAddress gatewayIp; 37 + private final IpAddress gatewayIp;
38 - private final boolean dhcpEnabled; 38 + private final boolean dhcpEnabled;
39 - private final boolean shared; 39 + private final boolean shared;
40 - private final Mode ipV6AddressMode; 40 + private final Mode ipV6AddressMode;
41 - private final Mode ipV6RaMode; 41 + private final Mode ipV6RaMode;
42 - private final Set<HostRoute> hostRoutes; 42 + private final Set<HostRoute> hostRoutes;
43 - private final Set<AllocationPool> allocationPools; 43 + private final Set<AllocationPool> allocationPools;
44 - 44 +
45 - /** 45 + /**
46 - * Creates a subnet object. 46 + * Creates a subnet object.
47 - * 47 + *
48 - * @param id subnet identifier 48 + * @param id subnet identifier
49 - * @param subnetName the name of subnet 49 + * @param subnetName the name of subnet
50 - * @param networkId network identifier 50 + * @param networkId network identifier
51 - * @param tenantId tenant identifier 51 + * @param tenantId tenant identifier
52 - * @param ipVersion Version of ipv4 or ipv6 52 + * @param ipVersion Version of ipv4 or ipv6
53 - * @param cidr the cidr 53 + * @param cidr the cidr
54 - * @param gatewayIp gateway ip 54 + * @param gatewayIp gateway ip
55 - * @param dhcpEnabled dhcp enabled or not 55 + * @param dhcpEnabled dhcp enabled or not
56 - * @param shared indicates whether this network is shared across all 56 + * @param shared indicates whether this network is shared across all
57 - * tenants, By default, only administrative user can change this 57 + * tenants, By default, only administrative user can change this
58 - * value 58 + * value
59 - * @param hostRoutes a collection of host routes 59 + * @param hostRoutes a collection of host routes
60 - * @param ipV6AddressMode ipV6AddressMode 60 + * @param ipV6AddressMode ipV6AddressMode
61 - * @param ipV6RaMode ipV6RaMode 61 + * @param ipV6RaMode ipV6RaMode
62 - * @param allocationPoolsIt a collection of allocationPools 62 + * @param allocationPoolsIt a collection of allocationPools
63 - */ 63 + */
64 - public DefaultSubnet(SubnetId id, String subnetName, 64 + public DefaultSubnet(SubnetId id, String subnetName,
65 - TenantNetworkId networkId, TenantId tenantId, 65 + TenantNetworkId networkId, TenantId tenantId,
66 - Version ipVersion, IpPrefix cidr, IpAddress gatewayIp, 66 + Version ipVersion, IpPrefix cidr, IpAddress gatewayIp,
67 - boolean dhcpEnabled, boolean shared, 67 + boolean dhcpEnabled, boolean shared,
68 - Set<HostRoute> hostRoutes, Mode ipV6AddressMode, 68 + Set<HostRoute> hostRoutes, Mode ipV6AddressMode,
69 - Mode ipV6RaMode, 69 + Mode ipV6RaMode,
70 - Set<AllocationPool> allocationPoolsIt) { 70 + Set<AllocationPool> allocationPoolsIt) {
71 - this.id = id; 71 + this.id = id;
72 - this.subnetName = subnetName; 72 + this.subnetName = subnetName;
73 - this.networkId = networkId; 73 + this.networkId = networkId;
74 - this.tenantId = tenantId; 74 + this.tenantId = tenantId;
75 - this.ipVersion = ipVersion; 75 + this.ipVersion = ipVersion;
76 - this.cidr = cidr; 76 + this.cidr = cidr;
77 - this.gatewayIp = gatewayIp; 77 + this.gatewayIp = gatewayIp;
78 - this.dhcpEnabled = dhcpEnabled; 78 + this.dhcpEnabled = dhcpEnabled;
79 - this.shared = shared; 79 + this.shared = shared;
80 - this.ipV6AddressMode = ipV6AddressMode; 80 + this.ipV6AddressMode = ipV6AddressMode;
81 - this.ipV6RaMode = ipV6RaMode; 81 + this.ipV6RaMode = ipV6RaMode;
82 - this.hostRoutes = hostRoutes; 82 + this.hostRoutes = hostRoutes;
83 - this.allocationPools = allocationPoolsIt; 83 + this.allocationPools = allocationPoolsIt;
84 - } 84 + }
85 - 85 +
86 - @Override 86 + @Override
87 - public SubnetId id() { 87 + public SubnetId id() {
88 - return id; 88 + return id;
89 - } 89 + }
90 - 90 +
91 - @Override 91 + @Override
92 - public String subnetName() { 92 + public String subnetName() {
93 - return subnetName; 93 + return subnetName;
94 - } 94 + }
95 - 95 +
96 - @Override 96 + @Override
97 - public TenantNetworkId networkId() { 97 + public TenantNetworkId networkId() {
98 - return networkId; 98 + return networkId;
99 - } 99 + }
100 - 100 +
101 - @Override 101 + @Override
102 - public TenantId tenantId() { 102 + public TenantId tenantId() {
103 - return tenantId; 103 + return tenantId;
104 - } 104 + }
105 - 105 +
106 - @Override 106 + @Override
107 - public Version ipVersion() { 107 + public Version ipVersion() {
108 - return ipVersion; 108 + return ipVersion;
109 - } 109 + }
110 - 110 +
111 - @Override 111 + @Override
112 - public IpPrefix cidr() { 112 + public IpPrefix cidr() {
113 - return cidr; 113 + return cidr;
114 - } 114 + }
115 - 115 +
116 - @Override 116 + @Override
117 - public IpAddress gatewayIp() { 117 + public IpAddress gatewayIp() {
118 - return gatewayIp; 118 + return gatewayIp;
119 - } 119 + }
120 - 120 +
121 - @Override 121 + @Override
122 - public boolean dhcpEnabled() { 122 + public boolean dhcpEnabled() {
123 - return dhcpEnabled; 123 + return dhcpEnabled;
124 - } 124 + }
125 - 125 +
126 - @Override 126 + @Override
127 - public boolean shared() { 127 + public boolean shared() {
128 - return shared; 128 + return shared;
129 - } 129 + }
130 - 130 +
131 - @Override 131 + @Override
132 - public Iterable<HostRoute> hostRoutes() { 132 + public Iterable<HostRoute> hostRoutes() {
133 - return hostRoutes; 133 + return hostRoutes;
134 - } 134 + }
135 - 135 +
136 - @Override 136 + @Override
137 - public Mode ipV6AddressMode() { 137 + public Mode ipV6AddressMode() {
138 - return ipV6AddressMode; 138 + return ipV6AddressMode;
139 - } 139 + }
140 - 140 +
141 - @Override 141 + @Override
142 - public Mode ipV6RaMode() { 142 + public Mode ipV6RaMode() {
143 - return ipV6RaMode; 143 + return ipV6RaMode;
144 - } 144 + }
145 - 145 +
146 - @Override 146 + @Override
147 - public Iterable<AllocationPool> allocationPools() { 147 + public Iterable<AllocationPool> allocationPools() {
148 - return allocationPools; 148 + return allocationPools;
149 - } 149 + }
150 - 150 +
151 - @Override 151 + @Override
152 - public int hashCode() { 152 + public int hashCode() {
153 - return Objects.hash(id, subnetName, ipVersion, cidr, gatewayIp, 153 + return Objects.hash(id, subnetName, ipVersion, cidr, gatewayIp,
154 - dhcpEnabled, shared, tenantId); 154 + dhcpEnabled, shared, tenantId);
155 - } 155 + }
156 - 156 +
157 - @Override 157 + @Override
158 - public boolean equals(Object obj) { 158 + public boolean equals(Object obj) {
159 - if (this == obj) { 159 + if (this == obj) {
160 - return true; 160 + return true;
161 - } 161 + }
162 - if (obj instanceof DefaultSubnet) { 162 + if (obj instanceof DefaultSubnet) {
163 - final DefaultSubnet that = (DefaultSubnet) obj; 163 + final DefaultSubnet that = (DefaultSubnet) obj;
164 - return Objects.equals(this.id, that.id) 164 + return Objects.equals(this.id, that.id)
165 - && Objects.equals(this.subnetName, that.subnetName) 165 + && Objects.equals(this.subnetName, that.subnetName)
166 - && Objects.equals(this.ipVersion, that.ipVersion) 166 + && Objects.equals(this.ipVersion, that.ipVersion)
167 - && Objects.equals(this.cidr, that.cidr) 167 + && Objects.equals(this.cidr, that.cidr)
168 - && Objects.equals(this.shared, that.shared) 168 + && Objects.equals(this.shared, that.shared)
169 - && Objects.equals(this.gatewayIp, that.gatewayIp) 169 + && Objects.equals(this.gatewayIp, that.gatewayIp)
170 - && Objects.equals(this.dhcpEnabled, that.dhcpEnabled); 170 + && Objects.equals(this.dhcpEnabled, that.dhcpEnabled);
171 - } 171 + }
172 - return false; 172 + return false;
173 - } 173 + }
174 - 174 +
175 - @Override 175 + @Override
176 - public String toString() { 176 + public String toString() {
177 - return toStringHelper(this).add("id", id).add("subnetName", subnetName) 177 + return toStringHelper(this).add("id", id).add("subnetName", subnetName)
178 - .add("ipVersion", ipVersion).add("cidr", cidr) 178 + .add("ipVersion", ipVersion).add("cidr", cidr)
179 - .add("shared", shared).add("gatewayIp", gatewayIp) 179 + .add("shared", shared).add("gatewayIp", gatewayIp)
180 - .add("dhcpEnabled", dhcpEnabled).toString(); 180 + .add("dhcpEnabled", dhcpEnabled).toString();
181 - } 181 + }
182 - 182 +
183 -} 183 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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.Objects; 20 +import java.util.Objects;
21 - 21 +
22 -/** 22 +/**
23 - * Default implementation of TenantNetwork interface. 23 + * Default implementation of TenantNetwork interface.
24 - */ 24 + */
25 -public final class DefaultTenantNetwork implements TenantNetwork { 25 +public final class DefaultTenantNetwork implements TenantNetwork {
26 - private final TenantNetworkId id; 26 + private final TenantNetworkId id;
27 - private final String name; 27 + private final String name;
28 - private final boolean adminStateUp; 28 + private final boolean adminStateUp;
29 - private final State state; 29 + private final State state;
30 - private final boolean shared; 30 + private final boolean shared;
31 - private final Type type; 31 + private final Type type;
32 - private final TenantId tenantId; 32 + private final TenantId tenantId;
33 - private final boolean routerExternal; 33 + private final boolean routerExternal;
34 - private final PhysicalNetwork physicalNetwork; 34 + private final PhysicalNetwork physicalNetwork;
35 - private final SegmentationId segmentationId; 35 + private final SegmentationId segmentationId;
36 - 36 +
37 - /** 37 + /**
38 - * Creates a neutronNetwork element attributed to the specified provider. 38 + * Creates a neutronNetwork element attributed to the specified provider.
39 - * 39 + *
40 - * @param id network identifier 40 + * @param id network identifier
41 - * @param name the network name 41 + * @param name the network name
42 - * @param adminStateUp administrative state of the network 42 + * @param adminStateUp administrative state of the network
43 - * @param state the network state 43 + * @param state the network state
44 - * @param shared indicates whether this network is shared across all 44 + * @param shared indicates whether this network is shared across all
45 - * tenants, By default, only administrative user can change this 45 + * tenants, By default, only administrative user can change this
46 - * value 46 + * value
47 - * @param tenantId tenant identifier 47 + * @param tenantId tenant identifier
48 - * @param routerExternal network routerExternal 48 + * @param routerExternal network routerExternal
49 - * @param type the network type 49 + * @param type the network type
50 - * @param physicalNetwork physicalNetwork identifier 50 + * @param physicalNetwork physicalNetwork identifier
51 - * @param segmentationId segmentation identifier 51 + * @param segmentationId segmentation identifier
52 - */ 52 + */
53 - public DefaultTenantNetwork(TenantNetworkId id, String name, 53 + public DefaultTenantNetwork(TenantNetworkId id, String name,
54 - boolean adminStateUp, State state, 54 + boolean adminStateUp, State state,
55 - boolean shared, TenantId tenantId, 55 + boolean shared, TenantId tenantId,
56 - boolean routerExternal, Type type, 56 + boolean routerExternal, Type type,
57 - PhysicalNetwork physicalNetwork, 57 + PhysicalNetwork physicalNetwork,
58 - SegmentationId segmentationId) { 58 + SegmentationId segmentationId) {
59 - this.id = id; 59 + this.id = id;
60 - this.name = name; 60 + this.name = name;
61 - this.adminStateUp = adminStateUp; 61 + this.adminStateUp = adminStateUp;
62 - this.state = state; 62 + this.state = state;
63 - this.shared = shared; 63 + this.shared = shared;
64 - this.type = type; 64 + this.type = type;
65 - this.tenantId = tenantId; 65 + this.tenantId = tenantId;
66 - this.routerExternal = routerExternal; 66 + this.routerExternal = routerExternal;
67 - this.physicalNetwork = physicalNetwork; 67 + this.physicalNetwork = physicalNetwork;
68 - this.segmentationId = segmentationId; 68 + this.segmentationId = segmentationId;
69 - } 69 + }
70 - 70 +
71 - @Override 71 + @Override
72 - public TenantNetworkId id() { 72 + public TenantNetworkId id() {
73 - return id; 73 + return id;
74 - } 74 + }
75 - 75 +
76 - @Override 76 + @Override
77 - public String name() { 77 + public String name() {
78 - return name; 78 + return name;
79 - } 79 + }
80 - 80 +
81 - @Override 81 + @Override
82 - public boolean adminStateUp() { 82 + public boolean adminStateUp() {
83 - return adminStateUp; 83 + return adminStateUp;
84 - } 84 + }
85 - 85 +
86 - @Override 86 + @Override
87 - public State state() { 87 + public State state() {
88 - return state; 88 + return state;
89 - } 89 + }
90 - 90 +
91 - @Override 91 + @Override
92 - public boolean shared() { 92 + public boolean shared() {
93 - return shared; 93 + return shared;
94 - } 94 + }
95 - 95 +
96 - @Override 96 + @Override
97 - public TenantId tenantId() { 97 + public TenantId tenantId() {
98 - return tenantId; 98 + return tenantId;
99 - } 99 + }
100 - 100 +
101 - @Override 101 + @Override
102 - public boolean routerExternal() { 102 + public boolean routerExternal() {
103 - return routerExternal; 103 + return routerExternal;
104 - } 104 + }
105 - 105 +
106 - @Override 106 + @Override
107 - public Type type() { 107 + public Type type() {
108 - return type; 108 + return type;
109 - } 109 + }
110 - 110 +
111 - @Override 111 + @Override
112 - public PhysicalNetwork physicalNetwork() { 112 + public PhysicalNetwork physicalNetwork() {
113 - return physicalNetwork; 113 + return physicalNetwork;
114 - } 114 + }
115 - 115 +
116 - @Override 116 + @Override
117 - public SegmentationId segmentationId() { 117 + public SegmentationId segmentationId() {
118 - return segmentationId; 118 + return segmentationId;
119 - } 119 + }
120 - 120 +
121 - @Override 121 + @Override
122 - public int hashCode() { 122 + public int hashCode() {
123 - return Objects.hash(id, name, adminStateUp, state, shared, tenantId, 123 + return Objects.hash(id, name, adminStateUp, state, shared, tenantId,
124 - routerExternal, type, physicalNetwork, 124 + routerExternal, type, physicalNetwork,
125 - segmentationId); 125 + segmentationId);
126 - } 126 + }
127 - 127 +
128 - @Override 128 + @Override
129 - public boolean equals(Object obj) { 129 + public boolean equals(Object obj) {
130 - if (this == obj) { 130 + if (this == obj) {
131 - return true; 131 + return true;
132 - } 132 + }
133 - if (obj instanceof DefaultTenantNetwork) { 133 + if (obj instanceof DefaultTenantNetwork) {
134 - final DefaultTenantNetwork that = (DefaultTenantNetwork) obj; 134 + final DefaultTenantNetwork that = (DefaultTenantNetwork) obj;
135 - return Objects.equals(this.id, that.id) 135 + return Objects.equals(this.id, that.id)
136 - && Objects.equals(this.name, that.name) 136 + && Objects.equals(this.name, that.name)
137 - && Objects.equals(this.adminStateUp, that.adminStateUp) 137 + && Objects.equals(this.adminStateUp, that.adminStateUp)
138 - && Objects.equals(this.state, that.state) 138 + && Objects.equals(this.state, that.state)
139 - && Objects.equals(this.shared, that.shared) 139 + && Objects.equals(this.shared, that.shared)
140 - && Objects.equals(this.tenantId, that.tenantId) 140 + && Objects.equals(this.tenantId, that.tenantId)
141 - && Objects.equals(this.routerExternal, that.routerExternal) 141 + && Objects.equals(this.routerExternal, that.routerExternal)
142 - && Objects.equals(this.type, that.type) 142 + && Objects.equals(this.type, that.type)
143 - && Objects.equals(this.physicalNetwork, 143 + && Objects.equals(this.physicalNetwork,
144 - that.physicalNetwork) 144 + that.physicalNetwork)
145 - && Objects.equals(this.segmentationId, that.segmentationId); 145 + && Objects.equals(this.segmentationId, that.segmentationId);
146 - } 146 + }
147 - return false; 147 + return false;
148 - } 148 + }
149 - 149 +
150 - @Override 150 + @Override
151 - public String toString() { 151 + public String toString() {
152 - return toStringHelper(this).add("id", id).add("name", name) 152 + return toStringHelper(this).add("id", id).add("name", name)
153 - .add("adminStateUp", adminStateUp).add("state", state) 153 + .add("adminStateUp", adminStateUp).add("state", state)
154 - .add("shared", shared).add("tenantId", tenantId) 154 + .add("shared", shared).add("tenantId", tenantId)
155 - .add("routeExternal", routerExternal).add("type", type) 155 + .add("routeExternal", routerExternal).add("type", type)
156 - .add("physicalNetwork", physicalNetwork) 156 + .add("physicalNetwork", physicalNetwork)
157 - .add("segmentationId", segmentationId).toString(); 157 + .add("segmentationId", segmentationId).toString();
158 - } 158 + }
159 - 159 +
160 -} 160 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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 +import java.util.Set;
24 - 24 +
25 -import org.onlab.packet.MacAddress; 25 +import org.onlab.packet.MacAddress;
26 -import org.onosproject.net.DeviceId; 26 +import org.onosproject.net.DeviceId;
27 - 27 +
28 -/** 28 +/**
29 - * Default implementation of VirtualPort interface . 29 + * Default implementation of VirtualPort interface .
30 - */ 30 + */
31 -public final class DefaultVirtualPort implements VirtualPort { 31 +public final class DefaultVirtualPort implements VirtualPort {
32 - private final VirtualPortId id; 32 + private final VirtualPortId id;
33 - private final TenantNetworkId networkId; 33 + private final TenantNetworkId networkId;
34 - private final Boolean adminStateUp; 34 + private final Boolean adminStateUp;
35 - private final String name; 35 + private final String name;
36 - private final State state; 36 + private final State state;
37 - private final MacAddress macAddress; 37 + private final MacAddress macAddress;
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 Set<FixedIp> fixedIps; 41 + private final Set<FixedIp> fixedIps;
42 - private final BindingHostId 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;
46 - private final Set<AllowedAddressPair> allowedAddressPairs; 46 + private final Set<AllowedAddressPair> allowedAddressPairs;
47 - private final Set<SecurityGroup> securityGroups; 47 + private final Set<SecurityGroup> securityGroups;
48 - 48 +
49 - /** 49 + /**
50 - * Creates a VirtualPort object. 50 + * Creates a VirtualPort object.
51 - * 51 + *
52 - * @param id the virtual port identifier 52 + * @param id the virtual port identifier
53 - * @param networkId the network identifier 53 + * @param networkId the network identifier
54 - * @param adminStateUp adminStateup true or false 54 + * @param adminStateUp adminStateup true or false
55 - * @param strMap the map of properties of virtual port 55 + * @param strMap the map of properties of virtual port
56 - * @param state virtual port state 56 + * @param state virtual port state
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 fixedIps set of 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
64 - */ 64 + */
65 - public DefaultVirtualPort(VirtualPortId id, 65 + public DefaultVirtualPort(VirtualPortId id,
66 - TenantNetworkId networkId, 66 + TenantNetworkId networkId,
67 - Boolean adminStateUp, 67 + Boolean adminStateUp,
68 - Map<String, String> strMap, 68 + Map<String, String> strMap,
69 - State state, 69 + State state,
70 - MacAddress macAddress, 70 + MacAddress macAddress,
71 - TenantId tenantId, 71 + TenantId tenantId,
72 - DeviceId deviceId, 72 + DeviceId deviceId,
73 - Set<FixedIp> fixedIps, 73 + Set<FixedIp> fixedIps,
74 - BindingHostId bindingHostId, 74 + BindingHostId bindingHostId,
75 - Set<AllowedAddressPair> allowedAddressPairs, 75 + Set<AllowedAddressPair> allowedAddressPairs,
76 - Set<SecurityGroup> securityGroups) { 76 + Set<SecurityGroup> securityGroups) {
77 - this.id = id; 77 + this.id = id;
78 - this.networkId = networkId; 78 + this.networkId = networkId;
79 - this.adminStateUp = adminStateUp; 79 + this.adminStateUp = adminStateUp;
80 - this.name = strMap.get("name"); 80 + this.name = strMap.get("name");
81 - this.state = state; 81 + this.state = state;
82 - this.macAddress = macAddress; 82 + this.macAddress = macAddress;
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.fixedIps = fixedIps; 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");
90 - this.bindingVifDetails = strMap.get("bindingVifDetails"); 90 + this.bindingVifDetails = strMap.get("bindingVifDetails");
91 - this.allowedAddressPairs = allowedAddressPairs; 91 + this.allowedAddressPairs = allowedAddressPairs;
92 - this.securityGroups = securityGroups; 92 + this.securityGroups = securityGroups;
93 - } 93 + }
94 - 94 +
95 - @Override 95 + @Override
96 - public VirtualPortId portId() { 96 + public VirtualPortId portId() {
97 - return id; 97 + return id;
98 - } 98 + }
99 - 99 +
100 - @Override 100 + @Override
101 - public TenantNetworkId networkId() { 101 + public TenantNetworkId networkId() {
102 - return networkId; 102 + return networkId;
103 - } 103 + }
104 - 104 +
105 - @Override 105 + @Override
106 - public String name() { 106 + public String name() {
107 - return name; 107 + return name;
108 - } 108 + }
109 - 109 +
110 - @Override 110 + @Override
111 - public boolean adminStateUp() { 111 + public boolean adminStateUp() {
112 - return adminStateUp; 112 + return adminStateUp;
113 - } 113 + }
114 - 114 +
115 - @Override 115 + @Override
116 - public State state() { 116 + public State state() {
117 - return state; 117 + return state;
118 - } 118 + }
119 - 119 +
120 - @Override 120 + @Override
121 - public MacAddress macAddress() { 121 + public MacAddress macAddress() {
122 - return macAddress; 122 + return macAddress;
123 - } 123 + }
124 - 124 +
125 - @Override 125 + @Override
126 - public TenantId tenantId() { 126 + public TenantId tenantId() {
127 - return tenantId; 127 + return tenantId;
128 - } 128 + }
129 - 129 +
130 - @Override 130 + @Override
131 - public DeviceId deviceId() { 131 + public DeviceId deviceId() {
132 - return deviceId; 132 + return deviceId;
133 - } 133 + }
134 - 134 +
135 - @Override 135 + @Override
136 - public String deviceOwner() { 136 + public String deviceOwner() {
137 - return deviceOwner; 137 + return deviceOwner;
138 - } 138 + }
139 - 139 +
140 - @Override 140 + @Override
141 - public Collection<AllowedAddressPair> allowedAddressPairs() { 141 + public Collection<AllowedAddressPair> allowedAddressPairs() {
142 - return allowedAddressPairs; 142 + return allowedAddressPairs;
143 - } 143 + }
144 - 144 +
145 - @Override 145 + @Override
146 - public Set<FixedIp> fixedIps() { 146 + public Set<FixedIp> fixedIps() {
147 - return fixedIps; 147 + return fixedIps;
148 - } 148 + }
149 - 149 +
150 - @Override 150 + @Override
151 - public BindingHostId bindingHostId() { 151 + public BindingHostId bindingHostId() {
152 - return bindingHostId; 152 + return bindingHostId;
153 - } 153 + }
154 - 154 +
155 - @Override 155 + @Override
156 - public String bindingVnicType() { 156 + public String bindingVnicType() {
157 - return bindingVifType; 157 + return bindingVifType;
158 - } 158 + }
159 - 159 +
160 - @Override 160 + @Override
161 - public String bindingVifType() { 161 + public String bindingVifType() {
162 - return bindingVifType; 162 + return bindingVifType;
163 - } 163 + }
164 - 164 +
165 - @Override 165 + @Override
166 - public String bindingVifDetails() { 166 + public String bindingVifDetails() {
167 - return bindingVifDetails; 167 + return bindingVifDetails;
168 - } 168 + }
169 - 169 +
170 - @Override 170 + @Override
171 - public Collection<SecurityGroup> securityGroups() { 171 + public Collection<SecurityGroup> securityGroups() {
172 - return securityGroups; 172 + return securityGroups;
173 - } 173 + }
174 - 174 +
175 - @Override 175 + @Override
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, fixedIps, bindingHostId, 179 + allowedAddressPairs, fixedIps, bindingHostId,
180 - bindingVnicType, bindingVifType, bindingVifDetails, 180 + bindingVnicType, bindingVifType, bindingVifDetails,
181 - securityGroups); 181 + securityGroups);
182 - } 182 + }
183 - 183 +
184 - @Override 184 + @Override
185 - public boolean equals(Object obj) { 185 + public boolean equals(Object obj) {
186 - if (this == obj) { 186 + if (this == obj) {
187 - return true; 187 + return true;
188 - } 188 + }
189 - if (obj instanceof DefaultVirtualPort) { 189 + if (obj instanceof DefaultVirtualPort) {
190 - final DefaultVirtualPort that = (DefaultVirtualPort) obj; 190 + final DefaultVirtualPort that = (DefaultVirtualPort) obj;
191 - return Objects.equals(this.id, that.id) 191 + return Objects.equals(this.id, that.id)
192 - && Objects.equals(this.networkId, that.networkId) 192 + && Objects.equals(this.networkId, that.networkId)
193 - && Objects.equals(this.adminStateUp, that.adminStateUp) 193 + && Objects.equals(this.adminStateUp, that.adminStateUp)
194 - && Objects.equals(this.state, that.state) 194 + && Objects.equals(this.state, that.state)
195 - && Objects.equals(this.name, that.name) 195 + && Objects.equals(this.name, that.name)
196 - && Objects.equals(this.tenantId, that.tenantId) 196 + && Objects.equals(this.tenantId, that.tenantId)
197 - && Objects.equals(this.macAddress, that.macAddress) 197 + && Objects.equals(this.macAddress, that.macAddress)
198 - && Objects.equals(this.deviceId, that.deviceId) 198 + && Objects.equals(this.deviceId, that.deviceId)
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.fixedIps, that.fixedIps) 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)
206 - && Objects.equals(this.bindingVifType, that.bindingVifType) 206 + && Objects.equals(this.bindingVifType, that.bindingVifType)
207 - && Objects.equals(this.bindingVnicType, 207 + && Objects.equals(this.bindingVnicType,
208 - that.bindingVnicType) 208 + that.bindingVnicType)
209 - && Objects.equals(this.securityGroups, that.securityGroups); 209 + && Objects.equals(this.securityGroups, that.securityGroups);
210 - } 210 + }
211 - return false; 211 + return false;
212 - } 212 + }
213 - 213 +
214 - @Override 214 + @Override
215 - public String toString() { 215 + public String toString() {
216 - return toStringHelper(this).add("id", id).add("network_id", networkId) 216 + return toStringHelper(this).add("id", id).add("network_id", networkId)
217 - .add("adminStateUp", adminStateUp).add("state", state) 217 + .add("adminStateUp", adminStateUp).add("state", state)
218 - .add("name", name).add("state", state) 218 + .add("name", name).add("state", state)
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", fixedIps).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)
226 - .add("securityGroups", securityGroups).toString(); 226 + .add("securityGroups", securityGroups).toString();
227 - } 227 + }
228 - 228 +
229 -} 229 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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;
20 - 20 +
21 -import java.util.Objects; 21 +import java.util.Objects;
22 - 22 +
23 -import org.onlab.packet.IpAddress; 23 +import org.onlab.packet.IpAddress;
24 - 24 +
25 -/** 25 +/**
26 - * Immutable representation of a IP address for the port, Include the IP address 26 + * Immutable representation of a IP address for the port, Include the IP address
27 - * and subnet identity. 27 + * and subnet identity.
28 - */ 28 + */
29 -public final class FixedIp { 29 +public final class FixedIp {
30 - private final SubnetId subnetId; 30 + private final SubnetId subnetId;
31 - private final IpAddress ip; 31 + private final IpAddress ip;
32 - // Public construction is prohibited 32 + // Public construction is prohibited
33 - private FixedIp(SubnetId subnetId, IpAddress ip) { 33 + private FixedIp(SubnetId subnetId, IpAddress ip) {
34 - checkNotNull(subnetId, "SubnetId cannot be null"); 34 + checkNotNull(subnetId, "SubnetId cannot be null");
35 - checkNotNull(ip, "IpAddress cannot be null"); 35 + checkNotNull(ip, "IpAddress cannot be null");
36 - this.subnetId = subnetId; 36 + this.subnetId = subnetId;
37 - this.ip = ip; 37 + this.ip = ip;
38 - } 38 + }
39 - 39 +
40 - /** 40 + /**
41 - * Returns the FixedIp subnet identifier. 41 + * Returns the FixedIp subnet identifier.
42 - * 42 + *
43 - * @return subnet identifier 43 + * @return subnet identifier
44 - */ 44 + */
45 - public SubnetId subnetId() { 45 + public SubnetId subnetId() {
46 - return subnetId; 46 + return subnetId;
47 - } 47 + }
48 - 48 +
49 - /** 49 + /**
50 - * Returns the FixedIp IP address. 50 + * Returns the FixedIp IP address.
51 - * 51 + *
52 - * @return IP address 52 + * @return IP address
53 - */ 53 + */
54 - public IpAddress ip() { 54 + public IpAddress ip() {
55 - return ip; 55 + return ip;
56 - } 56 + }
57 - 57 +
58 - /** 58 + /**
59 - * Creates a fixed ip using the supplied fixedIp. 59 + * Creates a fixed ip using the supplied fixedIp.
60 - * 60 + *
61 - * @param subnetId subnet identity 61 + * @param subnetId subnet identity
62 - * @param ip IP address 62 + * @param ip IP address
63 - * @return FixedIp 63 + * @return FixedIp
64 - */ 64 + */
65 - public static FixedIp fixedIp(SubnetId subnetId, IpAddress ip) { 65 + public static FixedIp fixedIp(SubnetId subnetId, IpAddress ip) {
66 - return new FixedIp(subnetId, ip); 66 + return new FixedIp(subnetId, ip);
67 - } 67 + }
68 - 68 +
69 - @Override 69 + @Override
70 - public int hashCode() { 70 + public int hashCode() {
71 - return Objects.hash(subnetId, ip); 71 + return Objects.hash(subnetId, ip);
72 - } 72 + }
73 - 73 +
74 - @Override 74 + @Override
75 - public boolean equals(Object obj) { 75 + public boolean equals(Object obj) {
76 - if (this == obj) { 76 + if (this == obj) {
77 - return true; 77 + return true;
78 - } 78 + }
79 - if (obj instanceof FixedIp) { 79 + if (obj instanceof FixedIp) {
80 - final FixedIp that = (FixedIp) obj; 80 + final FixedIp that = (FixedIp) obj;
81 - return Objects.equals(this.subnetId, that.subnetId) 81 + return Objects.equals(this.subnetId, that.subnetId)
82 - && Objects.equals(this.ip, that.ip); 82 + && Objects.equals(this.ip, that.ip);
83 - } 83 + }
84 - return false; 84 + return false;
85 - } 85 + }
86 - 86 +
87 - @Override 87 + @Override
88 - public String toString() { 88 + public String toString() {
89 - return toStringHelper(this).add("subnetId", subnetId).add("ip", ip) 89 + return toStringHelper(this).add("subnetId", subnetId).add("ip", ip)
90 - .toString(); 90 + .toString();
91 - } 91 + }
92 - 92 +
93 -} 93 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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;
20 - 20 +
21 -/** 21 +/**
22 - * Host route dictionaries for the subnet. 22 + * Host route dictionaries for the subnet.
23 - */ 23 + */
24 -public interface HostRoute { 24 +public interface HostRoute {
25 - 25 +
26 - /** 26 + /**
27 - * Returns the next hop address. 27 + * Returns the next hop address.
28 - * 28 + *
29 - * @return next hop address 29 + * @return next hop address
30 - */ 30 + */
31 - IpAddress nexthop(); 31 + IpAddress nexthop();
32 - 32 +
33 - /** 33 + /**
34 - * Returns the destination address. 34 + * Returns the destination address.
35 - * 35 + *
36 - * @return destination address 36 + * @return destination address
37 - */ 37 + */
38 - IpPrefix destination(); 38 + IpPrefix destination();
39 -} 39 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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 physical network 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 PhysicalNetwork object. 36 + * Creates a PhysicalNetwork object.
37 - * 37 + *
38 - * @param physicalNetwork physical network 38 + * @param physicalNetwork physical network
39 - * @return physical network 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 + * Returns a physicalNetwork.
47 - * 47 + *
48 - * @return physical network 48 + * @return physical network
49 - */ 49 + */
50 - public String physicalNetwork() { 50 + public String physicalNetwork() {
51 - return physicalNetwork; 51 + return physicalNetwork;
52 - } 52 + }
53 - 53 +
54 - @Override 54 + @Override
55 - public int hashCode() { 55 + public int hashCode() {
56 - return Objects.hash(physicalNetwork); 56 + return Objects.hash(physicalNetwork);
57 - } 57 + }
58 - 58 +
59 - @Override 59 + @Override
60 - public boolean equals(Object obj) { 60 + public boolean equals(Object obj) {
61 - if (this == obj) { 61 + if (this == obj) {
62 - return true; 62 + return true;
63 - } 63 + }
64 - if (obj instanceof PhysicalNetwork) { 64 + if (obj instanceof PhysicalNetwork) {
65 - final PhysicalNetwork that = (PhysicalNetwork) obj; 65 + final PhysicalNetwork that = (PhysicalNetwork) obj;
66 - return this.getClass() == that.getClass() 66 + return this.getClass() == that.getClass()
67 - && Objects.equals(this.physicalNetwork, 67 + && Objects.equals(this.physicalNetwork,
68 - that.physicalNetwork); 68 + that.physicalNetwork);
69 - } 69 + }
70 - return false; 70 + return false;
71 - } 71 + }
72 - 72 +
73 - @Override 73 + @Override
74 - public String toString() { 74 + public String toString() {
75 - return physicalNetwork; 75 + return physicalNetwork;
76 - } 76 + }
77 - 77 +
78 -} 78 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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.MoreObjects.toStringHelper; 20 +import static com.google.common.base.MoreObjects.toStringHelper;
21 -import static com.google.common.base.Preconditions.checkNotNull; 21 +import static com.google.common.base.Preconditions.checkNotNull;
22 - 22 +
23 -/** 23 +/**
24 - * Immutable representation of a security group. 24 + * Immutable representation of a security group.
25 - */ 25 + */
26 -public final class SecurityGroup { 26 +public final class SecurityGroup {
27 - private final String securityGroup; 27 + private final String securityGroup;
28 - 28 +
29 - /** 29 + /**
30 - * Returns the securityGroup. 30 + * Returns the securityGroup.
31 - * 31 + *
32 - * @return securityGroup 32 + * @return securityGroup
33 - */ 33 + */
34 - public String securityGroup() { 34 + public String securityGroup() {
35 - return securityGroup; 35 + return securityGroup;
36 - } 36 + }
37 - // Public construction is prohibited 37 + // Public construction is prohibited
38 - private SecurityGroup(String securityGroup) { 38 + private SecurityGroup(String securityGroup) {
39 - checkNotNull(securityGroup, "SecurityGroup cannot be null"); 39 + checkNotNull(securityGroup, "SecurityGroup cannot be null");
40 - this.securityGroup = securityGroup; 40 + this.securityGroup = securityGroup;
41 - } 41 + }
42 - 42 +
43 - /** 43 + /**
44 - * Creates a securityGroup using the supplied securityGroup. 44 + * Creates a securityGroup using the supplied securityGroup.
45 - * 45 + *
46 - * @param securityGroup security group 46 + * @param securityGroup security group
47 - * @return securityGroup 47 + * @return securityGroup
48 - */ 48 + */
49 - public static SecurityGroup securityGroup(String securityGroup) { 49 + public static SecurityGroup securityGroup(String securityGroup) {
50 - return new SecurityGroup(securityGroup); 50 + return new SecurityGroup(securityGroup);
51 - } 51 + }
52 - 52 +
53 - @Override 53 + @Override
54 - public int hashCode() { 54 + public int hashCode() {
55 - return Objects.hash(securityGroup); 55 + return Objects.hash(securityGroup);
56 - } 56 + }
57 - 57 +
58 - @Override 58 + @Override
59 - public boolean equals(Object obj) { 59 + public boolean equals(Object obj) {
60 - if (this == obj) { 60 + if (this == obj) {
61 - return true; 61 + return true;
62 - } 62 + }
63 - if (obj instanceof SecurityGroup) { 63 + if (obj instanceof SecurityGroup) {
64 - final SecurityGroup that = (SecurityGroup) obj; 64 + final SecurityGroup that = (SecurityGroup) obj;
65 - return this.getClass() == that.getClass() 65 + return this.getClass() == that.getClass()
66 - && Objects.equals(this.securityGroup, that.securityGroup); 66 + && Objects.equals(this.securityGroup, that.securityGroup);
67 - } 67 + }
68 - return false; 68 + return false;
69 - } 69 + }
70 - 70 +
71 - @Override 71 + @Override
72 - public String toString() { 72 + public String toString() {
73 - return toStringHelper(this).add("securityGroup", securityGroup) 73 + return toStringHelper(this).add("securityGroup", securityGroup)
74 - .toString(); 74 + .toString();
75 - } 75 + }
76 - 76 +
77 -} 77 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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 Segmentation identifier. 23 + * Immutable representation of a Segmentation identifier.
24 - */ 24 + */
25 -public final class SegmentationId { 25 +public final class SegmentationId {
26 - 26 +
27 - private final String segmentationId; 27 + private final String segmentationId;
28 - 28 +
29 - // Public construction is prohibited 29 + // Public construction is prohibited
30 - private SegmentationId(String segmentationId) { 30 + private SegmentationId(String segmentationId) {
31 - checkNotNull(segmentationId, "SegmentationId cannot be null"); 31 + checkNotNull(segmentationId, "SegmentationId cannot be null");
32 - this.segmentationId = segmentationId; 32 + this.segmentationId = segmentationId;
33 - } 33 + }
34 - 34 +
35 - /** 35 + /**
36 - * Creates a SegmentationId object. 36 + * Creates a SegmentationId object.
37 - * 37 + *
38 - * @param segmentationId segmentation identifier 38 + * @param segmentationId segmentation identifier
39 - * @return SegmentationId 39 + * @return SegmentationId
40 - */ 40 + */
41 - public static SegmentationId segmentationId(String segmentationId) { 41 + public static SegmentationId segmentationId(String segmentationId) {
42 - return new SegmentationId(segmentationId); 42 + return new SegmentationId(segmentationId);
43 - } 43 + }
44 - 44 +
45 - /** 45 + /**
46 - * Returns the segmentation identifier. 46 + * Returns the segmentation identifier.
47 - * 47 + *
48 - * @return segmentationId 48 + * @return segmentationId
49 - */ 49 + */
50 - public String segmentationId() { 50 + public String segmentationId() {
51 - return segmentationId; 51 + return segmentationId;
52 - } 52 + }
53 - 53 +
54 - @Override 54 + @Override
55 - public int hashCode() { 55 + public int hashCode() {
56 - return Objects.hash(segmentationId); 56 + return Objects.hash(segmentationId);
57 - } 57 + }
58 - 58 +
59 - @Override 59 + @Override
60 - public boolean equals(Object obj) { 60 + public boolean equals(Object obj) {
61 - if (this == obj) { 61 + if (this == obj) {
62 - return true; 62 + return true;
63 - } 63 + }
64 - if (obj instanceof SegmentationId) { 64 + if (obj instanceof SegmentationId) {
65 - final SegmentationId that = (SegmentationId) obj; 65 + final SegmentationId that = (SegmentationId) obj;
66 - return this.getClass() == that.getClass() 66 + return this.getClass() == that.getClass()
67 - && Objects.equals(this.segmentationId, that.segmentationId); 67 + && Objects.equals(this.segmentationId, that.segmentationId);
68 - } 68 + }
69 - return false; 69 + return false;
70 - } 70 + }
71 - 71 +
72 - @Override 72 + @Override
73 - public String toString() { 73 + public String toString() {
74 - return segmentationId; 74 + return segmentationId;
75 - } 75 + }
76 - 76 +
77 -} 77 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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;
20 -import org.onlab.packet.IpPrefix; 20 +import org.onlab.packet.IpPrefix;
21 - 21 +
22 -/** 22 +/**
23 - * Representation of a subnet. 23 + * Representation of a subnet.
24 - */ 24 + */
25 -public interface Subnet { 25 +public interface Subnet {
26 - 26 +
27 - /** 27 + /**
28 - * Coarse classification of the type of the ipV6Mode. 28 + * Coarse classification of the type of the ipV6Mode.
29 - */ 29 + */
30 - public enum Mode { 30 + public enum Mode {
31 - DHCPV6_STATEFUL, DHCPV6_STATELESS, SLAAC 31 + DHCPV6_STATEFUL, DHCPV6_STATELESS, SLAAC
32 - } 32 + }
33 - 33 +
34 - /** 34 + /**
35 - * Returns the subnet identifier. 35 + * Returns the subnet identifier.
36 - * 36 + *
37 - * @return identifier 37 + * @return identifier
38 - */ 38 + */
39 - SubnetId id(); 39 + SubnetId id();
40 - 40 +
41 - /** 41 + /**
42 - * Returns the name of the subnet. 42 + * Returns the name of the subnet.
43 - * 43 + *
44 - * @return subnetName 44 + * @return subnetName
45 - */ 45 + */
46 - String subnetName(); 46 + String subnetName();
47 - 47 +
48 - /** 48 + /**
49 - * Returns the network identifier. 49 + * Returns the network identifier.
50 - * 50 + *
51 - * @return the network identifier 51 + * @return the network identifier
52 - */ 52 + */
53 - TenantNetworkId networkId(); 53 + TenantNetworkId networkId();
54 - 54 +
55 - /** 55 + /**
56 - * Returns tenant identifier. 56 + * Returns tenant identifier.
57 - * 57 + *
58 - * @return the tenant identifier 58 + * @return the tenant identifier
59 - */ 59 + */
60 - TenantId tenantId(); 60 + TenantId tenantId();
61 - 61 +
62 - /** 62 + /**
63 - * Returns the IP version, which is 4 or 6. 63 + * Returns the IP version, which is 4 or 6.
64 - * 64 + *
65 - * @return ipVersion 65 + * @return ipVersion
66 - */ 66 + */
67 - Version ipVersion(); 67 + Version ipVersion();
68 - 68 +
69 - /** 69 + /**
70 - * Returns the cidr. 70 + * Returns the cidr.
71 - * 71 + *
72 - * @return cidr 72 + * @return cidr
73 - */ 73 + */
74 - IpPrefix cidr(); 74 + IpPrefix cidr();
75 - 75 +
76 - /** 76 + /**
77 - * Returns the gateway IP address. 77 + * Returns the gateway IP address.
78 - * 78 + *
79 - * @return gatewayIp 79 + * @return gatewayIp
80 - */ 80 + */
81 - IpAddress gatewayIp(); 81 + IpAddress gatewayIp();
82 - 82 +
83 - /** 83 + /**
84 - * Returns true if DHCP is enabled and return false if DHCP is disabled. 84 + * Returns true if DHCP is enabled and return false if DHCP is disabled.
85 - * 85 + *
86 - * @return true or false 86 + * @return true or false
87 - */ 87 + */
88 - boolean dhcpEnabled(); 88 + boolean dhcpEnabled();
89 - 89 +
90 - /** 90 + /**
91 - * Indicates whether this tenantNetwork is shared across all tenants. By 91 + * Indicates whether this tenantNetwork is shared across all tenants. By
92 - * default, only administrative user can change this value. 92 + * default, only administrative user can change this value.
93 - * 93 + *
94 - * @return true or false 94 + * @return true or false
95 - */ 95 + */
96 - boolean shared(); 96 + boolean shared();
97 - 97 +
98 - /** 98 + /**
99 - * Returns a collection of hostRoutes. 99 + * Returns a collection of hostRoutes.
100 - * 100 + *
101 - * @return a collection of hostRoutes 101 + * @return a collection of hostRoutes
102 - */ 102 + */
103 - Iterable<HostRoute> hostRoutes(); 103 + Iterable<HostRoute> hostRoutes();
104 - 104 +
105 - /** 105 + /**
106 - * Returns the ipV6AddressMode. A valid value is dhcpv6-stateful, 106 + * Returns the ipV6AddressMode. A valid value is dhcpv6-stateful,
107 - * dhcpv6-stateless, or slaac. 107 + * dhcpv6-stateless, or slaac.
108 - * 108 + *
109 - * @return ipV6AddressMode whose value is dhcpv6-stateful, dhcpv6-stateless 109 + * @return ipV6AddressMode whose value is dhcpv6-stateful, dhcpv6-stateless
110 - * or slaac 110 + * or slaac
111 - */ 111 + */
112 - Mode ipV6AddressMode(); 112 + Mode ipV6AddressMode();
113 - 113 +
114 - /** 114 + /**
115 - * Returns the ipV6RaMode.A valid value is dhcpv6-stateful, 115 + * Returns the ipV6RaMode.A valid value is dhcpv6-stateful,
116 - * dhcpv6-stateless, or slaac. 116 + * dhcpv6-stateless, or slaac.
117 - * 117 + *
118 - * @return ipV6RaMode whose value is dhcpv6-stateful, dhcpv6-stateless or 118 + * @return ipV6RaMode whose value is dhcpv6-stateful, dhcpv6-stateless or
119 - * slaac 119 + * slaac
120 - */ 120 + */
121 - Mode ipV6RaMode(); 121 + Mode ipV6RaMode();
122 - 122 +
123 - /** 123 + /**
124 - * Returns a collection of allocation_pools. 124 + * Returns a collection of allocation_pools.
125 - * 125 + *
126 - * @return a collection of allocationPools 126 + * @return a collection of allocationPools
127 - */ 127 + */
128 - Iterable<AllocationPool> allocationPools(); 128 + Iterable<AllocationPool> allocationPools();
129 -} 129 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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 +
20 -import java.util.Objects; 20 +import java.util.Objects;
21 - 21 +
22 -/** 22 +/**
23 - * Immutable representation of a subnet identifier. 23 + * Immutable representation of a subnet identifier.
24 - */ 24 + */
25 -public final class SubnetId { 25 +public final class SubnetId {
26 - 26 +
27 - private final String subnetId; 27 + private final String subnetId;
28 - 28 +
29 - // Public construction is prohibited 29 + // Public construction is prohibited
30 - private SubnetId(String subnetId) { 30 + private SubnetId(String subnetId) {
31 - checkNotNull(subnetId, "SubnetId cannot be null"); 31 + checkNotNull(subnetId, "SubnetId cannot be null");
32 - this.subnetId = subnetId; 32 + this.subnetId = subnetId;
33 - } 33 + }
34 - 34 +
35 - /** 35 + /**
36 - * Creates a Subnet identifier. 36 + * Creates a Subnet identifier.
37 - * 37 + *
38 - * @param subnetId the subnet identifier 38 + * @param subnetId the subnet identifier
39 - * @return the subnet identifier 39 + * @return the subnet identifier
40 - */ 40 + */
41 - public static SubnetId subnetId(String subnetId) { 41 + public static SubnetId subnetId(String subnetId) {
42 - return new SubnetId(subnetId); 42 + return new SubnetId(subnetId);
43 - } 43 + }
44 - 44 +
45 - /** 45 + /**
46 - * Returns the subnet identifier. 46 + * Returns the subnet identifier.
47 - * 47 + *
48 - * @return the subnet identifier 48 + * @return the subnet identifier
49 - */ 49 + */
50 - public String subnetId() { 50 + public String subnetId() {
51 - return subnetId; 51 + return subnetId;
52 - } 52 + }
53 - 53 +
54 - @Override 54 + @Override
55 - public int hashCode() { 55 + public int hashCode() {
56 - return Objects.hash(subnetId); 56 + return Objects.hash(subnetId);
57 - } 57 + }
58 - 58 +
59 - @Override 59 + @Override
60 - public boolean equals(Object obj) { 60 + public boolean equals(Object obj) {
61 - if (this == obj) { 61 + if (this == obj) {
62 - return true; 62 + return true;
63 - } 63 + }
64 - if (obj instanceof SubnetId) { 64 + if (obj instanceof SubnetId) {
65 - final SubnetId that = (SubnetId) obj; 65 + final SubnetId that = (SubnetId) obj;
66 - return this.getClass() == that.getClass() 66 + return this.getClass() == that.getClass()
67 - && Objects.equals(this.subnetId, that.subnetId); 67 + && Objects.equals(this.subnetId, that.subnetId);
68 - } 68 + }
69 - return false; 69 + return false;
70 - } 70 + }
71 - 71 +
72 - @Override 72 + @Override
73 - public String toString() { 73 + public String toString() {
74 - return subnetId; 74 + return subnetId;
75 - } 75 + }
76 -} 76 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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 tenant identifier. 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 + /**
35 - * Creates a network id using the tenantid. 35 + * Creates a network id using the tenantid.
36 - * 36 + *
37 - * @param tenantid network String 37 + * @param tenantid network String
38 - * @return TenantId 38 + * @return TenantId
39 - */ 39 + */
40 - public static TenantId tenantId(String tenantid) { 40 + public static TenantId tenantId(String tenantid) {
41 - checkNotNull(tenantid, "Tenantid can not be null"); 41 + checkNotNull(tenantid, "Tenantid can not be null");
42 - return new TenantId(tenantid); 42 + return new TenantId(tenantid);
43 - } 43 + }
44 - 44 +
45 - /** 45 + /**
46 - * Returns the tenant identifier. 46 + * Returns the tenant identifier.
47 - * 47 + *
48 - * @return the tenant identifier 48 + * @return the tenant identifier
49 - */ 49 + */
50 - public String tenantId() { 50 + public String tenantId() {
51 - return tenantId; 51 + return tenantId;
52 - } 52 + }
53 - 53 +
54 - @Override 54 + @Override
55 - public int hashCode() { 55 + public int hashCode() {
56 - return Objects.hash(tenantId); 56 + return Objects.hash(tenantId);
57 - } 57 + }
58 - 58 +
59 - @Override 59 + @Override
60 - public boolean equals(Object obj) { 60 + public boolean equals(Object obj) {
61 - if (this == obj) { 61 + if (this == obj) {
62 - return true; 62 + return true;
63 - } 63 + }
64 - if (obj instanceof TenantId) { 64 + if (obj instanceof TenantId) {
65 - final TenantId that = (TenantId) obj; 65 + final TenantId that = (TenantId) obj;
66 - return this.getClass() == that.getClass() 66 + return this.getClass() == that.getClass()
67 - && Objects.equals(this.tenantId, that.tenantId); 67 + && Objects.equals(this.tenantId, that.tenantId);
68 - } 68 + }
69 - return false; 69 + return false;
70 - } 70 + }
71 - 71 +
72 - @Override 72 + @Override
73 - public String toString() { 73 + public String toString() {
74 - return tenantId; 74 + return tenantId;
75 - } 75 + }
76 - 76 +
77 -} 77 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.vtnrsc; 16 +package org.onosproject.vtnrsc;
17 - 17 +
18 -/** 18 +/**
19 - * Representation of the tenantNetwork. 19 + * Representation of the tenantNetwork.
20 - */ 20 + */
21 -public interface TenantNetwork { 21 +public interface TenantNetwork {
22 - 22 +
23 - /** 23 + /**
24 - * Coarse classification of the state of the tenantNetwork. 24 + * Coarse classification of the state of the tenantNetwork.
25 - */ 25 + */
26 - public enum State { 26 + public enum State {
27 - /** 27 + /**
28 - * Signifies that a tenantNetwork is currently active.This state means 28 + * Signifies that a tenantNetwork is currently active.This state means
29 - * that this network is available. 29 + * that this network is available.
30 - */ 30 + */
31 - ACTIVE, 31 + ACTIVE,
32 - /** 32 + /**
33 - * Signifies that a tenantNetwork is currently built. 33 + * Signifies that a tenantNetwork is currently built.
34 - */ 34 + */
35 - BUILD, 35 + BUILD,
36 - /** 36 + /**
37 - * Signifies that a tenantNetwork is currently unavailable. 37 + * Signifies that a tenantNetwork is currently unavailable.
38 - */ 38 + */
39 - DOWN, 39 + DOWN,
40 - /** 40 + /**
41 - * Signifies that a tenantNetwork is currently error. 41 + * Signifies that a tenantNetwork is currently error.
42 - */ 42 + */
43 - ERROR 43 + ERROR
44 - } 44 + }
45 - 45 +
46 - /** 46 + /**
47 - * Coarse classification of the type of the tenantNetwork. 47 + * Coarse classification of the type of the tenantNetwork.
48 - */ 48 + */
49 - public enum Type { 49 + public enum Type {
50 - /** 50 + /**
51 - * Signifies that a tenantNetwork is local. 51 + * Signifies that a tenantNetwork is local.
52 - */ 52 + */
53 - LOCAL 53 + LOCAL
54 - } 54 + }
55 - 55 +
56 - /** 56 + /**
57 - * Returns the tenantNetwork identifier. 57 + * Returns the tenantNetwork identifier.
58 - * 58 + *
59 - * @return tenantNetwork identifier 59 + * @return tenantNetwork identifier
60 - */ 60 + */
61 - TenantNetworkId id(); 61 + TenantNetworkId id();
62 - 62 +
63 - /** 63 + /**
64 - * Returns the tenantNetwork name. 64 + * Returns the tenantNetwork name.
65 - * 65 + *
66 - * @return tenantNetwork name 66 + * @return tenantNetwork name
67 - */ 67 + */
68 - String name(); 68 + String name();
69 - 69 +
70 - /** 70 + /**
71 - * Returns the administrative state of the tenantNetwork,which is up(true) 71 + * Returns the administrative state of the tenantNetwork,which is up(true)
72 - * or down(false). 72 + * or down(false).
73 - * 73 + *
74 - * @return true or false 74 + * @return true or false
75 - */ 75 + */
76 - boolean adminStateUp(); 76 + boolean adminStateUp();
77 - 77 +
78 - /** 78 + /**
79 - * Returns the tenantNetwork state. 79 + * Returns the tenantNetwork state.
80 - * 80 + *
81 - * @return tenant network state 81 + * @return tenant network state
82 - */ 82 + */
83 - State state(); 83 + State state();
84 - 84 +
85 - /** 85 + /**
86 - * Indicates whether this tenantNetwork is shared across all tenants. By 86 + * Indicates whether this tenantNetwork is shared across all tenants. By
87 - * default,only administrative user can change this value. 87 + * default,only administrative user can change this value.
88 - * 88 + *
89 - * @return true or false 89 + * @return true or false
90 - */ 90 + */
91 - boolean shared(); 91 + boolean shared();
92 - 92 +
93 - /** 93 + /**
94 - * Returns the UUID of the tenant that will own the tenantNetwork. This 94 + * Returns the UUID of the tenant that will own the tenantNetwork. This
95 - * tenant can be different from the tenant that makes the create 95 + * tenant can be different from the tenant that makes the create
96 - * tenantNetwork request. 96 + * tenantNetwork request.
97 - * 97 + *
98 - * @return the tenant identifier 98 + * @return the tenant identifier
99 - */ 99 + */
100 - TenantId tenantId(); 100 + TenantId tenantId();
101 - 101 +
102 - /** 102 + /**
103 - * Returns the routerExternal.Indicates whether this network is externally 103 + * Returns the routerExternal.Indicates whether this network is externally
104 - * accessible. 104 + * accessible.
105 - * 105 + *
106 - * @return true or false 106 + * @return true or false
107 - */ 107 + */
108 - boolean routerExternal(); 108 + boolean routerExternal();
109 - 109 +
110 - /** 110 + /**
111 - * Returns the tenantNetwork Type. 111 + * Returns the tenantNetwork Type.
112 - * 112 + *
113 - * @return tenantNetwork Type 113 + * @return tenantNetwork Type
114 - */ 114 + */
115 - Type type(); 115 + Type type();
116 - 116 +
117 - /** 117 + /**
118 - * Returns the tenantNetwork physical network. 118 + * Returns the tenantNetwork physical network.
119 - * 119 + *
120 - * @return tenantNetwork physical network 120 + * @return tenantNetwork physical network
121 - */ 121 + */
122 - PhysicalNetwork physicalNetwork(); 122 + PhysicalNetwork physicalNetwork();
123 - 123 +
124 - /** 124 + /**
125 - * Returns the tenantNetwork segmentation id. 125 + * Returns the tenantNetwork segmentation id.
126 - * 126 + *
127 - * @return tenantNetwork segmentation id 127 + * @return tenantNetwork segmentation id
128 - */ 128 + */
129 - SegmentationId segmentationId(); 129 + SegmentationId segmentationId();
130 -} 130 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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;
20 - 20 +
21 -/** 21 +/**
22 - * Immutable representation of a tenantNetwork identity. 22 + * Immutable representation of a tenantNetwork identity.
23 - */ 23 + */
24 -public final class TenantNetworkId { 24 +public final class TenantNetworkId {
25 - 25 +
26 - private final String networkId; 26 + private final String networkId;
27 - 27 +
28 - // Public construction is prohibited 28 + // Public construction is prohibited
29 - private TenantNetworkId(String networkId) { 29 + private TenantNetworkId(String networkId) {
30 - this.networkId = networkId; 30 + this.networkId = networkId;
31 - } 31 + }
32 - 32 +
33 - /** 33 + /**
34 - * Creates a TenantNetwork identifier. 34 + * Creates a TenantNetwork identifier.
35 - * 35 + *
36 - * @param networkId tenantNetwork identify string 36 + * @param networkId tenantNetwork identify string
37 - * @return the attached tenantNetwork identifier 37 + * @return the attached tenantNetwork identifier
38 - */ 38 + */
39 - public static TenantNetworkId networkId(String networkId) { 39 + public static TenantNetworkId networkId(String networkId) {
40 - checkNotNull(networkId, "Networkid cannot be null"); 40 + checkNotNull(networkId, "Networkid cannot be null");
41 - return new TenantNetworkId(networkId); 41 + return new TenantNetworkId(networkId);
42 - } 42 + }
43 - 43 +
44 - /** 44 + /**
45 - * Returns tenantNetwork identifier. 45 + * Returns tenantNetwork identifier.
46 - * 46 + *
47 - * @return the tenantNetwork identifier 47 + * @return the tenantNetwork identifier
48 - */ 48 + */
49 - public String networkId() { 49 + public String networkId() {
50 - return networkId; 50 + return networkId;
51 - } 51 + }
52 - 52 +
53 - @Override 53 + @Override
54 - public int hashCode() { 54 + public int hashCode() {
55 - return Objects.hash(networkId); 55 + return Objects.hash(networkId);
56 - } 56 + }
57 - 57 +
58 - @Override 58 + @Override
59 - public boolean equals(Object obj) { 59 + public boolean equals(Object obj) {
60 - if (this == obj) { 60 + if (this == obj) {
61 - return true; 61 + return true;
62 - } 62 + }
63 - if (obj instanceof TenantNetworkId) { 63 + if (obj instanceof TenantNetworkId) {
64 - final TenantNetworkId that = (TenantNetworkId) obj; 64 + final TenantNetworkId that = (TenantNetworkId) obj;
65 - return this.getClass() == that.getClass() 65 + return this.getClass() == that.getClass()
66 - && Objects.equals(this.networkId, that.networkId); 66 + && Objects.equals(this.networkId, that.networkId);
67 - } 67 + }
68 - return false; 68 + return false;
69 - } 69 + }
70 - 70 +
71 - @Override 71 + @Override
72 - public String toString() { 72 + public String toString() {
73 - return networkId; 73 + return networkId;
74 - } 74 + }
75 - 75 +
76 -} 76 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.vtnrsc; 16 +package org.onosproject.vtnrsc;
17 - 17 +
18 -import java.util.Collection; 18 +import java.util.Collection;
19 -import java.util.Set; 19 +import java.util.Set;
20 - 20 +
21 -import org.onlab.packet.MacAddress; 21 +import org.onlab.packet.MacAddress;
22 -import org.onosproject.net.DeviceId; 22 +import org.onosproject.net.DeviceId;
23 - 23 +
24 -/** 24 +/**
25 - * Representation of the VirtualPort. 25 + * Representation of the VirtualPort.
26 - */ 26 + */
27 -public interface VirtualPort { 27 +public interface VirtualPort {
28 - /** 28 + /**
29 - * Coarse classification of the type of the virtual port. 29 + * Coarse classification of the type of the virtual port.
30 - */ 30 + */
31 - public enum State { 31 + public enum State {
32 - /** 32 + /**
33 - * Signifies that a virtualPort is currently active,This state mean that 33 + * Signifies that a virtualPort is currently active,This state mean that
34 - * this virtualPort is available. 34 + * this virtualPort is available.
35 - */ 35 + */
36 - ACTIVE, 36 + ACTIVE,
37 - /** 37 + /**
38 - * Signifies that a virtualPort is currently unavailable. 38 + * Signifies that a virtualPort is currently unavailable.
39 - */ 39 + */
40 - DOWN 40 + DOWN
41 - } 41 + }
42 - 42 +
43 - /** 43 + /**
44 - * Returns the virtualPort identifier. 44 + * Returns the virtualPort identifier.
45 - * 45 + *
46 - * @return virtualPort identifier 46 + * @return virtualPort identifier
47 - */ 47 + */
48 - VirtualPortId portId(); 48 + VirtualPortId portId();
49 - 49 +
50 - /** 50 + /**
51 - * Returns the network identifier. 51 + * Returns the network identifier.
52 - * 52 + *
53 - * @return tenantNetwork identifier 53 + * @return tenantNetwork identifier
54 - */ 54 + */
55 - TenantNetworkId networkId(); 55 + TenantNetworkId networkId();
56 - 56 +
57 - /** 57 + /**
58 - * Returns the symbolic name for the virtualPort. 58 + * Returns the symbolic name for the virtualPort.
59 - * 59 + *
60 - * @return virtualPort name 60 + * @return virtualPort name
61 - */ 61 + */
62 - String name(); 62 + String name();
63 - 63 +
64 - /** 64 + /**
65 - * Returns the administrative status of the port,which is up(true) or 65 + * Returns the administrative status of the port,which is up(true) or
66 - * down(false). 66 + * down(false).
67 - * 67 + *
68 - * @return true if the administrative status of the port is up 68 + * @return true if the administrative status of the port is up
69 - */ 69 + */
70 - boolean adminStateUp(); 70 + boolean adminStateUp();
71 - 71 +
72 - /** 72 + /**
73 - * Returns the state. 73 + * Returns the state.
74 - * 74 + *
75 - * @return state 75 + * @return state
76 - */ 76 + */
77 - State state(); 77 + State state();
78 - 78 +
79 - /** 79 + /**
80 - * Returns the MAC address. 80 + * Returns the MAC address.
81 - * 81 + *
82 - * @return MAC Address 82 + * @return MAC Address
83 - */ 83 + */
84 - MacAddress macAddress(); 84 + MacAddress macAddress();
85 - 85 +
86 - /** 86 + /**
87 - * Returns the port tenantId. 87 + * Returns the port tenantId.
88 - * 88 + *
89 - * @return port tenantId 89 + * @return port tenantId
90 - */ 90 + */
91 - TenantId tenantId(); 91 + TenantId tenantId();
92 - 92 +
93 - /** 93 + /**
94 - * Returns the device identifier. 94 + * Returns the device identifier.
95 - * 95 + *
96 - * @return deviceId 96 + * @return deviceId
97 - */ 97 + */
98 - DeviceId deviceId(); 98 + DeviceId deviceId();
99 - 99 +
100 - /** 100 + /**
101 - * Returns the identifier of the entity that uses this port. 101 + * Returns the identifier of the entity that uses this port.
102 - * 102 + *
103 - * @return deviceOwner 103 + * @return deviceOwner
104 - */ 104 + */
105 - String deviceOwner(); 105 + String deviceOwner();
106 - 106 +
107 - /** 107 + /**
108 - * Returns the virtualPort allowedAddressPairs. 108 + * Returns the virtualPort allowedAddressPairs.
109 - * 109 + *
110 - * @return virtualPort allowedAddressPairs 110 + * @return virtualPort allowedAddressPairs
111 - */ 111 + */
112 - Collection<AllowedAddressPair> allowedAddressPairs(); 112 + Collection<AllowedAddressPair> allowedAddressPairs();
113 - 113 +
114 - /** 114 + /**
115 - * Returns set of IP addresses for the port, include the IP addresses 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 FixedIps Set of fixedIp 118 + * @return FixedIps Set of fixedIp
119 - */ 119 + */
120 - Set<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 - BindingHostId bindingHostId(); 127 + BindingHostId bindingHostId();
128 - 128 +
129 - /** 129 + /**
130 - * Returns the virtualPort bindingVnicType. 130 + * Returns the virtualPort bindingVnicType.
131 - * 131 + *
132 - * @return virtualPort bindingVnicType 132 + * @return virtualPort bindingVnicType
133 - */ 133 + */
134 - String bindingVnicType(); 134 + String bindingVnicType();
135 - 135 +
136 - /** 136 + /**
137 - * Returns the virtualPort bindingVifType. 137 + * Returns the virtualPort bindingVifType.
138 - * 138 + *
139 - * @return virtualPort bindingVifType 139 + * @return virtualPort bindingVifType
140 - */ 140 + */
141 - String bindingVifType(); 141 + String bindingVifType();
142 - 142 +
143 - /** 143 + /**
144 - * Returns the virtualPort bindingvifDetail. 144 + * Returns the virtualPort bindingvifDetail.
145 - * 145 + *
146 - * @return virtualPort bindingvifDetail 146 + * @return virtualPort bindingvifDetail
147 - */ 147 + */
148 - String bindingVifDetails(); 148 + String bindingVifDetails();
149 - 149 +
150 - /** 150 + /**
151 - * Returns the security groups. 151 + * Returns the security groups.
152 - * 152 + *
153 - * @return port security groups 153 + * @return port security groups
154 - */ 154 + */
155 - Iterable<SecurityGroup> securityGroups(); 155 + Iterable<SecurityGroup> securityGroups();
156 -} 156 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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 +
20 -import java.util.Objects; 20 +import java.util.Objects;
21 - 21 +
22 -/** 22 +/**
23 - * Immutable representation of a virtual port identifier. 23 + * Immutable representation of a virtual port identifier.
24 - */ 24 + */
25 -public final class VirtualPortId { 25 +public final class VirtualPortId {
26 - private final String portId; 26 + private final String portId;
27 - // Public construction is prohibited 27 + // Public construction is prohibited
28 - private VirtualPortId(String virtualPortId) { 28 + private VirtualPortId(String virtualPortId) {
29 - checkNotNull(virtualPortId, "VirtualPortId cannot be null"); 29 + checkNotNull(virtualPortId, "VirtualPortId cannot be null");
30 - this.portId = virtualPortId; 30 + this.portId = virtualPortId;
31 - } 31 + }
32 - 32 +
33 - public String portId() { 33 + public String portId() {
34 - return portId; 34 + return portId;
35 - } 35 + }
36 - 36 +
37 - /** 37 + /**
38 - * Creates a virtualPort id using the supplied portId. 38 + * Creates a virtualPort id using the supplied portId.
39 - * 39 + *
40 - * @param portId virtualport identifier 40 + * @param portId virtualport identifier
41 - * @return VirtualPortId 41 + * @return VirtualPortId
42 - */ 42 + */
43 - public static VirtualPortId portId(String portId) { 43 + public static VirtualPortId portId(String portId) {
44 - return new VirtualPortId(portId); 44 + return new VirtualPortId(portId);
45 - } 45 + }
46 - 46 +
47 - @Override 47 + @Override
48 - public int hashCode() { 48 + public int hashCode() {
49 - return Objects.hash(portId); 49 + return Objects.hash(portId);
50 - } 50 + }
51 - 51 +
52 - @Override 52 + @Override
53 - public boolean equals(Object obj) { 53 + public boolean equals(Object obj) {
54 - if (this == obj) { 54 + if (this == obj) {
55 - return true; 55 + return true;
56 - } 56 + }
57 - if (obj instanceof VirtualPortId) { 57 + if (obj instanceof VirtualPortId) {
58 - final VirtualPortId that = (VirtualPortId) obj; 58 + final VirtualPortId that = (VirtualPortId) obj;
59 - return this.getClass() == that.getClass() 59 + return this.getClass() == that.getClass()
60 - && Objects.equals(this.portId, that.portId); 60 + && Objects.equals(this.portId, that.portId);
61 - } 61 + }
62 - return false; 62 + return false;
63 - } 63 + }
64 - 64 +
65 - @Override 65 + @Override
66 - public String toString() { 66 + public String toString() {
67 - return portId; 67 + return portId;
68 - } 68 + }
69 - 69 +
70 -} 70 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.vtnrsc.subnet; 16 +package org.onosproject.vtnrsc.subnet;
17 - 17 +
18 -import org.onosproject.vtnrsc.Subnet; 18 +import org.onosproject.vtnrsc.Subnet;
19 -import org.onosproject.vtnrsc.SubnetId; 19 +import org.onosproject.vtnrsc.SubnetId;
20 - 20 +
21 - 21 +
22 -/** 22 +/**
23 - * Service for interacting with the inventory of subnets. 23 + * Service for interacting with the inventory of subnets.
24 - */ 24 + */
25 -public interface SubnetService { 25 +public interface SubnetService {
26 - /** 26 + /**
27 - * Returns the subnet with the specified identifier. 27 + * Returns the subnet with the specified identifier.
28 - * 28 + *
29 - * @param subnetId subnet identifier 29 + * @param subnetId subnet identifier
30 - * @return true or false 30 + * @return true or false
31 - */ 31 + */
32 - boolean exists(SubnetId subnetId); 32 + boolean exists(SubnetId subnetId);
33 - /** 33 + /**
34 - * Returns a collection of the currently known subnets. 34 + * Returns a collection of the currently known subnets.
35 - * 35 + *
36 - * @return iterable collection of subnets 36 + * @return iterable collection of subnets
37 - */ 37 + */
38 - Iterable<Subnet> getSubnets(); 38 + Iterable<Subnet> getSubnets();
39 - 39 +
40 - /** 40 + /**
41 - * Returns the subnet with the specified identifier. 41 + * Returns the subnet with the specified identifier.
42 - * 42 + *
43 - * @param subnetId subnet identifier 43 + * @param subnetId subnet identifier
44 - * @return subnet or null if one with the given identifier is not known 44 + * @return subnet or null if one with the given identifier is not known
45 - */ 45 + */
46 - Subnet getSubnet(SubnetId subnetId); 46 + Subnet getSubnet(SubnetId subnetId);
47 - /** 47 + /**
48 - * Creates new subnets. 48 + * Creates new subnets.
49 - * 49 + *
50 - * @param subnets the iterable collection of subnets 50 + * @param subnets the iterable collection of subnets
51 - * @return true if the identifier subnet has been created right 51 + * @return true if the identifier subnet has been created right
52 - */ 52 + */
53 - boolean createSubnets(Iterable<Subnet> subnets); 53 + boolean createSubnets(Iterable<Subnet> subnets);
54 - 54 +
55 - /** 55 + /**
56 - * Updates existing subnets. 56 + * Updates existing subnets.
57 - * 57 + *
58 - * @param subnets the iterable collection of subnets 58 + * @param subnets the iterable collection of subnets
59 - * @return true if all subnets were updated successfully 59 + * @return true if all subnets were updated successfully
60 - */ 60 + */
61 - boolean updateSubnets(Iterable<Subnet> subnets); 61 + boolean updateSubnets(Iterable<Subnet> subnets);
62 - 62 +
63 - /** 63 + /**
64 - * Administratively removes the specified subnets from the store. 64 + * Administratively removes the specified subnets from the store.
65 - * 65 + *
66 - * @param subnetIds the iterable collection of subnets identifier 66 + * @param subnetIds the iterable collection of subnets identifier
67 - * @return true if remove identifier subnets successfully 67 + * @return true if remove identifier subnets successfully
68 - */ 68 + */
69 - boolean removeSubnets(Iterable<SubnetId> subnetIds); 69 + boolean removeSubnets(Iterable<SubnetId> subnetIds);
70 - 70 +
71 - 71 +
72 -} 72 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.vtnrsc.subnet.impl; 16 +package org.onosproject.vtnrsc.subnet.impl;
17 - 17 +
18 -import org.apache.felix.scr.annotations.Activate; 18 +import org.apache.felix.scr.annotations.Activate;
19 -import org.apache.felix.scr.annotations.Component; 19 +import org.apache.felix.scr.annotations.Component;
20 -import org.apache.felix.scr.annotations.Deactivate; 20 +import org.apache.felix.scr.annotations.Deactivate;
21 -import org.apache.felix.scr.annotations.Reference; 21 +import org.apache.felix.scr.annotations.Reference;
22 -import org.apache.felix.scr.annotations.ReferenceCardinality; 22 +import org.apache.felix.scr.annotations.ReferenceCardinality;
23 -import org.apache.felix.scr.annotations.Service; 23 +import org.apache.felix.scr.annotations.Service;
24 -import org.onlab.packet.IpAddress; 24 +import org.onlab.packet.IpAddress;
25 -import org.onosproject.core.ApplicationId; 25 +import org.onosproject.core.ApplicationId;
26 -import org.onosproject.core.CoreService; 26 +import org.onosproject.core.CoreService;
27 -import org.onosproject.store.serializers.KryoNamespaces; 27 +import org.onosproject.store.serializers.KryoNamespaces;
28 -import org.onosproject.store.service.Serializer; 28 +import org.onosproject.store.service.Serializer;
29 -import org.onosproject.store.service.StorageService; 29 +import org.onosproject.store.service.StorageService;
30 -import org.onosproject.vtnrsc.AllocationPool; 30 +import org.onosproject.vtnrsc.AllocationPool;
31 -import org.onosproject.vtnrsc.DefaultAllocationPool; 31 +import org.onosproject.vtnrsc.DefaultAllocationPool;
32 -import org.onosproject.vtnrsc.DefaultHostRoute; 32 +import org.onosproject.vtnrsc.DefaultHostRoute;
33 -import org.onosproject.vtnrsc.DefaultSubnet; 33 +import org.onosproject.vtnrsc.DefaultSubnet;
34 -import org.onosproject.vtnrsc.HostRoute; 34 +import org.onosproject.vtnrsc.HostRoute;
35 -import org.onosproject.vtnrsc.Subnet; 35 +import org.onosproject.vtnrsc.Subnet;
36 -import org.onosproject.vtnrsc.SubnetId; 36 +import org.onosproject.vtnrsc.SubnetId;
37 -import org.onosproject.vtnrsc.TenantId; 37 +import org.onosproject.vtnrsc.TenantId;
38 -import org.onosproject.vtnrsc.TenantNetworkId; 38 +import org.onosproject.vtnrsc.TenantNetworkId;
39 -import org.onosproject.vtnrsc.subnet.SubnetService; 39 +import org.onosproject.vtnrsc.subnet.SubnetService;
40 -import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService; 40 +import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService;
41 -import org.slf4j.Logger; 41 +import org.slf4j.Logger;
42 - 42 +
43 -import java.util.Arrays; 43 +import java.util.Arrays;
44 -import java.util.Collections; 44 +import java.util.Collections;
45 -import java.util.Map; 45 +import java.util.Map;
46 - 46 +
47 -import static com.google.common.base.Preconditions.checkNotNull; 47 +import static com.google.common.base.Preconditions.checkNotNull;
48 -import static org.slf4j.LoggerFactory.getLogger; 48 +import static org.slf4j.LoggerFactory.getLogger;
49 - 49 +
50 -/** 50 +/**
51 - * Provides implementation of the Subnet service. 51 + * Provides implementation of the Subnet service.
52 - */ 52 + */
53 -@Component(immediate = true) 53 +@Component(immediate = true)
54 -@Service 54 +@Service
55 -public class SubnetManager implements SubnetService { 55 +public class SubnetManager implements SubnetService {
56 - 56 +
57 - private static final String SUBNET_ID_NULL = "Subnet ID cannot be null"; 57 + private static final String SUBNET_ID_NULL = "Subnet ID cannot be null";
58 - private static final String SUBNET_NOT_NULL = "Subnet cannot be null"; 58 + private static final String SUBNET_NOT_NULL = "Subnet cannot be null";
59 - private static final String SUBNET = "vtn-subnet-store"; 59 + private static final String SUBNET = "vtn-subnet-store";
60 - private static final String VTNRSC_APP = "org.onosproject.vtnrsc"; 60 + private static final String VTNRSC_APP = "org.onosproject.vtnrsc";
61 - 61 +
62 - 62 +
63 - private final Logger log = getLogger(getClass()); 63 + private final Logger log = getLogger(getClass());
64 - 64 +
65 - protected Map<SubnetId, Subnet> subnetStore; 65 + protected Map<SubnetId, Subnet> subnetStore;
66 - protected ApplicationId appId; 66 + protected ApplicationId appId;
67 - 67 +
68 - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 68 + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
69 - protected StorageService storageService; 69 + protected StorageService storageService;
70 - 70 +
71 - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 71 + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
72 - protected CoreService coreService; 72 + protected CoreService coreService;
73 - 73 +
74 - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 74 + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
75 - protected TenantNetworkService tenantNetworkService; 75 + protected TenantNetworkService tenantNetworkService;
76 - 76 +
77 - @Activate 77 + @Activate
78 - public void activate() { 78 + public void activate() {
79 - 79 +
80 - appId = coreService.registerApplication(VTNRSC_APP); 80 + appId = coreService.registerApplication(VTNRSC_APP);
81 - 81 +
82 - subnetStore = storageService.<SubnetId, Subnet>consistentMapBuilder() 82 + subnetStore = storageService.<SubnetId, Subnet>consistentMapBuilder()
83 - .withName(SUBNET) 83 + .withName(SUBNET)
84 - .withApplicationId(appId) 84 + .withApplicationId(appId)
85 - .withPurgeOnUninstall() 85 + .withPurgeOnUninstall()
86 - .withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API), 86 + .withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API),
87 - Subnet.class, 87 + Subnet.class,
88 - SubnetId.class, 88 + SubnetId.class,
89 - TenantNetworkId.class, 89 + TenantNetworkId.class,
90 - TenantId.class, 90 + TenantId.class,
91 - HostRoute.class, 91 + HostRoute.class,
92 - DefaultHostRoute.class, 92 + DefaultHostRoute.class,
93 - Subnet.Mode.class, 93 + Subnet.Mode.class,
94 - AllocationPool.class, 94 + AllocationPool.class,
95 - DefaultAllocationPool.class, 95 + DefaultAllocationPool.class,
96 - DefaultSubnet.class, 96 + DefaultSubnet.class,
97 - IpAddress.Version.class)) 97 + IpAddress.Version.class))
98 - .build().asJavaMap(); 98 + .build().asJavaMap();
99 - 99 +
100 - log.info("Started"); 100 + log.info("Started");
101 - } 101 + }
102 - 102 +
103 - @Deactivate 103 + @Deactivate
104 - public void deactivate() { 104 + public void deactivate() {
105 - log.info("Stopped"); 105 + log.info("Stopped");
106 - } 106 + }
107 - 107 +
108 - @Override 108 + @Override
109 - public Iterable<Subnet> getSubnets() { 109 + public Iterable<Subnet> getSubnets() {
110 - return Collections.unmodifiableCollection(subnetStore.values()); 110 + return Collections.unmodifiableCollection(subnetStore.values());
111 - } 111 + }
112 - 112 +
113 - @Override 113 + @Override
114 - public Subnet getSubnet(SubnetId subnetId) { 114 + public Subnet getSubnet(SubnetId subnetId) {
115 - checkNotNull(subnetId, SUBNET_ID_NULL); 115 + checkNotNull(subnetId, SUBNET_ID_NULL);
116 - return subnetStore.get(subnetId); 116 + return subnetStore.get(subnetId);
117 - } 117 + }
118 - 118 +
119 - @Override 119 + @Override
120 - public boolean exists(SubnetId subnetId) { 120 + public boolean exists(SubnetId subnetId) {
121 - checkNotNull(subnetId, SUBNET_ID_NULL); 121 + checkNotNull(subnetId, SUBNET_ID_NULL);
122 - return subnetStore.containsKey(subnetId); 122 + return subnetStore.containsKey(subnetId);
123 - } 123 + }
124 - 124 +
125 - @Override 125 + @Override
126 - public boolean createSubnets(Iterable<Subnet> subnets) { 126 + public boolean createSubnets(Iterable<Subnet> subnets) {
127 - checkNotNull(subnets, SUBNET_NOT_NULL); 127 + checkNotNull(subnets, SUBNET_NOT_NULL);
128 - for (Subnet subnet : subnets) { 128 + for (Subnet subnet : subnets) {
129 - if (!tenantNetworkService.exists(subnet.networkId())) { 129 + if (!tenantNetworkService.exists(subnet.networkId())) {
130 - log.debug("The network identifier that the subnet {} belong to is not exist", 130 + log.debug("The network identifier that the subnet {} belong to is not exist",
131 - subnet.networkId().toString(), subnet.id().toString()); 131 + subnet.networkId().toString(), subnet.id().toString());
132 - return false; 132 + return false;
133 - } 133 + }
134 - subnetStore.put(subnet.id(), subnet); 134 + subnetStore.put(subnet.id(), subnet);
135 - if (!subnetStore.containsKey(subnet.id())) { 135 + if (!subnetStore.containsKey(subnet.id())) {
136 - log.debug("The identified subnet whose identifier is {} create failed", 136 + log.debug("The identified subnet whose identifier is {} create failed",
137 - subnet.id().toString()); 137 + subnet.id().toString());
138 - return false; 138 + return false;
139 - } 139 + }
140 - } 140 + }
141 - return true; 141 + return true;
142 - } 142 + }
143 - 143 +
144 - @Override 144 + @Override
145 - public boolean updateSubnets(Iterable<Subnet> subnets) { 145 + public boolean updateSubnets(Iterable<Subnet> subnets) {
146 - checkNotNull(subnets, SUBNET_NOT_NULL); 146 + checkNotNull(subnets, SUBNET_NOT_NULL);
147 - if (subnets != null) { 147 + if (subnets != null) {
148 - for (Subnet subnet : subnets) { 148 + for (Subnet subnet : subnets) {
149 - if (!subnetStore.containsKey(subnet.id())) { 149 + if (!subnetStore.containsKey(subnet.id())) {
150 - log.debug("The subnet is not exist whose identifier is {}", 150 + log.debug("The subnet is not exist whose identifier is {}",
151 - subnet.id().toString()); 151 + subnet.id().toString());
152 - return false; 152 + return false;
153 - } 153 + }
154 - 154 +
155 - subnetStore.put(subnet.id(), subnet); 155 + subnetStore.put(subnet.id(), subnet);
156 - 156 +
157 - if (!subnet.equals(subnetStore.get(subnet.id()))) { 157 + if (!subnet.equals(subnetStore.get(subnet.id()))) {
158 - log.debug("The subnet is updated failed whose identifier is {}", 158 + log.debug("The subnet is updated failed whose identifier is {}",
159 - subnet.id().toString()); 159 + subnet.id().toString());
160 - return false; 160 + return false;
161 - } 161 + }
162 - } 162 + }
163 - } 163 + }
164 - return true; 164 + return true;
165 - } 165 + }
166 - 166 +
167 - @Override 167 + @Override
168 - public boolean removeSubnets(Iterable<SubnetId> subnetIds) { 168 + public boolean removeSubnets(Iterable<SubnetId> subnetIds) {
169 - checkNotNull(subnetIds, SUBNET_ID_NULL); 169 + checkNotNull(subnetIds, SUBNET_ID_NULL);
170 - if (subnetIds != null) { 170 + if (subnetIds != null) {
171 - for (SubnetId subnetId : subnetIds) { 171 + for (SubnetId subnetId : subnetIds) {
172 - subnetStore.remove(subnetId); 172 + subnetStore.remove(subnetId);
173 - if (subnetStore.containsKey(subnetId)) { 173 + if (subnetStore.containsKey(subnetId)) {
174 - log.debug("The subnet created is failed whose identifier is {}", 174 + log.debug("The subnet created is failed whose identifier is {}",
175 - subnetId.toString()); 175 + subnetId.toString());
176 - return false; 176 + return false;
177 - } 177 + }
178 - } 178 + }
179 - } 179 + }
180 - return true; 180 + return true;
181 - } 181 + }
182 - 182 +
183 -} 183 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.vtnrsc.tenantnetwork; 16 +package org.onosproject.vtnrsc.tenantnetwork;
17 - 17 +
18 -import org.onosproject.vtnrsc.TenantNetwork; 18 +import org.onosproject.vtnrsc.TenantNetwork;
19 -import org.onosproject.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.
23 - */ 23 + */
24 -public interface TenantNetworkService { 24 +public interface TenantNetworkService {
25 - 25 +
26 - /** 26 + /**
27 - * Returns if the tenantNetwork is existed. 27 + * Returns if the tenantNetwork is existed.
28 - * 28 + *
29 - * @param networkId tenantNetwork identifier 29 + * @param networkId tenantNetwork identifier
30 - * @return true or false if one with the given identifier exists. 30 + * @return true or false if one with the given identifier exists.
31 - */ 31 + */
32 - boolean exists(TenantNetworkId networkId); 32 + boolean exists(TenantNetworkId networkId);
33 - 33 +
34 - /** 34 + /**
35 - * Returns the number of tenantNetwork known to the system. 35 + * Returns the number of tenantNetwork known to the system.
36 - * 36 + *
37 - * @return number of tenantNetwork. 37 + * @return number of tenantNetwork.
38 - */ 38 + */
39 - int getNetworkCount(); 39 + int getNetworkCount();
40 - 40 +
41 - /** 41 + /**
42 - * Returns an iterable collection of the currently known tenantNetwork. 42 + * Returns an iterable collection of the currently known tenantNetwork.
43 - * 43 + *
44 - * @return collection of tenantNetwork. 44 + * @return collection of tenantNetwork.
45 - */ 45 + */
46 - Iterable<TenantNetwork> getNetworks(); 46 + Iterable<TenantNetwork> getNetworks();
47 - 47 +
48 - /** 48 + /**
49 - * Returns the tenantNetwork with the identifier. 49 + * Returns the tenantNetwork with the identifier.
50 - * 50 + *
51 - * @param networkId TenantNetwork identifier 51 + * @param networkId TenantNetwork identifier
52 - * @return TenantNetwork or null if one with the given identifier is not 52 + * @return TenantNetwork or null if one with the given identifier is not
53 - * known. 53 + * known.
54 - */ 54 + */
55 - TenantNetwork getNetwork(TenantNetworkId networkId); 55 + TenantNetwork getNetwork(TenantNetworkId networkId);
56 - 56 +
57 - /** 57 + /**
58 - * Creates tenantNetworks by networks. 58 + * Creates tenantNetworks by networks.
59 - * 59 + *
60 - * @param networks the collection of tenantNetworks 60 + * @param networks the collection of tenantNetworks
61 - * @return true if all given identifiers created successfully. 61 + * @return true if all given identifiers created successfully.
62 - */ 62 + */
63 - boolean createNetworks(Iterable<TenantNetwork> networks); 63 + boolean createNetworks(Iterable<TenantNetwork> networks);
64 - 64 +
65 - /** 65 + /**
66 - * Updates tenantNetworks by tenantNetworks. 66 + * Updates tenantNetworks by tenantNetworks.
67 - * 67 + *
68 - * @param networks the collection of tenantNetworks 68 + * @param networks the collection of tenantNetworks
69 - * @return true if all given identifiers updated successfully. 69 + * @return true if all given identifiers updated successfully.
70 - */ 70 + */
71 - boolean updateNetworks(Iterable<TenantNetwork> networks); 71 + boolean updateNetworks(Iterable<TenantNetwork> networks);
72 - 72 +
73 - /** 73 + /**
74 - * Deletes tenantNetwork by tenantNetworkIds. 74 + * Deletes tenantNetwork by tenantNetworkIds.
75 - * 75 + *
76 - * @param networksIds the collection of tenantNetworkIds 76 + * @param networksIds the collection of tenantNetworkIds
77 - * @return true if the specified tenantNetworks deleted successfully. 77 + * @return true if the specified tenantNetworks deleted successfully.
78 - */ 78 + */
79 - boolean removeNetworks(Iterable<TenantNetworkId> networksIds); 79 + boolean removeNetworks(Iterable<TenantNetworkId> networksIds);
80 -} 80 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.vtnrsc.tenantnetwork.impl; 16 +package org.onosproject.vtnrsc.tenantnetwork.impl;
17 - 17 +
18 -import org.apache.felix.scr.annotations.Activate; 18 +import org.apache.felix.scr.annotations.Activate;
19 -import org.apache.felix.scr.annotations.Component; 19 +import org.apache.felix.scr.annotations.Component;
20 -import org.apache.felix.scr.annotations.Deactivate; 20 +import org.apache.felix.scr.annotations.Deactivate;
21 -import org.apache.felix.scr.annotations.Reference; 21 +import org.apache.felix.scr.annotations.Reference;
22 -import org.apache.felix.scr.annotations.ReferenceCardinality; 22 +import org.apache.felix.scr.annotations.ReferenceCardinality;
23 -import org.apache.felix.scr.annotations.Service; 23 +import org.apache.felix.scr.annotations.Service;
24 -import org.onosproject.core.ApplicationId; 24 +import org.onosproject.core.ApplicationId;
25 -import org.onosproject.core.CoreService; 25 +import org.onosproject.core.CoreService;
26 -import org.onosproject.store.serializers.KryoNamespaces; 26 +import org.onosproject.store.serializers.KryoNamespaces;
27 -import org.onosproject.store.service.Serializer; 27 +import org.onosproject.store.service.Serializer;
28 -import org.onosproject.store.service.StorageService; 28 +import org.onosproject.store.service.StorageService;
29 -import org.onosproject.vtnrsc.DefaultTenantNetwork; 29 +import org.onosproject.vtnrsc.DefaultTenantNetwork;
30 -import org.onosproject.vtnrsc.PhysicalNetwork; 30 +import org.onosproject.vtnrsc.PhysicalNetwork;
31 -import org.onosproject.vtnrsc.SegmentationId; 31 +import org.onosproject.vtnrsc.SegmentationId;
32 -import org.onosproject.vtnrsc.TenantId; 32 +import org.onosproject.vtnrsc.TenantId;
33 -import org.onosproject.vtnrsc.TenantNetwork; 33 +import org.onosproject.vtnrsc.TenantNetwork;
34 -import org.onosproject.vtnrsc.TenantNetworkId; 34 +import org.onosproject.vtnrsc.TenantNetworkId;
35 -import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService; 35 +import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService;
36 -import org.slf4j.Logger; 36 +import org.slf4j.Logger;
37 - 37 +
38 -import java.util.Arrays; 38 +import java.util.Arrays;
39 -import java.util.Collections; 39 +import java.util.Collections;
40 -import java.util.Map; 40 +import java.util.Map;
41 - 41 +
42 -import static com.google.common.base.Preconditions.checkNotNull; 42 +import static com.google.common.base.Preconditions.checkNotNull;
43 -import static org.slf4j.LoggerFactory.getLogger; 43 +import static org.slf4j.LoggerFactory.getLogger;
44 - 44 +
45 -/** 45 +/**
46 - * Provides implementation of the tenantNetworkService. 46 + * Provides implementation of the tenantNetworkService.
47 - */ 47 + */
48 -@Component(immediate = true) 48 +@Component(immediate = true)
49 -@Service 49 +@Service
50 -public class TenantNetworkManager implements TenantNetworkService { 50 +public class TenantNetworkManager implements TenantNetworkService {
51 - 51 +
52 - private static final String NETWORK_ID_NULL = "Network ID cannot be null"; 52 + private static final String NETWORK_ID_NULL = "Network ID cannot be null";
53 - private static final String NETWORK_NOT_NULL = "Network ID cannot be null"; 53 + private static final String NETWORK_NOT_NULL = "Network ID cannot be null";
54 - private static final String TENANTNETWORK = "vtn-tenant-network-store"; 54 + private static final String TENANTNETWORK = "vtn-tenant-network-store";
55 - private static final String VTNRSC_APP = "org.onosproject.vtnrsc"; 55 + private static final String VTNRSC_APP = "org.onosproject.vtnrsc";
56 - 56 +
57 - protected Map<TenantNetworkId, TenantNetwork> networkIdAsKeyStore; 57 + protected Map<TenantNetworkId, TenantNetwork> networkIdAsKeyStore;
58 - protected ApplicationId appId; 58 + protected ApplicationId appId;
59 - 59 +
60 - private final Logger log = getLogger(getClass()); 60 + private final Logger log = getLogger(getClass());
61 - 61 +
62 - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 62 + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
63 - protected StorageService storageService; 63 + protected StorageService storageService;
64 - 64 +
65 - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 65 + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
66 - protected CoreService coreService; 66 + protected CoreService coreService;
67 - 67 +
68 - 68 +
69 - @Activate 69 + @Activate
70 - public void activate() { 70 + public void activate() {
71 - 71 +
72 - appId = coreService.registerApplication(VTNRSC_APP); 72 + appId = coreService.registerApplication(VTNRSC_APP);
73 - 73 +
74 - networkIdAsKeyStore = storageService.<TenantNetworkId, TenantNetwork>consistentMapBuilder() 74 + networkIdAsKeyStore = storageService.<TenantNetworkId, TenantNetwork>consistentMapBuilder()
75 - .withName(TENANTNETWORK) 75 + .withName(TENANTNETWORK)
76 - .withApplicationId(appId) 76 + .withApplicationId(appId)
77 - .withPurgeOnUninstall() 77 + .withPurgeOnUninstall()
78 - .withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API), 78 + .withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API),
79 - TenantNetworkId.class, 79 + TenantNetworkId.class,
80 - DefaultTenantNetwork.class, 80 + DefaultTenantNetwork.class,
81 - TenantNetwork.State.class, 81 + TenantNetwork.State.class,
82 - TenantId.class, 82 + TenantId.class,
83 - TenantNetwork.Type.class, 83 + TenantNetwork.Type.class,
84 - PhysicalNetwork.class, 84 + PhysicalNetwork.class,
85 - SegmentationId.class)) 85 + SegmentationId.class))
86 - .build().asJavaMap(); 86 + .build().asJavaMap();
87 - 87 +
88 - log.info("Started"); 88 + log.info("Started");
89 - } 89 + }
90 - 90 +
91 - @Deactivate 91 + @Deactivate
92 - public void deactivate() { 92 + public void deactivate() {
93 - log.info("Stopped"); 93 + log.info("Stopped");
94 - } 94 + }
95 - 95 +
96 - @Override 96 + @Override
97 - public boolean exists(TenantNetworkId networkId) { 97 + public boolean exists(TenantNetworkId networkId) {
98 - checkNotNull(networkId, NETWORK_ID_NULL); 98 + checkNotNull(networkId, NETWORK_ID_NULL);
99 - return networkIdAsKeyStore.containsKey(networkId); 99 + return networkIdAsKeyStore.containsKey(networkId);
100 - } 100 + }
101 - 101 +
102 - @Override 102 + @Override
103 - public int getNetworkCount() { 103 + public int getNetworkCount() {
104 - return networkIdAsKeyStore.size(); 104 + return networkIdAsKeyStore.size();
105 - } 105 + }
106 - 106 +
107 - @Override 107 + @Override
108 - public Iterable<TenantNetwork> getNetworks() { 108 + public Iterable<TenantNetwork> getNetworks() {
109 - return Collections.unmodifiableCollection(networkIdAsKeyStore.values()); 109 + return Collections.unmodifiableCollection(networkIdAsKeyStore.values());
110 - } 110 + }
111 - 111 +
112 - @Override 112 + @Override
113 - public TenantNetwork getNetwork(TenantNetworkId networkId) { 113 + public TenantNetwork getNetwork(TenantNetworkId networkId) {
114 - checkNotNull(networkId, NETWORK_ID_NULL); 114 + checkNotNull(networkId, NETWORK_ID_NULL);
115 - return networkIdAsKeyStore.get(networkId); 115 + return networkIdAsKeyStore.get(networkId);
116 - } 116 + }
117 - 117 +
118 - @Override 118 + @Override
119 - public boolean createNetworks(Iterable<TenantNetwork> networks) { 119 + public boolean createNetworks(Iterable<TenantNetwork> networks) {
120 - checkNotNull(networks, NETWORK_NOT_NULL); 120 + checkNotNull(networks, NETWORK_NOT_NULL);
121 - for (TenantNetwork network : networks) { 121 + for (TenantNetwork network : networks) {
122 - networkIdAsKeyStore.put(network.id(), network); 122 + networkIdAsKeyStore.put(network.id(), network);
123 - if (!networkIdAsKeyStore.containsKey(network.id())) { 123 + if (!networkIdAsKeyStore.containsKey(network.id())) {
124 - log.debug("The tenantNetwork is created failed which identifier was {}", network.id() 124 + log.debug("The tenantNetwork is created failed which identifier was {}", network.id()
125 - .toString()); 125 + .toString());
126 - return false; 126 + return false;
127 - } 127 + }
128 - } 128 + }
129 - return true; 129 + return true;
130 - } 130 + }
131 - 131 +
132 - @Override 132 + @Override
133 - public boolean updateNetworks(Iterable<TenantNetwork> networks) { 133 + public boolean updateNetworks(Iterable<TenantNetwork> networks) {
134 - checkNotNull(networks, NETWORK_NOT_NULL); 134 + checkNotNull(networks, NETWORK_NOT_NULL);
135 - for (TenantNetwork network : networks) { 135 + for (TenantNetwork network : networks) {
136 - if (!networkIdAsKeyStore.containsKey(network.id())) { 136 + if (!networkIdAsKeyStore.containsKey(network.id())) {
137 - log.debug("The tenantNetwork is not exist whose identifier was {} ", 137 + log.debug("The tenantNetwork is not exist whose identifier was {} ",
138 - network.id().toString()); 138 + network.id().toString());
139 - return false; 139 + return false;
140 - } 140 + }
141 - 141 +
142 - networkIdAsKeyStore.put(network.id(), network); 142 + networkIdAsKeyStore.put(network.id(), network);
143 - 143 +
144 - if (!network.equals(networkIdAsKeyStore.get(network.id()))) { 144 + if (!network.equals(networkIdAsKeyStore.get(network.id()))) {
145 - log.debug("The tenantNetwork is updated failed whose identifier was {} ", 145 + log.debug("The tenantNetwork is updated failed whose identifier was {} ",
146 - network.id().toString()); 146 + network.id().toString());
147 - return false; 147 + return false;
148 - } 148 + }
149 - 149 +
150 - } 150 + }
151 - return true; 151 + return true;
152 - } 152 + }
153 - 153 +
154 - @Override 154 + @Override
155 - public boolean removeNetworks(Iterable<TenantNetworkId> networkIds) { 155 + public boolean removeNetworks(Iterable<TenantNetworkId> networkIds) {
156 - checkNotNull(networkIds, NETWORK_NOT_NULL); 156 + checkNotNull(networkIds, NETWORK_NOT_NULL);
157 - for (TenantNetworkId networkId : networkIds) { 157 + for (TenantNetworkId networkId : networkIds) {
158 - networkIdAsKeyStore.remove(networkId); 158 + networkIdAsKeyStore.remove(networkId);
159 - if (networkIdAsKeyStore.containsKey(networkId)) { 159 + if (networkIdAsKeyStore.containsKey(networkId)) {
160 - log.debug("The tenantNetwork is removed failed whose identifier was {}", 160 + log.debug("The tenantNetwork is removed failed whose identifier was {}",
161 - networkId.toString()); 161 + networkId.toString());
162 - return false; 162 + return false;
163 - } 163 + }
164 - } 164 + }
165 - return true; 165 + return true;
166 - } 166 + }
167 -} 167 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.vtnrsc.tunnel; 16 +package org.onosproject.vtnrsc.tunnel;
17 - 17 +
18 -import org.onosproject.vtnrsc.Subnet; 18 +import org.onosproject.vtnrsc.Subnet;
19 -import org.onosproject.vtnrsc.SubnetId; 19 +import org.onosproject.vtnrsc.SubnetId;
20 - 20 +
21 - 21 +
22 -/** 22 +/**
23 - * Service for interacting with the inventory of subnets. 23 + * Service for interacting with the inventory of subnets.
24 - */ 24 + */
25 -public interface TunnelConfigService { 25 +public interface TunnelConfigService {
26 - /** 26 + /**
27 - * Returns the subnet with the specified identifier. 27 + * Returns the subnet with the specified identifier.
28 - * 28 + *
29 - * @param subnetId subnet identifier 29 + * @param subnetId subnet identifier
30 - * @return true or false 30 + * @return true or false
31 - */ 31 + */
32 - boolean exists(SubnetId subnetId); 32 + boolean exists(SubnetId subnetId);
33 - /** 33 + /**
34 - * Returns a collection of the currently known subnets. 34 + * Returns a collection of the currently known subnets.
35 - * 35 + *
36 - * @return iterable collection of subnets 36 + * @return iterable collection of subnets
37 - */ 37 + */
38 - Iterable<Subnet> getSubnets(); 38 + Iterable<Subnet> getSubnets();
39 - 39 +
40 - /** 40 + /**
41 - * Returns the subnet with the specified identifier. 41 + * Returns the subnet with the specified identifier.
42 - * 42 + *
43 - * @param subnetId subnet identifier 43 + * @param subnetId subnet identifier
44 - * @return subnet or null if one with the given identifier is not known 44 + * @return subnet or null if one with the given identifier is not known
45 - */ 45 + */
46 - Subnet getSubnet(SubnetId subnetId); 46 + Subnet getSubnet(SubnetId subnetId);
47 - /** 47 + /**
48 - * Creates new subnets. 48 + * Creates new subnets.
49 - * 49 + *
50 - * @param subnets the iterable collection of subnets 50 + * @param subnets the iterable collection of subnets
51 - * @return true if the identifier subnet has been created right 51 + * @return true if the identifier subnet has been created right
52 - */ 52 + */
53 - boolean createSubnets(Iterable<Subnet> subnets); 53 + boolean createSubnets(Iterable<Subnet> subnets);
54 - 54 +
55 - /** 55 + /**
56 - * Updates existing subnets. 56 + * Updates existing subnets.
57 - * 57 + *
58 - * @param subnets the iterable collection of subnets 58 + * @param subnets the iterable collection of subnets
59 - * @return true if all subnets were updated successfully 59 + * @return true if all subnets were updated successfully
60 - */ 60 + */
61 - boolean updateSubnets(Iterable<Subnet> subnets); 61 + boolean updateSubnets(Iterable<Subnet> subnets);
62 - 62 +
63 - /** 63 + /**
64 - * Administratively removes the specified subnets from the store. 64 + * Administratively removes the specified subnets from the store.
65 - * 65 + *
66 - * @param subnetIds the iterable collection of subnets identifier 66 + * @param subnetIds the iterable collection of subnets identifier
67 - * @return true if remove identifier subnets successfully 67 + * @return true if remove identifier subnets successfully
68 - */ 68 + */
69 - boolean removeSubnets(Iterable<SubnetId> subnetIds); 69 + boolean removeSubnets(Iterable<SubnetId> subnetIds);
70 - 70 +
71 - 71 +
72 -} 72 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.vtnrsc.virtualport.impl; 16 +package org.onosproject.vtnrsc.virtualport.impl;
17 - 17 +
18 -import org.apache.felix.scr.annotations.Activate; 18 +import org.apache.felix.scr.annotations.Activate;
19 -import org.apache.felix.scr.annotations.Component; 19 +import org.apache.felix.scr.annotations.Component;
20 -import org.apache.felix.scr.annotations.Deactivate; 20 +import org.apache.felix.scr.annotations.Deactivate;
21 -import org.apache.felix.scr.annotations.Reference; 21 +import org.apache.felix.scr.annotations.Reference;
22 -import org.apache.felix.scr.annotations.ReferenceCardinality; 22 +import org.apache.felix.scr.annotations.ReferenceCardinality;
23 -import org.apache.felix.scr.annotations.Service; 23 +import org.apache.felix.scr.annotations.Service;
24 -import org.onlab.packet.IpAddress; 24 +import org.onlab.packet.IpAddress;
25 -import org.onosproject.core.ApplicationId; 25 +import org.onosproject.core.ApplicationId;
26 -import org.onosproject.core.CoreService; 26 +import org.onosproject.core.CoreService;
27 -import org.onosproject.net.DeviceId; 27 +import org.onosproject.net.DeviceId;
28 -import org.onosproject.store.serializers.KryoNamespaces; 28 +import org.onosproject.store.serializers.KryoNamespaces;
29 -import org.onosproject.store.service.Serializer; 29 +import org.onosproject.store.service.Serializer;
30 -import org.onosproject.store.service.StorageService; 30 +import org.onosproject.store.service.StorageService;
31 -import org.onosproject.vtnrsc.AllowedAddressPair; 31 +import org.onosproject.vtnrsc.AllowedAddressPair;
32 -import org.onosproject.vtnrsc.BindingHostId; 32 +import org.onosproject.vtnrsc.BindingHostId;
33 -import org.onosproject.vtnrsc.DefaultVirtualPort; 33 +import org.onosproject.vtnrsc.DefaultVirtualPort;
34 -import org.onosproject.vtnrsc.FixedIp; 34 +import org.onosproject.vtnrsc.FixedIp;
35 -import org.onosproject.vtnrsc.SecurityGroup; 35 +import org.onosproject.vtnrsc.SecurityGroup;
36 -import org.onosproject.vtnrsc.SubnetId; 36 +import org.onosproject.vtnrsc.SubnetId;
37 -import org.onosproject.vtnrsc.TenantId; 37 +import org.onosproject.vtnrsc.TenantId;
38 -import org.onosproject.vtnrsc.TenantNetworkId; 38 +import org.onosproject.vtnrsc.TenantNetworkId;
39 -import org.onosproject.vtnrsc.VirtualPort; 39 +import org.onosproject.vtnrsc.VirtualPort;
40 -import org.onosproject.vtnrsc.VirtualPortId; 40 +import org.onosproject.vtnrsc.VirtualPortId;
41 -import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService; 41 +import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService;
42 -import org.onosproject.vtnrsc.virtualport.VirtualPortService; 42 +import org.onosproject.vtnrsc.virtualport.VirtualPortService;
43 -import org.slf4j.Logger; 43 +import org.slf4j.Logger;
44 -import org.slf4j.LoggerFactory; 44 +import org.slf4j.LoggerFactory;
45 - 45 +
46 -import java.util.Arrays; 46 +import java.util.Arrays;
47 -import java.util.Collection; 47 +import java.util.Collection;
48 -import java.util.Collections; 48 +import java.util.Collections;
49 -import java.util.Map; 49 +import java.util.Map;
50 - 50 +
51 -import static com.google.common.base.Preconditions.checkNotNull; 51 +import static com.google.common.base.Preconditions.checkNotNull;
52 - 52 +
53 -/** 53 +/**
54 - * Provides implementation of the VirtualPort APIs. 54 + * Provides implementation of the VirtualPort APIs.
55 - */ 55 + */
56 -@Component(immediate = true) 56 +@Component(immediate = true)
57 -@Service 57 +@Service
58 -public class VirtualPortManager implements VirtualPortService { 58 +public class VirtualPortManager implements VirtualPortService {
59 - 59 +
60 - private final Logger log = LoggerFactory.getLogger(getClass()); 60 + private final Logger log = LoggerFactory.getLogger(getClass());
61 - 61 +
62 - private static final String VIRTUALPORT = "vtn-virtual-port"; 62 + private static final String VIRTUALPORT = "vtn-virtual-port";
63 - private static final String VTNRSC_APP = "org.onosproject.vtnrsc"; 63 + private static final String VTNRSC_APP = "org.onosproject.vtnrsc";
64 - 64 +
65 - private static final String VIRTUALPORT_ID_NULL = "VirtualPort ID cannot be null"; 65 + private static final String VIRTUALPORT_ID_NULL = "VirtualPort ID cannot be null";
66 - private static final String VIRTUALPORT_NOT_NULL = "VirtualPort cannot be null"; 66 + private static final String VIRTUALPORT_NOT_NULL = "VirtualPort cannot be null";
67 - private static final String TENANTID_NOT_NULL = "TenantId cannot be null"; 67 + private static final String TENANTID_NOT_NULL = "TenantId cannot be null";
68 - private static final String NETWORKID_NOT_NULL = "NetworkId cannot be null"; 68 + private static final String NETWORKID_NOT_NULL = "NetworkId cannot be null";
69 - private static final String DEVICEID_NOT_NULL = "DeviceId cannot be null"; 69 + private static final String DEVICEID_NOT_NULL = "DeviceId cannot be null";
70 - 70 +
71 - protected Map<VirtualPortId, VirtualPort> vPortStore; 71 + protected Map<VirtualPortId, VirtualPort> vPortStore;
72 - protected ApplicationId appId; 72 + protected ApplicationId appId;
73 - 73 +
74 - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 74 + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
75 - protected StorageService storageService; 75 + protected StorageService storageService;
76 - 76 +
77 - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 77 + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
78 - protected TenantNetworkService networkService; 78 + protected TenantNetworkService networkService;
79 - 79 +
80 - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 80 + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
81 - protected CoreService coreService; 81 + protected CoreService coreService;
82 - 82 +
83 - @Activate 83 + @Activate
84 - public void activate() { 84 + public void activate() {
85 - 85 +
86 - appId = coreService.registerApplication(VTNRSC_APP); 86 + appId = coreService.registerApplication(VTNRSC_APP);
87 - 87 +
88 - vPortStore = storageService.<VirtualPortId, VirtualPort>consistentMapBuilder() 88 + vPortStore = storageService.<VirtualPortId, VirtualPort>consistentMapBuilder()
89 - .withName(VIRTUALPORT) 89 + .withName(VIRTUALPORT)
90 - .withApplicationId(appId) 90 + .withApplicationId(appId)
91 - .withPurgeOnUninstall() 91 + .withPurgeOnUninstall()
92 - .withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API), 92 + .withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API),
93 - VirtualPortId.class, 93 + VirtualPortId.class,
94 - TenantNetworkId.class, 94 + TenantNetworkId.class,
95 - VirtualPort.State.class, 95 + VirtualPort.State.class,
96 - TenantId.class, 96 + TenantId.class,
97 - AllowedAddressPair.class, 97 + AllowedAddressPair.class,
98 - FixedIp.class, 98 + FixedIp.class,
99 - BindingHostId.class, 99 + BindingHostId.class,
100 - SecurityGroup.class, 100 + SecurityGroup.class,
101 - SubnetId.class, 101 + SubnetId.class,
102 - IpAddress.class, 102 + IpAddress.class,
103 - DefaultVirtualPort.class)) 103 + DefaultVirtualPort.class))
104 - .build().asJavaMap(); 104 + .build().asJavaMap();
105 - log.info("Started"); 105 + log.info("Started");
106 - } 106 + }
107 - 107 +
108 - @Deactivate 108 + @Deactivate
109 - public void deactivate() { 109 + public void deactivate() {
110 - vPortStore.clear(); 110 + vPortStore.clear();
111 - log.info("Stoppped"); 111 + log.info("Stoppped");
112 - } 112 + }
113 - 113 +
114 - @Override 114 + @Override
115 - public boolean exists(VirtualPortId vPortId) { 115 + public boolean exists(VirtualPortId vPortId) {
116 - checkNotNull(vPortId, VIRTUALPORT_ID_NULL); 116 + checkNotNull(vPortId, VIRTUALPORT_ID_NULL);
117 - return vPortStore.containsKey(vPortId); 117 + return vPortStore.containsKey(vPortId);
118 - } 118 + }
119 - 119 +
120 - @Override 120 + @Override
121 - public VirtualPort getPort(VirtualPortId vPortId) { 121 + public VirtualPort getPort(VirtualPortId vPortId) {
122 - checkNotNull(vPortId, VIRTUALPORT_ID_NULL); 122 + checkNotNull(vPortId, VIRTUALPORT_ID_NULL);
123 - return vPortStore.get(vPortId); 123 + return vPortStore.get(vPortId);
124 - } 124 + }
125 - 125 +
126 - @Override 126 + @Override
127 - public Collection<VirtualPort> getPorts() { 127 + public Collection<VirtualPort> getPorts() {
128 - return Collections.unmodifiableCollection(vPortStore.values()); 128 + return Collections.unmodifiableCollection(vPortStore.values());
129 - } 129 + }
130 - 130 +
131 - @Override 131 + @Override
132 - public Collection<VirtualPort> getPorts(TenantNetworkId networkId) { 132 + public Collection<VirtualPort> getPorts(TenantNetworkId networkId) {
133 - checkNotNull(networkId, NETWORKID_NOT_NULL); 133 + checkNotNull(networkId, NETWORKID_NOT_NULL);
134 - Collection<VirtualPort> vPortWithNetworkIds = vPortStore.values(); 134 + Collection<VirtualPort> vPortWithNetworkIds = vPortStore.values();
135 - for (VirtualPort vPort : vPortWithNetworkIds) { 135 + for (VirtualPort vPort : vPortWithNetworkIds) {
136 - if (!vPort.networkId().equals(networkId)) { 136 + if (!vPort.networkId().equals(networkId)) {
137 - vPortWithNetworkIds.remove(vPort); 137 + vPortWithNetworkIds.remove(vPort);
138 - } 138 + }
139 - } 139 + }
140 - return vPortWithNetworkIds; 140 + return vPortWithNetworkIds;
141 - } 141 + }
142 - 142 +
143 - @Override 143 + @Override
144 - public Collection<VirtualPort> getPorts(TenantId tenantId) { 144 + public Collection<VirtualPort> getPorts(TenantId tenantId) {
145 - checkNotNull(tenantId, TENANTID_NOT_NULL); 145 + checkNotNull(tenantId, TENANTID_NOT_NULL);
146 - Collection<VirtualPort> vPortWithTenantIds = vPortStore.values(); 146 + Collection<VirtualPort> vPortWithTenantIds = vPortStore.values();
147 - for (VirtualPort vPort : vPortWithTenantIds) { 147 + for (VirtualPort vPort : vPortWithTenantIds) {
148 - if (!vPort.tenantId().equals(tenantId)) { 148 + if (!vPort.tenantId().equals(tenantId)) {
149 - vPortWithTenantIds.remove(vPort); 149 + vPortWithTenantIds.remove(vPort);
150 - } 150 + }
151 - } 151 + }
152 - return vPortWithTenantIds; 152 + return vPortWithTenantIds;
153 - } 153 + }
154 - 154 +
155 - @Override 155 + @Override
156 - public Collection<VirtualPort> getPorts(DeviceId deviceId) { 156 + public Collection<VirtualPort> getPorts(DeviceId deviceId) {
157 - checkNotNull(deviceId, DEVICEID_NOT_NULL); 157 + checkNotNull(deviceId, DEVICEID_NOT_NULL);
158 - Collection<VirtualPort> vPortWithDeviceIds = vPortStore.values(); 158 + Collection<VirtualPort> vPortWithDeviceIds = vPortStore.values();
159 - for (VirtualPort vPort : vPortWithDeviceIds) { 159 + for (VirtualPort vPort : vPortWithDeviceIds) {
160 - if (!vPort.deviceId().equals(deviceId)) { 160 + if (!vPort.deviceId().equals(deviceId)) {
161 - vPortWithDeviceIds.remove(vPort); 161 + vPortWithDeviceIds.remove(vPort);
162 - } 162 + }
163 - } 163 + }
164 - return vPortWithDeviceIds; 164 + return vPortWithDeviceIds;
165 - } 165 + }
166 - 166 +
167 - @Override 167 + @Override
168 - public boolean createPorts(Iterable<VirtualPort> vPorts) { 168 + public boolean createPorts(Iterable<VirtualPort> vPorts) {
169 - checkNotNull(vPorts, VIRTUALPORT_NOT_NULL); 169 + checkNotNull(vPorts, VIRTUALPORT_NOT_NULL);
170 - for (VirtualPort vPort : vPorts) { 170 + for (VirtualPort vPort : vPorts) {
171 - log.debug("vPortId is {} ", vPort.portId().toString()); 171 + log.debug("vPortId is {} ", vPort.portId().toString());
172 - vPortStore.put(vPort.portId(), vPort); 172 + vPortStore.put(vPort.portId(), vPort);
173 - if (!vPortStore.containsKey(vPort.portId())) { 173 + if (!vPortStore.containsKey(vPort.portId())) {
174 - log.debug("The virtualPort is created failed whose identifier is {} ", 174 + log.debug("The virtualPort is created failed whose identifier is {} ",
175 - vPort.portId().toString()); 175 + vPort.portId().toString());
176 - return false; 176 + return false;
177 - } 177 + }
178 - } 178 + }
179 - return true; 179 + return true;
180 - } 180 + }
181 - 181 +
182 - @Override 182 + @Override
183 - public boolean updatePorts(Iterable<VirtualPort> vPorts) { 183 + public boolean updatePorts(Iterable<VirtualPort> vPorts) {
184 - checkNotNull(vPorts, VIRTUALPORT_NOT_NULL); 184 + checkNotNull(vPorts, VIRTUALPORT_NOT_NULL);
185 - if (vPorts != null) { 185 + if (vPorts != null) {
186 - for (VirtualPort vPort : vPorts) { 186 + for (VirtualPort vPort : vPorts) {
187 - vPortStore.put(vPort.portId(), vPort); 187 + vPortStore.put(vPort.portId(), vPort);
188 - if (!vPortStore.containsKey(vPort.portId())) { 188 + if (!vPortStore.containsKey(vPort.portId())) {
189 - log.debug("The virtualPort is not exist whose identifier is {}", 189 + log.debug("The virtualPort is not exist whose identifier is {}",
190 - vPort.portId().toString()); 190 + vPort.portId().toString());
191 - return false; 191 + return false;
192 - } 192 + }
193 - 193 +
194 - vPortStore.put(vPort.portId(), vPort); 194 + vPortStore.put(vPort.portId(), vPort);
195 - 195 +
196 - if (!vPort.equals(vPortStore.get(vPort.portId()))) { 196 + if (!vPort.equals(vPortStore.get(vPort.portId()))) {
197 - log.debug("The virtualPort is updated failed whose identifier is {}", 197 + log.debug("The virtualPort is updated failed whose identifier is {}",
198 - vPort.portId().toString()); 198 + vPort.portId().toString());
199 - return false; 199 + return false;
200 - } 200 + }
201 - } 201 + }
202 - } 202 + }
203 - return true; 203 + return true;
204 - } 204 + }
205 - 205 +
206 - @Override 206 + @Override
207 - public boolean removePorts(Iterable<VirtualPortId> vPortIds) { 207 + public boolean removePorts(Iterable<VirtualPortId> vPortIds) {
208 - checkNotNull(vPortIds, VIRTUALPORT_ID_NULL); 208 + checkNotNull(vPortIds, VIRTUALPORT_ID_NULL);
209 - if (vPortIds != null) { 209 + if (vPortIds != null) {
210 - for (VirtualPortId vPortId : vPortIds) { 210 + for (VirtualPortId vPortId : vPortIds) {
211 - vPortStore.remove(vPortId); 211 + vPortStore.remove(vPortId);
212 - if (vPortStore.containsKey(vPortId)) { 212 + if (vPortStore.containsKey(vPortId)) {
213 - log.debug("The virtualPort is removed failed whose identifier is {}", 213 + log.debug("The virtualPort is removed failed whose identifier is {}",
214 - vPortId.toString()); 214 + vPortId.toString());
215 - return false; 215 + return false;
216 - } 216 + }
217 - } 217 + }
218 - } 218 + }
219 - return true; 219 + return true;
220 - } 220 + }
221 - 221 +
222 -} 222 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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.vtnrsc.AllocationPool; 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 +
26 -/** 26 +/**
27 - * Subnet AllocationPool codec. 27 + * Subnet AllocationPool codec.
28 - */ 28 + */
29 -public final class AllocationPoolsCodec extends JsonCodec<AllocationPool> { 29 +public final class AllocationPoolsCodec extends JsonCodec<AllocationPool> {
30 - 30 +
31 - @Override 31 + @Override
32 - public ObjectNode encode(AllocationPool alocPool, CodecContext context) { 32 + public ObjectNode encode(AllocationPool alocPool, CodecContext context) {
33 - checkNotNull(alocPool, "AllocationPools cannot be null"); 33 + checkNotNull(alocPool, "AllocationPools cannot be null");
34 - ObjectNode result = context.mapper().createObjectNode() 34 + ObjectNode result = context.mapper().createObjectNode()
35 - .put("start", alocPool.startIp().toString()) 35 + .put("start", alocPool.startIp().toString())
36 - .put("end", alocPool.endIp().toString()); 36 + .put("end", alocPool.endIp().toString());
37 - return result; 37 + return result;
38 - } 38 + }
39 - 39 +
40 -} 40 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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.vtnrsc.AllowedAddressPair; 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 +
26 -/** 26 +/**
27 - * VirtualPort AllowedAddressPair codec. 27 + * VirtualPort AllowedAddressPair codec.
28 - */ 28 + */
29 -public final class AllowedAddressPairCodec extends JsonCodec<AllowedAddressPair> { 29 +public final class AllowedAddressPairCodec extends JsonCodec<AllowedAddressPair> {
30 - 30 +
31 - @Override 31 + @Override
32 - public ObjectNode encode(AllowedAddressPair alocAddPair, CodecContext context) { 32 + public ObjectNode encode(AllowedAddressPair alocAddPair, CodecContext context) {
33 - checkNotNull(alocAddPair, "AllowedAddressPair cannot be null"); 33 + checkNotNull(alocAddPair, "AllowedAddressPair cannot be null");
34 - ObjectNode result = context.mapper().createObjectNode() 34 + ObjectNode result = context.mapper().createObjectNode()
35 - .put("ip_address", alocAddPair.ip().toString()) 35 + .put("ip_address", alocAddPair.ip().toString())
36 - .put("mac_address", alocAddPair.mac().toString()); 36 + .put("mac_address", alocAddPair.mac().toString());
37 - return result; 37 + return result;
38 - } 38 + }
39 - 39 +
40 -} 40 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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.vtnrsc.FixedIp; 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 +
26 -/** 26 +/**
27 - * VirtualPort FixedIp codec. 27 + * VirtualPort FixedIp codec.
28 - */ 28 + */
29 -public final class FixedIpCodec extends JsonCodec<FixedIp> { 29 +public final class FixedIpCodec extends JsonCodec<FixedIp> {
30 - 30 +
31 - @Override 31 + @Override
32 - public ObjectNode encode(FixedIp fixIp, CodecContext context) { 32 + public ObjectNode encode(FixedIp fixIp, CodecContext context) {
33 - checkNotNull(fixIp, "FixedIp cannot be null"); 33 + checkNotNull(fixIp, "FixedIp cannot be null");
34 - ObjectNode result = context.mapper().createObjectNode() 34 + ObjectNode result = context.mapper().createObjectNode()
35 - .put("subnet_id", fixIp.subnetId().toString()) 35 + .put("subnet_id", fixIp.subnetId().toString())
36 - .put("ip_address", fixIp.ip().toString()); 36 + .put("ip_address", fixIp.ip().toString());
37 - return result; 37 + return result;
38 - } 38 + }
39 - 39 +
40 -} 40 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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.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 +
26 -/** 26 +/**
27 - * Subnet HostRoute codec. 27 + * Subnet HostRoute codec.
28 - */ 28 + */
29 -public final class HostRoutesCodec extends JsonCodec<HostRoute> { 29 +public final class HostRoutesCodec extends JsonCodec<HostRoute> {
30 - 30 +
31 - @Override 31 + @Override
32 - public ObjectNode encode(HostRoute hostRoute, CodecContext context) { 32 + public ObjectNode encode(HostRoute hostRoute, CodecContext context) {
33 - checkNotNull(hostRoute, "HostRoute cannot be null"); 33 + checkNotNull(hostRoute, "HostRoute cannot be null");
34 - ObjectNode result = context.mapper().createObjectNode() 34 + ObjectNode result = context.mapper().createObjectNode()
35 - .put("nexthop", hostRoute.nexthop().toString()) 35 + .put("nexthop", hostRoute.nexthop().toString())
36 - .put("destination", hostRoute.destination().toString()); 36 + .put("destination", hostRoute.destination().toString());
37 - return result; 37 + return result;
38 - } 38 + }
39 - 39 +
40 -} 40 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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.vtnrsc.SecurityGroup; 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 +
26 -/** 26 +/**
27 - * Virtualport SecurityGroup codec. 27 + * Virtualport SecurityGroup codec.
28 - */ 28 + */
29 -public final class SecurityGroupCodec extends JsonCodec<SecurityGroup> { 29 +public final class SecurityGroupCodec extends JsonCodec<SecurityGroup> {
30 - 30 +
31 - @Override 31 + @Override
32 - public ObjectNode encode(SecurityGroup securGroup, CodecContext context) { 32 + public ObjectNode encode(SecurityGroup securGroup, CodecContext context) {
33 - checkNotNull(securGroup, "SecurityGroup cannot be null"); 33 + checkNotNull(securGroup, "SecurityGroup cannot be null");
34 - ObjectNode result = context.mapper().createObjectNode() 34 + ObjectNode result = context.mapper().createObjectNode()
35 - .put("security_group", securGroup.securityGroup()); 35 + .put("security_group", securGroup.securityGroup());
36 - return result; 36 + return result;
37 - } 37 + }
38 - 38 +
39 -} 39 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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.vtnrsc.Subnet; 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 +
26 -/** 26 +/**
27 - * Subnet JSON codec. 27 + * Subnet JSON codec.
28 - */ 28 + */
29 -public final class SubnetCodec extends JsonCodec<Subnet> { 29 +public final class SubnetCodec extends JsonCodec<Subnet> {
30 - @Override 30 + @Override
31 - public ObjectNode encode(Subnet subnet, CodecContext context) { 31 + public ObjectNode encode(Subnet subnet, CodecContext context) {
32 - checkNotNull(subnet, "Subnet cannot be null"); 32 + checkNotNull(subnet, "Subnet cannot be null");
33 - ObjectNode result = context.mapper().createObjectNode() 33 + ObjectNode result = context.mapper().createObjectNode()
34 - .put("id", subnet.id().toString()) 34 + .put("id", subnet.id().toString())
35 - .put("gateway_ip", subnet.gatewayIp().toString()) 35 + .put("gateway_ip", subnet.gatewayIp().toString())
36 - .put("network_id", subnet.networkId().toString()) 36 + .put("network_id", subnet.networkId().toString())
37 - .put("name", subnet.subnetName()) 37 + .put("name", subnet.subnetName())
38 - .put("ip_version", subnet.ipVersion().toString()) 38 + .put("ip_version", subnet.ipVersion().toString())
39 - .put("cidr", subnet.cidr().toString()) 39 + .put("cidr", subnet.cidr().toString())
40 - .put("shared", subnet.shared()) 40 + .put("shared", subnet.shared())
41 - .put("enabled_dchp", subnet.dhcpEnabled()) 41 + .put("enabled_dchp", subnet.dhcpEnabled())
42 - .put("tenant_id", subnet.tenantId().toString()) 42 + .put("tenant_id", subnet.tenantId().toString())
43 - .put("ipv6_address_mode", subnet.ipV6AddressMode() == null ? null 43 + .put("ipv6_address_mode", subnet.ipV6AddressMode() == null ? null
44 - : subnet.ipV6AddressMode().toString()) 44 + : subnet.ipV6AddressMode().toString())
45 - .put("ipv6_ra_mode", subnet.ipV6RaMode() == null ? null 45 + .put("ipv6_ra_mode", subnet.ipV6RaMode() == null ? null
46 - : subnet.ipV6RaMode().toString()); 46 + : subnet.ipV6RaMode().toString());
47 - result.set("allocation_pools", new AllocationPoolsCodec().encode(subnet 47 + result.set("allocation_pools", new AllocationPoolsCodec().encode(subnet
48 - .allocationPools(), context)); 48 + .allocationPools(), context));
49 - result.set("host_routes", 49 + result.set("host_routes",
50 - new HostRoutesCodec().encode(subnet.hostRoutes(), context)); 50 + new HostRoutesCodec().encode(subnet.hostRoutes(), context));
51 - return result; 51 + return result;
52 - } 52 + }
53 -} 53 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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.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 +
26 -/** 26 +/**
27 - * TenantNetwork JSON codec. 27 + * TenantNetwork JSON codec.
28 - */ 28 + */
29 -public final class TenantNetworkCodec extends JsonCodec<TenantNetwork> { 29 +public final class TenantNetworkCodec extends JsonCodec<TenantNetwork> {
30 - 30 +
31 - @Override 31 + @Override
32 - public ObjectNode encode(TenantNetwork network, CodecContext context) { 32 + public ObjectNode encode(TenantNetwork network, CodecContext context) {
33 - checkNotNull(network, "Network cannot be null"); 33 + checkNotNull(network, "Network cannot be null");
34 - ObjectNode result = context.mapper().createObjectNode() 34 + ObjectNode result = context.mapper().createObjectNode()
35 - .put("id", network.id().toString()) 35 + .put("id", network.id().toString())
36 - .put("name", network.name()) 36 + .put("name", network.name())
37 - .put("admin_state_up", network.adminStateUp()) 37 + .put("admin_state_up", network.adminStateUp())
38 - .put("status", "" + network.state()) 38 + .put("status", "" + network.state())
39 - .put("shared", network.shared()) 39 + .put("shared", network.shared())
40 - .put("tenant_id", network.tenantId().toString()) 40 + .put("tenant_id", network.tenantId().toString())
41 - .put("router:external", network.routerExternal()) 41 + .put("router:external", network.routerExternal())
42 - .put("provider:network_type", "" + network.type()) 42 + .put("provider:network_type", "" + network.type())
43 - .put("provider:physical_network", network.physicalNetwork().toString()) 43 + .put("provider:physical_network", network.physicalNetwork().toString())
44 - .put("provider:segmentation_id", network.segmentationId().toString()); 44 + .put("provider:segmentation_id", network.segmentationId().toString());
45 - return result; 45 + return result;
46 - } 46 + }
47 -} 47 +}
......
1 -/* 1 +/*
2 - * Copyright 2015 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.
6 - * You may obtain a copy of the License at 6 + * You may obtain a copy of the License at
7 - * 7 + *
8 - * http://www.apache.org/licenses/LICENSE-2.0 8 + * http://www.apache.org/licenses/LICENSE-2.0
9 - * 9 + *
10 - * Unless required by applicable law or agreed to in writing, software 10 + * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, 11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.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.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 +
26 -/** 26 +/**
27 - * VirtualPort JSON codec. 27 + * VirtualPort JSON codec.
28 - */ 28 + */
29 -public final class VirtualPortCodec extends JsonCodec<VirtualPort> { 29 +public final class VirtualPortCodec extends JsonCodec<VirtualPort> {
30 - @Override 30 + @Override
31 - public ObjectNode encode(VirtualPort vPort, CodecContext context) { 31 + public ObjectNode encode(VirtualPort vPort, CodecContext context) {
32 - checkNotNull(vPort, "VPort cannot be null"); 32 + checkNotNull(vPort, "VPort cannot be null");
33 - ObjectNode result = context 33 + ObjectNode result = context
34 - .mapper() 34 + .mapper()
35 - .createObjectNode() 35 + .createObjectNode()
36 - .put("id", vPort.portId().toString()) 36 + .put("id", vPort.portId().toString())
37 - .put("network_id", vPort.networkId().toString()) 37 + .put("network_id", vPort.networkId().toString())
38 - .put("admin_state_up", vPort.adminStateUp()) 38 + .put("admin_state_up", vPort.adminStateUp())
39 - .put("name", vPort.name()) 39 + .put("name", vPort.name())
40 - .put("status", vPort.state().toString()) 40 + .put("status", vPort.state().toString())
41 - .put("mac_address", vPort.macAddress().toString()) 41 + .put("mac_address", vPort.macAddress().toString())
42 - .put("tenant_id", vPort.tenantId().toString()) 42 + .put("tenant_id", vPort.tenantId().toString())
43 - .put("device_id", vPort.deviceId().toString()) 43 + .put("device_id", vPort.deviceId().toString())
44 - .put("device_owner", vPort.deviceOwner()) 44 + .put("device_owner", vPort.deviceOwner())
45 - .put("binding:vnic_type", vPort.bindingVnicType()) 45 + .put("binding:vnic_type", vPort.bindingVnicType())
46 - .put("binding:Vif_type", vPort.bindingVifType()) 46 + .put("binding:Vif_type", vPort.bindingVifType())
47 - .put("binding:host_id", vPort.bindingHostId().toString()) 47 + .put("binding:host_id", vPort.bindingHostId().toString())
48 - .put("binding:vif_details", vPort.bindingVifDetails()); 48 + .put("binding:vif_details", vPort.bindingVifDetails());
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));
51 - result.set("fixed_ips", new FixedIpCodec().encode( 51 + result.set("fixed_ips", new FixedIpCodec().encode(
52 - vPort.fixedIps(), context)); 52 + vPort.fixedIps(), context));
53 - result.set("security_groups", new SecurityGroupCodec().encode( 53 + result.set("security_groups", new SecurityGroupCodec().encode(
54 - vPort.securityGroups(), context)); 54 + vPort.securityGroups(), context));
55 - return result; 55 + return result;
56 - } 56 + }
57 -} 57 +}
......