Updated and refactored the JSON serialization of Topology-related
and "Low Intent" objects:

* Added JSON serialization for topology-related FooEvent objects
  For now, their format matches exactly the corresponding Topology Foo object:
  - DeviceEvent: matches Device
  - SwitchEvent: matches Switch
  - PortEvent: matches Port
  - LinkEvent: matches Link

* Refactored the JSON serialization of existing objects so it
  is more consistent:

============================================
  - Topology Device serialization: "port" is renamed to "portNumber"

  OLD:
{
    "mac": "00:01:02:03:04:05"
    "attachmentPoints": [
        {
            "dpid": "11:22:33:44:55:66:77:88",
            "port": 1
        },
        ...
    ]
}

  NEW:
{
    "mac": "00:01:02:03:04:05"
    "attachmentPoints": [
        {
            "dpid": "11:22:33:44:55:66:77:88",
            "portNumber": 1
        },
        ...
    ]
}
============================================
   - Low Level Intent serialization (LinkEvent used by "path"):
     portNumber is an integer instead of a string

OLD:
[
        ...
        "path": [
            {
                "src": {
                    "portNumber": "2",
                    "dpid": "00:00:00:00:00:00:02:02"
                },
                "dst": {
                    "portNumber": "2",
                    "dpid": "00:00:00:00:00:00:02:01"
                }
            },

NEW:
[
        ...
        "path": [
            {
                "src": {
                    "portNumber": 2,
                    "dpid": "00:00:00:00:00:00:02:02"
                },
                "dst": {
                    "portNumber": 2,
                    "dpid": "00:00:00:00:00:00:02:01"
                }
            },
============================================
   - Topology Link serialization: Format changed to match LinkEvent (and SwitchPort):

OLD:
{
    ...
    "links": [
        {
            "dst-switch": "00:00:00:00:00:00:01:03",
            "src-switch": "00:00:00:00:00:00:01:06",
            "src-port": 3,
            "dst-port": 4
        },

NEW:
{
    ...
    "links": [
        {
            "src": {
                "portNumber": 3,
                "dpid": "00:00:00:00:00:00:01:06"
            },
            "dst": {
                "portNumber": 4,
                "dpid": "00:00:00:00:00:00:01:03"
            }
        },

============================================
    - Topology Port serialization: Renamed "number" to "portNumber"

OLD:
{
    "switches": [
        {
            "state": "ACTIVE",
            "ports": [
                {
                    "state": "ACTIVE",
                    "desc": null,
                    "number": 1,
                    "dpid": "00:00:00:00:00:00:04:0e"
                },

NEW:
{
    "switches": [
        {
            "state": "ACTIVE",
            "ports": [
                {
                    "state": "ACTIVE",
                    "desc": null,
                    "portNumber": 1,
                    "dpid": "00:00:00:00:00:00:04:0e"
                },

============================================
      - SwitchPort serialization (used in number of places referred above):
        portNumber is an integer instead of a string
OLD:
                {
                    "portNumber": "2",
                    "dpid": "00:00:00:00:00:00:02:02"
                }

NEW:
                {
                    "portNumber": 2,
                    "dpid": "00:00:00:00:00:00:02:02"
                }

======================

* Added JSON serialization for TopologyEvents. The format is:

{
    "addedSwitches": [
        {
            "state": "ACTIVE",
            "ports": [
            ],
            "dpid": "00:00:00:00:00:00:02:07"
        },
        ...
    ],
    "removedSwitches": [
        {
            "state": "ACTIVE",
            "ports": [
            ],
            "dpid": "00:00:00:00:00:00:02:08"
        },
        ...
    ],
    "addedPorts": [
        {
            "state": "ACTIVE",
            "desc": null,
            "portNumber": 1,
            "dpid": "00:00:00:00:00:00:02:07"
        },
        ...
    ],
    "removedPorts": [
        {
            "state": "ACTIVE",
            "desc": null,
            "portNumber": 1,
            "dpid": "00:00:00:00:00:00:02:08"
        },
        ...
    ],
    "addedLinks": [
        {
            "src": {
                "portNumber": 10,
                "dpid": "00:00:00:00:00:00:04:01"
            },
            "dst": {
                "portNumber": 2,
                "dpid": "00:00:00:00:00:00:04:0a"
            }
        },
        ...
    ],
    "removedLinks": [
        {
            "src": {
                "portNumber": 5,
                "dpid": "00:00:00:00:00:00:05:01"
            },
            "dst": {
                "portNumber": 6,
                "dpid": "00:00:00:00:00:00:05:0a"
            }
        },
        ...
    ],
    "addedHosts": [
        {
            "mac": "00:01:02:03:04:05"
            "attachmentPoints": [
                {
                    "dpid": "11:22:33:44:55:66:77:88",
                    "port": 1
                },
                ...
            ]
        },
        ...
    ],
    "removedHosts": [
        {
            "mac": "00:01:02:03:08:08"
            "attachmentPoints": [
                {
                    "dpid": "11:22:33:44:55:11:11:11",
                    "port": 1
                },
                ...
            ]
        },
        ...
    ]
}

Change-Id: Ib72be653bc03444b888c0417b3f026966a7df3f3
16 files changed
tree: 248e07cf1539c77af1e46e58cfcd90258e234476
  1. .checkstyle
  2. .gitignore
  3. .gitreview
  4. Authors
  5. LICENSE.txt
  6. NOTICE.txt
  7. PARTNERS.txt
  8. README.md
  9. build-ramcloud-java-bindings.sh
  10. cluster-mgmt/
  11. conf/
  12. gui/
  13. install-oracle-java.sh
  14. lib/
  15. old-scripts/
  16. onos.sh
  17. onoscli
  18. pom.xml
  19. prep-for-offline.sh
  20. ramcloud-build-scripts/
  21. sample/
  22. scripts/
  23. setup-eclipse.sh
  24. setup-ramcloud.sh
  25. src/
  26. start-ons2014demo.sh
  27. start-rest.sh
  28. vm-utils/
  29. web/
README.md

ONOS (Open Networking Operating System)

ONOS (Open Networking Operating System) is an experimental distributed SDN OS. Currently, it is under active development. ONOS was announced and demonstrated at ONS'13, '14.

License

Apache 2.0

Steps to download and setup a development Virtual Machine

https://wiki.onlab.us:8443/display/onosdocs/Getting+Started+with+ONOS

Building ONOS

  1. Cleanly build ONOS

     $ cd ${ONOS_HOME}/
     $ mvn clean
     $ mvn compile
    

External Dependencies

  1. Required packages

     $ sudo apt-get install maven python-flask python-cmd2 python-pyparsing
    
  2. ZooKeeper

    Download and install apache-zookeeper-3.4.6: http://zookeeper.apache.org/releases.html

    By default ONOS expect ZooKeeper to be installed in ~/zookeeper-3.4.6.
    This can be changed by specifing the path using ZK_HOME environment variable.

    Data directory ZooKeeper uses by default is /var/lib/zookeeper. You will need to give current user permission to write to this directory.

    This directory can be changed using specifying ZK_LIB_DIR environment variable and running ./onos.sh setup to generate ${ONOS_HOME}/conf/zoo.cfg.

    See Configuration for details about ./onos.sh setup.

  3. RAMCloud

    Run setup-ramcloud.sh to download and install RAMCloud to ~/ramcloud.
    Installation path can be changed by specifing RAMCLOUD_HOME environment variable.

     $ cd ${ONOS_HOME}/
     $ ./setup-ramcloud.sh
    

Configuration

./onos.sh setup script is used to generate ONOS related configuration files. This script read configuration from "${ONOS_CONF_DIR}/onos_node.`hostname`.conf".

Copy the file "${ONOS_HOME}/conf/onos_node.conf" to match the hostname and configure the content appropriately.
e.g., To use RAMCloud as data store change host.backend to ramcloud

Once you're done with required configuration run following to generate configuration files.

    $ cd ${ONOS_HOME}/
    $ ./onos.sh setup

Running ONOS and required components

To start ZooKeeper, RAMCloud (if enabled in configuration) and ONOS core.

    $ cd ${ONOS_HOME}/
    $ ./onos.sh start single-node

To stop all the above

    $ cd ${ONOS_HOME}/
    $ ./onos.sh stop

If you need to use the REST APIs, follow the instruction for "Start ONOS REST API server" in next section.

Running ONOS and required components one by one

You can manually start/stop individual ONOS components as follows:

  1. Start Zookeeper

     $ cd ${ONOS_HOME}/
     $ ./onos.sh zk start
    
     ## Confirm Zookeeper is running:
     $ ./onos.sh zk status
    
  2. Start RAMCloud Coordinator (only on one of the node in cluster)

     $ cd ${ONOS_HOME}/
     $ ./onos.sh rc-coord start
    
     ## Confirm RAMCloud Coordinator is running:
     $ ./onos.sh rc-coord status
    
  3. Start RAMCloud Server

     $ cd ${ONOS_HOME}/
     $ ./onos.sh rc-server start
    
     ## Confirm RAMCloud Server is running:
     $ ./onos.sh rc-server status
    
  4. Start ONOS

     $ cd ${ONOS_HOME}/
     $ ./onos.sh core start
    
     ## Confirm ONOS is running:
     $ ./onos.sh core status
    
  5. Start ONOS REST API server

     $ cd ${ONOS_HOME}/
     $ ./start-rest.sh start
    
     ## Confirm the REST API server is running:
     $ ./start-rest.sh status
    

Developing ONOS in offline environment (Optional)

Maven need the Internet connection to download required dependencies and plugins, when they're used for the first time.

If you need to develop ONOS in an Internet unreachable environment you may want to run the following helper script before you go offline, so that required dependencies and plugins for frequently used maven target will be downloaded to your local environment.

    $ ./prep-for-offline.sh