Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Thomas Vachuska
2014-10-16 12:17:45 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
140d58545350816b831e4ed0d85a372ecef60c79
140d5854
1 parent
cce11ca2
Added new app for OSCAR/ONOS integration.
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
155 additions
and
0 deletions
apps/calendar/pom.xml
apps/calendar/src/main/java/org/onlab/onos/calendar/BandwidthCalendarResource.java
apps/calendar/src/main/webapp/WEB-INF/web.xml
apps/pom.xml
features/features.xml
apps/calendar/pom.xml
0 → 100644
View file @
140d585
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.onlab.onos
</groupId>
<artifactId>
onos-apps
</artifactId>
<version>
1.0.0-SNAPSHOT
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<artifactId>
onos-app-calendar
</artifactId>
<packaging>
bundle
</packaging>
<description>
ONOS simple calendaring REST interface for intents
</description>
<properties>
<web.context>
/onos/calendar
</web.context>
</properties>
<dependencies>
<dependency>
<groupId>
org.onlab.onos
</groupId>
<artifactId>
onlab-rest
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.sun.jersey
</groupId>
<artifactId>
jersey-servlet
</artifactId>
</dependency>
<dependency>
<groupId>
com.sun.jersey.jersey-test-framework
</groupId>
<artifactId>
jersey-test-framework-core
</artifactId>
<version>
1.18.1
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.sun.jersey.jersey-test-framework
</groupId>
<artifactId>
jersey-test-framework-grizzly2
</artifactId>
<version>
1.18.1
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.osgi
</groupId>
<artifactId>
org.osgi.core
</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.felix
</groupId>
<artifactId>
maven-bundle-plugin
</artifactId>
<extensions>
true
</extensions>
<configuration>
<instructions>
<_wab>
src/main/webapp/
</_wab>
<Bundle-SymbolicName>
${project.groupId}.${project.artifactId}
</Bundle-SymbolicName>
<Import-Package>
org.osgi.framework,
javax.ws.rs,javax.ws.rs.core,
com.sun.jersey.api.core,
com.sun.jersey.spi.container.servlet,
com.sun.jersey.server.impl.container.servlet,
org.onlab.packet.*,
org.onlab.rest.*,
org.onlab.onos.*
</Import-Package>
<Web-ContextPath>
${web.context}
</Web-ContextPath>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
apps/calendar/src/main/java/org/onlab/onos/calendar/BandwidthCalendarResource.java
0 → 100644
View file @
140d585
package
org
.
onlab
.
onos
.
calendar
;
import
org.onlab.onos.net.ConnectPoint
;
import
org.onlab.onos.net.DeviceId
;
import
org.onlab.onos.net.intent.IntentService
;
import
org.onlab.rest.BaseResource
;
import
javax.ws.rs.POST
;
import
javax.ws.rs.Path
;
import
javax.ws.rs.PathParam
;
import
javax.ws.rs.core.Response
;
import
java.net.URI
;
import
static
org
.
onlab
.
onos
.
net
.
PortNumber
.
portNumber
;
/**
* Web resource for triggering calendared intents.
*/
@Path
(
"intent"
)
public
class
BandwidthCalendarResource
extends
BaseResource
{
@POST
@Path
(
"{src}/{dst}/{srcPort}/{dstPort}/{bandwidth}"
)
public
Response
createIntent
(
@PathParam
(
"src"
)
String
src
,
@PathParam
(
"dst"
)
String
dst
,
@PathParam
(
"srcPort"
)
String
srcPort
,
@PathParam
(
"dstPort"
)
String
dstPort
,
@PathParam
(
"bandwidth"
)
String
bandwidth
)
{
// TODO: implement calls to intent framework
IntentService
service
=
get
(
IntentService
.
class
);
ConnectPoint
srcPoint
=
new
ConnectPoint
(
deviceId
(
src
),
portNumber
(
srcPort
));
ConnectPoint
dstPoint
=
new
ConnectPoint
(
deviceId
(
dst
),
portNumber
(
dstPort
));
return
Response
.
ok
(
"Yo! We got src="
+
srcPoint
+
"; dst="
+
dstPoint
+
"; bw="
+
bandwidth
+
"; intent service "
+
service
).
build
();
}
private
DeviceId
deviceId
(
String
dpid
)
{
return
DeviceId
.
deviceId
(
URI
.
create
(
"of:"
+
dpid
));
}
}
apps/calendar/src/main/webapp/WEB-INF/web.xml
0 → 100644
View file @
140d585
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns=
"http://java.sun.com/xml/ns/javaee"
xmlns:web=
"http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id=
"ONOS"
version=
"2.5"
>
<display-name>
ONOS GUI
</display-name>
<servlet>
<servlet-name>
JAX-RS Service
</servlet-name>
<servlet-class>
com.sun.jersey.spi.container.servlet.ServletContainer
</servlet-class>
<init-param>
<param-name>
com.sun.jersey.config.property.packages
</param-name>
<param-value>
org.onlab.onos.calendar
</param-value>
</init-param>
<load-on-startup>
10
</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>
JAX-RS Service
</servlet-name>
<url-pattern>
/rs/*
</url-pattern>
</servlet-mapping>
</web-app>
\ No newline at end of file
apps/pom.xml
View file @
140d585
...
...
@@ -25,6 +25,7 @@
<module>
proxyarp
</module>
<module>
config
</module>
<module>
sdnip
</module>
<module>
calendar
</module>
</modules>
<properties>
...
...
features/features.xml
View file @
140d585
...
...
@@ -164,4 +164,11 @@
<bundle>
mvn:org.onlab.onos/onos-app-sdnip/1.0.0-SNAPSHOT
</bundle>
</feature>
<feature
name=
"onos-app-calendar"
version=
"1.0.0"
description=
"REST interface for scheduling intents from an external calendar"
>
<feature>
onos-api
</feature>
<feature>
onos-thirdparty-web
</feature>
<bundle>
mvn:org.onlab.onos/onos-app-calendar/1.0.0-SNAPSHOT
</bundle>
</feature>
</features>
...
...
Please
register
or
login
to post a comment