Reference Guide
Table Of Contents
- 1 Introduction
- 2 Establishing Your Test and Development Environments
- 3 Developing Applications
- Introduction
- Authentication
- REST API
- Audit Logging
- Alert Logging
- Configuration
- High Availability
- OpenFlow
- Metrics Framework
- GUI
- SKI Framework - Overview
- SKI Framework - Navigation Tree
- SKI Framework - Hash Navigation
- SKI Framework - View Life-Cycle
- SKI Framework - Live Reference Application
- UI Extension
- Introduction
- Controller Teaming
- Distributed Coordination Service
- Persistence
- Backup and Restore
- Device Driver Framework
- 4 Application Security
- 5 Including Debian Packages with Applications
- 6 Sample Application
- Application Description
- Creating Application Development Workspace
- Application Generator (Automatic Workspace Creation)
- Creating Eclipse Projects
- Updating Project Dependencies
- Building the Application
- Installing the Application
- Application Code
- 7 Testing Applications
- 8 Built-In Applications
- Appendix A
- Appendix B
- Bibliography
if an error occurs writing the file (which will currently manifest itself as an internal server error 500
back to the application code).
After the debian file has been uploaded to the admin space it must be installed. The installation is
accomplished via a script that is executed by the business logic in the admin space. The business
logic will only look in the admin upload directory for the debian package to install. This is not a
synchronous operation in that the underlying script schedules an operation to occur in the future
and then returns. From the applications perspective, the call to install a debian will return
immediate, but the actual effort to install the debian package will not occur until some point in the
future. To install a debian package, execute the following command, where $1 is the name of the
debian file:
echo “dpkg –i $1 >> /var/log/sdn/admin/install.log 2>&1” | sudo at now + 1 min
Uploading a debian package
The path for a debian package upload is “/upload”. The REST API requires that a header be
provided with the file name. Once the file has been copied (you provide an InputStream in the
REST API call) the method should return. The REST API call to upload the debian file will have a
return code of 200 if the request succeeds. The response string associated with the debian
package upload is an empty JSON structure.
// communication with the administrative component
@Reference(policy = ReferencePolicy.DYNAMIC,
cardinality = ReferenceCardinality.OPTIONAL_UNARY)
private volatile AdminRest adminRest;
. . .
File unzipDir = appService.getAppUnzipDir(APP_ID, APP_VERSION);
File deb = new File(unzipDir, APP_DEBIAN_FILE);
. . .
BasicHeader fileHeader =
new BasicHeader("filename", APP_DEBIAN_FILE);
Header[] headers = {fileHeader};
try (InputStream stream =
Files.newInputStream(Paths.get(deb.toURI()))) {
URI uri = adminRest.uri(IpAddress.LOOPBACK_IPv4, UPLOAD_PATH);
ResponseData resp = adminRest.post(adminRest.login(),
uri, headers, stream);
if (resp.status() != Response.Status.OK.getStatusCode())
throw new IllegalStateException(E_UPLOAD + resp.status());
}
133