Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagetext
ONOS_ROOT/apps/pom.xml (apps parent POM)
         |    |  
         |    /ifwd/pom.xml (application POM)
         |         |
         |         /src/main/java/org/onlab/onosonosproject/ifwd/IntentReactiveForwarding.java (the application)
         |             |                              |
         |             |                              /package-info.java (optional documentation/annotations)
         |             |
         |             /test/java/org/onlab/onosonosproject/ifwd/ (Unit tests go here)
         |
         /core/api/src/main/java/org/onlab/onosonosproject/net/apps/ForwardingMapService.java (the service interface)
         |
         /cli/src/main/java/org/onlabonosproject/onos/cli/net/ForwardingMapCommand.java (the command)
                      |
                      /resources/OSGI-INF/blueprint/shell-config.xml (Karaf shell configuration)  

...

We start by defining a new interface for the service in the onos-api package (ONOS_ROOT/core/api/src/main/java/org/onlab/onosonosproject/net/). We also create a new directory, apps/, for our service interface to reside in. The interface is added to this location so that the cli package that implements the commands has access to it.

Code Block
languagejava
titleForwardingMapService.java
collapsetrue
/*
 * Copyright 2014 Open Networking Laboratory
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
package org.onlabonosproject.onos.net.apps;

import java.util.Map;

import org.onlab.onosonosproject.net.HostId;

/**
 * A demonstrative service for the intent reactive forwarding application to
 * export.
 */
public interface ForwardingMapService {

    /**
     * Get the endpoints of the host-to-host intents that were installed.
     *
     * @return maps of source to destination
     */
    public Map<HostId, HostId> getEndPoints();

}

...