Committed by
Gerrit Code Review
API definitions for the TE Topology Core App.
This APP creates and manages a hierarchy of TE topologies received from SBI TE provider and from user configurations from NBI. The API contains internal data structures for TE attributes that are aligned with the TE attributes definition in standard IETF YANG TE topology model (https://tools.ietf.org/html/draft-ietf-teas-yang-te-topo-05). This commit includes the following interface definitions: - TE topology provider service, which is called by the TE topology provider from SB to pass TE topologies to the TE topology core APP - TE topology service, which provides service APIs for an external APP to get/set TE topologies and their attributes. - Network, Node, Link definitions for TE networks and their default class implementation Change-Id: Iafcf6911b8d9e494397e3a255cae282bbca74d5c
Showing
58 changed files
with
5051 additions
and
0 deletions
... | @@ -76,6 +76,7 @@ | ... | @@ -76,6 +76,7 @@ |
76 | <module>scalablegateway</module> | 76 | <module>scalablegateway</module> |
77 | <module>bmv2-demo</module> | 77 | <module>bmv2-demo</module> |
78 | <module>yms</module> | 78 | <module>yms</module> |
79 | + <module>tetopology</module> | ||
79 | <module>rabbitmq</module> | 80 | <module>rabbitmq</module> |
80 | <module>learning-switch</module> | 81 | <module>learning-switch</module> |
81 | </modules> | 82 | </modules> | ... | ... |
apps/tetopology/BUCK
0 → 100644
1 | +COMPILE_DEPS = [ | ||
2 | + '//lib:CORE_DEPS', | ||
3 | +] | ||
4 | + | ||
5 | +osgi_jar_with_tests ( | ||
6 | + deps = COMPILE_DEPS, | ||
7 | +) | ||
8 | + | ||
9 | +onos_app ( | ||
10 | + title = 'TE Topology Core App', | ||
11 | + category = 'Traffic Steering', | ||
12 | + url = 'http://onosproject.org', | ||
13 | + description = 'Application to create and manage hierarchical TE topologies.', | ||
14 | +) |
apps/tetopology/app.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2015 Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<app name="org.onosproject.tetopology" origin="HUAWEI" version="${project.version}" | ||
18 | + featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features" | ||
19 | + features="${project.artifactId}"> | ||
20 | + <description>${project.description}</description> | ||
21 | + <artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact> | ||
22 | +</app> | ||
23 | + |
apps/tetopology/features.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2015 Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}"> | ||
18 | + <feature name="${project.artifactId}" version="${project.version}" | ||
19 | + description="${project.description}"> | ||
20 | + <feature>onos-api</feature> | ||
21 | + <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle> | ||
22 | + </feature> | ||
23 | +</features> |
apps/tetopology/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2016-present Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
18 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
19 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
20 | + <modelVersion>4.0.0</modelVersion> | ||
21 | + <parent> | ||
22 | + <groupId>org.onosproject</groupId> | ||
23 | + <artifactId>onos-apps</artifactId> | ||
24 | + <version>1.8.0-SNAPSHOT</version> | ||
25 | + <relativePath>../pom.xml</relativePath> | ||
26 | + </parent> | ||
27 | + | ||
28 | + <artifactId>onos-app-tetopology</artifactId> | ||
29 | + <version>1.8.0-SNAPSHOT</version> | ||
30 | + <packaging>bundle</packaging> | ||
31 | + | ||
32 | + <description>IETF TE Management</description> | ||
33 | + | ||
34 | + <properties> | ||
35 | + <onos.app.name>org.onosproject.tetopology</onos.app.name> | ||
36 | + <onos.app.category>Application</onos.app.category> | ||
37 | + <onos.app.url>http://onosproject.org</onos.app.url> | ||
38 | + <onos.app.readme>IETF TE Management.</onos.app.readme> | ||
39 | + <!-- onos.app.requires>com.huawei.tsdn.yang</onos.app.requires --> | ||
40 | + </properties> | ||
41 | + <dependencies> | ||
42 | + <dependency> | ||
43 | + <groupId>org.onosproject</groupId> | ||
44 | + <artifactId>onlab-junit</artifactId> | ||
45 | + <scope>test</scope> | ||
46 | + </dependency> | ||
47 | + <dependency> | ||
48 | + <groupId>org.onosproject</groupId> | ||
49 | + <artifactId>onos-core-serializers</artifactId> | ||
50 | + <version>${project.version}</version> | ||
51 | + </dependency> | ||
52 | + <dependency> | ||
53 | + <groupId>com.google.guava</groupId> | ||
54 | + <artifactId>guava-testlib</artifactId> | ||
55 | + <scope>test</scope> | ||
56 | + </dependency> | ||
57 | + <dependency> | ||
58 | + <groupId>org.easymock</groupId> | ||
59 | + <artifactId>easymock</artifactId> | ||
60 | + <scope>test</scope> | ||
61 | + </dependency> | ||
62 | + <dependency> | ||
63 | + <groupId>org.onosproject</groupId> | ||
64 | + <artifactId>onlab-osgi</artifactId> | ||
65 | + <classifier>tests</classifier> | ||
66 | + <scope>test</scope> | ||
67 | + </dependency> | ||
68 | + <dependency> | ||
69 | + <groupId>org.onosproject</groupId> | ||
70 | + <artifactId>onos-api</artifactId> | ||
71 | + <scope>test</scope> | ||
72 | + <classifier>tests</classifier> | ||
73 | + </dependency> | ||
74 | + | ||
75 | + <dependency> | ||
76 | + <groupId>org.onosproject</groupId> | ||
77 | + <artifactId>onos-incubator-api</artifactId> | ||
78 | + <version>${project.version}</version> | ||
79 | + </dependency> | ||
80 | + <dependency> | ||
81 | + <groupId>org.onosproject</groupId> | ||
82 | + <artifactId>onlab-misc</artifactId> | ||
83 | + <version>${project.version}</version> | ||
84 | + </dependency> | ||
85 | + <dependency> | ||
86 | + <groupId>org.onosproject</groupId> | ||
87 | + <artifactId>onos-core-common</artifactId> | ||
88 | + <version>${project.version}</version> | ||
89 | + </dependency> | ||
90 | + | ||
91 | + <dependency> | ||
92 | + <groupId>org.onosproject</groupId> | ||
93 | + <artifactId>onos-core-common</artifactId> | ||
94 | + <version>${project.version}</version> | ||
95 | + <classifier>tests</classifier> | ||
96 | + <scope>test</scope> | ||
97 | + </dependency> | ||
98 | + | ||
99 | + </dependencies> | ||
100 | +</project> |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/DefaultNetwork.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +import org.onosproject.tetopology.management.api.link.NetworkLink; | ||
21 | +import org.onosproject.tetopology.management.api.node.NetworkNode; | ||
22 | + | ||
23 | +import com.google.common.base.MoreObjects; | ||
24 | +import com.google.common.base.Objects; | ||
25 | + | ||
26 | +/** | ||
27 | + * Default Network implementation. | ||
28 | + * <p> | ||
29 | + * The Set/Get methods below are defined to accept and pass references because | ||
30 | + * the object class is treated as a "composite" object class that holds | ||
31 | + * references to various member objects and their relationships, forming a | ||
32 | + * data tree. Internal routines of the TE topology manager may use the | ||
33 | + * following example methods to construct and manipulate any piece of data in | ||
34 | + * the data tree: | ||
35 | + * <pre> | ||
36 | + * newNode.getTe().setAdminStatus(), or | ||
37 | + * newNode.getSupportingNodeIds().add(nodeId), etc. | ||
38 | + * </pre> | ||
39 | + * Same for constructors where, for example, a child list may be constructed | ||
40 | + * first and passed in by reference to its parent object constructor. | ||
41 | + */ | ||
42 | +public class DefaultNetwork implements Network { | ||
43 | + private KeyId networkId; | ||
44 | + private List<KeyId> supportingNetworkIds; | ||
45 | + private List<NetworkNode> nodes; | ||
46 | + private List<NetworkLink> links; | ||
47 | + private TeTopologyId teTopologyId; | ||
48 | + private boolean serverProvided; | ||
49 | + | ||
50 | + /** | ||
51 | + * Constructor with all fields. | ||
52 | + * | ||
53 | + * @param networkId network identifier | ||
54 | + * @param supportingNetworkIds supporting network identifier | ||
55 | + * @param nodes list of nodes within the network | ||
56 | + * @param links list of links within the network | ||
57 | + * @param teTopologyId TE topology identifier | ||
58 | + * @param serverProvided whether the network is received from server | ||
59 | + */ | ||
60 | + public DefaultNetwork(KeyId networkId, List<KeyId> supportingNetworkIds, | ||
61 | + List<NetworkNode> nodes, List<NetworkLink> links, TeTopologyId teTopologyId, | ||
62 | + boolean serverProvided) { | ||
63 | + this.networkId = networkId; | ||
64 | + this.supportingNetworkIds = supportingNetworkIds; | ||
65 | + this.nodes = nodes; | ||
66 | + this.links = links; | ||
67 | + this.teTopologyId = teTopologyId; | ||
68 | + this.serverProvided = serverProvided; | ||
69 | + } | ||
70 | + | ||
71 | + /** | ||
72 | + * Constructor with key only. | ||
73 | + * | ||
74 | + * @param networkId network identifier | ||
75 | + */ | ||
76 | + public DefaultNetwork(KeyId networkId) { | ||
77 | + this.networkId = networkId; | ||
78 | + } | ||
79 | + | ||
80 | + /** | ||
81 | + * Creates an instance of DefaultNetwork from an existing Network object. | ||
82 | + * | ||
83 | + * @param network network identifier | ||
84 | + */ | ||
85 | + public DefaultNetwork(Network network) { | ||
86 | + this.networkId = network.networkId(); | ||
87 | + this.supportingNetworkIds = network.getSupportingNetworkIds(); | ||
88 | + this.nodes = network.getNodes(); | ||
89 | + this.links = network.getLinks(); | ||
90 | + this.teTopologyId = network.getTeTopologyId(); | ||
91 | + this.serverProvided = network.isServerProvided(); | ||
92 | + } | ||
93 | + | ||
94 | + @Override | ||
95 | + public KeyId networkId() { | ||
96 | + return networkId; | ||
97 | + } | ||
98 | + | ||
99 | + @Override | ||
100 | + public List<KeyId> getSupportingNetworkIds() { | ||
101 | + return supportingNetworkIds; | ||
102 | + } | ||
103 | + | ||
104 | + @Override | ||
105 | + public List<NetworkNode> getNodes() { | ||
106 | + return nodes; | ||
107 | + } | ||
108 | + | ||
109 | + @Override | ||
110 | + public NetworkNode getNode(KeyId nodeId) { | ||
111 | + | ||
112 | + for (NetworkNode node : nodes) { | ||
113 | + if (node.nodeId().equals(nodeId)) { | ||
114 | + return node; | ||
115 | + } | ||
116 | + } | ||
117 | + return null; | ||
118 | + } | ||
119 | + | ||
120 | + @Override | ||
121 | + public List<NetworkLink> getLinks() { | ||
122 | + return links; | ||
123 | + } | ||
124 | + | ||
125 | + @Override | ||
126 | + public NetworkLink getLink(KeyId linkId) { | ||
127 | + | ||
128 | + for (NetworkLink link : links) { | ||
129 | + if (link.linkId().equals(linkId)) { | ||
130 | + return link; | ||
131 | + } | ||
132 | + } | ||
133 | + return null; | ||
134 | + } | ||
135 | + | ||
136 | + @Override | ||
137 | + public boolean isServerProvided() { | ||
138 | + return serverProvided; | ||
139 | + } | ||
140 | + | ||
141 | + @Override | ||
142 | + public TeTopologyId getTeTopologyId() { | ||
143 | + return teTopologyId; | ||
144 | + } | ||
145 | + | ||
146 | + | ||
147 | + /** | ||
148 | + * Sets the supporting network keys. | ||
149 | + * | ||
150 | + * @param supportingNetworkIds the supportingNetworkIds to set | ||
151 | + */ | ||
152 | + public void setSupportingNetworkIds(List<KeyId> supportingNetworkIds) { | ||
153 | + this.supportingNetworkIds = supportingNetworkIds; | ||
154 | + } | ||
155 | + | ||
156 | + /** | ||
157 | + * Sets the list of nodes . | ||
158 | + * | ||
159 | + * @param nodes the nodes to set | ||
160 | + */ | ||
161 | + public void setNodes(List<NetworkNode> nodes) { | ||
162 | + this.nodes = nodes; | ||
163 | + } | ||
164 | + | ||
165 | + /** | ||
166 | + * Sets the links. | ||
167 | + * | ||
168 | + * @param links the links to set | ||
169 | + */ | ||
170 | + public void setLinks(List<NetworkLink> links) { | ||
171 | + this.links = links; | ||
172 | + } | ||
173 | + | ||
174 | + /** | ||
175 | + * Sets the attribute serverProvided. | ||
176 | + * | ||
177 | + * @param serverProvided the attribute to set | ||
178 | + */ | ||
179 | + public void setServerProvided(boolean serverProvided) { | ||
180 | + this.serverProvided = serverProvided; | ||
181 | + } | ||
182 | + | ||
183 | + /** | ||
184 | + * Sets the TE Topology Id. | ||
185 | + * | ||
186 | + * @param teTopologyId the teTopologyId to set | ||
187 | + */ | ||
188 | + public void setTeTopologyId(TeTopologyId teTopologyId) { | ||
189 | + this.teTopologyId = teTopologyId; | ||
190 | + } | ||
191 | + | ||
192 | + @Override | ||
193 | + public int hashCode() { | ||
194 | + return Objects.hashCode(networkId, supportingNetworkIds, | ||
195 | + nodes, links, serverProvided, teTopologyId); | ||
196 | + } | ||
197 | + | ||
198 | + @Override | ||
199 | + public boolean equals(Object object) { | ||
200 | + if (this == object) { | ||
201 | + return true; | ||
202 | + } | ||
203 | + if (object instanceof DefaultNetwork) { | ||
204 | + DefaultNetwork that = (DefaultNetwork) object; | ||
205 | + return Objects.equal(this.networkId, that.networkId) && | ||
206 | + Objects.equal(this.supportingNetworkIds, that.supportingNetworkIds) && | ||
207 | + Objects.equal(this.nodes, that.nodes) && | ||
208 | + Objects.equal(this.links, that.links) && | ||
209 | + Objects.equal(this.serverProvided, that.serverProvided) && | ||
210 | + Objects.equal(this.teTopologyId, that.teTopologyId); | ||
211 | + } | ||
212 | + return false; | ||
213 | + } | ||
214 | + | ||
215 | + @Override | ||
216 | + public String toString() { | ||
217 | + return MoreObjects.toStringHelper(this) | ||
218 | + .add("networkId", networkId) | ||
219 | + .add("supportingNetworkIds", supportingNetworkIds) | ||
220 | + .add("nodes", nodes) | ||
221 | + .add("links", links) | ||
222 | + .add("serverProvided", serverProvided) | ||
223 | + .add("teTopologyId", teTopologyId) | ||
224 | + .toString(); | ||
225 | + } | ||
226 | + | ||
227 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/DefaultNetworks.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +import com.google.common.base.MoreObjects; | ||
21 | +import com.google.common.base.Objects; | ||
22 | + | ||
23 | +/** | ||
24 | + * Default Networks implementation. | ||
25 | + * <p> | ||
26 | + * The Set/Get methods below are defined to accept and pass references because | ||
27 | + * the object class is treated as a "composite" object class that holds | ||
28 | + * references to various member objects and their relationships, forming a | ||
29 | + * data tree. Internal routines of the TE topology manager may use the | ||
30 | + * following example methods to construct and manipulate any piece of data in | ||
31 | + * the data tree: | ||
32 | + * <pre> | ||
33 | + * newNode.getTe().setAdminStatus(), or | ||
34 | + * newNode.getSupportingNodeIds().add(nodeId), etc. | ||
35 | + * </pre> | ||
36 | + * Same for constructors where, for example, a child list may be constructed | ||
37 | + * first and passed in by reference to its parent object constructor. | ||
38 | + */ | ||
39 | +public class DefaultNetworks implements Networks, TeTopologyEventSubject { | ||
40 | + private List<Network> networks; | ||
41 | + | ||
42 | + /** | ||
43 | + * Creates an instance of DefaultNetworks. | ||
44 | + */ | ||
45 | + public DefaultNetworks() { | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * Constructor with all fields. | ||
50 | + * | ||
51 | + * @param networks list of networks | ||
52 | + */ | ||
53 | + public DefaultNetworks(List<Network> networks) { | ||
54 | + this.networks = networks; | ||
55 | + } | ||
56 | + | ||
57 | + @Override | ||
58 | + public List<Network> networks() { | ||
59 | + return networks; | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * Sets the networks. | ||
64 | + * | ||
65 | + * @param networks the networks to set | ||
66 | + */ | ||
67 | + public void setNetworks(List<Network> networks) { | ||
68 | + this.networks = networks; | ||
69 | + } | ||
70 | + | ||
71 | + @Override | ||
72 | + public int hashCode() { | ||
73 | + return Objects.hashCode(networks); | ||
74 | + } | ||
75 | + | ||
76 | + @Override | ||
77 | + public boolean equals(Object object) { | ||
78 | + if (this == object) { | ||
79 | + return true; | ||
80 | + } | ||
81 | + if (object instanceof DefaultNetworks) { | ||
82 | + DefaultNetworks that = (DefaultNetworks) object; | ||
83 | + return Objects.equal(this.networks, that.networks); | ||
84 | + } | ||
85 | + return false; | ||
86 | + } | ||
87 | + | ||
88 | + @Override | ||
89 | + public String toString() { | ||
90 | + return MoreObjects.toStringHelper(this) | ||
91 | + .add("networks", networks) | ||
92 | + .toString(); | ||
93 | + } | ||
94 | + | ||
95 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/InternalTeNetwork.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api; | ||
17 | + | ||
18 | + | ||
19 | +import com.google.common.base.MoreObjects; | ||
20 | +import com.google.common.base.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Internal TE Network implementation. | ||
24 | + */ | ||
25 | +public class InternalTeNetwork extends DefaultNetwork { | ||
26 | + private TeTopologyType teTopologyType; | ||
27 | + | ||
28 | + /** | ||
29 | + * Constructor with all fields. | ||
30 | + * | ||
31 | + * @param teTopologyType TE topology type | ||
32 | + * @param network network object | ||
33 | + */ | ||
34 | + public InternalTeNetwork(TeTopologyType teTopologyType, Network network) { | ||
35 | + super(network); | ||
36 | + this.teTopologyType = teTopologyType; | ||
37 | + } | ||
38 | + | ||
39 | + /** | ||
40 | + * Returns the TE topoology type. | ||
41 | + * | ||
42 | + * @return TE topology type | ||
43 | + */ | ||
44 | + public TeTopologyType getTeTopologyType() { | ||
45 | + return this.teTopologyType; | ||
46 | + } | ||
47 | + | ||
48 | + @Override | ||
49 | + public int hashCode() { | ||
50 | + return Objects.hashCode(super.hashCode(), teTopologyType); | ||
51 | + } | ||
52 | + | ||
53 | + @Override | ||
54 | + public boolean equals(Object object) { | ||
55 | + if (this == object) { | ||
56 | + return true; | ||
57 | + } | ||
58 | + if (object instanceof InternalTeNetwork) { | ||
59 | + | ||
60 | + if (!super.equals(object)) { | ||
61 | + return false; | ||
62 | + } | ||
63 | + | ||
64 | + InternalTeNetwork that = (InternalTeNetwork) object; | ||
65 | + return Objects.equal(this.teTopologyType, that.teTopologyType); | ||
66 | + } | ||
67 | + return false; | ||
68 | + } | ||
69 | + | ||
70 | + @Override | ||
71 | + public String toString() { | ||
72 | + return MoreObjects.toStringHelper(this) | ||
73 | + .add("teTopologyType", teTopologyType) | ||
74 | + .add("DefaultNetwork", super.toString()) | ||
75 | + .toString(); | ||
76 | + } | ||
77 | + | ||
78 | +} |
1 | +/* | ||
2 | + * Copyright 2016-present 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.tetopology.management.api; | ||
18 | + | ||
19 | +import java.net.URI; | ||
20 | +import java.util.Objects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Representation of an key identifier in URI. | ||
24 | + * | ||
25 | + */ | ||
26 | +public class KeyId { | ||
27 | + /** | ||
28 | + * Represents either no uri, or an unspecified uri. | ||
29 | + */ | ||
30 | + public static final KeyId NONE = keyId("none:none"); | ||
31 | + | ||
32 | + private final URI uri; | ||
33 | + private final String str; | ||
34 | + | ||
35 | + // Public construction is prohibited | ||
36 | + private KeyId(URI uri) { | ||
37 | + this.uri = uri; | ||
38 | + //this.str = uri.toString().toLowerCase(); | ||
39 | + this.str = uri.toString(); | ||
40 | + } | ||
41 | + | ||
42 | + | ||
43 | + /** | ||
44 | + * Default constructor for serialization of KeyId. | ||
45 | + */ | ||
46 | + protected KeyId() { | ||
47 | + this.uri = null; | ||
48 | + this.str = null; | ||
49 | + } | ||
50 | + | ||
51 | + /** | ||
52 | + * Returns the backing URI. | ||
53 | + * | ||
54 | + * @return backing URI | ||
55 | + */ | ||
56 | + public URI uri() { | ||
57 | + return uri; | ||
58 | + } | ||
59 | + | ||
60 | + @Override | ||
61 | + public int hashCode() { | ||
62 | + return str.hashCode(); | ||
63 | + } | ||
64 | + | ||
65 | + @Override | ||
66 | + public boolean equals(Object obj) { | ||
67 | + if (this == obj) { | ||
68 | + return true; | ||
69 | + } | ||
70 | + if (obj instanceof KeyId) { | ||
71 | + KeyId that = (KeyId) obj; | ||
72 | + return this.getClass() == that.getClass() && | ||
73 | + Objects.equals(this.str, that.str); | ||
74 | + } | ||
75 | + return false; | ||
76 | + } | ||
77 | + | ||
78 | + @Override | ||
79 | + public String toString() { | ||
80 | + return str; | ||
81 | + } | ||
82 | + | ||
83 | + /** | ||
84 | + * Creates a uri id using the supplied URI. | ||
85 | + * | ||
86 | + * @param uri URI | ||
87 | + * @return UriId | ||
88 | + */ | ||
89 | + public static KeyId keyId(URI uri) { | ||
90 | + return new KeyId(uri); | ||
91 | + } | ||
92 | + | ||
93 | + /** | ||
94 | + * Creates a uri id using the supplied URI string. | ||
95 | + * | ||
96 | + * @param string URI string | ||
97 | + * @return UriId | ||
98 | + */ | ||
99 | + public static KeyId keyId(String string) { | ||
100 | + return keyId(URI.create(string)); | ||
101 | + } | ||
102 | + | ||
103 | +} |
1 | +/* | ||
2 | + * Copyright 2016-present 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.tetopology.management.api; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +import org.onosproject.tetopology.management.api.link.NetworkLink; | ||
21 | +import org.onosproject.tetopology.management.api.node.NetworkNode; | ||
22 | + | ||
23 | +/** | ||
24 | + * Abstraction of a network element. | ||
25 | + */ | ||
26 | +public interface Network extends TeTopologyEventSubject { | ||
27 | + | ||
28 | + /** | ||
29 | + * Returns the network identifier / key of this element. | ||
30 | + * | ||
31 | + * @return network identifier | ||
32 | + */ | ||
33 | + KeyId networkId(); | ||
34 | + | ||
35 | + /** | ||
36 | + * Returns the attribute of supporting Network. | ||
37 | + * | ||
38 | + * @return list of the ids of the supporting networks | ||
39 | + */ | ||
40 | + List<KeyId> getSupportingNetworkIds(); | ||
41 | + | ||
42 | + /** | ||
43 | + * Returns a collection of nodes in the network identified by the specified | ||
44 | + * network id. | ||
45 | + * | ||
46 | + * @return a collection of currently known nodes | ||
47 | + */ | ||
48 | + List<NetworkNode> getNodes(); | ||
49 | + | ||
50 | + /** | ||
51 | + * Returns the node. | ||
52 | + * | ||
53 | + * @param nodeId node id URI format | ||
54 | + * @return value of node | ||
55 | + */ | ||
56 | + NetworkNode getNode(KeyId nodeId); | ||
57 | + | ||
58 | + /** | ||
59 | + * Returns a collection of links in the network identified by the specified | ||
60 | + * network id. | ||
61 | + * | ||
62 | + * @return a collection of currently known links | ||
63 | + */ | ||
64 | + List<NetworkLink> getLinks(); | ||
65 | + | ||
66 | + /** | ||
67 | + * Returns the link. | ||
68 | + * | ||
69 | + * @param linkId link id in URI format | ||
70 | + * @return value of link | ||
71 | + */ | ||
72 | + NetworkLink getLink(KeyId linkId); | ||
73 | + | ||
74 | + /** | ||
75 | + * Returns if the network is provided by a server or is configured by a | ||
76 | + * client. | ||
77 | + * | ||
78 | + * @return true if the network is provided by a server; false otherwise | ||
79 | + */ | ||
80 | + boolean isServerProvided(); | ||
81 | + | ||
82 | + /** | ||
83 | + * Returns the TE topology Id. | ||
84 | + * | ||
85 | + * @return TE topology id for this network | ||
86 | + */ | ||
87 | + TeTopologyId getTeTopologyId(); | ||
88 | +} |
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +/** | ||
21 | + * Abstraction of an entity which represents the functionality of networks. | ||
22 | + */ | ||
23 | +public interface Networks { | ||
24 | + | ||
25 | + /** | ||
26 | + * Returns the list of networks. | ||
27 | + * | ||
28 | + * @return list of networks | ||
29 | + */ | ||
30 | + List<Network> networks(); | ||
31 | + | ||
32 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyEvent.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api; | ||
17 | + | ||
18 | +import org.onosproject.event.AbstractEvent; | ||
19 | + | ||
20 | +/** | ||
21 | + * TE network topology event. | ||
22 | + */ | ||
23 | +public class TeTopologyEvent | ||
24 | + extends AbstractEvent<TeTopologyEvent.Type, TeTopologyEventSubject> { | ||
25 | + | ||
26 | + /** | ||
27 | + * Type of TE topology events. | ||
28 | + */ | ||
29 | + public enum Type { | ||
30 | + | ||
31 | + /** Designates addition of a network. */ | ||
32 | + NETWORK_ADDED, | ||
33 | + | ||
34 | + /** Designates update of a network. */ | ||
35 | + NETWORK_UPDATED, | ||
36 | + | ||
37 | + /** Designates removal of a network. */ | ||
38 | + NETWORK_REMOVED, | ||
39 | + | ||
40 | + /** Designates addition of a node. */ | ||
41 | + NODE_ADDED, | ||
42 | + | ||
43 | + /** Designates update of a node. */ | ||
44 | + NODE_UPDATED, | ||
45 | + | ||
46 | + /** Designates removal of a node. */ | ||
47 | + NODE_REMOVED, | ||
48 | + | ||
49 | + /** Designates addition of a termination point. */ | ||
50 | + TP_ADDED, | ||
51 | + | ||
52 | + /** Designates update of a termination point. */ | ||
53 | + TP_UPDATED, | ||
54 | + | ||
55 | + /** Designates removal of a termination point. */ | ||
56 | + TP_REMOVED, | ||
57 | + | ||
58 | + /** Designates addition of a link. */ | ||
59 | + LINK_ADDED, | ||
60 | + | ||
61 | + /** Designates update of a link. */ | ||
62 | + LINK_UPDATED, | ||
63 | + | ||
64 | + /** Designates removal of a link. */ | ||
65 | + LINK_REMOVED; | ||
66 | + } | ||
67 | + | ||
68 | + /** | ||
69 | + * Constructor for TeTopologyEvent. | ||
70 | + * | ||
71 | + * @param type type of topology event | ||
72 | + * @param subject event subject interface | ||
73 | + */ | ||
74 | + public TeTopologyEvent(Type type, TeTopologyEventSubject subject) { | ||
75 | + super(type, subject); | ||
76 | + } | ||
77 | + | ||
78 | + /** | ||
79 | + * Constructor for TeTopologyEvent. | ||
80 | + * | ||
81 | + * @param type type of topology event | ||
82 | + * @param subject event subject interface | ||
83 | + * @param time event time | ||
84 | + */ | ||
85 | + public TeTopologyEvent(Type type, TeTopologyEventSubject subject, long time) { | ||
86 | + super(type, subject, time); | ||
87 | + } | ||
88 | + | ||
89 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyEventSubject.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api; | ||
17 | + | ||
18 | +/** | ||
19 | + * Abstraction of TE network topology event subject. | ||
20 | + */ | ||
21 | +public interface TeTopologyEventSubject { | ||
22 | + | ||
23 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyId.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api; | ||
17 | + | ||
18 | +import com.google.common.base.MoreObjects; | ||
19 | +import com.google.common.base.Objects; | ||
20 | + | ||
21 | +/** | ||
22 | + * TE Topology identifiers. | ||
23 | + */ | ||
24 | +public class TeTopologyId { | ||
25 | + private final long providerId; | ||
26 | + private final long clientId; | ||
27 | + private final String topologyId; | ||
28 | + | ||
29 | + /** | ||
30 | + * Creates an instance of TE topology identifier. | ||
31 | + * | ||
32 | + * @param providerId value of provider identifier | ||
33 | + * @param clientId value of client identifier | ||
34 | + * @param topologyId value of topology identifier | ||
35 | + */ | ||
36 | + public TeTopologyId(long providerId, long clientId, String topologyId) { | ||
37 | + this.providerId = providerId; | ||
38 | + this.clientId = clientId; | ||
39 | + this.topologyId = topologyId; | ||
40 | + } | ||
41 | + | ||
42 | + /** | ||
43 | + * Returns the provider identifier. | ||
44 | + * | ||
45 | + * @return provider identifier | ||
46 | + */ | ||
47 | + public long providerId() { | ||
48 | + return providerId; | ||
49 | + } | ||
50 | + | ||
51 | + /** | ||
52 | + * Returns the client identifier. | ||
53 | + * | ||
54 | + * @return client identifier | ||
55 | + */ | ||
56 | + public long clientId() { | ||
57 | + return clientId; | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * Returns the topology identifier. | ||
62 | + * | ||
63 | + * @return topology identifier | ||
64 | + */ | ||
65 | + public String topologyId() { | ||
66 | + return topologyId; | ||
67 | + } | ||
68 | + | ||
69 | + @Override | ||
70 | + public int hashCode() { | ||
71 | + return Objects.hashCode(providerId, clientId, topologyId); | ||
72 | + } | ||
73 | + | ||
74 | + @Override | ||
75 | + public boolean equals(Object object) { | ||
76 | + if (this == object) { | ||
77 | + return true; | ||
78 | + } | ||
79 | + if (object instanceof TeTopologyId) { | ||
80 | + TeTopologyId that = (TeTopologyId) object; | ||
81 | + return Objects.equal(this.providerId, that.providerId) && | ||
82 | + Objects.equal(this.clientId, that.clientId) && | ||
83 | + Objects.equal(this.topologyId, that.topologyId); | ||
84 | + } | ||
85 | + return false; | ||
86 | + } | ||
87 | + | ||
88 | + @Override | ||
89 | + public String toString() { | ||
90 | + return MoreObjects.toStringHelper(this) | ||
91 | + .add("providerId", providerId) | ||
92 | + .add("clientId", clientId) | ||
93 | + .add("topologyId", topologyId) | ||
94 | + .toString(); | ||
95 | + } | ||
96 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyListener.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api; | ||
17 | + | ||
18 | +import org.onosproject.event.EventListener; | ||
19 | + | ||
20 | +/** | ||
21 | + * Entity capable of receiving TE network Topology related events. | ||
22 | + */ | ||
23 | +public interface TeTopologyListener extends EventListener<TeTopologyEvent> { | ||
24 | + | ||
25 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProvider.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api; | ||
17 | + | ||
18 | +import org.onosproject.net.provider.Provider; | ||
19 | + | ||
20 | +/** | ||
21 | + * Abstraction of an IETF network provider. | ||
22 | + * APIs for Manager to signal Provider. | ||
23 | + */ | ||
24 | +public interface TeTopologyProvider extends Provider { | ||
25 | + | ||
26 | + /** | ||
27 | + * TODO: | ||
28 | + * | ||
29 | + * Signals provider that abstract networks/network/link/node has been created/updated/deleted. | ||
30 | + * It's used by producers. | ||
31 | + * | ||
32 | + */ | ||
33 | + | ||
34 | + // TODO: Need to look at the following functions are required for TE Nodes | ||
35 | + | ||
36 | + // TODO: consider how dirty the triggerProbe gets; if it costs too much, let's drop it | ||
37 | + | ||
38 | + /** | ||
39 | + * Triggers an asynchronous probe of the specified device, intended to | ||
40 | + * determine whether the device is present or not. An indirect result of this | ||
41 | + * should be invocation of | ||
42 | + * {@link org.onosproject.net.device.DeviceProviderService#deviceConnected} )} or | ||
43 | + * {@link org.onosproject.net.device.DeviceProviderService#deviceDisconnected} | ||
44 | + * at some later point in time. | ||
45 | + * | ||
46 | + * @param deviceId ID of device to be probed | ||
47 | + */ | ||
48 | + //void triggerProbe(DeviceId deviceId); | ||
49 | + | ||
50 | + /** | ||
51 | + * Notifies the provider of a mastership role change for the specified | ||
52 | + * device as decided by the core. | ||
53 | + * | ||
54 | + * @param deviceId device identifier | ||
55 | + * @param newRole newly determined mastership role | ||
56 | + */ | ||
57 | + //void roleChanged(DeviceId deviceId, MastershipRole newRole); | ||
58 | + | ||
59 | + /** | ||
60 | + * Checks the reachability (connectivity) of a device from this provider. | ||
61 | + * | ||
62 | + * @param deviceId device identifier | ||
63 | + * @return true if reachable, false otherwise | ||
64 | + */ | ||
65 | + //boolean isReachable(DeviceId deviceId); | ||
66 | + | ||
67 | +} |
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api; | ||
17 | + | ||
18 | +import org.onosproject.net.provider.ProviderRegistry; | ||
19 | + | ||
20 | +/** | ||
21 | + * Abstraction of IETF networks topology provider registry. | ||
22 | + */ | ||
23 | +public interface TeTopologyProviderRegistry | ||
24 | + extends ProviderRegistry<TeTopologyProvider, TeTopologyProviderService> { | ||
25 | + | ||
26 | +} |
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api; | ||
17 | + | ||
18 | +import org.onosproject.net.provider.ProviderService; | ||
19 | +import org.onosproject.tetopology.management.api.link.NetworkLink; | ||
20 | +import org.onosproject.tetopology.management.api.link.NetworkLinkKey; | ||
21 | +import org.onosproject.tetopology.management.api.node.NetworkNode; | ||
22 | +import org.onosproject.tetopology.management.api.node.NetworkNodeKey; | ||
23 | +import org.onosproject.tetopology.management.api.node.TerminationPoint; | ||
24 | +import org.onosproject.tetopology.management.api.node.TerminationPointKey; | ||
25 | + | ||
26 | +/** | ||
27 | + * APIs for Provider to notify Manager about the network topology updates. | ||
28 | + */ | ||
29 | +public interface TeTopologyProviderService | ||
30 | + extends ProviderService<TeTopologyProvider> { | ||
31 | + | ||
32 | + /** | ||
33 | + * Signals that a Network has been created/updated. | ||
34 | + * | ||
35 | + * @param network value of the network to be updated | ||
36 | + */ | ||
37 | + void networkUpdated(Network network); | ||
38 | + | ||
39 | + /** | ||
40 | + * Signals that a Network has been removed. | ||
41 | + * | ||
42 | + * @param networkId network id in URI format | ||
43 | + */ | ||
44 | + void networkRemoved(KeyId networkId); | ||
45 | + | ||
46 | + /** | ||
47 | + * Signals that a Link has been created/updated. | ||
48 | + * | ||
49 | + * @param linkKey link id | ||
50 | + * @param link link object to be updated | ||
51 | + */ | ||
52 | + void linkUpdated(NetworkLinkKey linkKey, NetworkLink link); | ||
53 | + | ||
54 | + /** | ||
55 | + * Signals that a Network has been removed. | ||
56 | + * | ||
57 | + * @param linkKey link id | ||
58 | + */ | ||
59 | + void linkRemoved(NetworkLinkKey linkKey); | ||
60 | + | ||
61 | + /** | ||
62 | + * Signals that a Node has been created/updated. | ||
63 | + * | ||
64 | + * @param nodeKey node id | ||
65 | + * @param node node object to be updated | ||
66 | + */ | ||
67 | + void nodeUpdated(NetworkNodeKey nodeKey, NetworkNode node); | ||
68 | + | ||
69 | + /** | ||
70 | + * Signals that a Node has been removed. | ||
71 | + * | ||
72 | + * @param nodeKey node id | ||
73 | + */ | ||
74 | + void nodeRemoved(NetworkNodeKey nodeKey); | ||
75 | + | ||
76 | + /** | ||
77 | + * Signals that a TerminationPoint has been created/updated. | ||
78 | + * | ||
79 | + * @param terminationPointKey termination point id | ||
80 | + * @param terminationPoint termination point object to be updated | ||
81 | + */ | ||
82 | + void terminationPointUpdated(TerminationPointKey terminationPointKey, | ||
83 | + TerminationPoint terminationPoint); | ||
84 | + | ||
85 | + /** | ||
86 | + * Signals that a TerminationPoint has been removed. | ||
87 | + * | ||
88 | + * @param terminationPointKey termination point id | ||
89 | + */ | ||
90 | + void terminationPointRemoved(TerminationPointKey terminationPointKey); | ||
91 | + | ||
92 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyService.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api; | ||
17 | + | ||
18 | +import org.onosproject.event.ListenerService; | ||
19 | + | ||
20 | +/** | ||
21 | + * TE Topology Service API. | ||
22 | + */ | ||
23 | +public interface TeTopologyService | ||
24 | + extends ListenerService<TeTopologyEvent, TeTopologyListener> { | ||
25 | + | ||
26 | + /** | ||
27 | + * Returns a collection of currently known networks. | ||
28 | + * | ||
29 | + * @return a collection of networks | ||
30 | + */ | ||
31 | + Networks getNetworks(); | ||
32 | + | ||
33 | + /** | ||
34 | + * Returns the network identified by its network id. | ||
35 | + * | ||
36 | + * @param networkId network id in URI format | ||
37 | + * @return value of network | ||
38 | + */ | ||
39 | + Network getNetwork(KeyId networkId); | ||
40 | + | ||
41 | + /** | ||
42 | + * Updates the network. | ||
43 | + * | ||
44 | + * @param network network to be updated | ||
45 | + */ | ||
46 | + void updateNetwork(Network network); | ||
47 | + | ||
48 | + /** | ||
49 | + * Removes the network. | ||
50 | + * | ||
51 | + * @param networkId network id in URI format | ||
52 | + */ | ||
53 | + void removeNetwork(KeyId networkId); | ||
54 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyStore.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +import org.onosproject.store.Store; | ||
21 | + | ||
22 | +/** | ||
23 | + * Inventory of TE network topology. | ||
24 | + */ | ||
25 | +public interface TeTopologyStore | ||
26 | + extends Store<TeTopologyEvent, TeTopologyStoreDelegate> { | ||
27 | + | ||
28 | + /** | ||
29 | + * Returns a collection of currently known networks. | ||
30 | + * | ||
31 | + * @param type TE topology type | ||
32 | + * @return a collection of stored internal TE networks | ||
33 | + */ | ||
34 | + List<InternalTeNetwork> getNetworks(TeTopologyType type); | ||
35 | + | ||
36 | + /** | ||
37 | + * Returns the network. | ||
38 | + * | ||
39 | + * @param networkId network id in URI format | ||
40 | + * @return value of internal TE network | ||
41 | + */ | ||
42 | + InternalTeNetwork getNetwork(KeyId networkId); | ||
43 | + | ||
44 | + /** | ||
45 | + * Updates the network. | ||
46 | + * | ||
47 | + * @param network value of the network to be updated | ||
48 | + */ | ||
49 | + void updateNetwork(InternalTeNetwork network); | ||
50 | + | ||
51 | + /** | ||
52 | + * Removes the network. | ||
53 | + * | ||
54 | + * @param networkId network id in URI format | ||
55 | + */ | ||
56 | + void removeNetwork(KeyId networkId); | ||
57 | + | ||
58 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyStoreDelegate.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api; | ||
17 | + | ||
18 | +import org.onosproject.store.StoreDelegate; | ||
19 | + | ||
20 | +/** | ||
21 | + * Abstraction of TE networks store delegate. | ||
22 | + */ | ||
23 | +public interface TeTopologyStoreDelegate extends StoreDelegate<TeTopologyEvent> { | ||
24 | + | ||
25 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyType.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016-present 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.tetopology.management.api; | ||
18 | + | ||
19 | +/** | ||
20 | + * TE Topology type enumeration. | ||
21 | + */ | ||
22 | +public enum TeTopologyType { | ||
23 | + | ||
24 | + /** | ||
25 | + * Native topology. | ||
26 | + */ | ||
27 | + NATIVE(0), | ||
28 | + | ||
29 | + /** | ||
30 | + * Customized topology. | ||
31 | + */ | ||
32 | + CUSTOMIZED(1), | ||
33 | + | ||
34 | + /** | ||
35 | + * Subordinate TE topology received from SB. | ||
36 | + */ | ||
37 | + SUBORDINATE(2), | ||
38 | + | ||
39 | + /** | ||
40 | + * Configured TE topology received from NB. | ||
41 | + */ | ||
42 | + CONFIGURED(3), | ||
43 | + | ||
44 | + /** | ||
45 | + * ANY - default value, used for topology filtering based on topology type. | ||
46 | + */ | ||
47 | + ANY(4); | ||
48 | + | ||
49 | + private int teTopologyType; | ||
50 | + | ||
51 | + /** | ||
52 | + * Creates an instance of teTopologyType. | ||
53 | + * | ||
54 | + * @param value value of teTopologyType | ||
55 | + */ | ||
56 | + TeTopologyType(int value) { | ||
57 | + teTopologyType = value; | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * Returns the attribute teTopologyType. | ||
62 | + * | ||
63 | + * @return value of teTopologyType | ||
64 | + */ | ||
65 | + public int teTopologyType() { | ||
66 | + return teTopologyType; | ||
67 | + } | ||
68 | + | ||
69 | + /** | ||
70 | + * Returns the object of teTopologyType from input String. Returns null | ||
71 | + * when string conversion fails or value is not recognized. | ||
72 | + * | ||
73 | + * @param valInString input String | ||
74 | + * @return Object of teTopologyType | ||
75 | + */ | ||
76 | + public static TeTopologyType of(String valInString) { | ||
77 | + try { | ||
78 | + int tmpVal = Integer.parseInt(valInString); | ||
79 | + return of(tmpVal); | ||
80 | + } catch (Exception e) { | ||
81 | + } | ||
82 | + return null; | ||
83 | + } | ||
84 | + | ||
85 | + /** | ||
86 | + * Returns the object of teTopologyType from input integer. Returns null | ||
87 | + * when the integer value is not recognized. | ||
88 | + * | ||
89 | + * @param value value of teTopologyType | ||
90 | + * @return Object of corresponding TE topology type | ||
91 | + */ | ||
92 | + public static TeTopologyType of(int value) { | ||
93 | + switch (value) { | ||
94 | + case 0: | ||
95 | + return TeTopologyType.NATIVE; | ||
96 | + case 1: | ||
97 | + return TeTopologyType.CUSTOMIZED; | ||
98 | + case 2: | ||
99 | + return TeTopologyType.SUBORDINATE; | ||
100 | + case 3: | ||
101 | + return TeTopologyType.CONFIGURED; | ||
102 | + case 4: | ||
103 | + return TeTopologyType.ANY; | ||
104 | + default : | ||
105 | + return null; | ||
106 | + } | ||
107 | + } | ||
108 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/AsNumber.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +import java.util.Objects; | ||
19 | + | ||
20 | +import com.google.common.base.MoreObjects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Implementation of Automous System (AS) number as an ElementType. | ||
24 | + */ | ||
25 | +public class AsNumber implements ElementType { | ||
26 | + private final int asNumber; | ||
27 | + | ||
28 | + /** | ||
29 | + * Creates an instance of AsNumber. | ||
30 | + * | ||
31 | + * @param asNumber value of autonomous system number | ||
32 | + */ | ||
33 | + public AsNumber(int asNumber) { | ||
34 | + this.asNumber = asNumber; | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Returns the asNumber. | ||
39 | + * | ||
40 | + * @return value of the autonomous system number | ||
41 | + */ | ||
42 | + public int getAsNumber() { | ||
43 | + return asNumber; | ||
44 | + } | ||
45 | + | ||
46 | + @Override | ||
47 | + public int hashCode() { | ||
48 | + return Objects.hash(asNumber); | ||
49 | + } | ||
50 | + | ||
51 | + @Override | ||
52 | + public boolean equals(Object obj) { | ||
53 | + if (this == obj) { | ||
54 | + return true; | ||
55 | + } | ||
56 | + if (obj instanceof AsNumber) { | ||
57 | + AsNumber other = (AsNumber) obj; | ||
58 | + return Objects.equals(asNumber, other.asNumber); | ||
59 | + } | ||
60 | + return false; | ||
61 | + } | ||
62 | + | ||
63 | + @Override | ||
64 | + public String toString() { | ||
65 | + return MoreObjects.toStringHelper(getClass()) | ||
66 | + .add("asNumber", asNumber) | ||
67 | + .toString(); | ||
68 | + } | ||
69 | + | ||
70 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/DefaultNetworkLink.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +import org.onosproject.tetopology.management.api.KeyId; | ||
21 | +import org.onosproject.tetopology.management.api.node.TerminationPointKey; | ||
22 | + | ||
23 | +import com.google.common.base.MoreObjects; | ||
24 | +import com.google.common.base.Objects; | ||
25 | + | ||
26 | +/** | ||
27 | + * NetworkLink implementation. | ||
28 | + * <p> | ||
29 | + * The Set/Get methods below are defined to accept and pass references because | ||
30 | + * the object class is treated as a "composite" object class that holds | ||
31 | + * references to various member objects and their relationships, forming a | ||
32 | + * data tree. Internal routines of the TE topology manager may use the | ||
33 | + * following example methods to construct and manipulate any piece of data in | ||
34 | + * the data tree: | ||
35 | + *<pre> | ||
36 | + * newNode.getTe().setAdminStatus(), or | ||
37 | + * newNode.getSupportingNodeIds().add(nodeId), etc. | ||
38 | + *</pre> | ||
39 | + * Same for constructors where, for example, a child list may be constructed | ||
40 | + * first and passed in by reference to its parent object constructor. | ||
41 | + */ | ||
42 | +public class DefaultNetworkLink implements NetworkLink { | ||
43 | + private final KeyId linkId; | ||
44 | + private TerminationPointKey source; | ||
45 | + private TerminationPointKey destination; | ||
46 | + private List<NetworkLinkKey> supportingLinkIds; | ||
47 | + private TeLink te; | ||
48 | + | ||
49 | + /** | ||
50 | + * Creates an instance of DefaultNetworkLink. | ||
51 | + * | ||
52 | + * @param linkId link identifier | ||
53 | + */ | ||
54 | + public DefaultNetworkLink(KeyId linkId) { | ||
55 | + this.linkId = linkId; | ||
56 | + } | ||
57 | + | ||
58 | + /** | ||
59 | + * Sets the link source point. | ||
60 | + * | ||
61 | + * @param source the source to set | ||
62 | + */ | ||
63 | + public void setSource(TerminationPointKey source) { | ||
64 | + this.source = source; | ||
65 | + } | ||
66 | + | ||
67 | + /** | ||
68 | + * Sets the link destination point. | ||
69 | + * | ||
70 | + * @param destination the destination to set | ||
71 | + */ | ||
72 | + public void setDestination(TerminationPointKey destination) { | ||
73 | + this.destination = destination; | ||
74 | + } | ||
75 | + | ||
76 | + /** | ||
77 | + * Sets the supporting link Ids. | ||
78 | + * | ||
79 | + * @param supportingLinkIds the supportingLinkIds to set | ||
80 | + */ | ||
81 | + public void setSupportingLinkIds(List<NetworkLinkKey> supportingLinkIds) { | ||
82 | + this.supportingLinkIds = supportingLinkIds; | ||
83 | + } | ||
84 | + | ||
85 | + /** | ||
86 | + * Sets the te extension. | ||
87 | + * | ||
88 | + * @param te the te to set | ||
89 | + */ | ||
90 | + public void setTe(TeLink te) { | ||
91 | + this.te = te; | ||
92 | + } | ||
93 | + | ||
94 | + @Override | ||
95 | + public KeyId linkId() { | ||
96 | + return linkId; | ||
97 | + } | ||
98 | + | ||
99 | + @Override | ||
100 | + public TerminationPointKey getSource() { | ||
101 | + return source; | ||
102 | + } | ||
103 | + | ||
104 | + @Override | ||
105 | + public TerminationPointKey getDestination() { | ||
106 | + return destination; | ||
107 | + } | ||
108 | + @Override | ||
109 | + public List<NetworkLinkKey> getSupportingLinkIds() { | ||
110 | + return supportingLinkIds; | ||
111 | + } | ||
112 | + | ||
113 | + @Override | ||
114 | + public TeLink getTe() { | ||
115 | + return te; | ||
116 | + } | ||
117 | + | ||
118 | + @Override | ||
119 | + public int hashCode() { | ||
120 | + return Objects.hashCode(linkId, source, destination, supportingLinkIds, te); | ||
121 | + } | ||
122 | + | ||
123 | + @Override | ||
124 | + public boolean equals(Object object) { | ||
125 | + if (this == object) { | ||
126 | + return true; | ||
127 | + } | ||
128 | + if (object instanceof DefaultNetworkLink) { | ||
129 | + DefaultNetworkLink that = (DefaultNetworkLink) object; | ||
130 | + return Objects.equal(this.linkId, that.linkId) && | ||
131 | + Objects.equal(this.source, that.source) && | ||
132 | + Objects.equal(this.destination, that.destination) && | ||
133 | + Objects.equal(this.supportingLinkIds, that.supportingLinkIds) && | ||
134 | + Objects.equal(this.te, that.te); | ||
135 | + } | ||
136 | + return false; | ||
137 | + } | ||
138 | + | ||
139 | + @Override | ||
140 | + public String toString() { | ||
141 | + return MoreObjects.toStringHelper(this) | ||
142 | + .add("linkId", linkId) | ||
143 | + .add("source", source) | ||
144 | + .add("destination", destination) | ||
145 | + .add("supportingLinkIds", supportingLinkIds) | ||
146 | + .add("te", te) | ||
147 | + .toString(); | ||
148 | + } | ||
149 | + | ||
150 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/ElementType.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +/** | ||
19 | + * Abstraction of a path element type. | ||
20 | + */ | ||
21 | +public interface ElementType { | ||
22 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/ExternalDomain.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +import org.onosproject.tetopology.management.api.KeyId; | ||
19 | + | ||
20 | +import com.google.common.base.MoreObjects; | ||
21 | +import com.google.common.base.Objects; | ||
22 | + | ||
23 | +/** | ||
24 | + * Representation of an external domain link. | ||
25 | + */ | ||
26 | +public class ExternalDomain { | ||
27 | + private final KeyId remoteTeNodeId; | ||
28 | + private final KeyId remoteTeLinkTpId; | ||
29 | + private final long plugId; | ||
30 | + | ||
31 | + /** | ||
32 | + * Creates an instance of ExternalDomain. | ||
33 | + * | ||
34 | + * @param remoteTeNodeId remote TE node identifier | ||
35 | + * @param remoteTeLinkTpId remote TE link termination point identifier | ||
36 | + * @param plugId global plug id | ||
37 | + */ | ||
38 | + public ExternalDomain(KeyId remoteTeNodeId, KeyId remoteTeLinkTpId, long plugId) { | ||
39 | + this.remoteTeNodeId = remoteTeNodeId; | ||
40 | + this.remoteTeLinkTpId = remoteTeLinkTpId; | ||
41 | + this.plugId = plugId; | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * Creates an instance of ExternalDomain with remote TE node and tp. | ||
46 | + * | ||
47 | + * @param remoteTeNodeId remote TE node identifier | ||
48 | + * @param remoteTeLinkTpId remote TE link termination point identifier | ||
49 | + */ | ||
50 | + public ExternalDomain(KeyId remoteTeNodeId, KeyId remoteTeLinkTpId) { | ||
51 | + this.remoteTeNodeId = remoteTeNodeId; | ||
52 | + this.remoteTeLinkTpId = remoteTeLinkTpId; | ||
53 | + this.plugId = 0L; | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * Creates an instance of ExternalDomain with plugId. | ||
58 | + * | ||
59 | + * @param plugId global plug id | ||
60 | + */ | ||
61 | + public ExternalDomain(long plugId) { | ||
62 | + this.remoteTeNodeId = null; | ||
63 | + this.remoteTeLinkTpId = null; | ||
64 | + this.plugId = plugId; | ||
65 | + } | ||
66 | + | ||
67 | + /** | ||
68 | + * Returns the remote TeNode Id. | ||
69 | + * | ||
70 | + * @return value of the remote TE node identifier | ||
71 | + */ | ||
72 | + public KeyId remoteTeNodeId() { | ||
73 | + return remoteTeNodeId; | ||
74 | + } | ||
75 | + | ||
76 | + /** | ||
77 | + * Returns the remote TeLink TpId. | ||
78 | + * | ||
79 | + * @return value of the remote TE link identifier | ||
80 | + */ | ||
81 | + public KeyId remoteTeLinkTpId() { | ||
82 | + return remoteTeLinkTpId; | ||
83 | + } | ||
84 | + | ||
85 | + /** | ||
86 | + * Returns the plugId. | ||
87 | + * | ||
88 | + * @return value of the global plug id | ||
89 | + */ | ||
90 | + public long plugId() { | ||
91 | + return plugId; | ||
92 | + } | ||
93 | + | ||
94 | + @Override | ||
95 | + public int hashCode() { | ||
96 | + return Objects.hashCode(remoteTeNodeId, remoteTeLinkTpId, remoteTeLinkTpId); | ||
97 | + } | ||
98 | + | ||
99 | + @Override | ||
100 | + public boolean equals(Object object) { | ||
101 | + if (this == object) { | ||
102 | + return true; | ||
103 | + } | ||
104 | + if (object instanceof ExternalDomain) { | ||
105 | + ExternalDomain that = (ExternalDomain) object; | ||
106 | + return Objects.equal(this.remoteTeNodeId, that.remoteTeNodeId) && | ||
107 | + Objects.equal(this.remoteTeLinkTpId, that.remoteTeLinkTpId) && | ||
108 | + Objects.equal(this.remoteTeLinkTpId, that.remoteTeLinkTpId); | ||
109 | + } | ||
110 | + return false; | ||
111 | + } | ||
112 | + | ||
113 | + @Override | ||
114 | + public String toString() { | ||
115 | + return MoreObjects.toStringHelper(this) | ||
116 | + .add("remoteTeNodeId", remoteTeNodeId) | ||
117 | + .add("remoteTeLinkTpId", remoteTeLinkTpId) | ||
118 | + .add("remoteTeLinkTpId", remoteTeLinkTpId) | ||
119 | + .toString(); | ||
120 | + } | ||
121 | +} |
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +import java.util.Objects; | ||
19 | + | ||
20 | +import com.google.common.base.MoreObjects; | ||
21 | + | ||
22 | +/** | ||
23 | + * Implementation of Label as an ElementType. | ||
24 | + */ | ||
25 | +public class Label implements ElementType { | ||
26 | + private final long value; | ||
27 | + | ||
28 | + /** | ||
29 | + * Creates an instance of Label. | ||
30 | + * | ||
31 | + * @param label label value | ||
32 | + */ | ||
33 | + public Label(long label) { | ||
34 | + this.value = label; | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Returns the label. | ||
39 | + * | ||
40 | + * @return value of the label | ||
41 | + */ | ||
42 | + public long label() { | ||
43 | + return value; | ||
44 | + } | ||
45 | + | ||
46 | + @Override | ||
47 | + public int hashCode() { | ||
48 | + return Objects.hash(value); | ||
49 | + } | ||
50 | + | ||
51 | + @Override | ||
52 | + public boolean equals(Object obj) { | ||
53 | + if (this == obj) { | ||
54 | + return true; | ||
55 | + } | ||
56 | + if (obj instanceof Label) { | ||
57 | + Label other = (Label) obj; | ||
58 | + return | ||
59 | + Objects.equals(value, other.value); | ||
60 | + } | ||
61 | + return false; | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public String toString() { | ||
66 | + return MoreObjects.toStringHelper(getClass()) | ||
67 | + .add("value", value) | ||
68 | + .toString(); | ||
69 | + } | ||
70 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/LinkProtectionType.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016-present 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.tetopology.management.api.link; | ||
18 | + | ||
19 | +/** | ||
20 | + * Represents ENUM data of linkProtectionType. | ||
21 | + */ | ||
22 | +public enum LinkProtectionType { | ||
23 | + | ||
24 | + /** | ||
25 | + * Represents unprotected. | ||
26 | + */ | ||
27 | + UNPROTECTED(0), | ||
28 | + | ||
29 | + /** | ||
30 | + * Represents extraTraffic. | ||
31 | + */ | ||
32 | + EXTRA_TRAFFIC(1), | ||
33 | + | ||
34 | + /** | ||
35 | + * Represents shared. | ||
36 | + */ | ||
37 | + SHARED(2), | ||
38 | + | ||
39 | + /** | ||
40 | + * Represents yangAutoPrefix1For1. | ||
41 | + */ | ||
42 | + YANGAUTOPREFIX1_FOR_1(3), | ||
43 | + | ||
44 | + /** | ||
45 | + * Represents yangAutoPrefix1Plus1. | ||
46 | + */ | ||
47 | + YANGAUTOPREFIX1_PLUS_1(4), | ||
48 | + | ||
49 | + /** | ||
50 | + * Represents enhanced. | ||
51 | + */ | ||
52 | + ENHANCED(5); | ||
53 | + | ||
54 | + private int linkProtectionType; | ||
55 | + | ||
56 | + LinkProtectionType(int value) { | ||
57 | + linkProtectionType = value; | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * Returns the attribute linkProtectionType. | ||
62 | + * | ||
63 | + * @return value of linkProtectionType | ||
64 | + */ | ||
65 | + public int linkProtectionType() { | ||
66 | + return linkProtectionType; | ||
67 | + } | ||
68 | + | ||
69 | + /** | ||
70 | + * Returns the object of linkProtectionType from input String. Returns null | ||
71 | + * when string conversion fails or converted integer value is not recognized. | ||
72 | + * | ||
73 | + * @param valInString input String | ||
74 | + * @return Object of linkProtectionType | ||
75 | + */ | ||
76 | + public static LinkProtectionType of(String valInString) { | ||
77 | + try { | ||
78 | + int tmpVal = Integer.parseInt(valInString); | ||
79 | + return of(tmpVal); | ||
80 | + } catch (NumberFormatException e) { | ||
81 | + } | ||
82 | + return null; | ||
83 | + } | ||
84 | + | ||
85 | + /** | ||
86 | + * Returns the object of linkProtectionType from input integer. Returns null | ||
87 | + * when the integer value is not recognized. | ||
88 | + * | ||
89 | + * @param value value of linkProtectionTypeForTypeInt | ||
90 | + * @return Object of linkProtectionTypeForTypeInt | ||
91 | + */ | ||
92 | + public static LinkProtectionType of(int value) { | ||
93 | + switch (value) { | ||
94 | + case 0: | ||
95 | + return LinkProtectionType.UNPROTECTED; | ||
96 | + case 1: | ||
97 | + return LinkProtectionType.EXTRA_TRAFFIC; | ||
98 | + case 2: | ||
99 | + return LinkProtectionType.SHARED; | ||
100 | + case 3: | ||
101 | + return LinkProtectionType.YANGAUTOPREFIX1_FOR_1; | ||
102 | + case 4: | ||
103 | + return LinkProtectionType.YANGAUTOPREFIX1_PLUS_1; | ||
104 | + case 5: | ||
105 | + return LinkProtectionType.ENHANCED; | ||
106 | + default : | ||
107 | + return null; | ||
108 | + } | ||
109 | + } | ||
110 | + | ||
111 | + | ||
112 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/NetworkLink.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +import org.onosproject.tetopology.management.api.KeyId; | ||
21 | +import org.onosproject.tetopology.management.api.TeTopologyEventSubject; | ||
22 | +import org.onosproject.tetopology.management.api.node.TerminationPointKey; | ||
23 | + | ||
24 | +/** | ||
25 | + * Abstraction of a base network link. | ||
26 | + */ | ||
27 | +public interface NetworkLink extends TeTopologyEventSubject { | ||
28 | + | ||
29 | + /** | ||
30 | + * Returns the link id. | ||
31 | + * | ||
32 | + * @return link identifier | ||
33 | + */ | ||
34 | + KeyId linkId(); | ||
35 | + | ||
36 | + /** | ||
37 | + * Returns the link source termination point. | ||
38 | + * | ||
39 | + * @return source link termination point id | ||
40 | + */ | ||
41 | + TerminationPointKey getSource(); | ||
42 | + | ||
43 | + /** | ||
44 | + * Returns the link destination termination point. | ||
45 | + * | ||
46 | + * @return destination link termination point id | ||
47 | + */ | ||
48 | + TerminationPointKey getDestination(); | ||
49 | + | ||
50 | + /** | ||
51 | + * Returns the supporting link ids. | ||
52 | + * | ||
53 | + * @return list of the ids of the supporting links | ||
54 | + */ | ||
55 | + List<NetworkLinkKey> getSupportingLinkIds(); | ||
56 | + | ||
57 | + /** | ||
58 | + * Returns the link te extension. | ||
59 | + * | ||
60 | + * @return TE link attributes | ||
61 | + */ | ||
62 | + TeLink getTe(); | ||
63 | + | ||
64 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/NetworkLinkKey.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +import org.onosproject.tetopology.management.api.KeyId; | ||
19 | + | ||
20 | +import com.google.common.base.MoreObjects; | ||
21 | +import com.google.common.base.Objects; | ||
22 | + | ||
23 | +/** | ||
24 | + * Representation of a link key or link reference. | ||
25 | + */ | ||
26 | +public class NetworkLinkKey { | ||
27 | + private final KeyId networkId; | ||
28 | + private final KeyId linkId; | ||
29 | + | ||
30 | + /** | ||
31 | + * Creates an instance of NetworkLinkKey. | ||
32 | + * | ||
33 | + * @param networkId network identifier | ||
34 | + * @param linkId link identifier | ||
35 | + */ | ||
36 | + public NetworkLinkKey(KeyId networkId, KeyId linkId) { | ||
37 | + this.networkId = networkId; | ||
38 | + this.linkId = linkId; | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
42 | + * Returns the network identifier. | ||
43 | + * | ||
44 | + * @return network identifier | ||
45 | + */ | ||
46 | + public KeyId networkId() { | ||
47 | + return networkId; | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * Returns the link identifier. | ||
52 | + * | ||
53 | + * @return link identifier | ||
54 | + */ | ||
55 | + public KeyId linkId() { | ||
56 | + return linkId; | ||
57 | + } | ||
58 | + | ||
59 | + @Override | ||
60 | + public int hashCode() { | ||
61 | + return Objects.hashCode(networkId, linkId); | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public boolean equals(Object object) { | ||
66 | + if (this == object) { | ||
67 | + return true; | ||
68 | + } | ||
69 | + if (object instanceof NetworkLinkKey) { | ||
70 | + NetworkLinkKey that = (NetworkLinkKey) object; | ||
71 | + return Objects.equal(this.networkId, that.networkId) && | ||
72 | + Objects.equal(this.linkId, that.linkId); | ||
73 | + } | ||
74 | + return false; | ||
75 | + } | ||
76 | + | ||
77 | + @Override | ||
78 | + public String toString() { | ||
79 | + return MoreObjects.toStringHelper(this) | ||
80 | + .add("networkId", networkId) | ||
81 | + .add("linkId", linkId) | ||
82 | + .toString(); | ||
83 | + } | ||
84 | + | ||
85 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/PathElement.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +import com.google.common.base.MoreObjects; | ||
19 | +import com.google.common.base.Objects; | ||
20 | + | ||
21 | +/** | ||
22 | + * Represent a path element. | ||
23 | + */ | ||
24 | +public class PathElement { | ||
25 | + private final long pathElementId; | ||
26 | + private final ElementType type; | ||
27 | + | ||
28 | + /** | ||
29 | + * Creates an instance of PathElement. | ||
30 | + * | ||
31 | + * @param pathElementId path element identifier | ||
32 | + * @param type path element type | ||
33 | + */ | ||
34 | + public PathElement(long pathElementId, ElementType type) { | ||
35 | + this.pathElementId = pathElementId; | ||
36 | + this.type = type; | ||
37 | + } | ||
38 | + | ||
39 | + /** | ||
40 | + * Returns the path element identifier. | ||
41 | + * | ||
42 | + * @return path element id | ||
43 | + */ | ||
44 | + public long pathElementId() { | ||
45 | + return pathElementId; | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * Returns the path element type. | ||
50 | + * | ||
51 | + * @return path element type | ||
52 | + */ | ||
53 | + public ElementType type() { | ||
54 | + return type; | ||
55 | + } | ||
56 | + | ||
57 | + @Override | ||
58 | + public int hashCode() { | ||
59 | + return Objects.hashCode(pathElementId, type); | ||
60 | + } | ||
61 | + | ||
62 | + @Override | ||
63 | + public boolean equals(Object object) { | ||
64 | + if (this == object) { | ||
65 | + return true; | ||
66 | + } | ||
67 | + if (object instanceof PathElement) { | ||
68 | + PathElement that = (PathElement) object; | ||
69 | + return Objects.equal(this.pathElementId, that.pathElementId) && | ||
70 | + Objects.equal(this.type, that.type); | ||
71 | + } | ||
72 | + return false; | ||
73 | + } | ||
74 | + | ||
75 | + @Override | ||
76 | + public String toString() { | ||
77 | + return MoreObjects.toStringHelper(this) | ||
78 | + .add("pathElementId", pathElementId) | ||
79 | + .add("type", type) | ||
80 | + .toString(); | ||
81 | + } | ||
82 | + | ||
83 | +} |
1 | +/** | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +import java.util.Objects; | ||
19 | + | ||
20 | +import org.onlab.packet.Ip4Address; | ||
21 | + | ||
22 | +import com.google.common.base.MoreObjects; | ||
23 | + | ||
24 | +/** | ||
25 | + * Implementation of IPv4 address as an ElementType. | ||
26 | + */ | ||
27 | +public class TeIpv4 implements ElementType { | ||
28 | + private Ip4Address v4Address; | ||
29 | + private short v4PrefixLength; | ||
30 | + private boolean v4Loose; | ||
31 | + | ||
32 | + /** | ||
33 | + * Creates an instance of TeIpv4. | ||
34 | + */ | ||
35 | + public TeIpv4() { | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * Sets the v4 address. | ||
40 | + * | ||
41 | + * @param v4Address the v4Address to set | ||
42 | + */ | ||
43 | + public void setV4Address(Ip4Address v4Address) { | ||
44 | + this.v4Address = v4Address; | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * Sets the prefix length. | ||
49 | + * | ||
50 | + * @param v4PrefixLength the v4PrefixLength to set | ||
51 | + */ | ||
52 | + public void setV4PrefixLength(short v4PrefixLength) { | ||
53 | + this.v4PrefixLength = v4PrefixLength; | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * Sets the loose flag. | ||
58 | + * | ||
59 | + * @param v4Loose the v4Loose to set | ||
60 | + */ | ||
61 | + public void setV4Loose(boolean v4Loose) { | ||
62 | + this.v4Loose = v4Loose; | ||
63 | + } | ||
64 | + | ||
65 | + /** | ||
66 | + * Returns the v4Address. | ||
67 | + * | ||
68 | + * @return IPv4 address | ||
69 | + */ | ||
70 | + public Ip4Address v4Address() { | ||
71 | + return v4Address; | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * Returns the v4PrefixLength. | ||
76 | + * | ||
77 | + * @return IPv4 address prefix length | ||
78 | + */ | ||
79 | + public short v4PrefixLength() { | ||
80 | + return v4PrefixLength; | ||
81 | + } | ||
82 | + | ||
83 | + /** | ||
84 | + * Returns the v4Loose. | ||
85 | + * | ||
86 | + * @return true if the address specifies a loose hop; false otherwise | ||
87 | + */ | ||
88 | + public boolean v4Loose() { | ||
89 | + return v4Loose; | ||
90 | + } | ||
91 | + | ||
92 | + @Override | ||
93 | + public int hashCode() { | ||
94 | + return Objects.hash(v4Address, v4PrefixLength, v4Loose); | ||
95 | + } | ||
96 | + | ||
97 | + @Override | ||
98 | + public boolean equals(Object obj) { | ||
99 | + if (this == obj) { | ||
100 | + return true; | ||
101 | + } | ||
102 | + if (obj instanceof TeIpv4) { | ||
103 | + TeIpv4 other = (TeIpv4) obj; | ||
104 | + return Objects.equals(v4Address, other.v4Address) && | ||
105 | + Objects.equals(v4PrefixLength, other.v4PrefixLength) && | ||
106 | + Objects.equals(v4Loose, other.v4Loose); | ||
107 | + } | ||
108 | + return false; | ||
109 | + } | ||
110 | + | ||
111 | + @Override | ||
112 | + public String toString() { | ||
113 | + return MoreObjects.toStringHelper(getClass()) | ||
114 | + .add("v4Address", v4Address) | ||
115 | + .add("v4PrefixLength", v4PrefixLength) | ||
116 | + .add("v4Loose", v4Loose) | ||
117 | + .toString(); | ||
118 | + } | ||
119 | + | ||
120 | +} |
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +import java.util.Objects; | ||
19 | + | ||
20 | +import org.onlab.packet.Ip6Address; | ||
21 | + | ||
22 | +import com.google.common.base.MoreObjects; | ||
23 | + | ||
24 | +/** | ||
25 | + * Implementation of IPv6 address as an ElementType. | ||
26 | + */ | ||
27 | +public class TeIpv6 implements ElementType { | ||
28 | + private Ip6Address v6Address; | ||
29 | + private short v6PrefixLength; | ||
30 | + private boolean v6Loose; | ||
31 | + | ||
32 | + /** | ||
33 | + * Creates an instance of TeIpv6. | ||
34 | + */ | ||
35 | + public TeIpv6() { | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * Sets the v6 address. | ||
40 | + * | ||
41 | + * @param v6Address the v6Address to set | ||
42 | + */ | ||
43 | + public void setV6Address(Ip6Address v6Address) { | ||
44 | + this.v6Address = v6Address; | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * Sets the prefix length. | ||
49 | + * | ||
50 | + * @param v6PrefixLength the v6PrefixLength to set | ||
51 | + */ | ||
52 | + public void setV6PrefixLength(short v6PrefixLength) { | ||
53 | + this.v6PrefixLength = v6PrefixLength; | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * Sets the loose flag. | ||
58 | + * | ||
59 | + * @param v6Loose the v6Loose to set | ||
60 | + */ | ||
61 | + public void setv6Loose(boolean v6Loose) { | ||
62 | + this.v6Loose = v6Loose; | ||
63 | + } | ||
64 | + | ||
65 | + /** | ||
66 | + * Returns the v6Address. | ||
67 | + * | ||
68 | + * @return IPv6 address | ||
69 | + */ | ||
70 | + public Ip6Address v6Address() { | ||
71 | + return v6Address; | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * Returns the v6PrefixLength. | ||
76 | + * | ||
77 | + * @return IPv6 address prefix length | ||
78 | + */ | ||
79 | + public short v6PrefixLength() { | ||
80 | + return v6PrefixLength; | ||
81 | + } | ||
82 | + | ||
83 | + /** | ||
84 | + * Returns the v6Loose. | ||
85 | + * | ||
86 | + * @return true if the address specifies a loose hop; false otherwise | ||
87 | + */ | ||
88 | + public boolean v6Loose() { | ||
89 | + return v6Loose; | ||
90 | + } | ||
91 | + | ||
92 | + @Override | ||
93 | + public int hashCode() { | ||
94 | + return Objects.hash(v6Address, v6PrefixLength, v6Loose); | ||
95 | + } | ||
96 | + | ||
97 | + @Override | ||
98 | + public boolean equals(Object obj) { | ||
99 | + if (this == obj) { | ||
100 | + return true; | ||
101 | + } | ||
102 | + if (obj instanceof TeIpv6) { | ||
103 | + TeIpv6 other = (TeIpv6) obj; | ||
104 | + return Objects.equals(v6Address, other.v6Address) && | ||
105 | + Objects.equals(v6PrefixLength, other.v6PrefixLength) && | ||
106 | + Objects.equals(v6Loose, other.v6Loose); | ||
107 | + } | ||
108 | + return false; | ||
109 | + } | ||
110 | + | ||
111 | + @Override | ||
112 | + public String toString() { | ||
113 | + return MoreObjects.toStringHelper(getClass()) | ||
114 | + .add("v6Address", v6Address) | ||
115 | + .add("v6PrefixLength", v6PrefixLength) | ||
116 | + .add("v6Loose", v6Loose) | ||
117 | + .toString(); | ||
118 | + } | ||
119 | + | ||
120 | +} |
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +import java.math.BigDecimal; | ||
19 | +import java.math.BigInteger; | ||
20 | +import java.util.List; | ||
21 | + | ||
22 | +import org.onosproject.tetopology.management.api.node.TeStatus; | ||
23 | + | ||
24 | +import com.google.common.base.MoreObjects; | ||
25 | +import com.google.common.base.Objects; | ||
26 | + | ||
27 | +/** | ||
28 | + * Link TE extension. | ||
29 | + * <p> | ||
30 | + * The Set/Get methods below are defined to accept and pass references because | ||
31 | + * the object class is treated as a "composite" object class that holds | ||
32 | + * references to various member objects and their relationships, forming a | ||
33 | + * data tree. Internal routines of the TE topology manager may use the | ||
34 | + * following example methods to construct and manipulate any piece of data in | ||
35 | + * the data tree: | ||
36 | + *<pre> | ||
37 | + * newNode.getTe().setAdminStatus(), or | ||
38 | + * newNode.getSupportingNodeIds().add(nodeId), etc. | ||
39 | + *</pre> | ||
40 | + * Same for constructors where, for example, a child list may be constructed | ||
41 | + * first and passed in by reference to its parent object constructor. | ||
42 | + */ | ||
43 | +public class TeLink { | ||
44 | + // See org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te. | ||
45 | + // topology.rev20160708.ietftetopology | ||
46 | + // .augmentedntlink.te.config.DefaultTeLinkAttributes for reference | ||
47 | + private BigInteger linkIndex; | ||
48 | + private String name; | ||
49 | + private TeStatus adminStatus; | ||
50 | + private TeStatus opStatus; | ||
51 | + private TeLinkAccessType accessType; | ||
52 | + //private administrativeGroup | ||
53 | + private LinkProtectionType linkProtectionType; | ||
54 | + private BigDecimal maxLinkBandwidth; | ||
55 | + private BigDecimal maxResvLinkBandwidth; | ||
56 | + private List<UnreservedBandwidth> unreservedBandwidths; | ||
57 | + private long teDefaultMetric; | ||
58 | + private ExternalDomain externalDomain; | ||
59 | + private List<Long> teSrlgs; | ||
60 | + private boolean isAbstract; | ||
61 | + private UnderlayPath underlayPath; | ||
62 | + | ||
63 | + /** | ||
64 | + * Creates an instance of TeLink. | ||
65 | + * | ||
66 | + * @param linkIndex TE link index | ||
67 | + */ | ||
68 | + public TeLink(BigInteger linkIndex) { | ||
69 | + this.linkIndex = linkIndex; | ||
70 | + } | ||
71 | + | ||
72 | + /** | ||
73 | + * Sets the name. | ||
74 | + * | ||
75 | + * @param name the name to set | ||
76 | + */ | ||
77 | + public void setName(String name) { | ||
78 | + this.name = name; | ||
79 | + } | ||
80 | + | ||
81 | + /** | ||
82 | + * Sets the administrative status. | ||
83 | + * | ||
84 | + * @param adminStatus the adminStatus to set | ||
85 | + */ | ||
86 | + public void setAdminStatus(TeStatus adminStatus) { | ||
87 | + this.adminStatus = adminStatus; | ||
88 | + } | ||
89 | + | ||
90 | + /** | ||
91 | + * Sets the operational status. | ||
92 | + * | ||
93 | + * @param opStatus the opStatus to set | ||
94 | + */ | ||
95 | + public void setOpStatus(TeStatus opStatus) { | ||
96 | + this.opStatus = opStatus; | ||
97 | + } | ||
98 | + | ||
99 | + /** | ||
100 | + * Sets the access type. | ||
101 | + * | ||
102 | + * @param accessType the accessType to set | ||
103 | + */ | ||
104 | + public void setAccessType(TeLinkAccessType accessType) { | ||
105 | + this.accessType = accessType; | ||
106 | + } | ||
107 | + | ||
108 | + /** | ||
109 | + * Sets the protection type. | ||
110 | + * | ||
111 | + * @param type the linkProtectionType to set | ||
112 | + */ | ||
113 | + public void setLinkProtectionType(LinkProtectionType type) { | ||
114 | + this.linkProtectionType = type; | ||
115 | + } | ||
116 | + | ||
117 | + /** | ||
118 | + * Sets the link maximum bandwidth. | ||
119 | + * | ||
120 | + * @param bw the maxLinkBandwidth to set | ||
121 | + */ | ||
122 | + public void setMaxLinkBandwidth(BigDecimal bw) { | ||
123 | + this.maxLinkBandwidth = bw; | ||
124 | + } | ||
125 | + | ||
126 | + /** | ||
127 | + * Sets the link maximum reservable bandwidth. | ||
128 | + * | ||
129 | + * @param bw the maxResvLinkBandwidth to set | ||
130 | + */ | ||
131 | + public void setMaxResvLinkBandwidth(BigDecimal bw) { | ||
132 | + this.maxResvLinkBandwidth = bw; | ||
133 | + } | ||
134 | + | ||
135 | + /** | ||
136 | + * Sets the list of link unreserved bandwidths. | ||
137 | + * | ||
138 | + * @param bwList the unreservedBandwidths to set | ||
139 | + */ | ||
140 | + public void setUnreservedBandwidths(List<UnreservedBandwidth> bwList) { | ||
141 | + this.unreservedBandwidths = bwList; | ||
142 | + } | ||
143 | + | ||
144 | + /** | ||
145 | + * Sets the default metric. | ||
146 | + * | ||
147 | + * @param metric the teDefaultMetric to set | ||
148 | + */ | ||
149 | + public void setTeDefaultMetric(long metric) { | ||
150 | + this.teDefaultMetric = metric; | ||
151 | + } | ||
152 | + | ||
153 | + /** | ||
154 | + * Sets the external domain link. | ||
155 | + * | ||
156 | + * @param extDomain the externalDomain to set | ||
157 | + */ | ||
158 | + public void setExternalDomain(ExternalDomain extDomain) { | ||
159 | + this.externalDomain = extDomain; | ||
160 | + } | ||
161 | + | ||
162 | + /** | ||
163 | + * Sets the list of SRLGs. | ||
164 | + * | ||
165 | + * @param teSrlgs the teSrlgs to set | ||
166 | + */ | ||
167 | + public void setTeSrlgs(List<Long> teSrlgs) { | ||
168 | + this.teSrlgs = teSrlgs; | ||
169 | + } | ||
170 | + | ||
171 | + /** | ||
172 | + * Sets the isAbstract flag. | ||
173 | + * | ||
174 | + * @param isAbstract the isAbstract to set | ||
175 | + */ | ||
176 | + public void setIsAbstract(boolean isAbstract) { | ||
177 | + this.isAbstract = isAbstract; | ||
178 | + } | ||
179 | + | ||
180 | + /** | ||
181 | + * Sets the link underlay path. | ||
182 | + * | ||
183 | + * @param underlayPath the underlay path to set | ||
184 | + */ | ||
185 | + public void setUnderlayPath(UnderlayPath underlayPath) { | ||
186 | + this.underlayPath = underlayPath; | ||
187 | + } | ||
188 | + | ||
189 | + /** | ||
190 | + * Returns the link index. | ||
191 | + * | ||
192 | + * @return link index | ||
193 | + */ | ||
194 | + public BigInteger linkIndex() { | ||
195 | + return linkIndex; | ||
196 | + } | ||
197 | + | ||
198 | + /** | ||
199 | + * Returns the name. | ||
200 | + * | ||
201 | + * @return name of the TE link | ||
202 | + */ | ||
203 | + public String name() { | ||
204 | + return name; | ||
205 | + } | ||
206 | + | ||
207 | + /** | ||
208 | + * Returns the administrative status. | ||
209 | + * | ||
210 | + * @return link admin status | ||
211 | + */ | ||
212 | + public TeStatus adminStatus() { | ||
213 | + return adminStatus; | ||
214 | + } | ||
215 | + | ||
216 | + /** | ||
217 | + * Returns the operational status. | ||
218 | + * | ||
219 | + * @return link operational status | ||
220 | + */ | ||
221 | + public TeStatus opStatus() { | ||
222 | + return opStatus; | ||
223 | + } | ||
224 | + | ||
225 | + /** | ||
226 | + * Returns the access type. | ||
227 | + * | ||
228 | + * @return link access type | ||
229 | + */ | ||
230 | + public TeLinkAccessType accessType() { | ||
231 | + return accessType; | ||
232 | + } | ||
233 | + | ||
234 | + /** | ||
235 | + * Returns the link protection type. | ||
236 | + * | ||
237 | + * @return link protection type | ||
238 | + */ | ||
239 | + public LinkProtectionType linkProtectionType() { | ||
240 | + return linkProtectionType; | ||
241 | + } | ||
242 | + | ||
243 | + /** | ||
244 | + * Returns the link maximum bandwidth. | ||
245 | + * | ||
246 | + * @return link maximum bandwidth | ||
247 | + */ | ||
248 | + public BigDecimal maxLinkBandwidth() { | ||
249 | + return maxLinkBandwidth; | ||
250 | + } | ||
251 | + | ||
252 | + /** | ||
253 | + * Returns the maximum reservable bandwidth. | ||
254 | + * | ||
255 | + * @return link maximum reservable bandwidth | ||
256 | + */ | ||
257 | + public BigDecimal maxResvLinkBandwidth() { | ||
258 | + return maxResvLinkBandwidth; | ||
259 | + } | ||
260 | + | ||
261 | + /** | ||
262 | + * Returns the list of link unreserved bandwidths. | ||
263 | + * | ||
264 | + * @return link unreserved bandwidth | ||
265 | + */ | ||
266 | + public List<UnreservedBandwidth> unreservedBandwidths() { | ||
267 | + return unreservedBandwidths; | ||
268 | + } | ||
269 | + | ||
270 | + /** | ||
271 | + * Returns the te default metric. | ||
272 | + * | ||
273 | + * @return link TE metric | ||
274 | + */ | ||
275 | + public long teDefaultMetric() { | ||
276 | + return teDefaultMetric; | ||
277 | + } | ||
278 | + | ||
279 | + /** | ||
280 | + * Returns the external domain link. | ||
281 | + * | ||
282 | + * @return external domain | ||
283 | + */ | ||
284 | + public ExternalDomain externalDomain() { | ||
285 | + return externalDomain; | ||
286 | + } | ||
287 | + | ||
288 | + /** | ||
289 | + * Returns the list of SRLGs. | ||
290 | + * | ||
291 | + * @return link SRLG | ||
292 | + */ | ||
293 | + public List<Long> teSrlgs() { | ||
294 | + return teSrlgs; | ||
295 | + } | ||
296 | + | ||
297 | + /** | ||
298 | + * Returns the flag isAbstract. | ||
299 | + * | ||
300 | + * @return true or false if link is abstract | ||
301 | + */ | ||
302 | + public boolean isAbstract() { | ||
303 | + return isAbstract; | ||
304 | + } | ||
305 | + | ||
306 | + /** | ||
307 | + * Returns the underlay path data. | ||
308 | + * | ||
309 | + * @return link underlay TE path | ||
310 | + */ | ||
311 | + public UnderlayPath underlayPath() { | ||
312 | + return underlayPath; | ||
313 | + } | ||
314 | + | ||
315 | + @Override | ||
316 | + public int hashCode() { | ||
317 | + return Objects.hashCode(linkIndex, name, adminStatus, opStatus, accessType, | ||
318 | + linkProtectionType, maxLinkBandwidth, maxResvLinkBandwidth, unreservedBandwidths, | ||
319 | + teDefaultMetric, externalDomain, teSrlgs, isAbstract, underlayPath); | ||
320 | + } | ||
321 | + | ||
322 | + @Override | ||
323 | + public boolean equals(Object object) { | ||
324 | + if (this == object) { | ||
325 | + return true; | ||
326 | + } | ||
327 | + if (object instanceof TeLink) { | ||
328 | + TeLink that = (TeLink) object; | ||
329 | + return Objects.equal(this.linkIndex, that.linkIndex) && | ||
330 | + Objects.equal(this.name, that.name) && | ||
331 | + Objects.equal(this.adminStatus, that.adminStatus) && | ||
332 | + Objects.equal(this.opStatus, that.opStatus) && | ||
333 | + Objects.equal(this.accessType, that.accessType) && | ||
334 | + Objects.equal(this.linkProtectionType, that.linkProtectionType) && | ||
335 | + Objects.equal(this.maxLinkBandwidth, that.maxLinkBandwidth) && | ||
336 | + Objects.equal(this.maxResvLinkBandwidth, that.maxResvLinkBandwidth) && | ||
337 | + Objects.equal(this.unreservedBandwidths, that.unreservedBandwidths) && | ||
338 | + Objects.equal(this.teDefaultMetric, that.teDefaultMetric) && | ||
339 | + Objects.equal(this.externalDomain, that.externalDomain) && | ||
340 | + Objects.equal(this.teSrlgs, that.teSrlgs) && | ||
341 | + Objects.equal(this.isAbstract, that.isAbstract) && | ||
342 | + Objects.equal(this.underlayPath, that.underlayPath); | ||
343 | + } | ||
344 | + return false; | ||
345 | + } | ||
346 | + | ||
347 | + @Override | ||
348 | + public String toString() { | ||
349 | + return MoreObjects.toStringHelper(this) | ||
350 | + .add("linkIndex", linkIndex) | ||
351 | + .add("name", name) | ||
352 | + .add("adminStatus", adminStatus) | ||
353 | + .add("opStatus", opStatus) | ||
354 | + .add("accessType", accessType) | ||
355 | + .add("linkProtectionType", linkProtectionType) | ||
356 | + .add("maxLinkBandwidth", maxLinkBandwidth) | ||
357 | + .add("maxResvLinkBandwidth", maxResvLinkBandwidth) | ||
358 | + .add("unreservedBandwidths", unreservedBandwidths) | ||
359 | + .add("teDefaultMetric", teDefaultMetric) | ||
360 | + .add("externalDomain", externalDomain) | ||
361 | + .add("teSrlgs", teSrlgs) | ||
362 | + .add("isAbstract", isAbstract) | ||
363 | + .add("underlayPath", underlayPath) | ||
364 | + .toString(); | ||
365 | + } | ||
366 | + | ||
367 | + | ||
368 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkAccessType.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +/** | ||
19 | + * Represents ENUM data of teLinkAccessType. | ||
20 | + */ | ||
21 | +public enum TeLinkAccessType { | ||
22 | + /** | ||
23 | + * Represents pointToPoint. | ||
24 | + */ | ||
25 | + POINT_TO_POINT(0), | ||
26 | + | ||
27 | + /** | ||
28 | + * Represents multiAccess. | ||
29 | + */ | ||
30 | + MULTI_ACCESS(1); | ||
31 | + | ||
32 | + private int teLinkAccessType; | ||
33 | + | ||
34 | + TeLinkAccessType(int value) { | ||
35 | + teLinkAccessType = value; | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * Returns the attribute teLinkAccessType. | ||
40 | + * | ||
41 | + * @return value of teLinkAccessType | ||
42 | + */ | ||
43 | + public int teLinkAccessType() { | ||
44 | + return teLinkAccessType; | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * Returns the object of teLinkAccessType from input String. Returns null | ||
49 | + * when string conversion fails or converted integer value is not recognized. | ||
50 | + * | ||
51 | + * @param valInString input String | ||
52 | + * @return Object of teLinkAccessType | ||
53 | + */ | ||
54 | + public static TeLinkAccessType of(String valInString) { | ||
55 | + try { | ||
56 | + int tmpVal = Integer.parseInt(valInString); | ||
57 | + return of(tmpVal); | ||
58 | + } catch (NumberFormatException e) { | ||
59 | + } | ||
60 | + return null; | ||
61 | + } | ||
62 | + | ||
63 | + /** | ||
64 | + * Returns the object of teLinkAccessTypeForTypeInt. Returns null | ||
65 | + * when the integer value is not recognized. | ||
66 | + * | ||
67 | + * @param value value of teLinkAccessTypeForTypeInt | ||
68 | + * @return Object of teLinkAccessTypeForTypeInt | ||
69 | + */ | ||
70 | + public static TeLinkAccessType of(int value) { | ||
71 | + switch (value) { | ||
72 | + case 0: | ||
73 | + return TeLinkAccessType.POINT_TO_POINT; | ||
74 | + case 1: | ||
75 | + return TeLinkAccessType.MULTI_ACCESS; | ||
76 | + default : | ||
77 | + return null; | ||
78 | + } | ||
79 | + } | ||
80 | + | ||
81 | +} |
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | +import java.util.Objects; | ||
20 | + | ||
21 | +import org.onosproject.tetopology.management.api.node.TeNetworkTopologyId; | ||
22 | + | ||
23 | +import com.google.common.base.MoreObjects; | ||
24 | + | ||
25 | +/** | ||
26 | + * Represents the common defintion of an underlay path that supports a TE link. | ||
27 | + */ | ||
28 | +public class UnderlayAbstractPath { | ||
29 | + private TeNetworkTopologyId ref; | ||
30 | + private List<PathElement> pathElements; | ||
31 | + | ||
32 | + /** | ||
33 | + * Creates an instance of UnderlayAbstractPath. | ||
34 | + */ | ||
35 | + public UnderlayAbstractPath() { | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * Sets the TE Topology reference. | ||
40 | + * | ||
41 | + * @param ref the ref to set | ||
42 | + */ | ||
43 | + public void setRef(TeNetworkTopologyId ref) { | ||
44 | + this.ref = ref; | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * Sets the list of path elements. | ||
49 | + * | ||
50 | + * @param pathElements the pathElement to set | ||
51 | + */ | ||
52 | + public void setPathElement(List<PathElement> pathElements) { | ||
53 | + this.pathElements = pathElements; | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * Returns the TE Topology reference. | ||
58 | + * | ||
59 | + * @return value of TE network topology identifier | ||
60 | + */ | ||
61 | + public TeNetworkTopologyId ref() { | ||
62 | + return ref; | ||
63 | + } | ||
64 | + | ||
65 | + /** | ||
66 | + * Returns the list of path elements. | ||
67 | + * | ||
68 | + * @return list of path elements | ||
69 | + */ | ||
70 | + public List<PathElement> pathElements() { | ||
71 | + return pathElements; | ||
72 | + } | ||
73 | + | ||
74 | + @Override | ||
75 | + public int hashCode() { | ||
76 | + return Objects.hash(ref, pathElements); | ||
77 | + } | ||
78 | + | ||
79 | + @Override | ||
80 | + public boolean equals(Object obj) { | ||
81 | + if (this == obj) { | ||
82 | + return true; | ||
83 | + } | ||
84 | + if (obj instanceof UnderlayAbstractPath) { | ||
85 | + UnderlayAbstractPath other = (UnderlayAbstractPath) obj; | ||
86 | + return Objects.equals(ref, other.ref) && | ||
87 | + Objects.equals(pathElements, other.pathElements); | ||
88 | + } | ||
89 | + return false; | ||
90 | + } | ||
91 | + | ||
92 | + @Override | ||
93 | + public String toString() { | ||
94 | + return MoreObjects.toStringHelper(getClass()) | ||
95 | + .add("ref", ref) | ||
96 | + .add("pathElements", pathElements) | ||
97 | + .toString(); | ||
98 | + } | ||
99 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayBackupPath.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +import java.util.Objects; | ||
19 | +import com.google.common.base.MoreObjects; | ||
20 | + | ||
21 | +/** | ||
22 | + * Represents a list of backup service paths on the underlay topology that | ||
23 | + * protect the underlay primary path. | ||
24 | + */ | ||
25 | +public class UnderlayBackupPath extends UnderlayAbstractPath { | ||
26 | + private long index; | ||
27 | + | ||
28 | + /** | ||
29 | + * Sets the index. | ||
30 | + * | ||
31 | + * @param index the index to set | ||
32 | + */ | ||
33 | + public void setIndex(long index) { | ||
34 | + this.index = index; | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Returns the index. | ||
39 | + * | ||
40 | + * @return path index | ||
41 | + */ | ||
42 | + public long index() { | ||
43 | + return index; | ||
44 | + } | ||
45 | + | ||
46 | + @Override | ||
47 | + public int hashCode() { | ||
48 | + return Objects.hash(super.hashCode(), index); | ||
49 | + } | ||
50 | + | ||
51 | + @Override | ||
52 | + public boolean equals(Object obj) { | ||
53 | + if (this == obj) { | ||
54 | + return true; | ||
55 | + } | ||
56 | + if (obj instanceof UnderlayBackupPath) { | ||
57 | + if (!super.equals(obj)) { | ||
58 | + return false; | ||
59 | + } | ||
60 | + UnderlayBackupPath that = (UnderlayBackupPath) obj; | ||
61 | + return this.index == that.index; | ||
62 | + } | ||
63 | + return false; | ||
64 | + } | ||
65 | + | ||
66 | + @Override | ||
67 | + public String toString() { | ||
68 | + return MoreObjects.toStringHelper(getClass()) | ||
69 | + .add("index", index) | ||
70 | + .add("ref", ref()) | ||
71 | + .add("pathElements", pathElements()) | ||
72 | + .toString(); | ||
73 | + } | ||
74 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPath.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +import org.onosproject.tetopology.management.api.node.TerminationPointKey; | ||
21 | + | ||
22 | +import com.google.common.base.MoreObjects; | ||
23 | +import com.google.common.base.Objects; | ||
24 | + | ||
25 | +/** | ||
26 | + * Represents the TE link underlay path data. | ||
27 | + */ | ||
28 | +public class UnderlayPath { | ||
29 | + private int protectionType; | ||
30 | + private UnderlayPrimaryPath primaryPath; | ||
31 | + private List<UnderlayBackupPath> backupPaths; | ||
32 | + private TerminationPointKey trailSrc; | ||
33 | + private TerminationPointKey trailDes; | ||
34 | + | ||
35 | + /** | ||
36 | + * Creates an instance of Underlay. | ||
37 | + */ | ||
38 | + public UnderlayPath() { | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
42 | + * Sets the protection type. | ||
43 | + * | ||
44 | + * @param protectionType the protectionType to set | ||
45 | + */ | ||
46 | + public void setProtectionType(int protectionType) { | ||
47 | + this.protectionType = protectionType; | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * Sets the primary path. | ||
52 | + * | ||
53 | + * @param primaryPath the primaryPath to set | ||
54 | + */ | ||
55 | + public void setPrimaryPath(UnderlayPrimaryPath primaryPath) { | ||
56 | + this.primaryPath = primaryPath; | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * Sets the link of backup paths. | ||
61 | + * | ||
62 | + * @param backupPaths the backupPath to set | ||
63 | + */ | ||
64 | + public void setBackupPath(List<UnderlayBackupPath> backupPaths) { | ||
65 | + this.backupPaths = backupPaths; | ||
66 | + } | ||
67 | + | ||
68 | + /** | ||
69 | + * Sets the trail source. | ||
70 | + * | ||
71 | + * @param trailSrc the trailSrc to set | ||
72 | + */ | ||
73 | + public void setTrailSrc(TerminationPointKey trailSrc) { | ||
74 | + this.trailSrc = trailSrc; | ||
75 | + } | ||
76 | + | ||
77 | + /** | ||
78 | + * Sets the trail destination. | ||
79 | + * | ||
80 | + * @param trailDes the trailDes to set | ||
81 | + */ | ||
82 | + public void setTrailDes(TerminationPointKey trailDes) { | ||
83 | + this.trailDes = trailDes; | ||
84 | + } | ||
85 | + | ||
86 | + /** | ||
87 | + * Returns the protection type. | ||
88 | + * | ||
89 | + * @return path protection type | ||
90 | + */ | ||
91 | + public int protectionType() { | ||
92 | + return protectionType; | ||
93 | + } | ||
94 | + | ||
95 | + /** | ||
96 | + * Returns the primary path. | ||
97 | + * | ||
98 | + * @return underlay primary path | ||
99 | + */ | ||
100 | + public UnderlayPrimaryPath primaryPath() { | ||
101 | + return primaryPath; | ||
102 | + } | ||
103 | + | ||
104 | + /** | ||
105 | + * Returns the backup paths. | ||
106 | + * | ||
107 | + * @return list of underlay backup paths | ||
108 | + */ | ||
109 | + public List<UnderlayBackupPath> backupPaths() { | ||
110 | + return backupPaths; | ||
111 | + } | ||
112 | + | ||
113 | + /** | ||
114 | + * Returns the trail source. | ||
115 | + * | ||
116 | + * @return trail source | ||
117 | + */ | ||
118 | + public TerminationPointKey trailSrc() { | ||
119 | + return trailSrc; | ||
120 | + } | ||
121 | + | ||
122 | + /** | ||
123 | + * Returns the trail destination. | ||
124 | + * | ||
125 | + * @return trail destination | ||
126 | + */ | ||
127 | + public TerminationPointKey trailDes() { | ||
128 | + return trailDes; | ||
129 | + } | ||
130 | + | ||
131 | + @Override | ||
132 | + public int hashCode() { | ||
133 | + return Objects.hashCode(protectionType, primaryPath, | ||
134 | + backupPaths, trailSrc, trailDes); | ||
135 | + } | ||
136 | + | ||
137 | + @Override | ||
138 | + public boolean equals(Object object) { | ||
139 | + if (this == object) { | ||
140 | + return true; | ||
141 | + } | ||
142 | + if (object instanceof UnderlayPath) { | ||
143 | + UnderlayPath that = (UnderlayPath) object; | ||
144 | + return Objects.equal(this.protectionType, that.protectionType) && | ||
145 | + Objects.equal(this.primaryPath, that.primaryPath) && | ||
146 | + Objects.equal(this.backupPaths, that.backupPaths) && | ||
147 | + Objects.equal(this.trailSrc, that.trailSrc) && | ||
148 | + Objects.equal(this.trailDes, that.trailDes); | ||
149 | + } | ||
150 | + return false; | ||
151 | + } | ||
152 | + | ||
153 | + @Override | ||
154 | + public String toString() { | ||
155 | + return MoreObjects.toStringHelper(this) | ||
156 | + .add("protectionType", protectionType) | ||
157 | + .add("primaryPath", primaryPath) | ||
158 | + .add("backupPaths", backupPaths) | ||
159 | + .add("trailSrc", trailSrc) | ||
160 | + .add("trailDes", trailDes) | ||
161 | + .toString(); | ||
162 | + } | ||
163 | + | ||
164 | +} |
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +/** | ||
19 | + * Represents the underlay primary path that supports a TE link. | ||
20 | + */ | ||
21 | +public class UnderlayPrimaryPath extends UnderlayAbstractPath { | ||
22 | +/* | ||
23 | + * Underlay primary path currently has the same data structure defined in | ||
24 | + * the underlay abstract path. It may be extended per standard definitions. | ||
25 | + */ | ||
26 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnnumberedLink.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +import java.util.Objects; | ||
19 | + | ||
20 | +import org.onlab.packet.IpAddress; | ||
21 | + | ||
22 | +import com.google.common.base.MoreObjects; | ||
23 | + | ||
24 | +/** | ||
25 | + * Implementation of unnumbered link as an ElementType. | ||
26 | + */ | ||
27 | +public class UnnumberedLink implements ElementType { | ||
28 | + private IpAddress routerId; | ||
29 | + private long interfaceId; | ||
30 | + | ||
31 | + /** | ||
32 | + * Creates an instance of UnnumberedLink. | ||
33 | + */ | ||
34 | + public UnnumberedLink() { | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Sets the router Id. | ||
39 | + * | ||
40 | + * @param routerId the routerId to set | ||
41 | + */ | ||
42 | + public void setRouterId(IpAddress routerId) { | ||
43 | + this.routerId = routerId; | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * Sets the interface Id. | ||
48 | + * | ||
49 | + * @param interfaceId the interfaceId to set | ||
50 | + */ | ||
51 | + public void setInterfaceId(long interfaceId) { | ||
52 | + this.interfaceId = interfaceId; | ||
53 | + } | ||
54 | + | ||
55 | + /** | ||
56 | + * Returns the router Id. | ||
57 | + * | ||
58 | + * @return router identifier | ||
59 | + */ | ||
60 | + public IpAddress routerId() { | ||
61 | + return routerId; | ||
62 | + } | ||
63 | + | ||
64 | + /** | ||
65 | + * Returns the interface Id. | ||
66 | + * | ||
67 | + * @return interface identifier | ||
68 | + */ | ||
69 | + public long interfaceId() { | ||
70 | + return interfaceId; | ||
71 | + } | ||
72 | + | ||
73 | + @Override | ||
74 | + public int hashCode() { | ||
75 | + return Objects.hash(routerId, interfaceId); | ||
76 | + } | ||
77 | + | ||
78 | + @Override | ||
79 | + public boolean equals(Object obj) { | ||
80 | + if (this == obj) { | ||
81 | + return true; | ||
82 | + } | ||
83 | + if (obj instanceof UnnumberedLink) { | ||
84 | + UnnumberedLink other = (UnnumberedLink) obj; | ||
85 | + return | ||
86 | + Objects.equals(routerId, other.routerId) && | ||
87 | + Objects.equals(interfaceId, other.interfaceId); | ||
88 | + } | ||
89 | + return false; | ||
90 | + } | ||
91 | + | ||
92 | + @Override | ||
93 | + public String toString() { | ||
94 | + return MoreObjects.toStringHelper(getClass()) | ||
95 | + .add("routerId", routerId) | ||
96 | + .add("interfaceId", interfaceId) | ||
97 | + .toString(); | ||
98 | + } | ||
99 | +} |
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.link; | ||
17 | + | ||
18 | +import java.math.BigDecimal; | ||
19 | + | ||
20 | +import com.google.common.base.MoreObjects; | ||
21 | +import com.google.common.base.Objects; | ||
22 | + | ||
23 | +/** | ||
24 | + * Representation of a link's unreserved bandwidth. | ||
25 | + */ | ||
26 | +public class UnreservedBandwidth { | ||
27 | + private final short priority; | ||
28 | + private final BigDecimal bandwidth; | ||
29 | + | ||
30 | + /** | ||
31 | + * Create an instance of UnreservedBandwidth. | ||
32 | + * | ||
33 | + * @param priority allocatable priority of unreserved bandwidth | ||
34 | + * @param bandwidth bandwidth | ||
35 | + */ | ||
36 | + public UnreservedBandwidth(short priority, BigDecimal bandwidth) { | ||
37 | + this.priority = priority; | ||
38 | + this.bandwidth = bandwidth; | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
42 | + * Returns the priority. | ||
43 | + * | ||
44 | + * @return the priority | ||
45 | + */ | ||
46 | + public short priority() { | ||
47 | + return priority; | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * Returns the bandwidth. | ||
52 | + * | ||
53 | + * @return the bandwidth | ||
54 | + */ | ||
55 | + public BigDecimal bandwidth() { | ||
56 | + return bandwidth; | ||
57 | + } | ||
58 | + | ||
59 | + @Override | ||
60 | + public int hashCode() { | ||
61 | + return Objects.hashCode(priority, bandwidth); | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public boolean equals(Object object) { | ||
66 | + if (this == object) { | ||
67 | + return true; | ||
68 | + } | ||
69 | + if (object instanceof UnreservedBandwidth) { | ||
70 | + UnreservedBandwidth that = (UnreservedBandwidth) object; | ||
71 | + return Objects.equal(this.priority, that.priority) && | ||
72 | + Objects.equal(this.bandwidth, that.bandwidth); | ||
73 | + } | ||
74 | + return false; | ||
75 | + } | ||
76 | + | ||
77 | + @Override | ||
78 | + public String toString() { | ||
79 | + return MoreObjects.toStringHelper(this) | ||
80 | + .add("priority", priority) | ||
81 | + .add("bandwidth", bandwidth) | ||
82 | + .toString(); | ||
83 | + } | ||
84 | + | ||
85 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/package-info.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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 | + * TE link API. | ||
18 | + */ | ||
19 | +package org.onosproject.tetopology.management.api.link; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/ConnectivityMatrix.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.node; | ||
17 | + | ||
18 | +import com.google.common.base.MoreObjects; | ||
19 | +import com.google.common.base.Objects; | ||
20 | + | ||
21 | +/** | ||
22 | + * Represents node's switching limitations. | ||
23 | + */ | ||
24 | +public class ConnectivityMatrix { | ||
25 | + private final long id; | ||
26 | + private TerminationPointKey from; | ||
27 | + private TerminationPointKey to; | ||
28 | + private boolean isAllowed; | ||
29 | + | ||
30 | + /** | ||
31 | + * Creates an instance of ConnectivityMatrix. | ||
32 | + * | ||
33 | + * @param id connectivity matrix identifier | ||
34 | + * @param from from termination point key | ||
35 | + * @param to to termination point key | ||
36 | + * @param isAllowed indicate whether this connectivity matrix is useable | ||
37 | + */ | ||
38 | + public ConnectivityMatrix(long id, TerminationPointKey from, | ||
39 | + TerminationPointKey to, boolean isAllowed) { | ||
40 | + this.id = id; | ||
41 | + this.from = from; | ||
42 | + this.to = to; | ||
43 | + this.isAllowed = isAllowed; | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * Constructor with id only. | ||
48 | + * | ||
49 | + * @param id connectivity matrix id | ||
50 | + */ | ||
51 | + public ConnectivityMatrix(long id) { | ||
52 | + this.id = id; | ||
53 | + } | ||
54 | + | ||
55 | + /** | ||
56 | + * Returns the id. | ||
57 | + * | ||
58 | + * @return connectivity matrix id | ||
59 | + */ | ||
60 | + public long id() { | ||
61 | + return id; | ||
62 | + } | ||
63 | + | ||
64 | + /** | ||
65 | + * Returns the "from" of a connectivity matrix. | ||
66 | + * | ||
67 | + * @return the "from" of a connectivity matrix | ||
68 | + */ | ||
69 | + public TerminationPointKey from() { | ||
70 | + return from; | ||
71 | + } | ||
72 | + | ||
73 | + /** | ||
74 | + * Returns the "to" of a connectivity matrix. | ||
75 | + * | ||
76 | + * @return the "to" of a connectivity matrix | ||
77 | + */ | ||
78 | + public TerminationPointKey to() { | ||
79 | + return to; | ||
80 | + } | ||
81 | + | ||
82 | + /** | ||
83 | + * Returns true if the connectivity matrix is allowed; false otherwise. | ||
84 | + * | ||
85 | + * @return true if the connectivity matrix is allowed; false otherwise | ||
86 | + */ | ||
87 | + public boolean isAllowed() { | ||
88 | + return isAllowed; | ||
89 | + } | ||
90 | + | ||
91 | + /** | ||
92 | + * Sets the from termination point. | ||
93 | + * | ||
94 | + * @param from the from to set | ||
95 | + */ | ||
96 | + public void setFrom(TerminationPointKey from) { | ||
97 | + this.from = from; | ||
98 | + } | ||
99 | + | ||
100 | + /** | ||
101 | + * Sets the to termination point. | ||
102 | + * | ||
103 | + * @param to the to to set | ||
104 | + */ | ||
105 | + public void setTo(TerminationPointKey to) { | ||
106 | + this.to = to; | ||
107 | + } | ||
108 | + | ||
109 | + /** | ||
110 | + * Sets isAllowed. | ||
111 | + * | ||
112 | + * @param isAllowed the isAllowed to set | ||
113 | + */ | ||
114 | + public void setIsAllowed(boolean isAllowed) { | ||
115 | + this.isAllowed = isAllowed; | ||
116 | + } | ||
117 | + | ||
118 | + @Override | ||
119 | + public int hashCode() { | ||
120 | + return Objects.hashCode(id, from, to, isAllowed); | ||
121 | + } | ||
122 | + | ||
123 | + @Override | ||
124 | + public boolean equals(Object object) { | ||
125 | + if (this == object) { | ||
126 | + return true; | ||
127 | + } | ||
128 | + if (object instanceof ConnectivityMatrix) { | ||
129 | + ConnectivityMatrix that = (ConnectivityMatrix) object; | ||
130 | + return Objects.equal(this.id, that.id) && | ||
131 | + Objects.equal(this.from, that.from) && | ||
132 | + Objects.equal(this.to, that.to) && | ||
133 | + Objects.equal(this.isAllowed, that.isAllowed); | ||
134 | + } | ||
135 | + return false; | ||
136 | + } | ||
137 | + | ||
138 | + @Override | ||
139 | + public String toString() { | ||
140 | + return MoreObjects.toStringHelper(this) | ||
141 | + .add("id", id) | ||
142 | + .add("from", from) | ||
143 | + .add("to", to) | ||
144 | + .add("isAllowed", isAllowed) | ||
145 | + .toString(); | ||
146 | + } | ||
147 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/DefaultNetworkNode.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.node; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +import org.onosproject.tetopology.management.api.KeyId; | ||
21 | + | ||
22 | +import com.google.common.base.MoreObjects; | ||
23 | +import com.google.common.base.Objects; | ||
24 | + | ||
25 | +/** | ||
26 | + * NetworkNode implementation. | ||
27 | + * <p> | ||
28 | + * The Set/Get methods below are defined to accept and pass references because | ||
29 | + * the object class is treated as a "composite" object class that holds | ||
30 | + * references to various member objects and their relationships, forming a | ||
31 | + * data tree. Internal routines of the TE topology manager may use the | ||
32 | + * following example methods to construct and manipulate any piece of data in | ||
33 | + * the data tree: | ||
34 | + *<pre> | ||
35 | + * newNode.getTe().setAdminStatus(), or | ||
36 | + * newNode.getSupportingNodeIds().add(nodeId), etc. | ||
37 | + *</pre> | ||
38 | + * Same for constructors where, for example, a child list may be constructed | ||
39 | + * first and passed in by reference to its parent object constructor. | ||
40 | + */ | ||
41 | +public class DefaultNetworkNode implements NetworkNode { | ||
42 | + private final KeyId id; | ||
43 | + private List<NetworkNodeKey> supportingNodeIds; | ||
44 | + private TeNode te; | ||
45 | + private List<TerminationPoint> tps; | ||
46 | + | ||
47 | + /** | ||
48 | + * Creates an instance of DefaultNetworkNode using Id. | ||
49 | + * | ||
50 | + * @param id network node identifier | ||
51 | + */ | ||
52 | + public DefaultNetworkNode(KeyId id) { | ||
53 | + this.id = id; | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * Creates an instance of DefaultNetworkNode. | ||
58 | + * | ||
59 | + * @param id network node identifier | ||
60 | + * @param nodeIds support node identifiers | ||
61 | + * @param te te parameter of the node | ||
62 | + */ | ||
63 | + public DefaultNetworkNode(KeyId id, List<NetworkNodeKey> nodeIds, TeNode te) { | ||
64 | + this.id = id; | ||
65 | + this.supportingNodeIds = nodeIds; | ||
66 | + this.te = te; | ||
67 | + } | ||
68 | + | ||
69 | + /** | ||
70 | + * Sets the list of supporting node ids. | ||
71 | + * | ||
72 | + * @param ids the supporting node ids to set | ||
73 | + */ | ||
74 | + public void setSupportingNodeIds(List<NetworkNodeKey> ids) { | ||
75 | + this.supportingNodeIds = ids; | ||
76 | + } | ||
77 | + | ||
78 | + /** | ||
79 | + * Sets the te attribute. | ||
80 | + * | ||
81 | + * @param te the te to set | ||
82 | + */ | ||
83 | + public void setTe(TeNode te) { | ||
84 | + this.te = te; | ||
85 | + } | ||
86 | + | ||
87 | + /** | ||
88 | + * Sets the TerminationPoints. | ||
89 | + * | ||
90 | + * @param tps the tps to set | ||
91 | + */ | ||
92 | + public void setTerminationPoints(List<TerminationPoint> tps) { | ||
93 | + this.tps = tps; | ||
94 | + } | ||
95 | + | ||
96 | + /** | ||
97 | + * Returns the node identifier. | ||
98 | + * | ||
99 | + * @return node identifier | ||
100 | + */ | ||
101 | + @Override | ||
102 | + public KeyId nodeId() { | ||
103 | + return id; | ||
104 | + } | ||
105 | + | ||
106 | + /** | ||
107 | + * Returns the supportingNodeIds. | ||
108 | + * | ||
109 | + * @return list of supporting node identifiers for this node | ||
110 | + */ | ||
111 | + @Override | ||
112 | + public List<NetworkNodeKey> getSupportingNodeIds() { | ||
113 | + return supportingNodeIds; | ||
114 | + } | ||
115 | + | ||
116 | + /** | ||
117 | + * Returns the te attribute value. | ||
118 | + * | ||
119 | + * @return TE attributes of this node | ||
120 | + */ | ||
121 | + @Override | ||
122 | + public TeNode getTe() { | ||
123 | + return te; | ||
124 | + } | ||
125 | + | ||
126 | + /** | ||
127 | + * Returns the list of termination points. | ||
128 | + * | ||
129 | + * @return a list of termination points associated with this node | ||
130 | + */ | ||
131 | + @Override | ||
132 | + public List<TerminationPoint> getTerminationPoints() { | ||
133 | + return tps; | ||
134 | + } | ||
135 | + | ||
136 | + /** | ||
137 | + * Returns the termination point. | ||
138 | + * | ||
139 | + * @return the termination point | ||
140 | + */ | ||
141 | + @Override | ||
142 | + public TerminationPoint getTerminationPoint(KeyId tpId) { | ||
143 | + | ||
144 | + for (TerminationPoint tp : tps) { | ||
145 | + if (tp.id().equals(tpId)) { | ||
146 | + return tp; | ||
147 | + } | ||
148 | + } | ||
149 | + | ||
150 | + return null; | ||
151 | + } | ||
152 | + | ||
153 | + @Override | ||
154 | + public int hashCode() { | ||
155 | + return Objects.hashCode(id, supportingNodeIds, te, tps); | ||
156 | + } | ||
157 | + | ||
158 | + @Override | ||
159 | + public boolean equals(Object object) { | ||
160 | + if (this == object) { | ||
161 | + return true; | ||
162 | + } | ||
163 | + if (object instanceof DefaultNetworkNode) { | ||
164 | + DefaultNetworkNode that = (DefaultNetworkNode) object; | ||
165 | + return Objects.equal(this.id, that.id) && | ||
166 | + Objects.equal(this.supportingNodeIds, that.supportingNodeIds) && | ||
167 | + Objects.equal(this.te, that.te) && | ||
168 | + Objects.equal(this.tps, that.tps); | ||
169 | + } | ||
170 | + return false; | ||
171 | + } | ||
172 | + | ||
173 | + @Override | ||
174 | + public String toString() { | ||
175 | + return MoreObjects.toStringHelper(this) | ||
176 | + .add("id", id) | ||
177 | + .add("supportingNodeIds", supportingNodeIds) | ||
178 | + .add("te", te) | ||
179 | + .add("tps", tps) | ||
180 | + .toString(); | ||
181 | + } | ||
182 | + | ||
183 | +} |
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.node; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +import org.onosproject.tetopology.management.api.KeyId; | ||
21 | + | ||
22 | +import com.google.common.base.MoreObjects; | ||
23 | +import com.google.common.base.Objects; | ||
24 | + | ||
25 | +/** | ||
26 | + * Represent a termination point. | ||
27 | + * <p> | ||
28 | + * The Set/Get methods below are defined to accept and pass references because | ||
29 | + * the object class is treated as a "composite" object class that holds | ||
30 | + * references to various member objects and their relationships, forming a | ||
31 | + * data tree. Internal routines of the TE topology manager may use the | ||
32 | + * following example methods to construct and manipulate any piece of data in | ||
33 | + * the data tree: | ||
34 | + *<pre> | ||
35 | + * newNode.getTe().setAdminStatus(), or | ||
36 | + * newNode.getSupportingNodeIds().add(nodeId), etc. | ||
37 | + *</pre> | ||
38 | + * Same for constructors where, for example, a child list may be constructed | ||
39 | + * first and passed in by reference to its parent object constructor. | ||
40 | + */ | ||
41 | +public class DefaultTerminationPoint implements TerminationPoint { | ||
42 | + private KeyId id; | ||
43 | + private List<TerminationPointKey> supportingTpIds; | ||
44 | + private TeTerminationPoint te; | ||
45 | + | ||
46 | + /** | ||
47 | + * Creates an instance of DefaultTerminationPoint. | ||
48 | + * | ||
49 | + * @param id termination point identifier | ||
50 | + * @param tps support termination point identifier | ||
51 | + * @param te te parameters of the terminiation point | ||
52 | + */ | ||
53 | + public DefaultTerminationPoint(KeyId id, List<TerminationPointKey> tps, | ||
54 | + TeTerminationPoint te) { | ||
55 | + this.id = id; | ||
56 | + this.supportingTpIds = tps; | ||
57 | + this.te = te; | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * Creates an instance of DefaultTerminationPoint with teTpId only. | ||
62 | + * | ||
63 | + * @param id termination point identifier | ||
64 | + */ | ||
65 | + public DefaultTerminationPoint(KeyId id) { | ||
66 | + this.id = id; | ||
67 | + } | ||
68 | + | ||
69 | + @Override | ||
70 | + public KeyId id() { | ||
71 | + return id; | ||
72 | + } | ||
73 | + | ||
74 | + @Override | ||
75 | + public List<TerminationPointKey> getSupportingTpIds() { | ||
76 | + return supportingTpIds; | ||
77 | + } | ||
78 | + | ||
79 | + @Override | ||
80 | + public TeTerminationPoint getTe() { | ||
81 | + return te; | ||
82 | + } | ||
83 | + | ||
84 | + /** | ||
85 | + * Sets the Id. | ||
86 | + * | ||
87 | + * @param id the id to set | ||
88 | + */ | ||
89 | + public void setId(KeyId id) { | ||
90 | + this.id = id; | ||
91 | + } | ||
92 | + | ||
93 | + /** | ||
94 | + * Sets the supportingTpIds. | ||
95 | + * | ||
96 | + * @param tps the supportingTpIds to set | ||
97 | + */ | ||
98 | + public void setSupportingTpIds(List<TerminationPointKey> tps) { | ||
99 | + this.supportingTpIds = tps; | ||
100 | + } | ||
101 | + | ||
102 | + /** | ||
103 | + * Sets the te extension. | ||
104 | + * | ||
105 | + * @param te the te to set | ||
106 | + */ | ||
107 | + public void setTe(TeTerminationPoint te) { | ||
108 | + this.te = te; | ||
109 | + } | ||
110 | + | ||
111 | + @Override | ||
112 | + public int hashCode() { | ||
113 | + return Objects.hashCode(id, supportingTpIds, te); | ||
114 | + } | ||
115 | + | ||
116 | + @Override | ||
117 | + public boolean equals(Object object) { | ||
118 | + if (this == object) { | ||
119 | + return true; | ||
120 | + } | ||
121 | + if (object instanceof DefaultTerminationPoint) { | ||
122 | + DefaultTerminationPoint that = (DefaultTerminationPoint) object; | ||
123 | + return Objects.equal(this.id, that.id) && | ||
124 | + Objects.equal(this.supportingTpIds, that.supportingTpIds) && | ||
125 | + Objects.equal(this.te, that.te); | ||
126 | + } | ||
127 | + return false; | ||
128 | + } | ||
129 | + | ||
130 | + @Override | ||
131 | + public String toString() { | ||
132 | + return MoreObjects.toStringHelper(this) | ||
133 | + .add("id", id) | ||
134 | + .add("supportingTpIds", supportingTpIds) | ||
135 | + .add("te", te) | ||
136 | + .toString(); | ||
137 | + } | ||
138 | + | ||
139 | +} |
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.node; | ||
17 | + | ||
18 | +/** | ||
19 | + * Interface switching capability representation. | ||
20 | + */ | ||
21 | +public class InterfaceSwitchingCapability { | ||
22 | + // Should include switching capability, lsp encoding, max_lsp-bandwidth | ||
23 | + | ||
24 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/NetworkNode.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.node; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +import org.onosproject.tetopology.management.api.KeyId; | ||
21 | +import org.onosproject.tetopology.management.api.TeTopologyEventSubject; | ||
22 | + | ||
23 | +/** | ||
24 | + * Abstraction of a network node. | ||
25 | + */ | ||
26 | +public interface NetworkNode extends TeTopologyEventSubject { | ||
27 | + | ||
28 | + /** | ||
29 | + * Returns the node id. | ||
30 | + * | ||
31 | + * @return node identifier | ||
32 | + */ | ||
33 | + KeyId nodeId(); | ||
34 | + | ||
35 | + /** | ||
36 | + * Returns the supporting node ids. | ||
37 | + * | ||
38 | + * @return list of the ids of the supporting nodes | ||
39 | + */ | ||
40 | + List<NetworkNodeKey> getSupportingNodeIds(); | ||
41 | + | ||
42 | + /** | ||
43 | + * Returns the node TE extension attributes. | ||
44 | + * | ||
45 | + * @return node TE extension attributes | ||
46 | + */ | ||
47 | + TeNode getTe(); | ||
48 | + | ||
49 | + /** | ||
50 | + * Returns a collection of currently known termination points. | ||
51 | + * | ||
52 | + * @return a collection of termination points associated with this node | ||
53 | + */ | ||
54 | + List<TerminationPoint> getTerminationPoints(); | ||
55 | + | ||
56 | + /** | ||
57 | + * Returns the termination point. | ||
58 | + * | ||
59 | + * @param tpId termination point id | ||
60 | + * @return value of termination point | ||
61 | + */ | ||
62 | + TerminationPoint getTerminationPoint(KeyId tpId); | ||
63 | + | ||
64 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/NetworkNodeKey.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.node; | ||
17 | + | ||
18 | +import org.onosproject.tetopology.management.api.KeyId; | ||
19 | + | ||
20 | +import com.google.common.base.MoreObjects; | ||
21 | +import com.google.common.base.Objects; | ||
22 | + | ||
23 | +/** | ||
24 | + * Representation of a node key or node reference. | ||
25 | + */ | ||
26 | +public class NetworkNodeKey { | ||
27 | + private final KeyId networkId; | ||
28 | + private final KeyId nodeId; | ||
29 | + | ||
30 | + /** | ||
31 | + * Creates an instance of NetworkNodeKey. | ||
32 | + * | ||
33 | + * @param networkId network identifier | ||
34 | + * @param nodeId node identifier | ||
35 | + */ | ||
36 | + public NetworkNodeKey(KeyId networkId, KeyId nodeId) { | ||
37 | + this.networkId = networkId; | ||
38 | + this.nodeId = nodeId; | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
42 | + * Returns the network identifier. | ||
43 | + * | ||
44 | + * @return network identifier | ||
45 | + */ | ||
46 | + public KeyId networkId() { | ||
47 | + return networkId; | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * Returns the node identifier. | ||
52 | + * | ||
53 | + * @return node identifier | ||
54 | + */ | ||
55 | + public KeyId nodeId() { | ||
56 | + return nodeId; | ||
57 | + } | ||
58 | + | ||
59 | + @Override | ||
60 | + public int hashCode() { | ||
61 | + return Objects.hashCode(networkId, nodeId); | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public boolean equals(Object object) { | ||
66 | + if (this == object) { | ||
67 | + return true; | ||
68 | + } | ||
69 | + if (object instanceof NetworkNodeKey) { | ||
70 | + NetworkNodeKey that = (NetworkNodeKey) object; | ||
71 | + return Objects.equal(this.networkId, that.networkId) && | ||
72 | + Objects.equal(this.nodeId, that.nodeId); | ||
73 | + } | ||
74 | + return false; | ||
75 | + } | ||
76 | + | ||
77 | + @Override | ||
78 | + public String toString() { | ||
79 | + return MoreObjects.toStringHelper(this) | ||
80 | + .add("networkId", networkId) | ||
81 | + .add("nodeId", nodeId) | ||
82 | + .toString(); | ||
83 | + } | ||
84 | + | ||
85 | +} |
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.node; | ||
17 | + | ||
18 | +import org.onosproject.tetopology.management.api.KeyId; | ||
19 | +import org.onosproject.tetopology.management.api.TeTopologyId; | ||
20 | + | ||
21 | +import com.google.common.base.MoreObjects; | ||
22 | +import com.google.common.base.Objects; | ||
23 | + | ||
24 | +/** | ||
25 | + * TE Network Topology identifiers. | ||
26 | + */ | ||
27 | +public class TeNetworkTopologyId { | ||
28 | + private final KeyId networkId; | ||
29 | + private final TeTopologyId topologyId; | ||
30 | + | ||
31 | + /** | ||
32 | + * Creates an instance of TeNetworkTopologyId. | ||
33 | + * | ||
34 | + * @param networkId network identifier | ||
35 | + * @param topologyId topology identifier | ||
36 | + */ | ||
37 | + public TeNetworkTopologyId(KeyId networkId, TeTopologyId topologyId) { | ||
38 | + this.networkId = networkId; | ||
39 | + this.topologyId = topologyId; | ||
40 | + } | ||
41 | + | ||
42 | + /** | ||
43 | + * Creates TeNetworkTopologyId with networkId. | ||
44 | + * | ||
45 | + * @param networkId network identifier | ||
46 | + */ | ||
47 | + public TeNetworkTopologyId(KeyId networkId) { | ||
48 | + this.networkId = networkId; | ||
49 | + this.topologyId = null; | ||
50 | + } | ||
51 | + | ||
52 | + /** | ||
53 | + * Creates TeNetworkTopologyId with topologyId. | ||
54 | + * | ||
55 | + * @param topologyId topology identifier | ||
56 | + */ | ||
57 | + public TeNetworkTopologyId(TeTopologyId topologyId) { | ||
58 | + this.networkId = null; | ||
59 | + this.topologyId = topologyId; | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * Returns the network identifier. | ||
64 | + * | ||
65 | + * @return network id | ||
66 | + */ | ||
67 | + public KeyId getNetworkId() { | ||
68 | + return networkId; | ||
69 | + } | ||
70 | + | ||
71 | + /** | ||
72 | + * Returns the topology identifier. | ||
73 | + * | ||
74 | + * @return TE topology id | ||
75 | + */ | ||
76 | + public TeTopologyId getTopologyId() { | ||
77 | + return topologyId; | ||
78 | + } | ||
79 | + | ||
80 | + @Override | ||
81 | + public int hashCode() { | ||
82 | + return Objects.hashCode(networkId, topologyId); | ||
83 | + } | ||
84 | + | ||
85 | + @Override | ||
86 | + public boolean equals(Object object) { | ||
87 | + if (this == object) { | ||
88 | + return true; | ||
89 | + } | ||
90 | + if (object instanceof TeNetworkTopologyId) { | ||
91 | + TeNetworkTopologyId that = (TeNetworkTopologyId) object; | ||
92 | + return Objects.equal(this.networkId, that.networkId) && | ||
93 | + Objects.equal(this.topologyId, that.topologyId); | ||
94 | + } | ||
95 | + return false; | ||
96 | + } | ||
97 | + | ||
98 | + @Override | ||
99 | + public String toString() { | ||
100 | + return MoreObjects.toStringHelper(this) | ||
101 | + .add("networkId", networkId) | ||
102 | + .add("topologyId", topologyId) | ||
103 | + .toString(); | ||
104 | + } | ||
105 | + | ||
106 | +} |
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.node; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +import com.google.common.base.MoreObjects; | ||
21 | +import com.google.common.base.Objects; | ||
22 | + | ||
23 | +/** | ||
24 | + * TE Node representation. | ||
25 | + * <p> | ||
26 | + * The Set/Get methods below are defined to accept and pass references because | ||
27 | + * the object class is treated as a "composite" object class that holds | ||
28 | + * references to various member objects and their relationships, forming a | ||
29 | + * data tree. Internal routines of the TE topology manager may use the | ||
30 | + * following example methods to construct and manipulate any piece of data in | ||
31 | + * the data tree: | ||
32 | + * <pre> | ||
33 | + * newNode.getTe().setAdminStatus(), or | ||
34 | + * newNode.getSupportingNodeIds().add(nodeId), etc. | ||
35 | + * </pre> | ||
36 | + * Same for constructors where, for example, a child list may be constructed | ||
37 | + * first and passed in by reference to its parent object constructor. | ||
38 | + */ | ||
39 | +public class TeNode { | ||
40 | + // See org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te. | ||
41 | + // topology.rev20160708.ietftetopology | ||
42 | + // .augmentednwnode.te.config.DefaultTeNodeAttributes for reference | ||
43 | + private String teNodeId; | ||
44 | + private String name; | ||
45 | + private TeStatus adminStatus; | ||
46 | + private TeStatus opStatus; | ||
47 | + private boolean isAbstract; | ||
48 | + private List<ConnectivityMatrix> connMatrices; | ||
49 | + private TeNetworkTopologyId underlayTopology; | ||
50 | + private List<TunnelTerminationPoint> tunnelTerminationPoints; | ||
51 | + | ||
52 | + /** | ||
53 | + * Creates an instance of TeNode. | ||
54 | + * | ||
55 | + * @param teNodeId TE node identifier | ||
56 | + */ | ||
57 | + public TeNode(String teNodeId) { | ||
58 | + this.teNodeId = teNodeId; | ||
59 | + } | ||
60 | + | ||
61 | + /** | ||
62 | + * Sets the node name. | ||
63 | + * | ||
64 | + * @param name the name to set | ||
65 | + */ | ||
66 | + public void setName(String name) { | ||
67 | + this.name = name; | ||
68 | + } | ||
69 | + | ||
70 | + /** | ||
71 | + * Sets the node administrative status. | ||
72 | + * | ||
73 | + * @param adminStatus the adminStatus to set | ||
74 | + */ | ||
75 | + public void setAdminStatus(TeStatus adminStatus) { | ||
76 | + this.adminStatus = adminStatus; | ||
77 | + } | ||
78 | + | ||
79 | + /** | ||
80 | + * Sets the node operational status. | ||
81 | + * | ||
82 | + * @param opStatus the opStatus to set | ||
83 | + */ | ||
84 | + public void setOpStatus(TeStatus opStatus) { | ||
85 | + this.opStatus = opStatus; | ||
86 | + } | ||
87 | + | ||
88 | + /** | ||
89 | + * Sets the node is an abstract node or not. | ||
90 | + * | ||
91 | + * @param isAbstract the isAbstract to set | ||
92 | + */ | ||
93 | + public void setAbstract(boolean isAbstract) { | ||
94 | + this.isAbstract = isAbstract; | ||
95 | + } | ||
96 | + | ||
97 | + /** | ||
98 | + * Set connectivity matrix table. | ||
99 | + * | ||
100 | + * @param connMatrices connectivity matrix table | ||
101 | + */ | ||
102 | + public void setConnectivityMatrices(List<ConnectivityMatrix> connMatrices) { | ||
103 | + this.connMatrices = connMatrices; | ||
104 | + } | ||
105 | + | ||
106 | + /** | ||
107 | + * Sets the node underlay TE topology. | ||
108 | + * | ||
109 | + * @param topo the underlayTopology to set | ||
110 | + */ | ||
111 | + public void setUnderlayTopology(TeNetworkTopologyId topo) { | ||
112 | + this.underlayTopology = topo; | ||
113 | + } | ||
114 | + | ||
115 | + /** | ||
116 | + * Sets the list of tunnel termination points. | ||
117 | + * | ||
118 | + * @param ttps the tunnelTerminationPoints to set | ||
119 | + */ | ||
120 | + public void setTunnelTerminationPoints(List<TunnelTerminationPoint> ttps) { | ||
121 | + this.tunnelTerminationPoints = ttps; | ||
122 | + } | ||
123 | + | ||
124 | + /** | ||
125 | + * Returns the teNodeId. | ||
126 | + * | ||
127 | + * @return TE node id | ||
128 | + */ | ||
129 | + public String teNodeId() { | ||
130 | + return teNodeId; | ||
131 | + } | ||
132 | + | ||
133 | + /** | ||
134 | + * Returns the name. | ||
135 | + * | ||
136 | + * @return TE node name | ||
137 | + */ | ||
138 | + public String name() { | ||
139 | + return name; | ||
140 | + } | ||
141 | + | ||
142 | + /** | ||
143 | + * Returns the adminStatus. | ||
144 | + * | ||
145 | + * @return TE node admin status | ||
146 | + */ | ||
147 | + public TeStatus adminStatus() { | ||
148 | + return adminStatus; | ||
149 | + } | ||
150 | + | ||
151 | + /** | ||
152 | + * Returns the opStatus. | ||
153 | + * | ||
154 | + * @return TE node operational status | ||
155 | + */ | ||
156 | + public TeStatus opStatus() { | ||
157 | + return opStatus; | ||
158 | + } | ||
159 | + | ||
160 | + /** | ||
161 | + * Returns the isAbstract. | ||
162 | + * | ||
163 | + * @return true or false if the TE node is abstract | ||
164 | + */ | ||
165 | + public boolean isAbstract() { | ||
166 | + return isAbstract; | ||
167 | + } | ||
168 | + | ||
169 | + /** | ||
170 | + * Returns the connectivity matrix table. | ||
171 | + * | ||
172 | + * @return node connectivity matrix table | ||
173 | + */ | ||
174 | + public List<ConnectivityMatrix> connectivityMatrices() { | ||
175 | + return connMatrices; | ||
176 | + } | ||
177 | + | ||
178 | + /** | ||
179 | + * Returns the underlay topology. | ||
180 | + * | ||
181 | + * @return node underlay topology | ||
182 | + */ | ||
183 | + public TeNetworkTopologyId underlayTopology() { | ||
184 | + return underlayTopology; | ||
185 | + } | ||
186 | + | ||
187 | + /** | ||
188 | + * Returns the tunnelTerminationPoints. | ||
189 | + * | ||
190 | + * @return list of tunnel terminational points | ||
191 | + */ | ||
192 | + public List<TunnelTerminationPoint> tunnelTerminationPoints() { | ||
193 | + return tunnelTerminationPoints; | ||
194 | + } | ||
195 | + | ||
196 | + @Override | ||
197 | + public int hashCode() { | ||
198 | + return Objects.hashCode(teNodeId, name, adminStatus, opStatus, isAbstract, | ||
199 | + connMatrices, underlayTopology, tunnelTerminationPoints); | ||
200 | + } | ||
201 | + | ||
202 | + @Override | ||
203 | + public boolean equals(Object object) { | ||
204 | + if (this == object) { | ||
205 | + return true; | ||
206 | + } | ||
207 | + if (object instanceof TeNode) { | ||
208 | + TeNode that = (TeNode) object; | ||
209 | + return Objects.equal(this.teNodeId, that.teNodeId) && | ||
210 | + Objects.equal(this.name, that.name) && | ||
211 | + Objects.equal(this.adminStatus, that.adminStatus) && | ||
212 | + Objects.equal(this.opStatus, that.opStatus) && | ||
213 | + Objects.equal(this.isAbstract, that.isAbstract) && | ||
214 | + Objects.equal(this.connMatrices, that.connMatrices) && | ||
215 | + Objects.equal(this.underlayTopology, that.underlayTopology) && | ||
216 | + Objects.equal(this.tunnelTerminationPoints, that.tunnelTerminationPoints); | ||
217 | + } | ||
218 | + return false; | ||
219 | + } | ||
220 | + | ||
221 | + @Override | ||
222 | + public String toString() { | ||
223 | + return MoreObjects.toStringHelper(this) | ||
224 | + .add("teNodeId", teNodeId) | ||
225 | + .add("name", name) | ||
226 | + .add("adminStatus", adminStatus) | ||
227 | + .add("opStatus", opStatus) | ||
228 | + .add("isAbstract", isAbstract) | ||
229 | + .add("connMatrices", connMatrices) | ||
230 | + .add("underlayTopology", underlayTopology) | ||
231 | + .add("tunnelTerminationPoints", tunnelTerminationPoints) | ||
232 | + .toString(); | ||
233 | + } | ||
234 | + | ||
235 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TeStatus.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016-present 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.tetopology.management.api.node; | ||
18 | + | ||
19 | +/** | ||
20 | + * Represents ENUM data of teStatus. | ||
21 | + */ | ||
22 | +public enum TeStatus { | ||
23 | + | ||
24 | + /** | ||
25 | + * Represents up. | ||
26 | + */ | ||
27 | + UP(0), | ||
28 | + | ||
29 | + /** | ||
30 | + * Represents down. | ||
31 | + */ | ||
32 | + DOWN(1), | ||
33 | + | ||
34 | + /** | ||
35 | + * Represents testing. | ||
36 | + */ | ||
37 | + TESTING(2), | ||
38 | + | ||
39 | + /** | ||
40 | + * Represents preparingMaintenance. | ||
41 | + */ | ||
42 | + PREPARING_MAINTENANCE(3), | ||
43 | + | ||
44 | + /** | ||
45 | + * Represents maintenance. | ||
46 | + */ | ||
47 | + MAINTENANCE(4), | ||
48 | + | ||
49 | + /** | ||
50 | + * Status cannot be determined for some reason. | ||
51 | + */ | ||
52 | + UNKNOWN(5); | ||
53 | + | ||
54 | + private int teStatus; | ||
55 | + | ||
56 | + /** | ||
57 | + * Creates an instance of teStatus. | ||
58 | + * | ||
59 | + * @param value value of teStatus | ||
60 | + */ | ||
61 | + TeStatus(int value) { | ||
62 | + teStatus = value; | ||
63 | + } | ||
64 | + | ||
65 | + /** | ||
66 | + * Returns the attribute teStatus. | ||
67 | + * | ||
68 | + * @return value of teStatus | ||
69 | + */ | ||
70 | + public int teStatus() { | ||
71 | + return teStatus; | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * Returns the object of teStatus fromString input String. Returns null | ||
76 | + * when the integer value is not recognized. | ||
77 | + * | ||
78 | + * @param valInString input String | ||
79 | + * @return Object of teStatus | ||
80 | + */ | ||
81 | + public static TeStatus of(String valInString) { | ||
82 | + try { | ||
83 | + int tmpVal = Integer.parseInt(valInString); | ||
84 | + return of(tmpVal); | ||
85 | + } catch (NumberFormatException e) { | ||
86 | + } | ||
87 | + return null; | ||
88 | + } | ||
89 | + | ||
90 | + /** | ||
91 | + * Returns the object of teAdminStatusEnumForTypeInt.Returns null | ||
92 | + * when string conversion fails or converted integer value is not | ||
93 | + * recognized. | ||
94 | + * | ||
95 | + * @param value value of teAdminStatusEnumForTypeInt | ||
96 | + * @return Object of teAdminStatusEnumForTypeInt | ||
97 | + */ | ||
98 | + public static TeStatus of(int value) { | ||
99 | + switch (value) { | ||
100 | + case 0: | ||
101 | + return TeStatus.UP; | ||
102 | + case 1: | ||
103 | + return TeStatus.DOWN; | ||
104 | + case 2: | ||
105 | + return TeStatus.TESTING; | ||
106 | + case 3: | ||
107 | + return TeStatus.PREPARING_MAINTENANCE; | ||
108 | + case 4: | ||
109 | + return TeStatus.MAINTENANCE; | ||
110 | + case 5: | ||
111 | + return TeStatus.UNKNOWN; | ||
112 | + default : | ||
113 | + return null; | ||
114 | + } | ||
115 | + } | ||
116 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TeTerminationPoint.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.node; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +import org.onosproject.tetopology.management.api.KeyId; | ||
21 | + | ||
22 | +import com.google.common.base.MoreObjects; | ||
23 | +import com.google.common.base.Objects; | ||
24 | + | ||
25 | +/** | ||
26 | + * TE termination point representation. | ||
27 | + */ | ||
28 | +public class TeTerminationPoint { | ||
29 | + private KeyId teTpId; | ||
30 | + private List<InterfaceSwitchingCapability> capabilities; | ||
31 | + private long interLayerLockId; | ||
32 | + | ||
33 | + /** | ||
34 | + * Creates an instance of TeTerminationPoint. | ||
35 | + * | ||
36 | + * @param teTpId TE termination point identifier | ||
37 | + * @param capabilities capability descriptor for termination point | ||
38 | + * @param interLayerLockId inter-layer lock identifier | ||
39 | + */ | ||
40 | + public TeTerminationPoint(KeyId teTpId, | ||
41 | + List<InterfaceSwitchingCapability> capabilities, long interLayerLockId) { | ||
42 | + this.teTpId = teTpId; | ||
43 | + this.capabilities = capabilities; | ||
44 | + this.interLayerLockId = interLayerLockId; | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * Creates an instance of TeTerminationPoint with teTpId only. | ||
49 | + * | ||
50 | + * @param teTpId TE termination point id | ||
51 | + */ | ||
52 | + public TeTerminationPoint(KeyId teTpId) { | ||
53 | + this.teTpId = teTpId; | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * Returns the TE termination point id. | ||
58 | + * | ||
59 | + * @return value of teTpId | ||
60 | + */ | ||
61 | + public KeyId teTpId() { | ||
62 | + return teTpId; | ||
63 | + } | ||
64 | + | ||
65 | + /** | ||
66 | + * Returns the interface switching capabilities. | ||
67 | + * | ||
68 | + * @return interface switching capabilities | ||
69 | + */ | ||
70 | + public List<InterfaceSwitchingCapability> interfaceSwitchingCapabilities() { | ||
71 | + return capabilities; | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * Returns the interLayerLockId. | ||
76 | + * | ||
77 | + * @return interlayer lock id | ||
78 | + */ | ||
79 | + public long getInterLayerLockId() { | ||
80 | + return interLayerLockId; | ||
81 | + } | ||
82 | + | ||
83 | + /** | ||
84 | + * Sets the te tp Id. | ||
85 | + * | ||
86 | + * @param teTpId the teTpId to set | ||
87 | + */ | ||
88 | + public void setTeTpId(KeyId teTpId) { | ||
89 | + this.teTpId = teTpId; | ||
90 | + } | ||
91 | + | ||
92 | + /** | ||
93 | + * Sets the interface switching capabilities. | ||
94 | + * | ||
95 | + * @param capabilities the capabilities to set | ||
96 | + */ | ||
97 | + public void setInterfaceSwitchingCapabilities(List<InterfaceSwitchingCapability> capabilities) { | ||
98 | + this.capabilities = capabilities; | ||
99 | + } | ||
100 | + | ||
101 | + /** | ||
102 | + * Sets the inter layer lockId. | ||
103 | + * | ||
104 | + * @param interLayerLockId the interLayerLockId to set | ||
105 | + */ | ||
106 | + public void setInterLayerLockId(long interLayerLockId) { | ||
107 | + this.interLayerLockId = interLayerLockId; | ||
108 | + } | ||
109 | + | ||
110 | + @Override | ||
111 | + public int hashCode() { | ||
112 | + return Objects.hashCode(teTpId, capabilities, interLayerLockId); | ||
113 | + } | ||
114 | + | ||
115 | + @Override | ||
116 | + public boolean equals(Object object) { | ||
117 | + if (this == object) { | ||
118 | + return true; | ||
119 | + } | ||
120 | + if (object instanceof TeTerminationPoint) { | ||
121 | + TeTerminationPoint that = (TeTerminationPoint) object; | ||
122 | + return Objects.equal(this.teTpId, that.teTpId) && | ||
123 | + Objects.equal(this.capabilities, that.capabilities) && | ||
124 | + Objects.equal(this.interLayerLockId, that.interLayerLockId); | ||
125 | + } | ||
126 | + return false; | ||
127 | + } | ||
128 | + | ||
129 | + @Override | ||
130 | + public String toString() { | ||
131 | + return MoreObjects.toStringHelper(this) | ||
132 | + .add("teTpId", teTpId) | ||
133 | + .add("capabilities", capabilities) | ||
134 | + .add("interLayerLockId", interLayerLockId) | ||
135 | + .toString(); | ||
136 | + } | ||
137 | + | ||
138 | +} |
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.node; | ||
17 | + | ||
18 | +/** | ||
19 | + * The termination capabilities between tunnel-termination-point | ||
20 | + * and link termination-point. | ||
21 | + */ | ||
22 | +public class TerminationCapability { | ||
23 | + // See reference - org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang | ||
24 | + // .ietf.te.topology.rev20160708.ietftetopology.augmentednwnode.te | ||
25 | + //.tunnelterminationpoint.config.DefaultTerminationCapability | ||
26 | + private TerminationPointKey linkTpId; | ||
27 | + //List<MaxLspBandwidth> maxLspBandwidth | ||
28 | + // TODO - to be extended per future standard definitions | ||
29 | + | ||
30 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TerminationPoint.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.node; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +import org.onosproject.tetopology.management.api.KeyId; | ||
21 | +import org.onosproject.tetopology.management.api.TeTopologyEventSubject; | ||
22 | + | ||
23 | +/** | ||
24 | + * Abstraction of a termination point. | ||
25 | + */ | ||
26 | +public interface TerminationPoint extends TeTopologyEventSubject { | ||
27 | + | ||
28 | + /** | ||
29 | + * Returns the termination point id. | ||
30 | + * | ||
31 | + * @return termination point id | ||
32 | + */ | ||
33 | + KeyId id(); | ||
34 | + | ||
35 | + /** | ||
36 | + * Returns list of supporting termination point ids. | ||
37 | + * | ||
38 | + * @return the supportingTpIds | ||
39 | + */ | ||
40 | + List<TerminationPointKey> getSupportingTpIds(); | ||
41 | + | ||
42 | + /** | ||
43 | + * Returns TE attributes for this termination point. | ||
44 | + * | ||
45 | + * @return the te attribute | ||
46 | + */ | ||
47 | + TeTerminationPoint getTe(); | ||
48 | + | ||
49 | +} |
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.node; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | + | ||
20 | +import org.onosproject.tetopology.management.api.KeyId; | ||
21 | + | ||
22 | +import com.google.common.base.Objects; | ||
23 | + | ||
24 | +/** | ||
25 | + * Representation of a termination point key or reference. | ||
26 | + */ | ||
27 | +public class TerminationPointKey extends NetworkNodeKey { | ||
28 | + private final KeyId tpId; | ||
29 | + | ||
30 | + /** | ||
31 | + * Creates an instance of TerminationPointKey. | ||
32 | + * | ||
33 | + * @param networkId network identifier | ||
34 | + * @param nodeId node identifier | ||
35 | + * @param tpId termination point identifier | ||
36 | + */ | ||
37 | + public TerminationPointKey(KeyId networkId, KeyId nodeId, KeyId tpId) { | ||
38 | + super(networkId, nodeId); | ||
39 | + this.tpId = tpId; | ||
40 | + } | ||
41 | + | ||
42 | + /** | ||
43 | + * Returns the termination point Id. | ||
44 | + * | ||
45 | + * @return termination point identifier | ||
46 | + */ | ||
47 | + public KeyId tpId() { | ||
48 | + return tpId; | ||
49 | + } | ||
50 | + | ||
51 | + @Override | ||
52 | + public int hashCode() { | ||
53 | + return Objects.hashCode(super.hashCode(), tpId); | ||
54 | + } | ||
55 | + | ||
56 | + @Override | ||
57 | + public boolean equals(Object object) { | ||
58 | + if (object instanceof TerminationPointKey) { | ||
59 | + if (!super.equals(object)) { | ||
60 | + return false; | ||
61 | + } | ||
62 | + TerminationPointKey that = (TerminationPointKey) object; | ||
63 | + return Objects.equal(this.tpId, that.tpId); | ||
64 | + } | ||
65 | + return false; | ||
66 | + } | ||
67 | + | ||
68 | + @Override | ||
69 | + public String toString() { | ||
70 | + return toStringHelper(this) | ||
71 | + .add("networkId", networkId()) | ||
72 | + .add("nodeId", nodeId()) | ||
73 | + .add("tpId", tpId) | ||
74 | + .toString(); | ||
75 | + } | ||
76 | + | ||
77 | +} |
1 | +/* | ||
2 | + * Copyright 2016 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.tetopology.management.api.node; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +import com.google.common.base.MoreObjects; | ||
21 | +import com.google.common.base.Objects; | ||
22 | + | ||
23 | +/** | ||
24 | + * Representation of a tunnel termination point. | ||
25 | + */ | ||
26 | +public class TunnelTerminationPoint { | ||
27 | + //See org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te | ||
28 | + //.topology.rev20160708.ietftetopology | ||
29 | + //.augmentednwnode.te.DefaultTunnelTerminationPoint | ||
30 | + //org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.topology | ||
31 | + //.rev20160708.ietftetopology | ||
32 | + //.augmentednwnode.te.tunnelterminationpoint.DefaultConfig | ||
33 | + private byte[] tunnelTpId; | ||
34 | + private List<InterfaceSwitchingCapability> switchingCapabilities; | ||
35 | + private long interLayerLockId; | ||
36 | + private List<TerminationCapability> terminationCapability; | ||
37 | + | ||
38 | + /** | ||
39 | + * Create an instance of TunnelTerminationPoint. | ||
40 | + * | ||
41 | + * @param tunnelTpId tunnel termination point id | ||
42 | + */ | ||
43 | + public TunnelTerminationPoint(byte[] tunnelTpId) { | ||
44 | + this.tunnelTpId = tunnelTpId; | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * Sets the switching capabilities. | ||
49 | + * | ||
50 | + * @param swcaps the switching capabilities to set | ||
51 | + */ | ||
52 | + public void setSwitchingCapabilities(List<InterfaceSwitchingCapability> swcaps) { | ||
53 | + this.switchingCapabilities = swcaps; | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * Sets the interLayerLockId. | ||
58 | + * | ||
59 | + * @param id the interLayerLockId to set | ||
60 | + */ | ||
61 | + public void setInterLayerLockId(long id) { | ||
62 | + this.interLayerLockId = id; | ||
63 | + } | ||
64 | + | ||
65 | + /** | ||
66 | + * Sets the termination capability. | ||
67 | + * | ||
68 | + * @param terminationCapability the terminationCapability to set | ||
69 | + */ | ||
70 | + public void setTerminationCapabilities(List<TerminationCapability> terminationCapability) { | ||
71 | + this.terminationCapability = terminationCapability; | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * Returns the tunnelTpId. | ||
76 | + * | ||
77 | + * @return tunnel termination point id | ||
78 | + */ | ||
79 | + public byte[] getTunnelTpId() { | ||
80 | + return tunnelTpId; | ||
81 | + } | ||
82 | + | ||
83 | + /** | ||
84 | + * Returns the switching capabilities. | ||
85 | + * | ||
86 | + * @return switching capabilities | ||
87 | + */ | ||
88 | + public List<InterfaceSwitchingCapability> getSwitchingCapabilities() { | ||
89 | + return switchingCapabilities; | ||
90 | + } | ||
91 | + | ||
92 | + /** | ||
93 | + * Returns the interLayerLockId. | ||
94 | + * | ||
95 | + * @return inter layer lock identifier | ||
96 | + */ | ||
97 | + public long getInterLayerLockId() { | ||
98 | + return interLayerLockId; | ||
99 | + } | ||
100 | + | ||
101 | + /** | ||
102 | + * Returns the termination capability list. | ||
103 | + * | ||
104 | + * @return termination capabilities | ||
105 | + */ | ||
106 | + public List<TerminationCapability> getTerminationCapabilities() { | ||
107 | + return terminationCapability; | ||
108 | + } | ||
109 | + | ||
110 | + @Override | ||
111 | + public int hashCode() { | ||
112 | + return Objects.hashCode(tunnelTpId, switchingCapabilities, interLayerLockId, terminationCapability); | ||
113 | + } | ||
114 | + | ||
115 | + @Override | ||
116 | + public boolean equals(Object object) { | ||
117 | + if (this == object) { | ||
118 | + return true; | ||
119 | + } | ||
120 | + if (object instanceof TunnelTerminationPoint) { | ||
121 | + TunnelTerminationPoint that = (TunnelTerminationPoint) object; | ||
122 | + return Objects.equal(this.tunnelTpId, that.tunnelTpId) && | ||
123 | + Objects.equal(this.switchingCapabilities, that.switchingCapabilities) && | ||
124 | + Objects.equal(this.terminationCapability, that.terminationCapability) && | ||
125 | + Objects.equal(this.interLayerLockId, that.interLayerLockId); | ||
126 | + } | ||
127 | + return false; | ||
128 | + } | ||
129 | + | ||
130 | + @Override | ||
131 | + public String toString() { | ||
132 | + return MoreObjects.toStringHelper(this) | ||
133 | + .add("tunnelTpId", tunnelTpId) | ||
134 | + .add("switchingCapabilities", switchingCapabilities) | ||
135 | + .add("interLayerLockId", interLayerLockId) | ||
136 | + .add("terminationCapability", terminationCapability) | ||
137 | + .toString(); | ||
138 | + } | ||
139 | + | ||
140 | +} |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/package-info.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 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 | + * TE node API. | ||
18 | + */ | ||
19 | +package org.onosproject.tetopology.management.api.node; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/package-info.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016-present 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 | + * TE topology management API. | ||
19 | + */ | ||
20 | +package org.onosproject.tetopology.management.api; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment