Committed by
Gerrit Code Review
Application manages the IP layer topology information - Interfaces
Change-Id: Ie1dea035674ee98583e98a82cca7e33ab0858b92
Showing
68 changed files
with
5429 additions
and
0 deletions
apps/iptopology-api/pom.xml
0 → 100644
1 | +<!-- | ||
2 | + ~ Copyright 2015 Open Networking Laboratory | ||
3 | + ~ | ||
4 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + ~ you may not use this file except in compliance with the License. | ||
6 | + ~ You may obtain a copy of the License at | ||
7 | + ~ | ||
8 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + ~ | ||
10 | + ~ Unless required by applicable law or agreed to in writing, software | ||
11 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + ~ See the License for the specific language governing permissions and | ||
14 | + ~ limitations under the License. | ||
15 | + --> | ||
16 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
17 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
18 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
19 | + <modelVersion>4.0.0</modelVersion> | ||
20 | + <parent> | ||
21 | + <groupId>org.onosproject</groupId> | ||
22 | + <artifactId>onos-apps</artifactId> | ||
23 | + <version>1.4.0-SNAPSHOT</version> | ||
24 | + </parent> | ||
25 | + <artifactId>onos-app-iptopology-api</artifactId> | ||
26 | + <packaging>bundle</packaging> | ||
27 | + | ||
28 | + <description>IP Layer Topology API</description> | ||
29 | +</project> |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Area identifier class (32 Bit Area-ID). | ||
24 | + */ | ||
25 | +public class AreaId { | ||
26 | + private final int areaId; | ||
27 | + | ||
28 | + /** | ||
29 | + * Constructor to set area identifier. | ||
30 | + * | ||
31 | + * @param areaId area id | ||
32 | + */ | ||
33 | + public AreaId(int areaId) { | ||
34 | + this.areaId = areaId; | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * obtain area identifier. | ||
39 | + * | ||
40 | + * @return area identifier | ||
41 | + */ | ||
42 | + public int areaId() { | ||
43 | + return areaId; | ||
44 | + } | ||
45 | + | ||
46 | + @Override | ||
47 | + public int hashCode() { | ||
48 | + return Objects.hash(areaId); | ||
49 | + } | ||
50 | + | ||
51 | + @Override | ||
52 | + public boolean equals(Object obj) { | ||
53 | + if (this == obj) { | ||
54 | + return true; | ||
55 | + } | ||
56 | + | ||
57 | + if (obj instanceof AreaId) { | ||
58 | + AreaId other = (AreaId) obj; | ||
59 | + return Objects.equals(areaId, other.areaId); | ||
60 | + } | ||
61 | + return false; | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public String toString() { | ||
66 | + return toStringHelper(this) | ||
67 | + .add("areaId", areaId) | ||
68 | + .toString(); | ||
69 | + } | ||
70 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Autonomous system Number class (32 Bit ASNumber). | ||
24 | + */ | ||
25 | +public class AsNumber { | ||
26 | + private final int asNum; | ||
27 | + | ||
28 | + /** | ||
29 | + * Constructor to set As number. | ||
30 | + * | ||
31 | + * @param asNum As number | ||
32 | + */ | ||
33 | + public AsNumber(int asNum) { | ||
34 | + this.asNum = asNum; | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Obtain autonomous system number. | ||
39 | + * | ||
40 | + * @return autonomous system number | ||
41 | + */ | ||
42 | + public int asNum() { | ||
43 | + return asNum; | ||
44 | + } | ||
45 | + | ||
46 | + @Override | ||
47 | + public int hashCode() { | ||
48 | + return Objects.hash(asNum); | ||
49 | + } | ||
50 | + | ||
51 | + @Override | ||
52 | + public boolean equals(Object obj) { | ||
53 | + if (this == obj) { | ||
54 | + return true; | ||
55 | + } | ||
56 | + | ||
57 | + if (obj instanceof AsNumber) { | ||
58 | + AsNumber other = (AsNumber) obj; | ||
59 | + return Objects.equals(asNum, other.asNum); | ||
60 | + } | ||
61 | + return false; | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public String toString() { | ||
66 | + return toStringHelper(this) | ||
67 | + .add("asNum", asNum) | ||
68 | + .toString(); | ||
69 | + } | ||
70 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Represents administrative group color. | ||
24 | + * bit mask - least significant bit is referred to as 'group 0', | ||
25 | + * and the most significant bit is referred to as 'group 31' | ||
26 | + */ | ||
27 | +public class Color { | ||
28 | + private final int color; | ||
29 | + | ||
30 | + /** | ||
31 | + * Constructor to initialize its parameter. | ||
32 | + * | ||
33 | + * @param color assigned by the network administrator | ||
34 | + */ | ||
35 | + public Color(int color) { | ||
36 | + this.color = color; | ||
37 | + } | ||
38 | + | ||
39 | + /** | ||
40 | + * Obtains administrative group. | ||
41 | + * | ||
42 | + * @return administrative group | ||
43 | + */ | ||
44 | + public int color() { | ||
45 | + return color; | ||
46 | + } | ||
47 | + | ||
48 | + @Override | ||
49 | + public int hashCode() { | ||
50 | + return Objects.hash(color); | ||
51 | + } | ||
52 | + | ||
53 | + @Override | ||
54 | + public boolean equals(Object obj) { | ||
55 | + if (this == obj) { | ||
56 | + return true; | ||
57 | + } | ||
58 | + | ||
59 | + if (obj instanceof Color) { | ||
60 | + Color other = (Color) obj; | ||
61 | + return Objects.equals(color, other.color); | ||
62 | + } | ||
63 | + return false; | ||
64 | + } | ||
65 | + | ||
66 | + @Override | ||
67 | + public String toString() { | ||
68 | + return toStringHelper(this) | ||
69 | + .add("color", color) | ||
70 | + .toString(); | ||
71 | + } | ||
72 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +import org.onosproject.net.Element; | ||
23 | + | ||
24 | +/** | ||
25 | + * Default Device interface implementation. | ||
26 | + */ | ||
27 | +public class DefaultDeviceIntf implements DeviceIntf { | ||
28 | + | ||
29 | + private final Element element; | ||
30 | + private final DeviceInterface deviceInterface; | ||
31 | + | ||
32 | + /** | ||
33 | + * Constructor to initialize device interface parameters. | ||
34 | + * | ||
35 | + * @param element parent network element | ||
36 | + * @param deviceInterface device interface | ||
37 | + */ | ||
38 | + public DefaultDeviceIntf(Element element, DeviceInterface deviceInterface) { | ||
39 | + this.element = element; | ||
40 | + this.deviceInterface = deviceInterface; | ||
41 | + } | ||
42 | + | ||
43 | + @Override | ||
44 | + public Element element() { | ||
45 | + return element; | ||
46 | + } | ||
47 | + | ||
48 | + @Override | ||
49 | + public DeviceInterface deviceInterface() { | ||
50 | + return deviceInterface; | ||
51 | + } | ||
52 | + | ||
53 | + @Override | ||
54 | + public int hashCode() { | ||
55 | + return Objects.hash(element, deviceInterface); | ||
56 | + } | ||
57 | + | ||
58 | + @Override | ||
59 | + public boolean equals(Object obj) { | ||
60 | + if (this == obj) { | ||
61 | + return true; | ||
62 | + } | ||
63 | + | ||
64 | + if (obj instanceof DefaultDeviceIntf) { | ||
65 | + final DefaultDeviceIntf other = (DefaultDeviceIntf) obj; | ||
66 | + return Objects.equals(this.element.id(), other.element.id()) | ||
67 | + && Objects.equals(this.deviceInterface, other.deviceInterface); | ||
68 | + } | ||
69 | + return false; | ||
70 | + } | ||
71 | + | ||
72 | + @Override | ||
73 | + public String toString() { | ||
74 | + return toStringHelper(this) | ||
75 | + .add("element", element.id()) | ||
76 | + .add("deviceInterface", deviceInterface) | ||
77 | + .toString(); | ||
78 | + } | ||
79 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/DefaultDevicePrefix.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import org.onosproject.net.AbstractAnnotated; | ||
19 | +import org.onosproject.net.Annotations; | ||
20 | +import org.onosproject.net.Element; | ||
21 | + | ||
22 | +import java.util.Objects; | ||
23 | + | ||
24 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
25 | + | ||
26 | +/** | ||
27 | + * Default Device prefix implementation. | ||
28 | + */ | ||
29 | +public class DefaultDevicePrefix extends AbstractAnnotated implements DevicePrefix { | ||
30 | + | ||
31 | + private final Element element; | ||
32 | + private final PrefixIdentifier prefixIdentifier; | ||
33 | + private final PrefixTed prefixTed; | ||
34 | + | ||
35 | + /** | ||
36 | + * Creates a network device prefix attributed to the specified element. | ||
37 | + * | ||
38 | + * @param element parent network element | ||
39 | + * @param prefixIdentifier prefix identifier | ||
40 | + * @param prefixTed prefid traffic engineering parameters | ||
41 | + * @param annotations optional key/value annotations | ||
42 | + */ | ||
43 | + public DefaultDevicePrefix(Element element, PrefixIdentifier prefixIdentifier, | ||
44 | + PrefixTed prefixTed, Annotations... annotations) { | ||
45 | + super(annotations); | ||
46 | + this.element = element; | ||
47 | + this.prefixIdentifier = prefixIdentifier; | ||
48 | + this.prefixTed = prefixTed; | ||
49 | + } | ||
50 | + | ||
51 | + @Override | ||
52 | + public Element element() { | ||
53 | + return element; | ||
54 | + } | ||
55 | + | ||
56 | + @Override | ||
57 | + public PrefixIdentifier prefixIdentifier() { | ||
58 | + return prefixIdentifier; | ||
59 | + } | ||
60 | + | ||
61 | + @Override | ||
62 | + public PrefixTed prefixTed() { | ||
63 | + return prefixTed; | ||
64 | + } | ||
65 | + | ||
66 | + @Override | ||
67 | + public int hashCode() { | ||
68 | + return Objects.hash(element, prefixIdentifier, prefixTed); | ||
69 | + } | ||
70 | + | ||
71 | + @Override | ||
72 | + public boolean equals(Object obj) { | ||
73 | + if (this == obj) { | ||
74 | + return true; | ||
75 | + } | ||
76 | + if (obj instanceof DefaultDevicePrefix) { | ||
77 | + final DefaultDevicePrefix other = (DefaultDevicePrefix) obj; | ||
78 | + return Objects.equals(this.element.id(), other.element.id()) && | ||
79 | + Objects.equals(this.prefixIdentifier, other.prefixIdentifier) && | ||
80 | + Objects.equals(this.prefixTed, other.prefixTed) && | ||
81 | + Objects.equals(this.annotations(), other.annotations()); | ||
82 | + } | ||
83 | + return false; | ||
84 | + } | ||
85 | + | ||
86 | + @Override | ||
87 | + public String toString() { | ||
88 | + return toStringHelper(this) | ||
89 | + .omitNullValues() | ||
90 | + .add("element", element.id()) | ||
91 | + .add("prefixIdentifier", prefixIdentifier) | ||
92 | + .add("prefixTed", prefixTed) | ||
93 | + .toString(); | ||
94 | + } | ||
95 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import org.onosproject.net.AbstractElement; | ||
19 | +import org.onosproject.net.Annotations; | ||
20 | +import org.onosproject.net.DeviceId; | ||
21 | +import org.onosproject.net.provider.ProviderId; | ||
22 | + | ||
23 | +import java.util.Objects; | ||
24 | + | ||
25 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
26 | + | ||
27 | +/** | ||
28 | + * Default ip device model implementation. | ||
29 | + */ | ||
30 | +public class DefaultIpDevice extends AbstractElement implements IpDevice { | ||
31 | + | ||
32 | + private final Type type; | ||
33 | + private final IpDeviceIdentifier deviceIdentifier; | ||
34 | + private final DeviceTed deviceTed; | ||
35 | + | ||
36 | + | ||
37 | + /** | ||
38 | + * For Serialization. | ||
39 | + */ | ||
40 | + private DefaultIpDevice() { | ||
41 | + this.type = null; | ||
42 | + this.deviceIdentifier = null; | ||
43 | + this.deviceTed = null; | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * Creates a network element attributed to the specified provider. | ||
48 | + * | ||
49 | + * @param providerId identity of the provider | ||
50 | + * @param id device identifier | ||
51 | + * @param type device type | ||
52 | + * @param deviceIdentifier provides device identifier details | ||
53 | + * @param deviceTed device traffic engineering parameters | ||
54 | + * @param annotations optional key/value annotations | ||
55 | + */ | ||
56 | + public DefaultIpDevice(ProviderId providerId, DeviceId id, Type type, | ||
57 | + IpDeviceIdentifier deviceIdentifier, DeviceTed deviceTed, | ||
58 | + Annotations... annotations) { | ||
59 | + super(providerId, id, annotations); | ||
60 | + this.type = type; | ||
61 | + this.deviceIdentifier = deviceIdentifier; | ||
62 | + this.deviceTed = deviceTed; | ||
63 | + } | ||
64 | + | ||
65 | + @Override | ||
66 | + public DeviceId id() { | ||
67 | + return (DeviceId) id; | ||
68 | + } | ||
69 | + | ||
70 | + @Override | ||
71 | + public Type type() { | ||
72 | + return type; | ||
73 | + } | ||
74 | + | ||
75 | + @Override | ||
76 | + public IpDeviceIdentifier deviceIdentifier() { | ||
77 | + return deviceIdentifier; | ||
78 | + } | ||
79 | + | ||
80 | + @Override | ||
81 | + public DeviceTed deviceTed() { | ||
82 | + return deviceTed; } | ||
83 | + | ||
84 | + @Override | ||
85 | + public int hashCode() { | ||
86 | + return Objects.hash(type, deviceIdentifier, deviceTed); | ||
87 | + } | ||
88 | + | ||
89 | + @Override | ||
90 | + public boolean equals(Object obj) { | ||
91 | + if (this == obj) { | ||
92 | + return true; | ||
93 | + } | ||
94 | + | ||
95 | + if (obj instanceof DefaultIpDevice) { | ||
96 | + final DefaultIpDevice other = (DefaultIpDevice) obj; | ||
97 | + return Objects.equals(this.id, other.id) && | ||
98 | + Objects.equals(this.type, other.type) && | ||
99 | + Objects.equals(this.deviceIdentifier, other.deviceIdentifier) && | ||
100 | + Objects.equals(this.deviceTed, other.deviceTed); | ||
101 | + } | ||
102 | + return false; | ||
103 | + } | ||
104 | + @Override | ||
105 | + public String toString() { | ||
106 | + return toStringHelper(this) | ||
107 | + .omitNullValues() | ||
108 | + .add("id", id) | ||
109 | + .add("deviceIdentifier", deviceIdentifier) | ||
110 | + .add("deviceTed", deviceTed) | ||
111 | + .toString(); | ||
112 | + } | ||
113 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import org.onosproject.net.AbstractModel; | ||
19 | +import org.onosproject.net.Annotations; | ||
20 | +import org.onosproject.net.provider.ProviderId; | ||
21 | + | ||
22 | +import java.util.Objects; | ||
23 | + | ||
24 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
25 | + | ||
26 | +/** | ||
27 | + * This class provides Link identifier and link ted details. | ||
28 | + */ | ||
29 | +public class DefaultIpLink extends AbstractModel implements IpLink { | ||
30 | + | ||
31 | + private final TerminationPoint src; | ||
32 | + private final TerminationPoint dst; | ||
33 | + private final IpLinkIdentifier linkIdentifier; | ||
34 | + private final LinkTed linkTed; | ||
35 | + | ||
36 | + /** | ||
37 | + * Constructor to initialize its parameters. | ||
38 | + * | ||
39 | + * @param src link source termination point | ||
40 | + * @param dst link destination termination point | ||
41 | + * @param linkIdentifier provides link identifier details | ||
42 | + * @param linkTed provides link traffic engineering details | ||
43 | + * @param annotations optional key/value annotations | ||
44 | + */ | ||
45 | + public DefaultIpLink(ProviderId providerId, TerminationPoint src, TerminationPoint dst, | ||
46 | + IpLinkIdentifier linkIdentifier, LinkTed linkTed, | ||
47 | + Annotations... annotations) { | ||
48 | + super(providerId, annotations); | ||
49 | + this.src = src; | ||
50 | + this.dst = dst; | ||
51 | + this.linkIdentifier = linkIdentifier; | ||
52 | + this.linkTed = linkTed; | ||
53 | + } | ||
54 | + | ||
55 | + @Override | ||
56 | + public TerminationPoint src() { | ||
57 | + return src; | ||
58 | + } | ||
59 | + | ||
60 | + @Override | ||
61 | + public TerminationPoint dst() { | ||
62 | + return dst; | ||
63 | + } | ||
64 | + | ||
65 | + @Override | ||
66 | + public IpLinkIdentifier linkIdentifier() { | ||
67 | + return linkIdentifier; | ||
68 | + } | ||
69 | + | ||
70 | + @Override | ||
71 | + public LinkTed linkTed() { | ||
72 | + return linkTed; | ||
73 | + } | ||
74 | + | ||
75 | + @Override | ||
76 | + public int hashCode() { | ||
77 | + return Objects.hash(src, dst, linkIdentifier, linkTed); | ||
78 | + } | ||
79 | + | ||
80 | + @Override | ||
81 | + public boolean equals(Object obj) { | ||
82 | + if (this == obj) { | ||
83 | + return true; | ||
84 | + } | ||
85 | + if (obj instanceof DefaultIpLink) { | ||
86 | + final DefaultIpLink other = (DefaultIpLink) obj; | ||
87 | + return Objects.equals(this.src, other.src) && | ||
88 | + Objects.equals(this.dst, other.dst) && | ||
89 | + Objects.equals(this.linkIdentifier, other.linkIdentifier) && | ||
90 | + Objects.equals(this.linkTed, other.linkTed); | ||
91 | + } | ||
92 | + return false; | ||
93 | + } | ||
94 | + | ||
95 | + @Override | ||
96 | + public String toString() { | ||
97 | + return toStringHelper(this) | ||
98 | + .omitNullValues() | ||
99 | + .add("src", src) | ||
100 | + .add("dst", dst) | ||
101 | + .add("linkIdentifier", linkIdentifier) | ||
102 | + .add("linkTed", linkTed) | ||
103 | + .toString(); | ||
104 | + } | ||
105 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import java.util.Objects; | ||
19 | + | ||
20 | +import org.onlab.packet.Ip4Address; | ||
21 | +import org.onlab.packet.Ip6Address; | ||
22 | + | ||
23 | +import com.google.common.base.MoreObjects; | ||
24 | + | ||
25 | +/** | ||
26 | + * Representation of device interface. | ||
27 | + */ | ||
28 | +public class DeviceInterface { | ||
29 | + private final Ip4Address ip4Address; | ||
30 | + private final Ip6Address ip6Address; | ||
31 | + private final InterfaceIdentifier interfaceId; | ||
32 | + | ||
33 | + /** | ||
34 | + * Constructor to initialize its parameter. | ||
35 | + * | ||
36 | + * @param ip4Address ipv4 interface address | ||
37 | + * @param ip6Address ipv6 interface address | ||
38 | + * @param interfaceId interface Identifier | ||
39 | + */ | ||
40 | + public DeviceInterface(Ip4Address ip4Address, Ip6Address ip6Address, InterfaceIdentifier interfaceId) { | ||
41 | + this.ip4Address = ip4Address; | ||
42 | + this.ip6Address = ip6Address; | ||
43 | + this.interfaceId = interfaceId; | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * obtains ipv4 address of an interface. | ||
48 | + * | ||
49 | + * @return ipv4 interface address | ||
50 | + */ | ||
51 | + public Ip4Address ip4Address() { | ||
52 | + return ip4Address; | ||
53 | + } | ||
54 | + | ||
55 | + /** | ||
56 | + * obtains ipv6 interface address. | ||
57 | + * | ||
58 | + * @return ipv6 interface address | ||
59 | + */ | ||
60 | + public Ip6Address ip6Address() { | ||
61 | + return ip6Address; | ||
62 | + } | ||
63 | + | ||
64 | + /** | ||
65 | + * obtains interface identifier. | ||
66 | + * | ||
67 | + * @return interface identifier | ||
68 | + */ | ||
69 | + public InterfaceIdentifier interfaceId() { | ||
70 | + return interfaceId; | ||
71 | + } | ||
72 | + | ||
73 | + @Override | ||
74 | + public int hashCode() { | ||
75 | + return Objects.hash(ip4Address, ip6Address, interfaceId); | ||
76 | + } | ||
77 | + | ||
78 | + @Override | ||
79 | + public boolean equals(Object obj) { | ||
80 | + if (this == obj) { | ||
81 | + return true; | ||
82 | + } | ||
83 | + if (obj instanceof DeviceInterface) { | ||
84 | + final DeviceInterface other = (DeviceInterface) obj; | ||
85 | + return Objects.equals(this.ip4Address, other.ip4Address) | ||
86 | + && Objects.equals(this.ip6Address, other.ip6Address) | ||
87 | + && Objects.equals(this.interfaceId, other.interfaceId); | ||
88 | + } | ||
89 | + return false; | ||
90 | + } | ||
91 | + | ||
92 | + @Override | ||
93 | + public String toString() { | ||
94 | + return MoreObjects.toStringHelper(this) | ||
95 | + .add("ip4Address", ip4Address) | ||
96 | + .add("ip6Address", ip6Address) | ||
97 | + .add("interfaceId", interfaceId) | ||
98 | + .toString(); | ||
99 | + } | ||
100 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import org.onosproject.net.Element; | ||
19 | + | ||
20 | +/** | ||
21 | + * Abstraction of Device interface. | ||
22 | + */ | ||
23 | +public interface DeviceIntf { | ||
24 | + /** | ||
25 | + * Returns the parent network element to which this interface belongs. | ||
26 | + * | ||
27 | + * @return parent network element | ||
28 | + */ | ||
29 | + Element element(); | ||
30 | + | ||
31 | + /** | ||
32 | + * Returns device interface details. | ||
33 | + * | ||
34 | + * @return device interface details | ||
35 | + */ | ||
36 | + DeviceInterface deviceInterface(); | ||
37 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import org.onosproject.net.Annotated; | ||
19 | +import org.onosproject.net.Element; | ||
20 | + | ||
21 | +/** | ||
22 | + * Abstraction of Device Prefix. | ||
23 | + */ | ||
24 | +public interface DevicePrefix extends Annotated { | ||
25 | + | ||
26 | + /** | ||
27 | + * Returns the parent network element to which this port belongs. | ||
28 | + * | ||
29 | + * @return parent network element | ||
30 | + */ | ||
31 | + Element element(); | ||
32 | + | ||
33 | + /** | ||
34 | + * Returns prefix identifier details. | ||
35 | + * | ||
36 | + * @return prefix identifier details | ||
37 | + */ | ||
38 | + PrefixIdentifier prefixIdentifier(); | ||
39 | + | ||
40 | + /** | ||
41 | + * Returns prefix Traffic engineering parameters. | ||
42 | + * | ||
43 | + * @return prefix Traffic engineering parameters | ||
44 | + */ | ||
45 | + PrefixTed prefixTed(); | ||
46 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Iterator; | ||
21 | +import java.util.List; | ||
22 | +import java.util.Objects; | ||
23 | + | ||
24 | +import org.onlab.packet.Ip4Address; | ||
25 | +import org.onlab.packet.Ip6Address; | ||
26 | + | ||
27 | +/** | ||
28 | + * Represents Device Traffic Engineering parameters. | ||
29 | + */ | ||
30 | +public class DeviceTed { | ||
31 | + private final List<Ip4Address> ipv4RouterIds; | ||
32 | + private final List<Ip6Address> ipv6RouterIds; | ||
33 | + private final List<TopologyId> topologyIds; | ||
34 | + private final Position position; | ||
35 | + | ||
36 | + /** | ||
37 | + * Constructor to initialize the parameter fields. | ||
38 | + * | ||
39 | + * @param ipv4RouterIds Router ids of Ipv4 | ||
40 | + * @param ipv6RouterIds Router ids of Ipv6 | ||
41 | + * @param topologyIds list of multi-topology IDs of the node | ||
42 | + * @param position of router whether it is ABR or ASBR | ||
43 | + */ | ||
44 | + public DeviceTed(List<Ip4Address> ipv4RouterIds, List<Ip6Address> ipv6RouterIds, | ||
45 | + List<TopologyId> topologyIds, Position position) { | ||
46 | + this.ipv4RouterIds = ipv4RouterIds; | ||
47 | + this.ipv6RouterIds = ipv6RouterIds; | ||
48 | + this.topologyIds = topologyIds; | ||
49 | + this.position = position; | ||
50 | + } | ||
51 | + | ||
52 | + /** | ||
53 | + * Obtain list of Ipv4 Router id. | ||
54 | + * | ||
55 | + * @return Ipv4 Router ids | ||
56 | + */ | ||
57 | + public List<Ip4Address> ipv4RouterIds() { | ||
58 | + return ipv4RouterIds; | ||
59 | + } | ||
60 | + | ||
61 | + /** | ||
62 | + * Obtain list of Ipv6 Router id. | ||
63 | + * | ||
64 | + * @return Ipv6 Router ids | ||
65 | + */ | ||
66 | + public List<Ip6Address> ipv6RouterIds() { | ||
67 | + return ipv6RouterIds; | ||
68 | + } | ||
69 | + | ||
70 | + /** | ||
71 | + * Obtain the list of topology ID's. | ||
72 | + * | ||
73 | + * @return list of topology id's | ||
74 | + */ | ||
75 | + public List<TopologyId> topologyIds() { | ||
76 | + return topologyIds; | ||
77 | + } | ||
78 | + | ||
79 | + | ||
80 | + /** | ||
81 | + * Obtain position of device in the network. | ||
82 | + * | ||
83 | + * @return position of device in the network | ||
84 | + */ | ||
85 | + public Position position() { | ||
86 | + return position; | ||
87 | + } | ||
88 | + | ||
89 | + @Override | ||
90 | + public int hashCode() { | ||
91 | + return Objects.hash(ipv4RouterIds, ipv6RouterIds, topologyIds, position); | ||
92 | + } | ||
93 | + | ||
94 | + @Override | ||
95 | + public boolean equals(Object obj) { | ||
96 | + if (this == obj) { | ||
97 | + return true; | ||
98 | + } | ||
99 | + | ||
100 | + if (obj instanceof DeviceTed) { | ||
101 | + int countObjSubTlv = 0; | ||
102 | + int countOtherSubTlv = 0; | ||
103 | + int countObjTopologyId = 0; | ||
104 | + int countOtherTopologyId = 0; | ||
105 | + boolean isCommonSubTlv = true; | ||
106 | + boolean isCommonSubTlv6 = true; | ||
107 | + boolean isCommonTopology = true; | ||
108 | + DeviceTed other = (DeviceTed) obj; | ||
109 | + Iterator<Ip4Address> objListIterator = other.ipv4RouterIds.iterator(); | ||
110 | + countOtherSubTlv = other.ipv4RouterIds.size(); | ||
111 | + countObjSubTlv = ipv4RouterIds.size(); | ||
112 | + | ||
113 | + Iterator<Ip6Address> objListIteratorIpv6 = other.ipv6RouterIds.iterator(); | ||
114 | + int countOtherSubTlv6 = other.ipv6RouterIds.size(); | ||
115 | + int countObjSubTlv6 = ipv6RouterIds.size(); | ||
116 | + | ||
117 | + Iterator<TopologyId> topologyId = other.topologyIds.iterator(); | ||
118 | + countOtherTopologyId = other.topologyIds.size(); | ||
119 | + countObjTopologyId = topologyIds.size(); | ||
120 | + | ||
121 | + if (countObjSubTlv != countOtherSubTlv || countOtherSubTlv6 != countObjSubTlv6 | ||
122 | + || countObjTopologyId != countOtherTopologyId) { | ||
123 | + return false; | ||
124 | + } else { | ||
125 | + while (objListIterator.hasNext() && isCommonSubTlv) { | ||
126 | + Ip4Address subTlv = objListIterator.next(); | ||
127 | + //find index of that element and then get that from the list and then compare | ||
128 | + if (ipv4RouterIds.contains(subTlv) && other.ipv4RouterIds.contains(subTlv)) { | ||
129 | + isCommonSubTlv = Objects.equals(ipv4RouterIds.get(ipv4RouterIds.indexOf(subTlv)), | ||
130 | + other.ipv4RouterIds.get(other.ipv4RouterIds.indexOf(subTlv))); | ||
131 | + } else { | ||
132 | + isCommonSubTlv = false; | ||
133 | + } | ||
134 | + } | ||
135 | + while (objListIteratorIpv6.hasNext() && isCommonSubTlv6) { | ||
136 | + Ip6Address subTlv = objListIteratorIpv6.next(); | ||
137 | + //find index of that element and then get that from the list and then compare | ||
138 | + if (ipv6RouterIds.contains(subTlv) && other.ipv6RouterIds.contains(subTlv)) { | ||
139 | + isCommonSubTlv6 = Objects.equals(ipv6RouterIds.get(ipv6RouterIds.indexOf(subTlv)), | ||
140 | + other.ipv6RouterIds.get(other.ipv6RouterIds.indexOf(subTlv))); | ||
141 | + } else { | ||
142 | + isCommonSubTlv6 = false; | ||
143 | + } | ||
144 | + } | ||
145 | + while (topologyId.hasNext() && isCommonTopology) { | ||
146 | + TopologyId subTlv = topologyId.next(); | ||
147 | + //find index of that element and then get that from the list and then compare | ||
148 | + if (topologyIds.contains(subTlv) && other.topologyIds.contains(subTlv)) { | ||
149 | + isCommonTopology = Objects.equals(topologyIds.get(topologyIds.indexOf(subTlv)), | ||
150 | + other.topologyIds.get(other.topologyIds.indexOf(subTlv))); | ||
151 | + } else { | ||
152 | + isCommonTopology = false; | ||
153 | + } | ||
154 | + } | ||
155 | + return isCommonSubTlv && isCommonSubTlv6 && isCommonTopology | ||
156 | + && Objects.equals(position, other.position); | ||
157 | + } | ||
158 | + } | ||
159 | + return false; | ||
160 | + } | ||
161 | + | ||
162 | + @Override | ||
163 | + public String toString() { | ||
164 | + return toStringHelper(this) | ||
165 | + .omitNullValues() | ||
166 | + .add("ipv6RouterIds", ipv6RouterIds) | ||
167 | + .add("ipv4RouterIds", ipv4RouterIds) | ||
168 | + .add("topologyIds", topologyIds) | ||
169 | + .add("position", position) | ||
170 | + .toString(); | ||
171 | + } | ||
172 | + | ||
173 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | + | ||
17 | +package org.onosproject.iptopology.api; | ||
18 | + | ||
19 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
20 | + | ||
21 | +import java.util.Objects; | ||
22 | + | ||
23 | +/** | ||
24 | + * Domain Identifier(32 Bit). | ||
25 | + */ | ||
26 | +public class DomainId { | ||
27 | + private final int domainIdentifier; | ||
28 | + | ||
29 | + /** | ||
30 | + * Constructor to initialize domain identifier. | ||
31 | + * | ||
32 | + * @param domainIdentifier domain identifier | ||
33 | + */ | ||
34 | + public DomainId(int domainIdentifier) { | ||
35 | + this.domainIdentifier = domainIdentifier; | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * Obtain domain identifier. | ||
40 | + * | ||
41 | + * @return domain identifier | ||
42 | + */ | ||
43 | + public int domainIdentifier() { | ||
44 | + return domainIdentifier; | ||
45 | + } | ||
46 | + | ||
47 | + @Override | ||
48 | + public int hashCode() { | ||
49 | + return Objects.hash(domainIdentifier); | ||
50 | + } | ||
51 | + | ||
52 | + @Override | ||
53 | + public boolean equals(Object obj) { | ||
54 | + if (this == obj) { | ||
55 | + return true; | ||
56 | + } | ||
57 | + | ||
58 | + if (obj instanceof DomainId) { | ||
59 | + DomainId other = (DomainId) obj; | ||
60 | + return Objects.equals(domainIdentifier, other.domainIdentifier); | ||
61 | + } | ||
62 | + return false; | ||
63 | + } | ||
64 | + | ||
65 | + @Override | ||
66 | + public String toString() { | ||
67 | + return toStringHelper(this) | ||
68 | + .add("domainIdentifier", domainIdentifier) | ||
69 | + .toString(); | ||
70 | + } | ||
71 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Represents the extended igp administrative tags of the prefix. | ||
24 | + */ | ||
25 | +public class ExtendedRouteTag { | ||
26 | + private final long extRouteTag; | ||
27 | + | ||
28 | + /** | ||
29 | + * Constructor to initialize its parameter. | ||
30 | + * | ||
31 | + * @param extRouteTag extended ISIS route tag | ||
32 | + */ | ||
33 | + public ExtendedRouteTag(long extRouteTag) { | ||
34 | + this.extRouteTag = extRouteTag; | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Obtains extended igp administrative tags. | ||
39 | + * | ||
40 | + * @return extended igp administrative tags | ||
41 | + */ | ||
42 | + public long extRouteTag() { | ||
43 | + return extRouteTag; | ||
44 | + } | ||
45 | + | ||
46 | + @Override | ||
47 | + public int hashCode() { | ||
48 | + return Objects.hash(extRouteTag); | ||
49 | + } | ||
50 | + | ||
51 | + @Override | ||
52 | + public boolean equals(Object obj) { | ||
53 | + if (this == obj) { | ||
54 | + return true; | ||
55 | + } | ||
56 | + | ||
57 | + if (obj instanceof ExtendedRouteTag) { | ||
58 | + ExtendedRouteTag other = (ExtendedRouteTag) obj; | ||
59 | + return Objects.equals(extRouteTag, other.extRouteTag); | ||
60 | + } | ||
61 | + return false; | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public String toString() { | ||
66 | + return toStringHelper(this) | ||
67 | + .add("extRouteTag", extRouteTag) | ||
68 | + .toString(); | ||
69 | + } | ||
70 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * This class provides implementation IS-IS and OSPF flags assigned to the prefix. | ||
24 | + */ | ||
25 | +public class IgpFlags { | ||
26 | + private final boolean isisUpDown; | ||
27 | + private final boolean ospfNoUnicast; | ||
28 | + private final boolean ospfLclAddr; | ||
29 | + private final boolean ospfNssa; | ||
30 | + | ||
31 | + /** | ||
32 | + * Constructor to initialize its parameters. | ||
33 | + * | ||
34 | + * @param isisUpDown IS-IS Up/Down | ||
35 | + * @param ospfNoUnicast OSPF no unicast | ||
36 | + * @param ospfLclAddr OSPF local address | ||
37 | + * @param ospfNssa OSPF propagate NSSA | ||
38 | + */ | ||
39 | + public IgpFlags(boolean isisUpDown, boolean ospfNoUnicast, boolean ospfLclAddr, | ||
40 | + boolean ospfNssa) { | ||
41 | + this.isisUpDown = isisUpDown; | ||
42 | + this.ospfNoUnicast = ospfNoUnicast; | ||
43 | + this.ospfLclAddr = ospfLclAddr; | ||
44 | + this.ospfNssa = ospfNssa; | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * Provides information whether IS-IS is Up/Down. | ||
49 | + * | ||
50 | + * @return IS-IS Up/Down bit enabled or not | ||
51 | + */ | ||
52 | + public boolean isisUpDown() { | ||
53 | + return isisUpDown; | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * Provides information whether OSPF is unicast or not. | ||
58 | + * | ||
59 | + * @return OSPF no unicast Bit set or not | ||
60 | + */ | ||
61 | + public boolean ospfNoUnicast() { | ||
62 | + return ospfNoUnicast; | ||
63 | + } | ||
64 | + | ||
65 | + /** | ||
66 | + * Provides information on OSPF local address. | ||
67 | + * | ||
68 | + * @return OSPF local address Bit set or not | ||
69 | + */ | ||
70 | + public boolean ospfLclAddr() { | ||
71 | + return ospfLclAddr; | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * Provides information on OSPF propagate NSSA. | ||
76 | + * | ||
77 | + * @return OSPF propagate NSSA Bit set or not | ||
78 | + */ | ||
79 | + public boolean ospfNssa() { | ||
80 | + return ospfNssa; | ||
81 | + } | ||
82 | + | ||
83 | + @Override | ||
84 | + public int hashCode() { | ||
85 | + return Objects.hash(isisUpDown, ospfNoUnicast, ospfLclAddr, | ||
86 | + ospfNssa); | ||
87 | + } | ||
88 | + | ||
89 | + @Override | ||
90 | + public boolean equals(Object obj) { | ||
91 | + if (this == obj) { | ||
92 | + return true; | ||
93 | + } | ||
94 | + | ||
95 | + if (obj instanceof IgpFlags) { | ||
96 | + IgpFlags other = (IgpFlags) obj; | ||
97 | + return Objects.equals(isisUpDown, other.isisUpDown) | ||
98 | + && Objects.equals(ospfNoUnicast, other.ospfNoUnicast) | ||
99 | + && Objects.equals(ospfLclAddr, other.ospfLclAddr) | ||
100 | + && Objects.equals(ospfNssa, other.ospfNssa); | ||
101 | + } | ||
102 | + return false; | ||
103 | + } | ||
104 | + | ||
105 | + @Override | ||
106 | + public String toString() { | ||
107 | + return toStringHelper(this) | ||
108 | + .add("isisUpDown", isisUpDown) | ||
109 | + .add("ospfNoUnicast", ospfNoUnicast) | ||
110 | + .add("ospfLclAddr", ospfLclAddr) | ||
111 | + .add("ospfNssa", ospfNssa) | ||
112 | + .toString(); | ||
113 | + } | ||
114 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/InterfaceIdentifier.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * This class provides information on Local Interface Identifier and Remote | ||
24 | + * Interface Identifier of the link. | ||
25 | + */ | ||
26 | +public class InterfaceIdentifier { | ||
27 | + private final Integer identifier; | ||
28 | + | ||
29 | + /** | ||
30 | + * Constructor to initialize identifier. | ||
31 | + * | ||
32 | + * @param identifier local/remote interface identifier | ||
33 | + */ | ||
34 | + public InterfaceIdentifier(Integer identifier) { | ||
35 | + this.identifier = identifier; | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * Provides the local/remote interface identifier of the link. | ||
40 | + * | ||
41 | + * @return interface identifier | ||
42 | + */ | ||
43 | + public Integer identifier() { | ||
44 | + return identifier; | ||
45 | + } | ||
46 | + | ||
47 | + @Override | ||
48 | + public int hashCode() { | ||
49 | + return Objects.hash(identifier); | ||
50 | + } | ||
51 | + | ||
52 | + @Override | ||
53 | + public boolean equals(Object obj) { | ||
54 | + if (this == obj) { | ||
55 | + return true; | ||
56 | + } | ||
57 | + | ||
58 | + if (obj instanceof InterfaceIdentifier) { | ||
59 | + InterfaceIdentifier other = (InterfaceIdentifier) obj; | ||
60 | + return Objects.equals(identifier, other.identifier); | ||
61 | + } | ||
62 | + return false; | ||
63 | + } | ||
64 | + | ||
65 | + @Override | ||
66 | + public String toString() { | ||
67 | + return toStringHelper(this) | ||
68 | + .add("identifier", identifier) | ||
69 | + .toString(); | ||
70 | + } | ||
71 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import org.onosproject.net.DeviceId; | ||
19 | +import org.onosproject.net.Element; | ||
20 | + | ||
21 | +/** | ||
22 | + * Abstraction of Ip Device. | ||
23 | + */ | ||
24 | +public interface IpDevice extends Element { | ||
25 | + /** | ||
26 | + ** Enum type to store Device Type. | ||
27 | + */ | ||
28 | + enum Type { | ||
29 | + /** | ||
30 | + * Signifies that the device is pseudo device. | ||
31 | + */ | ||
32 | + PSEUDO, | ||
33 | + | ||
34 | + /** | ||
35 | + * Signifies that the device is non-pseudo device. | ||
36 | + */ | ||
37 | + NONPSEUDO; | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * Obtains device id. | ||
42 | + * | ||
43 | + * @return device id | ||
44 | + */ | ||
45 | + @Override | ||
46 | + DeviceId id(); | ||
47 | + | ||
48 | + /** | ||
49 | + * Obtains device type. | ||
50 | + * | ||
51 | + * @return device type | ||
52 | + */ | ||
53 | + Type type(); | ||
54 | + | ||
55 | + /** | ||
56 | + * Obtains Device identifier details. | ||
57 | + * | ||
58 | + * @return identifier of the device | ||
59 | + */ | ||
60 | + IpDeviceIdentifier deviceIdentifier(); | ||
61 | + | ||
62 | + /** | ||
63 | + * Obtains the traffic engineering parameters of the device. | ||
64 | + * | ||
65 | + * @return traffic engineering parameters of the device | ||
66 | + */ | ||
67 | + DeviceTed deviceTed(); | ||
68 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Represents IP Device Identifiers. | ||
24 | + */ | ||
25 | +public class IpDeviceIdentifier { | ||
26 | + | ||
27 | + private final RouteDistinguisher routeDish; | ||
28 | + private final RouteInstance routeInstance; | ||
29 | + private final AsNumber asNum; | ||
30 | + private final DomainId domainIdentifier; | ||
31 | + private final AreaId areaId; | ||
32 | + private final RouteIdentifier routerIdentifier; | ||
33 | + | ||
34 | + /** | ||
35 | + * Constructor to initialize parameters. | ||
36 | + * | ||
37 | + * @param routeInstance routing protocol instance | ||
38 | + * @param asNum AS number | ||
39 | + * @param domainIdentifier BGP-LS domain | ||
40 | + * @param areaId Area ID | ||
41 | + * @param routerIdentifier IGP router ID | ||
42 | + */ | ||
43 | + public IpDeviceIdentifier(RouteDistinguisher routeDish, RouteInstance routeInstance, AsNumber asNum, | ||
44 | + DomainId domainIdentifier, AreaId areaId, RouteIdentifier routerIdentifier) { | ||
45 | + this.routeDish = routeDish; | ||
46 | + this.areaId = areaId; | ||
47 | + this.asNum = asNum; | ||
48 | + this.domainIdentifier = domainIdentifier; | ||
49 | + this.routeInstance = routeInstance; | ||
50 | + this.routerIdentifier = routerIdentifier; | ||
51 | + } | ||
52 | + | ||
53 | + /** | ||
54 | + * Obtains Route Distinguisher of Ip Device. | ||
55 | + * | ||
56 | + * @return Area ID | ||
57 | + */ | ||
58 | + public RouteDistinguisher routeDish() { | ||
59 | + return routeDish; | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * Obtains Area ID if Ip Device. | ||
64 | + * | ||
65 | + * @return Area ID | ||
66 | + */ | ||
67 | + public AreaId areaId() { | ||
68 | + return areaId; | ||
69 | + } | ||
70 | + | ||
71 | + /** | ||
72 | + * Obtains AS number of Ip Device. | ||
73 | + * | ||
74 | + * @return AS number | ||
75 | + */ | ||
76 | + public AsNumber asNum() { | ||
77 | + return asNum; | ||
78 | + } | ||
79 | + | ||
80 | + /** | ||
81 | + * Obtains domain identifier of Ip Device. | ||
82 | + * | ||
83 | + * @return domain identifier | ||
84 | + */ | ||
85 | + public DomainId domainIdentifier() { | ||
86 | + return domainIdentifier; | ||
87 | + } | ||
88 | + | ||
89 | + /** | ||
90 | + * Obtains Router id of Ip Device. | ||
91 | + * | ||
92 | + * @return Router id | ||
93 | + */ | ||
94 | + public RouteIdentifier routerIdentifier() { | ||
95 | + return routerIdentifier; | ||
96 | + } | ||
97 | + | ||
98 | + /** | ||
99 | + * Obtains routing protocol instance. | ||
100 | + * | ||
101 | + * @return routing protocol instance | ||
102 | + */ | ||
103 | + public RouteInstance routeInstance() { | ||
104 | + return routeInstance; | ||
105 | + } | ||
106 | + | ||
107 | + @Override | ||
108 | + public int hashCode() { | ||
109 | + return Objects.hash(routeDish, areaId, asNum, domainIdentifier, routerIdentifier, routeInstance); | ||
110 | + } | ||
111 | + | ||
112 | + @Override | ||
113 | + public boolean equals(Object obj) { | ||
114 | + if (this == obj) { | ||
115 | + return true; | ||
116 | + } | ||
117 | + | ||
118 | + if (obj instanceof IpDeviceIdentifier) { | ||
119 | + IpDeviceIdentifier other = (IpDeviceIdentifier) obj; | ||
120 | + return Objects.equals(areaId, other.areaId) && Objects.equals(asNum, other.asNum) | ||
121 | + && Objects.equals(domainIdentifier, other.domainIdentifier) | ||
122 | + && Objects.equals(routerIdentifier, other.routerIdentifier) | ||
123 | + && Objects.equals(routeInstance, other.routeInstance) | ||
124 | + && Objects.equals(routeDish, other.routeDish); | ||
125 | + } | ||
126 | + return false; | ||
127 | + } | ||
128 | + | ||
129 | + @Override | ||
130 | + public String toString() { | ||
131 | + return toStringHelper(this) | ||
132 | + .omitNullValues() | ||
133 | + .add("areaId", areaId) | ||
134 | + .add("asNum", asNum) | ||
135 | + .add("domainIdentifier", domainIdentifier) | ||
136 | + .add("routerIdentifier", routerIdentifier) | ||
137 | + .add("routeInstance", routeInstance) | ||
138 | + .add("routeDish", routeDish) | ||
139 | + .toString(); | ||
140 | + } | ||
141 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import org.onosproject.net.Annotated; | ||
19 | +import org.onosproject.net.NetworkResource; | ||
20 | +import org.onosproject.net.Provided; | ||
21 | + | ||
22 | +/** | ||
23 | + * Abstraction of a network ip link. | ||
24 | + */ | ||
25 | +public interface IpLink extends Annotated, Provided, NetworkResource { | ||
26 | + | ||
27 | + /** | ||
28 | + * Returns source termination point of link. | ||
29 | + * | ||
30 | + * @return source termination point of link | ||
31 | + */ | ||
32 | + TerminationPoint src(); | ||
33 | + | ||
34 | + /** | ||
35 | + * Returns destination termination point of link. | ||
36 | + * | ||
37 | + * @return destination termination point of link | ||
38 | + */ | ||
39 | + TerminationPoint dst(); | ||
40 | + | ||
41 | + /** | ||
42 | + * Returns link identifier details. | ||
43 | + * | ||
44 | + * @return link identifier details | ||
45 | + */ | ||
46 | + IpLinkIdentifier linkIdentifier(); | ||
47 | + | ||
48 | + /** | ||
49 | + * Returns the link traffic engineering parameters. | ||
50 | + * | ||
51 | + * @return links traffic engineering parameters | ||
52 | + */ | ||
53 | + LinkTed linkTed(); | ||
54 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +import org.onlab.packet.Ip4Address; | ||
23 | +import org.onlab.packet.Ip6Address; | ||
24 | + | ||
25 | +/** | ||
26 | + * Represents Ip Link Identifier. | ||
27 | + */ | ||
28 | +public class IpLinkIdentifier { | ||
29 | + private final InterfaceIdentifier localIndentifier; | ||
30 | + private final InterfaceIdentifier remoteIndentifier; | ||
31 | + private final Ip4Address localIpv4Addr; | ||
32 | + private final Ip4Address remoteIpv4Addr; | ||
33 | + private final Ip6Address localIpv6Addr; | ||
34 | + private final Ip6Address remoteIpv6Addr; | ||
35 | + private final TopologyId topologyId; | ||
36 | + | ||
37 | + /** | ||
38 | + * Constructor to initialize its parameters. | ||
39 | + * | ||
40 | + * @param localIndentifier local interface identifier of the link | ||
41 | + * @param remoteIndentifier remote interface identifier of the link | ||
42 | + * @param localIpv4Addr local IPv4 address of the link | ||
43 | + * @param remoteIpv4Addr remote IPv4 address of the link | ||
44 | + * @param localIpv6Addr local IPv6 address of the link | ||
45 | + * @param remoteIpv6Addr remote IPv6 address of the link | ||
46 | + * @param topologyId link topology identifier | ||
47 | + */ | ||
48 | + public IpLinkIdentifier(InterfaceIdentifier localIndentifier, InterfaceIdentifier remoteIndentifier, | ||
49 | + Ip4Address localIpv4Addr, Ip4Address remoteIpv4Addr, Ip6Address localIpv6Addr, | ||
50 | + Ip6Address remoteIpv6Addr, TopologyId topologyId) { | ||
51 | + this.localIndentifier = localIndentifier; | ||
52 | + this.remoteIndentifier = remoteIndentifier; | ||
53 | + this.localIpv4Addr = localIpv4Addr; | ||
54 | + this.remoteIpv4Addr = remoteIpv4Addr; | ||
55 | + this.localIpv6Addr = localIpv6Addr; | ||
56 | + this.remoteIpv6Addr = remoteIpv6Addr; | ||
57 | + this.topologyId = topologyId; | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * Obtains link local identifier. | ||
62 | + * | ||
63 | + * @return link local identifier | ||
64 | + */ | ||
65 | + public InterfaceIdentifier localIndentifier() { | ||
66 | + return localIndentifier; | ||
67 | + } | ||
68 | + | ||
69 | + /** | ||
70 | + * Obtains link local identifier. | ||
71 | + * | ||
72 | + * @return link local identifier | ||
73 | + */ | ||
74 | + public InterfaceIdentifier remoteIndentifier() { | ||
75 | + return remoteIndentifier; | ||
76 | + } | ||
77 | + | ||
78 | + /** | ||
79 | + * Obtains local IPv4 address of the link. | ||
80 | + * | ||
81 | + * @return local IPv4 address of the link | ||
82 | + */ | ||
83 | + public Ip4Address localIpv4Addr() { | ||
84 | + return localIpv4Addr; | ||
85 | + } | ||
86 | + | ||
87 | + /** | ||
88 | + * Obtains remote IPv4 address of the link. | ||
89 | + * | ||
90 | + * @return remote IPv4 address of the link | ||
91 | + */ | ||
92 | + public Ip4Address remoteIpv4Addr() { | ||
93 | + return remoteIpv4Addr; | ||
94 | + } | ||
95 | + | ||
96 | + /** | ||
97 | + * Obtains local IPv6 address of the link. | ||
98 | + * | ||
99 | + * @return local IPv6 address of the link | ||
100 | + */ | ||
101 | + public Ip6Address localIpv6Addr() { | ||
102 | + return localIpv6Addr; | ||
103 | + } | ||
104 | + | ||
105 | + /** | ||
106 | + * Obtains remote IPv6 address of the link. | ||
107 | + * | ||
108 | + * @return remote IPv6 address of the link | ||
109 | + */ | ||
110 | + public Ip6Address remoteIpv6Addr() { | ||
111 | + return remoteIpv6Addr; | ||
112 | + } | ||
113 | + | ||
114 | + /** | ||
115 | + * Obtains Topology ID of the link. | ||
116 | + * | ||
117 | + * @return Topology ID of the link | ||
118 | + */ | ||
119 | + public TopologyId topologyId() { | ||
120 | + return topologyId; | ||
121 | + } | ||
122 | + | ||
123 | + @Override | ||
124 | + public int hashCode() { | ||
125 | + return Objects.hash(localIndentifier, remoteIndentifier, localIpv4Addr, remoteIpv4Addr, | ||
126 | + localIpv6Addr, remoteIpv6Addr, topologyId); | ||
127 | + } | ||
128 | + | ||
129 | + @Override | ||
130 | + public boolean equals(Object obj) { | ||
131 | + if (this == obj) { | ||
132 | + return true; | ||
133 | + } | ||
134 | + | ||
135 | + if (obj instanceof IpLinkIdentifier) { | ||
136 | + IpLinkIdentifier other = (IpLinkIdentifier) obj; | ||
137 | + return Objects.equals(topologyId, other.topologyId) | ||
138 | + && Objects.equals(localIndentifier, other.localIndentifier) | ||
139 | + && Objects.equals(remoteIndentifier, other.remoteIndentifier) | ||
140 | + && Objects.equals(localIpv4Addr, other.localIpv4Addr) | ||
141 | + && Objects.equals(remoteIpv4Addr, other.remoteIpv4Addr) | ||
142 | + && Objects.equals(localIpv6Addr, other.localIpv6Addr) | ||
143 | + && Objects.equals(remoteIpv6Addr, other.remoteIpv6Addr); | ||
144 | + } | ||
145 | + return false; | ||
146 | + } | ||
147 | + | ||
148 | + @Override | ||
149 | + public String toString() { | ||
150 | + return toStringHelper(this) | ||
151 | + .omitNullValues() | ||
152 | + .add("localIndentifier", localIndentifier) | ||
153 | + .add("remoteIndentifier", remoteIndentifier) | ||
154 | + .add("localIpv4Addr", localIpv4Addr) | ||
155 | + .add("remoteIpv4Addr", remoteIpv4Addr) | ||
156 | + .add("localIpv6Addr", localIpv6Addr) | ||
157 | + .add("remoteIpv6Addr", remoteIpv6Addr) | ||
158 | + .add("topologyId", topologyId) | ||
159 | + .toString(); | ||
160 | + } | ||
161 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +import org.onlab.packet.IpPrefix; | ||
23 | + | ||
24 | +/** | ||
25 | + * Provides information of IP address prefix in the IGP topology and a router advertises | ||
26 | + * this to each of its BGP nexthop. | ||
27 | + */ | ||
28 | +public class IpReachability { | ||
29 | + private final IpPrefix ipPrefix; | ||
30 | + | ||
31 | + /** | ||
32 | + * Constructor to initialize IP prefix. | ||
33 | + * | ||
34 | + * @param ipPrefix IP address prefix | ||
35 | + */ | ||
36 | + public IpReachability(IpPrefix ipPrefix) { | ||
37 | + this.ipPrefix = ipPrefix; | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * Provides IP Address prefix reachability. | ||
42 | + * | ||
43 | + * @return IP Address prefix | ||
44 | + */ | ||
45 | + public IpPrefix ipPrefix() { | ||
46 | + return ipPrefix; | ||
47 | + } | ||
48 | + | ||
49 | + @Override | ||
50 | + public int hashCode() { | ||
51 | + return Objects.hash(ipPrefix); | ||
52 | + } | ||
53 | + | ||
54 | + @Override | ||
55 | + public boolean equals(Object obj) { | ||
56 | + if (this == obj) { | ||
57 | + return true; | ||
58 | + } | ||
59 | + | ||
60 | + if (obj instanceof IpReachability) { | ||
61 | + IpReachability other = (IpReachability) obj; | ||
62 | + return Objects.equals(ipPrefix, other.ipPrefix); | ||
63 | + } | ||
64 | + return false; | ||
65 | + } | ||
66 | + | ||
67 | + @Override | ||
68 | + public String toString() { | ||
69 | + return toStringHelper(this) | ||
70 | + .add("ipPrefix", ipPrefix) | ||
71 | + .toString(); | ||
72 | + } | ||
73 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Represents the Pseudonode information of device in ISIS domain. | ||
24 | + */ | ||
25 | +public class IsIsPseudonode implements RouteIdentifier { | ||
26 | + private final IsoNodeId isoNodeId; | ||
27 | + private final byte psnIdentifier; | ||
28 | + private final ProtocolType type; | ||
29 | + | ||
30 | + /** | ||
31 | + * Constructor to initialize the values. | ||
32 | + * | ||
33 | + * @param isoNodeId ISO system-ID | ||
34 | + * @param psnIdentifier Pseudonode identifier | ||
35 | + * @param type Protocol ID | ||
36 | + */ | ||
37 | + public IsIsPseudonode(IsoNodeId isoNodeId, byte psnIdentifier, ProtocolType type) { | ||
38 | + this.isoNodeId = isoNodeId; | ||
39 | + this.psnIdentifier = psnIdentifier; | ||
40 | + this.type = type; | ||
41 | + } | ||
42 | + | ||
43 | + /** | ||
44 | + * Obtains iso system id of Pseudonode of device in ISIS domain. | ||
45 | + * | ||
46 | + * @return ISO system Id | ||
47 | + */ | ||
48 | + public IsoNodeId isoNodeId() { | ||
49 | + return isoNodeId; | ||
50 | + } | ||
51 | + | ||
52 | + /** | ||
53 | + * Obtains Pseudonode identifier. | ||
54 | + * | ||
55 | + * @return Pseudonode identifier | ||
56 | + */ | ||
57 | + public byte psnIdentifier() { | ||
58 | + return psnIdentifier; | ||
59 | + } | ||
60 | + | ||
61 | + @Override | ||
62 | + public ProtocolType type() { | ||
63 | + return type; | ||
64 | + } | ||
65 | + | ||
66 | + @Override | ||
67 | + public int hashCode() { | ||
68 | + return Objects.hash(isoNodeId, psnIdentifier, type); | ||
69 | + } | ||
70 | + | ||
71 | + @Override | ||
72 | + public boolean equals(Object obj) { | ||
73 | + if (this == obj) { | ||
74 | + return true; | ||
75 | + } | ||
76 | + | ||
77 | + if (obj instanceof IsIsPseudonode) { | ||
78 | + IsIsPseudonode other = (IsIsPseudonode) obj; | ||
79 | + return Objects.equals(isoNodeId, other.isoNodeId) && Objects.equals(psnIdentifier, other.psnIdentifier) | ||
80 | + && Objects.equals(type, other.type); | ||
81 | + } | ||
82 | + return false; | ||
83 | + } | ||
84 | + | ||
85 | + @Override | ||
86 | + public String toString() { | ||
87 | + return toStringHelper(this) | ||
88 | + .add("isoNodeId", isoNodeId) | ||
89 | + .add("psnIdentifier", psnIdentifier) | ||
90 | + .add("type", type) | ||
91 | + .toString(); | ||
92 | + } | ||
93 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Represents ISO system id of the device. | ||
24 | + */ | ||
25 | +public class IsoNodeId implements RouteIdentifier { | ||
26 | + private final byte[] isoNodeId; | ||
27 | + private final ProtocolType type; | ||
28 | + | ||
29 | + /** | ||
30 | + * Constructor to initialize the values. | ||
31 | + * | ||
32 | + * @param isoNodeId ISO system-ID | ||
33 | + * @param type Protocol type | ||
34 | + */ | ||
35 | + public IsoNodeId(byte[] isoNodeId, ProtocolType type) { | ||
36 | + this.isoNodeId = isoNodeId; | ||
37 | + this.type = type; | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * Obtains ISO system id of the device. | ||
42 | + * | ||
43 | + * @return ISO system id | ||
44 | + */ | ||
45 | + public byte[] isoNodeId() { | ||
46 | + return isoNodeId; | ||
47 | + } | ||
48 | + | ||
49 | + @Override | ||
50 | + public ProtocolType type() { | ||
51 | + return type; | ||
52 | + } | ||
53 | + | ||
54 | + @Override | ||
55 | + public int hashCode() { | ||
56 | + return Objects.hash(isoNodeId, type); | ||
57 | + } | ||
58 | + | ||
59 | + @Override | ||
60 | + public boolean equals(Object obj) { | ||
61 | + if (this == obj) { | ||
62 | + return true; | ||
63 | + } | ||
64 | + | ||
65 | + if (obj instanceof IsoNodeId) { | ||
66 | + IsoNodeId other = (IsoNodeId) obj; | ||
67 | + return Objects.equals(isoNodeId, other.isoNodeId) && Objects.equals(type, other.type); | ||
68 | + } | ||
69 | + return false; | ||
70 | + } | ||
71 | + | ||
72 | + @Override | ||
73 | + public String toString() { | ||
74 | + return toStringHelper(this) | ||
75 | + .add("isoNodeId", isoNodeId) | ||
76 | + .add("type", type) | ||
77 | + .toString(); | ||
78 | + } | ||
79 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Iterator; | ||
21 | +import java.util.List; | ||
22 | +import java.util.Objects; | ||
23 | + | ||
24 | +import org.onlab.packet.Ip4Address; | ||
25 | +import org.onlab.packet.Ip6Address; | ||
26 | +import org.onlab.util.Bandwidth; | ||
27 | + | ||
28 | +/** | ||
29 | + * Represents Link Traffic engineering parameters. | ||
30 | + */ | ||
31 | +public class LinkTed { | ||
32 | + private final Bandwidth maximumLink; | ||
33 | + private final Bandwidth maxReserved; | ||
34 | + private final List<Bandwidth> maxUnResBandwidth; | ||
35 | + private final Metric teMetric; | ||
36 | + private final Metric igpMetric; | ||
37 | + private final List<Ip4Address> ipv4LocRouterId; | ||
38 | + private final List<Ip6Address> ipv6LocRouterId; | ||
39 | + private final List<Ip4Address> ipv4RemRouterId; | ||
40 | + private final List<Ip6Address> ipv6RemRouterId; | ||
41 | + private final Color color; | ||
42 | + private final Signalling signalType; | ||
43 | + private final List<Srlg> srlgGroup; | ||
44 | + private final ProtectionType protectType; | ||
45 | + | ||
46 | + /** | ||
47 | + * Constructor to initialize its parameter. | ||
48 | + * | ||
49 | + * @param maximumLink maximum bandwidth can be used | ||
50 | + * @param maxReserved max bandwidth that can be reserved | ||
51 | + * @param maxUnResBandwidth amount of bandwidth reservable | ||
52 | + * @param teMetric Traffic engineering metric | ||
53 | + * @param igpMetric IGP metric | ||
54 | + * @param color information on administrative group assigned to the interface | ||
55 | + * @param signalType MPLS signaling protocols | ||
56 | + * @param srlgGroup Shared Risk Link Group information | ||
57 | + * @param protectType protection capabilities of the link | ||
58 | + * @param ipv4LocRouterId IPv4 router-Id of local node | ||
59 | + * @param ipv6LocRouterId IPv6 router-Id of local node | ||
60 | + * @param ipv4RemRouterId IPv4 router-Id of remote node | ||
61 | + * @param ipv6RemRouterId IPv6 router-Id of remote node | ||
62 | + */ | ||
63 | + public LinkTed(Bandwidth maximumLink, Bandwidth maxReserved, List<Bandwidth> maxUnResBandwidth, | ||
64 | + Metric teMetric, Metric igpMetric, Color color, Signalling signalType, List<Srlg> srlgGroup, | ||
65 | + ProtectionType protectType, List<Ip4Address> ipv4LocRouterId, List<Ip6Address> ipv6LocRouterId, | ||
66 | + List<Ip4Address> ipv4RemRouterId, List<Ip6Address> ipv6RemRouterId) { | ||
67 | + this.maximumLink = maximumLink; | ||
68 | + this.maxReserved = maxReserved; | ||
69 | + this.maxUnResBandwidth = maxUnResBandwidth; | ||
70 | + this.teMetric = teMetric; | ||
71 | + this.igpMetric = igpMetric; | ||
72 | + this.color = color; | ||
73 | + this.signalType = signalType; | ||
74 | + this.srlgGroup = srlgGroup; | ||
75 | + this.protectType = protectType; | ||
76 | + this.ipv4LocRouterId = ipv4LocRouterId; | ||
77 | + this.ipv6LocRouterId = ipv6LocRouterId; | ||
78 | + this.ipv4RemRouterId = ipv4RemRouterId; | ||
79 | + this.ipv6RemRouterId = ipv6RemRouterId; | ||
80 | + } | ||
81 | + | ||
82 | + /** | ||
83 | + * Provides maximum bandwidth can be used on the link. | ||
84 | + * | ||
85 | + * @return maximum bandwidth | ||
86 | + */ | ||
87 | + public Bandwidth maximumLink() { | ||
88 | + return maximumLink; | ||
89 | + } | ||
90 | + | ||
91 | + /** | ||
92 | + * Amount of bandwidth reservable on the link. | ||
93 | + * | ||
94 | + * @return unreserved bandwidth | ||
95 | + */ | ||
96 | + public List<Bandwidth> maxUnResBandwidth() { | ||
97 | + return maxUnResBandwidth; | ||
98 | + } | ||
99 | + | ||
100 | + /** | ||
101 | + * Provides max bandwidth that can be reserved on the link. | ||
102 | + * | ||
103 | + * @return max bandwidth reserved | ||
104 | + */ | ||
105 | + public Bandwidth maxReserved() { | ||
106 | + return maxReserved; | ||
107 | + } | ||
108 | + | ||
109 | + /** | ||
110 | + * Provides Traffic engineering metric for the link. | ||
111 | + * | ||
112 | + * @return Traffic engineering metric | ||
113 | + */ | ||
114 | + public Metric teMetric() { | ||
115 | + return teMetric; | ||
116 | + } | ||
117 | + | ||
118 | + /** | ||
119 | + * Provides IGP metric for the link. | ||
120 | + * | ||
121 | + * @return IGP metric | ||
122 | + */ | ||
123 | + public Metric igpMetric() { | ||
124 | + return igpMetric; | ||
125 | + } | ||
126 | + | ||
127 | + /** | ||
128 | + * Provides protection capabilities of the link. | ||
129 | + * | ||
130 | + * @return link protection type | ||
131 | + */ | ||
132 | + public ProtectionType protectType() { | ||
133 | + return protectType; | ||
134 | + } | ||
135 | + | ||
136 | + /** | ||
137 | + * Provides Shared Risk Link Group information. | ||
138 | + * | ||
139 | + * @return Shared Risk Link Group value | ||
140 | + */ | ||
141 | + public List<Srlg> srlgGroup() { | ||
142 | + return srlgGroup; | ||
143 | + } | ||
144 | + | ||
145 | + /** | ||
146 | + * Provides which MPLS signaling protocols are enabled. | ||
147 | + * | ||
148 | + * @return signal type | ||
149 | + */ | ||
150 | + public Signalling signalType() { | ||
151 | + return signalType; | ||
152 | + } | ||
153 | + | ||
154 | + /** | ||
155 | + * Provides information on administrative group assigned to the interface. | ||
156 | + * | ||
157 | + * @return 4-octect bit mask assigned by network administrator | ||
158 | + */ | ||
159 | + public Color color() { | ||
160 | + return color; | ||
161 | + } | ||
162 | + | ||
163 | + /** | ||
164 | + * Provides IPv4 router-Id of local node. | ||
165 | + * | ||
166 | + * @return IPv4 router-Id of local node | ||
167 | + */ | ||
168 | + public List<Ip4Address> ipv4LocRouterId() { | ||
169 | + return ipv4LocRouterId; | ||
170 | + } | ||
171 | + | ||
172 | + /** | ||
173 | + * Provides IPv6 router-Id of local node. | ||
174 | + * | ||
175 | + * @return IPv6 router-Id of local node | ||
176 | + */ | ||
177 | + public List<Ip6Address> ipv6LocRouterId() { | ||
178 | + return ipv6LocRouterId; | ||
179 | + } | ||
180 | + | ||
181 | + /** | ||
182 | + * Provides IPv4 router-Id of remote node. | ||
183 | + * | ||
184 | + * @return IPv4 router-Id of remote node | ||
185 | + */ | ||
186 | + public List<Ip4Address> ipv4RemRouterId() { | ||
187 | + return ipv4RemRouterId; | ||
188 | + } | ||
189 | + | ||
190 | + /** | ||
191 | + * Provides IPv6 router-Id of remote node. | ||
192 | + * | ||
193 | + * @return IPv6 router-Id of remote node | ||
194 | + */ | ||
195 | + public List<Ip6Address> ipv6RemRouterId() { | ||
196 | + return ipv6RemRouterId; | ||
197 | + } | ||
198 | + | ||
199 | + @Override | ||
200 | + public int hashCode() { | ||
201 | + return Objects.hash(maximumLink, maxReserved, maxUnResBandwidth, teMetric, igpMetric, | ||
202 | + ipv4LocRouterId, ipv6LocRouterId, ipv4RemRouterId, ipv6RemRouterId, | ||
203 | + color, signalType, srlgGroup, protectType); | ||
204 | + } | ||
205 | + | ||
206 | + @Override | ||
207 | + public boolean equals(Object obj) { | ||
208 | + if (this == obj) { | ||
209 | + return true; | ||
210 | + } | ||
211 | + | ||
212 | + if (obj instanceof LinkTed) { | ||
213 | + int countCommonBandwidth = 0; | ||
214 | + int countOtherCommonBandwidth = 0; | ||
215 | + int countOther4LocRouterId = 0; | ||
216 | + int countCommon4LocRouterId = 0; | ||
217 | + int countOther6RemRouterId = 0; | ||
218 | + int countCommon6RemRouterId = 0; | ||
219 | + int countOther4RemRouterId = 0; | ||
220 | + int countCommon4RemRouterId = 0; | ||
221 | + int countCommon6LocRouterId = 0; | ||
222 | + int countOther6LocRouterId = 0; | ||
223 | + int countCommonSrlg = 0; | ||
224 | + int countOtherSrlg = 0; | ||
225 | + boolean isCommonBandwidth = true; | ||
226 | + boolean isCommonIp4Loc = true; | ||
227 | + boolean isCommonIp4Rem = true; | ||
228 | + boolean isCommonIp6Loc = true; | ||
229 | + boolean isCommonIp6Rem = true; | ||
230 | + boolean isCommonSrlg = true; | ||
231 | + LinkTed other = (LinkTed) obj; | ||
232 | + Iterator<Bandwidth> objListIterator = other.maxUnResBandwidth.iterator(); | ||
233 | + countOtherCommonBandwidth = other.maxUnResBandwidth.size(); | ||
234 | + countCommonBandwidth = maxUnResBandwidth.size(); | ||
235 | + | ||
236 | + Iterator<Ip4Address> ipv4local = other.ipv4LocRouterId.iterator(); | ||
237 | + countOther4LocRouterId = other.ipv4LocRouterId.size(); | ||
238 | + countCommon4LocRouterId = ipv4LocRouterId.size(); | ||
239 | + | ||
240 | + Iterator<Ip4Address> ipv4remote = other.ipv4RemRouterId.iterator(); | ||
241 | + countOther4RemRouterId = other.ipv4RemRouterId.size(); | ||
242 | + countCommon4RemRouterId = ipv4RemRouterId.size(); | ||
243 | + | ||
244 | + Iterator<Ip6Address> ipv6local = other.ipv6LocRouterId.iterator(); | ||
245 | + countOther6LocRouterId = other.ipv6LocRouterId.size(); | ||
246 | + countCommon6LocRouterId = ipv6LocRouterId.size(); | ||
247 | + | ||
248 | + Iterator<Ip6Address> ipv6remote = other.ipv6RemRouterId.iterator(); | ||
249 | + countOther6RemRouterId = other.ipv6RemRouterId.size(); | ||
250 | + countCommon6RemRouterId = ipv6RemRouterId.size(); | ||
251 | + | ||
252 | + Iterator<Srlg> srlg = other.srlgGroup.iterator(); | ||
253 | + countOtherSrlg = other.srlgGroup.size(); | ||
254 | + countCommonSrlg = srlgGroup.size(); | ||
255 | + | ||
256 | + if (countOtherCommonBandwidth != countCommonBandwidth | ||
257 | + || countOther4LocRouterId != countCommon4LocRouterId | ||
258 | + || countOther4RemRouterId != countCommon4RemRouterId | ||
259 | + || countOther6LocRouterId != countCommon6LocRouterId | ||
260 | + || countOther6RemRouterId != countCommon6RemRouterId | ||
261 | + || countOtherSrlg != countCommonSrlg) { | ||
262 | + return false; | ||
263 | + } else { | ||
264 | + while (objListIterator.hasNext() && isCommonBandwidth) { | ||
265 | + Bandwidth subTlv = objListIterator.next(); | ||
266 | + if (maxUnResBandwidth.contains(subTlv) && other.maxUnResBandwidth.contains(subTlv)) { | ||
267 | + isCommonBandwidth = Objects.equals(maxUnResBandwidth.get(maxUnResBandwidth.indexOf(subTlv)), | ||
268 | + other.maxUnResBandwidth.get(other.maxUnResBandwidth.indexOf(subTlv))); | ||
269 | + } else { | ||
270 | + isCommonBandwidth = false; | ||
271 | + } | ||
272 | + } | ||
273 | + while (ipv4local.hasNext() && isCommonIp4Loc) { | ||
274 | + Ip4Address subTlv = ipv4local.next(); | ||
275 | + if (ipv4LocRouterId.contains(subTlv) && other.ipv4LocRouterId.contains(subTlv)) { | ||
276 | + isCommonIp4Loc = Objects.equals(ipv4LocRouterId.get(ipv4LocRouterId.indexOf(subTlv)), | ||
277 | + other.ipv4LocRouterId.get(other.ipv4LocRouterId.indexOf(subTlv))); | ||
278 | + } else { | ||
279 | + isCommonIp4Loc = false; | ||
280 | + } | ||
281 | + } | ||
282 | + while (ipv4remote.hasNext() && isCommonIp4Rem) { | ||
283 | + Ip4Address subTlv = ipv4remote.next(); | ||
284 | + if (ipv4RemRouterId.contains(subTlv) && other.ipv4RemRouterId.contains(subTlv)) { | ||
285 | + isCommonIp4Rem = Objects.equals(ipv4RemRouterId.get(ipv4RemRouterId.indexOf(subTlv)), | ||
286 | + other.ipv4RemRouterId.get(other.ipv4RemRouterId.indexOf(subTlv))); | ||
287 | + } else { | ||
288 | + isCommonIp4Rem = false; | ||
289 | + } | ||
290 | + } | ||
291 | + while (ipv6remote.hasNext() && isCommonIp6Rem) { | ||
292 | + Ip6Address subTlv = ipv6remote.next(); | ||
293 | + if (ipv6RemRouterId.contains(subTlv) && other.ipv6RemRouterId.contains(subTlv)) { | ||
294 | + isCommonIp6Rem = Objects.equals(ipv6RemRouterId.get(ipv6RemRouterId.indexOf(subTlv)), | ||
295 | + other.ipv6RemRouterId.get(other.ipv6RemRouterId.indexOf(subTlv))); | ||
296 | + } else { | ||
297 | + isCommonIp6Rem = false; | ||
298 | + } | ||
299 | + } | ||
300 | + while (ipv6local.hasNext() && isCommonIp6Loc) { | ||
301 | + Ip6Address subTlv = ipv6local.next(); | ||
302 | + if (ipv6LocRouterId.contains(subTlv) && other.ipv6LocRouterId.contains(subTlv)) { | ||
303 | + isCommonIp6Loc = Objects.equals(ipv6LocRouterId.get(ipv6LocRouterId.indexOf(subTlv)), | ||
304 | + other.ipv6LocRouterId.get(other.ipv6LocRouterId.indexOf(subTlv))); | ||
305 | + } else { | ||
306 | + isCommonIp6Loc = false; | ||
307 | + } | ||
308 | + } | ||
309 | + while (srlg.hasNext() && isCommonIp6Loc) { | ||
310 | + Srlg subTlv = srlg.next(); | ||
311 | + if (srlgGroup.contains(subTlv) && other.srlgGroup.contains(subTlv)) { | ||
312 | + isCommonSrlg = Objects.equals(srlgGroup.get(srlgGroup.indexOf(subTlv)), | ||
313 | + other.srlgGroup.get(other.srlgGroup.indexOf(subTlv))); | ||
314 | + } else { | ||
315 | + isCommonSrlg = false; | ||
316 | + } | ||
317 | + } | ||
318 | + return isCommonBandwidth && isCommonIp4Loc && isCommonIp4Rem && isCommonIp6Rem && isCommonIp6Loc | ||
319 | + && isCommonSrlg | ||
320 | + && Objects.equals(igpMetric, other.igpMetric) | ||
321 | + && Objects.equals(teMetric, other.teMetric) | ||
322 | + && Objects.equals(maximumLink, other.maximumLink) | ||
323 | + && Objects.equals(protectType, other.protectType) | ||
324 | + && Objects.equals(color, other.color) | ||
325 | + && Objects.equals(signalType, other.signalType); | ||
326 | + } | ||
327 | + } | ||
328 | + return false; | ||
329 | + } | ||
330 | + | ||
331 | + @Override | ||
332 | + public String toString() { | ||
333 | + return toStringHelper(this) | ||
334 | + .add("igpMetric", igpMetric) | ||
335 | + .add("teMetric", teMetric) | ||
336 | + .add("maximumLink", maximumLink) | ||
337 | + .add("maxReserved", maxReserved) | ||
338 | + .add("maxUnResBandwidth", maxUnResBandwidth) | ||
339 | + .add("ipv4LocRouterId", ipv4LocRouterId) | ||
340 | + .add("ipv4RemRouterId", ipv4RemRouterId) | ||
341 | + .add("ipv6LocRouterId", ipv6LocRouterId) | ||
342 | + .add("ipv6RemRouterId", ipv6RemRouterId) | ||
343 | + .add("protectType", protectType) | ||
344 | + .add("color", color) | ||
345 | + .add("srlgGroup", srlgGroup) | ||
346 | + .add("signalType", signalType) | ||
347 | + .toString(); | ||
348 | + } | ||
349 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Represents Traffic engineering metrics. | ||
24 | + */ | ||
25 | +public class Metric { | ||
26 | + private final Integer metric; | ||
27 | + | ||
28 | + /** | ||
29 | + * Constructor to initialize its metric. | ||
30 | + * | ||
31 | + * @param metric can be TE metric or IGP metric or Prefix metric | ||
32 | + */ | ||
33 | + public Metric(Integer metric) { | ||
34 | + this.metric = metric; | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Obtains traffic engineering metric. | ||
39 | + * | ||
40 | + * @return traffic engineering metric | ||
41 | + */ | ||
42 | + public Integer metric() { | ||
43 | + return metric; | ||
44 | + } | ||
45 | + | ||
46 | + @Override | ||
47 | + public int hashCode() { | ||
48 | + return Objects.hash(metric); | ||
49 | + } | ||
50 | + | ||
51 | + @Override | ||
52 | + public boolean equals(Object obj) { | ||
53 | + if (this == obj) { | ||
54 | + return true; | ||
55 | + } | ||
56 | + | ||
57 | + if (obj instanceof Metric) { | ||
58 | + Metric other = (Metric) obj; | ||
59 | + return Objects.equals(metric, other.metric); | ||
60 | + } | ||
61 | + return false; | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public String toString() { | ||
66 | + return toStringHelper(this) | ||
67 | + .add("metric", metric) | ||
68 | + .toString(); | ||
69 | + } | ||
70 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +import org.onlab.packet.Ip4Address; | ||
23 | + | ||
24 | +/** | ||
25 | + * Represents Pseudonode information of OSFP device. | ||
26 | + */ | ||
27 | +public class OspfPseudonode implements RouteIdentifier { | ||
28 | + private final RouterId designatedRouter; | ||
29 | + private final Ip4Address drInterface; | ||
30 | + private final ProtocolType type; | ||
31 | + | ||
32 | + /** | ||
33 | + * Constructor to initialize the values. | ||
34 | + * | ||
35 | + * @param designatedRouter Router Id of designated router | ||
36 | + * @param drInterface IP address of Designated Router interface | ||
37 | + * @param type Protocol ID | ||
38 | + */ | ||
39 | + public OspfPseudonode(RouterId designatedRouter, Ip4Address drInterface, ProtocolType type) { | ||
40 | + this.designatedRouter = designatedRouter; | ||
41 | + this.drInterface = drInterface; | ||
42 | + this.type = type; | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * Obtains designated Router Id. | ||
47 | + * | ||
48 | + * @return designated Router Id | ||
49 | + */ | ||
50 | + public RouterId designatedRouter() { | ||
51 | + return designatedRouter; | ||
52 | + } | ||
53 | + | ||
54 | + /** | ||
55 | + * Obtains IP address of Designated Router interface. | ||
56 | + * | ||
57 | + * @return IP address of Designated Router interface | ||
58 | + */ | ||
59 | + public Ip4Address drInterface() { | ||
60 | + return drInterface; | ||
61 | + } | ||
62 | + | ||
63 | + @Override | ||
64 | + public ProtocolType type() { | ||
65 | + return type; | ||
66 | + } | ||
67 | + | ||
68 | + @Override | ||
69 | + public int hashCode() { | ||
70 | + return Objects.hash(designatedRouter, drInterface, type); | ||
71 | + } | ||
72 | + | ||
73 | + @Override | ||
74 | + public boolean equals(Object obj) { | ||
75 | + if (this == obj) { | ||
76 | + return true; | ||
77 | + } | ||
78 | + | ||
79 | + if (obj instanceof OspfPseudonode) { | ||
80 | + OspfPseudonode other = (OspfPseudonode) obj; | ||
81 | + return Objects.equals(designatedRouter, other.designatedRouter) | ||
82 | + && Objects.equals(drInterface, other.drInterface) | ||
83 | + && Objects.equals(type, other.type); | ||
84 | + } | ||
85 | + return false; | ||
86 | + } | ||
87 | + | ||
88 | + @Override | ||
89 | + public String toString() { | ||
90 | + return toStringHelper(this) | ||
91 | + .add("designatedRouter", designatedRouter) | ||
92 | + .add("drInterface", drInterface) | ||
93 | + .add("type", type) | ||
94 | + .toString(); | ||
95 | + } | ||
96 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Represents Position of device in the network. | ||
24 | + */ | ||
25 | +public class Position { | ||
26 | + private final Boolean asbr; | ||
27 | + private final Boolean abr; | ||
28 | + | ||
29 | + /** | ||
30 | + * Constructor to set position of device. | ||
31 | + * | ||
32 | + * @param asbr autonomous system boundary router | ||
33 | + * @param abr area boundary router | ||
34 | + */ | ||
35 | + public Position(Boolean asbr, Boolean abr) { | ||
36 | + this.asbr = asbr; | ||
37 | + this.abr = abr; | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * obtain whether the device is autonomous system boundary router or not. | ||
42 | + * | ||
43 | + * @return autonomous system boundary router or not | ||
44 | + */ | ||
45 | + Boolean asbr() { | ||
46 | + return asbr; | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * obtain whether the device is area boundary router or not. | ||
51 | + * | ||
52 | + * @return area boundary router or not | ||
53 | + */ | ||
54 | + Boolean abr() { | ||
55 | + return abr; | ||
56 | + } | ||
57 | + | ||
58 | + @Override | ||
59 | + public int hashCode() { | ||
60 | + return Objects.hash(abr, asbr); | ||
61 | + } | ||
62 | + | ||
63 | + @Override | ||
64 | + public boolean equals(Object obj) { | ||
65 | + if (this == obj) { | ||
66 | + return true; | ||
67 | + } | ||
68 | + | ||
69 | + if (obj instanceof Position) { | ||
70 | + Position other = (Position) obj; | ||
71 | + return Objects.equals(abr, other.abr) && Objects.equals(asbr, other.asbr); | ||
72 | + } | ||
73 | + return false; | ||
74 | + } | ||
75 | + | ||
76 | + @Override | ||
77 | + public String toString() { | ||
78 | + return toStringHelper(this) | ||
79 | + .omitNullValues() | ||
80 | + .add("abrBit", abr) | ||
81 | + .add("asbrBit", asbr) | ||
82 | + .toString(); | ||
83 | + } | ||
84 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * This class provides Prefix Identifier details. | ||
24 | + */ | ||
25 | +public class PrefixIdentifier { | ||
26 | + private final TopologyId topologyId; | ||
27 | + private final RouteType routeType; | ||
28 | + private final IpReachability ipReach; | ||
29 | + | ||
30 | + /** | ||
31 | + * Constructor to initialize its parameters. | ||
32 | + * | ||
33 | + * @param topologyId topology ID of prefix | ||
34 | + * @param routeType OSPF Route type of the prefix | ||
35 | + * @param ipReach IP address prefix reachability information | ||
36 | + */ | ||
37 | + public PrefixIdentifier(TopologyId topologyId, RouteType routeType, IpReachability ipReach) { | ||
38 | + this.topologyId = topologyId; | ||
39 | + this.routeType = routeType; | ||
40 | + this.ipReach = ipReach; | ||
41 | + } | ||
42 | + | ||
43 | + /** | ||
44 | + * Provides topology ID of prefix. | ||
45 | + * | ||
46 | + * @return topology id | ||
47 | + */ | ||
48 | + public TopologyId topologyId() { | ||
49 | + return this.topologyId; | ||
50 | + } | ||
51 | + | ||
52 | + /** | ||
53 | + * Provides IP address prefix reachability information. | ||
54 | + * | ||
55 | + * @return IP address prefix | ||
56 | + */ | ||
57 | + public IpReachability ipReach() { | ||
58 | + return this.ipReach; | ||
59 | + } | ||
60 | + | ||
61 | + /** | ||
62 | + * Provides OSPF Route type of the prefix. | ||
63 | + * | ||
64 | + * @return Route type | ||
65 | + */ | ||
66 | + public RouteType routeType() { | ||
67 | + return this.routeType; | ||
68 | + } | ||
69 | + | ||
70 | + @Override | ||
71 | + public int hashCode() { | ||
72 | + return Objects.hash(topologyId, routeType, ipReach); | ||
73 | + } | ||
74 | + | ||
75 | + @Override | ||
76 | + public boolean equals(Object obj) { | ||
77 | + if (this == obj) { | ||
78 | + return true; | ||
79 | + } | ||
80 | + | ||
81 | + if (obj instanceof PrefixIdentifier) { | ||
82 | + PrefixIdentifier other = (PrefixIdentifier) obj; | ||
83 | + return Objects.equals(topologyId, other.topologyId) && Objects.equals(routeType, other.routeType) | ||
84 | + && Objects.equals(ipReach, other.ipReach); | ||
85 | + } | ||
86 | + return false; | ||
87 | + } | ||
88 | + | ||
89 | + @Override | ||
90 | + public String toString() { | ||
91 | + return toStringHelper(this) | ||
92 | + .omitNullValues() | ||
93 | + .add("routeType", routeType) | ||
94 | + .add("ipReach", ipReach) | ||
95 | + .add("topologyId", topologyId) | ||
96 | + .toString(); | ||
97 | + } | ||
98 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +import org.onlab.packet.IpAddress; | ||
23 | + | ||
24 | +/** | ||
25 | + * This class provides implementation of prefix traffic engineering data. | ||
26 | + */ | ||
27 | +public class PrefixTed { | ||
28 | + private final IgpFlags igpFlags; | ||
29 | + private final RouteTag routeTag; | ||
30 | + private final ExtendedRouteTag extendedRouteTag; | ||
31 | + private final Metric metric; | ||
32 | + private final IpAddress fwdingAddress; | ||
33 | + | ||
34 | + /** | ||
35 | + * Constructor to initialize its parameters. | ||
36 | + * | ||
37 | + * @param igpFlags igp flags | ||
38 | + * @param routeTag ospf route tag | ||
39 | + * @param extendedRouteTag isis route tag | ||
40 | + * @param metric prefix metric | ||
41 | + * @param fwdingAddress forwarding address | ||
42 | + */ | ||
43 | + /** | ||
44 | + * Constructor to initialize its parameters. | ||
45 | + * | ||
46 | + * @param igpFlags IS-IS and OSPF flags assigned to the prefix | ||
47 | + * @param routeTag IGP (ISIS or OSPF) tags of the prefix | ||
48 | + * @param extendedRouteTag extended ISIS route tags of the prefix | ||
49 | + * @param metric metric of the prefix | ||
50 | + * @param fwdingAddress OSPF forwarding address | ||
51 | + */ | ||
52 | + public PrefixTed(IgpFlags igpFlags, RouteTag routeTag, ExtendedRouteTag extendedRouteTag, | ||
53 | + Metric metric, IpAddress fwdingAddress) { | ||
54 | + this.igpFlags = igpFlags; | ||
55 | + this.routeTag = routeTag; | ||
56 | + this.extendedRouteTag = extendedRouteTag; | ||
57 | + this.metric = metric; | ||
58 | + this.fwdingAddress = fwdingAddress; | ||
59 | + } | ||
60 | + | ||
61 | + /** | ||
62 | + * Provides IS-IS and OSPF flags assigned to the prefix. | ||
63 | + * | ||
64 | + * @return IGP flags | ||
65 | + */ | ||
66 | + public IgpFlags igpFlags() { | ||
67 | + return igpFlags; | ||
68 | + } | ||
69 | + | ||
70 | + /** | ||
71 | + * Provides IGP (ISIS or OSPF) tags of the prefix. | ||
72 | + * | ||
73 | + * @return IGP route tag. | ||
74 | + */ | ||
75 | + public RouteTag routeTag() { | ||
76 | + return routeTag; | ||
77 | + } | ||
78 | + | ||
79 | + /** | ||
80 | + * Provides extended ISIS route tags of the prefix. | ||
81 | + * | ||
82 | + * @return extended IS-IS route tag | ||
83 | + */ | ||
84 | + public ExtendedRouteTag extendedRouteTag() { | ||
85 | + return extendedRouteTag; | ||
86 | + } | ||
87 | + | ||
88 | + /** | ||
89 | + * Provides metric of the prefix. | ||
90 | + * | ||
91 | + * @return prefix metric | ||
92 | + */ | ||
93 | + public Metric metric() { | ||
94 | + return metric; | ||
95 | + } | ||
96 | + | ||
97 | + /** | ||
98 | + * Provides OSPF forwarding address. | ||
99 | + * | ||
100 | + * @return forwarding address | ||
101 | + */ | ||
102 | + public IpAddress fwdingAddress() { | ||
103 | + return fwdingAddress; | ||
104 | + } | ||
105 | + | ||
106 | + | ||
107 | + @Override | ||
108 | + public int hashCode() { | ||
109 | + return Objects.hash(igpFlags, routeTag, extendedRouteTag, metric, fwdingAddress); | ||
110 | + } | ||
111 | + | ||
112 | + @Override | ||
113 | + public boolean equals(Object obj) { | ||
114 | + if (this == obj) { | ||
115 | + return true; | ||
116 | + } | ||
117 | + | ||
118 | + if (obj instanceof PrefixTed) { | ||
119 | + PrefixTed other = (PrefixTed) obj; | ||
120 | + return Objects.equals(igpFlags, other.igpFlags) && Objects.equals(extendedRouteTag, other.extendedRouteTag) | ||
121 | + && Objects.equals(routeTag, other.routeTag) && Objects.equals(metric, other.metric) | ||
122 | + && Objects.equals(fwdingAddress, other.fwdingAddress); | ||
123 | + } | ||
124 | + return false; | ||
125 | + } | ||
126 | + | ||
127 | + @Override | ||
128 | + public String toString() { | ||
129 | + return toStringHelper(this) | ||
130 | + .omitNullValues() | ||
131 | + .add("igpFlags", igpFlags) | ||
132 | + .add("extendedRouteTag", extendedRouteTag) | ||
133 | + .add("routeTag", routeTag) | ||
134 | + .add("metric", metric) | ||
135 | + .add("fwdingAddress", fwdingAddress) | ||
136 | + .toString(); | ||
137 | + } | ||
138 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Represents protection capabilities of the link. | ||
24 | + */ | ||
25 | +public class ProtectionType { | ||
26 | + private final LinkProtectionType protectionType; | ||
27 | + | ||
28 | + /** | ||
29 | + * Enum to provide Link Protection type. | ||
30 | + */ | ||
31 | + public enum LinkProtectionType { | ||
32 | + Extra_Traffic(1), Unprotected(2), Shared(4), Enhanced(0x20), Dedicated_OneIsToOne(8), | ||
33 | + Dedicated_OnePlusOne(0x10), Reserved(0x40); | ||
34 | + int value; | ||
35 | + | ||
36 | + /** | ||
37 | + * Constructor to assign value. | ||
38 | + * | ||
39 | + * @param val link protection type | ||
40 | + */ | ||
41 | + LinkProtectionType(int val) { | ||
42 | + value = val; | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * Provides Link protection type. | ||
47 | + * | ||
48 | + * @return protection type | ||
49 | + */ | ||
50 | + public byte type() { | ||
51 | + return (byte) value; | ||
52 | + } | ||
53 | + } | ||
54 | + | ||
55 | + /** | ||
56 | + * Constructor to initialize protection type. | ||
57 | + * | ||
58 | + * @param protectionType link protection type | ||
59 | + */ | ||
60 | + public ProtectionType(LinkProtectionType protectionType) { | ||
61 | + this.protectionType = protectionType; | ||
62 | + } | ||
63 | + | ||
64 | + /** | ||
65 | + * Provides protection capabilities of the link. | ||
66 | + * | ||
67 | + * @return link protection type. | ||
68 | + */ | ||
69 | + public LinkProtectionType protectionType() { | ||
70 | + return protectionType; | ||
71 | + } | ||
72 | + | ||
73 | + @Override | ||
74 | + public int hashCode() { | ||
75 | + return Objects.hash(protectionType); | ||
76 | + } | ||
77 | + | ||
78 | + @Override | ||
79 | + public boolean equals(Object obj) { | ||
80 | + if (this == obj) { | ||
81 | + return true; | ||
82 | + } | ||
83 | + | ||
84 | + if (obj instanceof ProtectionType) { | ||
85 | + ProtectionType other = (ProtectionType) obj; | ||
86 | + return Objects.equals(protectionType, other.protectionType); | ||
87 | + } | ||
88 | + return false; | ||
89 | + } | ||
90 | + | ||
91 | + @Override | ||
92 | + public String toString() { | ||
93 | + return toStringHelper(this) | ||
94 | + .add("protectionType", protectionType) | ||
95 | + .toString(); | ||
96 | + } | ||
97 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | + | ||
17 | +/** | ||
18 | + * Implementation of RouteDistinguisher. | ||
19 | + */ | ||
20 | +package org.onosproject.iptopology.api; | ||
21 | + | ||
22 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
23 | + | ||
24 | +import java.util.Objects; | ||
25 | + | ||
26 | +/** | ||
27 | + * Represents Route Distinguisher of device in the network. | ||
28 | + */ | ||
29 | +public class RouteDistinguisher { | ||
30 | + private final Long routeDistinguisher; | ||
31 | + | ||
32 | + /** | ||
33 | + * Constructor to initialize parameters. | ||
34 | + * | ||
35 | + * @param routeDistinguisher route distinguisher | ||
36 | + */ | ||
37 | + public RouteDistinguisher(Long routeDistinguisher) { | ||
38 | + this.routeDistinguisher = routeDistinguisher; | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
42 | + * Obtain route distinguisher. | ||
43 | + * | ||
44 | + * @return route distinguisher | ||
45 | + */ | ||
46 | + public Long routeDistinguisher() { | ||
47 | + return routeDistinguisher; | ||
48 | + } | ||
49 | + | ||
50 | + @Override | ||
51 | + public int hashCode() { | ||
52 | + return Objects.hash(routeDistinguisher); | ||
53 | + } | ||
54 | + | ||
55 | + @Override | ||
56 | + public boolean equals(Object obj) { | ||
57 | + if (this == obj) { | ||
58 | + return true; | ||
59 | + } | ||
60 | + | ||
61 | + if (obj instanceof RouteDistinguisher) { | ||
62 | + RouteDistinguisher other = (RouteDistinguisher) obj; | ||
63 | + return Objects.equals(routeDistinguisher, other.routeDistinguisher); | ||
64 | + } | ||
65 | + return false; | ||
66 | + } | ||
67 | + | ||
68 | + @Override | ||
69 | + public String toString() { | ||
70 | + return toStringHelper(this) | ||
71 | + .add("routeDistinguisher", routeDistinguisher) | ||
72 | + .toString(); | ||
73 | + } | ||
74 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +/** | ||
19 | + * Abstraction of Router ID to identify the router with a distinct IP address. | ||
20 | + */ | ||
21 | +public interface RouteIdentifier { | ||
22 | + /** | ||
23 | + * Enum to provide Protocol type. | ||
24 | + */ | ||
25 | + public enum ProtocolType { | ||
26 | + ISIS_LevelOne(1), ISIS_LevelTwo(2), OSPFv2(3), Direct(4), Static_Configuration(5), OSPFv3(6); | ||
27 | + int value; | ||
28 | + | ||
29 | + /** | ||
30 | + * Sets protocol ID. | ||
31 | + * | ||
32 | + * @param val protocol ID | ||
33 | + */ | ||
34 | + ProtocolType(int val) { | ||
35 | + value = val; | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * Provides Protocol ID. | ||
40 | + * | ||
41 | + * @return Protocol ID | ||
42 | + */ | ||
43 | + public byte getType() { | ||
44 | + return (byte) value; | ||
45 | + } | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * Provides Protocol ID to identify which protocol routing instance is used. | ||
50 | + * | ||
51 | + * @return Protocol type | ||
52 | + */ | ||
53 | + ProtocolType type(); | ||
54 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Represents routing universe where the network element belongs. | ||
24 | + */ | ||
25 | +public class RouteInstance { | ||
26 | + private final long routeInstance; | ||
27 | + | ||
28 | + /** | ||
29 | + * Constructor to initialize routeInstance. | ||
30 | + * | ||
31 | + * @param routeInstance routing protocol instance | ||
32 | + */ | ||
33 | + public RouteInstance(long routeInstance) { | ||
34 | + this.routeInstance = routeInstance; | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Obtain route instance. | ||
39 | + * | ||
40 | + * @return route instance | ||
41 | + */ | ||
42 | + public long routeInstance() { | ||
43 | + return routeInstance; | ||
44 | + } | ||
45 | + | ||
46 | + @Override | ||
47 | + public int hashCode() { | ||
48 | + return Objects.hash(routeInstance); | ||
49 | + } | ||
50 | + | ||
51 | + @Override | ||
52 | + public boolean equals(Object obj) { | ||
53 | + if (this == obj) { | ||
54 | + return true; | ||
55 | + } | ||
56 | + | ||
57 | + if (obj instanceof RouteInstance) { | ||
58 | + RouteInstance other = (RouteInstance) obj; | ||
59 | + return Objects.equals(routeInstance, other.routeInstance); | ||
60 | + } | ||
61 | + return false; | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public String toString() { | ||
66 | + return toStringHelper(this) | ||
67 | + .add("routeInstance", routeInstance) | ||
68 | + .toString(); | ||
69 | + } | ||
70 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Represents the igp administrative tags of the prefix. | ||
24 | + */ | ||
25 | +public class RouteTag { | ||
26 | + private final int routeTag; | ||
27 | + | ||
28 | + /** | ||
29 | + * Constructor to initialize its parameter. | ||
30 | + * | ||
31 | + * @param routeTag IGP route tag | ||
32 | + */ | ||
33 | + public RouteTag(int routeTag) { | ||
34 | + this.routeTag = routeTag; | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Obtains igp administrative tags of the prefix. | ||
39 | + * | ||
40 | + * @return igp administrative tags of the prefix | ||
41 | + */ | ||
42 | + public int routeTag() { | ||
43 | + return routeTag; | ||
44 | + } | ||
45 | + | ||
46 | + @Override | ||
47 | + public int hashCode() { | ||
48 | + return Objects.hash(routeTag); | ||
49 | + } | ||
50 | + | ||
51 | + @Override | ||
52 | + public boolean equals(Object obj) { | ||
53 | + if (this == obj) { | ||
54 | + return true; | ||
55 | + } | ||
56 | + | ||
57 | + if (obj instanceof RouteTag) { | ||
58 | + RouteTag other = (RouteTag) obj; | ||
59 | + return Objects.equals(routeTag, other.routeTag); | ||
60 | + } | ||
61 | + return false; | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public String toString() { | ||
66 | + return toStringHelper(this) | ||
67 | + .add("routeTag", routeTag) | ||
68 | + .toString(); | ||
69 | + } | ||
70 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Represents Route type of the prefix in the OSPF domain. | ||
24 | + */ | ||
25 | +public class RouteType { | ||
26 | + private final Type routeType; | ||
27 | + | ||
28 | + /** | ||
29 | + * Enum to provide Route type. | ||
30 | + */ | ||
31 | + public enum Type { | ||
32 | + Intra_Area(1), Inter_Area(2), External_1(3), External_2(4), NSSA_1(5), NSSA_2(6); | ||
33 | + int value; | ||
34 | + | ||
35 | + /** | ||
36 | + * Constructor to assign value. | ||
37 | + * | ||
38 | + * @param val route type | ||
39 | + */ | ||
40 | + Type(int val) { | ||
41 | + value = val; | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * Provides route type. | ||
46 | + * | ||
47 | + * @return route type | ||
48 | + */ | ||
49 | + public byte type() { | ||
50 | + return (byte) value; | ||
51 | + } | ||
52 | + } | ||
53 | + | ||
54 | + /** | ||
55 | + * Constructor to initialize routeType. | ||
56 | + * | ||
57 | + * @param routeType Route type | ||
58 | + */ | ||
59 | + public RouteType(Type routeType) { | ||
60 | + this.routeType = routeType; | ||
61 | + } | ||
62 | + | ||
63 | + /** | ||
64 | + * Provides Route type of the prefix. | ||
65 | + * | ||
66 | + * @return Route type | ||
67 | + */ | ||
68 | + public Type routeType() { | ||
69 | + return routeType; | ||
70 | + } | ||
71 | + | ||
72 | + @Override | ||
73 | + public int hashCode() { | ||
74 | + return Objects.hash(routeType); | ||
75 | + } | ||
76 | + | ||
77 | + @Override | ||
78 | + public boolean equals(Object obj) { | ||
79 | + if (this == obj) { | ||
80 | + return true; | ||
81 | + } | ||
82 | + | ||
83 | + if (obj instanceof RouteType) { | ||
84 | + RouteType other = (RouteType) obj; | ||
85 | + return Objects.equals(routeType, other.routeType); | ||
86 | + } | ||
87 | + return false; | ||
88 | + } | ||
89 | + | ||
90 | + @Override | ||
91 | + public String toString() { | ||
92 | + return toStringHelper(this) | ||
93 | + .add("routeType", routeType) | ||
94 | + .toString(); | ||
95 | + } | ||
96 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Represents Router ID of the device. | ||
24 | + */ | ||
25 | +public class RouterId implements RouteIdentifier { | ||
26 | + private final int routerId; | ||
27 | + private final ProtocolType type; | ||
28 | + | ||
29 | + /** | ||
30 | + * Constructor to initialize its parameters. | ||
31 | + * | ||
32 | + * @param routerId Router ID of designated router | ||
33 | + */ | ||
34 | + public RouterId(int routerId, ProtocolType type) { | ||
35 | + this.routerId = routerId; | ||
36 | + this.type = type; | ||
37 | + } | ||
38 | + | ||
39 | + /** | ||
40 | + * Obtains Router Id of the device. | ||
41 | + * | ||
42 | + * @return Router Id of the device | ||
43 | + */ | ||
44 | + public int routerId() { | ||
45 | + return routerId; | ||
46 | + } | ||
47 | + | ||
48 | + @Override | ||
49 | + public ProtocolType type() { | ||
50 | + return type; | ||
51 | + } | ||
52 | + | ||
53 | + @Override | ||
54 | + public int hashCode() { | ||
55 | + return Objects.hash(routerId, type); | ||
56 | + } | ||
57 | + | ||
58 | + @Override | ||
59 | + public boolean equals(Object obj) { | ||
60 | + if (this == obj) { | ||
61 | + return true; | ||
62 | + } | ||
63 | + | ||
64 | + if (obj instanceof RouterId) { | ||
65 | + RouterId other = (RouterId) obj; | ||
66 | + return Objects.equals(routerId, other.routerId) && Objects.equals(type, other.type); | ||
67 | + } | ||
68 | + return false; | ||
69 | + } | ||
70 | + | ||
71 | + @Override | ||
72 | + public String toString() { | ||
73 | + return toStringHelper(this) | ||
74 | + .add("routerId", routerId) | ||
75 | + .add("type", type) | ||
76 | + .toString(); | ||
77 | + } | ||
78 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Represents signaling protocols that are enabled. | ||
24 | + */ | ||
25 | +public class Signalling { | ||
26 | + private final Boolean ldp; | ||
27 | + private final Boolean rsvpte; | ||
28 | + | ||
29 | + /** | ||
30 | + * Constructor to initialize the values. | ||
31 | + * | ||
32 | + * @param ldp Label Distribution Protocol whether enabled or not | ||
33 | + * @param rsvpte RSVP TE whether enabled or not | ||
34 | + */ | ||
35 | + public Signalling(Boolean ldp, Boolean rsvpte) { | ||
36 | + this.ldp = ldp; | ||
37 | + this.rsvpte = rsvpte; | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * Obtains whether LDP signalling protocol is enabled or not. | ||
42 | + * | ||
43 | + * @return LDP signalling protocol is enabled or not | ||
44 | + */ | ||
45 | + public Boolean ldp() { | ||
46 | + return ldp; | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * Obtains whether rsvp-te signalling protocol is enabled or not. | ||
51 | + * | ||
52 | + * @return rsvp-te signalling protocol is enabled or not | ||
53 | + */ | ||
54 | + public Boolean rsvpte() { | ||
55 | + return rsvpte; | ||
56 | + } | ||
57 | + | ||
58 | + @Override | ||
59 | + public int hashCode() { | ||
60 | + return Objects.hash(ldp, rsvpte); | ||
61 | + } | ||
62 | + | ||
63 | + @Override | ||
64 | + public boolean equals(Object obj) { | ||
65 | + if (this == obj) { | ||
66 | + return true; | ||
67 | + } | ||
68 | + | ||
69 | + if (obj instanceof Signalling) { | ||
70 | + Signalling other = (Signalling) obj; | ||
71 | + return Objects.equals(ldp, other.ldp) && Objects.equals(rsvpte, other.rsvpte); | ||
72 | + } | ||
73 | + return false; | ||
74 | + } | ||
75 | + | ||
76 | + @Override | ||
77 | + public String toString() { | ||
78 | + return toStringHelper(this) | ||
79 | + .add("ldp", ldp) | ||
80 | + .add("rsvpte", rsvpte) | ||
81 | + .toString(); | ||
82 | + } | ||
83 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Represents Shared Risk Link Group information. | ||
24 | + */ | ||
25 | +public class Srlg { | ||
26 | + private final int srlgGroup; | ||
27 | + | ||
28 | + /** | ||
29 | + * Constructor to initialize its parameter. | ||
30 | + * | ||
31 | + * @param srlgGroup list of Shared Risk Link Group value | ||
32 | + */ | ||
33 | + public Srlg(int srlgGroup) { | ||
34 | + this.srlgGroup = srlgGroup; | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Provides Shared Risk link group. | ||
39 | + * | ||
40 | + * @return Shared Risk link group value | ||
41 | + */ | ||
42 | + public int srlgGroup() { | ||
43 | + return srlgGroup; | ||
44 | + } | ||
45 | + | ||
46 | + @Override | ||
47 | + public int hashCode() { | ||
48 | + return Objects.hash(srlgGroup); | ||
49 | + } | ||
50 | + | ||
51 | + @Override | ||
52 | + public boolean equals(Object obj) { | ||
53 | + if (this == obj) { | ||
54 | + return true; | ||
55 | + } | ||
56 | + | ||
57 | + if (obj instanceof Srlg) { | ||
58 | + Srlg other = (Srlg) obj; | ||
59 | + return Objects.equals(srlgGroup, other.srlgGroup); | ||
60 | + } | ||
61 | + return false; | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public String toString() { | ||
66 | + return toStringHelper(this) | ||
67 | + .add("srlgGroup", srlgGroup) | ||
68 | + .toString(); | ||
69 | + } | ||
70 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import java.util.Objects; | ||
19 | + | ||
20 | +import org.onosproject.net.DeviceId; | ||
21 | +import org.onosproject.net.ElementId; | ||
22 | + | ||
23 | +import com.google.common.base.MoreObjects; | ||
24 | + | ||
25 | +/** | ||
26 | + * Abstraction of a network termination point expressed as a pair of the network element identifier and device | ||
27 | + * interface. | ||
28 | + */ | ||
29 | +public class TerminationPoint { | ||
30 | + private final ElementId elementId; | ||
31 | + private final DeviceInterface deviceInterface; | ||
32 | + | ||
33 | + /** | ||
34 | + * Constructor to initialize its parameters. | ||
35 | + * | ||
36 | + * @param elementId network element identifier | ||
37 | + * @param deviceInterface device interface | ||
38 | + */ | ||
39 | + public TerminationPoint(ElementId elementId, DeviceInterface deviceInterface) { | ||
40 | + this.elementId = elementId; | ||
41 | + this.deviceInterface = deviceInterface; | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * Returns the network element identifier. | ||
46 | + * | ||
47 | + * @return element identifier | ||
48 | + */ | ||
49 | + public ElementId elementId() { | ||
50 | + return elementId; | ||
51 | + } | ||
52 | + | ||
53 | + /** | ||
54 | + * Returns the identifier of the infrastructure device if the termination | ||
55 | + * point belongs to a network element which is indeed an ip | ||
56 | + * device. | ||
57 | + * | ||
58 | + * @return network element identifier as a device identifier | ||
59 | + * @throws java.lang.IllegalStateException if termination point is not | ||
60 | + * associated with a device | ||
61 | + */ | ||
62 | + public DeviceId deviceId() { | ||
63 | + if (elementId instanceof DeviceId) { | ||
64 | + return (DeviceId) elementId; | ||
65 | + } | ||
66 | + throw new IllegalStateException("Termination point not associated " + | ||
67 | + "with an ip device"); | ||
68 | + } | ||
69 | + | ||
70 | + /** | ||
71 | + * Returns Device interface details. | ||
72 | + * | ||
73 | + * @return device interface details | ||
74 | + */ | ||
75 | + public DeviceInterface deviceInterface() { | ||
76 | + return deviceInterface; | ||
77 | + } | ||
78 | + | ||
79 | + @Override | ||
80 | + public int hashCode() { | ||
81 | + return Objects.hash(elementId, deviceInterface); | ||
82 | + } | ||
83 | + | ||
84 | + @Override | ||
85 | + public boolean equals(Object obj) { | ||
86 | + if (this == obj) { | ||
87 | + return true; | ||
88 | + } | ||
89 | + if (obj instanceof TerminationPoint) { | ||
90 | + final TerminationPoint other = (TerminationPoint) obj; | ||
91 | + return Objects.equals(this.elementId, other.elementId) | ||
92 | + && Objects.equals(this.deviceInterface, other.deviceInterface); | ||
93 | + } | ||
94 | + return false; | ||
95 | + } | ||
96 | + | ||
97 | + @Override | ||
98 | + public String toString() { | ||
99 | + return MoreObjects.toStringHelper(this) | ||
100 | + .add("elementId", elementId) | ||
101 | + .add("deviceInterface", deviceInterface) | ||
102 | + .toString(); | ||
103 | + } | ||
104 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api; | ||
17 | + | ||
18 | +import java.util.Objects; | ||
19 | + | ||
20 | +import com.google.common.base.MoreObjects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Represents Multi-Topology IDs for a network link, node or prefix. | ||
24 | + */ | ||
25 | +public class TopologyId { | ||
26 | + private final short topologyId; | ||
27 | + | ||
28 | + /** | ||
29 | + * Constructor to initialize its parameter. | ||
30 | + * | ||
31 | + * @param topologyId topology id for node/link/prefix | ||
32 | + */ | ||
33 | + public TopologyId(short topologyId) { | ||
34 | + this.topologyId = topologyId; | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Obtains the topology ID. | ||
39 | + * | ||
40 | + * @return topology ID | ||
41 | + */ | ||
42 | + public short topologyId() { | ||
43 | + return topologyId; | ||
44 | + } | ||
45 | + | ||
46 | + @Override | ||
47 | + public int hashCode() { | ||
48 | + return Objects.hash(topologyId); | ||
49 | + } | ||
50 | + | ||
51 | + @Override | ||
52 | + public boolean equals(Object obj) { | ||
53 | + if (this == obj) { | ||
54 | + return true; | ||
55 | + } | ||
56 | + | ||
57 | + if (obj instanceof TopologyId) { | ||
58 | + TopologyId other = (TopologyId) obj; | ||
59 | + return Objects.equals(topologyId, other.topologyId); | ||
60 | + } | ||
61 | + return false; | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public String toString() { | ||
66 | + return MoreObjects.toStringHelper(getClass()) | ||
67 | + .add("topologyId", topologyId) | ||
68 | + .toString(); | ||
69 | + } | ||
70 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.device; | ||
17 | + | ||
18 | +import com.google.common.base.MoreObjects; | ||
19 | +import org.onlab.packet.Ip6Address; | ||
20 | +import org.onlab.packet.Ip4Address; | ||
21 | +import org.onosproject.iptopology.api.InterfaceIdentifier; | ||
22 | +import org.onosproject.net.AbstractDescription; | ||
23 | +import org.onosproject.net.SparseAnnotations; | ||
24 | + | ||
25 | +/** | ||
26 | + * Default implementation of immutable Interface description. | ||
27 | + */ | ||
28 | +public class DefaultInterfaceDescription extends AbstractDescription | ||
29 | + implements InterfaceDescription { | ||
30 | + | ||
31 | + private final InterfaceIdentifier intfId; | ||
32 | + private final Ip4Address ipv4Address; | ||
33 | + private final Ip6Address ipv6Address; | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + /** | ||
38 | + * Creates an interface description using the supplied information. | ||
39 | + * | ||
40 | + * @param intfId interface identifier | ||
41 | + * @param ipv4Address ipv4 address of an interface | ||
42 | + * @param ipv6Address ipv6 address of an interface | ||
43 | + * @param annotations optional key/value annotations map | ||
44 | + */ | ||
45 | + public DefaultInterfaceDescription(InterfaceIdentifier intfId, Ip4Address ipv4Address, | ||
46 | + Ip6Address ipv6Address, SparseAnnotations...annotations) { | ||
47 | + super(annotations); | ||
48 | + this.intfId = intfId; | ||
49 | + this.ipv4Address = ipv4Address; | ||
50 | + this.ipv6Address = ipv6Address; | ||
51 | + } | ||
52 | + | ||
53 | + /** | ||
54 | + * Default constructor for serialization. | ||
55 | + */ | ||
56 | + private DefaultInterfaceDescription() { | ||
57 | + this.intfId = null; | ||
58 | + this.ipv4Address = null; | ||
59 | + this.ipv6Address = null; | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * Creates an interface description using the supplied information. | ||
64 | + * | ||
65 | + * @param base InterfaceDescription to get basic information from | ||
66 | + * @param annotations optional key/value annotations map | ||
67 | + */ | ||
68 | + public DefaultInterfaceDescription(InterfaceDescription base, | ||
69 | + SparseAnnotations annotations) { | ||
70 | + this(base.intfId(), base.ipv4Address(), base.ipv6Address(), annotations); | ||
71 | + } | ||
72 | + | ||
73 | + @Override | ||
74 | + public InterfaceIdentifier intfId() { | ||
75 | + return intfId; | ||
76 | + } | ||
77 | + | ||
78 | + @Override | ||
79 | + public Ip4Address ipv4Address() { | ||
80 | + return ipv4Address; | ||
81 | + } | ||
82 | + | ||
83 | + @Override | ||
84 | + public Ip6Address ipv6Address() { | ||
85 | + return ipv6Address; } | ||
86 | + | ||
87 | + @Override | ||
88 | + public String toString() { | ||
89 | + return MoreObjects.toStringHelper(getClass()) | ||
90 | + .add("intfId", intfId) | ||
91 | + .add("ipv4Address", ipv4Address) | ||
92 | + .add("ipv6Address", ipv6Address) | ||
93 | + .add("annotations", annotations()) | ||
94 | + .toString(); | ||
95 | + } | ||
96 | + | ||
97 | +} |
1 | +/* | ||
2 | + * Copyright 2014-2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.device; | ||
17 | + | ||
18 | +import org.onosproject.iptopology.api.DeviceTed; | ||
19 | +import org.onosproject.iptopology.api.IpDeviceIdentifier; | ||
20 | +import org.onosproject.net.AbstractDescription; | ||
21 | +import org.onosproject.net.SparseAnnotations; | ||
22 | + | ||
23 | +import java.net.URI; | ||
24 | + | ||
25 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
26 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
27 | +import static org.onosproject.iptopology.api.IpDevice.Type; | ||
28 | + | ||
29 | +/** | ||
30 | + * Default implementation of immutable device description entity. | ||
31 | + */ | ||
32 | +public class DefaultIpDeviceDescription extends AbstractDescription | ||
33 | + implements IpDeviceDescription { | ||
34 | + private final URI uri; | ||
35 | + private final Type type; | ||
36 | + private final IpDeviceIdentifier deviceIdentifier; | ||
37 | + private final DeviceTed deviceTed; | ||
38 | + | ||
39 | + /** | ||
40 | + * Creates an ip device description using the supplied information. | ||
41 | + * | ||
42 | + * @param uri device URI | ||
43 | + * @param type device type | ||
44 | + * @param deviceIdentifier device manufacturer | ||
45 | + * @param deviceTed device Traffic Engineering parameters | ||
46 | + * @param annotations optional key/value annotations map | ||
47 | + */ | ||
48 | + public DefaultIpDeviceDescription(URI uri, Type type, IpDeviceIdentifier deviceIdentifier, | ||
49 | + DeviceTed deviceTed, SparseAnnotations... annotations) { | ||
50 | + super(annotations); | ||
51 | + this.uri = checkNotNull(uri, "Device URI cannot be null"); | ||
52 | + this.type = checkNotNull(type, "Device type cannot be null"); | ||
53 | + this.deviceIdentifier = deviceIdentifier; | ||
54 | + this.deviceTed = deviceTed; | ||
55 | + } | ||
56 | + | ||
57 | + /** | ||
58 | + * Creates an ip device description using the supplied information. | ||
59 | + * @param base IpDeviceDescription to basic information | ||
60 | + * @param annotations Annotations to use. | ||
61 | + */ | ||
62 | + public DefaultIpDeviceDescription(IpDeviceDescription base, SparseAnnotations... annotations) { | ||
63 | + this(base.deviceURI(), base.type(), base.deviceIdentifier(), | ||
64 | + base.deviceTed(), annotations); | ||
65 | + } | ||
66 | + | ||
67 | + /** | ||
68 | + * Creates an ip device description using the supplied information. | ||
69 | + * @param base IpDeviceDescription to basic information (except for type) | ||
70 | + * @param type device type | ||
71 | + * @param annotations Annotations to use. | ||
72 | + */ | ||
73 | + public DefaultIpDeviceDescription(IpDeviceDescription base, Type type, SparseAnnotations... annotations) { | ||
74 | + this(base.deviceURI(), type, base.deviceIdentifier(), | ||
75 | + base.deviceTed(), annotations); | ||
76 | + } | ||
77 | + | ||
78 | + @Override | ||
79 | + public URI deviceURI() { | ||
80 | + return uri; | ||
81 | + } | ||
82 | + | ||
83 | + @Override | ||
84 | + public Type type() { | ||
85 | + return type; | ||
86 | + } | ||
87 | + | ||
88 | + @Override | ||
89 | + public IpDeviceIdentifier deviceIdentifier() { | ||
90 | + return deviceIdentifier; | ||
91 | + } | ||
92 | + | ||
93 | + @Override | ||
94 | + public DeviceTed deviceTed() { | ||
95 | + return deviceTed; | ||
96 | + } | ||
97 | + | ||
98 | + @Override | ||
99 | + public String toString() { | ||
100 | + return toStringHelper(this) | ||
101 | + .add("uri", uri) | ||
102 | + .add("type", type) | ||
103 | + .add("devid", deviceIdentifier) | ||
104 | + .add("devTed", deviceTed) | ||
105 | + .toString(); | ||
106 | + } | ||
107 | + | ||
108 | + /** | ||
109 | + * Default constructor for serialization. | ||
110 | + */ | ||
111 | + private DefaultIpDeviceDescription() { | ||
112 | + this.uri = null; | ||
113 | + this.type = null; | ||
114 | + this.deviceIdentifier = null; | ||
115 | + this.deviceTed = null; | ||
116 | + } | ||
117 | +} |
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.device; | ||
17 | + | ||
18 | +import com.google.common.base.MoreObjects; | ||
19 | +import org.onosproject.iptopology.api.PrefixIdentifier; | ||
20 | +import org.onosproject.iptopology.api.PrefixTed; | ||
21 | +import org.onosproject.net.AbstractDescription; | ||
22 | +import org.onosproject.net.SparseAnnotations; | ||
23 | + | ||
24 | +/** | ||
25 | + * Default implementation of immutable Prefix description. | ||
26 | + */ | ||
27 | +public class DefaultPrefixDescription extends AbstractDescription | ||
28 | + implements PrefixDescription { | ||
29 | + | ||
30 | + private final PrefixIdentifier prefixIdentifier; | ||
31 | + private final PrefixTed prefixTed; | ||
32 | + | ||
33 | + | ||
34 | + /** | ||
35 | + * Creates prefix description using the supplied information. | ||
36 | + * | ||
37 | + * @param prefixIdentifier prefix identifier | ||
38 | + * @param prefixTed prefix traffic engineering parameters | ||
39 | + * @param annotations optional key/value annotations map | ||
40 | + */ | ||
41 | + public DefaultPrefixDescription(PrefixIdentifier prefixIdentifier, PrefixTed prefixTed, | ||
42 | + SparseAnnotations...annotations) { | ||
43 | + super(annotations); | ||
44 | + this.prefixIdentifier = prefixIdentifier; | ||
45 | + this.prefixTed = prefixTed; | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * Default constructor for serialization. | ||
50 | + */ | ||
51 | + private DefaultPrefixDescription() { | ||
52 | + this.prefixIdentifier = null; | ||
53 | + this.prefixTed = null; | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * Creates prefix description using the supplied information. | ||
58 | + * | ||
59 | + * @param base PrefixDescription to get basic information from | ||
60 | + * @param annotations optional key/value annotations map | ||
61 | + */ | ||
62 | + public DefaultPrefixDescription(PrefixDescription base, | ||
63 | + SparseAnnotations annotations) { | ||
64 | + this(base.prefixIdentifier(), base.prefixTed(), annotations); | ||
65 | + } | ||
66 | + | ||
67 | + @Override | ||
68 | + public PrefixIdentifier prefixIdentifier() { | ||
69 | + return prefixIdentifier; | ||
70 | + } | ||
71 | + | ||
72 | + @Override | ||
73 | + public PrefixTed prefixTed() { | ||
74 | + return prefixTed; | ||
75 | + } | ||
76 | + | ||
77 | + @Override | ||
78 | + public String toString() { | ||
79 | + return MoreObjects.toStringHelper(getClass()) | ||
80 | + .add("prefixIdentifier", prefixIdentifier) | ||
81 | + .add("prefixTed", prefixTed) | ||
82 | + .add("annotations", annotations()) | ||
83 | + .toString(); | ||
84 | + } | ||
85 | + | ||
86 | +} |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/InterfaceDescription.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.device; | ||
17 | + | ||
18 | +import org.onlab.packet.Ip4Address; | ||
19 | +import org.onlab.packet.Ip6Address; | ||
20 | +import org.onosproject.iptopology.api.InterfaceIdentifier; | ||
21 | +import org.onosproject.net.Description; | ||
22 | + | ||
23 | + | ||
24 | +/** | ||
25 | + * Information about an interface. | ||
26 | + */ | ||
27 | +public interface InterfaceDescription extends Description { | ||
28 | + | ||
29 | + /** | ||
30 | + * Returns the IPv4 Address of an interface. | ||
31 | + * | ||
32 | + * @return ipv4 address | ||
33 | + */ | ||
34 | + Ip4Address ipv4Address(); | ||
35 | + | ||
36 | + /** | ||
37 | + * Returns the IPv6 Address of an interface. | ||
38 | + * | ||
39 | + * @return ipv6 address | ||
40 | + */ | ||
41 | + Ip6Address ipv6Address(); | ||
42 | + | ||
43 | + | ||
44 | + /** | ||
45 | + * Returns the interface id of the interface. | ||
46 | + * | ||
47 | + * @return interface identifier | ||
48 | + */ | ||
49 | + InterfaceIdentifier intfId(); | ||
50 | + | ||
51 | +} |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceDescription.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014-2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.device; | ||
17 | + | ||
18 | +import org.onosproject.iptopology.api.DeviceTed; | ||
19 | +import org.onosproject.iptopology.api.IpDevice; | ||
20 | +import org.onosproject.iptopology.api.IpDeviceIdentifier; | ||
21 | +import org.onosproject.net.Description; | ||
22 | + | ||
23 | + | ||
24 | +import java.net.URI; | ||
25 | + | ||
26 | +/** | ||
27 | + * Carrier of immutable information about an ip device. | ||
28 | + */ | ||
29 | +public interface IpDeviceDescription extends Description { | ||
30 | + | ||
31 | + /** | ||
32 | + * Protocol/provider specific URI that can be used to encode the identity | ||
33 | + * information required to communicate with the ip device externally, e.g. | ||
34 | + * datapath ID. | ||
35 | + * | ||
36 | + * @return provider specific URI for the ip device | ||
37 | + */ | ||
38 | + URI deviceURI(); | ||
39 | + | ||
40 | + /** | ||
41 | + * Returns the type of the ip device. For ex: Psuedo or actual | ||
42 | + * | ||
43 | + * @return type of the device | ||
44 | + */ | ||
45 | + IpDevice.Type type(); | ||
46 | + | ||
47 | + /** | ||
48 | + * Returns the device identifier details. | ||
49 | + * | ||
50 | + * @return identifier of the device | ||
51 | + */ | ||
52 | + IpDeviceIdentifier deviceIdentifier(); | ||
53 | + | ||
54 | + /** | ||
55 | + * Returns the traffic engineering parameters of the device. | ||
56 | + * | ||
57 | + * @return traffic engineering parameters of the device | ||
58 | + */ | ||
59 | + DeviceTed deviceTed(); | ||
60 | + | ||
61 | +} |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceEvent.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014-2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.device; | ||
17 | + | ||
18 | +import org.joda.time.LocalDateTime; | ||
19 | +import org.onosproject.event.AbstractEvent; | ||
20 | +import org.onosproject.iptopology.api.DeviceIntf; | ||
21 | +import org.onosproject.iptopology.api.DevicePrefix; | ||
22 | +import org.onosproject.iptopology.api.IpDevice; | ||
23 | + | ||
24 | + | ||
25 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
26 | + | ||
27 | +/** | ||
28 | + * Describes ip device event. | ||
29 | + */ | ||
30 | +public class IpDeviceEvent extends AbstractEvent<IpDeviceEvent.Type, IpDevice> { | ||
31 | + | ||
32 | + private final DeviceIntf devInterface; | ||
33 | + private final DevicePrefix devicePrefix; | ||
34 | + | ||
35 | + /** | ||
36 | + * Type of device events. | ||
37 | + */ | ||
38 | + public enum Type { | ||
39 | + /** | ||
40 | + * Signifies that a new device has been detected. | ||
41 | + */ | ||
42 | + DEVICE_ADDED, | ||
43 | + | ||
44 | + /** | ||
45 | + * Signifies that some device attributes have changed; excludes | ||
46 | + * availability changes. | ||
47 | + */ | ||
48 | + DEVICE_UPDATED, | ||
49 | + | ||
50 | + /** | ||
51 | + * Signifies that a device has been removed. | ||
52 | + */ | ||
53 | + DEVICE_REMOVED, | ||
54 | + | ||
55 | + /** | ||
56 | + * Signifies that an interface has been added. | ||
57 | + */ | ||
58 | + INTERFACE_ADDED, | ||
59 | + | ||
60 | + /** | ||
61 | + * Signifies that an interface has been updated. | ||
62 | + */ | ||
63 | + INTERFACE_UPDATED, | ||
64 | + | ||
65 | + /** | ||
66 | + * Signifies that an interface has been removed. | ||
67 | + */ | ||
68 | + INTERFACE_REMOVED, | ||
69 | + | ||
70 | + /** | ||
71 | + * Signifies that a prefix has been added. | ||
72 | + */ | ||
73 | + PREFIX_ADDED, | ||
74 | + | ||
75 | + /** | ||
76 | + * Signifies that a prefix has been updated. | ||
77 | + */ | ||
78 | + PREFIX_UPDATED, | ||
79 | + | ||
80 | + /** | ||
81 | + * Signifies that a prefix has been removed. | ||
82 | + */ | ||
83 | + PREFIX_REMOVED, | ||
84 | + | ||
85 | + } | ||
86 | + | ||
87 | + /** | ||
88 | + * Creates an event of a given type and for the specified ip device. | ||
89 | + * | ||
90 | + * @param type device event type | ||
91 | + * @param device event device subject | ||
92 | + */ | ||
93 | + public IpDeviceEvent(Type type, IpDevice device) { | ||
94 | + this(type, device, null, null); | ||
95 | + } | ||
96 | + | ||
97 | + /** | ||
98 | + * Creates an event of a given type and for the specified device and interface. | ||
99 | + * | ||
100 | + * @param type device event type | ||
101 | + * @param device event device subject | ||
102 | + * @param devInterface optional interface subject | ||
103 | + */ | ||
104 | + public IpDeviceEvent(Type type, IpDevice device, DeviceIntf devInterface) { | ||
105 | + this(type, device, devInterface, null); | ||
106 | + } | ||
107 | + | ||
108 | + /** | ||
109 | + * Creates an event of a given type and for the specified device and interface. | ||
110 | + * | ||
111 | + * @param type device event type | ||
112 | + * @param device event device subject | ||
113 | + * @param devicePrefix optional prefix subject | ||
114 | + */ | ||
115 | + public IpDeviceEvent(Type type, IpDevice device, DevicePrefix devicePrefix) { | ||
116 | + this(type, device, null, devicePrefix); | ||
117 | + } | ||
118 | + | ||
119 | + | ||
120 | + /** | ||
121 | + * Creates an event of a given type and for the specified device, interface and prefix. | ||
122 | + * | ||
123 | + * @param type device event type | ||
124 | + * @param device event device subject | ||
125 | + * @param devInterface optional interface subject | ||
126 | + * @param devicePrefix optional prefix subject | ||
127 | + */ | ||
128 | + public IpDeviceEvent(Type type, IpDevice device, DeviceIntf devInterface, DevicePrefix devicePrefix) { | ||
129 | + super(type, device); | ||
130 | + this.devInterface = devInterface; | ||
131 | + this.devicePrefix = devicePrefix; | ||
132 | + } | ||
133 | + | ||
134 | + | ||
135 | + /** | ||
136 | + * Creates an event of a given type and for the specified device, interface and time. | ||
137 | + * | ||
138 | + * @param type device event type | ||
139 | + * @param device event device subject | ||
140 | + * @param devInterface optional interface subject | ||
141 | + * @param devicePrefix optional prefix subject | ||
142 | + * @param time occurrence time | ||
143 | + */ | ||
144 | + | ||
145 | + public IpDeviceEvent(Type type, IpDevice device, DeviceIntf devInterface, DevicePrefix devicePrefix, long time) { | ||
146 | + super(type, device, time); | ||
147 | + this.devInterface = devInterface; | ||
148 | + this.devicePrefix = devicePrefix; | ||
149 | + } | ||
150 | + | ||
151 | + | ||
152 | + /** | ||
153 | + * Returns the interface subject. | ||
154 | + * | ||
155 | + * @return interface subject or null if the event is not interface specific. | ||
156 | + */ | ||
157 | + public DeviceIntf deviceInterface() { | ||
158 | + return devInterface; | ||
159 | + } | ||
160 | + | ||
161 | + /** | ||
162 | + * Returns the prefix subject. | ||
163 | + * | ||
164 | + * @return prefix subject or null if the event is not prefix specific. | ||
165 | + */ | ||
166 | + public DevicePrefix prefix() { | ||
167 | + return devicePrefix; | ||
168 | + } | ||
169 | + | ||
170 | + @Override | ||
171 | + public String toString() { | ||
172 | + if (devInterface == null || devicePrefix == null) { | ||
173 | + return super.toString(); | ||
174 | + } | ||
175 | + return toStringHelper(this) | ||
176 | + .add("time", new LocalDateTime(time())) | ||
177 | + .add("type", type()) | ||
178 | + .add("subject", subject()) | ||
179 | + .add("interface", devInterface) | ||
180 | + .add("prefix", devicePrefix) | ||
181 | + .toString(); | ||
182 | + } | ||
183 | +} |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceListener.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.device; | ||
17 | + | ||
18 | +import org.onosproject.event.EventListener; | ||
19 | + | ||
20 | +/** | ||
21 | + * Entity capable of receiving ip device related events. | ||
22 | + */ | ||
23 | +public interface IpDeviceListener extends EventListener<IpDeviceEvent> { | ||
24 | +} |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceProvider.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.device; | ||
17 | + | ||
18 | +import org.onosproject.net.provider.Provider; | ||
19 | + | ||
20 | +/** | ||
21 | + * Abstraction of a ip device information provider. | ||
22 | + */ | ||
23 | +public interface IpDeviceProvider extends Provider { | ||
24 | + // Currently there is none to set some information into the network | ||
25 | +} |
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.device; | ||
17 | + | ||
18 | +import org.onosproject.net.provider.ProviderRegistry; | ||
19 | + | ||
20 | +/** | ||
21 | + * Abstraction of a ip device provider registry. | ||
22 | + */ | ||
23 | +public interface IpDeviceProviderRegistry | ||
24 | + extends ProviderRegistry<IpDeviceProvider, IpDeviceProviderService> { | ||
25 | +} |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceProviderService.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014-2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.device; | ||
17 | + | ||
18 | +import org.onosproject.net.DeviceId; | ||
19 | +import org.onosproject.net.provider.ProviderService; | ||
20 | + | ||
21 | +import java.util.List; | ||
22 | + | ||
23 | +/** | ||
24 | + * Service through which ip device providers can inject ip device information into | ||
25 | + * the core. | ||
26 | + */ | ||
27 | +public interface IpDeviceProviderService extends ProviderService<IpDeviceProvider> { | ||
28 | + | ||
29 | + /** | ||
30 | + * Signals the core that an ip device is added or updated with IP topology information. | ||
31 | + * | ||
32 | + * @param deviceId device identifier | ||
33 | + * @param deviceDescription information about network ip device | ||
34 | + */ | ||
35 | + void addOrUpdateIpDevice(DeviceId deviceId, IpDeviceDescription deviceDescription); | ||
36 | + | ||
37 | + /** | ||
38 | + * Signals the core that an ip device is removed. | ||
39 | + * | ||
40 | + * @param deviceId identity of the ip device to be removed | ||
41 | + */ | ||
42 | + void removeIpDevice(DeviceId deviceId); | ||
43 | + | ||
44 | + /** | ||
45 | + * Sends information about all interfaces of a device. It is up to the core to | ||
46 | + * determine what has changed. | ||
47 | + * | ||
48 | + * @param deviceId identity of the ip device | ||
49 | + * @param interfaceDescriptions list of device interfaces | ||
50 | + */ | ||
51 | + void updateInterfaces(DeviceId deviceId, List<InterfaceDescription> interfaceDescriptions); | ||
52 | + | ||
53 | + /** | ||
54 | + * signals interfaces of a device is deleted. | ||
55 | + * | ||
56 | + * @param deviceId identity of the ip device | ||
57 | + * @param interfaceDescriptions list of device interfaces | ||
58 | + */ | ||
59 | + void removeInterfaces(DeviceId deviceId, List<InterfaceDescription> interfaceDescriptions); | ||
60 | + | ||
61 | + /** | ||
62 | + * Sends information about all ip prefix of a device. It is up to the core to | ||
63 | + * determine what has changed. | ||
64 | + * | ||
65 | + * @param deviceId identity of the ip device | ||
66 | + * @param prefixDescriptions list of device ip prefixes | ||
67 | + */ | ||
68 | + void updatePrefixes(DeviceId deviceId, List<PrefixDescription> prefixDescriptions); | ||
69 | + | ||
70 | + /** | ||
71 | + * signals ip prefix of a device is deleted. | ||
72 | + * | ||
73 | + * @param deviceId identity of the ip device | ||
74 | + * @param prefixDescriptions list of device ip prefixes | ||
75 | + */ | ||
76 | + void removePrefixes(DeviceId deviceId, List<PrefixDescription> prefixDescriptions); | ||
77 | + | ||
78 | +} |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceService.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014-2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.device; | ||
17 | + | ||
18 | +import org.onosproject.event.ListenerService; | ||
19 | +import org.onosproject.iptopology.api.DeviceIntf; | ||
20 | +import org.onosproject.iptopology.api.DevicePrefix; | ||
21 | +import org.onosproject.iptopology.api.InterfaceIdentifier; | ||
22 | +import org.onosproject.iptopology.api.IpDevice; | ||
23 | +import org.onosproject.net.DeviceId; | ||
24 | +import org.onlab.packet.Ip4Address; | ||
25 | +import org.onlab.packet.Ip6Address; | ||
26 | + | ||
27 | +import java.util.List; | ||
28 | + | ||
29 | +/** | ||
30 | + * Service for interacting with the inventory of ip devices. | ||
31 | + */ | ||
32 | +public interface IpDeviceService | ||
33 | + extends ListenerService<IpDeviceEvent, IpDeviceListener> { | ||
34 | + | ||
35 | + /** | ||
36 | + * Returns the number of ip devices known to the system. | ||
37 | + * | ||
38 | + * @return number of infrastructure devices | ||
39 | + */ | ||
40 | + int getIpDeviceCount(); | ||
41 | + | ||
42 | + /** | ||
43 | + * Returns a collection of the currently known ip | ||
44 | + * devices. | ||
45 | + * | ||
46 | + * @return collection of devices | ||
47 | + */ | ||
48 | + Iterable<IpDevice> getIpDevices(); | ||
49 | + | ||
50 | + /** | ||
51 | + * Returns a collection of the currently known ip | ||
52 | + * devices by device type. | ||
53 | + * | ||
54 | + * @param type device type | ||
55 | + * @return collection of devices | ||
56 | + */ | ||
57 | + Iterable<IpDevice> getIpDevices(IpDevice.Type type); | ||
58 | + | ||
59 | + | ||
60 | + /** | ||
61 | + * Returns the ip device with the specified identifier. | ||
62 | + * | ||
63 | + * @param deviceId device identifier | ||
64 | + * @return device or null if one with the given identifier is not known | ||
65 | + */ | ||
66 | + IpDevice getIpDevice(DeviceId deviceId); | ||
67 | + | ||
68 | + /** | ||
69 | + * Returns the list of interfaces associated with the device. | ||
70 | + * | ||
71 | + * @param deviceId device identifier | ||
72 | + * @return list of device interfaces | ||
73 | + */ | ||
74 | + List<DeviceIntf> getInterfaces(DeviceId deviceId); | ||
75 | + | ||
76 | + /** | ||
77 | + * Returns the interface with the specified ipv4 address and hosted by the given device. | ||
78 | + * | ||
79 | + * @param deviceId device identifier | ||
80 | + * @param ipv4Address ipv4 address | ||
81 | + * @return device interface | ||
82 | + */ | ||
83 | + DeviceIntf getInterface(DeviceId deviceId, Ip4Address ipv4Address); | ||
84 | + | ||
85 | + /** | ||
86 | + * Returns the interface with the specified ipv6 address and hosted by the given device. | ||
87 | + * | ||
88 | + * @param deviceId device identifier | ||
89 | + * @param ipv6Address ipv6 address | ||
90 | + * @return device interface | ||
91 | + */ | ||
92 | + DeviceIntf getInterface(DeviceId deviceId, Ip6Address ipv6Address); | ||
93 | + | ||
94 | + /** | ||
95 | + * Returns the interface with the specified interface id and hosted by the given device. | ||
96 | + * | ||
97 | + * @param deviceId device identifier | ||
98 | + * @param intfId interface id | ||
99 | + * @return device interface | ||
100 | + */ | ||
101 | + DeviceIntf getInterface(DeviceId deviceId, InterfaceIdentifier intfId); | ||
102 | + | ||
103 | + /** | ||
104 | + * Returns the list of ip prefix associated with the device. | ||
105 | + * | ||
106 | + * @param deviceId device identifier | ||
107 | + * @return list of device prefixes | ||
108 | + */ | ||
109 | + List<DevicePrefix> getPrefixes(DeviceId deviceId); | ||
110 | + | ||
111 | +} |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceStore.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014-2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.device; | ||
17 | + | ||
18 | +import org.onlab.packet.Ip4Address; | ||
19 | +import org.onlab.packet.Ip6Address; | ||
20 | +import org.onosproject.iptopology.api.DevicePrefix; | ||
21 | +import org.onosproject.iptopology.api.InterfaceIdentifier; | ||
22 | +import org.onosproject.iptopology.api.IpDevice; | ||
23 | +import org.onosproject.iptopology.api.DeviceIntf; | ||
24 | +import org.onosproject.net.DeviceId; | ||
25 | +import org.onosproject.net.provider.ProviderId; | ||
26 | +import org.onosproject.store.Store; | ||
27 | + | ||
28 | +import java.util.List; | ||
29 | + | ||
30 | +/** | ||
31 | + * Manages inventory of ip devices; not intended for direct use. | ||
32 | + */ | ||
33 | +public interface IpDeviceStore extends Store<IpDeviceEvent, IpDeviceStoreDelegate> { | ||
34 | + | ||
35 | + /** | ||
36 | + * Returns the number of ip devices known to the system. | ||
37 | + * | ||
38 | + * @return number of ip devices | ||
39 | + */ | ||
40 | + int getIpDeviceCount(); | ||
41 | + | ||
42 | + /** | ||
43 | + * Returns an iterable collection of all ip devices known to the system. | ||
44 | + * | ||
45 | + * @return ip device collection | ||
46 | + */ | ||
47 | + Iterable<IpDevice> getIpDevices(); | ||
48 | + | ||
49 | + | ||
50 | + /** | ||
51 | + * Returns an ip device with the specified identifier. | ||
52 | + * | ||
53 | + * @param deviceId device identifier | ||
54 | + * @return ip device | ||
55 | + */ | ||
56 | + IpDevice getIpDevice(DeviceId deviceId); | ||
57 | + | ||
58 | + /** | ||
59 | + * Creates a new infrastructure ip device, or updates an existing one using | ||
60 | + * the supplied device description. | ||
61 | + * | ||
62 | + * @param providerId provider identifier | ||
63 | + * @param deviceId device identifier | ||
64 | + * @param deviceDescription device description | ||
65 | + * @return ready to send event describing what occurred; null if no change | ||
66 | + */ | ||
67 | + IpDeviceEvent createOrUpdateIpDevice(ProviderId providerId, DeviceId deviceId, | ||
68 | + IpDeviceDescription deviceDescription); | ||
69 | + | ||
70 | + /** | ||
71 | + * Administratively removes the specified ip device from the store. | ||
72 | + * | ||
73 | + * @param deviceId device to be removed | ||
74 | + * @return null if no such ip device | ||
75 | + */ | ||
76 | + IpDeviceEvent removeIpDevice(DeviceId deviceId); | ||
77 | + | ||
78 | + /** | ||
79 | + * Updates the interface of the specified ip device using the given | ||
80 | + * list of interface descriptions. The list is assumed to be comprehensive. | ||
81 | + * | ||
82 | + * @param providerId provider identifier | ||
83 | + * @param deviceId ip device identifier | ||
84 | + * @param interfaceDescriptions list of interface descriptions | ||
85 | + * @return ready to send events describing what occurred; empty list if no change | ||
86 | + */ | ||
87 | + List<IpDeviceEvent> updateInterfaces(ProviderId providerId, DeviceId deviceId, | ||
88 | + List<InterfaceDescription> interfaceDescriptions); | ||
89 | + | ||
90 | + /** | ||
91 | + * Administratively removes the specified interface from the store. | ||
92 | + * | ||
93 | + * @param deviceId device of the interfaces to be removed | ||
94 | + * @param interfaceDescriptions list of interface descriptions | ||
95 | + * @return ready to send events describing what occurred. | ||
96 | + */ | ||
97 | + List<IpDeviceEvent> removeInterfaces(DeviceId deviceId, List<InterfaceDescription> interfaceDescriptions); | ||
98 | + | ||
99 | + /** | ||
100 | + * Returns the list of interfaces that belong to the specified device. | ||
101 | + * | ||
102 | + * @param deviceId device identifier | ||
103 | + * @return list of device interfaces | ||
104 | + */ | ||
105 | + List<DeviceIntf> getInterfaces(DeviceId deviceId); | ||
106 | + | ||
107 | + /** | ||
108 | + * Returns the specified device interface. | ||
109 | + * | ||
110 | + * @param deviceId device identifier | ||
111 | + * @param ipv4Address ipv4 address of the interface | ||
112 | + * @return device interface | ||
113 | + */ | ||
114 | + DeviceIntf getInterface(DeviceId deviceId, Ip4Address ipv4Address); | ||
115 | + | ||
116 | + /** | ||
117 | + * Returns the specified device interface. | ||
118 | + * | ||
119 | + * @param deviceId device identifier | ||
120 | + * @param ipv6Address ipv6 address of the interface | ||
121 | + * @return device interface | ||
122 | + */ | ||
123 | + DeviceIntf getInterface(DeviceId deviceId, Ip6Address ipv6Address); | ||
124 | + | ||
125 | + /** | ||
126 | + * Returns the specified device interface. | ||
127 | + * | ||
128 | + * @param deviceId device identifier | ||
129 | + * @param intfId interface identifier of the interface | ||
130 | + * @return device interface | ||
131 | + */ | ||
132 | + DeviceIntf getInterface(DeviceId deviceId, InterfaceIdentifier intfId); | ||
133 | + | ||
134 | + /** | ||
135 | + * Updates the prefix information of the specified ip device using the given | ||
136 | + * list of prefix descriptions. The list is assumed to be comprehensive. | ||
137 | + * | ||
138 | + * @param providerId provider identifier | ||
139 | + * @param deviceId ip device identifier | ||
140 | + * @param prefixDescriptions list of prefix descriptions | ||
141 | + * @return ready to send events describing what occurred; empty list if no change | ||
142 | + */ | ||
143 | + List<IpDeviceEvent> updatePrefixes(ProviderId providerId, DeviceId deviceId, | ||
144 | + List<PrefixDescription> prefixDescriptions); | ||
145 | + | ||
146 | + /** | ||
147 | + * Administratively removes the specified prefix from the store. | ||
148 | + * | ||
149 | + * @param deviceId device of the prefix to be removed | ||
150 | + * @param prefixDescriptions list of prefix descriptions | ||
151 | + * @return ready to send events describing what occurred. | ||
152 | + */ | ||
153 | + List<IpDeviceEvent> removePrefixes(DeviceId deviceId, List<PrefixDescription> prefixDescriptions); | ||
154 | + | ||
155 | + /** | ||
156 | + * Returns the list of prefixes that belong to the specified device. | ||
157 | + * | ||
158 | + * @param deviceId device identifier | ||
159 | + * @return list of device prefixes | ||
160 | + */ | ||
161 | + List<DevicePrefix> getPrefixes(DeviceId deviceId); | ||
162 | + | ||
163 | +} | ||
164 | + |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/IpDeviceStoreDelegate.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.device; | ||
17 | + | ||
18 | +import org.onosproject.store.StoreDelegate; | ||
19 | + | ||
20 | +/** | ||
21 | + * Infrastructure ip topology store delegate abstraction. | ||
22 | + */ | ||
23 | +public interface IpDeviceStoreDelegate extends StoreDelegate<IpDeviceEvent> { | ||
24 | +} |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/PrefixDescription.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.device; | ||
17 | + | ||
18 | +import org.onosproject.iptopology.api.PrefixIdentifier; | ||
19 | +import org.onosproject.iptopology.api.PrefixTed; | ||
20 | +import org.onosproject.net.Description; | ||
21 | + | ||
22 | +/** | ||
23 | + * Information about a prefix. | ||
24 | + */ | ||
25 | +public interface PrefixDescription extends Description { | ||
26 | + | ||
27 | + /** | ||
28 | + * Returns the prefix identifier. | ||
29 | + * | ||
30 | + * @return prefix identifier | ||
31 | + */ | ||
32 | + PrefixIdentifier prefixIdentifier(); | ||
33 | + | ||
34 | + /** | ||
35 | + * Returns the prefix Traffic Engineering parameters. | ||
36 | + * | ||
37 | + * @return prefix Traffic Engineering parameters | ||
38 | + */ | ||
39 | + PrefixTed prefixTed(); | ||
40 | + | ||
41 | +} |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/device/package-info.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | + | ||
17 | +/** | ||
18 | + * Ip device model & related services API definitions. | ||
19 | + */ | ||
20 | +package org.onosproject.iptopology.api.device; |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/link/DefaultIpLinkDescription.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.link; | ||
17 | + | ||
18 | +import com.google.common.base.MoreObjects; | ||
19 | +import org.onosproject.iptopology.api.IpLinkIdentifier; | ||
20 | +import org.onosproject.iptopology.api.LinkTed; | ||
21 | +import org.onosproject.iptopology.api.TerminationPoint; | ||
22 | +import org.onosproject.net.AbstractDescription; | ||
23 | +import org.onosproject.net.SparseAnnotations; | ||
24 | + | ||
25 | +/** | ||
26 | + * Default implementation of immutable ip link description entity. | ||
27 | + */ | ||
28 | +public class DefaultIpLinkDescription extends AbstractDescription | ||
29 | + implements IpLinkDescription { | ||
30 | + | ||
31 | + private final TerminationPoint src; | ||
32 | + private final TerminationPoint dst; | ||
33 | + private final IpLinkIdentifier linkIdentifier; | ||
34 | + private final LinkTed linkTed; | ||
35 | + | ||
36 | + /** | ||
37 | + * Creates an ip link description using the supplied information. | ||
38 | + * | ||
39 | + * @param src link source | ||
40 | + * @param dst link destination | ||
41 | + * @param linkIdentifier link identifier | ||
42 | + * @param linkTed link traffic engineering parameters | ||
43 | + * @param annotations optional key/value annotations | ||
44 | + */ | ||
45 | + public DefaultIpLinkDescription(TerminationPoint src, TerminationPoint dst, | ||
46 | + IpLinkIdentifier linkIdentifier, LinkTed linkTed, | ||
47 | + SparseAnnotations... annotations) { | ||
48 | + super(annotations); | ||
49 | + this.src = src; | ||
50 | + this.dst = dst; | ||
51 | + this.linkIdentifier = linkIdentifier; | ||
52 | + this.linkTed = linkTed; | ||
53 | + } | ||
54 | + | ||
55 | + /** | ||
56 | + * Creates an ip link description using the supplied information. | ||
57 | + * | ||
58 | + * @param base IpLinkDescription to basic information | ||
59 | + * @param annotations optional key/value annotations | ||
60 | + */ | ||
61 | + public DefaultIpLinkDescription(IpLinkDescription base, SparseAnnotations... annotations) { | ||
62 | + this(base.src(), base.dst(), base.linkIdentifier(), | ||
63 | + base.linkTed(), annotations); | ||
64 | + } | ||
65 | + | ||
66 | + @Override | ||
67 | + public TerminationPoint src() { | ||
68 | + return src; | ||
69 | + } | ||
70 | + | ||
71 | + @Override | ||
72 | + public TerminationPoint dst() { | ||
73 | + return dst; | ||
74 | + } | ||
75 | + | ||
76 | + @Override | ||
77 | + public IpLinkIdentifier linkIdentifier() { | ||
78 | + return linkIdentifier; | ||
79 | + } | ||
80 | + | ||
81 | + @Override | ||
82 | + public LinkTed linkTed() { | ||
83 | + return linkTed; } | ||
84 | + | ||
85 | + @Override | ||
86 | + public String toString() { | ||
87 | + return MoreObjects.toStringHelper(this) | ||
88 | + .add("src", src()) | ||
89 | + .add("dst", dst()) | ||
90 | + .add("linkIdentifier", linkIdentifier()) | ||
91 | + .add("linkTed", linkTed()) | ||
92 | + .toString(); | ||
93 | + } | ||
94 | + | ||
95 | +} |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/link/IpLinkDescription.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.link; | ||
17 | + | ||
18 | +import org.onosproject.iptopology.api.IpLinkIdentifier; | ||
19 | +import org.onosproject.iptopology.api.LinkTed; | ||
20 | +import org.onosproject.iptopology.api.TerminationPoint; | ||
21 | +import org.onosproject.net.Description; | ||
22 | + | ||
23 | +/** | ||
24 | + * Describes an ip link. | ||
25 | + */ | ||
26 | +public interface IpLinkDescription extends Description { | ||
27 | + | ||
28 | + /** | ||
29 | + * Returns the link source. | ||
30 | + * | ||
31 | + * @return links source | ||
32 | + */ | ||
33 | + TerminationPoint src(); | ||
34 | + | ||
35 | + /** | ||
36 | + * Returns the link destination. | ||
37 | + * | ||
38 | + * @return links destination | ||
39 | + */ | ||
40 | + TerminationPoint dst(); | ||
41 | + | ||
42 | + /** | ||
43 | + * Returns the link identifier. | ||
44 | + * | ||
45 | + * @return links identifier informations | ||
46 | + */ | ||
47 | + IpLinkIdentifier linkIdentifier(); | ||
48 | + | ||
49 | + /** | ||
50 | + * Returns the link traffic engineering parameters. | ||
51 | + * | ||
52 | + * @return links traffic engineering parameters | ||
53 | + */ | ||
54 | + LinkTed linkTed(); | ||
55 | +} |
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.link; | ||
17 | + | ||
18 | +import org.onosproject.event.AbstractEvent; | ||
19 | +import org.onosproject.iptopology.api.IpLink; | ||
20 | + | ||
21 | +/** | ||
22 | + * Describes ip link event. | ||
23 | + */ | ||
24 | +public class IpLinkEvent extends AbstractEvent<IpLinkEvent.Type, IpLink> { | ||
25 | + | ||
26 | + /** | ||
27 | + * Type of link events. | ||
28 | + */ | ||
29 | + public enum Type { | ||
30 | + /** | ||
31 | + * Signifies that a new ip link has been detected. | ||
32 | + */ | ||
33 | + LINK_ADDED, | ||
34 | + | ||
35 | + /** | ||
36 | + * Signifies that an ip link has been updated or changed state. | ||
37 | + */ | ||
38 | + LINK_UPDATED, | ||
39 | + | ||
40 | + /** | ||
41 | + * Signifies that an ip link has been removed. | ||
42 | + */ | ||
43 | + LINK_REMOVED | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * Creates an event of a given type and for the specified ip link and the | ||
48 | + * current time. | ||
49 | + * | ||
50 | + * @param type link event type | ||
51 | + * @param link event link subject | ||
52 | + */ | ||
53 | + public IpLinkEvent(Type type, IpLink link) { | ||
54 | + super(type, link); | ||
55 | + } | ||
56 | + | ||
57 | + /** | ||
58 | + * Creates an event of a given type and for the specified ip link and time. | ||
59 | + * | ||
60 | + * @param type link event type | ||
61 | + * @param link event link subject | ||
62 | + * @param time occurrence time | ||
63 | + */ | ||
64 | + public IpLinkEvent(Type type, IpLink link, long time) { | ||
65 | + super(type, link, time); | ||
66 | + } | ||
67 | + | ||
68 | +} |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/link/IpLinkListener.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.link; | ||
17 | + | ||
18 | +import org.onosproject.event.EventListener; | ||
19 | + | ||
20 | +/** | ||
21 | + * Entity capable of receiving ip link related events. | ||
22 | + */ | ||
23 | +public interface IpLinkListener extends EventListener<IpLinkEvent> { | ||
24 | +} |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/link/IpLinkProvider.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.link; | ||
17 | + | ||
18 | +import org.onosproject.net.provider.Provider; | ||
19 | + | ||
20 | +/** | ||
21 | + * Abstraction of an entity providing information about ip links | ||
22 | + * to the core. | ||
23 | + */ | ||
24 | +public interface IpLinkProvider extends Provider { | ||
25 | +} |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/link/IpLinkProviderRegistry.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.link; | ||
17 | + | ||
18 | +import org.onosproject.net.provider.ProviderRegistry; | ||
19 | + | ||
20 | +/** | ||
21 | + * Abstraction of an ip link provider registry. | ||
22 | + */ | ||
23 | +public interface IpLinkProviderRegistry | ||
24 | + extends ProviderRegistry<IpLinkProvider, IpLinkProviderService> { | ||
25 | +} |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/link/IpLinkProviderService.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.link; | ||
17 | + | ||
18 | + | ||
19 | +import org.onosproject.iptopology.api.TerminationPoint; | ||
20 | +import org.onosproject.net.DeviceId; | ||
21 | +import org.onosproject.net.provider.ProviderService; | ||
22 | + | ||
23 | +/** | ||
24 | + * Means for injecting ip link information into the core. | ||
25 | + */ | ||
26 | +public interface IpLinkProviderService extends ProviderService<IpLinkProvider> { | ||
27 | + | ||
28 | + /** | ||
29 | + * Signals that an ip link is added or updated with IP topology information. | ||
30 | + * | ||
31 | + * @param linkDescription ip link information | ||
32 | + */ | ||
33 | + void addOrUpdateIpLink(IpLinkDescription linkDescription); | ||
34 | + | ||
35 | + /** | ||
36 | + * Signals that an ip link has disappeared. | ||
37 | + * | ||
38 | + * @param linkDescription ip link information | ||
39 | + */ | ||
40 | + void removeIpLink(IpLinkDescription linkDescription); | ||
41 | + | ||
42 | + /** | ||
43 | + * Signals that ip links associated with the specified | ||
44 | + * termination point have vanished. | ||
45 | + * | ||
46 | + * @param terminationPoint termination point | ||
47 | + */ | ||
48 | + void removeIpLink(TerminationPoint terminationPoint); | ||
49 | + | ||
50 | + /** | ||
51 | + * Signals that ip links associated with the specified | ||
52 | + * device have vanished. | ||
53 | + * | ||
54 | + * @param deviceId device identifier | ||
55 | + */ | ||
56 | + void removeIpLink(DeviceId deviceId); | ||
57 | +} |
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.link; | ||
17 | + | ||
18 | +import java.util.Set; | ||
19 | + | ||
20 | +import org.onosproject.event.ListenerService; | ||
21 | +import org.onosproject.iptopology.api.IpLink; | ||
22 | +import org.onosproject.iptopology.api.TerminationPoint; | ||
23 | +import org.onosproject.net.DeviceId; | ||
24 | + | ||
25 | +/** | ||
26 | + * Service for interacting with the inventory of infrastructure links. | ||
27 | + */ | ||
28 | +public interface IpLinkService | ||
29 | + extends ListenerService<IpLinkEvent, IpLinkListener> { | ||
30 | + | ||
31 | + /** | ||
32 | + * Returns the count of all known ip links. | ||
33 | + * | ||
34 | + * @return number of ip links | ||
35 | + */ | ||
36 | + int getIpLinkCount(); | ||
37 | + | ||
38 | + /** | ||
39 | + * Returns a collection of all ip links. | ||
40 | + * | ||
41 | + * @return all ip links | ||
42 | + */ | ||
43 | + Iterable<IpLink> getIpLinks(); | ||
44 | + | ||
45 | + | ||
46 | + /** | ||
47 | + * Returns set of all ip links leading to and from the | ||
48 | + * specified ip device. | ||
49 | + * | ||
50 | + * @param deviceId device identifier | ||
51 | + * @return set of ip device links | ||
52 | + */ | ||
53 | + Set<IpLink> getIpDeviceLinks(DeviceId deviceId); | ||
54 | + | ||
55 | + /** | ||
56 | + * Returns set of all ip links leading from the specified ip device. | ||
57 | + * | ||
58 | + * @param deviceId device identifier | ||
59 | + * @return set of ip device egress links | ||
60 | + */ | ||
61 | + Set<IpLink> getIpDeviceEgressLinks(DeviceId deviceId); | ||
62 | + | ||
63 | + /** | ||
64 | + * Returns set of all ip links leading to the specified ip device. | ||
65 | + * | ||
66 | + * @param deviceId device identifier | ||
67 | + * @return set of ip device ingress links | ||
68 | + */ | ||
69 | + Set<IpLink> getIpDeviceIngressLinks(DeviceId deviceId); | ||
70 | + | ||
71 | + /** | ||
72 | + * Returns set of all ip links leading to and from the | ||
73 | + * specified termination point. | ||
74 | + * | ||
75 | + * @param terminationPoint termination point | ||
76 | + * @return set of ip links | ||
77 | + */ | ||
78 | + Set<IpLink> getIpLinks(TerminationPoint terminationPoint); | ||
79 | + | ||
80 | + /** | ||
81 | + * Returns set of all ip links leading from the specified | ||
82 | + * termination point. | ||
83 | + * | ||
84 | + * @param terminationPoint termination point | ||
85 | + * @return set of ip device egress links | ||
86 | + */ | ||
87 | + Set<IpLink> getEgressIpLinks(TerminationPoint terminationPoint); | ||
88 | + | ||
89 | + /** | ||
90 | + * Returns set of all ip links leading to the specified | ||
91 | + * termination point. | ||
92 | + * | ||
93 | + * @param terminationPoint termination point | ||
94 | + * @return set of ip device ingress links | ||
95 | + */ | ||
96 | + Set<IpLink> getIngressIpLinks(TerminationPoint terminationPoint); | ||
97 | + | ||
98 | + /** | ||
99 | + * Returns the ip links between the specified source | ||
100 | + * and destination termination points. | ||
101 | + * | ||
102 | + * @param src source termination point | ||
103 | + * @param dst destination termination point | ||
104 | + * @return ip link from source to destination; null if none found | ||
105 | + */ | ||
106 | + IpLink getIpLink(TerminationPoint src, TerminationPoint dst); | ||
107 | + | ||
108 | +} |
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.link; | ||
17 | + | ||
18 | +import org.onosproject.iptopology.api.IpLink; | ||
19 | +import org.onosproject.iptopology.api.TerminationPoint; | ||
20 | +import org.onosproject.net.DeviceId; | ||
21 | +import org.onosproject.net.provider.ProviderId; | ||
22 | +import org.onosproject.store.Store; | ||
23 | + | ||
24 | +import java.util.Set; | ||
25 | + | ||
26 | +/** | ||
27 | + * Manages inventory of ip links; not intended for direct use. | ||
28 | + */ | ||
29 | +public interface IpLinkStore extends Store<IpLinkEvent, IpLinkStoreDelegate> { | ||
30 | + | ||
31 | + /** | ||
32 | + * Returns the number of ip links in the store. | ||
33 | + * | ||
34 | + * @return number of ip links | ||
35 | + */ | ||
36 | + int getIpLinkCount(); | ||
37 | + | ||
38 | + /** | ||
39 | + * Returns an iterable collection of all ip links in the inventory. | ||
40 | + * | ||
41 | + * @return collection of all ip links | ||
42 | + */ | ||
43 | + Iterable<IpLink> getIpLinks(); | ||
44 | + | ||
45 | + /** | ||
46 | + * Returns all ip links egressing from the specified device. | ||
47 | + * | ||
48 | + * @param deviceId device identifier | ||
49 | + * @return set of ip device links | ||
50 | + */ | ||
51 | + Set<IpLink> getIpDeviceEgressLinks(DeviceId deviceId); | ||
52 | + | ||
53 | + /** | ||
54 | + * Returns all ip links ingressing from the specified device. | ||
55 | + * | ||
56 | + * @param deviceId device identifier | ||
57 | + * @return set of ip device links | ||
58 | + */ | ||
59 | + Set<IpLink> getIpDeviceIngressLinks(DeviceId deviceId); | ||
60 | + | ||
61 | + /** | ||
62 | + * Returns the ip link between the two termination points. | ||
63 | + * | ||
64 | + * @param src source termination point | ||
65 | + * @param dst destination termination point | ||
66 | + * @return ip link or null if one not found between the termination points | ||
67 | + */ | ||
68 | + IpLink getIpLink(TerminationPoint src, TerminationPoint dst); | ||
69 | + | ||
70 | + /** | ||
71 | + * Returns all ip links egressing from the specified termination point. | ||
72 | + * | ||
73 | + * @param src source termination point | ||
74 | + * @return set of termination point ip links | ||
75 | + */ | ||
76 | + Set<IpLink> getEgressIpLinks(TerminationPoint src); | ||
77 | + | ||
78 | + /** | ||
79 | + * Returns all ip links ingressing to the specified termination point. | ||
80 | + * | ||
81 | + * @param dst destination termination point | ||
82 | + * @return set of termination point ip links | ||
83 | + */ | ||
84 | + Set<IpLink> getIngressIpLinks(TerminationPoint dst); | ||
85 | + | ||
86 | + /** | ||
87 | + * Creates a new ip link, or updates an existing one, based on the given | ||
88 | + * information. | ||
89 | + * | ||
90 | + * @param providerId provider identity | ||
91 | + * @param linkDescription ip link description | ||
92 | + * @return create or update ip link event, or null if no change resulted | ||
93 | + */ | ||
94 | + IpLinkEvent createOrUpdateIpLink(ProviderId providerId, | ||
95 | + IpLinkDescription linkDescription); | ||
96 | + | ||
97 | + /** | ||
98 | + * Removes ip link, based on the specified information. | ||
99 | + * | ||
100 | + * @param src ip link source | ||
101 | + * @param dst ip link destination | ||
102 | + * @return remove or update ip link event, or null if no change resulted | ||
103 | + */ | ||
104 | + IpLinkEvent removeOrDownIpLink(TerminationPoint src, TerminationPoint dst); | ||
105 | + | ||
106 | + /** | ||
107 | + * Removes ip link based on the specified information. | ||
108 | + * | ||
109 | + * @param src ip link source | ||
110 | + * @param dst ip link destination | ||
111 | + * @return remove ip link event, or null if no change resulted | ||
112 | + */ | ||
113 | + IpLinkEvent removeIpLink(TerminationPoint src, TerminationPoint dst); | ||
114 | + | ||
115 | +} |
apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/link/IpLinkStoreDelegate.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.iptopology.api.link; | ||
17 | + | ||
18 | +import org.onosproject.store.StoreDelegate; | ||
19 | + | ||
20 | +/** | ||
21 | + * Ip link store delegate abstraction. | ||
22 | + */ | ||
23 | +public interface IpLinkStoreDelegate extends StoreDelegate<IpLinkEvent> { | ||
24 | +} |
1 | +/* | ||
2 | + * Copyright 2014 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | + | ||
17 | +/** | ||
18 | + * Ip link model & related services API definitions. | ||
19 | + */ | ||
20 | +package org.onosproject.iptopology.api.link; |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | + | ||
17 | +/** | ||
18 | + * Ip Topology API. | ||
19 | + */ | ||
20 | +package org.onosproject.iptopology.api; |
... | @@ -47,6 +47,7 @@ | ... | @@ -47,6 +47,7 @@ |
47 | <module>cordfabric</module> | 47 | <module>cordfabric</module> |
48 | <module>xos-integration</module> | 48 | <module>xos-integration</module> |
49 | <module>pcep-api</module> | 49 | <module>pcep-api</module> |
50 | + <module>iptopology-api</module> | ||
50 | <module>olt</module> | 51 | <module>olt</module> |
51 | <module>cip</module> | 52 | <module>cip</module> |
52 | <module>flowanalyzer</module> | 53 | <module>flowanalyzer</module> | ... | ... |
-
Please register or login to post a comment