Committed by
Gerrit Code Review
Fix files with windows line endings + Add checkstyle rule to catch this issue
Change-Id: Ic1905f2121c5c2ab66259f7f531c1e36fe58e9d4
Showing
39 changed files
with
4611 additions
and
4605 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.iptopology.api; | 16 | +package org.onosproject.iptopology.api; |
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 | - * Area identifier class (32 Bit Area-ID). | 23 | + * Area identifier class (32 Bit Area-ID). |
24 | - */ | 24 | + */ |
25 | -public class AreaId { | 25 | +public class AreaId { |
26 | - private final int areaId; | 26 | + private final int areaId; |
27 | - | 27 | + |
28 | - /** | 28 | + /** |
29 | - * Constructor to set area identifier. | 29 | + * Constructor to set area identifier. |
30 | - * | 30 | + * |
31 | - * @param areaId area id | 31 | + * @param areaId area id |
32 | - */ | 32 | + */ |
33 | - public AreaId(int areaId) { | 33 | + public AreaId(int areaId) { |
34 | - this.areaId = areaId; | 34 | + this.areaId = areaId; |
35 | - } | 35 | + } |
36 | - | 36 | + |
37 | - /** | 37 | + /** |
38 | - * obtain area identifier. | 38 | + * obtain area identifier. |
39 | - * | 39 | + * |
40 | - * @return area identifier | 40 | + * @return area identifier |
41 | - */ | 41 | + */ |
42 | - public int areaId() { | 42 | + public int areaId() { |
43 | - return areaId; | 43 | + return areaId; |
44 | - } | 44 | + } |
45 | - | 45 | + |
46 | - @Override | 46 | + @Override |
47 | - public int hashCode() { | 47 | + public int hashCode() { |
48 | - return Objects.hash(areaId); | 48 | + return Objects.hash(areaId); |
49 | - } | 49 | + } |
50 | - | 50 | + |
51 | - @Override | 51 | + @Override |
52 | - public boolean equals(Object obj) { | 52 | + public boolean equals(Object obj) { |
53 | - if (this == obj) { | 53 | + if (this == obj) { |
54 | - return true; | 54 | + return true; |
55 | - } | 55 | + } |
56 | - | 56 | + |
57 | - if (obj instanceof AreaId) { | 57 | + if (obj instanceof AreaId) { |
58 | - AreaId other = (AreaId) obj; | 58 | + AreaId other = (AreaId) obj; |
59 | - return Objects.equals(areaId, other.areaId); | 59 | + return Objects.equals(areaId, other.areaId); |
60 | - } | 60 | + } |
61 | - return false; | 61 | + return false; |
62 | - } | 62 | + } |
63 | - | 63 | + |
64 | - @Override | 64 | + @Override |
65 | - public String toString() { | 65 | + public String toString() { |
66 | - return toStringHelper(this) | 66 | + return toStringHelper(this) |
67 | - .add("areaId", areaId) | 67 | + .add("areaId", areaId) |
68 | - .toString(); | 68 | + .toString(); |
69 | - } | 69 | + } |
70 | } | 70 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
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.iptopology.api; | 16 | +package org.onosproject.iptopology.api; |
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 | - * Autonomous system Number class (32 Bit ASNumber). | 23 | + * Autonomous system Number class (32 Bit ASNumber). |
24 | - */ | 24 | + */ |
25 | -public class AsNumber { | 25 | +public class AsNumber { |
26 | - private final int asNum; | 26 | + private final int asNum; |
27 | - | 27 | + |
28 | - /** | 28 | + /** |
29 | - * Constructor to set As number. | 29 | + * Constructor to set As number. |
30 | - * | 30 | + * |
31 | - * @param asNum As number | 31 | + * @param asNum As number |
32 | - */ | 32 | + */ |
33 | - public AsNumber(int asNum) { | 33 | + public AsNumber(int asNum) { |
34 | - this.asNum = asNum; | 34 | + this.asNum = asNum; |
35 | - } | 35 | + } |
36 | - | 36 | + |
37 | - /** | 37 | + /** |
38 | - * Obtain autonomous system number. | 38 | + * Obtain autonomous system number. |
39 | - * | 39 | + * |
40 | - * @return autonomous system number | 40 | + * @return autonomous system number |
41 | - */ | 41 | + */ |
42 | - public int asNum() { | 42 | + public int asNum() { |
43 | - return asNum; | 43 | + return asNum; |
44 | - } | 44 | + } |
45 | - | 45 | + |
46 | - @Override | 46 | + @Override |
47 | - public int hashCode() { | 47 | + public int hashCode() { |
48 | - return Objects.hash(asNum); | 48 | + return Objects.hash(asNum); |
49 | - } | 49 | + } |
50 | - | 50 | + |
51 | - @Override | 51 | + @Override |
52 | - public boolean equals(Object obj) { | 52 | + public boolean equals(Object obj) { |
53 | - if (this == obj) { | 53 | + if (this == obj) { |
54 | - return true; | 54 | + return true; |
55 | - } | 55 | + } |
56 | - | 56 | + |
57 | - if (obj instanceof AsNumber) { | 57 | + if (obj instanceof AsNumber) { |
58 | - AsNumber other = (AsNumber) obj; | 58 | + AsNumber other = (AsNumber) obj; |
59 | - return Objects.equals(asNum, other.asNum); | 59 | + return Objects.equals(asNum, other.asNum); |
60 | - } | 60 | + } |
61 | - return false; | 61 | + return false; |
62 | - } | 62 | + } |
63 | - | 63 | + |
64 | - @Override | 64 | + @Override |
65 | - public String toString() { | 65 | + public String toString() { |
66 | - return toStringHelper(this) | 66 | + return toStringHelper(this) |
67 | - .add("asNum", asNum) | 67 | + .add("asNum", asNum) |
68 | - .toString(); | 68 | + .toString(); |
69 | - } | 69 | + } |
70 | } | 70 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
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.iptopology.api; | 16 | +package org.onosproject.iptopology.api; |
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.onosproject.net.Element; | 22 | +import org.onosproject.net.Element; |
23 | - | 23 | + |
24 | -/** | 24 | +/** |
25 | - * Default Device interface implementation. | 25 | + * Default Device interface implementation. |
26 | - */ | 26 | + */ |
27 | -public class DefaultDeviceIntf implements DeviceIntf { | 27 | +public class DefaultDeviceIntf implements DeviceIntf { |
28 | - | 28 | + |
29 | - private final Element element; | 29 | + private final Element element; |
30 | - private final DeviceInterface deviceInterface; | 30 | + private final DeviceInterface deviceInterface; |
31 | - | 31 | + |
32 | - /** | 32 | + /** |
33 | - * Constructor to initialize device interface parameters. | 33 | + * Constructor to initialize device interface parameters. |
34 | - * | 34 | + * |
35 | - * @param element parent network element | 35 | + * @param element parent network element |
36 | - * @param deviceInterface device interface | 36 | + * @param deviceInterface device interface |
37 | - */ | 37 | + */ |
38 | - public DefaultDeviceIntf(Element element, DeviceInterface deviceInterface) { | 38 | + public DefaultDeviceIntf(Element element, DeviceInterface deviceInterface) { |
39 | - this.element = element; | 39 | + this.element = element; |
40 | - this.deviceInterface = deviceInterface; | 40 | + this.deviceInterface = deviceInterface; |
41 | - } | 41 | + } |
42 | - | 42 | + |
43 | - @Override | 43 | + @Override |
44 | - public Element element() { | 44 | + public Element element() { |
45 | - return element; | 45 | + return element; |
46 | - } | 46 | + } |
47 | - | 47 | + |
48 | - @Override | 48 | + @Override |
49 | - public DeviceInterface deviceInterface() { | 49 | + public DeviceInterface deviceInterface() { |
50 | - return deviceInterface; | 50 | + return deviceInterface; |
51 | - } | 51 | + } |
52 | - | 52 | + |
53 | - @Override | 53 | + @Override |
54 | - public int hashCode() { | 54 | + public int hashCode() { |
55 | - return Objects.hash(element, deviceInterface); | 55 | + return Objects.hash(element, deviceInterface); |
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 | - | 63 | + |
64 | - if (obj instanceof DefaultDeviceIntf) { | 64 | + if (obj instanceof DefaultDeviceIntf) { |
65 | - final DefaultDeviceIntf other = (DefaultDeviceIntf) obj; | 65 | + final DefaultDeviceIntf other = (DefaultDeviceIntf) obj; |
66 | - return Objects.equals(this.element.id(), other.element.id()) | 66 | + return Objects.equals(this.element.id(), other.element.id()) |
67 | - && Objects.equals(this.deviceInterface, other.deviceInterface); | 67 | + && Objects.equals(this.deviceInterface, other.deviceInterface); |
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 toStringHelper(this) | 74 | + return toStringHelper(this) |
75 | - .add("element", element.id()) | 75 | + .add("element", element.id()) |
76 | - .add("deviceInterface", deviceInterface) | 76 | + .add("deviceInterface", deviceInterface) |
77 | - .toString(); | 77 | + .toString(); |
78 | - } | 78 | + } |
79 | } | 79 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
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.iptopology.api; | 16 | +package org.onosproject.iptopology.api; |
17 | - | 17 | + |
18 | -import org.onosproject.net.AbstractAnnotated; | 18 | +import org.onosproject.net.AbstractAnnotated; |
19 | -import org.onosproject.net.Annotations; | 19 | +import org.onosproject.net.Annotations; |
20 | -import org.onosproject.net.Element; | 20 | +import org.onosproject.net.Element; |
21 | - | 21 | + |
22 | -import java.util.Objects; | 22 | +import java.util.Objects; |
23 | - | 23 | + |
24 | -import static com.google.common.base.MoreObjects.toStringHelper; | 24 | +import static com.google.common.base.MoreObjects.toStringHelper; |
25 | - | 25 | + |
26 | -/** | 26 | +/** |
27 | - * Default Device prefix implementation. | 27 | + * Default Device prefix implementation. |
28 | - */ | 28 | + */ |
29 | -public class DefaultDevicePrefix extends AbstractAnnotated implements DevicePrefix { | 29 | +public class DefaultDevicePrefix extends AbstractAnnotated implements DevicePrefix { |
30 | - | 30 | + |
31 | - private final Element element; | 31 | + private final Element element; |
32 | - private final PrefixIdentifier prefixIdentifier; | 32 | + private final PrefixIdentifier prefixIdentifier; |
33 | - private final PrefixTed prefixTed; | 33 | + private final PrefixTed prefixTed; |
34 | - | 34 | + |
35 | - /** | 35 | + /** |
36 | - * Creates a network device prefix attributed to the specified element. | 36 | + * Creates a network device prefix attributed to the specified element. |
37 | - * | 37 | + * |
38 | - * @param element parent network element | 38 | + * @param element parent network element |
39 | - * @param prefixIdentifier prefix identifier | 39 | + * @param prefixIdentifier prefix identifier |
40 | - * @param prefixTed prefid traffic engineering parameters | 40 | + * @param prefixTed prefid traffic engineering parameters |
41 | - * @param annotations optional key/value annotations | 41 | + * @param annotations optional key/value annotations |
42 | - */ | 42 | + */ |
43 | - public DefaultDevicePrefix(Element element, PrefixIdentifier prefixIdentifier, | 43 | + public DefaultDevicePrefix(Element element, PrefixIdentifier prefixIdentifier, |
44 | - PrefixTed prefixTed, Annotations... annotations) { | 44 | + PrefixTed prefixTed, Annotations... annotations) { |
45 | - super(annotations); | 45 | + super(annotations); |
46 | - this.element = element; | 46 | + this.element = element; |
47 | - this.prefixIdentifier = prefixIdentifier; | 47 | + this.prefixIdentifier = prefixIdentifier; |
48 | - this.prefixTed = prefixTed; | 48 | + this.prefixTed = prefixTed; |
49 | - } | 49 | + } |
50 | - | 50 | + |
51 | - @Override | 51 | + @Override |
52 | - public Element element() { | 52 | + public Element element() { |
53 | - return element; | 53 | + return element; |
54 | - } | 54 | + } |
55 | - | 55 | + |
56 | - @Override | 56 | + @Override |
57 | - public PrefixIdentifier prefixIdentifier() { | 57 | + public PrefixIdentifier prefixIdentifier() { |
58 | - return prefixIdentifier; | 58 | + return prefixIdentifier; |
59 | - } | 59 | + } |
60 | - | 60 | + |
61 | - @Override | 61 | + @Override |
62 | - public PrefixTed prefixTed() { | 62 | + public PrefixTed prefixTed() { |
63 | - return prefixTed; | 63 | + return prefixTed; |
64 | - } | 64 | + } |
65 | - | 65 | + |
66 | - @Override | 66 | + @Override |
67 | - public int hashCode() { | 67 | + public int hashCode() { |
68 | - return Objects.hash(element, prefixIdentifier, prefixTed); | 68 | + return Objects.hash(element, prefixIdentifier, prefixTed); |
69 | - } | 69 | + } |
70 | - | 70 | + |
71 | - @Override | 71 | + @Override |
72 | - public boolean equals(Object obj) { | 72 | + public boolean equals(Object obj) { |
73 | - if (this == obj) { | 73 | + if (this == obj) { |
74 | - return true; | 74 | + return true; |
75 | - } | 75 | + } |
76 | - if (obj instanceof DefaultDevicePrefix) { | 76 | + if (obj instanceof DefaultDevicePrefix) { |
77 | - final DefaultDevicePrefix other = (DefaultDevicePrefix) obj; | 77 | + final DefaultDevicePrefix other = (DefaultDevicePrefix) obj; |
78 | - return Objects.equals(this.element.id(), other.element.id()) && | 78 | + return Objects.equals(this.element.id(), other.element.id()) && |
79 | - Objects.equals(this.prefixIdentifier, other.prefixIdentifier) && | 79 | + Objects.equals(this.prefixIdentifier, other.prefixIdentifier) && |
80 | - Objects.equals(this.prefixTed, other.prefixTed) && | 80 | + Objects.equals(this.prefixTed, other.prefixTed) && |
81 | - Objects.equals(this.annotations(), other.annotations()); | 81 | + Objects.equals(this.annotations(), other.annotations()); |
82 | - } | 82 | + } |
83 | - return false; | 83 | + return false; |
84 | - } | 84 | + } |
85 | - | 85 | + |
86 | - @Override | 86 | + @Override |
87 | - public String toString() { | 87 | + public String toString() { |
88 | - return toStringHelper(this) | 88 | + return toStringHelper(this) |
89 | - .omitNullValues() | 89 | + .omitNullValues() |
90 | - .add("element", element.id()) | 90 | + .add("element", element.id()) |
91 | - .add("prefixIdentifier", prefixIdentifier) | 91 | + .add("prefixIdentifier", prefixIdentifier) |
92 | - .add("prefixTed", prefixTed) | 92 | + .add("prefixTed", prefixTed) |
93 | - .toString(); | 93 | + .toString(); |
94 | - } | 94 | + } |
95 | } | 95 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
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.iptopology.api; | 16 | +package org.onosproject.iptopology.api; |
17 | - | 17 | + |
18 | -import org.onosproject.net.AbstractElement; | 18 | +import org.onosproject.net.AbstractElement; |
19 | -import org.onosproject.net.Annotations; | 19 | +import org.onosproject.net.Annotations; |
20 | -import org.onosproject.net.DeviceId; | 20 | +import org.onosproject.net.DeviceId; |
21 | -import org.onosproject.net.provider.ProviderId; | 21 | +import org.onosproject.net.provider.ProviderId; |
22 | - | 22 | + |
23 | -import java.util.Objects; | 23 | +import java.util.Objects; |
24 | - | 24 | + |
25 | -import static com.google.common.base.MoreObjects.toStringHelper; | 25 | +import static com.google.common.base.MoreObjects.toStringHelper; |
26 | - | 26 | + |
27 | -/** | 27 | +/** |
28 | - * Default ip device model implementation. | 28 | + * Default ip device model implementation. |
29 | - */ | 29 | + */ |
30 | -public class DefaultIpDevice extends AbstractElement implements IpDevice { | 30 | +public class DefaultIpDevice extends AbstractElement implements IpDevice { |
31 | - | 31 | + |
32 | - private final Type type; | 32 | + private final Type type; |
33 | - private final IpDeviceIdentifier deviceIdentifier; | 33 | + private final IpDeviceIdentifier deviceIdentifier; |
34 | - private final DeviceTed deviceTed; | 34 | + private final DeviceTed deviceTed; |
35 | - | 35 | + |
36 | - | 36 | + |
37 | - /** | 37 | + /** |
38 | - * For Serialization. | 38 | + * For Serialization. |
39 | - */ | 39 | + */ |
40 | - private DefaultIpDevice() { | 40 | + private DefaultIpDevice() { |
41 | - this.type = null; | 41 | + this.type = null; |
42 | - this.deviceIdentifier = null; | 42 | + this.deviceIdentifier = null; |
43 | - this.deviceTed = null; | 43 | + this.deviceTed = null; |
44 | - } | 44 | + } |
45 | - | 45 | + |
46 | - /** | 46 | + /** |
47 | - * Creates a network element attributed to the specified provider. | 47 | + * Creates a network element attributed to the specified provider. |
48 | - * | 48 | + * |
49 | - * @param providerId identity of the provider | 49 | + * @param providerId identity of the provider |
50 | - * @param id device identifier | 50 | + * @param id device identifier |
51 | - * @param type device type | 51 | + * @param type device type |
52 | - * @param deviceIdentifier provides device identifier details | 52 | + * @param deviceIdentifier provides device identifier details |
53 | - * @param deviceTed device traffic engineering parameters | 53 | + * @param deviceTed device traffic engineering parameters |
54 | - * @param annotations optional key/value annotations | 54 | + * @param annotations optional key/value annotations |
55 | - */ | 55 | + */ |
56 | - public DefaultIpDevice(ProviderId providerId, DeviceId id, Type type, | 56 | + public DefaultIpDevice(ProviderId providerId, DeviceId id, Type type, |
57 | - IpDeviceIdentifier deviceIdentifier, DeviceTed deviceTed, | 57 | + IpDeviceIdentifier deviceIdentifier, DeviceTed deviceTed, |
58 | - Annotations... annotations) { | 58 | + Annotations... annotations) { |
59 | - super(providerId, id, annotations); | 59 | + super(providerId, id, annotations); |
60 | - this.type = type; | 60 | + this.type = type; |
61 | - this.deviceIdentifier = deviceIdentifier; | 61 | + this.deviceIdentifier = deviceIdentifier; |
62 | - this.deviceTed = deviceTed; | 62 | + this.deviceTed = deviceTed; |
63 | - } | 63 | + } |
64 | - | 64 | + |
65 | - @Override | 65 | + @Override |
66 | - public DeviceId id() { | 66 | + public DeviceId id() { |
67 | - return (DeviceId) id; | 67 | + return (DeviceId) id; |
68 | - } | 68 | + } |
69 | - | 69 | + |
70 | - @Override | 70 | + @Override |
71 | - public Type type() { | 71 | + public Type type() { |
72 | - return type; | 72 | + return type; |
73 | - } | 73 | + } |
74 | - | 74 | + |
75 | - @Override | 75 | + @Override |
76 | - public IpDeviceIdentifier deviceIdentifier() { | 76 | + public IpDeviceIdentifier deviceIdentifier() { |
77 | - return deviceIdentifier; | 77 | + return deviceIdentifier; |
78 | - } | 78 | + } |
79 | - | 79 | + |
80 | - @Override | 80 | + @Override |
81 | - public DeviceTed deviceTed() { | 81 | + public DeviceTed deviceTed() { |
82 | - return deviceTed; } | 82 | + return deviceTed; } |
83 | - | 83 | + |
84 | - @Override | 84 | + @Override |
85 | - public int hashCode() { | 85 | + public int hashCode() { |
86 | - return Objects.hash(type, deviceIdentifier, deviceTed); | 86 | + return Objects.hash(type, deviceIdentifier, deviceTed); |
87 | - } | 87 | + } |
88 | - | 88 | + |
89 | - @Override | 89 | + @Override |
90 | - public boolean equals(Object obj) { | 90 | + public boolean equals(Object obj) { |
91 | - if (this == obj) { | 91 | + if (this == obj) { |
92 | - return true; | 92 | + return true; |
93 | - } | 93 | + } |
94 | - | 94 | + |
95 | - if (obj instanceof DefaultIpDevice) { | 95 | + if (obj instanceof DefaultIpDevice) { |
96 | - final DefaultIpDevice other = (DefaultIpDevice) obj; | 96 | + final DefaultIpDevice other = (DefaultIpDevice) obj; |
97 | - return Objects.equals(this.id, other.id) && | 97 | + return Objects.equals(this.id, other.id) && |
98 | - Objects.equals(this.type, other.type) && | 98 | + Objects.equals(this.type, other.type) && |
99 | - Objects.equals(this.deviceIdentifier, other.deviceIdentifier) && | 99 | + Objects.equals(this.deviceIdentifier, other.deviceIdentifier) && |
100 | - Objects.equals(this.deviceTed, other.deviceTed); | 100 | + Objects.equals(this.deviceTed, other.deviceTed); |
101 | - } | 101 | + } |
102 | - return false; | 102 | + return false; |
103 | - } | 103 | + } |
104 | - @Override | 104 | + @Override |
105 | - public String toString() { | 105 | + public String toString() { |
106 | - return toStringHelper(this) | 106 | + return toStringHelper(this) |
107 | - .omitNullValues() | 107 | + .omitNullValues() |
108 | - .add("id", id) | 108 | + .add("id", id) |
109 | - .add("deviceIdentifier", deviceIdentifier) | 109 | + .add("deviceIdentifier", deviceIdentifier) |
110 | - .add("deviceTed", deviceTed) | 110 | + .add("deviceTed", deviceTed) |
111 | - .toString(); | 111 | + .toString(); |
112 | - } | 112 | + } |
113 | } | 113 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
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.iptopology.api; | 16 | +package org.onosproject.iptopology.api; |
17 | - | 17 | + |
18 | -import org.onosproject.net.AbstractModel; | 18 | +import org.onosproject.net.AbstractModel; |
19 | -import org.onosproject.net.Annotations; | 19 | +import org.onosproject.net.Annotations; |
20 | -import org.onosproject.net.provider.ProviderId; | 20 | +import org.onosproject.net.provider.ProviderId; |
21 | - | 21 | + |
22 | -import java.util.Objects; | 22 | +import java.util.Objects; |
23 | - | 23 | + |
24 | -import static com.google.common.base.MoreObjects.toStringHelper; | 24 | +import static com.google.common.base.MoreObjects.toStringHelper; |
25 | - | 25 | + |
26 | -/** | 26 | +/** |
27 | - * This class provides Link identifier and link ted details. | 27 | + * This class provides Link identifier and link ted details. |
28 | - */ | 28 | + */ |
29 | -public class DefaultIpLink extends AbstractModel implements IpLink { | 29 | +public class DefaultIpLink extends AbstractModel implements IpLink { |
30 | - | 30 | + |
31 | - private final TerminationPoint src; | 31 | + private final TerminationPoint src; |
32 | - private final TerminationPoint dst; | 32 | + private final TerminationPoint dst; |
33 | - private final IpLinkIdentifier linkIdentifier; | 33 | + private final IpLinkIdentifier linkIdentifier; |
34 | - private final LinkTed linkTed; | 34 | + private final LinkTed linkTed; |
35 | - | 35 | + |
36 | - /** | 36 | + /** |
37 | - * Constructor to initialize its parameters. | 37 | + * Constructor to initialize its parameters. |
38 | - * | 38 | + * |
39 | - * @param providerId provider identification | 39 | + * @param providerId provider identification |
40 | - * @param src link source termination point | 40 | + * @param src link source termination point |
41 | - * @param dst link destination termination point | 41 | + * @param dst link destination termination point |
42 | - * @param linkIdentifier provides link identifier details | 42 | + * @param linkIdentifier provides link identifier details |
43 | - * @param linkTed provides link traffic engineering details | 43 | + * @param linkTed provides link traffic engineering details |
44 | - * @param annotations optional key/value annotations | 44 | + * @param annotations optional key/value annotations |
45 | - */ | 45 | + */ |
46 | - public DefaultIpLink(ProviderId providerId, TerminationPoint src, TerminationPoint dst, | 46 | + public DefaultIpLink(ProviderId providerId, TerminationPoint src, TerminationPoint dst, |
47 | - IpLinkIdentifier linkIdentifier, LinkTed linkTed, | 47 | + IpLinkIdentifier linkIdentifier, LinkTed linkTed, |
48 | - Annotations... annotations) { | 48 | + Annotations... annotations) { |
49 | - super(providerId, annotations); | 49 | + super(providerId, annotations); |
50 | - this.src = src; | 50 | + this.src = src; |
51 | - this.dst = dst; | 51 | + this.dst = dst; |
52 | - this.linkIdentifier = linkIdentifier; | 52 | + this.linkIdentifier = linkIdentifier; |
53 | - this.linkTed = linkTed; | 53 | + this.linkTed = linkTed; |
54 | - } | 54 | + } |
55 | - | 55 | + |
56 | - @Override | 56 | + @Override |
57 | - public TerminationPoint src() { | 57 | + public TerminationPoint src() { |
58 | - return src; | 58 | + return src; |
59 | - } | 59 | + } |
60 | - | 60 | + |
61 | - @Override | 61 | + @Override |
62 | - public TerminationPoint dst() { | 62 | + public TerminationPoint dst() { |
63 | - return dst; | 63 | + return dst; |
64 | - } | 64 | + } |
65 | - | 65 | + |
66 | - @Override | 66 | + @Override |
67 | - public IpLinkIdentifier linkIdentifier() { | 67 | + public IpLinkIdentifier linkIdentifier() { |
68 | - return linkIdentifier; | 68 | + return linkIdentifier; |
69 | - } | 69 | + } |
70 | - | 70 | + |
71 | - @Override | 71 | + @Override |
72 | - public LinkTed linkTed() { | 72 | + public LinkTed linkTed() { |
73 | - return linkTed; | 73 | + return linkTed; |
74 | - } | 74 | + } |
75 | - | 75 | + |
76 | - @Override | 76 | + @Override |
77 | - public int hashCode() { | 77 | + public int hashCode() { |
78 | - return Objects.hash(src, dst, linkIdentifier, linkTed); | 78 | + return Objects.hash(src, dst, linkIdentifier, linkTed); |
79 | - } | 79 | + } |
80 | - | 80 | + |
81 | - @Override | 81 | + @Override |
82 | - public boolean equals(Object obj) { | 82 | + public boolean equals(Object obj) { |
83 | - if (this == obj) { | 83 | + if (this == obj) { |
84 | - return true; | 84 | + return true; |
85 | - } | 85 | + } |
86 | - if (obj instanceof DefaultIpLink) { | 86 | + if (obj instanceof DefaultIpLink) { |
87 | - final DefaultIpLink other = (DefaultIpLink) obj; | 87 | + final DefaultIpLink other = (DefaultIpLink) obj; |
88 | - return Objects.equals(this.src, other.src) && | 88 | + return Objects.equals(this.src, other.src) && |
89 | - Objects.equals(this.dst, other.dst) && | 89 | + Objects.equals(this.dst, other.dst) && |
90 | - Objects.equals(this.linkIdentifier, other.linkIdentifier) && | 90 | + Objects.equals(this.linkIdentifier, other.linkIdentifier) && |
91 | - Objects.equals(this.linkTed, other.linkTed); | 91 | + Objects.equals(this.linkTed, other.linkTed); |
92 | - } | 92 | + } |
93 | - return false; | 93 | + return false; |
94 | - } | 94 | + } |
95 | - | 95 | + |
96 | - @Override | 96 | + @Override |
97 | - public String toString() { | 97 | + public String toString() { |
98 | - return toStringHelper(this) | 98 | + return toStringHelper(this) |
99 | - .omitNullValues() | 99 | + .omitNullValues() |
100 | - .add("src", src) | 100 | + .add("src", src) |
101 | - .add("dst", dst) | 101 | + .add("dst", dst) |
102 | - .add("linkIdentifier", linkIdentifier) | 102 | + .add("linkIdentifier", linkIdentifier) |
103 | - .add("linkTed", linkTed) | 103 | + .add("linkTed", linkTed) |
104 | - .toString(); | 104 | + .toString(); |
105 | - } | 105 | + } |
106 | } | 106 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
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.iptopology.api; | 16 | +package org.onosproject.iptopology.api; |
17 | - | 17 | + |
18 | -import java.util.Objects; | 18 | +import java.util.Objects; |
19 | - | 19 | + |
20 | -import org.onlab.packet.Ip4Address; | 20 | +import org.onlab.packet.Ip4Address; |
21 | -import org.onlab.packet.Ip6Address; | 21 | +import org.onlab.packet.Ip6Address; |
22 | - | 22 | + |
23 | -import com.google.common.base.MoreObjects; | 23 | +import com.google.common.base.MoreObjects; |
24 | - | 24 | + |
25 | -/** | 25 | +/** |
26 | - * Representation of device interface. | 26 | + * Representation of device interface. |
27 | - */ | 27 | + */ |
28 | -public class DeviceInterface { | 28 | +public class DeviceInterface { |
29 | - private final Ip4Address ip4Address; | 29 | + private final Ip4Address ip4Address; |
30 | - private final Ip6Address ip6Address; | 30 | + private final Ip6Address ip6Address; |
31 | - private final InterfaceIdentifier interfaceId; | 31 | + private final InterfaceIdentifier interfaceId; |
32 | - | 32 | + |
33 | - /** | 33 | + /** |
34 | - * Constructor to initialize its parameter. | 34 | + * Constructor to initialize its parameter. |
35 | - * | 35 | + * |
36 | - * @param ip4Address ipv4 interface address | 36 | + * @param ip4Address ipv4 interface address |
37 | - * @param ip6Address ipv6 interface address | 37 | + * @param ip6Address ipv6 interface address |
38 | - * @param interfaceId interface Identifier | 38 | + * @param interfaceId interface Identifier |
39 | - */ | 39 | + */ |
40 | - public DeviceInterface(Ip4Address ip4Address, Ip6Address ip6Address, InterfaceIdentifier interfaceId) { | 40 | + public DeviceInterface(Ip4Address ip4Address, Ip6Address ip6Address, InterfaceIdentifier interfaceId) { |
41 | - this.ip4Address = ip4Address; | 41 | + this.ip4Address = ip4Address; |
42 | - this.ip6Address = ip6Address; | 42 | + this.ip6Address = ip6Address; |
43 | - this.interfaceId = interfaceId; | 43 | + this.interfaceId = interfaceId; |
44 | - } | 44 | + } |
45 | - | 45 | + |
46 | - /** | 46 | + /** |
47 | - * obtains ipv4 address of an interface. | 47 | + * obtains ipv4 address of an interface. |
48 | - * | 48 | + * |
49 | - * @return ipv4 interface address | 49 | + * @return ipv4 interface address |
50 | - */ | 50 | + */ |
51 | - public Ip4Address ip4Address() { | 51 | + public Ip4Address ip4Address() { |
52 | - return ip4Address; | 52 | + return ip4Address; |
53 | - } | 53 | + } |
54 | - | 54 | + |
55 | - /** | 55 | + /** |
56 | - * obtains ipv6 interface address. | 56 | + * obtains ipv6 interface address. |
57 | - * | 57 | + * |
58 | - * @return ipv6 interface address | 58 | + * @return ipv6 interface address |
59 | - */ | 59 | + */ |
60 | - public Ip6Address ip6Address() { | 60 | + public Ip6Address ip6Address() { |
61 | - return ip6Address; | 61 | + return ip6Address; |
62 | - } | 62 | + } |
63 | - | 63 | + |
64 | - /** | 64 | + /** |
65 | - * obtains interface identifier. | 65 | + * obtains interface identifier. |
66 | - * | 66 | + * |
67 | - * @return interface identifier | 67 | + * @return interface identifier |
68 | - */ | 68 | + */ |
69 | - public InterfaceIdentifier interfaceId() { | 69 | + public InterfaceIdentifier interfaceId() { |
70 | - return interfaceId; | 70 | + return interfaceId; |
71 | - } | 71 | + } |
72 | - | 72 | + |
73 | - @Override | 73 | + @Override |
74 | - public int hashCode() { | 74 | + public int hashCode() { |
75 | - return Objects.hash(ip4Address, ip6Address, interfaceId); | 75 | + return Objects.hash(ip4Address, ip6Address, interfaceId); |
76 | - } | 76 | + } |
77 | - | 77 | + |
78 | - @Override | 78 | + @Override |
79 | - public boolean equals(Object obj) { | 79 | + public boolean equals(Object obj) { |
80 | - if (this == obj) { | 80 | + if (this == obj) { |
81 | - return true; | 81 | + return true; |
82 | - } | 82 | + } |
83 | - if (obj instanceof DeviceInterface) { | 83 | + if (obj instanceof DeviceInterface) { |
84 | - final DeviceInterface other = (DeviceInterface) obj; | 84 | + final DeviceInterface other = (DeviceInterface) obj; |
85 | - return Objects.equals(this.ip4Address, other.ip4Address) | 85 | + return Objects.equals(this.ip4Address, other.ip4Address) |
86 | - && Objects.equals(this.ip6Address, other.ip6Address) | 86 | + && Objects.equals(this.ip6Address, other.ip6Address) |
87 | - && Objects.equals(this.interfaceId, other.interfaceId); | 87 | + && Objects.equals(this.interfaceId, other.interfaceId); |
88 | - } | 88 | + } |
89 | - return false; | 89 | + return false; |
90 | - } | 90 | + } |
91 | - | 91 | + |
92 | - @Override | 92 | + @Override |
93 | - public String toString() { | 93 | + public String toString() { |
94 | - return MoreObjects.toStringHelper(this) | 94 | + return MoreObjects.toStringHelper(this) |
95 | - .add("ip4Address", ip4Address) | 95 | + .add("ip4Address", ip4Address) |
96 | - .add("ip6Address", ip6Address) | 96 | + .add("ip6Address", ip6Address) |
97 | - .add("interfaceId", interfaceId) | 97 | + .add("interfaceId", interfaceId) |
98 | - .toString(); | 98 | + .toString(); |
99 | - } | 99 | + } |
100 | } | 100 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
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.iptopology.api; | 16 | +package org.onosproject.iptopology.api; |
17 | - | 17 | + |
18 | -import org.onosproject.net.Element; | 18 | +import org.onosproject.net.Element; |
19 | - | 19 | + |
20 | -/** | 20 | +/** |
21 | - * Abstraction of Device interface. | 21 | + * Abstraction of Device interface. |
22 | - */ | 22 | + */ |
23 | -public interface DeviceIntf { | 23 | +public interface DeviceIntf { |
24 | - /** | 24 | + /** |
25 | - * Returns the parent network element to which this interface belongs. | 25 | + * Returns the parent network element to which this interface belongs. |
26 | - * | 26 | + * |
27 | - * @return parent network element | 27 | + * @return parent network element |
28 | - */ | 28 | + */ |
29 | - Element element(); | 29 | + Element element(); |
30 | - | 30 | + |
31 | - /** | 31 | + /** |
32 | - * Returns device interface details. | 32 | + * Returns device interface details. |
33 | - * | 33 | + * |
34 | - * @return device interface details | 34 | + * @return device interface details |
35 | - */ | 35 | + */ |
36 | - DeviceInterface deviceInterface(); | 36 | + DeviceInterface deviceInterface(); |
37 | } | 37 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
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.iptopology.api; | 16 | +package org.onosproject.iptopology.api; |
17 | - | 17 | + |
18 | -import org.onosproject.net.Annotated; | 18 | +import org.onosproject.net.Annotated; |
19 | -import org.onosproject.net.Element; | 19 | +import org.onosproject.net.Element; |
20 | - | 20 | + |
21 | -/** | 21 | +/** |
22 | - * Abstraction of Device Prefix. | 22 | + * Abstraction of Device Prefix. |
23 | - */ | 23 | + */ |
24 | -public interface DevicePrefix extends Annotated { | 24 | +public interface DevicePrefix extends Annotated { |
25 | - | 25 | + |
26 | - /** | 26 | + /** |
27 | - * Returns the parent network element to which this port belongs. | 27 | + * Returns the parent network element to which this port belongs. |
28 | - * | 28 | + * |
29 | - * @return parent network element | 29 | + * @return parent network element |
30 | - */ | 30 | + */ |
31 | - Element element(); | 31 | + Element element(); |
32 | - | 32 | + |
33 | - /** | 33 | + /** |
34 | - * Returns prefix identifier details. | 34 | + * Returns prefix identifier details. |
35 | - * | 35 | + * |
36 | - * @return prefix identifier details | 36 | + * @return prefix identifier details |
37 | - */ | 37 | + */ |
38 | - PrefixIdentifier prefixIdentifier(); | 38 | + PrefixIdentifier prefixIdentifier(); |
39 | - | 39 | + |
40 | - /** | 40 | + /** |
41 | - * Returns prefix Traffic engineering parameters. | 41 | + * Returns prefix Traffic engineering parameters. |
42 | - * | 42 | + * |
43 | - * @return prefix Traffic engineering parameters | 43 | + * @return prefix Traffic engineering parameters |
44 | - */ | 44 | + */ |
45 | - PrefixTed prefixTed(); | 45 | + PrefixTed prefixTed(); |
46 | } | 46 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
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 | - | 16 | + |
17 | -package org.onosproject.iptopology.api; | 17 | +package org.onosproject.iptopology.api; |
18 | - | 18 | + |
19 | -import static com.google.common.base.MoreObjects.toStringHelper; | 19 | +import static com.google.common.base.MoreObjects.toStringHelper; |
20 | - | 20 | + |
21 | -import java.util.Objects; | 21 | +import java.util.Objects; |
22 | - | 22 | + |
23 | -/** | 23 | +/** |
24 | - * Domain Identifier(32 Bit). | 24 | + * Domain Identifier(32 Bit). |
25 | - */ | 25 | + */ |
26 | -public class DomainId { | 26 | +public class DomainId { |
27 | - private final int domainIdentifier; | 27 | + private final int domainIdentifier; |
28 | - | 28 | + |
29 | - /** | 29 | + /** |
30 | - * Constructor to initialize domain identifier. | 30 | + * Constructor to initialize domain identifier. |
31 | - * | 31 | + * |
32 | - * @param domainIdentifier domain identifier | 32 | + * @param domainIdentifier domain identifier |
33 | - */ | 33 | + */ |
34 | - public DomainId(int domainIdentifier) { | 34 | + public DomainId(int domainIdentifier) { |
35 | - this.domainIdentifier = domainIdentifier; | 35 | + this.domainIdentifier = domainIdentifier; |
36 | - } | 36 | + } |
37 | - | 37 | + |
38 | - /** | 38 | + /** |
39 | - * Obtain domain identifier. | 39 | + * Obtain domain identifier. |
40 | - * | 40 | + * |
41 | - * @return domain identifier | 41 | + * @return domain identifier |
42 | - */ | 42 | + */ |
43 | - public int domainIdentifier() { | 43 | + public int domainIdentifier() { |
44 | - return domainIdentifier; | 44 | + return domainIdentifier; |
45 | - } | 45 | + } |
46 | - | 46 | + |
47 | - @Override | 47 | + @Override |
48 | - public int hashCode() { | 48 | + public int hashCode() { |
49 | - return Objects.hash(domainIdentifier); | 49 | + return Objects.hash(domainIdentifier); |
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 | - | 57 | + |
58 | - if (obj instanceof DomainId) { | 58 | + if (obj instanceof DomainId) { |
59 | - DomainId other = (DomainId) obj; | 59 | + DomainId other = (DomainId) obj; |
60 | - return Objects.equals(domainIdentifier, other.domainIdentifier); | 60 | + return Objects.equals(domainIdentifier, other.domainIdentifier); |
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 toStringHelper(this) | 67 | + return toStringHelper(this) |
68 | - .add("domainIdentifier", domainIdentifier) | 68 | + .add("domainIdentifier", domainIdentifier) |
69 | - .toString(); | 69 | + .toString(); |
70 | - } | 70 | + } |
71 | } | 71 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
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.iptopology.api; | 16 | +package org.onosproject.iptopology.api; |
17 | - | 17 | + |
18 | -import org.onosproject.net.DeviceId; | 18 | +import org.onosproject.net.DeviceId; |
19 | -import org.onosproject.net.Element; | 19 | +import org.onosproject.net.Element; |
20 | - | 20 | + |
21 | -/** | 21 | +/** |
22 | - * Abstraction of Ip Device. | 22 | + * Abstraction of Ip Device. |
23 | - */ | 23 | + */ |
24 | -public interface IpDevice extends Element { | 24 | +public interface IpDevice extends Element { |
25 | - /** | 25 | + /** |
26 | - ** Enum type to store Device Type. | 26 | + ** Enum type to store Device Type. |
27 | - */ | 27 | + */ |
28 | - enum Type { | 28 | + enum Type { |
29 | - /** | 29 | + /** |
30 | - * Signifies that the device is pseudo device. | 30 | + * Signifies that the device is pseudo device. |
31 | - */ | 31 | + */ |
32 | - PSEUDO, | 32 | + PSEUDO, |
33 | - | 33 | + |
34 | - /** | 34 | + /** |
35 | - * Signifies that the device is non-pseudo device. | 35 | + * Signifies that the device is non-pseudo device. |
36 | - */ | 36 | + */ |
37 | - NONPSEUDO; | 37 | + NONPSEUDO; |
38 | - } | 38 | + } |
39 | - | 39 | + |
40 | - /** | 40 | + /** |
41 | - * Obtains device id. | 41 | + * Obtains device id. |
42 | - * | 42 | + * |
43 | - * @return device id | 43 | + * @return device id |
44 | - */ | 44 | + */ |
45 | - @Override | 45 | + @Override |
46 | - DeviceId id(); | 46 | + DeviceId id(); |
47 | - | 47 | + |
48 | - /** | 48 | + /** |
49 | - * Obtains device type. | 49 | + * Obtains device type. |
50 | - * | 50 | + * |
51 | - * @return device type | 51 | + * @return device type |
52 | - */ | 52 | + */ |
53 | - Type type(); | 53 | + Type type(); |
54 | - | 54 | + |
55 | - /** | 55 | + /** |
56 | - * Obtains Device identifier details. | 56 | + * Obtains Device identifier details. |
57 | - * | 57 | + * |
58 | - * @return identifier of the device | 58 | + * @return identifier of the device |
59 | - */ | 59 | + */ |
60 | - IpDeviceIdentifier deviceIdentifier(); | 60 | + IpDeviceIdentifier deviceIdentifier(); |
61 | - | 61 | + |
62 | - /** | 62 | + /** |
63 | - * Obtains the traffic engineering parameters of the device. | 63 | + * Obtains the traffic engineering parameters of the device. |
64 | - * | 64 | + * |
65 | - * @return traffic engineering parameters of the device | 65 | + * @return traffic engineering parameters of the device |
66 | - */ | 66 | + */ |
67 | - DeviceTed deviceTed(); | 67 | + DeviceTed deviceTed(); |
68 | } | 68 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
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.iptopology.api; | 16 | +package org.onosproject.iptopology.api; |
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 | - * Represents IP Device Identifiers. | 23 | + * Represents IP Device Identifiers. |
24 | - */ | 24 | + */ |
25 | -public class IpDeviceIdentifier { | 25 | +public class IpDeviceIdentifier { |
26 | - | 26 | + |
27 | - private final RouteDistinguisher routeDish; | 27 | + private final RouteDistinguisher routeDish; |
28 | - private final RouteInstance routeInstance; | 28 | + private final RouteInstance routeInstance; |
29 | - private final AsNumber asNum; | 29 | + private final AsNumber asNum; |
30 | - private final DomainId domainIdentifier; | 30 | + private final DomainId domainIdentifier; |
31 | - private final AreaId areaId; | 31 | + private final AreaId areaId; |
32 | - private final RouteIdentifier routerIdentifier; | 32 | + private final RouteIdentifier routerIdentifier; |
33 | - | 33 | + |
34 | - /** | 34 | + /** |
35 | - * Constructor to initialize parameters. | 35 | + * Constructor to initialize parameters. |
36 | - * | 36 | + * |
37 | - * @param routeDish routing distinguisher instance | 37 | + * @param routeDish routing distinguisher instance |
38 | - * @param routeInstance routing protocol instance | 38 | + * @param routeInstance routing protocol instance |
39 | - * @param asNum AS number | 39 | + * @param asNum AS number |
40 | - * @param domainIdentifier BGP-LS domain | 40 | + * @param domainIdentifier BGP-LS domain |
41 | - * @param areaId Area ID | 41 | + * @param areaId Area ID |
42 | - * @param routerIdentifier IGP router ID | 42 | + * @param routerIdentifier IGP router ID |
43 | - */ | 43 | + */ |
44 | - public IpDeviceIdentifier(RouteDistinguisher routeDish, RouteInstance routeInstance, AsNumber asNum, | 44 | + public IpDeviceIdentifier(RouteDistinguisher routeDish, RouteInstance routeInstance, AsNumber asNum, |
45 | - DomainId domainIdentifier, AreaId areaId, RouteIdentifier routerIdentifier) { | 45 | + DomainId domainIdentifier, AreaId areaId, RouteIdentifier routerIdentifier) { |
46 | - this.routeDish = routeDish; | 46 | + this.routeDish = routeDish; |
47 | - this.areaId = areaId; | 47 | + this.areaId = areaId; |
48 | - this.asNum = asNum; | 48 | + this.asNum = asNum; |
49 | - this.domainIdentifier = domainIdentifier; | 49 | + this.domainIdentifier = domainIdentifier; |
50 | - this.routeInstance = routeInstance; | 50 | + this.routeInstance = routeInstance; |
51 | - this.routerIdentifier = routerIdentifier; | 51 | + this.routerIdentifier = routerIdentifier; |
52 | - } | 52 | + } |
53 | - | 53 | + |
54 | - /** | 54 | + /** |
55 | - * Obtains Route Distinguisher of Ip Device. | 55 | + * Obtains Route Distinguisher of Ip Device. |
56 | - * | 56 | + * |
57 | - * @return Area ID | 57 | + * @return Area ID |
58 | - */ | 58 | + */ |
59 | - public RouteDistinguisher routeDish() { | 59 | + public RouteDistinguisher routeDish() { |
60 | - return routeDish; | 60 | + return routeDish; |
61 | - } | 61 | + } |
62 | - | 62 | + |
63 | - /** | 63 | + /** |
64 | - * Obtains Area ID if Ip Device. | 64 | + * Obtains Area ID if Ip Device. |
65 | - * | 65 | + * |
66 | - * @return Area ID | 66 | + * @return Area ID |
67 | - */ | 67 | + */ |
68 | - public AreaId areaId() { | 68 | + public AreaId areaId() { |
69 | - return areaId; | 69 | + return areaId; |
70 | - } | 70 | + } |
71 | - | 71 | + |
72 | - /** | 72 | + /** |
73 | - * Obtains AS number of Ip Device. | 73 | + * Obtains AS number of Ip Device. |
74 | - * | 74 | + * |
75 | - * @return AS number | 75 | + * @return AS number |
76 | - */ | 76 | + */ |
77 | - public AsNumber asNum() { | 77 | + public AsNumber asNum() { |
78 | - return asNum; | 78 | + return asNum; |
79 | - } | 79 | + } |
80 | - | 80 | + |
81 | - /** | 81 | + /** |
82 | - * Obtains domain identifier of Ip Device. | 82 | + * Obtains domain identifier of Ip Device. |
83 | - * | 83 | + * |
84 | - * @return domain identifier | 84 | + * @return domain identifier |
85 | - */ | 85 | + */ |
86 | - public DomainId domainIdentifier() { | 86 | + public DomainId domainIdentifier() { |
87 | - return domainIdentifier; | 87 | + return domainIdentifier; |
88 | - } | 88 | + } |
89 | - | 89 | + |
90 | - /** | 90 | + /** |
91 | - * Obtains Router id of Ip Device. | 91 | + * Obtains Router id of Ip Device. |
92 | - * | 92 | + * |
93 | - * @return Router id | 93 | + * @return Router id |
94 | - */ | 94 | + */ |
95 | - public RouteIdentifier routerIdentifier() { | 95 | + public RouteIdentifier routerIdentifier() { |
96 | - return routerIdentifier; | 96 | + return routerIdentifier; |
97 | - } | 97 | + } |
98 | - | 98 | + |
99 | - /** | 99 | + /** |
100 | - * Obtains routing protocol instance. | 100 | + * Obtains routing protocol instance. |
101 | - * | 101 | + * |
102 | - * @return routing protocol instance | 102 | + * @return routing protocol instance |
103 | - */ | 103 | + */ |
104 | - public RouteInstance routeInstance() { | 104 | + public RouteInstance routeInstance() { |
105 | - return routeInstance; | 105 | + return routeInstance; |
106 | - } | 106 | + } |
107 | - | 107 | + |
108 | - @Override | 108 | + @Override |
109 | - public int hashCode() { | 109 | + public int hashCode() { |
110 | - return Objects.hash(routeDish, areaId, asNum, domainIdentifier, routerIdentifier, routeInstance); | 110 | + return Objects.hash(routeDish, areaId, asNum, domainIdentifier, routerIdentifier, routeInstance); |
111 | - } | 111 | + } |
112 | - | 112 | + |
113 | - @Override | 113 | + @Override |
114 | - public boolean equals(Object obj) { | 114 | + public boolean equals(Object obj) { |
115 | - if (this == obj) { | 115 | + if (this == obj) { |
116 | - return true; | 116 | + return true; |
117 | - } | 117 | + } |
118 | - | 118 | + |
119 | - if (obj instanceof IpDeviceIdentifier) { | 119 | + if (obj instanceof IpDeviceIdentifier) { |
120 | - IpDeviceIdentifier other = (IpDeviceIdentifier) obj; | 120 | + IpDeviceIdentifier other = (IpDeviceIdentifier) obj; |
121 | - return Objects.equals(areaId, other.areaId) && Objects.equals(asNum, other.asNum) | 121 | + return Objects.equals(areaId, other.areaId) && Objects.equals(asNum, other.asNum) |
122 | - && Objects.equals(domainIdentifier, other.domainIdentifier) | 122 | + && Objects.equals(domainIdentifier, other.domainIdentifier) |
123 | - && Objects.equals(routerIdentifier, other.routerIdentifier) | 123 | + && Objects.equals(routerIdentifier, other.routerIdentifier) |
124 | - && Objects.equals(routeInstance, other.routeInstance) | 124 | + && Objects.equals(routeInstance, other.routeInstance) |
125 | - && Objects.equals(routeDish, other.routeDish); | 125 | + && Objects.equals(routeDish, other.routeDish); |
126 | - } | 126 | + } |
127 | - return false; | 127 | + return false; |
128 | - } | 128 | + } |
129 | - | 129 | + |
130 | - @Override | 130 | + @Override |
131 | - public String toString() { | 131 | + public String toString() { |
132 | - return toStringHelper(this) | 132 | + return toStringHelper(this) |
133 | - .omitNullValues() | 133 | + .omitNullValues() |
134 | - .add("areaId", areaId) | 134 | + .add("areaId", areaId) |
135 | - .add("asNum", asNum) | 135 | + .add("asNum", asNum) |
136 | - .add("domainIdentifier", domainIdentifier) | 136 | + .add("domainIdentifier", domainIdentifier) |
137 | - .add("routerIdentifier", routerIdentifier) | 137 | + .add("routerIdentifier", routerIdentifier) |
138 | - .add("routeInstance", routeInstance) | 138 | + .add("routeInstance", routeInstance) |
139 | - .add("routeDish", routeDish) | 139 | + .add("routeDish", routeDish) |
140 | - .toString(); | 140 | + .toString(); |
141 | - } | 141 | + } |
142 | } | 142 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
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.iptopology.api; | 16 | +package org.onosproject.iptopology.api; |
17 | - | 17 | + |
18 | -import org.onosproject.net.Annotated; | 18 | +import org.onosproject.net.Annotated; |
19 | -import org.onosproject.net.NetworkResource; | 19 | +import org.onosproject.net.NetworkResource; |
20 | -import org.onosproject.net.Provided; | 20 | +import org.onosproject.net.Provided; |
21 | - | 21 | + |
22 | -/** | 22 | +/** |
23 | - * Abstraction of a network ip link. | 23 | + * Abstraction of a network ip link. |
24 | - */ | 24 | + */ |
25 | -public interface IpLink extends Annotated, Provided, NetworkResource { | 25 | +public interface IpLink extends Annotated, Provided, NetworkResource { |
26 | - | 26 | + |
27 | - /** | 27 | + /** |
28 | - * Returns source termination point of link. | 28 | + * Returns source termination point of link. |
29 | - * | 29 | + * |
30 | - * @return source termination point of link | 30 | + * @return source termination point of link |
31 | - */ | 31 | + */ |
32 | - TerminationPoint src(); | 32 | + TerminationPoint src(); |
33 | - | 33 | + |
34 | - /** | 34 | + /** |
35 | - * Returns destination termination point of link. | 35 | + * Returns destination termination point of link. |
36 | - * | 36 | + * |
37 | - * @return destination termination point of link | 37 | + * @return destination termination point of link |
38 | - */ | 38 | + */ |
39 | - TerminationPoint dst(); | 39 | + TerminationPoint dst(); |
40 | - | 40 | + |
41 | - /** | 41 | + /** |
42 | - * Returns link identifier details. | 42 | + * Returns link identifier details. |
43 | - * | 43 | + * |
44 | - * @return link identifier details | 44 | + * @return link identifier details |
45 | - */ | 45 | + */ |
46 | - IpLinkIdentifier linkIdentifier(); | 46 | + IpLinkIdentifier linkIdentifier(); |
47 | - | 47 | + |
48 | - /** | 48 | + /** |
49 | - * Returns the link traffic engineering parameters. | 49 | + * Returns the link traffic engineering parameters. |
50 | - * | 50 | + * |
51 | - * @return links traffic engineering parameters | 51 | + * @return links traffic engineering parameters |
52 | - */ | 52 | + */ |
53 | - LinkTed linkTed(); | 53 | + LinkTed linkTed(); |
54 | } | 54 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
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.iptopology.api; | 16 | +package org.onosproject.iptopology.api; |
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.Ip4Address; | 22 | +import org.onlab.packet.Ip4Address; |
23 | -import org.onlab.packet.Ip6Address; | 23 | +import org.onlab.packet.Ip6Address; |
24 | - | 24 | + |
25 | -/** | 25 | +/** |
26 | - * Represents Ip Link Identifier. | 26 | + * Represents Ip Link Identifier. |
27 | - */ | 27 | + */ |
28 | -public class IpLinkIdentifier { | 28 | +public class IpLinkIdentifier { |
29 | - private final InterfaceIdentifier localIndentifier; | 29 | + private final InterfaceIdentifier localIndentifier; |
30 | - private final InterfaceIdentifier remoteIndentifier; | 30 | + private final InterfaceIdentifier remoteIndentifier; |
31 | - private final Ip4Address localIpv4Addr; | 31 | + private final Ip4Address localIpv4Addr; |
32 | - private final Ip4Address remoteIpv4Addr; | 32 | + private final Ip4Address remoteIpv4Addr; |
33 | - private final Ip6Address localIpv6Addr; | 33 | + private final Ip6Address localIpv6Addr; |
34 | - private final Ip6Address remoteIpv6Addr; | 34 | + private final Ip6Address remoteIpv6Addr; |
35 | - private final TopologyId topologyId; | 35 | + private final TopologyId topologyId; |
36 | - | 36 | + |
37 | - /** | 37 | + /** |
38 | - * Constructor to initialize its parameters. | 38 | + * Constructor to initialize its parameters. |
39 | - * | 39 | + * |
40 | - * @param localIndentifier local interface identifier of the link | 40 | + * @param localIndentifier local interface identifier of the link |
41 | - * @param remoteIndentifier remote interface identifier of the link | 41 | + * @param remoteIndentifier remote interface identifier of the link |
42 | - * @param localIpv4Addr local IPv4 address of the link | 42 | + * @param localIpv4Addr local IPv4 address of the link |
43 | - * @param remoteIpv4Addr remote IPv4 address of the link | 43 | + * @param remoteIpv4Addr remote IPv4 address of the link |
44 | - * @param localIpv6Addr local IPv6 address of the link | 44 | + * @param localIpv6Addr local IPv6 address of the link |
45 | - * @param remoteIpv6Addr remote IPv6 address of the link | 45 | + * @param remoteIpv6Addr remote IPv6 address of the link |
46 | - * @param topologyId link topology identifier | 46 | + * @param topologyId link topology identifier |
47 | - */ | 47 | + */ |
48 | - public IpLinkIdentifier(InterfaceIdentifier localIndentifier, InterfaceIdentifier remoteIndentifier, | 48 | + public IpLinkIdentifier(InterfaceIdentifier localIndentifier, InterfaceIdentifier remoteIndentifier, |
49 | - Ip4Address localIpv4Addr, Ip4Address remoteIpv4Addr, Ip6Address localIpv6Addr, | 49 | + Ip4Address localIpv4Addr, Ip4Address remoteIpv4Addr, Ip6Address localIpv6Addr, |
50 | - Ip6Address remoteIpv6Addr, TopologyId topologyId) { | 50 | + Ip6Address remoteIpv6Addr, TopologyId topologyId) { |
51 | - this.localIndentifier = localIndentifier; | 51 | + this.localIndentifier = localIndentifier; |
52 | - this.remoteIndentifier = remoteIndentifier; | 52 | + this.remoteIndentifier = remoteIndentifier; |
53 | - this.localIpv4Addr = localIpv4Addr; | 53 | + this.localIpv4Addr = localIpv4Addr; |
54 | - this.remoteIpv4Addr = remoteIpv4Addr; | 54 | + this.remoteIpv4Addr = remoteIpv4Addr; |
55 | - this.localIpv6Addr = localIpv6Addr; | 55 | + this.localIpv6Addr = localIpv6Addr; |
56 | - this.remoteIpv6Addr = remoteIpv6Addr; | 56 | + this.remoteIpv6Addr = remoteIpv6Addr; |
57 | - this.topologyId = topologyId; | 57 | + this.topologyId = topologyId; |
58 | - } | 58 | + } |
59 | - | 59 | + |
60 | - /** | 60 | + /** |
61 | - * Obtains link local identifier. | 61 | + * Obtains link local identifier. |
62 | - * | 62 | + * |
63 | - * @return link local identifier | 63 | + * @return link local identifier |
64 | - */ | 64 | + */ |
65 | - public InterfaceIdentifier localIndentifier() { | 65 | + public InterfaceIdentifier localIndentifier() { |
66 | - return localIndentifier; | 66 | + return localIndentifier; |
67 | - } | 67 | + } |
68 | - | 68 | + |
69 | - /** | 69 | + /** |
70 | - * Obtains link local identifier. | 70 | + * Obtains link local identifier. |
71 | - * | 71 | + * |
72 | - * @return link local identifier | 72 | + * @return link local identifier |
73 | - */ | 73 | + */ |
74 | - public InterfaceIdentifier remoteIndentifier() { | 74 | + public InterfaceIdentifier remoteIndentifier() { |
75 | - return remoteIndentifier; | 75 | + return remoteIndentifier; |
76 | - } | 76 | + } |
77 | - | 77 | + |
78 | - /** | 78 | + /** |
79 | - * Obtains local IPv4 address of the link. | 79 | + * Obtains local IPv4 address of the link. |
80 | - * | 80 | + * |
81 | - * @return local IPv4 address of the link | 81 | + * @return local IPv4 address of the link |
82 | - */ | 82 | + */ |
83 | - public Ip4Address localIpv4Addr() { | 83 | + public Ip4Address localIpv4Addr() { |
84 | - return localIpv4Addr; | 84 | + return localIpv4Addr; |
85 | - } | 85 | + } |
86 | - | 86 | + |
87 | - /** | 87 | + /** |
88 | - * Obtains remote IPv4 address of the link. | 88 | + * Obtains remote IPv4 address of the link. |
89 | - * | 89 | + * |
90 | - * @return remote IPv4 address of the link | 90 | + * @return remote IPv4 address of the link |
91 | - */ | 91 | + */ |
92 | - public Ip4Address remoteIpv4Addr() { | 92 | + public Ip4Address remoteIpv4Addr() { |
93 | - return remoteIpv4Addr; | 93 | + return remoteIpv4Addr; |
94 | - } | 94 | + } |
95 | - | 95 | + |
96 | - /** | 96 | + /** |
97 | - * Obtains local IPv6 address of the link. | 97 | + * Obtains local IPv6 address of the link. |
98 | - * | 98 | + * |
99 | - * @return local IPv6 address of the link | 99 | + * @return local IPv6 address of the link |
100 | - */ | 100 | + */ |
101 | - public Ip6Address localIpv6Addr() { | 101 | + public Ip6Address localIpv6Addr() { |
102 | - return localIpv6Addr; | 102 | + return localIpv6Addr; |
103 | - } | 103 | + } |
104 | - | 104 | + |
105 | - /** | 105 | + /** |
106 | - * Obtains remote IPv6 address of the link. | 106 | + * Obtains remote IPv6 address of the link. |
107 | - * | 107 | + * |
108 | - * @return remote IPv6 address of the link | 108 | + * @return remote IPv6 address of the link |
109 | - */ | 109 | + */ |
110 | - public Ip6Address remoteIpv6Addr() { | 110 | + public Ip6Address remoteIpv6Addr() { |
111 | - return remoteIpv6Addr; | 111 | + return remoteIpv6Addr; |
112 | - } | 112 | + } |
113 | - | 113 | + |
114 | - /** | 114 | + /** |
115 | - * Obtains Topology ID of the link. | 115 | + * Obtains Topology ID of the link. |
116 | - * | 116 | + * |
117 | - * @return Topology ID of the link | 117 | + * @return Topology ID of the link |
118 | - */ | 118 | + */ |
119 | - public TopologyId topologyId() { | 119 | + public TopologyId topologyId() { |
120 | - return topologyId; | 120 | + return topologyId; |
121 | - } | 121 | + } |
122 | - | 122 | + |
123 | - @Override | 123 | + @Override |
124 | - public int hashCode() { | 124 | + public int hashCode() { |
125 | - return Objects.hash(localIndentifier, remoteIndentifier, localIpv4Addr, remoteIpv4Addr, | 125 | + return Objects.hash(localIndentifier, remoteIndentifier, localIpv4Addr, remoteIpv4Addr, |
126 | - localIpv6Addr, remoteIpv6Addr, topologyId); | 126 | + localIpv6Addr, remoteIpv6Addr, topologyId); |
127 | - } | 127 | + } |
128 | - | 128 | + |
129 | - @Override | 129 | + @Override |
130 | - public boolean equals(Object obj) { | 130 | + public boolean equals(Object obj) { |
131 | - if (this == obj) { | 131 | + if (this == obj) { |
132 | - return true; | 132 | + return true; |
133 | - } | 133 | + } |
134 | - | 134 | + |
135 | - if (obj instanceof IpLinkIdentifier) { | 135 | + if (obj instanceof IpLinkIdentifier) { |
136 | - IpLinkIdentifier other = (IpLinkIdentifier) obj; | 136 | + IpLinkIdentifier other = (IpLinkIdentifier) obj; |
137 | - return Objects.equals(topologyId, other.topologyId) | 137 | + return Objects.equals(topologyId, other.topologyId) |
138 | - && Objects.equals(localIndentifier, other.localIndentifier) | 138 | + && Objects.equals(localIndentifier, other.localIndentifier) |
139 | - && Objects.equals(remoteIndentifier, other.remoteIndentifier) | 139 | + && Objects.equals(remoteIndentifier, other.remoteIndentifier) |
140 | - && Objects.equals(localIpv4Addr, other.localIpv4Addr) | 140 | + && Objects.equals(localIpv4Addr, other.localIpv4Addr) |
141 | - && Objects.equals(remoteIpv4Addr, other.remoteIpv4Addr) | 141 | + && Objects.equals(remoteIpv4Addr, other.remoteIpv4Addr) |
142 | - && Objects.equals(localIpv6Addr, other.localIpv6Addr) | 142 | + && Objects.equals(localIpv6Addr, other.localIpv6Addr) |
143 | - && Objects.equals(remoteIpv6Addr, other.remoteIpv6Addr); | 143 | + && Objects.equals(remoteIpv6Addr, other.remoteIpv6Addr); |
144 | - } | 144 | + } |
145 | - return false; | 145 | + return false; |
146 | - } | 146 | + } |
147 | - | 147 | + |
148 | - @Override | 148 | + @Override |
149 | - public String toString() { | 149 | + public String toString() { |
150 | - return toStringHelper(this) | 150 | + return toStringHelper(this) |
151 | - .omitNullValues() | 151 | + .omitNullValues() |
152 | - .add("localIndentifier", localIndentifier) | 152 | + .add("localIndentifier", localIndentifier) |
153 | - .add("remoteIndentifier", remoteIndentifier) | 153 | + .add("remoteIndentifier", remoteIndentifier) |
154 | - .add("localIpv4Addr", localIpv4Addr) | 154 | + .add("localIpv4Addr", localIpv4Addr) |
155 | - .add("remoteIpv4Addr", remoteIpv4Addr) | 155 | + .add("remoteIpv4Addr", remoteIpv4Addr) |
156 | - .add("localIpv6Addr", localIpv6Addr) | 156 | + .add("localIpv6Addr", localIpv6Addr) |
157 | - .add("remoteIpv6Addr", remoteIpv6Addr) | 157 | + .add("remoteIpv6Addr", remoteIpv6Addr) |
158 | - .add("topologyId", topologyId) | 158 | + .add("topologyId", topologyId) |
159 | - .toString(); | 159 | + .toString(); |
160 | - } | 160 | + } |
161 | } | 161 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
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.iptopology.api; | 16 | +package org.onosproject.iptopology.api; |
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 | - * This class provides Prefix Identifier details. | 23 | + * This class provides Prefix Identifier details. |
24 | - */ | 24 | + */ |
25 | -public class PrefixIdentifier { | 25 | +public class PrefixIdentifier { |
26 | - private final TopologyId topologyId; | 26 | + private final TopologyId topologyId; |
27 | - private final RouteType routeType; | 27 | + private final RouteType routeType; |
28 | - private final IpReachability ipReach; | 28 | + private final IpReachability ipReach; |
29 | - | 29 | + |
30 | - /** | 30 | + /** |
31 | - * Constructor to initialize its parameters. | 31 | + * Constructor to initialize its parameters. |
32 | - * | 32 | + * |
33 | - * @param topologyId topology ID of prefix | 33 | + * @param topologyId topology ID of prefix |
34 | - * @param routeType OSPF Route type of the prefix | 34 | + * @param routeType OSPF Route type of the prefix |
35 | - * @param ipReach IP address prefix reachability information | 35 | + * @param ipReach IP address prefix reachability information |
36 | - */ | 36 | + */ |
37 | - public PrefixIdentifier(TopologyId topologyId, RouteType routeType, IpReachability ipReach) { | 37 | + public PrefixIdentifier(TopologyId topologyId, RouteType routeType, IpReachability ipReach) { |
38 | - this.topologyId = topologyId; | 38 | + this.topologyId = topologyId; |
39 | - this.routeType = routeType; | 39 | + this.routeType = routeType; |
40 | - this.ipReach = ipReach; | 40 | + this.ipReach = ipReach; |
41 | - } | 41 | + } |
42 | - | 42 | + |
43 | - /** | 43 | + /** |
44 | - * Provides topology ID of prefix. | 44 | + * Provides topology ID of prefix. |
45 | - * | 45 | + * |
46 | - * @return topology id | 46 | + * @return topology id |
47 | - */ | 47 | + */ |
48 | - public TopologyId topologyId() { | 48 | + public TopologyId topologyId() { |
49 | - return this.topologyId; | 49 | + return this.topologyId; |
50 | - } | 50 | + } |
51 | - | 51 | + |
52 | - /** | 52 | + /** |
53 | - * Provides IP address prefix reachability information. | 53 | + * Provides IP address prefix reachability information. |
54 | - * | 54 | + * |
55 | - * @return IP address prefix | 55 | + * @return IP address prefix |
56 | - */ | 56 | + */ |
57 | - public IpReachability ipReach() { | 57 | + public IpReachability ipReach() { |
58 | - return this.ipReach; | 58 | + return this.ipReach; |
59 | - } | 59 | + } |
60 | - | 60 | + |
61 | - /** | 61 | + /** |
62 | - * Provides OSPF Route type of the prefix. | 62 | + * Provides OSPF Route type of the prefix. |
63 | - * | 63 | + * |
64 | - * @return Route type | 64 | + * @return Route type |
65 | - */ | 65 | + */ |
66 | - public RouteType routeType() { | 66 | + public RouteType routeType() { |
67 | - return this.routeType; | 67 | + return this.routeType; |
68 | - } | 68 | + } |
69 | - | 69 | + |
70 | - @Override | 70 | + @Override |
71 | - public int hashCode() { | 71 | + public int hashCode() { |
72 | - return Objects.hash(topologyId, routeType, ipReach); | 72 | + return Objects.hash(topologyId, routeType, ipReach); |
73 | - } | 73 | + } |
74 | - | 74 | + |
75 | - @Override | 75 | + @Override |
76 | - public boolean equals(Object obj) { | 76 | + public boolean equals(Object obj) { |
77 | - if (this == obj) { | 77 | + if (this == obj) { |
78 | - return true; | 78 | + return true; |
79 | - } | 79 | + } |
80 | - | 80 | + |
81 | - if (obj instanceof PrefixIdentifier) { | 81 | + if (obj instanceof PrefixIdentifier) { |
82 | - PrefixIdentifier other = (PrefixIdentifier) obj; | 82 | + PrefixIdentifier other = (PrefixIdentifier) obj; |
83 | - return Objects.equals(topologyId, other.topologyId) && Objects.equals(routeType, other.routeType) | 83 | + return Objects.equals(topologyId, other.topologyId) && Objects.equals(routeType, other.routeType) |
84 | - && Objects.equals(ipReach, other.ipReach); | 84 | + && Objects.equals(ipReach, other.ipReach); |
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) | 91 | + return toStringHelper(this) |
92 | - .omitNullValues() | 92 | + .omitNullValues() |
93 | - .add("routeType", routeType) | 93 | + .add("routeType", routeType) |
94 | - .add("ipReach", ipReach) | 94 | + .add("ipReach", ipReach) |
95 | - .add("topologyId", topologyId) | 95 | + .add("topologyId", topologyId) |
96 | - .toString(); | 96 | + .toString(); |
97 | - } | 97 | + } |
98 | } | 98 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
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.iptopology.api; | 16 | +package org.onosproject.iptopology.api; |
17 | - | 17 | + |
18 | -import java.util.Objects; | 18 | +import java.util.Objects; |
19 | - | 19 | + |
20 | -import org.onosproject.net.DeviceId; | 20 | +import org.onosproject.net.DeviceId; |
21 | -import org.onosproject.net.ElementId; | 21 | +import org.onosproject.net.ElementId; |
22 | - | 22 | + |
23 | -import com.google.common.base.MoreObjects; | 23 | +import com.google.common.base.MoreObjects; |
24 | - | 24 | + |
25 | -/** | 25 | +/** |
26 | - * Abstraction of a network termination point expressed as a pair of the network element identifier and device | 26 | + * Abstraction of a network termination point expressed as a pair of the network element identifier and device |
27 | - * interface. | 27 | + * interface. |
28 | - */ | 28 | + */ |
29 | -public class TerminationPoint { | 29 | +public class TerminationPoint { |
30 | - private final ElementId elementId; | 30 | + private final ElementId elementId; |
31 | - private final DeviceInterface deviceInterface; | 31 | + private final DeviceInterface deviceInterface; |
32 | - | 32 | + |
33 | - /** | 33 | + /** |
34 | - * Constructor to initialize its parameters. | 34 | + * Constructor to initialize its parameters. |
35 | - * | 35 | + * |
36 | - * @param elementId network element identifier | 36 | + * @param elementId network element identifier |
37 | - * @param deviceInterface device interface | 37 | + * @param deviceInterface device interface |
38 | - */ | 38 | + */ |
39 | - public TerminationPoint(ElementId elementId, DeviceInterface deviceInterface) { | 39 | + public TerminationPoint(ElementId elementId, DeviceInterface deviceInterface) { |
40 | - this.elementId = elementId; | 40 | + this.elementId = elementId; |
41 | - this.deviceInterface = deviceInterface; | 41 | + this.deviceInterface = deviceInterface; |
42 | - } | 42 | + } |
43 | - | 43 | + |
44 | - /** | 44 | + /** |
45 | - * Returns the network element identifier. | 45 | + * Returns the network element identifier. |
46 | - * | 46 | + * |
47 | - * @return element identifier | 47 | + * @return element identifier |
48 | - */ | 48 | + */ |
49 | - public ElementId elementId() { | 49 | + public ElementId elementId() { |
50 | - return elementId; | 50 | + return elementId; |
51 | - } | 51 | + } |
52 | - | 52 | + |
53 | - /** | 53 | + /** |
54 | - * Returns the identifier of the infrastructure device if the termination | 54 | + * Returns the identifier of the infrastructure device if the termination |
55 | - * point belongs to a network element which is indeed an ip | 55 | + * point belongs to a network element which is indeed an ip |
56 | - * device. | 56 | + * device. |
57 | - * | 57 | + * |
58 | - * @return network element identifier as a device identifier | 58 | + * @return network element identifier as a device identifier |
59 | - * @throws java.lang.IllegalStateException if termination point is not | 59 | + * @throws java.lang.IllegalStateException if termination point is not |
60 | - * associated with a device | 60 | + * associated with a device |
61 | - */ | 61 | + */ |
62 | - public DeviceId deviceId() { | 62 | + public DeviceId deviceId() { |
63 | - if (elementId instanceof DeviceId) { | 63 | + if (elementId instanceof DeviceId) { |
64 | - return (DeviceId) elementId; | 64 | + return (DeviceId) elementId; |
65 | - } | 65 | + } |
66 | - throw new IllegalStateException("Termination point not associated " + | 66 | + throw new IllegalStateException("Termination point not associated " + |
67 | - "with an ip device"); | 67 | + "with an ip device"); |
68 | - } | 68 | + } |
69 | - | 69 | + |
70 | - /** | 70 | + /** |
71 | - * Returns Device interface details. | 71 | + * Returns Device interface details. |
72 | - * | 72 | + * |
73 | - * @return device interface details | 73 | + * @return device interface details |
74 | - */ | 74 | + */ |
75 | - public DeviceInterface deviceInterface() { | 75 | + public DeviceInterface deviceInterface() { |
76 | - return deviceInterface; | 76 | + return deviceInterface; |
77 | - } | 77 | + } |
78 | - | 78 | + |
79 | - @Override | 79 | + @Override |
80 | - public int hashCode() { | 80 | + public int hashCode() { |
81 | - return Objects.hash(elementId, deviceInterface); | 81 | + return Objects.hash(elementId, deviceInterface); |
82 | - } | 82 | + } |
83 | - | 83 | + |
84 | - @Override | 84 | + @Override |
85 | - public boolean equals(Object obj) { | 85 | + public boolean equals(Object obj) { |
86 | - if (this == obj) { | 86 | + if (this == obj) { |
87 | - return true; | 87 | + return true; |
88 | - } | 88 | + } |
89 | - if (obj instanceof TerminationPoint) { | 89 | + if (obj instanceof TerminationPoint) { |
90 | - final TerminationPoint other = (TerminationPoint) obj; | 90 | + final TerminationPoint other = (TerminationPoint) obj; |
91 | - return Objects.equals(this.elementId, other.elementId) | 91 | + return Objects.equals(this.elementId, other.elementId) |
92 | - && Objects.equals(this.deviceInterface, other.deviceInterface); | 92 | + && Objects.equals(this.deviceInterface, other.deviceInterface); |
93 | - } | 93 | + } |
94 | - return false; | 94 | + return false; |
95 | - } | 95 | + } |
96 | - | 96 | + |
97 | - @Override | 97 | + @Override |
98 | - public String toString() { | 98 | + public String toString() { |
99 | - return MoreObjects.toStringHelper(this) | 99 | + return MoreObjects.toStringHelper(this) |
100 | - .add("elementId", elementId) | 100 | + .add("elementId", elementId) |
101 | - .add("deviceInterface", deviceInterface) | 101 | + .add("deviceInterface", deviceInterface) |
102 | - .toString(); | 102 | + .toString(); |
103 | - } | 103 | + } |
104 | } | 104 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | -/* | 1 | +/* |
2 | - * Copyright 2014-2015 Open Networking Laboratory | 2 | + * Copyright 2014-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.mfwd.cli; | 16 | +package org.onosproject.mfwd.cli; |
17 | - | 17 | + |
18 | -import org.apache.felix.scr.annotations.Reference; | 18 | +import org.apache.felix.scr.annotations.Reference; |
19 | -import org.apache.felix.scr.annotations.ReferenceCardinality; | 19 | +import org.apache.felix.scr.annotations.ReferenceCardinality; |
20 | -import org.apache.karaf.shell.commands.Argument; | 20 | +import org.apache.karaf.shell.commands.Argument; |
21 | -import org.apache.karaf.shell.commands.Command; | 21 | +import org.apache.karaf.shell.commands.Command; |
22 | -import org.onosproject.cli.AbstractShellCommand; | 22 | +import org.onosproject.cli.AbstractShellCommand; |
23 | -import org.onosproject.mfwd.impl.McastForwarding; | 23 | +import org.onosproject.mfwd.impl.McastForwarding; |
24 | -import org.onosproject.net.ConnectPoint; | 24 | +import org.onosproject.net.ConnectPoint; |
25 | -import org.onosproject.net.mcast.McastRoute; | 25 | +import org.onosproject.net.mcast.McastRoute; |
26 | -import org.onosproject.net.mcast.MulticastRouteService; | 26 | +import org.onosproject.net.mcast.MulticastRouteService; |
27 | - | 27 | + |
28 | -/** | 28 | +/** |
29 | - * Installs a source, multicast group flow. | 29 | + * Installs a source, multicast group flow. |
30 | - */ | 30 | + */ |
31 | -@Command(scope = "onos", name = "mcast-join", | 31 | +@Command(scope = "onos", name = "mcast-join", |
32 | - description = "Installs a source, multicast group flow") | 32 | + description = "Installs a source, multicast group flow") |
33 | -public class McastJoinCommand extends AbstractShellCommand { | 33 | +public class McastJoinCommand extends AbstractShellCommand { |
34 | - | 34 | + |
35 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 35 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
36 | - MulticastRouteService mcastRouteManager = AbstractShellCommand.get(MulticastRouteService.class); | 36 | + MulticastRouteService mcastRouteManager = AbstractShellCommand.get(MulticastRouteService.class); |
37 | - | 37 | + |
38 | - @Argument(index = 0, name = "sAddr", | 38 | + @Argument(index = 0, name = "sAddr", |
39 | - description = "IP Address of the multicast source. '*' can be used for any source (*, G) entry", | 39 | + description = "IP Address of the multicast source. '*' can be used for any source (*, G) entry", |
40 | - required = true, multiValued = false) | 40 | + required = true, multiValued = false) |
41 | - String sAddr = null; | 41 | + String sAddr = null; |
42 | - | 42 | + |
43 | - @Argument(index = 1, name = "gAddr", | 43 | + @Argument(index = 1, name = "gAddr", |
44 | - description = "IP Address of the multicast group", | 44 | + description = "IP Address of the multicast group", |
45 | - required = true, multiValued = false) | 45 | + required = true, multiValued = false) |
46 | - String gAddr = null; | 46 | + String gAddr = null; |
47 | - | 47 | + |
48 | - @Argument(index = 2, name = "ingressPort", | 48 | + @Argument(index = 2, name = "ingressPort", |
49 | - description = "Ingress port of:XXXXXXXXXX/XX", | 49 | + description = "Ingress port of:XXXXXXXXXX/XX", |
50 | - required = false, multiValued = false) | 50 | + required = false, multiValued = false) |
51 | - String ingressPort = null; | 51 | + String ingressPort = null; |
52 | - | 52 | + |
53 | - @Argument(index = 3, name = "ports", | 53 | + @Argument(index = 3, name = "ports", |
54 | - description = "Egress ports of:XXXXXXXXXX/XX...", | 54 | + description = "Egress ports of:XXXXXXXXXX/XX...", |
55 | - required = false, multiValued = true) | 55 | + required = false, multiValued = true) |
56 | - String[] ports = null; | 56 | + String[] ports = null; |
57 | - | 57 | + |
58 | - @Override | 58 | + @Override |
59 | - protected void execute() { | 59 | + protected void execute() { |
60 | - | 60 | + |
61 | - McastRoute mRoute = McastForwarding.createStaticRoute(sAddr, gAddr); | 61 | + McastRoute mRoute = McastForwarding.createStaticRoute(sAddr, gAddr); |
62 | - mcastRouteManager.add(mRoute); | 62 | + mcastRouteManager.add(mRoute); |
63 | - | 63 | + |
64 | - ConnectPoint ingress = ConnectPoint.deviceConnectPoint(ingressPort); | 64 | + ConnectPoint ingress = ConnectPoint.deviceConnectPoint(ingressPort); |
65 | - mcastRouteManager.addSource(mRoute, ingress); | 65 | + mcastRouteManager.addSource(mRoute, ingress); |
66 | - | 66 | + |
67 | - for (String egCP : ports) { | 67 | + for (String egCP : ports) { |
68 | - log.debug("Egress port provided: " + egCP); | 68 | + log.debug("Egress port provided: " + egCP); |
69 | - ConnectPoint egress = ConnectPoint.deviceConnectPoint(egCP); | 69 | + ConnectPoint egress = ConnectPoint.deviceConnectPoint(egCP); |
70 | - mcastRouteManager.addSink(mRoute, egress); | 70 | + mcastRouteManager.addSink(mRoute, egress); |
71 | - | 71 | + |
72 | - } | 72 | + } |
73 | - print("Added the mcast route"); | 73 | + print("Added the mcast route"); |
74 | - } | 74 | + } |
75 | -} | 75 | +} | ... | ... |
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.List; | 18 | +import java.util.List; |
19 | - | 19 | + |
20 | -/** | 20 | +/** |
21 | - * Representation of a Router. | 21 | + * Representation of a Router. |
22 | - */ | 22 | + */ |
23 | -public interface Router { | 23 | +public interface Router { |
24 | - | 24 | + |
25 | - /** | 25 | + /** |
26 | - * Coarse classification of the type of the Router. | 26 | + * Coarse classification of the type of the Router. |
27 | - */ | 27 | + */ |
28 | - public enum Status { | 28 | + public enum Status { |
29 | - /** | 29 | + /** |
30 | - * Signifies that a router is currently active. | 30 | + * Signifies that a router is currently active. |
31 | - */ | 31 | + */ |
32 | - ACTIVE, | 32 | + ACTIVE, |
33 | - /** | 33 | + /** |
34 | - * Signifies that a router is currently inactive. | 34 | + * Signifies that a router is currently inactive. |
35 | - */ | 35 | + */ |
36 | - INACTIVE | 36 | + INACTIVE |
37 | - } | 37 | + } |
38 | - | 38 | + |
39 | - /** | 39 | + /** |
40 | - * Returns the router identifier. | 40 | + * Returns the router identifier. |
41 | - * | 41 | + * |
42 | - * @return identifier | 42 | + * @return identifier |
43 | - */ | 43 | + */ |
44 | - RouterId id(); | 44 | + RouterId id(); |
45 | - | 45 | + |
46 | - /** | 46 | + /** |
47 | - * Returns the router Name. | 47 | + * Returns the router Name. |
48 | - * | 48 | + * |
49 | - * @return routerName | 49 | + * @return routerName |
50 | - */ | 50 | + */ |
51 | - String name(); | 51 | + String name(); |
52 | - | 52 | + |
53 | - /** | 53 | + /** |
54 | - * Returns the router admin state. | 54 | + * Returns the router admin state. |
55 | - * | 55 | + * |
56 | - * @return true or false | 56 | + * @return true or false |
57 | - */ | 57 | + */ |
58 | - boolean adminStateUp(); | 58 | + boolean adminStateUp(); |
59 | - | 59 | + |
60 | - /** | 60 | + /** |
61 | - * Returns the status of router. | 61 | + * Returns the status of router. |
62 | - * | 62 | + * |
63 | - * @return RouterStatus | 63 | + * @return RouterStatus |
64 | - */ | 64 | + */ |
65 | - Status status(); | 65 | + Status status(); |
66 | - | 66 | + |
67 | - /** | 67 | + /** |
68 | - * Returns the distributed status of this router. | 68 | + * Returns the distributed status of this router. |
69 | - * If true, indicates a distributed router. | 69 | + * If true, indicates a distributed router. |
70 | - * | 70 | + * |
71 | - * @return true or false | 71 | + * @return true or false |
72 | - */ | 72 | + */ |
73 | - boolean distributed(); | 73 | + boolean distributed(); |
74 | - | 74 | + |
75 | - /** | 75 | + /** |
76 | - * Returns the RouterGateway of router. | 76 | + * Returns the RouterGateway of router. |
77 | - * | 77 | + * |
78 | - * @return routerGateway | 78 | + * @return routerGateway |
79 | - */ | 79 | + */ |
80 | - RouterGateway externalGatewayInfo(); | 80 | + RouterGateway externalGatewayInfo(); |
81 | - | 81 | + |
82 | - /** | 82 | + /** |
83 | - * Returns the gatewayPortid of router. | 83 | + * Returns the gatewayPortid of router. |
84 | - * | 84 | + * |
85 | - * @return virtualPortId | 85 | + * @return virtualPortId |
86 | - */ | 86 | + */ |
87 | - VirtualPortId gatewayPortid(); | 87 | + VirtualPortId gatewayPortid(); |
88 | - | 88 | + |
89 | - /** | 89 | + /** |
90 | - * Returns the owner(tenant) of this router. | 90 | + * Returns the owner(tenant) of this router. |
91 | - * | 91 | + * |
92 | - * @return tenantId | 92 | + * @return tenantId |
93 | - */ | 93 | + */ |
94 | - TenantId tenantId(); | 94 | + TenantId tenantId(); |
95 | - | 95 | + |
96 | - /** | 96 | + /** |
97 | - * Returns the router list of router. | 97 | + * Returns the router list of router. |
98 | - * | 98 | + * |
99 | - * @return routes | 99 | + * @return routes |
100 | - */ | 100 | + */ |
101 | - List<String> routes(); | 101 | + List<String> routes(); |
102 | -} | 102 | +} | ... | ... |
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.Collection; | 21 | +import java.util.Collection; |
22 | -import java.util.Objects; | 22 | +import java.util.Objects; |
23 | - | 23 | + |
24 | -/** | 24 | +/** |
25 | - * Representation of a Router gateway. | 25 | + * Representation of a Router gateway. |
26 | - */ | 26 | + */ |
27 | -public final class RouterGateway { | 27 | +public final class RouterGateway { |
28 | - | 28 | + |
29 | - private final TenantNetworkId networkId; | 29 | + private final TenantNetworkId networkId; |
30 | - private final boolean enableSnat; | 30 | + private final boolean enableSnat; |
31 | - private final Collection<FixedIp> externalFixedIps; | 31 | + private final Collection<FixedIp> externalFixedIps; |
32 | - | 32 | + |
33 | - // Public construction is prohibited | 33 | + // Public construction is prohibited |
34 | - private RouterGateway(TenantNetworkId networkId, boolean enableSnat, | 34 | + private RouterGateway(TenantNetworkId networkId, boolean enableSnat, |
35 | - Collection<FixedIp> externalFixedIps) { | 35 | + Collection<FixedIp> externalFixedIps) { |
36 | - this.networkId = checkNotNull(networkId, "networkId cannot be null"); | 36 | + this.networkId = checkNotNull(networkId, "networkId cannot be null"); |
37 | - this.enableSnat = checkNotNull(enableSnat, "enableSnat cannot be null"); | 37 | + this.enableSnat = checkNotNull(enableSnat, "enableSnat cannot be null"); |
38 | - this.externalFixedIps = checkNotNull(externalFixedIps, "externalFixedIps cannot be null"); | 38 | + this.externalFixedIps = checkNotNull(externalFixedIps, "externalFixedIps cannot be null"); |
39 | - } | 39 | + } |
40 | - | 40 | + |
41 | - /** | 41 | + /** |
42 | - * Creates router gateway object. | 42 | + * Creates router gateway object. |
43 | - * | 43 | + * |
44 | - * @param networkId network identifier | 44 | + * @param networkId network identifier |
45 | - * @param enableSnat SNAT enable or not | 45 | + * @param enableSnat SNAT enable or not |
46 | - * @param externalFixedIps external fixed IP | 46 | + * @param externalFixedIps external fixed IP |
47 | - * @return RouterGateway | 47 | + * @return RouterGateway |
48 | - */ | 48 | + */ |
49 | - public static RouterGateway routerGateway(TenantNetworkId networkId, boolean enableSnat, | 49 | + public static RouterGateway routerGateway(TenantNetworkId networkId, boolean enableSnat, |
50 | - Collection<FixedIp> externalFixedIps) { | 50 | + Collection<FixedIp> externalFixedIps) { |
51 | - return new RouterGateway(networkId, enableSnat, externalFixedIps); | 51 | + return new RouterGateway(networkId, enableSnat, externalFixedIps); |
52 | - } | 52 | + } |
53 | - | 53 | + |
54 | - /** | 54 | + /** |
55 | - * Returns network identifier. | 55 | + * Returns network identifier. |
56 | - * | 56 | + * |
57 | - * @return networkId | 57 | + * @return networkId |
58 | - */ | 58 | + */ |
59 | - public TenantNetworkId networkId() { | 59 | + public TenantNetworkId networkId() { |
60 | - return networkId; | 60 | + return networkId; |
61 | - } | 61 | + } |
62 | - | 62 | + |
63 | - /** | 63 | + /** |
64 | - * Return SNAT enable or not. | 64 | + * Return SNAT enable or not. |
65 | - * | 65 | + * |
66 | - * @return enableSnat | 66 | + * @return enableSnat |
67 | - */ | 67 | + */ |
68 | - public boolean enableSnat() { | 68 | + public boolean enableSnat() { |
69 | - return enableSnat; | 69 | + return enableSnat; |
70 | - } | 70 | + } |
71 | - | 71 | + |
72 | - /** | 72 | + /** |
73 | - * Return external fixed Ip. | 73 | + * Return external fixed Ip. |
74 | - * | 74 | + * |
75 | - * @return externalFixedIps | 75 | + * @return externalFixedIps |
76 | - */ | 76 | + */ |
77 | - public Collection<FixedIp> externalFixedIps() { | 77 | + public Collection<FixedIp> externalFixedIps() { |
78 | - return externalFixedIps; | 78 | + return externalFixedIps; |
79 | - } | 79 | + } |
80 | - | 80 | + |
81 | - @Override | 81 | + @Override |
82 | - public int hashCode() { | 82 | + public int hashCode() { |
83 | - return Objects.hash(networkId, enableSnat, externalFixedIps); | 83 | + return Objects.hash(networkId, enableSnat, externalFixedIps); |
84 | - } | 84 | + } |
85 | - | 85 | + |
86 | - @Override | 86 | + @Override |
87 | - public boolean equals(Object obj) { | 87 | + public boolean equals(Object obj) { |
88 | - if (this == obj) { | 88 | + if (this == obj) { |
89 | - return true; | 89 | + return true; |
90 | - } | 90 | + } |
91 | - if (obj instanceof RouterGateway) { | 91 | + if (obj instanceof RouterGateway) { |
92 | - final RouterGateway that = (RouterGateway) obj; | 92 | + final RouterGateway that = (RouterGateway) obj; |
93 | - return Objects.equals(this.networkId, that.networkId) | 93 | + return Objects.equals(this.networkId, that.networkId) |
94 | - && Objects.equals(this.enableSnat, that.enableSnat) | 94 | + && Objects.equals(this.enableSnat, that.enableSnat) |
95 | - && Objects.equals(this.externalFixedIps, that.externalFixedIps); | 95 | + && Objects.equals(this.externalFixedIps, that.externalFixedIps); |
96 | - } | 96 | + } |
97 | - return false; | 97 | + return false; |
98 | - } | 98 | + } |
99 | - | 99 | + |
100 | - @Override | 100 | + @Override |
101 | - public String toString() { | 101 | + public String toString() { |
102 | - return toStringHelper(this) | 102 | + return toStringHelper(this) |
103 | - .add("networkId", networkId) | 103 | + .add("networkId", networkId) |
104 | - .add("enableSnat", enableSnat) | 104 | + .add("enableSnat", enableSnat) |
105 | - .add("externalFixedIps", externalFixedIps) | 105 | + .add("externalFixedIps", externalFixedIps) |
106 | - .toString(); | 106 | + .toString(); |
107 | - } | 107 | + } |
108 | -} | 108 | +} | ... | ... |
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.util; | 16 | +package org.onosproject.vtnrsc.util; |
17 | - | 17 | + |
18 | -import java.util.Collection; | 18 | +import java.util.Collection; |
19 | -import java.util.HashMap; | 19 | +import java.util.HashMap; |
20 | -import java.util.LinkedList; | 20 | +import java.util.LinkedList; |
21 | -import java.util.List; | 21 | +import java.util.List; |
22 | -import java.util.Map; | 22 | +import java.util.Map; |
23 | -import java.util.Set; | 23 | +import java.util.Set; |
24 | -import java.util.concurrent.ExecutorService; | 24 | +import java.util.concurrent.ExecutorService; |
25 | -import java.util.concurrent.ScheduledExecutorService; | 25 | +import java.util.concurrent.ScheduledExecutorService; |
26 | -import java.util.concurrent.TimeUnit; | 26 | +import java.util.concurrent.TimeUnit; |
27 | -import java.util.function.BiFunction; | 27 | +import java.util.function.BiFunction; |
28 | - | 28 | + |
29 | -import org.onlab.util.KryoNamespace; | 29 | +import org.onlab.util.KryoNamespace; |
30 | -import org.onosproject.cluster.NodeId; | 30 | +import org.onosproject.cluster.NodeId; |
31 | -import org.onosproject.store.Timestamp; | 31 | +import org.onosproject.store.Timestamp; |
32 | - | 32 | + |
33 | -import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.*; | 33 | +import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.*; |
34 | -import org.onosproject.store.service.EventuallyConsistentMapListener; | 34 | +import org.onosproject.store.service.EventuallyConsistentMapListener; |
35 | -import org.onosproject.store.service.EventuallyConsistentMapEvent; | 35 | +import org.onosproject.store.service.EventuallyConsistentMapEvent; |
36 | -import org.onosproject.store.service.EventuallyConsistentMapBuilder; | 36 | +import org.onosproject.store.service.EventuallyConsistentMapBuilder; |
37 | -import org.onosproject.store.service.EventuallyConsistentMap; | 37 | +import org.onosproject.store.service.EventuallyConsistentMap; |
38 | - | 38 | + |
39 | -/** | 39 | +/** |
40 | - * Testing version of an Eventually Consistent Map. | 40 | + * Testing version of an Eventually Consistent Map. |
41 | - */ | 41 | + */ |
42 | - | 42 | + |
43 | -public final class VtnEventuallyConsistentMapTest<K, V> extends VtnEventuallyConsistentMapAdapter<K, V> { | 43 | +public final class VtnEventuallyConsistentMapTest<K, V> extends VtnEventuallyConsistentMapAdapter<K, V> { |
44 | - | 44 | + |
45 | - private final HashMap<K, V> map; | 45 | + private final HashMap<K, V> map; |
46 | - private final String mapName; | 46 | + private final String mapName; |
47 | - private final List<EventuallyConsistentMapListener<K, V>> listeners; | 47 | + private final List<EventuallyConsistentMapListener<K, V>> listeners; |
48 | - private final BiFunction<K, V, Collection<NodeId>> peerUpdateFunction; | 48 | + private final BiFunction<K, V, Collection<NodeId>> peerUpdateFunction; |
49 | - | 49 | + |
50 | - private VtnEventuallyConsistentMapTest(String mapName, | 50 | + private VtnEventuallyConsistentMapTest(String mapName, |
51 | - BiFunction<K, V, Collection<NodeId>> peerUpdateFunction) { | 51 | + BiFunction<K, V, Collection<NodeId>> peerUpdateFunction) { |
52 | - map = new HashMap<>(); | 52 | + map = new HashMap<>(); |
53 | - listeners = new LinkedList<>(); | 53 | + listeners = new LinkedList<>(); |
54 | - this.mapName = mapName; | 54 | + this.mapName = mapName; |
55 | - this.peerUpdateFunction = peerUpdateFunction; | 55 | + this.peerUpdateFunction = peerUpdateFunction; |
56 | - } | 56 | + } |
57 | - | 57 | + |
58 | - /** | 58 | + /** |
59 | - * Notify all listeners of an event. | 59 | + * Notify all listeners of an event. |
60 | - */ | 60 | + */ |
61 | - private void notifyListeners(EventuallyConsistentMapEvent<K, V> event) { | 61 | + private void notifyListeners(EventuallyConsistentMapEvent<K, V> event) { |
62 | - listeners.forEach( | 62 | + listeners.forEach( |
63 | - listener -> listener.event(event) | 63 | + listener -> listener.event(event) |
64 | - ); | 64 | + ); |
65 | - } | 65 | + } |
66 | - | 66 | + |
67 | - @Override | 67 | + @Override |
68 | - public int size() { | 68 | + public int size() { |
69 | - return map.size(); | 69 | + return map.size(); |
70 | - } | 70 | + } |
71 | - | 71 | + |
72 | - @Override | 72 | + @Override |
73 | - public boolean isEmpty() { | 73 | + public boolean isEmpty() { |
74 | - return map.isEmpty(); | 74 | + return map.isEmpty(); |
75 | - } | 75 | + } |
76 | - | 76 | + |
77 | - @Override | 77 | + @Override |
78 | - public boolean containsKey(K key) { | 78 | + public boolean containsKey(K key) { |
79 | - return map.containsKey(key); | 79 | + return map.containsKey(key); |
80 | - } | 80 | + } |
81 | - | 81 | + |
82 | - @Override | 82 | + @Override |
83 | - public boolean containsValue(V value) { | 83 | + public boolean containsValue(V value) { |
84 | - return map.containsValue(value); | 84 | + return map.containsValue(value); |
85 | - } | 85 | + } |
86 | - | 86 | + |
87 | - @Override | 87 | + @Override |
88 | - public V get(K key) { | 88 | + public V get(K key) { |
89 | - return map.get(key); | 89 | + return map.get(key); |
90 | - } | 90 | + } |
91 | - | 91 | + |
92 | - @Override | 92 | + @Override |
93 | - public void put(K key, V value) { | 93 | + public void put(K key, V value) { |
94 | - map.put(key, value); | 94 | + map.put(key, value); |
95 | - EventuallyConsistentMapEvent<K, V> addEvent = | 95 | + EventuallyConsistentMapEvent<K, V> addEvent = |
96 | - new EventuallyConsistentMapEvent<>(mapName, PUT, key, value); | 96 | + new EventuallyConsistentMapEvent<>(mapName, PUT, key, value); |
97 | - notifyListeners(addEvent); | 97 | + notifyListeners(addEvent); |
98 | - if (peerUpdateFunction != null) { | 98 | + if (peerUpdateFunction != null) { |
99 | - peerUpdateFunction.apply(key, value); | 99 | + peerUpdateFunction.apply(key, value); |
100 | - } | 100 | + } |
101 | - } | 101 | + } |
102 | - | 102 | + |
103 | - @Override | 103 | + @Override |
104 | - public V remove(K key) { | 104 | + public V remove(K key) { |
105 | - V result = map.remove(key); | 105 | + V result = map.remove(key); |
106 | - if (result != null) { | 106 | + if (result != null) { |
107 | - EventuallyConsistentMapEvent<K, V> removeEvent = | 107 | + EventuallyConsistentMapEvent<K, V> removeEvent = |
108 | - new EventuallyConsistentMapEvent<>(mapName, REMOVE, | 108 | + new EventuallyConsistentMapEvent<>(mapName, REMOVE, |
109 | - key, map.get(key)); | 109 | + key, map.get(key)); |
110 | - notifyListeners(removeEvent); | 110 | + notifyListeners(removeEvent); |
111 | - } | 111 | + } |
112 | - return result; | 112 | + return result; |
113 | - } | 113 | + } |
114 | - | 114 | + |
115 | - @Override | 115 | + @Override |
116 | - public void remove(K key, V value) { | 116 | + public void remove(K key, V value) { |
117 | - boolean removed = map.remove(key, value); | 117 | + boolean removed = map.remove(key, value); |
118 | - if (removed) { | 118 | + if (removed) { |
119 | - EventuallyConsistentMapEvent<K, V> removeEvent = | 119 | + EventuallyConsistentMapEvent<K, V> removeEvent = |
120 | - new EventuallyConsistentMapEvent<>(mapName, REMOVE, key, value); | 120 | + new EventuallyConsistentMapEvent<>(mapName, REMOVE, key, value); |
121 | - notifyListeners(removeEvent); | 121 | + notifyListeners(removeEvent); |
122 | - } | 122 | + } |
123 | - } | 123 | + } |
124 | - | 124 | + |
125 | - @Override | 125 | + @Override |
126 | - public V compute(K key, BiFunction<K, V, V> recomputeFunction) { | 126 | + public V compute(K key, BiFunction<K, V, V> recomputeFunction) { |
127 | - return map.compute(key, recomputeFunction); | 127 | + return map.compute(key, recomputeFunction); |
128 | - } | 128 | + } |
129 | - | 129 | + |
130 | - @Override | 130 | + @Override |
131 | - public void putAll(Map<? extends K, ? extends V> m) { | 131 | + public void putAll(Map<? extends K, ? extends V> m) { |
132 | - map.putAll(m); | 132 | + map.putAll(m); |
133 | - } | 133 | + } |
134 | - | 134 | + |
135 | - @Override | 135 | + @Override |
136 | - public void clear() { | 136 | + public void clear() { |
137 | - map.clear(); | 137 | + map.clear(); |
138 | - } | 138 | + } |
139 | - | 139 | + |
140 | - @Override | 140 | + @Override |
141 | - public Set<K> keySet() { | 141 | + public Set<K> keySet() { |
142 | - return map.keySet(); | 142 | + return map.keySet(); |
143 | - } | 143 | + } |
144 | - | 144 | + |
145 | - @Override | 145 | + @Override |
146 | - public Collection<V> values() { | 146 | + public Collection<V> values() { |
147 | - return map.values(); | 147 | + return map.values(); |
148 | - } | 148 | + } |
149 | - | 149 | + |
150 | - @Override | 150 | + @Override |
151 | - public Set<Map.Entry<K, V>> entrySet() { | 151 | + public Set<Map.Entry<K, V>> entrySet() { |
152 | - return map.entrySet(); | 152 | + return map.entrySet(); |
153 | - } | 153 | + } |
154 | - | 154 | + |
155 | - public static <K, V> Builder<K, V> builder() { | 155 | + public static <K, V> Builder<K, V> builder() { |
156 | - return new Builder<>(); | 156 | + return new Builder<>(); |
157 | - } | 157 | + } |
158 | - | 158 | + |
159 | - @Override | 159 | + @Override |
160 | - public void addListener(EventuallyConsistentMapListener<K, V> listener) { | 160 | + public void addListener(EventuallyConsistentMapListener<K, V> listener) { |
161 | - listeners.add(listener); | 161 | + listeners.add(listener); |
162 | - } | 162 | + } |
163 | - | 163 | + |
164 | - @Override | 164 | + @Override |
165 | - public void removeListener(EventuallyConsistentMapListener<K, V> listener) { | 165 | + public void removeListener(EventuallyConsistentMapListener<K, V> listener) { |
166 | - listeners.remove(listener); | 166 | + listeners.remove(listener); |
167 | - } | 167 | + } |
168 | - | 168 | + |
169 | - public static class Builder<K, V> implements EventuallyConsistentMapBuilder<K, V> { | 169 | + public static class Builder<K, V> implements EventuallyConsistentMapBuilder<K, V> { |
170 | - private String name; | 170 | + private String name; |
171 | - private BiFunction<K, V, Collection<NodeId>> peerUpdateFunction; | 171 | + private BiFunction<K, V, Collection<NodeId>> peerUpdateFunction; |
172 | - | 172 | + |
173 | - @Override | 173 | + @Override |
174 | - public EventuallyConsistentMapBuilder<K, V> withName(String name) { | 174 | + public EventuallyConsistentMapBuilder<K, V> withName(String name) { |
175 | - this.name = name; | 175 | + this.name = name; |
176 | - return this; | 176 | + return this; |
177 | - } | 177 | + } |
178 | - | 178 | + |
179 | - @Override | 179 | + @Override |
180 | - public EventuallyConsistentMapBuilder<K, V> withSerializer(KryoNamespace.Builder serializerBuilder) { | 180 | + public EventuallyConsistentMapBuilder<K, V> withSerializer(KryoNamespace.Builder serializerBuilder) { |
181 | - return this; | 181 | + return this; |
182 | - } | 182 | + } |
183 | - | 183 | + |
184 | - @Override | 184 | + @Override |
185 | - public EventuallyConsistentMapBuilder<K, V> | 185 | + public EventuallyConsistentMapBuilder<K, V> |
186 | - withTimestampProvider(BiFunction<K, V, Timestamp> timestampProvider) { | 186 | + withTimestampProvider(BiFunction<K, V, Timestamp> timestampProvider) { |
187 | - return this; | 187 | + return this; |
188 | - } | 188 | + } |
189 | - | 189 | + |
190 | - @Override | 190 | + @Override |
191 | - public EventuallyConsistentMapBuilder<K, V> withEventExecutor(ExecutorService executor) { | 191 | + public EventuallyConsistentMapBuilder<K, V> withEventExecutor(ExecutorService executor) { |
192 | - return this; | 192 | + return this; |
193 | - } | 193 | + } |
194 | - | 194 | + |
195 | - @Override | 195 | + @Override |
196 | - public EventuallyConsistentMapBuilder<K, V> withCommunicationExecutor(ExecutorService executor) { | 196 | + public EventuallyConsistentMapBuilder<K, V> withCommunicationExecutor(ExecutorService executor) { |
197 | - return this; | 197 | + return this; |
198 | - } | 198 | + } |
199 | - | 199 | + |
200 | - @Override | 200 | + @Override |
201 | - public EventuallyConsistentMapBuilder<K, V> withBackgroundExecutor(ScheduledExecutorService executor) { | 201 | + public EventuallyConsistentMapBuilder<K, V> withBackgroundExecutor(ScheduledExecutorService executor) { |
202 | - return this; | 202 | + return this; |
203 | - } | 203 | + } |
204 | - | 204 | + |
205 | - @Override | 205 | + @Override |
206 | - public EventuallyConsistentMapBuilder<K, V> | 206 | + public EventuallyConsistentMapBuilder<K, V> |
207 | - withPeerUpdateFunction(BiFunction<K, V, Collection<NodeId>> peerUpdateFunction) { | 207 | + withPeerUpdateFunction(BiFunction<K, V, Collection<NodeId>> peerUpdateFunction) { |
208 | - this.peerUpdateFunction = peerUpdateFunction; | 208 | + this.peerUpdateFunction = peerUpdateFunction; |
209 | - return this; | 209 | + return this; |
210 | - } | 210 | + } |
211 | - | 211 | + |
212 | - @Override | 212 | + @Override |
213 | - public EventuallyConsistentMapBuilder<K, V> withTombstonesDisabled() { | 213 | + public EventuallyConsistentMapBuilder<K, V> withTombstonesDisabled() { |
214 | - return this; | 214 | + return this; |
215 | - } | 215 | + } |
216 | - | 216 | + |
217 | - @Override | 217 | + @Override |
218 | - public EventuallyConsistentMapBuilder<K, V> withAntiEntropyPeriod(long period, TimeUnit unit) { | 218 | + public EventuallyConsistentMapBuilder<K, V> withAntiEntropyPeriod(long period, TimeUnit unit) { |
219 | - return this; | 219 | + return this; |
220 | - } | 220 | + } |
221 | - | 221 | + |
222 | - @Override | 222 | + @Override |
223 | - public EventuallyConsistentMapBuilder<K, V> withFasterConvergence() { | 223 | + public EventuallyConsistentMapBuilder<K, V> withFasterConvergence() { |
224 | - return this; | 224 | + return this; |
225 | - } | 225 | + } |
226 | - | 226 | + |
227 | - @Override | 227 | + @Override |
228 | - public EventuallyConsistentMapBuilder<K, V> withPersistence() { | 228 | + public EventuallyConsistentMapBuilder<K, V> withPersistence() { |
229 | - return this; | 229 | + return this; |
230 | - } | 230 | + } |
231 | - | 231 | + |
232 | - @Override | 232 | + @Override |
233 | - public EventuallyConsistentMap<K, V> build() { | 233 | + public EventuallyConsistentMap<K, V> build() { |
234 | - if (name == null) { | 234 | + if (name == null) { |
235 | - name = "test"; | 235 | + name = "test"; |
236 | - } | 236 | + } |
237 | - return new VtnEventuallyConsistentMapTest<>(name, peerUpdateFunction); | 237 | + return new VtnEventuallyConsistentMapTest<>(name, peerUpdateFunction); |
238 | - } | 238 | + } |
239 | - } | 239 | + } |
240 | - | 240 | + |
241 | -} | 241 | +} |
242 | - | 242 | + | ... | ... |
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.util; | 16 | +package org.onosproject.vtnrsc.util; |
17 | - | 17 | + |
18 | -import org.onosproject.store.service.EventuallyConsistentMapBuilder; | 18 | +import org.onosproject.store.service.EventuallyConsistentMapBuilder; |
19 | -import org.onosproject.store.service.ConsistentMapBuilder; | 19 | +import org.onosproject.store.service.ConsistentMapBuilder; |
20 | -import org.onosproject.store.service.DistributedSetBuilder; | 20 | +import org.onosproject.store.service.DistributedSetBuilder; |
21 | -import org.onosproject.store.service.DistributedQueueBuilder; | 21 | +import org.onosproject.store.service.DistributedQueueBuilder; |
22 | -import org.onosproject.store.service.AtomicCounterBuilder; | 22 | +import org.onosproject.store.service.AtomicCounterBuilder; |
23 | -import org.onosproject.store.service.AtomicValueBuilder; | 23 | +import org.onosproject.store.service.AtomicValueBuilder; |
24 | -import org.onosproject.store.service.TransactionContextBuilder; | 24 | +import org.onosproject.store.service.TransactionContextBuilder; |
25 | -import org.onosproject.store.service.StorageService; | 25 | +import org.onosproject.store.service.StorageService; |
26 | - | 26 | + |
27 | -/** | 27 | +/** |
28 | - * Adapter for the storage service. | 28 | + * Adapter for the storage service. |
29 | - */ | 29 | + */ |
30 | -public class VtnStorageServiceAdapter implements StorageService { | 30 | +public class VtnStorageServiceAdapter implements StorageService { |
31 | - @Override | 31 | + @Override |
32 | - public <K, V> EventuallyConsistentMapBuilder<K, V> eventuallyConsistentMapBuilder() { | 32 | + public <K, V> EventuallyConsistentMapBuilder<K, V> eventuallyConsistentMapBuilder() { |
33 | - return null; | 33 | + return null; |
34 | - } | 34 | + } |
35 | - | 35 | + |
36 | - @Override | 36 | + @Override |
37 | - public <K, V> ConsistentMapBuilder<K, V> consistentMapBuilder() { | 37 | + public <K, V> ConsistentMapBuilder<K, V> consistentMapBuilder() { |
38 | - return null; | 38 | + return null; |
39 | - } | 39 | + } |
40 | - | 40 | + |
41 | - @Override | 41 | + @Override |
42 | - public <E> DistributedSetBuilder<E> setBuilder() { | 42 | + public <E> DistributedSetBuilder<E> setBuilder() { |
43 | - return null; | 43 | + return null; |
44 | - } | 44 | + } |
45 | - | 45 | + |
46 | - @Override | 46 | + @Override |
47 | - public <E> DistributedQueueBuilder<E> queueBuilder() { | 47 | + public <E> DistributedQueueBuilder<E> queueBuilder() { |
48 | - return null; | 48 | + return null; |
49 | - } | 49 | + } |
50 | - | 50 | + |
51 | - @Override | 51 | + @Override |
52 | - public AtomicCounterBuilder atomicCounterBuilder() { | 52 | + public AtomicCounterBuilder atomicCounterBuilder() { |
53 | - return null; | 53 | + return null; |
54 | - } | 54 | + } |
55 | - | 55 | + |
56 | - @Override | 56 | + @Override |
57 | - public <V> AtomicValueBuilder<V> atomicValueBuilder() { | 57 | + public <V> AtomicValueBuilder<V> atomicValueBuilder() { |
58 | - return null; | 58 | + return null; |
59 | - } | 59 | + } |
60 | - | 60 | + |
61 | - @Override | 61 | + @Override |
62 | - public TransactionContextBuilder transactionContextBuilder() { | 62 | + public TransactionContextBuilder transactionContextBuilder() { |
63 | - return null; | 63 | + return null; |
64 | - } | 64 | + } |
65 | -} | 65 | +} | ... | ... |
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.util; | 16 | +package org.onosproject.vtnrsc.util; |
17 | - | 17 | + |
18 | -import org.onosproject.store.service.EventuallyConsistentMapBuilder; | 18 | +import org.onosproject.store.service.EventuallyConsistentMapBuilder; |
19 | - | 19 | + |
20 | -public class VtnStorageServiceTest extends VtnStorageServiceAdapter { | 20 | +public class VtnStorageServiceTest extends VtnStorageServiceAdapter { |
21 | - @Override | 21 | + @Override |
22 | - public <K, V> EventuallyConsistentMapBuilder<K, V> eventuallyConsistentMapBuilder() { | 22 | + public <K, V> EventuallyConsistentMapBuilder<K, V> eventuallyConsistentMapBuilder() { |
23 | - return VtnEventuallyConsistentMapTest.builder(); | 23 | + return VtnEventuallyConsistentMapTest.builder(); |
24 | - } | 24 | + } |
25 | -} | 25 | +} | ... | ... |
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 | - | 16 | + |
17 | -package org.onosproject.cli.net; | 17 | +package org.onosproject.cli.net; |
18 | - | 18 | + |
19 | -import org.apache.karaf.shell.commands.Argument; | 19 | +import org.apache.karaf.shell.commands.Argument; |
20 | -import org.apache.karaf.shell.commands.Command; | 20 | +import org.apache.karaf.shell.commands.Command; |
21 | -import org.apache.karaf.shell.commands.Option; | 21 | +import org.apache.karaf.shell.commands.Option; |
22 | -import org.onosproject.cli.AbstractShellCommand; | 22 | +import org.onosproject.cli.AbstractShellCommand; |
23 | -import org.onosproject.net.ConnectPoint; | 23 | +import org.onosproject.net.ConnectPoint; |
24 | -import org.onosproject.net.Device; | 24 | +import org.onosproject.net.Device; |
25 | -import org.onosproject.net.DeviceId; | 25 | +import org.onosproject.net.DeviceId; |
26 | -import org.onosproject.net.Port; | 26 | +import org.onosproject.net.Port; |
27 | -import org.onosproject.net.PortNumber; | 27 | +import org.onosproject.net.PortNumber; |
28 | -import org.onosproject.net.device.DeviceService; | 28 | +import org.onosproject.net.device.DeviceService; |
29 | -import org.onosproject.net.flow.TypedStoredFlowEntry; | 29 | +import org.onosproject.net.flow.TypedStoredFlowEntry; |
30 | -import org.onosproject.net.flow.instructions.Instruction; | 30 | +import org.onosproject.net.flow.instructions.Instruction; |
31 | -import org.onosproject.net.statistic.FlowStatisticService; | 31 | +import org.onosproject.net.statistic.FlowStatisticService; |
32 | -import org.onosproject.net.statistic.SummaryFlowEntryWithLoad; | 32 | +import org.onosproject.net.statistic.SummaryFlowEntryWithLoad; |
33 | -import org.onosproject.net.statistic.TypedFlowEntryWithLoad; | 33 | +import org.onosproject.net.statistic.TypedFlowEntryWithLoad; |
34 | - | 34 | + |
35 | -import java.util.List; | 35 | +import java.util.List; |
36 | -import java.util.Map; | 36 | +import java.util.Map; |
37 | - | 37 | + |
38 | -import static org.onosproject.net.DeviceId.deviceId; | 38 | +import static org.onosproject.net.DeviceId.deviceId; |
39 | -import static org.onosproject.net.PortNumber.portNumber; | 39 | +import static org.onosproject.net.PortNumber.portNumber; |
40 | - | 40 | + |
41 | -/** | 41 | +/** |
42 | - * Fetches flow statistics with a flow type and instruction type. | 42 | + * Fetches flow statistics with a flow type and instruction type. |
43 | - */ | 43 | + */ |
44 | -@Command(scope = "onos", name = "get-flow-stats", | 44 | +@Command(scope = "onos", name = "get-flow-stats", |
45 | - description = "Fetches flow stats for a connection point with given flow type and instruction type") | 45 | + description = "Fetches flow stats for a connection point with given flow type and instruction type") |
46 | -public class GetFlowStatistics extends AbstractShellCommand { | 46 | +public class GetFlowStatistics extends AbstractShellCommand { |
47 | - @Argument(index = 0, name = "devicePort", | 47 | + @Argument(index = 0, name = "devicePort", |
48 | - description = "Device[/Port] connectPoint Description", | 48 | + description = "Device[/Port] connectPoint Description", |
49 | - required = true, multiValued = false) | 49 | + required = true, multiValued = false) |
50 | - String devicePort = null; | 50 | + String devicePort = null; |
51 | - | 51 | + |
52 | - @Option(name = "-s", aliases = "--summary", | 52 | + @Option(name = "-s", aliases = "--summary", |
53 | - description = "Show flow stats summary", | 53 | + description = "Show flow stats summary", |
54 | - required = false, multiValued = false) | 54 | + required = false, multiValued = false) |
55 | - boolean showSummary = true; // default summary | 55 | + boolean showSummary = true; // default summary |
56 | - | 56 | + |
57 | - @Option(name = "-a", aliases = "--all", | 57 | + @Option(name = "-a", aliases = "--all", |
58 | - description = "Show flow stats all", | 58 | + description = "Show flow stats all", |
59 | - required = false, multiValued = false) | 59 | + required = false, multiValued = false) |
60 | - boolean showAll = false; | 60 | + boolean showAll = false; |
61 | - | 61 | + |
62 | - @Option(name = "-t", aliases = "--topn", | 62 | + @Option(name = "-t", aliases = "--topn", |
63 | - description = "Show flow stats topn", | 63 | + description = "Show flow stats topn", |
64 | - required = false, multiValued = false) | 64 | + required = false, multiValued = false) |
65 | - String showTopn = null; | 65 | + String showTopn = null; |
66 | - | 66 | + |
67 | - @Option(name = "-f", aliases = "--flowType", | 67 | + @Option(name = "-f", aliases = "--flowType", |
68 | - description = "Flow live type, It includes IMMEDIATE, SHORT, MID, LONG, UNKNOWN" | 68 | + description = "Flow live type, It includes IMMEDIATE, SHORT, MID, LONG, UNKNOWN" |
69 | - + ", and is valid with -a or -t option only", | 69 | + + ", and is valid with -a or -t option only", |
70 | - required = false, multiValued = false) | 70 | + required = false, multiValued = false) |
71 | - String flowLiveType = null; | 71 | + String flowLiveType = null; |
72 | - | 72 | + |
73 | - @Option(name = "-i", aliases = "--instructionType", | 73 | + @Option(name = "-i", aliases = "--instructionType", |
74 | - description = "Flow instruction type, It includes DROP, OUTPUT, GROUP, L0MODIFICATION, L2MODIFICATION," | 74 | + description = "Flow instruction type, It includes DROP, OUTPUT, GROUP, L0MODIFICATION, L2MODIFICATION," |
75 | - + " TABLE, L3MODIFICATION, METADATA" | 75 | + + " TABLE, L3MODIFICATION, METADATA" |
76 | - + ", and is valid with -a or -t option only", | 76 | + + ", and is valid with -a or -t option only", |
77 | - required = false, multiValued = false) | 77 | + required = false, multiValued = false) |
78 | - String instructionType = null; | 78 | + String instructionType = null; |
79 | - | 79 | + |
80 | - @Override | 80 | + @Override |
81 | - protected void execute() { | 81 | + protected void execute() { |
82 | - DeviceService deviceService = get(DeviceService.class); | 82 | + DeviceService deviceService = get(DeviceService.class); |
83 | - FlowStatisticService flowStatsService = get(FlowStatisticService.class); | 83 | + FlowStatisticService flowStatsService = get(FlowStatisticService.class); |
84 | - | 84 | + |
85 | - String deviceUri = getDeviceId(devicePort); | 85 | + String deviceUri = getDeviceId(devicePort); |
86 | - String portUri = getPortNumber(devicePort); | 86 | + String portUri = getPortNumber(devicePort); |
87 | - | 87 | + |
88 | - DeviceId ingressDeviceId = deviceId(deviceUri); | 88 | + DeviceId ingressDeviceId = deviceId(deviceUri); |
89 | - PortNumber ingressPortNumber; | 89 | + PortNumber ingressPortNumber; |
90 | - if (portUri.length() == 0) { | 90 | + if (portUri.length() == 0) { |
91 | - ingressPortNumber = null; | 91 | + ingressPortNumber = null; |
92 | - } else { | 92 | + } else { |
93 | - ingressPortNumber = portNumber(portUri); | 93 | + ingressPortNumber = portNumber(portUri); |
94 | - } | 94 | + } |
95 | - | 95 | + |
96 | - Device device = deviceService.getDevice(ingressDeviceId); | 96 | + Device device = deviceService.getDevice(ingressDeviceId); |
97 | - if (device == null) { | 97 | + if (device == null) { |
98 | - error("No such device %s", ingressDeviceId.uri()); | 98 | + error("No such device %s", ingressDeviceId.uri()); |
99 | - return; | 99 | + return; |
100 | - } | 100 | + } |
101 | - | 101 | + |
102 | - if (ingressPortNumber != null) { | 102 | + if (ingressPortNumber != null) { |
103 | - Port port = deviceService.getPort(ingressDeviceId, ingressPortNumber); | 103 | + Port port = deviceService.getPort(ingressDeviceId, ingressPortNumber); |
104 | - if (port == null) { | 104 | + if (port == null) { |
105 | - error("No such port %s on device %s", portUri, ingressDeviceId.uri()); | 105 | + error("No such port %s on device %s", portUri, ingressDeviceId.uri()); |
106 | - return; | 106 | + return; |
107 | - } | 107 | + } |
108 | - } | 108 | + } |
109 | - | 109 | + |
110 | - if (flowLiveType != null) { | 110 | + if (flowLiveType != null) { |
111 | - flowLiveType = flowLiveType.toUpperCase(); | 111 | + flowLiveType = flowLiveType.toUpperCase(); |
112 | - } | 112 | + } |
113 | - if (instructionType != null) { | 113 | + if (instructionType != null) { |
114 | - instructionType = instructionType.toUpperCase(); | 114 | + instructionType = instructionType.toUpperCase(); |
115 | - } | 115 | + } |
116 | - | 116 | + |
117 | - // convert String to FlowLiveType and check validity | 117 | + // convert String to FlowLiveType and check validity |
118 | - TypedStoredFlowEntry.FlowLiveType inLiveType; | 118 | + TypedStoredFlowEntry.FlowLiveType inLiveType; |
119 | - if (flowLiveType == null) { | 119 | + if (flowLiveType == null) { |
120 | - inLiveType = null; | 120 | + inLiveType = null; |
121 | - } else { | 121 | + } else { |
122 | - inLiveType = getFlowLiveType(flowLiveType); | 122 | + inLiveType = getFlowLiveType(flowLiveType); |
123 | - if (inLiveType == null) { | 123 | + if (inLiveType == null) { |
124 | - error("Invalid flow live type [%s] error", flowLiveType); | 124 | + error("Invalid flow live type [%s] error", flowLiveType); |
125 | - return; | 125 | + return; |
126 | - } | 126 | + } |
127 | - } | 127 | + } |
128 | - // convert String to InstructionType and check validity | 128 | + // convert String to InstructionType and check validity |
129 | - Instruction.Type inInstructionType; | 129 | + Instruction.Type inInstructionType; |
130 | - if (instructionType == null) { | 130 | + if (instructionType == null) { |
131 | - inInstructionType = null; | 131 | + inInstructionType = null; |
132 | - } else { | 132 | + } else { |
133 | - inInstructionType = getInstructionType(instructionType); | 133 | + inInstructionType = getInstructionType(instructionType); |
134 | - if (inInstructionType == null) { | 134 | + if (inInstructionType == null) { |
135 | - error("Invalid instruction type [%s] error", instructionType); | 135 | + error("Invalid instruction type [%s] error", instructionType); |
136 | - return; | 136 | + return; |
137 | - } | 137 | + } |
138 | - } | 138 | + } |
139 | - | 139 | + |
140 | - if (showTopn != null) { | 140 | + if (showTopn != null) { |
141 | - int topn = Integer.parseInt(showTopn); | 141 | + int topn = Integer.parseInt(showTopn); |
142 | - | 142 | + |
143 | - if (topn <= 0) { | 143 | + if (topn <= 0) { |
144 | - topn = 100; //default value | 144 | + topn = 100; //default value |
145 | - } else if (topn > 1000) { | 145 | + } else if (topn > 1000) { |
146 | - topn = 1000; //max value | 146 | + topn = 1000; //max value |
147 | - } | 147 | + } |
148 | - | 148 | + |
149 | - // print show topn head line with type | 149 | + // print show topn head line with type |
150 | - print("deviceId=%s, show TOPN=%s flows, live type=%s, instruction type=%s", | 150 | + print("deviceId=%s, show TOPN=%s flows, live type=%s, instruction type=%s", |
151 | - deviceUri, | 151 | + deviceUri, |
152 | - Integer.toString(topn), | 152 | + Integer.toString(topn), |
153 | - flowLiveType == null ? "ALL" : flowLiveType, | 153 | + flowLiveType == null ? "ALL" : flowLiveType, |
154 | - instructionType == null ? "ALL" : instructionType); | 154 | + instructionType == null ? "ALL" : instructionType); |
155 | - if (ingressPortNumber == null) { | 155 | + if (ingressPortNumber == null) { |
156 | - Map<ConnectPoint, List<TypedFlowEntryWithLoad>> typedFlowLoadMap = | 156 | + Map<ConnectPoint, List<TypedFlowEntryWithLoad>> typedFlowLoadMap = |
157 | - flowStatsService.loadTopnByType(device, inLiveType, inInstructionType, topn); | 157 | + flowStatsService.loadTopnByType(device, inLiveType, inInstructionType, topn); |
158 | - // print all ports topn flows load for a given device | 158 | + // print all ports topn flows load for a given device |
159 | - for (ConnectPoint cp : typedFlowLoadMap.keySet()) { | 159 | + for (ConnectPoint cp : typedFlowLoadMap.keySet()) { |
160 | - printPortFlowsLoad(cp, typedFlowLoadMap.get(cp)); | 160 | + printPortFlowsLoad(cp, typedFlowLoadMap.get(cp)); |
161 | - } | 161 | + } |
162 | - } else { | 162 | + } else { |
163 | - List<TypedFlowEntryWithLoad> typedFlowLoad = | 163 | + List<TypedFlowEntryWithLoad> typedFlowLoad = |
164 | - flowStatsService.loadTopnByType(device, ingressPortNumber, inLiveType, inInstructionType, topn); | 164 | + flowStatsService.loadTopnByType(device, ingressPortNumber, inLiveType, inInstructionType, topn); |
165 | - // print device/port topn flows load | 165 | + // print device/port topn flows load |
166 | - ConnectPoint cp = new ConnectPoint(ingressDeviceId, ingressPortNumber); | 166 | + ConnectPoint cp = new ConnectPoint(ingressDeviceId, ingressPortNumber); |
167 | - printPortFlowsLoad(cp, typedFlowLoad); | 167 | + printPortFlowsLoad(cp, typedFlowLoad); |
168 | - } | 168 | + } |
169 | - } else if (showAll) { // is true? | 169 | + } else if (showAll) { // is true? |
170 | - // print show all head line with type | 170 | + // print show all head line with type |
171 | - print("deviceId=%s, show ALL flows, live type=%s, instruction type=%s", | 171 | + print("deviceId=%s, show ALL flows, live type=%s, instruction type=%s", |
172 | - deviceUri, | 172 | + deviceUri, |
173 | - flowLiveType == null ? "ALL" : flowLiveType, | 173 | + flowLiveType == null ? "ALL" : flowLiveType, |
174 | - instructionType == null ? "ALL" : instructionType); | 174 | + instructionType == null ? "ALL" : instructionType); |
175 | - if (ingressPortNumber == null) { | 175 | + if (ingressPortNumber == null) { |
176 | - Map<ConnectPoint, List<TypedFlowEntryWithLoad>> typedFlowLoadMap = | 176 | + Map<ConnectPoint, List<TypedFlowEntryWithLoad>> typedFlowLoadMap = |
177 | - flowStatsService.loadAllByType(device, inLiveType, inInstructionType); | 177 | + flowStatsService.loadAllByType(device, inLiveType, inInstructionType); |
178 | - // print all ports all flows load for a given device | 178 | + // print all ports all flows load for a given device |
179 | - for (ConnectPoint cp : typedFlowLoadMap.keySet()) { | 179 | + for (ConnectPoint cp : typedFlowLoadMap.keySet()) { |
180 | - printPortFlowsLoad(cp, typedFlowLoadMap.get(cp)); | 180 | + printPortFlowsLoad(cp, typedFlowLoadMap.get(cp)); |
181 | - } | 181 | + } |
182 | - } else { | 182 | + } else { |
183 | - List<TypedFlowEntryWithLoad> typedFlowLoad = | 183 | + List<TypedFlowEntryWithLoad> typedFlowLoad = |
184 | - flowStatsService.loadAllByType(device, ingressPortNumber, inLiveType, inInstructionType); | 184 | + flowStatsService.loadAllByType(device, ingressPortNumber, inLiveType, inInstructionType); |
185 | - // print device/port all flows load | 185 | + // print device/port all flows load |
186 | - ConnectPoint cp = new ConnectPoint(ingressDeviceId, ingressPortNumber); | 186 | + ConnectPoint cp = new ConnectPoint(ingressDeviceId, ingressPortNumber); |
187 | - printPortFlowsLoad(cp, typedFlowLoad); | 187 | + printPortFlowsLoad(cp, typedFlowLoad); |
188 | - } | 188 | + } |
189 | - } else { // if (showSummary == true) //always is true | 189 | + } else { // if (showSummary == true) //always is true |
190 | - // print show summary head line | 190 | + // print show summary head line |
191 | - print("deviceId=%s, show SUMMARY flows", deviceUri); | 191 | + print("deviceId=%s, show SUMMARY flows", deviceUri); |
192 | - if (ingressPortNumber == null) { | 192 | + if (ingressPortNumber == null) { |
193 | - Map<ConnectPoint, SummaryFlowEntryWithLoad> summaryFlowLoadMap = | 193 | + Map<ConnectPoint, SummaryFlowEntryWithLoad> summaryFlowLoadMap = |
194 | - flowStatsService.loadSummary(device); | 194 | + flowStatsService.loadSummary(device); |
195 | - // print all ports flow load summary for a given device | 195 | + // print all ports flow load summary for a given device |
196 | - for (ConnectPoint cp : summaryFlowLoadMap.keySet()) { | 196 | + for (ConnectPoint cp : summaryFlowLoadMap.keySet()) { |
197 | - printPortSummaryLoad(cp, summaryFlowLoadMap.get(cp)); | 197 | + printPortSummaryLoad(cp, summaryFlowLoadMap.get(cp)); |
198 | - } | 198 | + } |
199 | - } else { | 199 | + } else { |
200 | - SummaryFlowEntryWithLoad summaryFlowLoad = | 200 | + SummaryFlowEntryWithLoad summaryFlowLoad = |
201 | - flowStatsService.loadSummary(device, ingressPortNumber); | 201 | + flowStatsService.loadSummary(device, ingressPortNumber); |
202 | - // print device/port flow load summary | 202 | + // print device/port flow load summary |
203 | - ConnectPoint cp = new ConnectPoint(ingressDeviceId, ingressPortNumber); | 203 | + ConnectPoint cp = new ConnectPoint(ingressDeviceId, ingressPortNumber); |
204 | - printPortSummaryLoad(cp, summaryFlowLoad); | 204 | + printPortSummaryLoad(cp, summaryFlowLoad); |
205 | - } | 205 | + } |
206 | - } | 206 | + } |
207 | - } | 207 | + } |
208 | - | 208 | + |
209 | - /** | 209 | + /** |
210 | - * Extracts the port number portion of the ConnectPoint. | 210 | + * Extracts the port number portion of the ConnectPoint. |
211 | - * | 211 | + * |
212 | - * @param deviceString string representing the device/port | 212 | + * @param deviceString string representing the device/port |
213 | - * @return port number as a string, empty string if the port is not found | 213 | + * @return port number as a string, empty string if the port is not found |
214 | - */ | 214 | + */ |
215 | - private String getPortNumber(String deviceString) { | 215 | + private String getPortNumber(String deviceString) { |
216 | - if (deviceString == null) { | 216 | + if (deviceString == null) { |
217 | - return ""; | 217 | + return ""; |
218 | - } | 218 | + } |
219 | - | 219 | + |
220 | - int slash = deviceString.indexOf('/'); | 220 | + int slash = deviceString.indexOf('/'); |
221 | - if (slash <= 0) { | 221 | + if (slash <= 0) { |
222 | - return ""; // return when no port number | 222 | + return ""; // return when no port number |
223 | - } | 223 | + } |
224 | - return deviceString.substring(slash + 1, deviceString.length()); | 224 | + return deviceString.substring(slash + 1, deviceString.length()); |
225 | - } | 225 | + } |
226 | - | 226 | + |
227 | - /** | 227 | + /** |
228 | - * Extracts the device ID portion of the ConnectPoint. | 228 | + * Extracts the device ID portion of the ConnectPoint. |
229 | - * | 229 | + * |
230 | - * @param deviceString string representing the device/port | 230 | + * @param deviceString string representing the device/port |
231 | - * @return device ID string | 231 | + * @return device ID string |
232 | - */ | 232 | + */ |
233 | - private String getDeviceId(String deviceString) { | 233 | + private String getDeviceId(String deviceString) { |
234 | - if (deviceString == null) { | 234 | + if (deviceString == null) { |
235 | - return ""; | 235 | + return ""; |
236 | - } | 236 | + } |
237 | - | 237 | + |
238 | - int slash = deviceString.indexOf('/'); | 238 | + int slash = deviceString.indexOf('/'); |
239 | - if (slash <= 0) { | 239 | + if (slash <= 0) { |
240 | - return deviceString; // return only included device ID | 240 | + return deviceString; // return only included device ID |
241 | - } | 241 | + } |
242 | - return deviceString.substring(0, slash); | 242 | + return deviceString.substring(0, slash); |
243 | - } | 243 | + } |
244 | - | 244 | + |
245 | - /** | 245 | + /** |
246 | - * converts string of flow live type to FloeLiveType enum. | 246 | + * converts string of flow live type to FloeLiveType enum. |
247 | - * | 247 | + * |
248 | - * @param liveType string representing the flow live type | 248 | + * @param liveType string representing the flow live type |
249 | - * @return TypedStoredFlowEntry.FlowLiveType | 249 | + * @return TypedStoredFlowEntry.FlowLiveType |
250 | - */ | 250 | + */ |
251 | - private TypedStoredFlowEntry.FlowLiveType getFlowLiveType(String liveType) { | 251 | + private TypedStoredFlowEntry.FlowLiveType getFlowLiveType(String liveType) { |
252 | - String liveTypeUC = liveType.toUpperCase(); | 252 | + String liveTypeUC = liveType.toUpperCase(); |
253 | - | 253 | + |
254 | - if (liveTypeUC.equals("IMMEDIATE")) { | 254 | + if (liveTypeUC.equals("IMMEDIATE")) { |
255 | - return TypedStoredFlowEntry.FlowLiveType.IMMEDIATE_FLOW; | 255 | + return TypedStoredFlowEntry.FlowLiveType.IMMEDIATE_FLOW; |
256 | - } else if (liveTypeUC.equals("SHORT")) { | 256 | + } else if (liveTypeUC.equals("SHORT")) { |
257 | - return TypedStoredFlowEntry.FlowLiveType.SHORT_FLOW; | 257 | + return TypedStoredFlowEntry.FlowLiveType.SHORT_FLOW; |
258 | - } else if (liveTypeUC.equals("MID")) { | 258 | + } else if (liveTypeUC.equals("MID")) { |
259 | - return TypedStoredFlowEntry.FlowLiveType.MID_FLOW; | 259 | + return TypedStoredFlowEntry.FlowLiveType.MID_FLOW; |
260 | - } else if (liveTypeUC.equals("LONG")) { | 260 | + } else if (liveTypeUC.equals("LONG")) { |
261 | - return TypedStoredFlowEntry.FlowLiveType.LONG_FLOW; | 261 | + return TypedStoredFlowEntry.FlowLiveType.LONG_FLOW; |
262 | - } else if (liveTypeUC.equals("UNKNOWN")) { | 262 | + } else if (liveTypeUC.equals("UNKNOWN")) { |
263 | - return TypedStoredFlowEntry.FlowLiveType.UNKNOWN_FLOW; | 263 | + return TypedStoredFlowEntry.FlowLiveType.UNKNOWN_FLOW; |
264 | - } else { | 264 | + } else { |
265 | - return null; // flow live type error | 265 | + return null; // flow live type error |
266 | - } | 266 | + } |
267 | - } | 267 | + } |
268 | - | 268 | + |
269 | - /** | 269 | + /** |
270 | - * converts string of instruction type to Instruction type enum. | 270 | + * converts string of instruction type to Instruction type enum. |
271 | - * | 271 | + * |
272 | - * @param instType string representing the instruction type | 272 | + * @param instType string representing the instruction type |
273 | - * @return Instruction.Type | 273 | + * @return Instruction.Type |
274 | - */ | 274 | + */ |
275 | - private Instruction.Type getInstructionType(String instType) { | 275 | + private Instruction.Type getInstructionType(String instType) { |
276 | - String instTypeUC = instType.toUpperCase(); | 276 | + String instTypeUC = instType.toUpperCase(); |
277 | - | 277 | + |
278 | - if (instTypeUC.equals("DROP")) { | 278 | + if (instTypeUC.equals("DROP")) { |
279 | - return Instruction.Type.DROP; | 279 | + return Instruction.Type.DROP; |
280 | - } else if (instTypeUC.equals("OUTPUT")) { | 280 | + } else if (instTypeUC.equals("OUTPUT")) { |
281 | - return Instruction.Type.OUTPUT; | 281 | + return Instruction.Type.OUTPUT; |
282 | - } else if (instTypeUC.equals("GROUP")) { | 282 | + } else if (instTypeUC.equals("GROUP")) { |
283 | - return Instruction.Type.GROUP; | 283 | + return Instruction.Type.GROUP; |
284 | - } else if (instTypeUC.equals("L0MODIFICATION")) { | 284 | + } else if (instTypeUC.equals("L0MODIFICATION")) { |
285 | - return Instruction.Type.L0MODIFICATION; | 285 | + return Instruction.Type.L0MODIFICATION; |
286 | - } else if (instTypeUC.equals("L2MODIFICATION")) { | 286 | + } else if (instTypeUC.equals("L2MODIFICATION")) { |
287 | - return Instruction.Type.L2MODIFICATION; | 287 | + return Instruction.Type.L2MODIFICATION; |
288 | - } else if (instTypeUC.equals("TABLE")) { | 288 | + } else if (instTypeUC.equals("TABLE")) { |
289 | - return Instruction.Type.TABLE; | 289 | + return Instruction.Type.TABLE; |
290 | - } else if (instTypeUC.equals("L3MODIFICATION")) { | 290 | + } else if (instTypeUC.equals("L3MODIFICATION")) { |
291 | - return Instruction.Type.L3MODIFICATION; | 291 | + return Instruction.Type.L3MODIFICATION; |
292 | - } else if (instTypeUC.equals("METADATA")) { | 292 | + } else if (instTypeUC.equals("METADATA")) { |
293 | - return Instruction.Type.METADATA; | 293 | + return Instruction.Type.METADATA; |
294 | - } else { | 294 | + } else { |
295 | - return null; // instruction type error | 295 | + return null; // instruction type error |
296 | - } | 296 | + } |
297 | - } | 297 | + } |
298 | - | 298 | + |
299 | - private void printPortFlowsLoad(ConnectPoint cp, List<TypedFlowEntryWithLoad> typedFlowLoad) { | 299 | + private void printPortFlowsLoad(ConnectPoint cp, List<TypedFlowEntryWithLoad> typedFlowLoad) { |
300 | - print(" deviceId/Port=%s/%s, %s flows", cp.elementId(), cp.port(), typedFlowLoad.size()); | 300 | + print(" deviceId/Port=%s/%s, %s flows", cp.elementId(), cp.port(), typedFlowLoad.size()); |
301 | - for (TypedFlowEntryWithLoad tfel: typedFlowLoad) { | 301 | + for (TypedFlowEntryWithLoad tfel: typedFlowLoad) { |
302 | - TypedStoredFlowEntry tfe = tfel.typedStoredFlowEntry(); | 302 | + TypedStoredFlowEntry tfe = tfel.typedStoredFlowEntry(); |
303 | - print(" flowId=%s, state=%s, liveType=%s, life=%s -> %s", | 303 | + print(" flowId=%s, state=%s, liveType=%s, life=%s -> %s", |
304 | - Long.toHexString(tfe.id().value()), | 304 | + Long.toHexString(tfe.id().value()), |
305 | - tfe.state(), | 305 | + tfe.state(), |
306 | - tfe.flowLiveType(), | 306 | + tfe.flowLiveType(), |
307 | - tfe.life(), | 307 | + tfe.life(), |
308 | - tfel.load().isValid() ? tfel.load() : "Load{rate=0, NOT VALID}"); | 308 | + tfel.load().isValid() ? tfel.load() : "Load{rate=0, NOT VALID}"); |
309 | - } | 309 | + } |
310 | - } | 310 | + } |
311 | - | 311 | + |
312 | - private void printPortSummaryLoad(ConnectPoint cp, SummaryFlowEntryWithLoad summaryFlowLoad) { | 312 | + private void printPortSummaryLoad(ConnectPoint cp, SummaryFlowEntryWithLoad summaryFlowLoad) { |
313 | - print(" deviceId/Port=%s/%s, Total=%s, Immediate=%s, Short=%s, Mid=%s, Long=%s, Unknown=%s", | 313 | + print(" deviceId/Port=%s/%s, Total=%s, Immediate=%s, Short=%s, Mid=%s, Long=%s, Unknown=%s", |
314 | - cp.elementId(), | 314 | + cp.elementId(), |
315 | - cp.port(), | 315 | + cp.port(), |
316 | - summaryFlowLoad.totalLoad().isValid() ? summaryFlowLoad.totalLoad() : "Load{rate=0, NOT VALID}", | 316 | + summaryFlowLoad.totalLoad().isValid() ? summaryFlowLoad.totalLoad() : "Load{rate=0, NOT VALID}", |
317 | - summaryFlowLoad.immediateLoad().isValid() ? summaryFlowLoad.immediateLoad() : "Load{rate=0, NOT VALID}", | 317 | + summaryFlowLoad.immediateLoad().isValid() ? summaryFlowLoad.immediateLoad() : "Load{rate=0, NOT VALID}", |
318 | - summaryFlowLoad.shortLoad().isValid() ? summaryFlowLoad.shortLoad() : "Load{rate=0, NOT VALID}", | 318 | + summaryFlowLoad.shortLoad().isValid() ? summaryFlowLoad.shortLoad() : "Load{rate=0, NOT VALID}", |
319 | - summaryFlowLoad.midLoad().isValid() ? summaryFlowLoad.midLoad() : "Load{rate=0, NOT VALID}", | 319 | + summaryFlowLoad.midLoad().isValid() ? summaryFlowLoad.midLoad() : "Load{rate=0, NOT VALID}", |
320 | - summaryFlowLoad.longLoad().isValid() ? summaryFlowLoad.longLoad() : "Load{rate=0, NOT VALID}", | 320 | + summaryFlowLoad.longLoad().isValid() ? summaryFlowLoad.longLoad() : "Load{rate=0, NOT VALID}", |
321 | - summaryFlowLoad.unknownLoad().isValid() ? summaryFlowLoad.unknownLoad() : "Load{rate=0, NOT VALID}"); | 321 | + summaryFlowLoad.unknownLoad().isValid() ? summaryFlowLoad.unknownLoad() : "Load{rate=0, NOT VALID}"); |
322 | - } | 322 | + } |
323 | -} | 323 | +} | ... | ... |
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 | - | 16 | + |
17 | -package org.onosproject.net.flow; | 17 | +package org.onosproject.net.flow; |
18 | - | 18 | + |
19 | -import static com.google.common.base.MoreObjects.toStringHelper; | 19 | +import static com.google.common.base.MoreObjects.toStringHelper; |
20 | - | 20 | + |
21 | -/** | 21 | +/** |
22 | - * Default flow entry class with FlowLiveType value, IMMEDIATE_FLOW, SHORT_FLOW, MID_FLOW, LONG_FLOW. | 22 | + * Default flow entry class with FlowLiveType value, IMMEDIATE_FLOW, SHORT_FLOW, MID_FLOW, LONG_FLOW. |
23 | - */ | 23 | + */ |
24 | -public class DefaultTypedFlowEntry extends DefaultFlowEntry | 24 | +public class DefaultTypedFlowEntry extends DefaultFlowEntry |
25 | - implements TypedStoredFlowEntry { | 25 | + implements TypedStoredFlowEntry { |
26 | - private FlowLiveType liveType; | 26 | + private FlowLiveType liveType; |
27 | - | 27 | + |
28 | - /** | 28 | + /** |
29 | - * Creates a typed flow entry from flow rule and its statistics, with default flow live type(IMMEDIATE_FLOW). | 29 | + * Creates a typed flow entry from flow rule and its statistics, with default flow live type(IMMEDIATE_FLOW). |
30 | - * | 30 | + * |
31 | - * @param rule the flow rule | 31 | + * @param rule the flow rule |
32 | - * @param state the flow state | 32 | + * @param state the flow state |
33 | - * @param life the flow duration since creation | 33 | + * @param life the flow duration since creation |
34 | - * @param packets the flow packets count | 34 | + * @param packets the flow packets count |
35 | - * @param bytes the flow bytes count | 35 | + * @param bytes the flow bytes count |
36 | - * | 36 | + * |
37 | - */ | 37 | + */ |
38 | - public DefaultTypedFlowEntry(FlowRule rule, FlowEntryState state, | 38 | + public DefaultTypedFlowEntry(FlowRule rule, FlowEntryState state, |
39 | - long life, long packets, long bytes) { | 39 | + long life, long packets, long bytes) { |
40 | - super(rule, state, life, packets, bytes); | 40 | + super(rule, state, life, packets, bytes); |
41 | - this.liveType = FlowLiveType.IMMEDIATE_FLOW; | 41 | + this.liveType = FlowLiveType.IMMEDIATE_FLOW; |
42 | - } | 42 | + } |
43 | - | 43 | + |
44 | - /** | 44 | + /** |
45 | - * Creates a typed flow entry from flow rule, with default flow live type(IMMEDIATE_FLOW). | 45 | + * Creates a typed flow entry from flow rule, with default flow live type(IMMEDIATE_FLOW). |
46 | - * | 46 | + * |
47 | - * @param rule the flow rule | 47 | + * @param rule the flow rule |
48 | - * | 48 | + * |
49 | - */ | 49 | + */ |
50 | - public DefaultTypedFlowEntry(FlowRule rule) { | 50 | + public DefaultTypedFlowEntry(FlowRule rule) { |
51 | - super(rule); | 51 | + super(rule); |
52 | - this.liveType = FlowLiveType.IMMEDIATE_FLOW; | 52 | + this.liveType = FlowLiveType.IMMEDIATE_FLOW; |
53 | - } | 53 | + } |
54 | - | 54 | + |
55 | - /** | 55 | + /** |
56 | - * Creates a typed flow entry from flow entry, with default flow live type(IMMEDIATE_FLOW). | 56 | + * Creates a typed flow entry from flow entry, with default flow live type(IMMEDIATE_FLOW). |
57 | - * | 57 | + * |
58 | - * @param fe the flow entry | 58 | + * @param fe the flow entry |
59 | - * | 59 | + * |
60 | - */ | 60 | + */ |
61 | - public DefaultTypedFlowEntry(FlowEntry fe) { | 61 | + public DefaultTypedFlowEntry(FlowEntry fe) { |
62 | - super(fe, fe.state(), fe.life(), fe.packets(), fe.bytes()); | 62 | + super(fe, fe.state(), fe.life(), fe.packets(), fe.bytes()); |
63 | - this.liveType = FlowLiveType.IMMEDIATE_FLOW; | 63 | + this.liveType = FlowLiveType.IMMEDIATE_FLOW; |
64 | - } | 64 | + } |
65 | - | 65 | + |
66 | - /** | 66 | + /** |
67 | - * Creates a typed flow entry from flow rule and flow live type. | 67 | + * Creates a typed flow entry from flow rule and flow live type. |
68 | - * | 68 | + * |
69 | - * @param rule the flow rule | 69 | + * @param rule the flow rule |
70 | - * @param liveType the flow live type | 70 | + * @param liveType the flow live type |
71 | - * | 71 | + * |
72 | - */ | 72 | + */ |
73 | - public DefaultTypedFlowEntry(FlowRule rule, FlowLiveType liveType) { | 73 | + public DefaultTypedFlowEntry(FlowRule rule, FlowLiveType liveType) { |
74 | - super(rule); | 74 | + super(rule); |
75 | - this.liveType = liveType; | 75 | + this.liveType = liveType; |
76 | - } | 76 | + } |
77 | - | 77 | + |
78 | - /** | 78 | + /** |
79 | - * Creates a typed flow entry from flow entry and flow live type. | 79 | + * Creates a typed flow entry from flow entry and flow live type. |
80 | - * | 80 | + * |
81 | - * @param fe the flow rule | 81 | + * @param fe the flow rule |
82 | - * @param liveType the flow live type | 82 | + * @param liveType the flow live type |
83 | - * | 83 | + * |
84 | - */ | 84 | + */ |
85 | - public DefaultTypedFlowEntry(FlowEntry fe, FlowLiveType liveType) { | 85 | + public DefaultTypedFlowEntry(FlowEntry fe, FlowLiveType liveType) { |
86 | - super(fe, fe.state(), fe.life(), fe.packets(), fe.bytes()); | 86 | + super(fe, fe.state(), fe.life(), fe.packets(), fe.bytes()); |
87 | - this.liveType = liveType; | 87 | + this.liveType = liveType; |
88 | - } | 88 | + } |
89 | - | 89 | + |
90 | - /** | 90 | + /** |
91 | - * Creates a typed flow entry from flow rule, error code and flow live type. | 91 | + * Creates a typed flow entry from flow rule, error code and flow live type. |
92 | - * | 92 | + * |
93 | - * @param rule the flow rule | 93 | + * @param rule the flow rule |
94 | - * @param errType the flow error type | 94 | + * @param errType the flow error type |
95 | - * @param errCode the flow error code | 95 | + * @param errCode the flow error code |
96 | - * @param liveType the flow live type | 96 | + * @param liveType the flow live type |
97 | - * | 97 | + * |
98 | - */ | 98 | + */ |
99 | - public DefaultTypedFlowEntry(FlowRule rule, int errType, int errCode, FlowLiveType liveType) { | 99 | + public DefaultTypedFlowEntry(FlowRule rule, int errType, int errCode, FlowLiveType liveType) { |
100 | - super(rule, errType, errCode); | 100 | + super(rule, errType, errCode); |
101 | - this.liveType = liveType; | 101 | + this.liveType = liveType; |
102 | - } | 102 | + } |
103 | - | 103 | + |
104 | - @Override | 104 | + @Override |
105 | - public FlowLiveType flowLiveType() { | 105 | + public FlowLiveType flowLiveType() { |
106 | - return this.liveType; | 106 | + return this.liveType; |
107 | - } | 107 | + } |
108 | - | 108 | + |
109 | - @Override | 109 | + @Override |
110 | - public void setFlowLiveType(FlowLiveType liveType) { | 110 | + public void setFlowLiveType(FlowLiveType liveType) { |
111 | - this.liveType = liveType; | 111 | + this.liveType = liveType; |
112 | - } | 112 | + } |
113 | - | 113 | + |
114 | - @Override | 114 | + @Override |
115 | - public String toString() { | 115 | + public String toString() { |
116 | - return toStringHelper(this) | 116 | + return toStringHelper(this) |
117 | - .add("entry", super.toString()) | 117 | + .add("entry", super.toString()) |
118 | - .add("type", liveType) | 118 | + .add("type", liveType) |
119 | - .toString(); | 119 | + .toString(); |
120 | - } | 120 | + } |
121 | -} | 121 | +} |
122 | - | 122 | + | ... | ... |
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 | - | 16 | + |
17 | -package org.onosproject.net.flow; | 17 | +package org.onosproject.net.flow; |
18 | - | 18 | + |
19 | -/** | 19 | +/** |
20 | - * Represents a flow live type for a given flow entry. | 20 | + * Represents a flow live type for a given flow entry. |
21 | - */ | 21 | + */ |
22 | -public interface TypedStoredFlowEntry extends StoredFlowEntry { | 22 | +public interface TypedStoredFlowEntry extends StoredFlowEntry { |
23 | - enum FlowLiveType { | 23 | + enum FlowLiveType { |
24 | - /** | 24 | + /** |
25 | - * Indicates that this rule has been submitted for addition immediately. | 25 | + * Indicates that this rule has been submitted for addition immediately. |
26 | - * Not necessarily collecting flow stats. | 26 | + * Not necessarily collecting flow stats. |
27 | - */ | 27 | + */ |
28 | - IMMEDIATE_FLOW, | 28 | + IMMEDIATE_FLOW, |
29 | - | 29 | + |
30 | - /** | 30 | + /** |
31 | - * Indicates that this rule has been submitted for a short time. | 31 | + * Indicates that this rule has been submitted for a short time. |
32 | - * Necessarily collecting flow stats every calAndPollInterval. | 32 | + * Necessarily collecting flow stats every calAndPollInterval. |
33 | - */ | 33 | + */ |
34 | - SHORT_FLOW, | 34 | + SHORT_FLOW, |
35 | - | 35 | + |
36 | - /** | 36 | + /** |
37 | - * Indicates that this rule has been submitted for a mid time. | 37 | + * Indicates that this rule has been submitted for a mid time. |
38 | - * Necessarily collecting flow stats every midPollInterval. | 38 | + * Necessarily collecting flow stats every midPollInterval. |
39 | - */ | 39 | + */ |
40 | - MID_FLOW, | 40 | + MID_FLOW, |
41 | - | 41 | + |
42 | - /** | 42 | + /** |
43 | - * Indicates that this rule has been submitted for a long time. | 43 | + * Indicates that this rule has been submitted for a long time. |
44 | - * Necessarily collecting flow stats every longPollInterval. | 44 | + * Necessarily collecting flow stats every longPollInterval. |
45 | - */ | 45 | + */ |
46 | - LONG_FLOW, | 46 | + LONG_FLOW, |
47 | - | 47 | + |
48 | - /** | 48 | + /** |
49 | - * Indicates that this rule has been submitted for UNKNOWN or ERROR. | 49 | + * Indicates that this rule has been submitted for UNKNOWN or ERROR. |
50 | - * Not necessarily collecting flow stats. | 50 | + * Not necessarily collecting flow stats. |
51 | - */ | 51 | + */ |
52 | - UNKNOWN_FLOW | 52 | + UNKNOWN_FLOW |
53 | - } | 53 | + } |
54 | - | 54 | + |
55 | - /** | 55 | + /** |
56 | - * Gets the flow live type for this entry. | 56 | + * Gets the flow live type for this entry. |
57 | - * | 57 | + * |
58 | - * @return flow live type | 58 | + * @return flow live type |
59 | - */ | 59 | + */ |
60 | - FlowLiveType flowLiveType(); | 60 | + FlowLiveType flowLiveType(); |
61 | - | 61 | + |
62 | - /** | 62 | + /** |
63 | - * Sets the new flow live type for this entry. | 63 | + * Sets the new flow live type for this entry. |
64 | - * @param liveType new flow live type. | 64 | + * @param liveType new flow live type. |
65 | - */ | 65 | + */ |
66 | - void setFlowLiveType(FlowLiveType liveType); | 66 | + void setFlowLiveType(FlowLiveType liveType); |
67 | -} | 67 | +} | ... | ... |
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 | - | 16 | + |
17 | -package org.onosproject.net.statistic; | 17 | +package org.onosproject.net.statistic; |
18 | - | 18 | + |
19 | -import org.onosproject.net.ConnectPoint; | 19 | +import org.onosproject.net.ConnectPoint; |
20 | -import org.onosproject.net.Device; | 20 | +import org.onosproject.net.Device; |
21 | -import org.onosproject.net.PortNumber; | 21 | +import org.onosproject.net.PortNumber; |
22 | -import org.onosproject.net.flow.TypedStoredFlowEntry; | 22 | +import org.onosproject.net.flow.TypedStoredFlowEntry; |
23 | -import org.onosproject.net.flow.instructions.Instruction; | 23 | +import org.onosproject.net.flow.instructions.Instruction; |
24 | - | 24 | + |
25 | -import java.util.List; | 25 | +import java.util.List; |
26 | -import java.util.Map; | 26 | +import java.util.Map; |
27 | - | 27 | + |
28 | -/** | 28 | +/** |
29 | - * Service for obtaining individual flow statistic information about device and link in the system. | 29 | + * Service for obtaining individual flow statistic information about device and link in the system. |
30 | - * Basic statistics are obtained from the StatisticService | 30 | + * Basic statistics are obtained from the StatisticService |
31 | - */ | 31 | + */ |
32 | -public interface FlowStatisticService { | 32 | +public interface FlowStatisticService { |
33 | - | 33 | + |
34 | - /** | 34 | + /** |
35 | - * Obtain the summary load list for the device with the given link. | 35 | + * Obtain the summary load list for the device with the given link. |
36 | - * | 36 | + * |
37 | - * @param device the Device to query. | 37 | + * @param device the Device to query. |
38 | - * @return map of summary flow entry load | 38 | + * @return map of summary flow entry load |
39 | - */ | 39 | + */ |
40 | - Map<ConnectPoint, SummaryFlowEntryWithLoad> loadSummary(Device device); | 40 | + Map<ConnectPoint, SummaryFlowEntryWithLoad> loadSummary(Device device); |
41 | - | 41 | + |
42 | - /** | 42 | + /** |
43 | - * Obtain the summary load for the device with the given link or port. | 43 | + * Obtain the summary load for the device with the given link or port. |
44 | - * | 44 | + * |
45 | - * @param device the Device to query. | 45 | + * @param device the Device to query. |
46 | - * @param pNumber the port number to query. | 46 | + * @param pNumber the port number to query. |
47 | - * @return summary flow entry load | 47 | + * @return summary flow entry load |
48 | - */ | 48 | + */ |
49 | - SummaryFlowEntryWithLoad loadSummary(Device device, PortNumber pNumber); | 49 | + SummaryFlowEntryWithLoad loadSummary(Device device, PortNumber pNumber); |
50 | - | 50 | + |
51 | - /** | 51 | + /** |
52 | - * Obtain the set of the flow type and load list for the device with the given link. | 52 | + * Obtain the set of the flow type and load list for the device with the given link. |
53 | - * | 53 | + * |
54 | - * @param device the Device to query. | 54 | + * @param device the Device to query. |
55 | - * @param liveType the FlowLiveType to filter, null means no filtering . | 55 | + * @param liveType the FlowLiveType to filter, null means no filtering . |
56 | - * @param instType the InstructionType to filter, null means no filtering. | 56 | + * @param instType the InstructionType to filter, null means no filtering. |
57 | - * @return map of flow entry load | 57 | + * @return map of flow entry load |
58 | - */ | 58 | + */ |
59 | - Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadAllByType(Device device, | 59 | + Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadAllByType(Device device, |
60 | - TypedStoredFlowEntry.FlowLiveType liveType, | 60 | + TypedStoredFlowEntry.FlowLiveType liveType, |
61 | - Instruction.Type instType); | 61 | + Instruction.Type instType); |
62 | - | 62 | + |
63 | - /** | 63 | + /** |
64 | - * Obtain the flow type and load list for the device with the given link or port. | 64 | + * Obtain the flow type and load list for the device with the given link or port. |
65 | - * | 65 | + * |
66 | - * @param device the Device to query. | 66 | + * @param device the Device to query. |
67 | - * @param pNumber the port number of the Device to query | 67 | + * @param pNumber the port number of the Device to query |
68 | - * @param liveType the FlowLiveType to filter, null means no filtering . | 68 | + * @param liveType the FlowLiveType to filter, null means no filtering . |
69 | - * @param instType the InstructionType to filter, null means no filtering. | 69 | + * @param instType the InstructionType to filter, null means no filtering. |
70 | - * @return list of flow entry load | 70 | + * @return list of flow entry load |
71 | - */ | 71 | + */ |
72 | - List<TypedFlowEntryWithLoad> loadAllByType(Device device, PortNumber pNumber, | 72 | + List<TypedFlowEntryWithLoad> loadAllByType(Device device, PortNumber pNumber, |
73 | - TypedStoredFlowEntry.FlowLiveType liveType, | 73 | + TypedStoredFlowEntry.FlowLiveType liveType, |
74 | - Instruction.Type instType); | 74 | + Instruction.Type instType); |
75 | - | 75 | + |
76 | - /** | 76 | + /** |
77 | - * Obtain the set of the flow type and load topn list for the device with the given link. | 77 | + * Obtain the set of the flow type and load topn list for the device with the given link. |
78 | - * | 78 | + * |
79 | - * @param device the Device to query. | 79 | + * @param device the Device to query. |
80 | - * @param liveType the FlowLiveType to filter, null means no filtering . | 80 | + * @param liveType the FlowLiveType to filter, null means no filtering . |
81 | - * @param instType the InstructionType to filter, null means no filtering. | 81 | + * @param instType the InstructionType to filter, null means no filtering. |
82 | - * @param topn the top number to filter, null means no filtering. | 82 | + * @param topn the top number to filter, null means no filtering. |
83 | - * @return map of flow entry load | 83 | + * @return map of flow entry load |
84 | - */ | 84 | + */ |
85 | - Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadTopnByType(Device device, | 85 | + Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadTopnByType(Device device, |
86 | - TypedStoredFlowEntry.FlowLiveType liveType, | 86 | + TypedStoredFlowEntry.FlowLiveType liveType, |
87 | - Instruction.Type instType, | 87 | + Instruction.Type instType, |
88 | - int topn); | 88 | + int topn); |
89 | - | 89 | + |
90 | - /** | 90 | + /** |
91 | - * Obtain the flow type and load topn list for the device with the given link or port. | 91 | + * Obtain the flow type and load topn list for the device with the given link or port. |
92 | - * | 92 | + * |
93 | - * @param device the Device to query. | 93 | + * @param device the Device to query. |
94 | - * @param pNumber the port number of the Device to query | 94 | + * @param pNumber the port number of the Device to query |
95 | - * @param liveType the FlowLiveType to filter, null means no filtering . | 95 | + * @param liveType the FlowLiveType to filter, null means no filtering . |
96 | - * @param instType the InstructionType to filter, null means no filtering. | 96 | + * @param instType the InstructionType to filter, null means no filtering. |
97 | - * @param topn topn //FIXME what? | 97 | + * @param topn topn //FIXME what? |
98 | - * @return list of flow entry load | 98 | + * @return list of flow entry load |
99 | - */ | 99 | + */ |
100 | - List<TypedFlowEntryWithLoad> loadTopnByType(Device device, PortNumber pNumber, | 100 | + List<TypedFlowEntryWithLoad> loadTopnByType(Device device, PortNumber pNumber, |
101 | - TypedStoredFlowEntry.FlowLiveType liveType, | 101 | + TypedStoredFlowEntry.FlowLiveType liveType, |
102 | - Instruction.Type instType, | 102 | + Instruction.Type instType, |
103 | - int topn); | 103 | + int topn); |
104 | -} | 104 | +} |
105 | - | 105 | + |
106 | - | 106 | + | ... | ... |
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 | - | 16 | + |
17 | -package org.onosproject.net.statistic; | 17 | +package org.onosproject.net.statistic; |
18 | - | 18 | + |
19 | -import org.onosproject.net.ConnectPoint; | 19 | +import org.onosproject.net.ConnectPoint; |
20 | -import org.onosproject.net.flow.FlowEntry; | 20 | +import org.onosproject.net.flow.FlowEntry; |
21 | -import org.onosproject.net.flow.FlowRule; | 21 | +import org.onosproject.net.flow.FlowRule; |
22 | - | 22 | + |
23 | -import java.util.Set; | 23 | +import java.util.Set; |
24 | - | 24 | + |
25 | -/** | 25 | +/** |
26 | - * Flow Store to house the computed statistics. | 26 | + * Flow Store to house the computed statistics. |
27 | - */ | 27 | + */ |
28 | -public interface FlowStatisticStore { | 28 | +public interface FlowStatisticStore { |
29 | - /** | 29 | + /** |
30 | - * Remove entries associated with this rule. | 30 | + * Remove entries associated with this rule. |
31 | - * | 31 | + * |
32 | - * @param rule {@link org.onosproject.net.flow.FlowRule} | 32 | + * @param rule {@link org.onosproject.net.flow.FlowRule} |
33 | - */ | 33 | + */ |
34 | - void removeFlowStatistic(FlowRule rule); | 34 | + void removeFlowStatistic(FlowRule rule); |
35 | - | 35 | + |
36 | - /** | 36 | + /** |
37 | - * Adds a flow stats observation for a flow rule. The previous flow will be removed. | 37 | + * Adds a flow stats observation for a flow rule. The previous flow will be removed. |
38 | - * | 38 | + * |
39 | - * @param rule a {@link org.onosproject.net.flow.FlowEntry} | 39 | + * @param rule a {@link org.onosproject.net.flow.FlowEntry} |
40 | - */ | 40 | + */ |
41 | - void addFlowStatistic(FlowEntry rule); | 41 | + void addFlowStatistic(FlowEntry rule); |
42 | - | 42 | + |
43 | - /** | 43 | + /** |
44 | - * Updates a stats observation for a flow rule. The old flow stats will be moved to previous stats. | 44 | + * Updates a stats observation for a flow rule. The old flow stats will be moved to previous stats. |
45 | - * | 45 | + * |
46 | - * @param rule a {@link org.onosproject.net.flow.FlowEntry} | 46 | + * @param rule a {@link org.onosproject.net.flow.FlowEntry} |
47 | - */ | 47 | + */ |
48 | - void updateFlowStatistic(FlowEntry rule); | 48 | + void updateFlowStatistic(FlowEntry rule); |
49 | - | 49 | + |
50 | - /** | 50 | + /** |
51 | - * Fetches the current observed flow stats values. | 51 | + * Fetches the current observed flow stats values. |
52 | - * | 52 | + * |
53 | - * @param connectPoint the port to fetch information for | 53 | + * @param connectPoint the port to fetch information for |
54 | - * @return set of current flow rules | 54 | + * @return set of current flow rules |
55 | - */ | 55 | + */ |
56 | - Set<FlowEntry> getCurrentFlowStatistic(ConnectPoint connectPoint); | 56 | + Set<FlowEntry> getCurrentFlowStatistic(ConnectPoint connectPoint); |
57 | - | 57 | + |
58 | - /** | 58 | + /** |
59 | - * Fetches the current observed flow stats values. | 59 | + * Fetches the current observed flow stats values. |
60 | - * | 60 | + * |
61 | - * @param connectPoint the port to fetch information for | 61 | + * @param connectPoint the port to fetch information for |
62 | - * @return set of current values | 62 | + * @return set of current values |
63 | - */ | 63 | + */ |
64 | - Set<FlowEntry> getPreviousFlowStatistic(ConnectPoint connectPoint); | 64 | + Set<FlowEntry> getPreviousFlowStatistic(ConnectPoint connectPoint); |
65 | -} | 65 | +} | ... | ... |
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 | - | 16 | + |
17 | -package org.onosproject.net.statistic; | 17 | +package org.onosproject.net.statistic; |
18 | - | 18 | + |
19 | -import org.onosproject.net.ConnectPoint; | 19 | +import org.onosproject.net.ConnectPoint; |
20 | - | 20 | + |
21 | -/** | 21 | +/** |
22 | - * Summary Load classified by flow live type. | 22 | + * Summary Load classified by flow live type. |
23 | - */ | 23 | + */ |
24 | -public class SummaryFlowEntryWithLoad { | 24 | +public class SummaryFlowEntryWithLoad { |
25 | - private ConnectPoint cp; | 25 | + private ConnectPoint cp; |
26 | - private Load totalLoad; | 26 | + private Load totalLoad; |
27 | - private Load immediateLoad; | 27 | + private Load immediateLoad; |
28 | - private Load shortLoad; | 28 | + private Load shortLoad; |
29 | - private Load midLoad; | 29 | + private Load midLoad; |
30 | - private Load longLoad; | 30 | + private Load longLoad; |
31 | - private Load unknownLoad; | 31 | + private Load unknownLoad; |
32 | - | 32 | + |
33 | - /** | 33 | + /** |
34 | - * Creates a new summary flow entry having load for the given connect point and total load. | 34 | + * Creates a new summary flow entry having load for the given connect point and total load. |
35 | - * | 35 | + * |
36 | - * @param cp connect point | 36 | + * @param cp connect point |
37 | - * @param totalLoad total load | 37 | + * @param totalLoad total load |
38 | - */ | 38 | + */ |
39 | - public SummaryFlowEntryWithLoad(ConnectPoint cp, Load totalLoad) { | 39 | + public SummaryFlowEntryWithLoad(ConnectPoint cp, Load totalLoad) { |
40 | - this.cp = cp; | 40 | + this.cp = cp; |
41 | - this.totalLoad = totalLoad; | 41 | + this.totalLoad = totalLoad; |
42 | - this.immediateLoad = new DefaultLoad(); | 42 | + this.immediateLoad = new DefaultLoad(); |
43 | - this.shortLoad = new DefaultLoad(); | 43 | + this.shortLoad = new DefaultLoad(); |
44 | - this.midLoad = new DefaultLoad(); | 44 | + this.midLoad = new DefaultLoad(); |
45 | - this.longLoad = new DefaultLoad(); | 45 | + this.longLoad = new DefaultLoad(); |
46 | - this.unknownLoad = new DefaultLoad(); | 46 | + this.unknownLoad = new DefaultLoad(); |
47 | - } | 47 | + } |
48 | - | 48 | + |
49 | - /** | 49 | + /** |
50 | - * Creates a new summary flow entry having load for the given connect point | 50 | + * Creates a new summary flow entry having load for the given connect point |
51 | - * and total, immediate, short, mid, and long load. | 51 | + * and total, immediate, short, mid, and long load. |
52 | - * | 52 | + * |
53 | - * @param cp connect point | 53 | + * @param cp connect point |
54 | - * @param totalLoad total load | 54 | + * @param totalLoad total load |
55 | - * @param immediateLoad immediate load | 55 | + * @param immediateLoad immediate load |
56 | - * @param shortLoad short load | 56 | + * @param shortLoad short load |
57 | - * @param midLoad mid load | 57 | + * @param midLoad mid load |
58 | - * @param longLoad long load | 58 | + * @param longLoad long load |
59 | - */ | 59 | + */ |
60 | - public SummaryFlowEntryWithLoad(ConnectPoint cp, | 60 | + public SummaryFlowEntryWithLoad(ConnectPoint cp, |
61 | - Load totalLoad, Load immediateLoad, Load shortLoad, Load midLoad, Load longLoad) { | 61 | + Load totalLoad, Load immediateLoad, Load shortLoad, Load midLoad, Load longLoad) { |
62 | - this.cp = cp; | 62 | + this.cp = cp; |
63 | - this.totalLoad = totalLoad; | 63 | + this.totalLoad = totalLoad; |
64 | - this.immediateLoad = immediateLoad; | 64 | + this.immediateLoad = immediateLoad; |
65 | - this.shortLoad = shortLoad; | 65 | + this.shortLoad = shortLoad; |
66 | - this.midLoad = midLoad; | 66 | + this.midLoad = midLoad; |
67 | - this.longLoad = longLoad; | 67 | + this.longLoad = longLoad; |
68 | - this.unknownLoad = new DefaultLoad(); | 68 | + this.unknownLoad = new DefaultLoad(); |
69 | - } | 69 | + } |
70 | - | 70 | + |
71 | - /** | 71 | + /** |
72 | - * Creates a new summary flow entry having load for the given connect point | 72 | + * Creates a new summary flow entry having load for the given connect point |
73 | - * and total, immediate, short, mid, long, and unknown load. | 73 | + * and total, immediate, short, mid, long, and unknown load. |
74 | - * | 74 | + * |
75 | - * @param cp connect point | 75 | + * @param cp connect point |
76 | - * @param totalLoad total load | 76 | + * @param totalLoad total load |
77 | - * @param immediateLoad immediate load | 77 | + * @param immediateLoad immediate load |
78 | - * @param shortLoad short load | 78 | + * @param shortLoad short load |
79 | - * @param midLoad mid load | 79 | + * @param midLoad mid load |
80 | - * @param longLoad long load | 80 | + * @param longLoad long load |
81 | - * @param unknownLoad long load | 81 | + * @param unknownLoad long load |
82 | - */ | 82 | + */ |
83 | - public SummaryFlowEntryWithLoad(ConnectPoint cp, | 83 | + public SummaryFlowEntryWithLoad(ConnectPoint cp, |
84 | - Load totalLoad, Load immediateLoad, | 84 | + Load totalLoad, Load immediateLoad, |
85 | - Load shortLoad, Load midLoad, Load longLoad, Load unknownLoad) { | 85 | + Load shortLoad, Load midLoad, Load longLoad, Load unknownLoad) { |
86 | - this.cp = cp; | 86 | + this.cp = cp; |
87 | - this.totalLoad = totalLoad; | 87 | + this.totalLoad = totalLoad; |
88 | - this.immediateLoad = immediateLoad; | 88 | + this.immediateLoad = immediateLoad; |
89 | - this.shortLoad = shortLoad; | 89 | + this.shortLoad = shortLoad; |
90 | - this.midLoad = midLoad; | 90 | + this.midLoad = midLoad; |
91 | - this.longLoad = longLoad; | 91 | + this.longLoad = longLoad; |
92 | - this.unknownLoad = unknownLoad; | 92 | + this.unknownLoad = unknownLoad; |
93 | - } | 93 | + } |
94 | - | 94 | + |
95 | - /** | 95 | + /** |
96 | - * Returns connect point. | 96 | + * Returns connect point. |
97 | - * | 97 | + * |
98 | - * @return connect point | 98 | + * @return connect point |
99 | - */ | 99 | + */ |
100 | - public ConnectPoint connectPoint() { | 100 | + public ConnectPoint connectPoint() { |
101 | - return cp; | 101 | + return cp; |
102 | - } | 102 | + } |
103 | - | 103 | + |
104 | - /** | 104 | + /** |
105 | - * Returns total load of connect point. | 105 | + * Returns total load of connect point. |
106 | - * | 106 | + * |
107 | - * @return total load | 107 | + * @return total load |
108 | - */ | 108 | + */ |
109 | - public Load totalLoad() { | 109 | + public Load totalLoad() { |
110 | - return totalLoad; | 110 | + return totalLoad; |
111 | - } | 111 | + } |
112 | - | 112 | + |
113 | - /** | 113 | + /** |
114 | - * Returns immediate load of connect point. | 114 | + * Returns immediate load of connect point. |
115 | - * | 115 | + * |
116 | - * @return immediate load | 116 | + * @return immediate load |
117 | - */ | 117 | + */ |
118 | - public Load immediateLoad() { | 118 | + public Load immediateLoad() { |
119 | - return immediateLoad; | 119 | + return immediateLoad; |
120 | - } | 120 | + } |
121 | - | 121 | + |
122 | - /** | 122 | + /** |
123 | - * Returns short load of connect point. | 123 | + * Returns short load of connect point. |
124 | - * | 124 | + * |
125 | - * @return short load | 125 | + * @return short load |
126 | - */ | 126 | + */ |
127 | - public Load shortLoad() { | 127 | + public Load shortLoad() { |
128 | - return shortLoad; | 128 | + return shortLoad; |
129 | - } | 129 | + } |
130 | - | 130 | + |
131 | - /** | 131 | + /** |
132 | - * Returns mid load of connect point. | 132 | + * Returns mid load of connect point. |
133 | - * | 133 | + * |
134 | - * @return mid load | 134 | + * @return mid load |
135 | - */ | 135 | + */ |
136 | - public Load midLoad() { | 136 | + public Load midLoad() { |
137 | - return midLoad; | 137 | + return midLoad; |
138 | - } | 138 | + } |
139 | - | 139 | + |
140 | - /** | 140 | + /** |
141 | - * Returns long load of connect point. | 141 | + * Returns long load of connect point. |
142 | - * | 142 | + * |
143 | - * @return long load | 143 | + * @return long load |
144 | - */ | 144 | + */ |
145 | - public Load longLoad() { | 145 | + public Load longLoad() { |
146 | - return longLoad; | 146 | + return longLoad; |
147 | - } | 147 | + } |
148 | - | 148 | + |
149 | - /** | 149 | + /** |
150 | - * Returns unknown load of connect point. | 150 | + * Returns unknown load of connect point. |
151 | - * | 151 | + * |
152 | - * @return unknown load | 152 | + * @return unknown load |
153 | - */ | 153 | + */ |
154 | - public Load unknownLoad() { | 154 | + public Load unknownLoad() { |
155 | - return unknownLoad; | 155 | + return unknownLoad; |
156 | - } | 156 | + } |
157 | -} | 157 | +} | ... | ... |
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 | - | 16 | + |
17 | -package org.onosproject.net.statistic; | 17 | +package org.onosproject.net.statistic; |
18 | - | 18 | + |
19 | -import org.onosproject.net.ConnectPoint; | 19 | +import org.onosproject.net.ConnectPoint; |
20 | -import org.onosproject.net.flow.FlowEntry; | 20 | +import org.onosproject.net.flow.FlowEntry; |
21 | -import org.onosproject.net.flow.TypedStoredFlowEntry; | 21 | +import org.onosproject.net.flow.TypedStoredFlowEntry; |
22 | -import org.onosproject.net.flow.DefaultTypedFlowEntry; | 22 | +import org.onosproject.net.flow.DefaultTypedFlowEntry; |
23 | - | 23 | + |
24 | -import static com.google.common.base.Preconditions.checkNotNull; | 24 | +import static com.google.common.base.Preconditions.checkNotNull; |
25 | - | 25 | + |
26 | -/** | 26 | +/** |
27 | - * Load of flow entry of flow live type. | 27 | + * Load of flow entry of flow live type. |
28 | - */ | 28 | + */ |
29 | -public class TypedFlowEntryWithLoad { | 29 | +public class TypedFlowEntryWithLoad { |
30 | - private ConnectPoint cp; | 30 | + private ConnectPoint cp; |
31 | - private TypedStoredFlowEntry tfe; | 31 | + private TypedStoredFlowEntry tfe; |
32 | - private Load load; | 32 | + private Load load; |
33 | - | 33 | + |
34 | - //TODO: make this variables class, and share with NewAdaptivceFlowStatsCollector class | 34 | + //TODO: make this variables class, and share with NewAdaptivceFlowStatsCollector class |
35 | - private static final int CAL_AND_POLL_INTERVAL = 5; // means SHORT_POLL_INTERVAL | 35 | + private static final int CAL_AND_POLL_INTERVAL = 5; // means SHORT_POLL_INTERVAL |
36 | - private static final int MID_POLL_INTERVAL = 10; | 36 | + private static final int MID_POLL_INTERVAL = 10; |
37 | - private static final int LONG_POLL_INTERVAL = 15; | 37 | + private static final int LONG_POLL_INTERVAL = 15; |
38 | - | 38 | + |
39 | - /** | 39 | + /** |
40 | - * Creates a new typed flow entry with load. | 40 | + * Creates a new typed flow entry with load. |
41 | - * | 41 | + * |
42 | - * @param cp connect point | 42 | + * @param cp connect point |
43 | - * @param tfe typed flow entry | 43 | + * @param tfe typed flow entry |
44 | - * @param load load | 44 | + * @param load load |
45 | - */ | 45 | + */ |
46 | - public TypedFlowEntryWithLoad(ConnectPoint cp, TypedStoredFlowEntry tfe, Load load) { | 46 | + public TypedFlowEntryWithLoad(ConnectPoint cp, TypedStoredFlowEntry tfe, Load load) { |
47 | - this.cp = cp; | 47 | + this.cp = cp; |
48 | - this.tfe = tfe; | 48 | + this.tfe = tfe; |
49 | - this.load = load; | 49 | + this.load = load; |
50 | - } | 50 | + } |
51 | - | 51 | + |
52 | - /** | 52 | + /** |
53 | - * Creates a new typed flow entry with load. | 53 | + * Creates a new typed flow entry with load. |
54 | - * | 54 | + * |
55 | - * @param cp connect point | 55 | + * @param cp connect point |
56 | - * @param tfe typed flow entry | 56 | + * @param tfe typed flow entry |
57 | - */ | 57 | + */ |
58 | - public TypedFlowEntryWithLoad(ConnectPoint cp, TypedStoredFlowEntry tfe) { | 58 | + public TypedFlowEntryWithLoad(ConnectPoint cp, TypedStoredFlowEntry tfe) { |
59 | - this.cp = cp; | 59 | + this.cp = cp; |
60 | - this.tfe = tfe; | 60 | + this.tfe = tfe; |
61 | - this.load = new DefaultLoad(tfe.bytes(), 0, typedPollInterval(tfe)); | 61 | + this.load = new DefaultLoad(tfe.bytes(), 0, typedPollInterval(tfe)); |
62 | - } | 62 | + } |
63 | - | 63 | + |
64 | - /** | 64 | + /** |
65 | - * Creates a new typed flow entry with load. | 65 | + * Creates a new typed flow entry with load. |
66 | - * | 66 | + * |
67 | - * @param cp connect point | 67 | + * @param cp connect point |
68 | - * @param fe flow entry | 68 | + * @param fe flow entry |
69 | - */ | 69 | + */ |
70 | - public TypedFlowEntryWithLoad(ConnectPoint cp, FlowEntry fe) { | 70 | + public TypedFlowEntryWithLoad(ConnectPoint cp, FlowEntry fe) { |
71 | - this.cp = cp; | 71 | + this.cp = cp; |
72 | - this.tfe = newTypedStoredFlowEntry(fe); | 72 | + this.tfe = newTypedStoredFlowEntry(fe); |
73 | - this.load = new DefaultLoad(fe.bytes(), 0, typedPollInterval(this.tfe)); | 73 | + this.load = new DefaultLoad(fe.bytes(), 0, typedPollInterval(this.tfe)); |
74 | - } | 74 | + } |
75 | - | 75 | + |
76 | - public ConnectPoint connectPoint() { | 76 | + public ConnectPoint connectPoint() { |
77 | - return cp; | 77 | + return cp; |
78 | - } | 78 | + } |
79 | - public TypedStoredFlowEntry typedStoredFlowEntry() { | 79 | + public TypedStoredFlowEntry typedStoredFlowEntry() { |
80 | - return tfe; | 80 | + return tfe; |
81 | - } | 81 | + } |
82 | - public Load load() { | 82 | + public Load load() { |
83 | - return load; | 83 | + return load; |
84 | - } | 84 | + } |
85 | - public void setLoad(Load load) { | 85 | + public void setLoad(Load load) { |
86 | - this.load = load; | 86 | + this.load = load; |
87 | - } | 87 | + } |
88 | - | 88 | + |
89 | - /** | 89 | + /** |
90 | - * Returns short polling interval. | 90 | + * Returns short polling interval. |
91 | - * | 91 | + * |
92 | - * @return short poll interval | 92 | + * @return short poll interval |
93 | - */ | 93 | + */ |
94 | - public static int shortPollInterval() { | 94 | + public static int shortPollInterval() { |
95 | - return CAL_AND_POLL_INTERVAL; | 95 | + return CAL_AND_POLL_INTERVAL; |
96 | - } | 96 | + } |
97 | - | 97 | + |
98 | - /** | 98 | + /** |
99 | - * Returns mid polling interval. | 99 | + * Returns mid polling interval. |
100 | - * | 100 | + * |
101 | - * @return mid poll interval | 101 | + * @return mid poll interval |
102 | - */ | 102 | + */ |
103 | - public static int midPollInterval() { | 103 | + public static int midPollInterval() { |
104 | - return MID_POLL_INTERVAL; | 104 | + return MID_POLL_INTERVAL; |
105 | - } | 105 | + } |
106 | - | 106 | + |
107 | - /** | 107 | + /** |
108 | - * Returns long polling interval. | 108 | + * Returns long polling interval. |
109 | - * | 109 | + * |
110 | - * @return long poll interval | 110 | + * @return long poll interval |
111 | - */ | 111 | + */ |
112 | - public static int longPollInterval() { | 112 | + public static int longPollInterval() { |
113 | - return LONG_POLL_INTERVAL; | 113 | + return LONG_POLL_INTERVAL; |
114 | - } | 114 | + } |
115 | - | 115 | + |
116 | - /** | 116 | + /** |
117 | - * Returns average polling interval. | 117 | + * Returns average polling interval. |
118 | - * | 118 | + * |
119 | - * @return average poll interval | 119 | + * @return average poll interval |
120 | - */ | 120 | + */ |
121 | - public static int avgPollInterval() { | 121 | + public static int avgPollInterval() { |
122 | - return (CAL_AND_POLL_INTERVAL + MID_POLL_INTERVAL + LONG_POLL_INTERVAL) / 3; | 122 | + return (CAL_AND_POLL_INTERVAL + MID_POLL_INTERVAL + LONG_POLL_INTERVAL) / 3; |
123 | - } | 123 | + } |
124 | - | 124 | + |
125 | - /** | 125 | + /** |
126 | - * Returns current typed flow entry's polling interval. | 126 | + * Returns current typed flow entry's polling interval. |
127 | - * | 127 | + * |
128 | - * @param tfe typed flow entry | 128 | + * @param tfe typed flow entry |
129 | - * @return typed poll interval | 129 | + * @return typed poll interval |
130 | - */ | 130 | + */ |
131 | - public static long typedPollInterval(TypedStoredFlowEntry tfe) { | 131 | + public static long typedPollInterval(TypedStoredFlowEntry tfe) { |
132 | - checkNotNull(tfe, "TypedStoredFlowEntry cannot be null"); | 132 | + checkNotNull(tfe, "TypedStoredFlowEntry cannot be null"); |
133 | - | 133 | + |
134 | - switch (tfe.flowLiveType()) { | 134 | + switch (tfe.flowLiveType()) { |
135 | - case LONG_FLOW: | 135 | + case LONG_FLOW: |
136 | - return LONG_POLL_INTERVAL; | 136 | + return LONG_POLL_INTERVAL; |
137 | - case MID_FLOW: | 137 | + case MID_FLOW: |
138 | - return MID_POLL_INTERVAL; | 138 | + return MID_POLL_INTERVAL; |
139 | - case SHORT_FLOW: | 139 | + case SHORT_FLOW: |
140 | - case IMMEDIATE_FLOW: | 140 | + case IMMEDIATE_FLOW: |
141 | - default: | 141 | + default: |
142 | - return CAL_AND_POLL_INTERVAL; | 142 | + return CAL_AND_POLL_INTERVAL; |
143 | - } | 143 | + } |
144 | - } | 144 | + } |
145 | - | 145 | + |
146 | - /** | 146 | + /** |
147 | - * Creates a new typed flow entry with the given flow entry fe. | 147 | + * Creates a new typed flow entry with the given flow entry fe. |
148 | - * | 148 | + * |
149 | - * @param fe flow entry | 149 | + * @param fe flow entry |
150 | - * @return new typed flow entry | 150 | + * @return new typed flow entry |
151 | - */ | 151 | + */ |
152 | - public static TypedStoredFlowEntry newTypedStoredFlowEntry(FlowEntry fe) { | 152 | + public static TypedStoredFlowEntry newTypedStoredFlowEntry(FlowEntry fe) { |
153 | - if (fe == null) { | 153 | + if (fe == null) { |
154 | - return null; | 154 | + return null; |
155 | - } | 155 | + } |
156 | - | 156 | + |
157 | - long life = fe.life(); | 157 | + long life = fe.life(); |
158 | - | 158 | + |
159 | - if (life >= LONG_POLL_INTERVAL) { | 159 | + if (life >= LONG_POLL_INTERVAL) { |
160 | - return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.LONG_FLOW); | 160 | + return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.LONG_FLOW); |
161 | - } else if (life >= MID_POLL_INTERVAL) { | 161 | + } else if (life >= MID_POLL_INTERVAL) { |
162 | - return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.MID_FLOW); | 162 | + return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.MID_FLOW); |
163 | - } else if (life >= CAL_AND_POLL_INTERVAL) { | 163 | + } else if (life >= CAL_AND_POLL_INTERVAL) { |
164 | - return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.SHORT_FLOW); | 164 | + return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.SHORT_FLOW); |
165 | - } else if (life >= 0) { | 165 | + } else if (life >= 0) { |
166 | - return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.IMMEDIATE_FLOW); | 166 | + return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.IMMEDIATE_FLOW); |
167 | - } else { // life < 0 | 167 | + } else { // life < 0 |
168 | - return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.UNKNOWN_FLOW); | 168 | + return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.UNKNOWN_FLOW); |
169 | - } | 169 | + } |
170 | - } | 170 | + } |
171 | -} | 171 | +} | ... | ... |
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 | - | 16 | + |
17 | -package org.onosproject.net.statistic.impl; | 17 | +package org.onosproject.net.statistic.impl; |
18 | - | 18 | + |
19 | -import com.google.common.base.MoreObjects; | 19 | +import com.google.common.base.MoreObjects; |
20 | -import com.google.common.base.Predicate; | 20 | +import com.google.common.base.Predicate; |
21 | -import com.google.common.collect.ImmutableSet; | 21 | +import com.google.common.collect.ImmutableSet; |
22 | -import org.apache.felix.scr.annotations.Activate; | 22 | +import org.apache.felix.scr.annotations.Activate; |
23 | -import org.apache.felix.scr.annotations.Component; | 23 | +import org.apache.felix.scr.annotations.Component; |
24 | -import org.apache.felix.scr.annotations.Deactivate; | 24 | +import org.apache.felix.scr.annotations.Deactivate; |
25 | -import org.apache.felix.scr.annotations.Reference; | 25 | +import org.apache.felix.scr.annotations.Reference; |
26 | -import org.apache.felix.scr.annotations.ReferenceCardinality; | 26 | +import org.apache.felix.scr.annotations.ReferenceCardinality; |
27 | -import org.apache.felix.scr.annotations.Service; | 27 | +import org.apache.felix.scr.annotations.Service; |
28 | -import org.onosproject.cli.Comparators; | 28 | +import org.onosproject.cli.Comparators; |
29 | -import org.onosproject.net.ConnectPoint; | 29 | +import org.onosproject.net.ConnectPoint; |
30 | -import org.onosproject.net.Device; | 30 | +import org.onosproject.net.Device; |
31 | -import org.onosproject.net.Port; | 31 | +import org.onosproject.net.Port; |
32 | -import org.onosproject.net.PortNumber; | 32 | +import org.onosproject.net.PortNumber; |
33 | -import org.onosproject.net.device.DeviceService; | 33 | +import org.onosproject.net.device.DeviceService; |
34 | -import org.onosproject.net.flow.DefaultTypedFlowEntry; | 34 | +import org.onosproject.net.flow.DefaultTypedFlowEntry; |
35 | -import org.onosproject.net.flow.FlowEntry; | 35 | +import org.onosproject.net.flow.FlowEntry; |
36 | -import org.onosproject.net.flow.FlowRule; | 36 | +import org.onosproject.net.flow.FlowRule; |
37 | -import org.onosproject.net.flow.FlowRuleEvent; | 37 | +import org.onosproject.net.flow.FlowRuleEvent; |
38 | -import org.onosproject.net.flow.FlowRuleListener; | 38 | +import org.onosproject.net.flow.FlowRuleListener; |
39 | -import org.onosproject.net.flow.FlowRuleService; | 39 | +import org.onosproject.net.flow.FlowRuleService; |
40 | -import org.onosproject.net.flow.TypedStoredFlowEntry; | 40 | +import org.onosproject.net.flow.TypedStoredFlowEntry; |
41 | -import org.onosproject.net.flow.instructions.Instruction; | 41 | +import org.onosproject.net.flow.instructions.Instruction; |
42 | -import org.onosproject.net.statistic.DefaultLoad; | 42 | +import org.onosproject.net.statistic.DefaultLoad; |
43 | -import org.onosproject.net.statistic.FlowStatisticService; | 43 | +import org.onosproject.net.statistic.FlowStatisticService; |
44 | -import org.onosproject.net.statistic.Load; | 44 | +import org.onosproject.net.statistic.Load; |
45 | -import org.onosproject.net.statistic.FlowStatisticStore; | 45 | +import org.onosproject.net.statistic.FlowStatisticStore; |
46 | -import org.onosproject.net.statistic.SummaryFlowEntryWithLoad; | 46 | +import org.onosproject.net.statistic.SummaryFlowEntryWithLoad; |
47 | -import org.onosproject.net.statistic.TypedFlowEntryWithLoad; | 47 | +import org.onosproject.net.statistic.TypedFlowEntryWithLoad; |
48 | - | 48 | + |
49 | -import org.slf4j.Logger; | 49 | +import org.slf4j.Logger; |
50 | - | 50 | + |
51 | -import java.util.ArrayList; | 51 | +import java.util.ArrayList; |
52 | -import java.util.HashMap; | 52 | +import java.util.HashMap; |
53 | -import java.util.List; | 53 | +import java.util.List; |
54 | -import java.util.Map; | 54 | +import java.util.Map; |
55 | -import java.util.Objects; | 55 | +import java.util.Objects; |
56 | -import java.util.Set; | 56 | +import java.util.Set; |
57 | -import java.util.TreeMap; | 57 | +import java.util.TreeMap; |
58 | -import java.util.stream.Collectors; | 58 | +import java.util.stream.Collectors; |
59 | - | 59 | + |
60 | -import static com.google.common.base.Preconditions.checkNotNull; | 60 | +import static com.google.common.base.Preconditions.checkNotNull; |
61 | -import static org.onosproject.security.AppGuard.checkPermission; | 61 | +import static org.onosproject.security.AppGuard.checkPermission; |
62 | -import static org.slf4j.LoggerFactory.getLogger; | 62 | +import static org.slf4j.LoggerFactory.getLogger; |
63 | -import static org.onosproject.security.AppPermission.Type.*; | 63 | +import static org.onosproject.security.AppPermission.Type.*; |
64 | - | 64 | + |
65 | -/** | 65 | +/** |
66 | - * Provides an implementation of the Flow Statistic Service. | 66 | + * Provides an implementation of the Flow Statistic Service. |
67 | - */ | 67 | + */ |
68 | -@Component(immediate = true, enabled = true) | 68 | +@Component(immediate = true, enabled = true) |
69 | -@Service | 69 | +@Service |
70 | -public class FlowStatisticManager implements FlowStatisticService { | 70 | +public class FlowStatisticManager implements FlowStatisticService { |
71 | - private final Logger log = getLogger(getClass()); | 71 | + private final Logger log = getLogger(getClass()); |
72 | - | 72 | + |
73 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 73 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
74 | - protected FlowRuleService flowRuleService; | 74 | + protected FlowRuleService flowRuleService; |
75 | - | 75 | + |
76 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 76 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
77 | - protected FlowStatisticStore flowStatisticStore; | 77 | + protected FlowStatisticStore flowStatisticStore; |
78 | - | 78 | + |
79 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 79 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
80 | - protected DeviceService deviceService; | 80 | + protected DeviceService deviceService; |
81 | - | 81 | + |
82 | - private final InternalFlowRuleStatsListener frListener = new InternalFlowRuleStatsListener(); | 82 | + private final InternalFlowRuleStatsListener frListener = new InternalFlowRuleStatsListener(); |
83 | - | 83 | + |
84 | - @Activate | 84 | + @Activate |
85 | - public void activate() { | 85 | + public void activate() { |
86 | - flowRuleService.addListener(frListener); | 86 | + flowRuleService.addListener(frListener); |
87 | - log.info("Started"); | 87 | + log.info("Started"); |
88 | - } | 88 | + } |
89 | - | 89 | + |
90 | - @Deactivate | 90 | + @Deactivate |
91 | - public void deactivate() { | 91 | + public void deactivate() { |
92 | - flowRuleService.removeListener(frListener); | 92 | + flowRuleService.removeListener(frListener); |
93 | - log.info("Stopped"); | 93 | + log.info("Stopped"); |
94 | - } | 94 | + } |
95 | - | 95 | + |
96 | - @Override | 96 | + @Override |
97 | - public Map<ConnectPoint, SummaryFlowEntryWithLoad> loadSummary(Device device) { | 97 | + public Map<ConnectPoint, SummaryFlowEntryWithLoad> loadSummary(Device device) { |
98 | - checkPermission(STATISTIC_READ); | 98 | + checkPermission(STATISTIC_READ); |
99 | - | 99 | + |
100 | - Map<ConnectPoint, SummaryFlowEntryWithLoad> summaryLoad = new TreeMap<>(Comparators.CONNECT_POINT_COMPARATOR); | 100 | + Map<ConnectPoint, SummaryFlowEntryWithLoad> summaryLoad = new TreeMap<>(Comparators.CONNECT_POINT_COMPARATOR); |
101 | - | 101 | + |
102 | - if (device == null) { | 102 | + if (device == null) { |
103 | - return summaryLoad; | 103 | + return summaryLoad; |
104 | - } | 104 | + } |
105 | - | 105 | + |
106 | - List<Port> ports = new ArrayList<>(deviceService.getPorts(device.id())); | 106 | + List<Port> ports = new ArrayList<>(deviceService.getPorts(device.id())); |
107 | - | 107 | + |
108 | - for (Port port : ports) { | 108 | + for (Port port : ports) { |
109 | - ConnectPoint cp = new ConnectPoint(device.id(), port.number()); | 109 | + ConnectPoint cp = new ConnectPoint(device.id(), port.number()); |
110 | - SummaryFlowEntryWithLoad sfe = loadSummaryPortInternal(cp); | 110 | + SummaryFlowEntryWithLoad sfe = loadSummaryPortInternal(cp); |
111 | - summaryLoad.put(cp, sfe); | 111 | + summaryLoad.put(cp, sfe); |
112 | - } | 112 | + } |
113 | - | 113 | + |
114 | - return summaryLoad; | 114 | + return summaryLoad; |
115 | - } | 115 | + } |
116 | - | 116 | + |
117 | - @Override | 117 | + @Override |
118 | - public SummaryFlowEntryWithLoad loadSummary(Device device, PortNumber pNumber) { | 118 | + public SummaryFlowEntryWithLoad loadSummary(Device device, PortNumber pNumber) { |
119 | - checkPermission(STATISTIC_READ); | 119 | + checkPermission(STATISTIC_READ); |
120 | - | 120 | + |
121 | - ConnectPoint cp = new ConnectPoint(device.id(), pNumber); | 121 | + ConnectPoint cp = new ConnectPoint(device.id(), pNumber); |
122 | - return loadSummaryPortInternal(cp); | 122 | + return loadSummaryPortInternal(cp); |
123 | - } | 123 | + } |
124 | - | 124 | + |
125 | - @Override | 125 | + @Override |
126 | - public Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadAllByType(Device device, | 126 | + public Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadAllByType(Device device, |
127 | - TypedStoredFlowEntry.FlowLiveType liveType, | 127 | + TypedStoredFlowEntry.FlowLiveType liveType, |
128 | - Instruction.Type instType) { | 128 | + Instruction.Type instType) { |
129 | - checkPermission(STATISTIC_READ); | 129 | + checkPermission(STATISTIC_READ); |
130 | - | 130 | + |
131 | - Map<ConnectPoint, List<TypedFlowEntryWithLoad>> allLoad = new TreeMap<>(Comparators.CONNECT_POINT_COMPARATOR); | 131 | + Map<ConnectPoint, List<TypedFlowEntryWithLoad>> allLoad = new TreeMap<>(Comparators.CONNECT_POINT_COMPARATOR); |
132 | - | 132 | + |
133 | - if (device == null) { | 133 | + if (device == null) { |
134 | - return allLoad; | 134 | + return allLoad; |
135 | - } | 135 | + } |
136 | - | 136 | + |
137 | - List<Port> ports = new ArrayList<>(deviceService.getPorts(device.id())); | 137 | + List<Port> ports = new ArrayList<>(deviceService.getPorts(device.id())); |
138 | - | 138 | + |
139 | - for (Port port : ports) { | 139 | + for (Port port : ports) { |
140 | - ConnectPoint cp = new ConnectPoint(device.id(), port.number()); | 140 | + ConnectPoint cp = new ConnectPoint(device.id(), port.number()); |
141 | - List<TypedFlowEntryWithLoad> tfel = loadAllPortInternal(cp, liveType, instType); | 141 | + List<TypedFlowEntryWithLoad> tfel = loadAllPortInternal(cp, liveType, instType); |
142 | - allLoad.put(cp, tfel); | 142 | + allLoad.put(cp, tfel); |
143 | - } | 143 | + } |
144 | - | 144 | + |
145 | - return allLoad; | 145 | + return allLoad; |
146 | - } | 146 | + } |
147 | - | 147 | + |
148 | - @Override | 148 | + @Override |
149 | - public List<TypedFlowEntryWithLoad> loadAllByType(Device device, PortNumber pNumber, | 149 | + public List<TypedFlowEntryWithLoad> loadAllByType(Device device, PortNumber pNumber, |
150 | - TypedStoredFlowEntry.FlowLiveType liveType, | 150 | + TypedStoredFlowEntry.FlowLiveType liveType, |
151 | - Instruction.Type instType) { | 151 | + Instruction.Type instType) { |
152 | - checkPermission(STATISTIC_READ); | 152 | + checkPermission(STATISTIC_READ); |
153 | - | 153 | + |
154 | - ConnectPoint cp = new ConnectPoint(device.id(), pNumber); | 154 | + ConnectPoint cp = new ConnectPoint(device.id(), pNumber); |
155 | - return loadAllPortInternal(cp, liveType, instType); | 155 | + return loadAllPortInternal(cp, liveType, instType); |
156 | - } | 156 | + } |
157 | - | 157 | + |
158 | - @Override | 158 | + @Override |
159 | - public Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadTopnByType(Device device, | 159 | + public Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadTopnByType(Device device, |
160 | - TypedStoredFlowEntry.FlowLiveType liveType, | 160 | + TypedStoredFlowEntry.FlowLiveType liveType, |
161 | - Instruction.Type instType, | 161 | + Instruction.Type instType, |
162 | - int topn) { | 162 | + int topn) { |
163 | - checkPermission(STATISTIC_READ); | 163 | + checkPermission(STATISTIC_READ); |
164 | - | 164 | + |
165 | - Map<ConnectPoint, List<TypedFlowEntryWithLoad>> allLoad = new TreeMap<>(Comparators.CONNECT_POINT_COMPARATOR); | 165 | + Map<ConnectPoint, List<TypedFlowEntryWithLoad>> allLoad = new TreeMap<>(Comparators.CONNECT_POINT_COMPARATOR); |
166 | - | 166 | + |
167 | - if (device == null) { | 167 | + if (device == null) { |
168 | - return allLoad; | 168 | + return allLoad; |
169 | - } | 169 | + } |
170 | - | 170 | + |
171 | - List<Port> ports = new ArrayList<>(deviceService.getPorts(device.id())); | 171 | + List<Port> ports = new ArrayList<>(deviceService.getPorts(device.id())); |
172 | - | 172 | + |
173 | - for (Port port : ports) { | 173 | + for (Port port : ports) { |
174 | - ConnectPoint cp = new ConnectPoint(device.id(), port.number()); | 174 | + ConnectPoint cp = new ConnectPoint(device.id(), port.number()); |
175 | - List<TypedFlowEntryWithLoad> tfel = loadTopnPortInternal(cp, liveType, instType, topn); | 175 | + List<TypedFlowEntryWithLoad> tfel = loadTopnPortInternal(cp, liveType, instType, topn); |
176 | - allLoad.put(cp, tfel); | 176 | + allLoad.put(cp, tfel); |
177 | - } | 177 | + } |
178 | - | 178 | + |
179 | - return allLoad; | 179 | + return allLoad; |
180 | - } | 180 | + } |
181 | - | 181 | + |
182 | - @Override | 182 | + @Override |
183 | - public List<TypedFlowEntryWithLoad> loadTopnByType(Device device, PortNumber pNumber, | 183 | + public List<TypedFlowEntryWithLoad> loadTopnByType(Device device, PortNumber pNumber, |
184 | - TypedStoredFlowEntry.FlowLiveType liveType, | 184 | + TypedStoredFlowEntry.FlowLiveType liveType, |
185 | - Instruction.Type instType, | 185 | + Instruction.Type instType, |
186 | - int topn) { | 186 | + int topn) { |
187 | - checkPermission(STATISTIC_READ); | 187 | + checkPermission(STATISTIC_READ); |
188 | - | 188 | + |
189 | - ConnectPoint cp = new ConnectPoint(device.id(), pNumber); | 189 | + ConnectPoint cp = new ConnectPoint(device.id(), pNumber); |
190 | - return loadTopnPortInternal(cp, liveType, instType, topn); | 190 | + return loadTopnPortInternal(cp, liveType, instType, topn); |
191 | - } | 191 | + } |
192 | - | 192 | + |
193 | - private SummaryFlowEntryWithLoad loadSummaryPortInternal(ConnectPoint cp) { | 193 | + private SummaryFlowEntryWithLoad loadSummaryPortInternal(ConnectPoint cp) { |
194 | - checkPermission(STATISTIC_READ); | 194 | + checkPermission(STATISTIC_READ); |
195 | - | 195 | + |
196 | - Set<FlowEntry> currentStats; | 196 | + Set<FlowEntry> currentStats; |
197 | - Set<FlowEntry> previousStats; | 197 | + Set<FlowEntry> previousStats; |
198 | - | 198 | + |
199 | - TypedStatistics typedStatistics; | 199 | + TypedStatistics typedStatistics; |
200 | - synchronized (flowStatisticStore) { | 200 | + synchronized (flowStatisticStore) { |
201 | - currentStats = flowStatisticStore.getCurrentFlowStatistic(cp); | 201 | + currentStats = flowStatisticStore.getCurrentFlowStatistic(cp); |
202 | - if (currentStats == null) { | 202 | + if (currentStats == null) { |
203 | - return new SummaryFlowEntryWithLoad(cp, new DefaultLoad()); | 203 | + return new SummaryFlowEntryWithLoad(cp, new DefaultLoad()); |
204 | - } | 204 | + } |
205 | - previousStats = flowStatisticStore.getPreviousFlowStatistic(cp); | 205 | + previousStats = flowStatisticStore.getPreviousFlowStatistic(cp); |
206 | - if (previousStats == null) { | 206 | + if (previousStats == null) { |
207 | - return new SummaryFlowEntryWithLoad(cp, new DefaultLoad()); | 207 | + return new SummaryFlowEntryWithLoad(cp, new DefaultLoad()); |
208 | - } | 208 | + } |
209 | - // copy to local flow entry | 209 | + // copy to local flow entry |
210 | - typedStatistics = new TypedStatistics(currentStats, previousStats); | 210 | + typedStatistics = new TypedStatistics(currentStats, previousStats); |
211 | - | 211 | + |
212 | - // Check for validity of this stats data | 212 | + // Check for validity of this stats data |
213 | - checkLoadValidity(currentStats, previousStats); | 213 | + checkLoadValidity(currentStats, previousStats); |
214 | - } | 214 | + } |
215 | - | 215 | + |
216 | - // current and previous set is not empty! | 216 | + // current and previous set is not empty! |
217 | - Set<FlowEntry> currentSet = typedStatistics.current(); | 217 | + Set<FlowEntry> currentSet = typedStatistics.current(); |
218 | - Set<FlowEntry> previousSet = typedStatistics.previous(); | 218 | + Set<FlowEntry> previousSet = typedStatistics.previous(); |
219 | - Load totalLoad = new DefaultLoad(aggregateBytesSet(currentSet), aggregateBytesSet(previousSet), | 219 | + Load totalLoad = new DefaultLoad(aggregateBytesSet(currentSet), aggregateBytesSet(previousSet), |
220 | - TypedFlowEntryWithLoad.avgPollInterval()); | 220 | + TypedFlowEntryWithLoad.avgPollInterval()); |
221 | - | 221 | + |
222 | - Map<FlowRule, TypedStoredFlowEntry> currentMap; | 222 | + Map<FlowRule, TypedStoredFlowEntry> currentMap; |
223 | - Map<FlowRule, TypedStoredFlowEntry> previousMap; | 223 | + Map<FlowRule, TypedStoredFlowEntry> previousMap; |
224 | - | 224 | + |
225 | - currentMap = typedStatistics.currentImmediate(); | 225 | + currentMap = typedStatistics.currentImmediate(); |
226 | - previousMap = typedStatistics.previousImmediate(); | 226 | + previousMap = typedStatistics.previousImmediate(); |
227 | - Load immediateLoad = new DefaultLoad(aggregateBytesMap(currentMap), aggregateBytesMap(previousMap), | 227 | + Load immediateLoad = new DefaultLoad(aggregateBytesMap(currentMap), aggregateBytesMap(previousMap), |
228 | - TypedFlowEntryWithLoad.shortPollInterval()); | 228 | + TypedFlowEntryWithLoad.shortPollInterval()); |
229 | - | 229 | + |
230 | - currentMap = typedStatistics.currentShort(); | 230 | + currentMap = typedStatistics.currentShort(); |
231 | - previousMap = typedStatistics.previousShort(); | 231 | + previousMap = typedStatistics.previousShort(); |
232 | - Load shortLoad = new DefaultLoad(aggregateBytesMap(currentMap), aggregateBytesMap(previousMap), | 232 | + Load shortLoad = new DefaultLoad(aggregateBytesMap(currentMap), aggregateBytesMap(previousMap), |
233 | - TypedFlowEntryWithLoad.shortPollInterval()); | 233 | + TypedFlowEntryWithLoad.shortPollInterval()); |
234 | - | 234 | + |
235 | - currentMap = typedStatistics.currentMid(); | 235 | + currentMap = typedStatistics.currentMid(); |
236 | - previousMap = typedStatistics.previousMid(); | 236 | + previousMap = typedStatistics.previousMid(); |
237 | - Load midLoad = new DefaultLoad(aggregateBytesMap(currentMap), aggregateBytesMap(previousMap), | 237 | + Load midLoad = new DefaultLoad(aggregateBytesMap(currentMap), aggregateBytesMap(previousMap), |
238 | - TypedFlowEntryWithLoad.midPollInterval()); | 238 | + TypedFlowEntryWithLoad.midPollInterval()); |
239 | - | 239 | + |
240 | - currentMap = typedStatistics.currentLong(); | 240 | + currentMap = typedStatistics.currentLong(); |
241 | - previousMap = typedStatistics.previousLong(); | 241 | + previousMap = typedStatistics.previousLong(); |
242 | - Load longLoad = new DefaultLoad(aggregateBytesMap(currentMap), aggregateBytesMap(previousMap), | 242 | + Load longLoad = new DefaultLoad(aggregateBytesMap(currentMap), aggregateBytesMap(previousMap), |
243 | - TypedFlowEntryWithLoad.longPollInterval()); | 243 | + TypedFlowEntryWithLoad.longPollInterval()); |
244 | - | 244 | + |
245 | - currentMap = typedStatistics.currentUnknown(); | 245 | + currentMap = typedStatistics.currentUnknown(); |
246 | - previousMap = typedStatistics.previousUnknown(); | 246 | + previousMap = typedStatistics.previousUnknown(); |
247 | - Load unknownLoad = new DefaultLoad(aggregateBytesMap(currentMap), aggregateBytesMap(previousMap), | 247 | + Load unknownLoad = new DefaultLoad(aggregateBytesMap(currentMap), aggregateBytesMap(previousMap), |
248 | - TypedFlowEntryWithLoad.avgPollInterval()); | 248 | + TypedFlowEntryWithLoad.avgPollInterval()); |
249 | - | 249 | + |
250 | - return new SummaryFlowEntryWithLoad(cp, totalLoad, immediateLoad, shortLoad, midLoad, longLoad, unknownLoad); | 250 | + return new SummaryFlowEntryWithLoad(cp, totalLoad, immediateLoad, shortLoad, midLoad, longLoad, unknownLoad); |
251 | - } | 251 | + } |
252 | - | 252 | + |
253 | - private List<TypedFlowEntryWithLoad> loadAllPortInternal(ConnectPoint cp, | 253 | + private List<TypedFlowEntryWithLoad> loadAllPortInternal(ConnectPoint cp, |
254 | - TypedStoredFlowEntry.FlowLiveType liveType, | 254 | + TypedStoredFlowEntry.FlowLiveType liveType, |
255 | - Instruction.Type instType) { | 255 | + Instruction.Type instType) { |
256 | - checkPermission(STATISTIC_READ); | 256 | + checkPermission(STATISTIC_READ); |
257 | - | 257 | + |
258 | - List<TypedFlowEntryWithLoad> retTfel = new ArrayList<>(); | 258 | + List<TypedFlowEntryWithLoad> retTfel = new ArrayList<>(); |
259 | - | 259 | + |
260 | - Set<FlowEntry> currentStats; | 260 | + Set<FlowEntry> currentStats; |
261 | - Set<FlowEntry> previousStats; | 261 | + Set<FlowEntry> previousStats; |
262 | - | 262 | + |
263 | - TypedStatistics typedStatistics; | 263 | + TypedStatistics typedStatistics; |
264 | - synchronized (flowStatisticStore) { | 264 | + synchronized (flowStatisticStore) { |
265 | - currentStats = flowStatisticStore.getCurrentFlowStatistic(cp); | 265 | + currentStats = flowStatisticStore.getCurrentFlowStatistic(cp); |
266 | - if (currentStats == null) { | 266 | + if (currentStats == null) { |
267 | - return retTfel; | 267 | + return retTfel; |
268 | - } | 268 | + } |
269 | - previousStats = flowStatisticStore.getPreviousFlowStatistic(cp); | 269 | + previousStats = flowStatisticStore.getPreviousFlowStatistic(cp); |
270 | - if (previousStats == null) { | 270 | + if (previousStats == null) { |
271 | - return retTfel; | 271 | + return retTfel; |
272 | - } | 272 | + } |
273 | - // copy to local flow entry set | 273 | + // copy to local flow entry set |
274 | - typedStatistics = new TypedStatistics(currentStats, previousStats); | 274 | + typedStatistics = new TypedStatistics(currentStats, previousStats); |
275 | - | 275 | + |
276 | - // Check for validity of this stats data | 276 | + // Check for validity of this stats data |
277 | - checkLoadValidity(currentStats, previousStats); | 277 | + checkLoadValidity(currentStats, previousStats); |
278 | - } | 278 | + } |
279 | - | 279 | + |
280 | - // current and previous set is not empty! | 280 | + // current and previous set is not empty! |
281 | - boolean isAllLiveType = (liveType == null ? true : false); // null is all live type | 281 | + boolean isAllLiveType = (liveType == null ? true : false); // null is all live type |
282 | - boolean isAllInstType = (instType == null ? true : false); // null is all inst type | 282 | + boolean isAllInstType = (instType == null ? true : false); // null is all inst type |
283 | - | 283 | + |
284 | - Map<FlowRule, TypedStoredFlowEntry> currentMap; | 284 | + Map<FlowRule, TypedStoredFlowEntry> currentMap; |
285 | - Map<FlowRule, TypedStoredFlowEntry> previousMap; | 285 | + Map<FlowRule, TypedStoredFlowEntry> previousMap; |
286 | - | 286 | + |
287 | - if (isAllLiveType || liveType == TypedStoredFlowEntry.FlowLiveType.IMMEDIATE_FLOW) { | 287 | + if (isAllLiveType || liveType == TypedStoredFlowEntry.FlowLiveType.IMMEDIATE_FLOW) { |
288 | - currentMap = typedStatistics.currentImmediate(); | 288 | + currentMap = typedStatistics.currentImmediate(); |
289 | - previousMap = typedStatistics.previousImmediate(); | 289 | + previousMap = typedStatistics.previousImmediate(); |
290 | - | 290 | + |
291 | - List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap, | 291 | + List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap, |
292 | - isAllInstType, instType, TypedFlowEntryWithLoad.shortPollInterval()); | 292 | + isAllInstType, instType, TypedFlowEntryWithLoad.shortPollInterval()); |
293 | - if (fel.size() > 0) { | 293 | + if (fel.size() > 0) { |
294 | - retTfel.addAll(fel); | 294 | + retTfel.addAll(fel); |
295 | - } | 295 | + } |
296 | - } | 296 | + } |
297 | - | 297 | + |
298 | - if (isAllLiveType || liveType == TypedStoredFlowEntry.FlowLiveType.SHORT_FLOW) { | 298 | + if (isAllLiveType || liveType == TypedStoredFlowEntry.FlowLiveType.SHORT_FLOW) { |
299 | - currentMap = typedStatistics.currentShort(); | 299 | + currentMap = typedStatistics.currentShort(); |
300 | - previousMap = typedStatistics.previousShort(); | 300 | + previousMap = typedStatistics.previousShort(); |
301 | - | 301 | + |
302 | - List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap, | 302 | + List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap, |
303 | - isAllInstType, instType, TypedFlowEntryWithLoad.shortPollInterval()); | 303 | + isAllInstType, instType, TypedFlowEntryWithLoad.shortPollInterval()); |
304 | - if (fel.size() > 0) { | 304 | + if (fel.size() > 0) { |
305 | - retTfel.addAll(fel); | 305 | + retTfel.addAll(fel); |
306 | - } | 306 | + } |
307 | - } | 307 | + } |
308 | - | 308 | + |
309 | - if (isAllLiveType || liveType == TypedStoredFlowEntry.FlowLiveType.MID_FLOW) { | 309 | + if (isAllLiveType || liveType == TypedStoredFlowEntry.FlowLiveType.MID_FLOW) { |
310 | - currentMap = typedStatistics.currentMid(); | 310 | + currentMap = typedStatistics.currentMid(); |
311 | - previousMap = typedStatistics.previousMid(); | 311 | + previousMap = typedStatistics.previousMid(); |
312 | - | 312 | + |
313 | - List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap, | 313 | + List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap, |
314 | - isAllInstType, instType, TypedFlowEntryWithLoad.midPollInterval()); | 314 | + isAllInstType, instType, TypedFlowEntryWithLoad.midPollInterval()); |
315 | - if (fel.size() > 0) { | 315 | + if (fel.size() > 0) { |
316 | - retTfel.addAll(fel); | 316 | + retTfel.addAll(fel); |
317 | - } | 317 | + } |
318 | - } | 318 | + } |
319 | - | 319 | + |
320 | - if (isAllLiveType || liveType == TypedStoredFlowEntry.FlowLiveType.LONG_FLOW) { | 320 | + if (isAllLiveType || liveType == TypedStoredFlowEntry.FlowLiveType.LONG_FLOW) { |
321 | - currentMap = typedStatistics.currentLong(); | 321 | + currentMap = typedStatistics.currentLong(); |
322 | - previousMap = typedStatistics.previousLong(); | 322 | + previousMap = typedStatistics.previousLong(); |
323 | - | 323 | + |
324 | - List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap, | 324 | + List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap, |
325 | - isAllInstType, instType, TypedFlowEntryWithLoad.longPollInterval()); | 325 | + isAllInstType, instType, TypedFlowEntryWithLoad.longPollInterval()); |
326 | - if (fel.size() > 0) { | 326 | + if (fel.size() > 0) { |
327 | - retTfel.addAll(fel); | 327 | + retTfel.addAll(fel); |
328 | - } | 328 | + } |
329 | - } | 329 | + } |
330 | - | 330 | + |
331 | - if (isAllLiveType || liveType == TypedStoredFlowEntry.FlowLiveType.UNKNOWN_FLOW) { | 331 | + if (isAllLiveType || liveType == TypedStoredFlowEntry.FlowLiveType.UNKNOWN_FLOW) { |
332 | - currentMap = typedStatistics.currentUnknown(); | 332 | + currentMap = typedStatistics.currentUnknown(); |
333 | - previousMap = typedStatistics.previousUnknown(); | 333 | + previousMap = typedStatistics.previousUnknown(); |
334 | - | 334 | + |
335 | - List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap, | 335 | + List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap, |
336 | - isAllInstType, instType, TypedFlowEntryWithLoad.avgPollInterval()); | 336 | + isAllInstType, instType, TypedFlowEntryWithLoad.avgPollInterval()); |
337 | - if (fel.size() > 0) { | 337 | + if (fel.size() > 0) { |
338 | - retTfel.addAll(fel); | 338 | + retTfel.addAll(fel); |
339 | - } | 339 | + } |
340 | - } | 340 | + } |
341 | - | 341 | + |
342 | - return retTfel; | 342 | + return retTfel; |
343 | - } | 343 | + } |
344 | - | 344 | + |
345 | - private List<TypedFlowEntryWithLoad> typedFlowEntryLoadByInstInternal(ConnectPoint cp, | 345 | + private List<TypedFlowEntryWithLoad> typedFlowEntryLoadByInstInternal(ConnectPoint cp, |
346 | - Map<FlowRule, TypedStoredFlowEntry> currentMap, | 346 | + Map<FlowRule, TypedStoredFlowEntry> currentMap, |
347 | - Map<FlowRule, TypedStoredFlowEntry> previousMap, | 347 | + Map<FlowRule, TypedStoredFlowEntry> previousMap, |
348 | - boolean isAllInstType, | 348 | + boolean isAllInstType, |
349 | - Instruction.Type instType, | 349 | + Instruction.Type instType, |
350 | - int liveTypePollInterval) { | 350 | + int liveTypePollInterval) { |
351 | - List<TypedFlowEntryWithLoad> fel = new ArrayList<>(); | 351 | + List<TypedFlowEntryWithLoad> fel = new ArrayList<>(); |
352 | - | 352 | + |
353 | - for (TypedStoredFlowEntry tfe : currentMap.values()) { | 353 | + for (TypedStoredFlowEntry tfe : currentMap.values()) { |
354 | - if (isAllInstType || | 354 | + if (isAllInstType || |
355 | - tfe.treatment().allInstructions().stream(). | 355 | + tfe.treatment().allInstructions().stream(). |
356 | - filter(i -> i.type() == instType). | 356 | + filter(i -> i.type() == instType). |
357 | - findAny().isPresent()) { | 357 | + findAny().isPresent()) { |
358 | - long currentBytes = tfe.bytes(); | 358 | + long currentBytes = tfe.bytes(); |
359 | - long previousBytes = previousMap.getOrDefault(tfe, new DefaultTypedFlowEntry((FlowRule) tfe)).bytes(); | 359 | + long previousBytes = previousMap.getOrDefault(tfe, new DefaultTypedFlowEntry((FlowRule) tfe)).bytes(); |
360 | - Load fLoad = new DefaultLoad(currentBytes, previousBytes, liveTypePollInterval); | 360 | + Load fLoad = new DefaultLoad(currentBytes, previousBytes, liveTypePollInterval); |
361 | - fel.add(new TypedFlowEntryWithLoad(cp, tfe, fLoad)); | 361 | + fel.add(new TypedFlowEntryWithLoad(cp, tfe, fLoad)); |
362 | - } | 362 | + } |
363 | - } | 363 | + } |
364 | - | 364 | + |
365 | - return fel; | 365 | + return fel; |
366 | - } | 366 | + } |
367 | - | 367 | + |
368 | - private List<TypedFlowEntryWithLoad> loadTopnPortInternal(ConnectPoint cp, | 368 | + private List<TypedFlowEntryWithLoad> loadTopnPortInternal(ConnectPoint cp, |
369 | - TypedStoredFlowEntry.FlowLiveType liveType, | 369 | + TypedStoredFlowEntry.FlowLiveType liveType, |
370 | - Instruction.Type instType, | 370 | + Instruction.Type instType, |
371 | - int topn) { | 371 | + int topn) { |
372 | - List<TypedFlowEntryWithLoad> fel = loadAllPortInternal(cp, liveType, instType); | 372 | + List<TypedFlowEntryWithLoad> fel = loadAllPortInternal(cp, liveType, instType); |
373 | - | 373 | + |
374 | - // Sort with descending order of load | 374 | + // Sort with descending order of load |
375 | - List<TypedFlowEntryWithLoad> tfel = | 375 | + List<TypedFlowEntryWithLoad> tfel = |
376 | - fel.stream().sorted(Comparators.TYPEFLOWENTRY_WITHLOAD_COMPARATOR). | 376 | + fel.stream().sorted(Comparators.TYPEFLOWENTRY_WITHLOAD_COMPARATOR). |
377 | - limit(topn).collect(Collectors.toList()); | 377 | + limit(topn).collect(Collectors.toList()); |
378 | - | 378 | + |
379 | - return tfel; | 379 | + return tfel; |
380 | - } | 380 | + } |
381 | - | 381 | + |
382 | - private long aggregateBytesSet(Set<FlowEntry> setFE) { | 382 | + private long aggregateBytesSet(Set<FlowEntry> setFE) { |
383 | - return setFE.stream().mapToLong(FlowEntry::bytes).sum(); | 383 | + return setFE.stream().mapToLong(FlowEntry::bytes).sum(); |
384 | - } | 384 | + } |
385 | - | 385 | + |
386 | - private long aggregateBytesMap(Map<FlowRule, TypedStoredFlowEntry> mapFE) { | 386 | + private long aggregateBytesMap(Map<FlowRule, TypedStoredFlowEntry> mapFE) { |
387 | - return mapFE.values().stream().mapToLong(FlowEntry::bytes).sum(); | 387 | + return mapFE.values().stream().mapToLong(FlowEntry::bytes).sum(); |
388 | - } | 388 | + } |
389 | - | 389 | + |
390 | - /** | 390 | + /** |
391 | - * Internal data class holding two set of typed flow entries. | 391 | + * Internal data class holding two set of typed flow entries. |
392 | - */ | 392 | + */ |
393 | - private static class TypedStatistics { | 393 | + private static class TypedStatistics { |
394 | - private final ImmutableSet<FlowEntry> currentAll; | 394 | + private final ImmutableSet<FlowEntry> currentAll; |
395 | - private final ImmutableSet<FlowEntry> previousAll; | 395 | + private final ImmutableSet<FlowEntry> previousAll; |
396 | - | 396 | + |
397 | - private final Map<FlowRule, TypedStoredFlowEntry> currentImmediate = new HashMap<>(); | 397 | + private final Map<FlowRule, TypedStoredFlowEntry> currentImmediate = new HashMap<>(); |
398 | - private final Map<FlowRule, TypedStoredFlowEntry> previousImmediate = new HashMap<>(); | 398 | + private final Map<FlowRule, TypedStoredFlowEntry> previousImmediate = new HashMap<>(); |
399 | - | 399 | + |
400 | - private final Map<FlowRule, TypedStoredFlowEntry> currentShort = new HashMap<>(); | 400 | + private final Map<FlowRule, TypedStoredFlowEntry> currentShort = new HashMap<>(); |
401 | - private final Map<FlowRule, TypedStoredFlowEntry> previousShort = new HashMap<>(); | 401 | + private final Map<FlowRule, TypedStoredFlowEntry> previousShort = new HashMap<>(); |
402 | - | 402 | + |
403 | - private final Map<FlowRule, TypedStoredFlowEntry> currentMid = new HashMap<>(); | 403 | + private final Map<FlowRule, TypedStoredFlowEntry> currentMid = new HashMap<>(); |
404 | - private final Map<FlowRule, TypedStoredFlowEntry> previousMid = new HashMap<>(); | 404 | + private final Map<FlowRule, TypedStoredFlowEntry> previousMid = new HashMap<>(); |
405 | - | 405 | + |
406 | - private final Map<FlowRule, TypedStoredFlowEntry> currentLong = new HashMap<>(); | 406 | + private final Map<FlowRule, TypedStoredFlowEntry> currentLong = new HashMap<>(); |
407 | - private final Map<FlowRule, TypedStoredFlowEntry> previousLong = new HashMap<>(); | 407 | + private final Map<FlowRule, TypedStoredFlowEntry> previousLong = new HashMap<>(); |
408 | - | 408 | + |
409 | - private final Map<FlowRule, TypedStoredFlowEntry> currentUnknown = new HashMap<>(); | 409 | + private final Map<FlowRule, TypedStoredFlowEntry> currentUnknown = new HashMap<>(); |
410 | - private final Map<FlowRule, TypedStoredFlowEntry> previousUnknown = new HashMap<>(); | 410 | + private final Map<FlowRule, TypedStoredFlowEntry> previousUnknown = new HashMap<>(); |
411 | - | 411 | + |
412 | - public TypedStatistics(Set<FlowEntry> current, Set<FlowEntry> previous) { | 412 | + public TypedStatistics(Set<FlowEntry> current, Set<FlowEntry> previous) { |
413 | - this.currentAll = ImmutableSet.copyOf(checkNotNull(current)); | 413 | + this.currentAll = ImmutableSet.copyOf(checkNotNull(current)); |
414 | - this.previousAll = ImmutableSet.copyOf(checkNotNull(previous)); | 414 | + this.previousAll = ImmutableSet.copyOf(checkNotNull(previous)); |
415 | - | 415 | + |
416 | - currentAll.forEach(fe -> { | 416 | + currentAll.forEach(fe -> { |
417 | - TypedStoredFlowEntry tfe = TypedFlowEntryWithLoad.newTypedStoredFlowEntry(fe); | 417 | + TypedStoredFlowEntry tfe = TypedFlowEntryWithLoad.newTypedStoredFlowEntry(fe); |
418 | - | 418 | + |
419 | - switch (tfe.flowLiveType()) { | 419 | + switch (tfe.flowLiveType()) { |
420 | - case IMMEDIATE_FLOW: | 420 | + case IMMEDIATE_FLOW: |
421 | - currentImmediate.put(fe, tfe); | 421 | + currentImmediate.put(fe, tfe); |
422 | - break; | 422 | + break; |
423 | - case SHORT_FLOW: | 423 | + case SHORT_FLOW: |
424 | - currentShort.put(fe, tfe); | 424 | + currentShort.put(fe, tfe); |
425 | - break; | 425 | + break; |
426 | - case MID_FLOW: | 426 | + case MID_FLOW: |
427 | - currentMid.put(fe, tfe); | 427 | + currentMid.put(fe, tfe); |
428 | - break; | 428 | + break; |
429 | - case LONG_FLOW: | 429 | + case LONG_FLOW: |
430 | - currentLong.put(fe, tfe); | 430 | + currentLong.put(fe, tfe); |
431 | - break; | 431 | + break; |
432 | - default: | 432 | + default: |
433 | - currentUnknown.put(fe, tfe); | 433 | + currentUnknown.put(fe, tfe); |
434 | - break; | 434 | + break; |
435 | - } | 435 | + } |
436 | - }); | 436 | + }); |
437 | - | 437 | + |
438 | - previousAll.forEach(fe -> { | 438 | + previousAll.forEach(fe -> { |
439 | - TypedStoredFlowEntry tfe = TypedFlowEntryWithLoad.newTypedStoredFlowEntry(fe); | 439 | + TypedStoredFlowEntry tfe = TypedFlowEntryWithLoad.newTypedStoredFlowEntry(fe); |
440 | - | 440 | + |
441 | - switch (tfe.flowLiveType()) { | 441 | + switch (tfe.flowLiveType()) { |
442 | - case IMMEDIATE_FLOW: | 442 | + case IMMEDIATE_FLOW: |
443 | - if (currentImmediate.containsKey(fe)) { | 443 | + if (currentImmediate.containsKey(fe)) { |
444 | - previousImmediate.put(fe, tfe); | 444 | + previousImmediate.put(fe, tfe); |
445 | - } else if (currentShort.containsKey(fe)) { | 445 | + } else if (currentShort.containsKey(fe)) { |
446 | - previousShort.put(fe, tfe); | 446 | + previousShort.put(fe, tfe); |
447 | - } else if (currentMid.containsKey(fe)) { | 447 | + } else if (currentMid.containsKey(fe)) { |
448 | - previousMid.put(fe, tfe); | 448 | + previousMid.put(fe, tfe); |
449 | - } else if (currentLong.containsKey(fe)) { | 449 | + } else if (currentLong.containsKey(fe)) { |
450 | - previousLong.put(fe, tfe); | 450 | + previousLong.put(fe, tfe); |
451 | - } else { | 451 | + } else { |
452 | - previousUnknown.put(fe, tfe); | 452 | + previousUnknown.put(fe, tfe); |
453 | - } | 453 | + } |
454 | - break; | 454 | + break; |
455 | - case SHORT_FLOW: | 455 | + case SHORT_FLOW: |
456 | - if (currentShort.containsKey(fe)) { | 456 | + if (currentShort.containsKey(fe)) { |
457 | - previousShort.put(fe, tfe); | 457 | + previousShort.put(fe, tfe); |
458 | - } else if (currentMid.containsKey(fe)) { | 458 | + } else if (currentMid.containsKey(fe)) { |
459 | - previousMid.put(fe, tfe); | 459 | + previousMid.put(fe, tfe); |
460 | - } else if (currentLong.containsKey(fe)) { | 460 | + } else if (currentLong.containsKey(fe)) { |
461 | - previousLong.put(fe, tfe); | 461 | + previousLong.put(fe, tfe); |
462 | - } else { | 462 | + } else { |
463 | - previousUnknown.put(fe, tfe); | 463 | + previousUnknown.put(fe, tfe); |
464 | - } | 464 | + } |
465 | - break; | 465 | + break; |
466 | - case MID_FLOW: | 466 | + case MID_FLOW: |
467 | - if (currentMid.containsKey(fe)) { | 467 | + if (currentMid.containsKey(fe)) { |
468 | - previousMid.put(fe, tfe); | 468 | + previousMid.put(fe, tfe); |
469 | - } else if (currentLong.containsKey(fe)) { | 469 | + } else if (currentLong.containsKey(fe)) { |
470 | - previousLong.put(fe, tfe); | 470 | + previousLong.put(fe, tfe); |
471 | - } else { | 471 | + } else { |
472 | - previousUnknown.put(fe, tfe); | 472 | + previousUnknown.put(fe, tfe); |
473 | - } | 473 | + } |
474 | - break; | 474 | + break; |
475 | - case LONG_FLOW: | 475 | + case LONG_FLOW: |
476 | - if (currentLong.containsKey(fe)) { | 476 | + if (currentLong.containsKey(fe)) { |
477 | - previousLong.put(fe, tfe); | 477 | + previousLong.put(fe, tfe); |
478 | - } else { | 478 | + } else { |
479 | - previousUnknown.put(fe, tfe); | 479 | + previousUnknown.put(fe, tfe); |
480 | - } | 480 | + } |
481 | - break; | 481 | + break; |
482 | - default: | 482 | + default: |
483 | - previousUnknown.put(fe, tfe); | 483 | + previousUnknown.put(fe, tfe); |
484 | - break; | 484 | + break; |
485 | - } | 485 | + } |
486 | - }); | 486 | + }); |
487 | - } | 487 | + } |
488 | - | 488 | + |
489 | - /** | 489 | + /** |
490 | - * Returns flow entries as the current value. | 490 | + * Returns flow entries as the current value. |
491 | - * | 491 | + * |
492 | - * @return flow entries as the current value | 492 | + * @return flow entries as the current value |
493 | - */ | 493 | + */ |
494 | - public ImmutableSet<FlowEntry> current() { | 494 | + public ImmutableSet<FlowEntry> current() { |
495 | - return currentAll; | 495 | + return currentAll; |
496 | - } | 496 | + } |
497 | - | 497 | + |
498 | - /** | 498 | + /** |
499 | - * Returns flow entries as the previous value. | 499 | + * Returns flow entries as the previous value. |
500 | - * | 500 | + * |
501 | - * @return flow entries as the previous value | 501 | + * @return flow entries as the previous value |
502 | - */ | 502 | + */ |
503 | - public ImmutableSet<FlowEntry> previous() { | 503 | + public ImmutableSet<FlowEntry> previous() { |
504 | - return previousAll; | 504 | + return previousAll; |
505 | - } | 505 | + } |
506 | - | 506 | + |
507 | - public Map<FlowRule, TypedStoredFlowEntry> currentImmediate() { | 507 | + public Map<FlowRule, TypedStoredFlowEntry> currentImmediate() { |
508 | - return currentImmediate; | 508 | + return currentImmediate; |
509 | - } | 509 | + } |
510 | - public Map<FlowRule, TypedStoredFlowEntry> previousImmediate() { | 510 | + public Map<FlowRule, TypedStoredFlowEntry> previousImmediate() { |
511 | - return previousImmediate; | 511 | + return previousImmediate; |
512 | - } | 512 | + } |
513 | - public Map<FlowRule, TypedStoredFlowEntry> currentShort() { | 513 | + public Map<FlowRule, TypedStoredFlowEntry> currentShort() { |
514 | - return currentShort; | 514 | + return currentShort; |
515 | - } | 515 | + } |
516 | - public Map<FlowRule, TypedStoredFlowEntry> previousShort() { | 516 | + public Map<FlowRule, TypedStoredFlowEntry> previousShort() { |
517 | - return previousShort; | 517 | + return previousShort; |
518 | - } | 518 | + } |
519 | - public Map<FlowRule, TypedStoredFlowEntry> currentMid() { | 519 | + public Map<FlowRule, TypedStoredFlowEntry> currentMid() { |
520 | - return currentMid; | 520 | + return currentMid; |
521 | - } | 521 | + } |
522 | - public Map<FlowRule, TypedStoredFlowEntry> previousMid() { | 522 | + public Map<FlowRule, TypedStoredFlowEntry> previousMid() { |
523 | - return previousMid; | 523 | + return previousMid; |
524 | - } | 524 | + } |
525 | - public Map<FlowRule, TypedStoredFlowEntry> currentLong() { | 525 | + public Map<FlowRule, TypedStoredFlowEntry> currentLong() { |
526 | - return currentLong; | 526 | + return currentLong; |
527 | - } | 527 | + } |
528 | - public Map<FlowRule, TypedStoredFlowEntry> previousLong() { | 528 | + public Map<FlowRule, TypedStoredFlowEntry> previousLong() { |
529 | - return previousLong; | 529 | + return previousLong; |
530 | - } | 530 | + } |
531 | - public Map<FlowRule, TypedStoredFlowEntry> currentUnknown() { | 531 | + public Map<FlowRule, TypedStoredFlowEntry> currentUnknown() { |
532 | - return currentUnknown; | 532 | + return currentUnknown; |
533 | - } | 533 | + } |
534 | - public Map<FlowRule, TypedStoredFlowEntry> previousUnknown() { | 534 | + public Map<FlowRule, TypedStoredFlowEntry> previousUnknown() { |
535 | - return previousUnknown; | 535 | + return previousUnknown; |
536 | - } | 536 | + } |
537 | - | 537 | + |
538 | - /** | 538 | + /** |
539 | - * Validates values are not empty. | 539 | + * Validates values are not empty. |
540 | - * | 540 | + * |
541 | - * @return false if either of the sets is empty. Otherwise, true. | 541 | + * @return false if either of the sets is empty. Otherwise, true. |
542 | - */ | 542 | + */ |
543 | - public boolean isValid() { | 543 | + public boolean isValid() { |
544 | - return !(currentAll.isEmpty() || previousAll.isEmpty()); | 544 | + return !(currentAll.isEmpty() || previousAll.isEmpty()); |
545 | - } | 545 | + } |
546 | - | 546 | + |
547 | - @Override | 547 | + @Override |
548 | - public int hashCode() { | 548 | + public int hashCode() { |
549 | - return Objects.hash(currentAll, previousAll); | 549 | + return Objects.hash(currentAll, previousAll); |
550 | - } | 550 | + } |
551 | - | 551 | + |
552 | - @Override | 552 | + @Override |
553 | - public boolean equals(Object obj) { | 553 | + public boolean equals(Object obj) { |
554 | - if (this == obj) { | 554 | + if (this == obj) { |
555 | - return true; | 555 | + return true; |
556 | - } | 556 | + } |
557 | - if (!(obj instanceof TypedStatistics)) { | 557 | + if (!(obj instanceof TypedStatistics)) { |
558 | - return false; | 558 | + return false; |
559 | - } | 559 | + } |
560 | - final TypedStatistics other = (TypedStatistics) obj; | 560 | + final TypedStatistics other = (TypedStatistics) obj; |
561 | - return Objects.equals(this.currentAll, other.currentAll) && | 561 | + return Objects.equals(this.currentAll, other.currentAll) && |
562 | - Objects.equals(this.previousAll, other.previousAll); | 562 | + Objects.equals(this.previousAll, other.previousAll); |
563 | - } | 563 | + } |
564 | - | 564 | + |
565 | - @Override | 565 | + @Override |
566 | - public String toString() { | 566 | + public String toString() { |
567 | - return MoreObjects.toStringHelper(this) | 567 | + return MoreObjects.toStringHelper(this) |
568 | - .add("current", currentAll) | 568 | + .add("current", currentAll) |
569 | - .add("previous", previousAll) | 569 | + .add("previous", previousAll) |
570 | - .toString(); | 570 | + .toString(); |
571 | - } | 571 | + } |
572 | - } | 572 | + } |
573 | - | 573 | + |
574 | - private void checkLoadValidity(Set<FlowEntry> current, Set<FlowEntry> previous) { | 574 | + private void checkLoadValidity(Set<FlowEntry> current, Set<FlowEntry> previous) { |
575 | - current.stream().forEach(c -> { | 575 | + current.stream().forEach(c -> { |
576 | - FlowEntry f = previous.stream().filter(p -> c.equals(p)). | 576 | + FlowEntry f = previous.stream().filter(p -> c.equals(p)). |
577 | - findAny().orElse(null); | 577 | + findAny().orElse(null); |
578 | - if (f != null && c.bytes() < f.bytes()) { | 578 | + if (f != null && c.bytes() < f.bytes()) { |
579 | - log.debug("FlowStatisticManager:checkLoadValidity():" + | 579 | + log.debug("FlowStatisticManager:checkLoadValidity():" + |
580 | - "Error: " + c + " :Previous bytes=" + f.bytes() + | 580 | + "Error: " + c + " :Previous bytes=" + f.bytes() + |
581 | - " is larger than current bytes=" + c.bytes() + " !!!"); | 581 | + " is larger than current bytes=" + c.bytes() + " !!!"); |
582 | - } | 582 | + } |
583 | - }); | 583 | + }); |
584 | - | 584 | + |
585 | - } | 585 | + } |
586 | - | 586 | + |
587 | - /** | 587 | + /** |
588 | - * Creates a predicate that checks the instruction type of a flow entry is the same as | 588 | + * Creates a predicate that checks the instruction type of a flow entry is the same as |
589 | - * the specified instruction type. | 589 | + * the specified instruction type. |
590 | - * | 590 | + * |
591 | - * @param instType instruction type to be checked | 591 | + * @param instType instruction type to be checked |
592 | - * @return predicate | 592 | + * @return predicate |
593 | - */ | 593 | + */ |
594 | - private static Predicate<FlowEntry> hasInstructionType(Instruction.Type instType) { | 594 | + private static Predicate<FlowEntry> hasInstructionType(Instruction.Type instType) { |
595 | - return new Predicate<FlowEntry>() { | 595 | + return new Predicate<FlowEntry>() { |
596 | - @Override | 596 | + @Override |
597 | - public boolean apply(FlowEntry flowEntry) { | 597 | + public boolean apply(FlowEntry flowEntry) { |
598 | - List<Instruction> allInstructions = flowEntry.treatment().allInstructions(); | 598 | + List<Instruction> allInstructions = flowEntry.treatment().allInstructions(); |
599 | - | 599 | + |
600 | - return allInstructions.stream().filter(i -> i.type() == instType).findAny().isPresent(); | 600 | + return allInstructions.stream().filter(i -> i.type() == instType).findAny().isPresent(); |
601 | - } | 601 | + } |
602 | - }; | 602 | + }; |
603 | - } | 603 | + } |
604 | - | 604 | + |
605 | - /** | 605 | + /** |
606 | - * Internal flow rule event listener for FlowStatisticManager. | 606 | + * Internal flow rule event listener for FlowStatisticManager. |
607 | - */ | 607 | + */ |
608 | - private class InternalFlowRuleStatsListener implements FlowRuleListener { | 608 | + private class InternalFlowRuleStatsListener implements FlowRuleListener { |
609 | - | 609 | + |
610 | - @Override | 610 | + @Override |
611 | - public void event(FlowRuleEvent event) { | 611 | + public void event(FlowRuleEvent event) { |
612 | - FlowRule rule = event.subject(); | 612 | + FlowRule rule = event.subject(); |
613 | - switch (event.type()) { | 613 | + switch (event.type()) { |
614 | - case RULE_ADDED: | 614 | + case RULE_ADDED: |
615 | - if (rule instanceof FlowEntry) { | 615 | + if (rule instanceof FlowEntry) { |
616 | - flowStatisticStore.addFlowStatistic((FlowEntry) rule); | 616 | + flowStatisticStore.addFlowStatistic((FlowEntry) rule); |
617 | - } | 617 | + } |
618 | - break; | 618 | + break; |
619 | - case RULE_UPDATED: | 619 | + case RULE_UPDATED: |
620 | - flowStatisticStore.updateFlowStatistic((FlowEntry) rule); | 620 | + flowStatisticStore.updateFlowStatistic((FlowEntry) rule); |
621 | - break; | 621 | + break; |
622 | - case RULE_ADD_REQUESTED: | 622 | + case RULE_ADD_REQUESTED: |
623 | - break; | 623 | + break; |
624 | - case RULE_REMOVE_REQUESTED: | 624 | + case RULE_REMOVE_REQUESTED: |
625 | - break; | 625 | + break; |
626 | - case RULE_REMOVED: | 626 | + case RULE_REMOVED: |
627 | - flowStatisticStore.removeFlowStatistic(rule); | 627 | + flowStatisticStore.removeFlowStatistic(rule); |
628 | - break; | 628 | + break; |
629 | - default: | 629 | + default: |
630 | - log.warn("Unknown flow rule event {}", event); | 630 | + log.warn("Unknown flow rule event {}", event); |
631 | - } | 631 | + } |
632 | - } | 632 | + } |
633 | - } | 633 | + } |
634 | -} | 634 | +} | ... | ... |
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 | - | 16 | + |
17 | -package org.onosproject.store.statistic.impl; | 17 | +package org.onosproject.store.statistic.impl; |
18 | - | 18 | + |
19 | -import com.google.common.base.Objects; | 19 | +import com.google.common.base.Objects; |
20 | -import org.apache.felix.scr.annotations.Activate; | 20 | +import org.apache.felix.scr.annotations.Activate; |
21 | -import org.apache.felix.scr.annotations.Component; | 21 | +import org.apache.felix.scr.annotations.Component; |
22 | -import org.apache.felix.scr.annotations.Deactivate; | 22 | +import org.apache.felix.scr.annotations.Deactivate; |
23 | -import org.apache.felix.scr.annotations.Reference; | 23 | +import org.apache.felix.scr.annotations.Reference; |
24 | -import org.apache.felix.scr.annotations.ReferenceCardinality; | 24 | +import org.apache.felix.scr.annotations.ReferenceCardinality; |
25 | -import org.apache.felix.scr.annotations.Service; | 25 | +import org.apache.felix.scr.annotations.Service; |
26 | -import org.onlab.util.KryoNamespace; | 26 | +import org.onlab.util.KryoNamespace; |
27 | -import org.onlab.util.Tools; | 27 | +import org.onlab.util.Tools; |
28 | -import org.onosproject.cluster.ClusterService; | 28 | +import org.onosproject.cluster.ClusterService; |
29 | -import org.onosproject.cluster.NodeId; | 29 | +import org.onosproject.cluster.NodeId; |
30 | -import org.onosproject.mastership.MastershipService; | 30 | +import org.onosproject.mastership.MastershipService; |
31 | -import org.onosproject.net.ConnectPoint; | 31 | +import org.onosproject.net.ConnectPoint; |
32 | -import org.onosproject.net.DeviceId; | 32 | +import org.onosproject.net.DeviceId; |
33 | -import org.onosproject.net.PortNumber; | 33 | +import org.onosproject.net.PortNumber; |
34 | -import org.onosproject.net.flow.FlowEntry; | 34 | +import org.onosproject.net.flow.FlowEntry; |
35 | -import org.onosproject.net.flow.FlowRule; | 35 | +import org.onosproject.net.flow.FlowRule; |
36 | -import org.onosproject.net.flow.instructions.Instruction; | 36 | +import org.onosproject.net.flow.instructions.Instruction; |
37 | -import org.onosproject.net.flow.instructions.Instructions; | 37 | +import org.onosproject.net.flow.instructions.Instructions; |
38 | -import org.onosproject.net.statistic.FlowStatisticStore; | 38 | +import org.onosproject.net.statistic.FlowStatisticStore; |
39 | -import org.onosproject.store.cluster.messaging.ClusterCommunicationService; | 39 | +import org.onosproject.store.cluster.messaging.ClusterCommunicationService; |
40 | -import org.onosproject.store.serializers.KryoNamespaces; | 40 | +import org.onosproject.store.serializers.KryoNamespaces; |
41 | -import org.onosproject.store.serializers.KryoSerializer; | 41 | +import org.onosproject.store.serializers.KryoSerializer; |
42 | -import org.slf4j.Logger; | 42 | +import org.slf4j.Logger; |
43 | - | 43 | + |
44 | -import java.util.Collections; | 44 | +import java.util.Collections; |
45 | -import java.util.HashSet; | 45 | +import java.util.HashSet; |
46 | -import java.util.Map; | 46 | +import java.util.Map; |
47 | -import java.util.Optional; | 47 | +import java.util.Optional; |
48 | -import java.util.Set; | 48 | +import java.util.Set; |
49 | -import java.util.concurrent.ConcurrentHashMap; | 49 | +import java.util.concurrent.ConcurrentHashMap; |
50 | -import java.util.concurrent.ExecutorService; | 50 | +import java.util.concurrent.ExecutorService; |
51 | -import java.util.concurrent.Executors; | 51 | +import java.util.concurrent.Executors; |
52 | -import java.util.concurrent.TimeUnit; | 52 | +import java.util.concurrent.TimeUnit; |
53 | - | 53 | + |
54 | -import static org.onlab.util.Tools.groupedThreads; | 54 | +import static org.onlab.util.Tools.groupedThreads; |
55 | -import static org.onosproject.store.statistic.impl.StatisticStoreMessageSubjects.GET_CURRENT; | 55 | +import static org.onosproject.store.statistic.impl.StatisticStoreMessageSubjects.GET_CURRENT; |
56 | -import static org.onosproject.store.statistic.impl.StatisticStoreMessageSubjects.GET_PREVIOUS; | 56 | +import static org.onosproject.store.statistic.impl.StatisticStoreMessageSubjects.GET_PREVIOUS; |
57 | -import static org.slf4j.LoggerFactory.getLogger; | 57 | +import static org.slf4j.LoggerFactory.getLogger; |
58 | - | 58 | + |
59 | -/** | 59 | +/** |
60 | - * Maintains flow statistics using RPC calls to collect stats from remote instances | 60 | + * Maintains flow statistics using RPC calls to collect stats from remote instances |
61 | - * on demand. | 61 | + * on demand. |
62 | - */ | 62 | + */ |
63 | -@Component(immediate = true) | 63 | +@Component(immediate = true) |
64 | -@Service | 64 | +@Service |
65 | -public class DistributedFlowStatisticStore implements FlowStatisticStore { | 65 | +public class DistributedFlowStatisticStore implements FlowStatisticStore { |
66 | - private final Logger log = getLogger(getClass()); | 66 | + private final Logger log = getLogger(getClass()); |
67 | - | 67 | + |
68 | - // TODO: Make configurable. | 68 | + // TODO: Make configurable. |
69 | - private static final int MESSAGE_HANDLER_THREAD_POOL_SIZE = 4; | 69 | + private static final int MESSAGE_HANDLER_THREAD_POOL_SIZE = 4; |
70 | - | 70 | + |
71 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 71 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
72 | - protected MastershipService mastershipService; | 72 | + protected MastershipService mastershipService; |
73 | - | 73 | + |
74 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 74 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
75 | - protected ClusterCommunicationService clusterCommunicator; | 75 | + protected ClusterCommunicationService clusterCommunicator; |
76 | - | 76 | + |
77 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 77 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
78 | - protected ClusterService clusterService; | 78 | + protected ClusterService clusterService; |
79 | - | 79 | + |
80 | - private Map<ConnectPoint, Set<FlowEntry>> previous = | 80 | + private Map<ConnectPoint, Set<FlowEntry>> previous = |
81 | - new ConcurrentHashMap<>(); | 81 | + new ConcurrentHashMap<>(); |
82 | - | 82 | + |
83 | - private Map<ConnectPoint, Set<FlowEntry>> current = | 83 | + private Map<ConnectPoint, Set<FlowEntry>> current = |
84 | - new ConcurrentHashMap<>(); | 84 | + new ConcurrentHashMap<>(); |
85 | - | 85 | + |
86 | - protected static final KryoSerializer SERIALIZER = new KryoSerializer() { | 86 | + protected static final KryoSerializer SERIALIZER = new KryoSerializer() { |
87 | - @Override | 87 | + @Override |
88 | - protected void setupKryoPool() { | 88 | + protected void setupKryoPool() { |
89 | - serializerPool = KryoNamespace.newBuilder() | 89 | + serializerPool = KryoNamespace.newBuilder() |
90 | - .register(KryoNamespaces.API) | 90 | + .register(KryoNamespaces.API) |
91 | - .nextId(KryoNamespaces.BEGIN_USER_CUSTOM_ID) | 91 | + .nextId(KryoNamespaces.BEGIN_USER_CUSTOM_ID) |
92 | - // register this store specific classes here | 92 | + // register this store specific classes here |
93 | - .build(); | 93 | + .build(); |
94 | - } | 94 | + } |
95 | - }; | 95 | + }; |
96 | - | 96 | + |
97 | - private NodeId local; | 97 | + private NodeId local; |
98 | - private ExecutorService messageHandlingExecutor; | 98 | + private ExecutorService messageHandlingExecutor; |
99 | - | 99 | + |
100 | - private static final long STATISTIC_STORE_TIMEOUT_MILLIS = 3000; | 100 | + private static final long STATISTIC_STORE_TIMEOUT_MILLIS = 3000; |
101 | - | 101 | + |
102 | - @Activate | 102 | + @Activate |
103 | - public void activate() { | 103 | + public void activate() { |
104 | - local = clusterService.getLocalNode().id(); | 104 | + local = clusterService.getLocalNode().id(); |
105 | - | 105 | + |
106 | - messageHandlingExecutor = Executors.newFixedThreadPool( | 106 | + messageHandlingExecutor = Executors.newFixedThreadPool( |
107 | - MESSAGE_HANDLER_THREAD_POOL_SIZE, | 107 | + MESSAGE_HANDLER_THREAD_POOL_SIZE, |
108 | - groupedThreads("onos/store/statistic", "message-handlers")); | 108 | + groupedThreads("onos/store/statistic", "message-handlers")); |
109 | - | 109 | + |
110 | - clusterCommunicator.addSubscriber( | 110 | + clusterCommunicator.addSubscriber( |
111 | - GET_CURRENT, SERIALIZER::decode, this::getCurrentStatisticInternal, SERIALIZER::encode, | 111 | + GET_CURRENT, SERIALIZER::decode, this::getCurrentStatisticInternal, SERIALIZER::encode, |
112 | - messageHandlingExecutor); | 112 | + messageHandlingExecutor); |
113 | - | 113 | + |
114 | - clusterCommunicator.addSubscriber( | 114 | + clusterCommunicator.addSubscriber( |
115 | - GET_CURRENT, SERIALIZER::decode, this::getPreviousStatisticInternal, SERIALIZER::encode, | 115 | + GET_CURRENT, SERIALIZER::decode, this::getPreviousStatisticInternal, SERIALIZER::encode, |
116 | - messageHandlingExecutor); | 116 | + messageHandlingExecutor); |
117 | - | 117 | + |
118 | - log.info("Started"); | 118 | + log.info("Started"); |
119 | - } | 119 | + } |
120 | - | 120 | + |
121 | - @Deactivate | 121 | + @Deactivate |
122 | - public void deactivate() { | 122 | + public void deactivate() { |
123 | - clusterCommunicator.removeSubscriber(GET_PREVIOUS); | 123 | + clusterCommunicator.removeSubscriber(GET_PREVIOUS); |
124 | - clusterCommunicator.removeSubscriber(GET_CURRENT); | 124 | + clusterCommunicator.removeSubscriber(GET_CURRENT); |
125 | - messageHandlingExecutor.shutdown(); | 125 | + messageHandlingExecutor.shutdown(); |
126 | - log.info("Stopped"); | 126 | + log.info("Stopped"); |
127 | - } | 127 | + } |
128 | - | 128 | + |
129 | - @Override | 129 | + @Override |
130 | - public synchronized void removeFlowStatistic(FlowRule rule) { | 130 | + public synchronized void removeFlowStatistic(FlowRule rule) { |
131 | - ConnectPoint cp = buildConnectPoint(rule); | 131 | + ConnectPoint cp = buildConnectPoint(rule); |
132 | - if (cp == null) { | 132 | + if (cp == null) { |
133 | - return; | 133 | + return; |
134 | - } | 134 | + } |
135 | - | 135 | + |
136 | - // remove this rule if present from current map | 136 | + // remove this rule if present from current map |
137 | - current.computeIfPresent(cp, (c, e) -> { e.remove(rule); return e; }); | 137 | + current.computeIfPresent(cp, (c, e) -> { e.remove(rule); return e; }); |
138 | - | 138 | + |
139 | - // remove this on if present from previous map | 139 | + // remove this on if present from previous map |
140 | - previous.computeIfPresent(cp, (c, e) -> { e.remove(rule); return e; }); | 140 | + previous.computeIfPresent(cp, (c, e) -> { e.remove(rule); return e; }); |
141 | - } | 141 | + } |
142 | - | 142 | + |
143 | - @Override | 143 | + @Override |
144 | - public synchronized void addFlowStatistic(FlowEntry rule) { | 144 | + public synchronized void addFlowStatistic(FlowEntry rule) { |
145 | - ConnectPoint cp = buildConnectPoint(rule); | 145 | + ConnectPoint cp = buildConnectPoint(rule); |
146 | - if (cp == null) { | 146 | + if (cp == null) { |
147 | - return; | 147 | + return; |
148 | - } | 148 | + } |
149 | - | 149 | + |
150 | - // create one if absent and add this rule | 150 | + // create one if absent and add this rule |
151 | - current.putIfAbsent(cp, new HashSet<>()); | 151 | + current.putIfAbsent(cp, new HashSet<>()); |
152 | - current.computeIfPresent(cp, (c, e) -> { e.add(rule); return e; }); | 152 | + current.computeIfPresent(cp, (c, e) -> { e.add(rule); return e; }); |
153 | - | 153 | + |
154 | - // remove previous one if present | 154 | + // remove previous one if present |
155 | - previous.computeIfPresent(cp, (c, e) -> { e.remove(rule); return e; }); | 155 | + previous.computeIfPresent(cp, (c, e) -> { e.remove(rule); return e; }); |
156 | - } | 156 | + } |
157 | - | 157 | + |
158 | - public synchronized void updateFlowStatistic(FlowEntry rule) { | 158 | + public synchronized void updateFlowStatistic(FlowEntry rule) { |
159 | - ConnectPoint cp = buildConnectPoint(rule); | 159 | + ConnectPoint cp = buildConnectPoint(rule); |
160 | - if (cp == null) { | 160 | + if (cp == null) { |
161 | - return; | 161 | + return; |
162 | - } | 162 | + } |
163 | - | 163 | + |
164 | - Set<FlowEntry> curr = current.get(cp); | 164 | + Set<FlowEntry> curr = current.get(cp); |
165 | - if (curr == null) { | 165 | + if (curr == null) { |
166 | - addFlowStatistic(rule); | 166 | + addFlowStatistic(rule); |
167 | - } else { | 167 | + } else { |
168 | - Optional<FlowEntry> f = curr.stream().filter(c -> rule.equals(c)). | 168 | + Optional<FlowEntry> f = curr.stream().filter(c -> rule.equals(c)). |
169 | - findAny(); | 169 | + findAny(); |
170 | - if (f.isPresent() && rule.bytes() < f.get().bytes()) { | 170 | + if (f.isPresent() && rule.bytes() < f.get().bytes()) { |
171 | - log.debug("DistributedFlowStatisticStore:updateFlowStatistic():" + | 171 | + log.debug("DistributedFlowStatisticStore:updateFlowStatistic():" + |
172 | - " Invalid Flow Update! Will be removed!!" + | 172 | + " Invalid Flow Update! Will be removed!!" + |
173 | - " curr flowId=" + Long.toHexString(rule.id().value()) + | 173 | + " curr flowId=" + Long.toHexString(rule.id().value()) + |
174 | - ", prev flowId=" + Long.toHexString(f.get().id().value()) + | 174 | + ", prev flowId=" + Long.toHexString(f.get().id().value()) + |
175 | - ", curr bytes=" + rule.bytes() + ", prev bytes=" + f.get().bytes() + | 175 | + ", curr bytes=" + rule.bytes() + ", prev bytes=" + f.get().bytes() + |
176 | - ", curr life=" + rule.life() + ", prev life=" + f.get().life() + | 176 | + ", curr life=" + rule.life() + ", prev life=" + f.get().life() + |
177 | - ", curr lastSeen=" + rule.lastSeen() + ", prev lastSeen=" + f.get().lastSeen()); | 177 | + ", curr lastSeen=" + rule.lastSeen() + ", prev lastSeen=" + f.get().lastSeen()); |
178 | - // something is wrong! invalid flow entry, so delete it | 178 | + // something is wrong! invalid flow entry, so delete it |
179 | - removeFlowStatistic(rule); | 179 | + removeFlowStatistic(rule); |
180 | - return; | 180 | + return; |
181 | - } | 181 | + } |
182 | - Set<FlowEntry> prev = previous.get(cp); | 182 | + Set<FlowEntry> prev = previous.get(cp); |
183 | - if (prev == null) { | 183 | + if (prev == null) { |
184 | - prev = new HashSet<>(); | 184 | + prev = new HashSet<>(); |
185 | - previous.put(cp, prev); | 185 | + previous.put(cp, prev); |
186 | - } | 186 | + } |
187 | - | 187 | + |
188 | - // previous one is exist | 188 | + // previous one is exist |
189 | - if (f.isPresent()) { | 189 | + if (f.isPresent()) { |
190 | - // remove old one and add new one | 190 | + // remove old one and add new one |
191 | - prev.remove(rule); | 191 | + prev.remove(rule); |
192 | - if (!prev.add(f.get())) { | 192 | + if (!prev.add(f.get())) { |
193 | - log.debug("DistributedFlowStatisticStore:updateFlowStatistic():" + | 193 | + log.debug("DistributedFlowStatisticStore:updateFlowStatistic():" + |
194 | - " flowId={}, add failed into previous.", | 194 | + " flowId={}, add failed into previous.", |
195 | - Long.toHexString(rule.id().value())); | 195 | + Long.toHexString(rule.id().value())); |
196 | - } | 196 | + } |
197 | - } | 197 | + } |
198 | - | 198 | + |
199 | - // remove old one and add new one | 199 | + // remove old one and add new one |
200 | - curr.remove(rule); | 200 | + curr.remove(rule); |
201 | - if (!curr.add(rule)) { | 201 | + if (!curr.add(rule)) { |
202 | - log.debug("DistributedFlowStatisticStore:updateFlowStatistic():" + | 202 | + log.debug("DistributedFlowStatisticStore:updateFlowStatistic():" + |
203 | - " flowId={}, add failed into current.", | 203 | + " flowId={}, add failed into current.", |
204 | - Long.toHexString(rule.id().value())); | 204 | + Long.toHexString(rule.id().value())); |
205 | - } | 205 | + } |
206 | - } | 206 | + } |
207 | - } | 207 | + } |
208 | - | 208 | + |
209 | - @Override | 209 | + @Override |
210 | - public Set<FlowEntry> getCurrentFlowStatistic(ConnectPoint connectPoint) { | 210 | + public Set<FlowEntry> getCurrentFlowStatistic(ConnectPoint connectPoint) { |
211 | - final DeviceId deviceId = connectPoint.deviceId(); | 211 | + final DeviceId deviceId = connectPoint.deviceId(); |
212 | - | 212 | + |
213 | - NodeId master = mastershipService.getMasterFor(deviceId); | 213 | + NodeId master = mastershipService.getMasterFor(deviceId); |
214 | - if (master == null) { | 214 | + if (master == null) { |
215 | - log.warn("No master for {}", deviceId); | 215 | + log.warn("No master for {}", deviceId); |
216 | - return Collections.emptySet(); | 216 | + return Collections.emptySet(); |
217 | - } | 217 | + } |
218 | - | 218 | + |
219 | - if (Objects.equal(local, master)) { | 219 | + if (Objects.equal(local, master)) { |
220 | - return getCurrentStatisticInternal(connectPoint); | 220 | + return getCurrentStatisticInternal(connectPoint); |
221 | - } else { | 221 | + } else { |
222 | - return Tools.futureGetOrElse(clusterCommunicator.sendAndReceive( | 222 | + return Tools.futureGetOrElse(clusterCommunicator.sendAndReceive( |
223 | - connectPoint, | 223 | + connectPoint, |
224 | - GET_CURRENT, | 224 | + GET_CURRENT, |
225 | - SERIALIZER::encode, | 225 | + SERIALIZER::encode, |
226 | - SERIALIZER::decode, | 226 | + SERIALIZER::decode, |
227 | - master), | 227 | + master), |
228 | - STATISTIC_STORE_TIMEOUT_MILLIS, | 228 | + STATISTIC_STORE_TIMEOUT_MILLIS, |
229 | - TimeUnit.MILLISECONDS, | 229 | + TimeUnit.MILLISECONDS, |
230 | - Collections.emptySet()); | 230 | + Collections.emptySet()); |
231 | - } | 231 | + } |
232 | - } | 232 | + } |
233 | - | 233 | + |
234 | - private synchronized Set<FlowEntry> getCurrentStatisticInternal(ConnectPoint connectPoint) { | 234 | + private synchronized Set<FlowEntry> getCurrentStatisticInternal(ConnectPoint connectPoint) { |
235 | - return current.get(connectPoint); | 235 | + return current.get(connectPoint); |
236 | - } | 236 | + } |
237 | - | 237 | + |
238 | - @Override | 238 | + @Override |
239 | - public Set<FlowEntry> getPreviousFlowStatistic(ConnectPoint connectPoint) { | 239 | + public Set<FlowEntry> getPreviousFlowStatistic(ConnectPoint connectPoint) { |
240 | - final DeviceId deviceId = connectPoint.deviceId(); | 240 | + final DeviceId deviceId = connectPoint.deviceId(); |
241 | - | 241 | + |
242 | - NodeId master = mastershipService.getMasterFor(deviceId); | 242 | + NodeId master = mastershipService.getMasterFor(deviceId); |
243 | - if (master == null) { | 243 | + if (master == null) { |
244 | - log.warn("No master for {}", deviceId); | 244 | + log.warn("No master for {}", deviceId); |
245 | - return Collections.emptySet(); | 245 | + return Collections.emptySet(); |
246 | - } | 246 | + } |
247 | - | 247 | + |
248 | - if (Objects.equal(local, master)) { | 248 | + if (Objects.equal(local, master)) { |
249 | - return getPreviousStatisticInternal(connectPoint); | 249 | + return getPreviousStatisticInternal(connectPoint); |
250 | - } else { | 250 | + } else { |
251 | - return Tools.futureGetOrElse(clusterCommunicator.sendAndReceive( | 251 | + return Tools.futureGetOrElse(clusterCommunicator.sendAndReceive( |
252 | - connectPoint, | 252 | + connectPoint, |
253 | - GET_PREVIOUS, | 253 | + GET_PREVIOUS, |
254 | - SERIALIZER::encode, | 254 | + SERIALIZER::encode, |
255 | - SERIALIZER::decode, | 255 | + SERIALIZER::decode, |
256 | - master), | 256 | + master), |
257 | - STATISTIC_STORE_TIMEOUT_MILLIS, | 257 | + STATISTIC_STORE_TIMEOUT_MILLIS, |
258 | - TimeUnit.MILLISECONDS, | 258 | + TimeUnit.MILLISECONDS, |
259 | - Collections.emptySet()); | 259 | + Collections.emptySet()); |
260 | - } | 260 | + } |
261 | - } | 261 | + } |
262 | - | 262 | + |
263 | - private synchronized Set<FlowEntry> getPreviousStatisticInternal(ConnectPoint connectPoint) { | 263 | + private synchronized Set<FlowEntry> getPreviousStatisticInternal(ConnectPoint connectPoint) { |
264 | - return previous.get(connectPoint); | 264 | + return previous.get(connectPoint); |
265 | - } | 265 | + } |
266 | - | 266 | + |
267 | - private ConnectPoint buildConnectPoint(FlowRule rule) { | 267 | + private ConnectPoint buildConnectPoint(FlowRule rule) { |
268 | - PortNumber port = getOutput(rule); | 268 | + PortNumber port = getOutput(rule); |
269 | - | 269 | + |
270 | - if (port == null) { | 270 | + if (port == null) { |
271 | - return null; | 271 | + return null; |
272 | - } | 272 | + } |
273 | - ConnectPoint cp = new ConnectPoint(rule.deviceId(), port); | 273 | + ConnectPoint cp = new ConnectPoint(rule.deviceId(), port); |
274 | - return cp; | 274 | + return cp; |
275 | - } | 275 | + } |
276 | - | 276 | + |
277 | - private PortNumber getOutput(FlowRule rule) { | 277 | + private PortNumber getOutput(FlowRule rule) { |
278 | - for (Instruction i : rule.treatment().allInstructions()) { | 278 | + for (Instruction i : rule.treatment().allInstructions()) { |
279 | - if (i.type() == Instruction.Type.OUTPUT) { | 279 | + if (i.type() == Instruction.Type.OUTPUT) { |
280 | - Instructions.OutputInstruction out = (Instructions.OutputInstruction) i; | 280 | + Instructions.OutputInstruction out = (Instructions.OutputInstruction) i; |
281 | - return out.port(); | 281 | + return out.port(); |
282 | - } | 282 | + } |
283 | - if (i.type() == Instruction.Type.DROP) { | 283 | + if (i.type() == Instruction.Type.DROP) { |
284 | - return PortNumber.P0; | 284 | + return PortNumber.P0; |
285 | - } | 285 | + } |
286 | - } | 286 | + } |
287 | - return null; | 287 | + return null; |
288 | - } | 288 | + } |
289 | } | 289 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
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 | - | 16 | + |
17 | -package org.onosproject.bgpio.protocol; | 17 | +package org.onosproject.bgpio.protocol; |
18 | - | 18 | + |
19 | -import org.jboss.netty.buffer.ChannelBuffer; | 19 | +import org.jboss.netty.buffer.ChannelBuffer; |
20 | -import org.onosproject.bgpio.exceptions.BgpParseException; | 20 | +import org.onosproject.bgpio.exceptions.BgpParseException; |
21 | -import org.onosproject.bgpio.protocol.ver4.BgpFactoryVer4; | 21 | +import org.onosproject.bgpio.protocol.ver4.BgpFactoryVer4; |
22 | -import org.onosproject.bgpio.types.BgpHeader; | 22 | +import org.onosproject.bgpio.types.BgpHeader; |
23 | -import org.slf4j.Logger; | 23 | +import org.slf4j.Logger; |
24 | -import org.slf4j.LoggerFactory; | 24 | +import org.slf4j.LoggerFactory; |
25 | - | 25 | + |
26 | -/** | 26 | +/** |
27 | - * Abstraction to provide the version for BGP. | 27 | + * Abstraction to provide the version for BGP. |
28 | - */ | 28 | + */ |
29 | -public final class BgpFactories { | 29 | +public final class BgpFactories { |
30 | - | 30 | + |
31 | - protected static final Logger log = LoggerFactory.getLogger(BgpFactories.class); | 31 | + protected static final Logger log = LoggerFactory.getLogger(BgpFactories.class); |
32 | - | 32 | + |
33 | - private static final GenericReader GENERIC_READER = new GenericReader(); | 33 | + private static final GenericReader GENERIC_READER = new GenericReader(); |
34 | - | 34 | + |
35 | - private BgpFactories() { | 35 | + private BgpFactories() { |
36 | - } | 36 | + } |
37 | - | 37 | + |
38 | - /** | 38 | + /** |
39 | - * Returns the instance of BGP Version. | 39 | + * Returns the instance of BGP Version. |
40 | - * | 40 | + * |
41 | - * @param version BGP version | 41 | + * @param version BGP version |
42 | - * @return BGP version | 42 | + * @return BGP version |
43 | - */ | 43 | + */ |
44 | - public static BgpFactory getFactory(BgpVersion version) { | 44 | + public static BgpFactory getFactory(BgpVersion version) { |
45 | - switch (version) { | 45 | + switch (version) { |
46 | - case BGP_4: | 46 | + case BGP_4: |
47 | - return BgpFactoryVer4.INSTANCE; | 47 | + return BgpFactoryVer4.INSTANCE; |
48 | - default: | 48 | + default: |
49 | - throw new IllegalArgumentException("[BgpFactory:]Unknown version: " + version); | 49 | + throw new IllegalArgumentException("[BgpFactory:]Unknown version: " + version); |
50 | - } | 50 | + } |
51 | - } | 51 | + } |
52 | - | 52 | + |
53 | - /** | 53 | + /** |
54 | - * Reader class for reading BGP messages from channel buffer. | 54 | + * Reader class for reading BGP messages from channel buffer. |
55 | - * | 55 | + * |
56 | - */ | 56 | + */ |
57 | - private static class GenericReader implements BgpMessageReader<BgpMessage> { | 57 | + private static class GenericReader implements BgpMessageReader<BgpMessage> { |
58 | - | 58 | + |
59 | - @Override | 59 | + @Override |
60 | - public BgpMessage readFrom(ChannelBuffer bb, BgpHeader bgpHeader) | 60 | + public BgpMessage readFrom(ChannelBuffer bb, BgpHeader bgpHeader) |
61 | - throws BgpParseException { | 61 | + throws BgpParseException { |
62 | - BgpFactory factory; | 62 | + BgpFactory factory; |
63 | - | 63 | + |
64 | - if (!bb.readable()) { | 64 | + if (!bb.readable()) { |
65 | - log.error("Empty message received"); | 65 | + log.error("Empty message received"); |
66 | - throw new BgpParseException("Empty message received"); | 66 | + throw new BgpParseException("Empty message received"); |
67 | - } | 67 | + } |
68 | - // TODO: Currently only BGP version 4 is supported | 68 | + // TODO: Currently only BGP version 4 is supported |
69 | - factory = org.onosproject.bgpio.protocol.ver4.BgpFactoryVer4.INSTANCE; | 69 | + factory = org.onosproject.bgpio.protocol.ver4.BgpFactoryVer4.INSTANCE; |
70 | - return factory.getReader().readFrom(bb, bgpHeader); | 70 | + return factory.getReader().readFrom(bb, bgpHeader); |
71 | - } | 71 | + } |
72 | - } | 72 | + } |
73 | - | 73 | + |
74 | - /** | 74 | + /** |
75 | - * Returns BGP messsage generic reader. | 75 | + * Returns BGP messsage generic reader. |
76 | - * | 76 | + * |
77 | - * @return bgp message generic reader | 77 | + * @return bgp message generic reader |
78 | - */ | 78 | + */ |
79 | - public static BgpMessageReader<BgpMessage> getGenericReader() { | 79 | + public static BgpMessageReader<BgpMessage> getGenericReader() { |
80 | - return GENERIC_READER; | 80 | + return GENERIC_READER; |
81 | - } | 81 | + } |
82 | -} | 82 | +} | ... | ... |
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.bgpio.protocol.linkstate; | 16 | +package org.onosproject.bgpio.protocol.linkstate; |
17 | - | 17 | + |
18 | -import java.util.List; | 18 | +import java.util.List; |
19 | - | 19 | + |
20 | -import org.jboss.netty.buffer.ChannelBuffer; | 20 | +import org.jboss.netty.buffer.ChannelBuffer; |
21 | -import org.onosproject.bgpio.exceptions.BgpParseException; | 21 | +import org.onosproject.bgpio.exceptions.BgpParseException; |
22 | -import org.onosproject.bgpio.protocol.BgpLinkLsNlri; | 22 | +import org.onosproject.bgpio.protocol.BgpLinkLsNlri; |
23 | -import org.onosproject.bgpio.protocol.NlriType; | 23 | +import org.onosproject.bgpio.protocol.NlriType; |
24 | -import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4.ProtocolType; | 24 | +import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4.ProtocolType; |
25 | -import org.onosproject.bgpio.types.BgpErrorType; | 25 | +import org.onosproject.bgpio.types.BgpErrorType; |
26 | -import org.onosproject.bgpio.types.BgpValueType; | 26 | +import org.onosproject.bgpio.types.BgpValueType; |
27 | -import org.onosproject.bgpio.types.RouteDistinguisher; | 27 | +import org.onosproject.bgpio.types.RouteDistinguisher; |
28 | -import org.onosproject.bgpio.util.Constants; | 28 | +import org.onosproject.bgpio.util.Constants; |
29 | -import org.slf4j.Logger; | 29 | +import org.slf4j.Logger; |
30 | -import org.slf4j.LoggerFactory; | 30 | +import org.slf4j.LoggerFactory; |
31 | - | 31 | + |
32 | -import com.google.common.base.MoreObjects; | 32 | +import com.google.common.base.MoreObjects; |
33 | - | 33 | + |
34 | -/** | 34 | +/** |
35 | - * Implementation of Link LS NLRI. | 35 | + * Implementation of Link LS NLRI. |
36 | - */ | 36 | + */ |
37 | -public class BgpLinkLsNlriVer4 implements BgpLinkLsNlri { | 37 | +public class BgpLinkLsNlriVer4 implements BgpLinkLsNlri { |
38 | - | 38 | + |
39 | - /* | 39 | + /* |
40 | - * REFERENCE : draft-ietf-idr-ls-distribution-11 | 40 | + * REFERENCE : draft-ietf-idr-ls-distribution-11 |
41 | - 0 1 2 3 | 41 | + 0 1 2 3 |
42 | - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 42 | + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
43 | - +-+-+-+-+-+-+-+-+ | 43 | + +-+-+-+-+-+-+-+-+ |
44 | - | Protocol-ID | | 44 | + | Protocol-ID | |
45 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 45 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
46 | - | Identifier | | 46 | + | Identifier | |
47 | - | (64 bits) | | 47 | + | (64 bits) | |
48 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 48 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
49 | - // Local Node Descriptors (variable) // | 49 | + // Local Node Descriptors (variable) // |
50 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 50 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
51 | - // Remote Node Descriptors (variable) // | 51 | + // Remote Node Descriptors (variable) // |
52 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 52 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
53 | - // Link Descriptors (variable) // | 53 | + // Link Descriptors (variable) // |
54 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 54 | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
55 | - | 55 | + |
56 | - Figure : The Link NLRI format | 56 | + Figure : The Link NLRI format |
57 | - */ | 57 | + */ |
58 | - private static final Logger log = LoggerFactory.getLogger(BgpLinkLsNlriVer4.class); | 58 | + private static final Logger log = LoggerFactory.getLogger(BgpLinkLsNlriVer4.class); |
59 | - public static final int LINK_NLRITYPE = 2; | 59 | + public static final int LINK_NLRITYPE = 2; |
60 | - | 60 | + |
61 | - private BgpLinkLSIdentifier linkLSIdentifier; | 61 | + private BgpLinkLSIdentifier linkLSIdentifier; |
62 | - private byte protocolId; | 62 | + private byte protocolId; |
63 | - private long identifier; | 63 | + private long identifier; |
64 | - private RouteDistinguisher routeDistinguisher; | 64 | + private RouteDistinguisher routeDistinguisher; |
65 | - private boolean isVpn; | 65 | + private boolean isVpn; |
66 | - | 66 | + |
67 | - /** | 67 | + /** |
68 | - * Initialize fields. | 68 | + * Initialize fields. |
69 | - */ | 69 | + */ |
70 | - public BgpLinkLsNlriVer4() { | 70 | + public BgpLinkLsNlriVer4() { |
71 | - this.protocolId = 0; | 71 | + this.protocolId = 0; |
72 | - this.identifier = 0; | 72 | + this.identifier = 0; |
73 | - this.linkLSIdentifier = null; | 73 | + this.linkLSIdentifier = null; |
74 | - this.routeDistinguisher = null; | 74 | + this.routeDistinguisher = null; |
75 | - this.isVpn = false; | 75 | + this.isVpn = false; |
76 | - } | 76 | + } |
77 | - | 77 | + |
78 | - /** | 78 | + /** |
79 | - * Constructor to initialize parameters for BGP LinkLSNlri. | 79 | + * Constructor to initialize parameters for BGP LinkLSNlri. |
80 | - * | 80 | + * |
81 | - * @param protocolId protocol Id | 81 | + * @param protocolId protocol Id |
82 | - * @param identifier field in BGP LinkLSNlri | 82 | + * @param identifier field in BGP LinkLSNlri |
83 | - * @param linkLSIdentifier link LS identifier | 83 | + * @param linkLSIdentifier link LS identifier |
84 | - * @param routeDistinguisher route distinguisher from message | 84 | + * @param routeDistinguisher route distinguisher from message |
85 | - * @param isVpn vpn info availability in message | 85 | + * @param isVpn vpn info availability in message |
86 | - */ | 86 | + */ |
87 | - public BgpLinkLsNlriVer4(byte protocolId, long identifier, BgpLinkLSIdentifier linkLSIdentifier, | 87 | + public BgpLinkLsNlriVer4(byte protocolId, long identifier, BgpLinkLSIdentifier linkLSIdentifier, |
88 | - RouteDistinguisher routeDistinguisher, boolean isVpn) { | 88 | + RouteDistinguisher routeDistinguisher, boolean isVpn) { |
89 | - this.protocolId = protocolId; | 89 | + this.protocolId = protocolId; |
90 | - this.identifier = identifier; | 90 | + this.identifier = identifier; |
91 | - this.linkLSIdentifier = linkLSIdentifier; | 91 | + this.linkLSIdentifier = linkLSIdentifier; |
92 | - this.routeDistinguisher = routeDistinguisher; | 92 | + this.routeDistinguisher = routeDistinguisher; |
93 | - this.isVpn = isVpn; | 93 | + this.isVpn = isVpn; |
94 | - } | 94 | + } |
95 | - | 95 | + |
96 | - /** | 96 | + /** |
97 | - * Reads from channelBuffer and parses Link LS Nlri. | 97 | + * Reads from channelBuffer and parses Link LS Nlri. |
98 | - * | 98 | + * |
99 | - * @param cb ChannelBuffer | 99 | + * @param cb ChannelBuffer |
100 | - * @param afi Address Family Identifier | 100 | + * @param afi Address Family Identifier |
101 | - * @param safi Subsequent Address Family Identifier | 101 | + * @param safi Subsequent Address Family Identifier |
102 | - * @return object of this class | 102 | + * @return object of this class |
103 | - * @throws BgpParseException while parsing Link LS NLRI | 103 | + * @throws BgpParseException while parsing Link LS NLRI |
104 | - */ | 104 | + */ |
105 | - public static BgpLinkLsNlriVer4 read(ChannelBuffer cb, short afi, byte safi) throws BgpParseException { | 105 | + public static BgpLinkLsNlriVer4 read(ChannelBuffer cb, short afi, byte safi) throws BgpParseException { |
106 | - boolean isVpn = false; | 106 | + boolean isVpn = false; |
107 | - RouteDistinguisher routeDistinguisher = null; | 107 | + RouteDistinguisher routeDistinguisher = null; |
108 | - if ((afi == Constants.AFI_VALUE) && (safi == Constants.VPN_SAFI_VALUE)) { | 108 | + if ((afi == Constants.AFI_VALUE) && (safi == Constants.VPN_SAFI_VALUE)) { |
109 | - routeDistinguisher = new RouteDistinguisher(); | 109 | + routeDistinguisher = new RouteDistinguisher(); |
110 | - routeDistinguisher = RouteDistinguisher.read(cb); | 110 | + routeDistinguisher = RouteDistinguisher.read(cb); |
111 | - isVpn = true; | 111 | + isVpn = true; |
112 | - } else { | 112 | + } else { |
113 | - isVpn = false; | 113 | + isVpn = false; |
114 | - } | 114 | + } |
115 | - byte protocolId = cb.readByte(); | 115 | + byte protocolId = cb.readByte(); |
116 | - long identifier = cb.readLong(); | 116 | + long identifier = cb.readLong(); |
117 | - | 117 | + |
118 | - BgpLinkLSIdentifier linkLSIdentifier = new BgpLinkLSIdentifier(); | 118 | + BgpLinkLSIdentifier linkLSIdentifier = new BgpLinkLSIdentifier(); |
119 | - linkLSIdentifier = BgpLinkLSIdentifier.parseLinkIdendifier(cb, protocolId); | 119 | + linkLSIdentifier = BgpLinkLSIdentifier.parseLinkIdendifier(cb, protocolId); |
120 | - return new BgpLinkLsNlriVer4(protocolId, identifier, linkLSIdentifier, routeDistinguisher, isVpn); | 120 | + return new BgpLinkLsNlriVer4(protocolId, identifier, linkLSIdentifier, routeDistinguisher, isVpn); |
121 | - } | 121 | + } |
122 | - | 122 | + |
123 | - @Override | 123 | + @Override |
124 | - public NlriType getNlriType() { | 124 | + public NlriType getNlriType() { |
125 | - return NlriType.LINK; | 125 | + return NlriType.LINK; |
126 | - } | 126 | + } |
127 | - | 127 | + |
128 | - @Override | 128 | + @Override |
129 | - public long getIdentifier() { | 129 | + public long getIdentifier() { |
130 | - return this.identifier; | 130 | + return this.identifier; |
131 | - } | 131 | + } |
132 | - | 132 | + |
133 | - /** | 133 | + /** |
134 | - * Set the link LS identifier. | 134 | + * Set the link LS identifier. |
135 | - * | 135 | + * |
136 | - * @param linkLSIdentifier link LS identifier to set | 136 | + * @param linkLSIdentifier link LS identifier to set |
137 | - */ | 137 | + */ |
138 | - public void setLinkLSIdentifier(BgpLinkLSIdentifier linkLSIdentifier) { | 138 | + public void setLinkLSIdentifier(BgpLinkLSIdentifier linkLSIdentifier) { |
139 | - this.linkLSIdentifier = linkLSIdentifier; | 139 | + this.linkLSIdentifier = linkLSIdentifier; |
140 | - } | 140 | + } |
141 | - | 141 | + |
142 | - @Override | 142 | + @Override |
143 | - public ProtocolType getProtocolId() throws BgpParseException { | 143 | + public ProtocolType getProtocolId() throws BgpParseException { |
144 | - switch (protocolId) { | 144 | + switch (protocolId) { |
145 | - case Constants.ISIS_LEVELONE: | 145 | + case Constants.ISIS_LEVELONE: |
146 | - return ProtocolType.ISIS_LEVEL_ONE; | 146 | + return ProtocolType.ISIS_LEVEL_ONE; |
147 | - case Constants.ISIS_LEVELTWO: | 147 | + case Constants.ISIS_LEVELTWO: |
148 | - return ProtocolType.ISIS_LEVEL_TWO; | 148 | + return ProtocolType.ISIS_LEVEL_TWO; |
149 | - case Constants.OSPFV2: | 149 | + case Constants.OSPFV2: |
150 | - return ProtocolType.OSPF_V2; | 150 | + return ProtocolType.OSPF_V2; |
151 | - case Constants.DIRECT: | 151 | + case Constants.DIRECT: |
152 | - return ProtocolType.DIRECT; | 152 | + return ProtocolType.DIRECT; |
153 | - case Constants.STATIC_CONFIGURATION: | 153 | + case Constants.STATIC_CONFIGURATION: |
154 | - return ProtocolType.STATIC_CONFIGURATION; | 154 | + return ProtocolType.STATIC_CONFIGURATION; |
155 | - case Constants.OSPFV3: | 155 | + case Constants.OSPFV3: |
156 | - return ProtocolType.OSPF_V3; | 156 | + return ProtocolType.OSPF_V3; |
157 | - default: | 157 | + default: |
158 | - throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, (byte) 0, null); | 158 | + throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, (byte) 0, null); |
159 | - } | 159 | + } |
160 | - } | 160 | + } |
161 | - | 161 | + |
162 | - @Override | 162 | + @Override |
163 | - public NodeDescriptors localNodeDescriptors() { | 163 | + public NodeDescriptors localNodeDescriptors() { |
164 | - return this.linkLSIdentifier.localNodeDescriptors(); | 164 | + return this.linkLSIdentifier.localNodeDescriptors(); |
165 | - } | 165 | + } |
166 | - | 166 | + |
167 | - @Override | 167 | + @Override |
168 | - public NodeDescriptors remoteNodeDescriptors() { | 168 | + public NodeDescriptors remoteNodeDescriptors() { |
169 | - return this.linkLSIdentifier.remoteNodeDescriptors(); | 169 | + return this.linkLSIdentifier.remoteNodeDescriptors(); |
170 | - } | 170 | + } |
171 | - | 171 | + |
172 | - /** | 172 | + /** |
173 | - * Returns whether VPN is present or not. | 173 | + * Returns whether VPN is present or not. |
174 | - * | 174 | + * |
175 | - * @return whether VPN is present or not | 175 | + * @return whether VPN is present or not |
176 | - */ | 176 | + */ |
177 | - public boolean isVpnPresent() { | 177 | + public boolean isVpnPresent() { |
178 | - return this.isVpn; | 178 | + return this.isVpn; |
179 | - } | 179 | + } |
180 | - | 180 | + |
181 | - @Override | 181 | + @Override |
182 | - public RouteDistinguisher getRouteDistinguisher() { | 182 | + public RouteDistinguisher getRouteDistinguisher() { |
183 | - return this.routeDistinguisher; | 183 | + return this.routeDistinguisher; |
184 | - } | 184 | + } |
185 | - | 185 | + |
186 | - /** | 186 | + /** |
187 | - * Returns link identifier. | 187 | + * Returns link identifier. |
188 | - * | 188 | + * |
189 | - * @return link identifier | 189 | + * @return link identifier |
190 | - */ | 190 | + */ |
191 | - public BgpLinkLSIdentifier getLinkIdentifier() { | 191 | + public BgpLinkLSIdentifier getLinkIdentifier() { |
192 | - return this.linkLSIdentifier; | 192 | + return this.linkLSIdentifier; |
193 | - } | 193 | + } |
194 | - | 194 | + |
195 | - @Override | 195 | + @Override |
196 | - public List<BgpValueType> linkDescriptors() { | 196 | + public List<BgpValueType> linkDescriptors() { |
197 | - return this.linkLSIdentifier.linkDescriptors(); | 197 | + return this.linkLSIdentifier.linkDescriptors(); |
198 | - } | 198 | + } |
199 | - | 199 | + |
200 | - @Override | 200 | + @Override |
201 | - public String toString() { | 201 | + public String toString() { |
202 | - return MoreObjects.toStringHelper(getClass()) | 202 | + return MoreObjects.toStringHelper(getClass()) |
203 | - .omitNullValues() | 203 | + .omitNullValues() |
204 | - .add("protocolId", protocolId) | 204 | + .add("protocolId", protocolId) |
205 | - .add("identifier", identifier) | 205 | + .add("identifier", identifier) |
206 | - .add("RouteDistinguisher ", routeDistinguisher) | 206 | + .add("RouteDistinguisher ", routeDistinguisher) |
207 | - .add("linkLSIdentifier", linkLSIdentifier) | 207 | + .add("linkLSIdentifier", linkLSIdentifier) |
208 | - .toString(); | 208 | + .toString(); |
209 | - } | 209 | + } |
210 | -} | 210 | +} | ... | ... |
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.bgpio.types; | 16 | +package org.onosproject.bgpio.types; |
17 | - | 17 | + |
18 | -import java.util.Objects; | 18 | +import java.util.Objects; |
19 | - | 19 | + |
20 | -import org.jboss.netty.buffer.ChannelBuffer; | 20 | +import org.jboss.netty.buffer.ChannelBuffer; |
21 | -import org.slf4j.Logger; | 21 | +import org.slf4j.Logger; |
22 | -import org.slf4j.LoggerFactory; | 22 | +import org.slf4j.LoggerFactory; |
23 | - | 23 | + |
24 | -import com.google.common.base.MoreObjects; | 24 | +import com.google.common.base.MoreObjects; |
25 | - | 25 | + |
26 | -/** | 26 | +/** |
27 | - * Provides FourOctetAsNumCapabilityTlv Capability Tlv. | 27 | + * Provides FourOctetAsNumCapabilityTlv Capability Tlv. |
28 | - */ | 28 | + */ |
29 | -public class FourOctetAsNumCapabilityTlv implements BgpValueType { | 29 | +public class FourOctetAsNumCapabilityTlv implements BgpValueType { |
30 | - | 30 | + |
31 | - /** | 31 | + /** |
32 | - * support to indicate its support for four-octet AS numbers -CAPABILITY TLV format. | 32 | + * support to indicate its support for four-octet AS numbers -CAPABILITY TLV format. |
33 | - */ | 33 | + */ |
34 | - protected static final Logger log = LoggerFactory | 34 | + protected static final Logger log = LoggerFactory |
35 | - .getLogger(FourOctetAsNumCapabilityTlv.class); | 35 | + .getLogger(FourOctetAsNumCapabilityTlv.class); |
36 | - | 36 | + |
37 | - public static final byte TYPE = 65; | 37 | + public static final byte TYPE = 65; |
38 | - public static final byte LENGTH = 4; | 38 | + public static final byte LENGTH = 4; |
39 | - | 39 | + |
40 | - private final int rawValue; | 40 | + private final int rawValue; |
41 | - | 41 | + |
42 | - /** | 42 | + /** |
43 | - * constructor to initialize rawValue. | 43 | + * constructor to initialize rawValue. |
44 | - * @param rawValue FourOctetAsNumCapabilityTlv | 44 | + * @param rawValue FourOctetAsNumCapabilityTlv |
45 | - */ | 45 | + */ |
46 | - public FourOctetAsNumCapabilityTlv(int rawValue) { | 46 | + public FourOctetAsNumCapabilityTlv(int rawValue) { |
47 | - this.rawValue = rawValue; | 47 | + this.rawValue = rawValue; |
48 | - } | 48 | + } |
49 | - | 49 | + |
50 | - /** | 50 | + /** |
51 | - * constructor to initialize raw. | 51 | + * constructor to initialize raw. |
52 | - * @param raw AS number | 52 | + * @param raw AS number |
53 | - * @return object of FourOctetAsNumCapabilityTlv | 53 | + * @return object of FourOctetAsNumCapabilityTlv |
54 | - */ | 54 | + */ |
55 | - public static FourOctetAsNumCapabilityTlv of(final int raw) { | 55 | + public static FourOctetAsNumCapabilityTlv of(final int raw) { |
56 | - return new FourOctetAsNumCapabilityTlv(raw); | 56 | + return new FourOctetAsNumCapabilityTlv(raw); |
57 | - } | 57 | + } |
58 | - | 58 | + |
59 | - /** | 59 | + /** |
60 | - * Returns value of TLV. | 60 | + * Returns value of TLV. |
61 | - * @return int value of rawValue | 61 | + * @return int value of rawValue |
62 | - */ | 62 | + */ |
63 | - public int getInt() { | 63 | + public int getInt() { |
64 | - return rawValue; | 64 | + return rawValue; |
65 | - } | 65 | + } |
66 | - | 66 | + |
67 | - @Override | 67 | + @Override |
68 | - public short getType() { | 68 | + public short getType() { |
69 | - return TYPE; | 69 | + return TYPE; |
70 | - } | 70 | + } |
71 | - | 71 | + |
72 | - @Override | 72 | + @Override |
73 | - public int hashCode() { | 73 | + public int hashCode() { |
74 | - return Objects.hash(rawValue); | 74 | + return Objects.hash(rawValue); |
75 | - } | 75 | + } |
76 | - | 76 | + |
77 | - @Override | 77 | + @Override |
78 | - public boolean equals(Object obj) { | 78 | + public boolean equals(Object obj) { |
79 | - if (this == obj) { | 79 | + if (this == obj) { |
80 | - return true; | 80 | + return true; |
81 | - } | 81 | + } |
82 | - if (obj instanceof FourOctetAsNumCapabilityTlv) { | 82 | + if (obj instanceof FourOctetAsNumCapabilityTlv) { |
83 | - FourOctetAsNumCapabilityTlv other = (FourOctetAsNumCapabilityTlv) obj; | 83 | + FourOctetAsNumCapabilityTlv other = (FourOctetAsNumCapabilityTlv) obj; |
84 | - return Objects.equals(rawValue, other.rawValue); | 84 | + return Objects.equals(rawValue, other.rawValue); |
85 | - } | 85 | + } |
86 | - return false; | 86 | + return false; |
87 | - } | 87 | + } |
88 | - | 88 | + |
89 | - @Override | 89 | + @Override |
90 | - public int write(ChannelBuffer cb) { | 90 | + public int write(ChannelBuffer cb) { |
91 | - int iLenStartIndex = cb.writerIndex(); | 91 | + int iLenStartIndex = cb.writerIndex(); |
92 | - cb.writeByte(TYPE); | 92 | + cb.writeByte(TYPE); |
93 | - cb.writeByte(LENGTH); | 93 | + cb.writeByte(LENGTH); |
94 | - cb.writeInt(rawValue); | 94 | + cb.writeInt(rawValue); |
95 | - return cb.writerIndex() - iLenStartIndex; | 95 | + return cb.writerIndex() - iLenStartIndex; |
96 | - } | 96 | + } |
97 | - | 97 | + |
98 | - /** | 98 | + /** |
99 | - * Reads the channel buffer and returns object of FourOctetAsNumCapabilityTlv. | 99 | + * Reads the channel buffer and returns object of FourOctetAsNumCapabilityTlv. |
100 | - * @param cb type of channel buffer | 100 | + * @param cb type of channel buffer |
101 | - * @return object of FourOctetAsNumCapabilityTlv | 101 | + * @return object of FourOctetAsNumCapabilityTlv |
102 | - */ | 102 | + */ |
103 | - public static FourOctetAsNumCapabilityTlv read(ChannelBuffer cb) { | 103 | + public static FourOctetAsNumCapabilityTlv read(ChannelBuffer cb) { |
104 | - return FourOctetAsNumCapabilityTlv.of(cb.readInt()); | 104 | + return FourOctetAsNumCapabilityTlv.of(cb.readInt()); |
105 | - } | 105 | + } |
106 | - | 106 | + |
107 | - @Override | 107 | + @Override |
108 | - public String toString() { | 108 | + public String toString() { |
109 | - return MoreObjects.toStringHelper(getClass()) | 109 | + return MoreObjects.toStringHelper(getClass()) |
110 | - .add("Type", TYPE) | 110 | + .add("Type", TYPE) |
111 | - .add("Length", LENGTH) | 111 | + .add("Length", LENGTH) |
112 | - .add("Value", rawValue).toString(); | 112 | + .add("Value", rawValue).toString(); |
113 | - } | 113 | + } |
114 | - | 114 | + |
115 | - @Override | 115 | + @Override |
116 | - public int compareTo(Object o) { | 116 | + public int compareTo(Object o) { |
117 | - // TODO Auto-generated method stub | 117 | + // TODO Auto-generated method stub |
118 | - return 0; | 118 | + return 0; |
119 | - } | 119 | + } |
120 | -} | 120 | +} | ... | ... |
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.bgpio.types; | 16 | +package org.onosproject.bgpio.types; |
17 | - | 17 | + |
18 | -import com.google.common.base.MoreObjects; | 18 | +import com.google.common.base.MoreObjects; |
19 | -import org.jboss.netty.buffer.ChannelBuffer; | 19 | +import org.jboss.netty.buffer.ChannelBuffer; |
20 | -import org.slf4j.Logger; | 20 | +import org.slf4j.Logger; |
21 | -import org.slf4j.LoggerFactory; | 21 | +import org.slf4j.LoggerFactory; |
22 | - | 22 | + |
23 | -import java.util.Objects; | 23 | +import java.util.Objects; |
24 | - | 24 | + |
25 | -/** | 25 | +/** |
26 | - * Provides MultiProtocolExtnCapabilityTlv. | 26 | + * Provides MultiProtocolExtnCapabilityTlv. |
27 | - */ | 27 | + */ |
28 | -public class MultiProtocolExtnCapabilityTlv implements BgpValueType { | 28 | +public class MultiProtocolExtnCapabilityTlv implements BgpValueType { |
29 | - | 29 | + |
30 | - /* | 30 | + /* |
31 | - 0 7 15 23 31 | 31 | + 0 7 15 23 31 |
32 | - +-------+-------+-------+-------+ | 32 | + +-------+-------+-------+-------+ |
33 | - | AFI | Res | SAFI | | 33 | + | AFI | Res | SAFI | |
34 | - +-------+-------+-------+-------+ | 34 | + +-------+-------+-------+-------+ |
35 | - | 35 | + |
36 | - Multiprotocol Extensions CAPABILITY TLV format | 36 | + Multiprotocol Extensions CAPABILITY TLV format |
37 | - REFERENCE : RFC 4760 | 37 | + REFERENCE : RFC 4760 |
38 | - */ | 38 | + */ |
39 | - protected static final Logger log = LoggerFactory | 39 | + protected static final Logger log = LoggerFactory |
40 | - .getLogger(MultiProtocolExtnCapabilityTlv.class); | 40 | + .getLogger(MultiProtocolExtnCapabilityTlv.class); |
41 | - | 41 | + |
42 | - public static final byte TYPE = 1; | 42 | + public static final byte TYPE = 1; |
43 | - public static final byte LENGTH = 4; | 43 | + public static final byte LENGTH = 4; |
44 | - | 44 | + |
45 | - private final short afi; | 45 | + private final short afi; |
46 | - private final byte res; | 46 | + private final byte res; |
47 | - private final byte safi; | 47 | + private final byte safi; |
48 | - | 48 | + |
49 | - /** | 49 | + /** |
50 | - * Constructor to initialize variables. | 50 | + * Constructor to initialize variables. |
51 | - * @param afi Address Family Identifiers | 51 | + * @param afi Address Family Identifiers |
52 | - * @param res reserved field | 52 | + * @param res reserved field |
53 | - * @param safi Subsequent Address Family Identifier | 53 | + * @param safi Subsequent Address Family Identifier |
54 | - */ | 54 | + */ |
55 | - public MultiProtocolExtnCapabilityTlv(short afi, byte res, byte safi) { | 55 | + public MultiProtocolExtnCapabilityTlv(short afi, byte res, byte safi) { |
56 | - this.afi = afi; | 56 | + this.afi = afi; |
57 | - this.res = res; | 57 | + this.res = res; |
58 | - this.safi = safi; | 58 | + this.safi = safi; |
59 | - } | 59 | + } |
60 | - | 60 | + |
61 | - /** | 61 | + /** |
62 | - * Returns object of MultiProtocolExtnCapabilityTlv. | 62 | + * Returns object of MultiProtocolExtnCapabilityTlv. |
63 | - * @param afi Address Family Identifiers | 63 | + * @param afi Address Family Identifiers |
64 | - * @param res reserved field | 64 | + * @param res reserved field |
65 | - * @param safi Subsequent Address Family Identifier | 65 | + * @param safi Subsequent Address Family Identifier |
66 | - * @return object of MultiProtocolExtnCapabilityTlv | 66 | + * @return object of MultiProtocolExtnCapabilityTlv |
67 | - */ | 67 | + */ |
68 | - public static MultiProtocolExtnCapabilityTlv of(short afi, byte res, | 68 | + public static MultiProtocolExtnCapabilityTlv of(short afi, byte res, |
69 | - byte safi) { | 69 | + byte safi) { |
70 | - return new MultiProtocolExtnCapabilityTlv(afi, res, safi); | 70 | + return new MultiProtocolExtnCapabilityTlv(afi, res, safi); |
71 | - } | 71 | + } |
72 | - | 72 | + |
73 | - /** | 73 | + /** |
74 | - * Returns afi Address Family Identifiers value. | 74 | + * Returns afi Address Family Identifiers value. |
75 | - * @return afi Address Family Identifiers value | 75 | + * @return afi Address Family Identifiers value |
76 | - */ | 76 | + */ |
77 | - public short getAfi() { | 77 | + public short getAfi() { |
78 | - return afi; | 78 | + return afi; |
79 | - } | 79 | + } |
80 | - | 80 | + |
81 | - /** | 81 | + /** |
82 | - * Returns res reserved field value. | 82 | + * Returns res reserved field value. |
83 | - * @return res reserved field value | 83 | + * @return res reserved field value |
84 | - */ | 84 | + */ |
85 | - public byte getRes() { | 85 | + public byte getRes() { |
86 | - return res; | 86 | + return res; |
87 | - } | 87 | + } |
88 | - | 88 | + |
89 | - /** | 89 | + /** |
90 | - * Returns safi Subsequent Address Family Identifier value. | 90 | + * Returns safi Subsequent Address Family Identifier value. |
91 | - * @return safi Subsequent Address Family Identifier value | 91 | + * @return safi Subsequent Address Family Identifier value |
92 | - */ | 92 | + */ |
93 | - public byte getSafi() { | 93 | + public byte getSafi() { |
94 | - return safi; | 94 | + return safi; |
95 | - } | 95 | + } |
96 | - | 96 | + |
97 | - @Override | 97 | + @Override |
98 | - public short getType() { | 98 | + public short getType() { |
99 | - return TYPE; | 99 | + return TYPE; |
100 | - } | 100 | + } |
101 | - | 101 | + |
102 | - @Override | 102 | + @Override |
103 | - public int hashCode() { | 103 | + public int hashCode() { |
104 | - return Objects.hash(afi, res, safi); | 104 | + return Objects.hash(afi, res, safi); |
105 | - } | 105 | + } |
106 | - | 106 | + |
107 | - @Override | 107 | + @Override |
108 | - public boolean equals(Object obj) { | 108 | + public boolean equals(Object obj) { |
109 | - if (this == obj) { | 109 | + if (this == obj) { |
110 | - return true; | 110 | + return true; |
111 | - } | 111 | + } |
112 | - if (obj instanceof MultiProtocolExtnCapabilityTlv) { | 112 | + if (obj instanceof MultiProtocolExtnCapabilityTlv) { |
113 | - MultiProtocolExtnCapabilityTlv other = (MultiProtocolExtnCapabilityTlv) obj; | 113 | + MultiProtocolExtnCapabilityTlv other = (MultiProtocolExtnCapabilityTlv) obj; |
114 | - return Objects.equals(this.afi, other.afi) | 114 | + return Objects.equals(this.afi, other.afi) |
115 | - && Objects.equals(this.res, other.res) | 115 | + && Objects.equals(this.res, other.res) |
116 | - && Objects.equals(this.safi, other.safi); | 116 | + && Objects.equals(this.safi, other.safi); |
117 | - } | 117 | + } |
118 | - return false; | 118 | + return false; |
119 | - } | 119 | + } |
120 | - | 120 | + |
121 | - @Override | 121 | + @Override |
122 | - public int write(ChannelBuffer cb) { | 122 | + public int write(ChannelBuffer cb) { |
123 | - int iLenStartIndex = cb.writerIndex(); | 123 | + int iLenStartIndex = cb.writerIndex(); |
124 | - cb.writeByte(TYPE); | 124 | + cb.writeByte(TYPE); |
125 | - cb.writeByte(LENGTH); | 125 | + cb.writeByte(LENGTH); |
126 | - | 126 | + |
127 | - // write afi | 127 | + // write afi |
128 | - cb.writeShort(afi); | 128 | + cb.writeShort(afi); |
129 | - | 129 | + |
130 | - // write res | 130 | + // write res |
131 | - cb.writeByte(res); | 131 | + cb.writeByte(res); |
132 | - | 132 | + |
133 | - // write safi | 133 | + // write safi |
134 | - cb.writeByte(safi); | 134 | + cb.writeByte(safi); |
135 | - | 135 | + |
136 | - return cb.writerIndex() - iLenStartIndex; | 136 | + return cb.writerIndex() - iLenStartIndex; |
137 | - } | 137 | + } |
138 | - | 138 | + |
139 | - /** | 139 | + /** |
140 | - * Reads from channel buffer and returns object of MultiprotocolCapabilityTlv. | 140 | + * Reads from channel buffer and returns object of MultiprotocolCapabilityTlv. |
141 | - * @param cb of type channel buffer | 141 | + * @param cb of type channel buffer |
142 | - * @return object of MultiProtocolExtnCapabilityTlv | 142 | + * @return object of MultiProtocolExtnCapabilityTlv |
143 | - */ | 143 | + */ |
144 | - public static BgpValueType read(ChannelBuffer cb) { | 144 | + public static BgpValueType read(ChannelBuffer cb) { |
145 | - short afi = cb.readShort(); | 145 | + short afi = cb.readShort(); |
146 | - byte res = cb.readByte(); | 146 | + byte res = cb.readByte(); |
147 | - byte safi = cb.readByte(); | 147 | + byte safi = cb.readByte(); |
148 | - return new MultiProtocolExtnCapabilityTlv(afi, res, safi); | 148 | + return new MultiProtocolExtnCapabilityTlv(afi, res, safi); |
149 | - } | 149 | + } |
150 | - | 150 | + |
151 | - @Override | 151 | + @Override |
152 | - public String toString() { | 152 | + public String toString() { |
153 | - return MoreObjects.toStringHelper(getClass()) | 153 | + return MoreObjects.toStringHelper(getClass()) |
154 | - .add("Type", TYPE) | 154 | + .add("Type", TYPE) |
155 | - .add("Length", LENGTH) | 155 | + .add("Length", LENGTH) |
156 | - .add("AFI", afi) | 156 | + .add("AFI", afi) |
157 | - .add("Reserved", res) | 157 | + .add("Reserved", res) |
158 | - .add("SAFI", safi).toString(); | 158 | + .add("SAFI", safi).toString(); |
159 | - } | 159 | + } |
160 | - | 160 | + |
161 | - @Override | 161 | + @Override |
162 | - public int compareTo(Object o) { | 162 | + public int compareTo(Object o) { |
163 | - // TODO Auto-generated method stub | 163 | + // TODO Auto-generated method stub |
164 | - return 0; | 164 | + return 0; |
165 | - } | 165 | + } |
166 | -} | 166 | +} | ... | ... |
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 | - | 16 | + |
17 | -/** | 17 | +/** |
18 | - *Bgp configuration provider. | 18 | + *Bgp configuration provider. |
19 | - */ | 19 | + */ |
20 | -package org.onosproject.provider.bgp.cfg.impl; | 20 | +package org.onosproject.provider.bgp.cfg.impl; | ... | ... |
... | @@ -94,6 +94,12 @@ | ... | @@ -94,6 +94,12 @@ |
94 | <property name="message" value="Line has trailing spaces."/> | 94 | <property name="message" value="Line has trailing spaces."/> |
95 | </module> | 95 | </module> |
96 | 96 | ||
97 | + <module name="RegexpMultiline"> | ||
98 | + <property name="format" value="\r\n"/> | ||
99 | + <property name="maximum" value="0"/> | ||
100 | + <property name="message" value="Line has windows line endings."/> | ||
101 | + </module> | ||
102 | + | ||
97 | <!-- Checks for Headers --> | 103 | <!-- Checks for Headers --> |
98 | <!-- See http://checkstyle.sf.net/config_header.html --> | 104 | <!-- See http://checkstyle.sf.net/config_header.html --> |
99 | <!-- <module name="Header"> --> | 105 | <!-- <module name="Header"> --> | ... | ... |
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.onlab.util; | 16 | +package org.onlab.util; |
17 | - | 17 | + |
18 | -import org.jboss.netty.buffer.ChannelBuffer; | 18 | +import org.jboss.netty.buffer.ChannelBuffer; |
19 | -import org.slf4j.Logger; | 19 | +import org.slf4j.Logger; |
20 | -import org.slf4j.LoggerFactory; | 20 | +import org.slf4j.LoggerFactory; |
21 | - | 21 | + |
22 | -/** | 22 | +/** |
23 | - * HexDump class an utility to dump buffer in hex format. | 23 | + * HexDump class an utility to dump buffer in hex format. |
24 | - */ | 24 | + */ |
25 | -public final class HexDump { | 25 | +public final class HexDump { |
26 | - protected static final Logger log = LoggerFactory.getLogger(HexDump.class); | 26 | + protected static final Logger log = LoggerFactory.getLogger(HexDump.class); |
27 | - | 27 | + |
28 | - private HexDump() { | 28 | + private HexDump() { |
29 | - } | 29 | + } |
30 | - | 30 | + |
31 | - /** | 31 | + /** |
32 | - * Dump the buffer content in hex format. | 32 | + * Dump the buffer content in hex format. |
33 | - * | 33 | + * |
34 | - * @param buff buffer content to dump in hex format | 34 | + * @param buff buffer content to dump in hex format |
35 | - */ | 35 | + */ |
36 | - public static void dump(ChannelBuffer buff) { | 36 | + public static void dump(ChannelBuffer buff) { |
37 | - buff.markReaderIndex(); | 37 | + buff.markReaderIndex(); |
38 | - try { | 38 | + try { |
39 | - do { | 39 | + do { |
40 | - StringBuilder sb = new StringBuilder(); | 40 | + StringBuilder sb = new StringBuilder(); |
41 | - for (int k = 0; (k < 16) && (buff.readableBytes() != 0); ++k) { | 41 | + for (int k = 0; (k < 16) && (buff.readableBytes() != 0); ++k) { |
42 | - if (0 == k % 4) { | 42 | + if (0 == k % 4) { |
43 | - sb.append(String.format(" ")); // blank after 4 bytes | 43 | + sb.append(String.format(" ")); // blank after 4 bytes |
44 | - } | 44 | + } |
45 | - sb.append(String.format("%02X ", buff.readByte())); | 45 | + sb.append(String.format("%02X ", buff.readByte())); |
46 | - } | 46 | + } |
47 | - log.debug(sb.toString()); | 47 | + log.debug(sb.toString()); |
48 | - } while (buff.readableBytes() != 0); | 48 | + } while (buff.readableBytes() != 0); |
49 | - } catch (Exception e) { | 49 | + } catch (Exception e) { |
50 | - log.error("[HexDump] Invalid buffer: " + e.toString()); | 50 | + log.error("[HexDump] Invalid buffer: " + e.toString()); |
51 | - } | 51 | + } |
52 | - buff.resetReaderIndex(); | 52 | + buff.resetReaderIndex(); |
53 | - } | 53 | + } |
54 | -} | 54 | +} | ... | ... |
-
Please register or login to post a comment