Naoki Shiota
Committed by Yuta HIGUCHI

Moved ecord.metro app to onos repo. (ONOS-4441)

Change-Id: I9a5d2935012eee433a4f63c672c16bdcb8d6b6b8
...@@ -122,6 +122,7 @@ APPS = [ ...@@ -122,6 +122,7 @@ APPS = [
122 '//apps/openstacknetworking/openstackswitching:onos-apps-openstacknetworking-openstackswitching-oar', 122 '//apps/openstacknetworking/openstackswitching:onos-apps-openstacknetworking-openstackswitching-oar',
123 '//apps/mobility:onos-apps-mobility-oar', 123 '//apps/mobility:onos-apps-mobility-oar',
124 '//apps/optical:onos-apps-optical-oar', 124 '//apps/optical:onos-apps-optical-oar',
125 + '//apps/newoptical:onos-apps-newoptical-oar',
125 '//apps/pathpainter:onos-apps-pathpainter-oar', 126 '//apps/pathpainter:onos-apps-pathpainter-oar',
126 '//apps/pcep-api:onos-apps-pcep-api-oar', 127 '//apps/pcep-api:onos-apps-pcep-api-oar',
127 '//apps/pim:onos-apps-pim-oar', 128 '//apps/pim:onos-apps-pim-oar',
......
1 +COMPILE_DEPS = [
2 + '//lib:CORE_DEPS',
3 + '//lib:org.apache.karaf.shell.console',
4 + '//cli:onos-cli',
5 +]
6 +
7 +osgi_jar_with_tests (
8 + deps = COMPILE_DEPS,
9 +)
10 +
11 +onos_app (
12 + title = 'Packet/Optical Use-Case App',
13 + category = 'Traffic Steering',
14 + url = 'http://onosproject.org',
15 + description = 'Packet/Optical use-case application.',
16 +)
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!--
3 + ~ Copyright 2016 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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
18 + <modelVersion>4.0.0</modelVersion>
19 +
20 + <parent>
21 + <artifactId>onos-apps</artifactId>
22 + <groupId>org.onosproject</groupId>
23 + <version>1.6.0-SNAPSHOT</version>
24 + <relativePath>../pom.xml</relativePath>
25 + </parent>
26 +
27 + <artifactId>onos-app-newoptical</artifactId>
28 + <packaging>bundle</packaging>
29 +
30 + <description>Application for setup optical network</description>
31 + <url>http://onosproject.org</url>
32 +
33 + <properties>
34 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
35 + <onos.app.name>org.onosproject.newoptical</onos.app.name>
36 + <onos.app.category>Traffic Steering</onos.app.category>
37 + <onos.app.url>http://onosproject.org</onos.app.url>
38 + <onos.app.origin>Open Networking Lab</onos.app.origin>
39 + </properties>
40 +
41 + <dependencies>
42 + <dependency>
43 + <groupId>org.onosproject</groupId>
44 + <artifactId>onos-api</artifactId>
45 + <version>${project.version}</version>
46 + </dependency>
47 +
48 + <dependency>
49 + <groupId>org.onosproject</groupId>
50 + <artifactId>onos-core-dist</artifactId>
51 + <version>${project.version}</version>
52 + </dependency>
53 +
54 + <dependency>
55 + <groupId>junit</groupId>
56 + <artifactId>junit</artifactId>
57 + <scope>test</scope>
58 + </dependency>
59 +
60 + <dependency>
61 + <groupId>org.onosproject</groupId>
62 + <artifactId>onos-api</artifactId>
63 + <version>${project.version}</version>
64 + <scope>test</scope>
65 + <classifier>tests</classifier>
66 + </dependency>
67 +
68 + <dependency>
69 + <groupId>org.apache.felix</groupId>
70 + <artifactId>org.apache.felix.scr.annotations</artifactId>
71 + <scope>provided</scope>
72 + </dependency>
73 +
74 + <dependency>
75 + <groupId>org.osgi</groupId>
76 + <artifactId>org.osgi.compendium</artifactId>
77 + <scope>provided</scope>
78 + </dependency>
79 +
80 + <dependency>
81 + <groupId>org.apache.karaf.shell</groupId>
82 + <artifactId>org.apache.karaf.shell.console</artifactId>
83 + <scope>provided</scope>
84 + </dependency>
85 +
86 + <dependency>
87 + <groupId>org.onosproject</groupId>
88 + <artifactId>onos-cli</artifactId>
89 + <version>${project.version}</version>
90 + </dependency>
91 +
92 + </dependencies>
93 +
94 + <build>
95 + <pluginManagement>
96 + <plugins>
97 + <plugin>
98 + <groupId>org.apache.karaf.tooling</groupId>
99 + <artifactId>karaf-maven-plugin</artifactId>
100 + <extensions>true</extensions>
101 + </plugin>
102 + </plugins>
103 + </pluginManagement>
104 + <plugins>
105 + <plugin>
106 + <groupId>org.apache.felix</groupId>
107 + <artifactId>maven-bundle-plugin</artifactId>
108 + <extensions>true</extensions>
109 + </plugin>
110 + <plugin>
111 + <groupId>org.apache.maven.plugins</groupId>
112 + <artifactId>maven-compiler-plugin</artifactId>
113 + <configuration>
114 + <source>1.8</source>
115 + <target>1.8</target>
116 + </configuration>
117 + </plugin>
118 + <plugin>
119 + <groupId>org.apache.felix</groupId>
120 + <artifactId>maven-scr-plugin</artifactId>
121 + <executions>
122 + <execution>
123 + <id>generate-scr-srcdescriptor</id>
124 + <goals>
125 + <goal>scr</goal>
126 + </goals>
127 + </execution>
128 + </executions>
129 + <configuration>
130 + <supportedProjectTypes>
131 + <supportedProjectType>bundle</supportedProjectType>
132 + <supportedProjectType>war</supportedProjectType>
133 + </supportedProjectTypes>
134 + </configuration>
135 + </plugin>
136 + <plugin>
137 + <groupId>org.onosproject</groupId>
138 + <artifactId>onos-maven-plugin</artifactId>
139 + <executions>
140 + <execution>
141 + <id>cfg</id>
142 + <phase>generate-resources</phase>
143 + <goals>
144 + <goal>cfg</goal>
145 + </goals>
146 + </execution>
147 + <execution>
148 + <id>swagger</id>
149 + <phase>generate-sources</phase>
150 + <goals>
151 + <goal>swagger</goal>
152 + </goals>
153 + </execution>
154 + <execution>
155 + <id>app</id>
156 + <phase>package</phase>
157 + <goals>
158 + <goal>app</goal>
159 + </goals>
160 + </execution>
161 + </executions>
162 + </plugin>
163 + </plugins>
164 + </build>
165 +
166 +</project>
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.newoptical;
17 +
18 +import com.google.common.annotations.Beta;
19 +import com.google.common.collect.ImmutableList;
20 +import com.google.common.collect.ImmutableSet;
21 +import org.onlab.util.Bandwidth;
22 +import org.onosproject.newoptical.api.OpticalConnectivityId;
23 +import org.onosproject.net.ConnectPoint;
24 +import org.onosproject.net.Link;
25 +import org.onosproject.net.Path;
26 +import org.onosproject.net.intent.IntentId;
27 +
28 +import java.time.Duration;
29 +import java.util.HashSet;
30 +import java.util.List;
31 +import java.util.Set;
32 +
33 +import static com.google.common.base.Preconditions.checkNotNull;
34 +
35 +/**
36 + * Entity to store optical connectivity request and related information.
37 + */
38 +@Beta
39 +public class OpticalConnectivity {
40 +
41 + private final OpticalConnectivityId id;
42 + private final List<Link> links;
43 + private final Bandwidth requestBandwidth;
44 + private final Duration requestLatency;
45 +
46 + // Bandwidth capacity of optical layer
47 + private Bandwidth opticalCapacity;
48 +
49 + private final Set<PacketLinkRealizedByOptical> realizingLinks = new HashSet<>();
50 +
51 + // TODO: This IntentId is used only to reserve bandwidth resource.
52 + // After ResourceManager is made to accept app-defined ResourceConsumer,
53 + // this Intent should be replaced with OpticalConnectivityId.
54 + private IntentId intentId;
55 +
56 + private State state = State.CREATED;
57 +
58 + public enum State {
59 + CREATED,
60 + INSTALLING,
61 + INSTALLED,
62 + WITHDRAWING,
63 + WITHDRAWN,
64 + FAILED
65 + }
66 +
67 + public OpticalConnectivity(OpticalConnectivityId id, Path path, Bandwidth requestBandwidth,
68 + Duration requestLatency) {
69 + this.id = id;
70 + this.links = ImmutableList.copyOf(path.links());
71 + this.requestBandwidth = requestBandwidth;
72 + this.requestLatency = requestLatency;
73 + }
74 +
75 + public void setLinkEstablished(ConnectPoint src, ConnectPoint dst) {
76 + realizingLinks.stream().filter(l -> l.isBetween(src, dst))
77 + .findAny()
78 + .ifPresent(l -> l.setEstablished(true));
79 + }
80 +
81 + public void setLinkRemoved(ConnectPoint src, ConnectPoint dst) {
82 + realizingLinks.stream().filter(l -> l.isBetween(src, dst))
83 + .findAny()
84 + .ifPresent(l -> l.setEstablished(false));
85 + }
86 +
87 + public boolean isAllRealizingLinkEstablished() {
88 + return realizingLinks.stream().allMatch(PacketLinkRealizedByOptical::isEstablished);
89 + }
90 +
91 + public boolean isAllRealizingLinkNotEstablished() {
92 + return !realizingLinks.stream().anyMatch(PacketLinkRealizedByOptical::isEstablished);
93 + }
94 +
95 + public OpticalConnectivityId id() {
96 + return id;
97 + }
98 +
99 + public List<Link> links() {
100 + return links;
101 + }
102 +
103 + public Bandwidth bandwidth() {
104 + return requestBandwidth;
105 + }
106 +
107 + public Duration latency() {
108 + return requestLatency;
109 + }
110 +
111 + public State state() {
112 + return state;
113 + }
114 +
115 + public boolean state(State state) {
116 + boolean valid = true;
117 + // reject invalid state transition
118 + switch (this.state) {
119 + case CREATED:
120 + valid = (state == State.INSTALLING || state == State.FAILED);
121 + break;
122 + case INSTALLING:
123 + valid = (state == State.INSTALLED || state == State.FAILED);
124 + break;
125 + case INSTALLED:
126 + valid = (state == State.WITHDRAWING || state == State.FAILED);
127 + break;
128 + case WITHDRAWING:
129 + valid = (state == State.WITHDRAWN || state == State.FAILED);
130 + break;
131 + case FAILED:
132 + valid = (state == State.INSTALLING || state == State.WITHDRAWING || state == State.FAILED);
133 + break;
134 + default:
135 + break;
136 + }
137 +
138 + if (valid) {
139 + this.state = state;
140 + }
141 +
142 + return valid;
143 + }
144 +
145 + public Bandwidth getOpticalCapacity() {
146 + return opticalCapacity;
147 + }
148 +
149 + public void setOpticalCapacity(Bandwidth opticalCapacity) {
150 + this.opticalCapacity = opticalCapacity;
151 + }
152 +
153 + public void addRealizingLink(PacketLinkRealizedByOptical link) {
154 + checkNotNull(link);
155 + realizingLinks.add(link);
156 + }
157 +
158 + public void removeRealizingLink(PacketLinkRealizedByOptical link) {
159 + checkNotNull(link);
160 + realizingLinks.remove(link);
161 + }
162 +
163 + public Set<PacketLinkRealizedByOptical> getRealizingLinks() {
164 + return ImmutableSet.copyOf(realizingLinks);
165 + }
166 +
167 + public IntentId getIntentId() {
168 + return intentId;
169 + }
170 +
171 + public void setIntentId(IntentId intentId) {
172 + this.intentId = intentId;
173 + }
174 +}
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.newoptical;
17 +
18 +import com.google.common.annotations.Beta;
19 +import org.onlab.util.Bandwidth;
20 +import org.onosproject.net.ConnectPoint;
21 +import org.onosproject.net.intent.Key;
22 +import org.onosproject.net.intent.OpticalCircuitIntent;
23 +import org.onosproject.net.intent.OpticalConnectivityIntent;
24 +
25 +import static com.google.common.base.Preconditions.checkNotNull;
26 +
27 +/**
28 + * Entity to represent packet link realized by optical intent.
29 + */
30 +@Beta
31 +public class PacketLinkRealizedByOptical {
32 + private final ConnectPoint src, dst;
33 + private final Bandwidth bandwidth;
34 + // TODO should be list of Intent Key?
35 + private final Key realizingIntentKey;
36 + // established=false represents that this (packet) link is expected to be
37 + // discovered after underlying (optical) path has been provisioned.
38 + private boolean established;
39 +
40 + /**
41 + * Creates instance with specified parameters.
42 + *
43 + * @param src source connect point
44 + * @param dst destination connect point
45 + * @param realizingIntentKey key of Optical*Intent that realizes packet link between src and dst
46 + * @param bandwidth assigned bandwidth
47 + */
48 + public PacketLinkRealizedByOptical(ConnectPoint src, ConnectPoint dst,
49 + Key realizingIntentKey, Bandwidth bandwidth) {
50 + this.src = src;
51 + this.dst = dst;
52 + this.realizingIntentKey = realizingIntentKey;
53 + this.bandwidth = bandwidth;
54 + this.established = false;
55 + }
56 +
57 + /**
58 + * Creates PacketLinkRealizedByOptical instance with specified connect points and OpticalCircuitIntent.
59 + * Assigned bandwidth is taken from physical limit of optical link.
60 + *
61 + * @param src source connect point
62 + * @param dst destination connect point
63 + * @param intent OpticalCircuitIntent that realizes packet link between src and dst
64 + * @return
65 + */
66 + public static PacketLinkRealizedByOptical create(ConnectPoint src, ConnectPoint dst,
67 + OpticalCircuitIntent intent) {
68 + checkNotNull(src);
69 + checkNotNull(dst);
70 + checkNotNull(intent);
71 +
72 + long rate = intent.getSignalType().bitRate();
73 + return new PacketLinkRealizedByOptical(src, dst, intent.key(), Bandwidth.bps(rate));
74 + }
75 +
76 + /**
77 + * Creates PacketLinkRealizedByOptical instance with specified connect points and OpticalConnectivityIntent.
78 + * Assigned bandwidth is taken from physical limit of optical link.
79 + *
80 + * @param src source connect point
81 + * @param dst destination connect point
82 + * @param intent OpticalConnectivityIntent that realizes packet link between src and dst
83 + * @return
84 + */
85 + public static PacketLinkRealizedByOptical create(ConnectPoint src, ConnectPoint dst,
86 + OpticalConnectivityIntent intent) {
87 + checkNotNull(src);
88 + checkNotNull(dst);
89 + checkNotNull(intent);
90 +
91 + long rate = intent.getSignalType().bitRate();
92 + return new PacketLinkRealizedByOptical(src, dst, intent.key(), Bandwidth.bps(rate));
93 + }
94 +
95 + /**
96 + * Returns source connect point.
97 + *
98 + * @return source connect point
99 + */
100 + public ConnectPoint src() {
101 + return src;
102 + }
103 +
104 + /**
105 + * Returns destination connect point.
106 + *
107 + * @return destination connect point
108 + */
109 + public ConnectPoint dst() {
110 + return dst;
111 + }
112 +
113 + /**
114 + * Returns assigned bandwidth.
115 + *
116 + * @return assigned bandwidth
117 + */
118 + public Bandwidth bandwidth() {
119 + return bandwidth;
120 + }
121 +
122 + /**
123 + * Returns intent key.
124 + *
125 + * @return intent key
126 + */
127 + public Key realizingIntentKey() {
128 + return realizingIntentKey;
129 + }
130 +
131 + /**
132 + * Returns whether packet link is realized or not.
133 + *
134 + * @return true if packet link is realized. false if not.
135 + */
136 + public boolean isEstablished() {
137 + return established;
138 + }
139 +
140 + /**
141 + * Sets packet link to be established.
142 + *
143 + * @param established status of packet link
144 + */
145 + public void setEstablished(boolean established) {
146 + this.established = established;
147 + }
148 +
149 + /**
150 + * Check if packet link is between specified two connect points.
151 + *
152 + * @param src source connect point
153 + * @param dst destination connect point
154 + * @return true if this link is between src and dst. false if not.
155 + */
156 + public boolean isBetween(ConnectPoint src, ConnectPoint dst) {
157 + return (this.src.equals(src) && this.dst.equals(dst));
158 + }
159 +
160 +}
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.newoptical.api;
17 +
18 +import com.google.common.annotations.Beta;
19 +import com.google.common.base.MoreObjects;
20 +import org.onlab.util.Identifier;
21 +
22 +// TODO: After ResourceManager is made to accept app-defined ResourceConsumer,
23 +// this class should be implemented as ResourceConsumer.
24 +/**
25 + * ID for optical connectivity.
26 + */
27 +@Beta
28 +public final class OpticalConnectivityId extends Identifier<Long> {
29 +
30 + public static OpticalConnectivityId of(long value) {
31 + return new OpticalConnectivityId(value);
32 + }
33 +
34 + OpticalConnectivityId(long value) {
35 + super(value);
36 + }
37 +
38 + @Override
39 + public String toString() {
40 + return MoreObjects.toStringHelper(this)
41 + .add("value", id())
42 + .toString();
43 + }
44 +}
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.newoptical.api;
17 +
18 +import com.google.common.annotations.Beta;
19 +import org.onosproject.event.AbstractEvent;
20 +
21 +/**
22 + * Event related to optical domain path setup.
23 + */
24 +@Beta
25 +public class OpticalPathEvent extends AbstractEvent<OpticalPathEvent.Type, OpticalConnectivityId> {
26 + public enum Type {
27 + PATH_INSTALLED,
28 + PATH_REMOVED
29 + }
30 +
31 + /**
32 + * Creates OpticalPathEvent object with specified type and subject.
33 + * @param type
34 + * @param subject
35 + */
36 + public OpticalPathEvent(Type type, OpticalConnectivityId subject) {
37 + super(type, subject);
38 + }
39 +
40 +}
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.newoptical.api;
17 +
18 +import org.onosproject.event.EventListener;
19 +
20 +/**
21 + * Entity capable of receiving optical path related events.
22 + */
23 +public interface OpticalPathListener extends EventListener<OpticalPathEvent> {
24 +}
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.newoptical.api;
17 +
18 +import com.google.common.annotations.Beta;
19 +import org.onlab.util.Bandwidth;
20 +import org.onosproject.event.ListenerService;
21 +import org.onosproject.net.ConnectPoint;
22 +import org.onosproject.net.Link;
23 +import org.onosproject.net.Path;
24 +
25 +import java.time.Duration;
26 +import java.util.List;
27 +
28 +/**
29 + * Service to setup optical domain connectivity.
30 + */
31 +@Beta
32 +public interface OpticalPathService extends ListenerService<OpticalPathEvent, OpticalPathListener> {
33 +
34 + /**
35 + * Calculates optical path between connect points and sets up connectivity.
36 + *
37 + * @param ingress ingress port
38 + * @param egress egress port
39 + * @param bandwidth required bandwidth. No bandwidth is assured if null.
40 + * @param latency required latency. No latency is assured if null.
41 + * @return ID of created connectivity if successful. null otherwise.
42 + */
43 + OpticalConnectivityId setupConnectivity(ConnectPoint ingress, ConnectPoint egress,
44 + Bandwidth bandwidth, Duration latency);
45 +
46 + /**
47 + * Sets up connectivity along given optical path.
48 + *
49 + * @param path path along which connectivity will be set up
50 + * @param bandwidth required bandwidth. No bandwidth is assured if null.
51 + * @param latency required latency. No latency is assured if null.
52 + * @return true if successful. false otherwise.
53 + */
54 + OpticalConnectivityId setupPath(Path path, Bandwidth bandwidth, Duration latency);
55 +
56 + /**
57 + * Removes connectivity with given ID.
58 + *
59 + * @param id ID of connectivity
60 + * @return true if succeed. false if failed.
61 + */
62 + boolean removeConnectivity(OpticalConnectivityId id);
63 +
64 + /**
65 + * Returns path assigned to given ID.
66 + * @param id ID of connectivity
67 + * @return list of link that compose a path. null if ID is invalid.
68 + */
69 + List<Link> getPath(OpticalConnectivityId id);
70 +}
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 + * API to optical path service.
18 + */
19 +package org.onosproject.newoptical.api;
...\ No newline at end of file ...\ No newline at end of file
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.newoptical.cli;
17 +
18 +import org.apache.karaf.shell.commands.Argument;
19 +import org.apache.karaf.shell.commands.Command;
20 +import org.onlab.util.Bandwidth;
21 +import org.onosproject.cli.AbstractShellCommand;
22 +import org.onosproject.newoptical.api.OpticalConnectivityId;
23 +import org.onosproject.newoptical.api.OpticalPathService;
24 +import org.onosproject.net.ConnectPoint;
25 +import org.onosproject.net.DeviceId;
26 +import org.onosproject.net.PortNumber;
27 +
28 +@Command(scope = "onos", name = "add-optical-connectivity",
29 + description = "Configure optical domain connectivity")
30 +public class AddOpticalConnectivityCommand extends AbstractShellCommand {
31 +
32 + @Argument(index = 0, name = "ingress", description = "Ingress connect point",
33 + required = true, multiValued = false)
34 + String ingressStr = null;
35 +
36 + @Argument(index = 1, name = "egress", description = "Egress connect point",
37 + required = true, multiValued = false)
38 + String egressStr = null;
39 +
40 + @Argument(index = 2, name = "bandwidth", description = "Bandwidth",
41 + required = false, multiValued = false)
42 + String bandwidthStr = null;
43 +
44 + @Argument(index = 3, name = "latency", description = "Latency",
45 + required = true, multiValued = false)
46 + String latencyStr = null;
47 +
48 +
49 + @Override
50 + protected void execute() {
51 + OpticalPathService opticalPathService = get(OpticalPathService.class);
52 +
53 + ConnectPoint ingress = readConnectPoint(ingressStr);
54 + ConnectPoint egress = readConnectPoint(egressStr);
55 + if (ingress == null || egress == null) {
56 + print("Invalid connect points: %s, %s", ingressStr, egressStr);
57 + return;
58 + }
59 +
60 + Bandwidth bandwidth = (bandwidthStr == null || bandwidthStr.isEmpty()) ? null :
61 + Bandwidth.bps(Long.valueOf(bandwidthStr));
62 +
63 + print("Trying to setup connectivity between %s and %s.", ingress, egress);
64 + OpticalConnectivityId id = opticalPathService.setupConnectivity(ingress, egress, bandwidth, null);
65 + if (id == null) {
66 + print("Failed.");
67 + return;
68 + }
69 + print("Optical path ID : %s", id.id());
70 + }
71 +
72 + private ConnectPoint readConnectPoint(String str) {
73 + String[] strings = str.split("/");
74 + if (strings.length != 2) {
75 + return null;
76 + }
77 +
78 + DeviceId devId = DeviceId.deviceId(strings[0]);
79 + PortNumber port = PortNumber.portNumber(strings[1]);
80 +
81 + return new ConnectPoint(devId, port);
82 + }
83 +
84 +}
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.newoptical.cli;
17 +
18 +import org.apache.karaf.shell.commands.Argument;
19 +import org.apache.karaf.shell.commands.Command;
20 +import org.onosproject.cli.AbstractShellCommand;
21 +import org.onosproject.newoptical.api.OpticalConnectivityId;
22 +import org.onosproject.newoptical.api.OpticalPathService;
23 +
24 +@Command(scope = "onos", name = "remove-optical-connectivity",
25 + description = "Remove optical domain connectivity")
26 +public class RemoveOpticalConnectivityCommand extends AbstractShellCommand {
27 + @Argument(index = 0, name = "id", description = "ID of optical connectivity",
28 + required = true, multiValued = false)
29 + String idStr = null;
30 +
31 + @Override
32 + protected void execute() {
33 + OpticalPathService opticalPathService = get(OpticalPathService.class);
34 +
35 + OpticalConnectivityId id = OpticalConnectivityId.of(Long.valueOf(idStr));
36 +
37 + print("Trying to remove connectivity with id %s.", idStr);
38 + if (opticalPathService.removeConnectivity(id)) {
39 + print(" -- success");
40 + } else {
41 + print(" -- failed");
42 + }
43 +
44 + }
45 +}
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 + * CLI to control optical path service.
18 + */
19 +package org.onosproject.newoptical.cli;
...\ No newline at end of file ...\ No newline at end of file
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 +/**
18 + * Module to control optical path.
19 + */
20 +package org.onosproject.newoptical;
...\ No newline at end of file ...\ No newline at end of file
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 +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
17 +
18 + <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
19 + <command>
20 + <action class="org.onosproject.newoptical.cli.AddOpticalConnectivityCommand"/>
21 + </command>
22 + <command>
23 + <action class="org.onosproject.newoptical.cli.RemoveOpticalConnectivityCommand"/>
24 + </command>
25 + </command-bundle>
26 +
27 +</blueprint>
...@@ -66,8 +66,11 @@ import static org.onosproject.net.optical.device.OpticalDeviceServiceView.optica ...@@ -66,8 +66,11 @@ import static org.onosproject.net.optical.device.OpticalDeviceServiceView.optica
66 * OpticalPathProvisioner listens for event notifications from the Intent F/W. 66 * OpticalPathProvisioner listens for event notifications from the Intent F/W.
67 * It generates one or more opticalConnectivityIntent(s) and submits (or withdraws) to Intent F/W 67 * It generates one or more opticalConnectivityIntent(s) and submits (or withdraws) to Intent F/W
68 * for adding/releasing capacity at the packet layer. 68 * for adding/releasing capacity at the packet layer.
69 + *
70 + * @deprecated in Goldeneye (1.6.0)
69 */ 71 */
70 72
73 +@Deprecated
71 @Component(immediate = true) 74 @Component(immediate = true)
72 public class OpticalPathProvisioner { 75 public class OpticalPathProvisioner {
73 76
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
37 <module>proxyarp</module> 37 <module>proxyarp</module>
38 <module>sdnip</module> 38 <module>sdnip</module>
39 <module>optical</module> 39 <module>optical</module>
40 + <module>newoptical</module>
40 <module>metrics</module> 41 <module>metrics</module>
41 <module>routing</module> 42 <module>routing</module>
42 <module>routing-api</module> 43 <module>routing-api</module>
......