Commit e0e2eb38f3953c0bae828cc72e72381cf5036418

Authored by adumas
0 parents

first commit

Showing 2266 changed files with 149208 additions and 0 deletions

Too many changes to show.

To preserve performance only 49 of 2266 files are displayed.

Floodlight-Default-Conf.launch 0 โ†’ 100644
  1 +++ a/Floodlight-Default-Conf.launch
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
  3 + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
  4 + <listEntry value="/floodlight/src/main/java/net/floodlightcontroller/core/Main.java"/>
  5 + </listAttribute>
  6 + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
  7 + <listEntry value="1"/>
  8 + </listAttribute>
  9 + <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="net.floodlightcontroller.core.Main"/>
  10 + <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="floodlight"/>
  11 + <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea"/>
  12 +</launchConfiguration>
... ...
Floodlight-Quantum-Conf.launch 0 โ†’ 100644
  1 +++ a/Floodlight-Quantum-Conf.launch
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
  3 + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
  4 + <listEntry value="/floodlight/src/main/java/net/floodlightcontroller/core/Main.java"/>
  5 + </listAttribute>
  6 + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
  7 + <listEntry value="1"/>
  8 + </listAttribute>
  9 + <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="net.floodlightcontroller.core.Main"/>
  10 + <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-cf src/main/resources/quantum.properties"/>
  11 + <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="floodlight"/>
  12 + <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea"/>
  13 +</launchConfiguration>
... ...
LICENSE.txt 0 โ†’ 100644
  1 +++ a/LICENSE.txt
  1 +
  2 + Apache License
  3 + Version 2.0, January 2004
  4 + http://www.apache.org/licenses/
  5 +
  6 + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
  7 +
  8 + 1. Definitions.
  9 +
  10 + "License" shall mean the terms and conditions for use, reproduction,
  11 + and distribution as defined by Sections 1 through 9 of this document.
  12 +
  13 + "Licensor" shall mean the copyright owner or entity authorized by
  14 + the copyright owner that is granting the License.
  15 +
  16 + "Legal Entity" shall mean the union of the acting entity and all
  17 + other entities that control, are controlled by, or are under common
  18 + control with that entity. For the purposes of this definition,
  19 + "control" means (i) the power, direct or indirect, to cause the
  20 + direction or management of such entity, whether by contract or
  21 + otherwise, or (ii) ownership of fifty percent (50%) or more of the
  22 + outstanding shares, or (iii) beneficial ownership of such entity.
  23 +
  24 + "You" (or "Your") shall mean an individual or Legal Entity
  25 + exercising permissions granted by this License.
  26 +
  27 + "Source" form shall mean the preferred form for making modifications,
  28 + including but not limited to software source code, documentation
  29 + source, and configuration files.
  30 +
  31 + "Object" form shall mean any form resulting from mechanical
  32 + transformation or translation of a Source form, including but
  33 + not limited to compiled object code, generated documentation,
  34 + and conversions to other media types.
  35 +
  36 + "Work" shall mean the work of authorship, whether in Source or
  37 + Object form, made available under the License, as indicated by a
  38 + copyright notice that is included in or attached to the work
  39 + (an example is provided in the Appendix below).
  40 +
  41 + "Derivative Works" shall mean any work, whether in Source or Object
  42 + form, that is based on (or derived from) the Work and for which the
  43 + editorial revisions, annotations, elaborations, or other modifications
  44 + represent, as a whole, an original work of authorship. For the purposes
  45 + of this License, Derivative Works shall not include works that remain
  46 + separable from, or merely link (or bind by name) to the interfaces of,
  47 + the Work and Derivative Works thereof.
  48 +
  49 + "Contribution" shall mean any work of authorship, including
  50 + the original version of the Work and any modifications or additions
  51 + to that Work or Derivative Works thereof, that is intentionally
  52 + submitted to Licensor for inclusion in the Work by the copyright owner
  53 + or by an individual or Legal Entity authorized to submit on behalf of
  54 + the copyright owner. For the purposes of this definition, "submitted"
  55 + means any form of electronic, verbal, or written communication sent
  56 + to the Licensor or its representatives, including but not limited to
  57 + communication on electronic mailing lists, source code control systems,
  58 + and issue tracking systems that are managed by, or on behalf of, the
  59 + Licensor for the purpose of discussing and improving the Work, but
  60 + excluding communication that is conspicuously marked or otherwise
  61 + designated in writing by the copyright owner as "Not a Contribution."
  62 +
  63 + "Contributor" shall mean Licensor and any individual or Legal Entity
  64 + on behalf of whom a Contribution has been received by Licensor and
  65 + subsequently incorporated within the Work.
  66 +
  67 + 2. Grant of Copyright License. Subject to the terms and conditions of
  68 + this License, each Contributor hereby grants to You a perpetual,
  69 + worldwide, non-exclusive, no-charge, royalty-free, irrevocable
  70 + copyright license to reproduce, prepare Derivative Works of,
  71 + publicly display, publicly perform, sublicense, and distribute the
  72 + Work and such Derivative Works in Source or Object form.
  73 +
  74 + 3. Grant of Patent License. Subject to the terms and conditions of
  75 + this License, each Contributor hereby grants to You a perpetual,
  76 + worldwide, non-exclusive, no-charge, royalty-free, irrevocable
  77 + (except as stated in this section) patent license to make, have made,
  78 + use, offer to sell, sell, import, and otherwise transfer the Work,
  79 + where such license applies only to those patent claims licensable
  80 + by such Contributor that are necessarily infringed by their
  81 + Contribution(s) alone or by combination of their Contribution(s)
  82 + with the Work to which such Contribution(s) was submitted. If You
  83 + institute patent litigation against any entity (including a
  84 + cross-claim or counterclaim in a lawsuit) alleging that the Work
  85 + or a Contribution incorporated within the Work constitutes direct
  86 + or contributory patent infringement, then any patent licenses
  87 + granted to You under this License for that Work shall terminate
  88 + as of the date such litigation is filed.
  89 +
  90 + 4. Redistribution. You may reproduce and distribute copies of the
  91 + Work or Derivative Works thereof in any medium, with or without
  92 + modifications, and in Source or Object form, provided that You
  93 + meet the following conditions:
  94 +
  95 + (a) You must give any other recipients of the Work or
  96 + Derivative Works a copy of this License; and
  97 +
  98 + (b) You must cause any modified files to carry prominent notices
  99 + stating that You changed the files; and
  100 +
  101 + (c) You must retain, in the Source form of any Derivative Works
  102 + that You distribute, all copyright, patent, trademark, and
  103 + attribution notices from the Source form of the Work,
  104 + excluding those notices that do not pertain to any part of
  105 + the Derivative Works; and
  106 +
  107 + (d) If the Work includes a "NOTICE" text file as part of its
  108 + distribution, then any Derivative Works that You distribute must
  109 + include a readable copy of the attribution notices contained
  110 + within such NOTICE file, excluding those notices that do not
  111 + pertain to any part of the Derivative Works, in at least one
  112 + of the following places: within a NOTICE text file distributed
  113 + as part of the Derivative Works; within the Source form or
  114 + documentation, if provided along with the Derivative Works; or,
  115 + within a display generated by the Derivative Works, if and
  116 + wherever such third-party notices normally appear. The contents
  117 + of the NOTICE file are for informational purposes only and
  118 + do not modify the License. You may add Your own attribution
  119 + notices within Derivative Works that You distribute, alongside
  120 + or as an addendum to the NOTICE text from the Work, provided
  121 + that such additional attribution notices cannot be construed
  122 + as modifying the License.
  123 +
  124 + You may add Your own copyright statement to Your modifications and
  125 + may provide additional or different license terms and conditions
  126 + for use, reproduction, or distribution of Your modifications, or
  127 + for any such Derivative Works as a whole, provided Your use,
  128 + reproduction, and distribution of the Work otherwise complies with
  129 + the conditions stated in this License.
  130 +
  131 + 5. Submission of Contributions. Unless You explicitly state otherwise,
  132 + any Contribution intentionally submitted for inclusion in the Work
  133 + by You to the Licensor shall be under the terms and conditions of
  134 + this License, without any additional terms or conditions.
  135 + Notwithstanding the above, nothing herein shall supersede or modify
  136 + the terms of any separate license agreement you may have executed
  137 + with Licensor regarding such Contributions.
  138 +
  139 + 6. Trademarks. This License does not grant permission to use the trade
  140 + names, trademarks, service marks, or product names of the Licensor,
  141 + except as required for reasonable and customary use in describing the
  142 + origin of the Work and reproducing the content of the NOTICE file.
  143 +
  144 + 7. Disclaimer of Warranty. Unless required by applicable law or
  145 + agreed to in writing, Licensor provides the Work (and each
  146 + Contributor provides its Contributions) on an "AS IS" BASIS,
  147 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  148 + implied, including, without limitation, any warranties or conditions
  149 + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
  150 + PARTICULAR PURPOSE. You are solely responsible for determining the
  151 + appropriateness of using or redistributing the Work and assume any
  152 + risks associated with Your exercise of permissions under this License.
  153 +
  154 + 8. Limitation of Liability. In no event and under no legal theory,
  155 + whether in tort (including negligence), contract, or otherwise,
  156 + unless required by applicable law (such as deliberate and grossly
  157 + negligent acts) or agreed to in writing, shall any Contributor be
  158 + liable to You for damages, including any direct, indirect, special,
  159 + incidental, or consequential damages of any character arising as a
  160 + result of this License or out of the use or inability to use the
  161 + Work (including but not limited to damages for loss of goodwill,
  162 + work stoppage, computer failure or malfunction, or any and all
  163 + other commercial damages or losses), even if such Contributor
  164 + has been advised of the possibility of such damages.
  165 +
  166 + 9. Accepting Warranty or Additional Liability. While redistributing
  167 + the Work or Derivative Works thereof, You may choose to offer,
  168 + and charge a fee for, acceptance of support, warranty, indemnity,
  169 + or other liability obligations and/or rights consistent with this
  170 + License. However, in accepting such obligations, You may act only
  171 + on Your own behalf and on Your sole responsibility, not on behalf
  172 + of any other Contributor, and only if You agree to indemnify,
  173 + defend, and hold each Contributor harmless for any liability
  174 + incurred by, or claims asserted against, such Contributor by reason
  175 + of your accepting any such warranty or additional liability.
  176 +
  177 + END OF TERMS AND CONDITIONS
  178 +
  179 + APPENDIX: How to apply the Apache License to your work.
  180 +
  181 + To apply the Apache License to your work, attach the following
  182 + boilerplate notice, with the fields enclosed by brackets "[]"
  183 + replaced with your own identifying information. (Don't include
  184 + the brackets!) The text should be enclosed in the appropriate
  185 + comment syntax for the file format. We also recommend that a
  186 + file or class name and description of purpose be included on the
  187 + same "printed page" as the copyright notice for easier
  188 + identification within third-party archives.
  189 +
  190 + Copyright [yyyy] [name of copyright owner]
  191 +
  192 + Licensed under the Apache License, Version 2.0 (the "License");
  193 + you may not use this file except in compliance with the License.
  194 + You may obtain a copy of the License at
  195 +
  196 + http://www.apache.org/licenses/LICENSE-2.0
  197 +
  198 + Unless required by applicable law or agreed to in writing, software
  199 + distributed under the License is distributed on an "AS IS" BASIS,
  200 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  201 + See the License for the specific language governing permissions and
  202 + limitations under the License.
... ...
Makefile 0 โ†’ 100644
  1 +++ a/Makefile
  1 +# Because I am old and crotchety and my fingers can't stop from running
  2 +# `make` commands
  3 +
  4 +.PHONY: docs doc all test tests count install clean
  5 +
  6 +all:
  7 + ant
  8 +
  9 +init:
  10 + ant init
  11 +
  12 +docs:
  13 + ant javadoc
  14 +
  15 +doc:
  16 + ant javadoc
  17 +
  18 +javadoc:
  19 + ant javadoc
  20 +
  21 +check: tests
  22 +test: tests
  23 +
  24 +tests: all unit-tests
  25 +
  26 +unit-tests:
  27 + ant tests
  28 +
  29 +regression-tests:
  30 + make -C regress tests
  31 +
  32 +count:
  33 + @find src -name \*.java | xargs wc -l | sort -n
  34 +
  35 +clean:
  36 + ant clean
... ...
NOTICE.txt 0 โ†’ 100644
  1 +++ a/NOTICE.txt
  1 +INDEMNITY AND DISCLAIMER OF WARRANTIES
  2 +
  3 +SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
  4 +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  5 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  6 +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  7 +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  8 +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  9 +OR 27973/00100/SF/5339045.1 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  10 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  11 +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  12 +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
... ...
README 0 โ†’ 100644
  1 +++ a/README
... ...
README.md 0 โ†’ 100644
  1 +++ a/README.md
  1 +Floodlight is the leading open source SDN controller. It is supported by a community of developers including a number of engineers from Big Switch Networks (http://www.bigswitch.com/).
  2 +
  3 +OpenFlow is a open standard managed by Open Networking Foundation. It specifies a protocol through switch a remote controller can modify the behavior of networking devices through a well-defined โ€œforwarding instruction setโ€. Floodlight is designed to work with the growing number of switches, routers, virtual witches, and access points that support the OpenFlow standard.
  4 +
  5 +Feature Highlights:
  6 +
  7 +- Offers a module loading system that make it simple to extend and enhance.
  8 +- Easy to set up with minimal dependencies
  9 +- Supports a broad range of virtual- and physical- OpenFlow switches
  10 +- Can handle mixed OpenFlow and non-OpenFlow networks โ€“ it can manage multiple โ€œislandsโ€ of OpenFlow hardware switches
  11 +- Designed to be high-performance โ€“ is the core of a commercial product from Big Switch Networks.
  12 +- Support for OpenStack Quantum cloud orchestration platform}
  13 +
  14 +To download a pre-built VM appliance, access documentation, and sign up for the mailing list, go to:
  15 +
  16 + http://www.projectfloodlight.org/floodlight
... ...
SyncClient.launch 0 โ†’ 100644
  1 +++ a/SyncClient.launch
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
  3 +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
  4 +<listEntry value="/floodlight/src/main/java/org/sdnplatform/sync/client/SyncClient.java"/>
  5 +</listAttribute>
  6 +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
  7 +<listEntry value="1"/>
  8 +</listAttribute>
  9 +<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.sdnplatform.sync.client.SyncClient"/>
  10 +<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--hostname localhost --port 6642 --authScheme CHALLENGE_RESPONSE --keyStorePath /opt/bigswitch/floodlight/configuration/auth_credentials.jceks --keyStorePassword dcbc178a0a3a8674f048ac86372ac456"/>
  11 +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="bigfloodlight"/>
  12 +<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea"/>
  13 +</launchConfiguration>
... ...
apps/circuitpusher/circuitpusher.py 0 โ†’ 100755
  1 +++ a/apps/circuitpusher/circuitpusher.py
  1 +#! /usr/bin/python
  2 +"""
  3 +Copyright 2013, Big Switch Networks, Inc.
  4 +
  5 +Licensed under the Apache License, Version 2.0 (the "License"); you may
  6 +not use this file except in compliance with the License. You may obtain
  7 +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, WITHOUT
  13 +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14 +License for the specific language governing permissions and limitations
  15 +under the License.
  16 +
  17 +circuitpusher utilizes floodlight rest APIs to create a bidirectional circuit,
  18 +i.e., permanent flow entry, on all switches in route between two devices based
  19 +on IP addresses with specified priority.
  20 +
  21 +Notes:
  22 + 1. The circuit pusher currently only creates circuit with two IP end points
  23 + 2. Prior to sending restAPI requests to the circuit pusher, the specified end
  24 + points must already been known to the controller (i.e., already have sent
  25 + packets on the network, easy way to assure this is to do a ping (to any
  26 + target) from the two hosts.
  27 + 3. The current supported command syntax format is:
  28 + a) circuitpusher.py --controller={IP}:{rest port} --type ip --src {IP} --dst {IP} --add --name {circuit-name}
  29 +
  30 + adds a new circuit between src and dst devices Currently ip circuit is supported. ARP is automatically supported.
  31 +
  32 + Currently a simple circuit record storage is provided in a text file circuits.json in the working directory.
  33 + The file is not protected and does not clean itself between controller restarts. The file is needed for correct operation
  34 + and the user should make sure deleting the file when floodlight controller is restarted.
  35 +
  36 + b) circuitpusher.py --controller={IP}:{rest port} --delete --name {circuit-name}
  37 +
  38 + deletes a created circuit (as recorded in circuits.json) using the previously given name
  39 +
  40 +@author kcwang
  41 +"""
  42 +
  43 +import os
  44 +import sys
  45 +import subprocess
  46 +import json
  47 +import argparse
  48 +import io
  49 +import time
  50 +
  51 +# parse circuit options. Currently supports add and delete actions.
  52 +# Syntax:
  53 +# circuitpusher --controller {IP:REST_PORT} --add --name {CIRCUIT_NAME} --type ip --src {IP} --dst {IP}
  54 +# circuitpusher --controller {IP:REST_PORT} --delete --name {CIRCUIT_NAME}
  55 +
  56 +parser = argparse.ArgumentParser(description='Circuit Pusher')
  57 +parser.add_argument('--controller', dest='controllerRestIp', action='store', default='localhost:8080', help='controller IP:RESTport, e.g., localhost:8080 or A.B.C.D:8080')
  58 +parser.add_argument('--add', dest='action', action='store_const', const='add', default='add', help='action: add, delete')
  59 +parser.add_argument('--delete', dest='action', action='store_const', const='delete', default='add', help='action: add, delete')
  60 +parser.add_argument('--type', dest='type', action='store', default='ip', help='valid types: ip')
  61 +parser.add_argument('--src', dest='srcAddress', action='store', default='0.0.0.0', help='source address: if type=ip, A.B.C.D')
  62 +parser.add_argument('--dst', dest='dstAddress', action='store', default='0.0.0.0', help='destination address: if type=ip, A.B.C.D')
  63 +parser.add_argument('--name', dest='circuitName', action='store', default='circuit-1', help='name for circuit, e.g., circuit-1')
  64 +
  65 +args = parser.parse_args()
  66 +print args
  67 +
  68 +controllerRestIp = args.controllerRestIp
  69 +
  70 +# first check if a local file exists, which needs to be updated after add/delete
  71 +if os.path.exists('./circuits.json'):
  72 + circuitDb = open('./circuits.json','r')
  73 + lines = circuitDb.readlines()
  74 + circuitDb.close()
  75 +else:
  76 + lines={}
  77 +
  78 +if args.action=='add':
  79 +
  80 + circuitDb = open('./circuits.json','a')
  81 +
  82 + for line in lines:
  83 + data = json.loads(line)
  84 + if data['name']==(args.circuitName):
  85 + print "Circuit %s exists already. Use new name to create." % args.circuitName
  86 + sys.exit()
  87 + else:
  88 + circuitExists = False
  89 +
  90 + # retrieve source and destination device attachment points
  91 + # using DeviceManager rest API
  92 +
  93 + command = "curl -s http://%s/wm/device/?ipv4=%s" % (args.controllerRestIp, args.srcAddress)
  94 + result = os.popen(command).read()
  95 + parsedResult = json.loads(result)
  96 + print command+"\n"
  97 +
  98 + try:
  99 + sourceSwitch = parsedResult[0]['attachmentPoint'][0]['switchDPID']
  100 + except IndexError:
  101 + print "ERROR : the specified end point (%s) must already been known to the controller (i.e., already have sent packets on the network, easy way to assure this is to do a ping (to any target) from the two hosts." % (args.srcAddress)
  102 + sys.exit()
  103 +
  104 + sourcePort = parsedResult[0]['attachmentPoint'][0]['port']
  105 +
  106 + command = "curl -s http://%s/wm/device/?ipv4=%s" % (args.controllerRestIp, args.dstAddress)
  107 + result = os.popen(command).read()
  108 + parsedResult = json.loads(result)
  109 + print command+"\n"
  110 +
  111 + try:
  112 + destSwitch = parsedResult[0]['attachmentPoint'][0]['switchDPID']
  113 + except IndexError:
  114 + print "ERROR : the specified end point (%s) must already been known to the controller (i.e., already have sent packets on the network, easy way to assure this is to do a ping (to any target) from the two hosts." % (args.dstAddress)
  115 + sys.exit()
  116 +
  117 + destPort = parsedResult[0]['attachmentPoint'][0]['port']
  118 +
  119 + print "Creating circuit:"
  120 + print "from source device at switch %s port %s" % (sourceSwitch,sourcePort)
  121 + print "to destination device at switch %s port %s"% (destSwitch,destPort)
  122 +
  123 + # retrieving route from source to destination
  124 + # using Routing rest API
  125 +
  126 + command = "curl -s http://%s/wm/topology/route/%s/%s/%s/%s/json" % (controllerRestIp, sourceSwitch, sourcePort, destSwitch, destPort)
  127 +
  128 + result = os.popen(command).read()
  129 + parsedResult = json.loads(result)
  130 +
  131 + print command+"\n"
  132 + print result+"\n"
  133 +
  134 + for i in range(len(parsedResult)):
  135 + if i % 2 == 0:
  136 + ap1Dpid = parsedResult[i]['switch']
  137 + ap1Port = parsedResult[i]['port']
  138 + print ap1Dpid, ap1Port
  139 +
  140 + else:
  141 + ap2Dpid = parsedResult[i]['switch']
  142 + ap2Port = parsedResult[i]['port']
  143 + print ap2Dpid, ap2Port
  144 +
  145 + # send one flow mod per pair of APs in route
  146 + # using StaticFlowPusher rest API
  147 +
  148 + # IMPORTANT NOTE: current Floodlight StaticflowEntryPusher
  149 + # assumes all flow entries to have unique name across all switches
  150 + # this will most possibly be relaxed later, but for now we
  151 + # encode each flow entry's name with both switch dpid, user
  152 + # specified name, and flow type (f: forward, r: reverse, farp/rarp: arp)
  153 +
  154 + command = "curl -s -d '{\"switch\": \"%s\", \"name\":\"%s\", \"src-ip\":\"%s\", \"dst-ip\":\"%s\", \"ether-type\":\"%s\", \"cookie\":\"0\", \"priority\":\"32768\", \"ingress-port\":\"%s\",\"active\":\"true\", \"actions\":\"output=%s\"}' http://%s/wm/staticflowentrypusher/json" % (ap1Dpid, ap1Dpid+"."+args.circuitName+".f", args.srcAddress, args.dstAddress, "0x800", ap1Port, ap2Port, controllerRestIp)
  155 + result = os.popen(command).read()
  156 + print command
  157 +
  158 + command = "curl -s -d '{\"switch\": \"%s\", \"name\":\"%s\", \"ether-type\":\"%s\", \"cookie\":\"0\", \"priority\":\"32768\", \"ingress-port\":\"%s\",\"active\":\"true\", \"actions\":\"output=%s\"}' http://%s/wm/staticflowentrypusher/json" % (ap1Dpid, ap1Dpid+"."+args.circuitName+".farp", "0x806", ap1Port, ap2Port, controllerRestIp)
  159 + result = os.popen(command).read()
  160 + print command
  161 +
  162 +
  163 + command = "curl -s -d '{\"switch\": \"%s\", \"name\":\"%s\", \"src-ip\":\"%s\", \"dst-ip\":\"%s\", \"ether-type\":\"%s\", \"cookie\":\"0\", \"priority\":\"32768\", \"ingress-port\":\"%s\",\"active\":\"true\", \"actions\":\"output=%s\"}' http://%s/wm/staticflowentrypusher/json" % (ap1Dpid, ap1Dpid+"."+args.circuitName+".r", args.dstAddress, args.srcAddress, "0x800", ap2Port, ap1Port, controllerRestIp)
  164 + result = os.popen(command).read()
  165 + print command
  166 +
  167 + command = "curl -s -d '{\"switch\": \"%s\", \"name\":\"%s\", \"ether-type\":\"%s\", \"cookie\":\"0\", \"priority\":\"32768\", \"ingress-port\":\"%s\",\"active\":\"true\", \"actions\":\"output=%s\"}' http://%s/wm/staticflowentrypusher/json" % (ap1Dpid, ap1Dpid+"."+args.circuitName+".rarp", "0x806", ap2Port, ap1Port, controllerRestIp)
  168 + result = os.popen(command).read()
  169 + print command
  170 +
  171 + # store created circuit attributes in local ./circuits.json
  172 + datetime = time.asctime()
  173 + circuitParams = {'name':args.circuitName, 'Dpid':ap1Dpid, 'inPort':ap1Port, 'outPort':ap2Port, 'datetime':datetime}
  174 + str = json.dumps(circuitParams)
  175 + circuitDb.write(str+"\n")
  176 +
  177 + # confirm successful circuit creation
  178 + # using controller rest API
  179 +
  180 + command="curl -s http://%s/wm/core/switch/all/flow/json| python -mjson.tool" % (controllerRestIp)
  181 + result = os.popen(command).read()
  182 + print command + "\n" + result
  183 +
  184 +elif args.action=='delete':
  185 +
  186 + circuitDb = open('./circuits.json','w')
  187 +
  188 + # removing previously created flow from switches
  189 + # using StaticFlowPusher rest API
  190 + # currently, circuitpusher records created circuits in local file ./circuits.db
  191 + # with circuit name and list of switches
  192 +
  193 + circuitExists = False
  194 +
  195 + for line in lines:
  196 + data = json.loads(line)
  197 + if data['name']==(args.circuitName):
  198 + circuitExists = True
  199 +
  200 + sw = data['Dpid']
  201 + print data, sw
  202 +
  203 + command = "curl -X DELETE -d '{\"name\":\"%s\", \"switch\":\"%s\"}' http://%s/wm/staticflowentrypusher/json" % (sw+"."+args.circuitName+".f", sw, controllerRestIp)
  204 + result = os.popen(command).read()
  205 + print command, result
  206 +
  207 + command = "curl -X DELETE -d '{\"name\":\"%s\", \"switch\":\"%s\"}' http://%s/wm/staticflowentrypusher/json" % (sw+"."+args.circuitName+".farp", sw, controllerRestIp)
  208 + result = os.popen(command).read()
  209 + print command, result
  210 +
  211 + command = "curl -X DELETE -d '{\"name\":\"%s\", \"switch\":\"%s\"}' http://%s/wm/staticflowentrypusher/json" % (sw+"."+args.circuitName+".r", sw, controllerRestIp)
  212 + result = os.popen(command).read()
  213 + print command, result
  214 +
  215 + command = "curl -X DELETE -d '{\"name\":\"%s\", \"switch\":\"%s\"}' http://%s/wm/staticflowentrypusher/json" % (sw+"."+args.circuitName+".rarp", sw, controllerRestIp)
  216 + result = os.popen(command).read()
  217 + print command, result
  218 +
  219 + else:
  220 + circuitDb.write(line)
  221 +
  222 + circuitDb.close()
  223 +
  224 + if not circuitExists:
  225 + print "specified circuit does not exist"
  226 + sys.exit()
  227 +
... ...
build.xml 0 โ†’ 100644
  1 +++ a/build.xml
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +
  3 + <!--
  4 + Copyright 2011, Big Switch Networks, Inc.
  5 +
  6 + Licensed to the Apache Software Foundation (ASF) under one or more
  7 + contributor license agreements. See the NOTICE file distributed with
  8 + this work for additional information regarding copyright ownership.
  9 + The ASF licenses this file to You under the Apache License, Version 2.0
  10 + (the "License"); you may not use this file except in compliance with
  11 + the License. You may obtain a copy of the License at
  12 +
  13 + http://www.apache.org/licenses/LICENSE-2.0
  14 +
  15 + Unless required by applicable law or agreed to in writing, software
  16 + distributed under the License is distributed on an "AS IS" BASIS,
  17 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18 + See the License for the specific language governing permissions and
  19 + limitations under the License.
  20 +-->
  21 +
  22 +<!--
  23 + The build uses pregenerated Thrift code by default to reduce build
  24 + dependencies. To generate it locally run the gen-thrift target.
  25 + If you change the Thrift files be sure to also commit the updated
  26 + generated code.
  27 +-->
  28 +
  29 +<project default="dist" name="floodlight">
  30 + <property name="target" location="target"/>
  31 + <property name="build" location="${target}/bin"/>
  32 + <property name="build-test" location="${target}/bin-test"/>
  33 + <property name="build-coverage" location="${target}/bin-coverage"/>
  34 + <property name="test-output" location="${target}/test"/>
  35 + <property name="coverage-output" location="${target}/coverage"/>
  36 + <property name="source" location="src/main/java"/>
  37 + <property name="resources" location="src/main/resources/"/>
  38 + <property name="test-resources" location="src/test/resources/"/>
  39 + <property name="source-test" location="src/test/java"/>
  40 + <property name="python-src" location="src/main/python"/>
  41 + <property name="docs" location="${target}/docs"/>
  42 + <property name="main-class" value="net.floodlightcontroller.core.Main"/>
  43 + <property name="floodlight-jar" location="${target}/floodlight.jar"/>
  44 + <property name="floodlight-test-jar" location="${target}/floodlight-test.jar"/>
  45 + <property name="thrift.dir" value="${basedir}/src/main/thrift"/>
  46 + <property name="thrift.out.dir" value="lib/gen-java"/>
  47 + <property name="ant.build.javac.source" value="1.6"/>
  48 + <property name="ant.build.javac.target" value="1.6"/>
  49 + <property name="findbugs.home" value="../build/findbugs-2.0.2"/>
  50 + <property name="findbugs.results" value="findbugs-results" />
  51 + <property name="lib" location="lib"/>
  52 +
  53 + <patternset id="lib">
  54 + <include name="logback-classic-1.0.0.jar"/>
  55 + <include name="logback-core-1.0.0.jar"/>
  56 + <include name="jackson-core-2.1.4.jar"/>
  57 + <include name="jackson-annotations-2.1.4.jar"/>
  58 + <include name="jackson-databind-2.1.4.jar"/>
  59 + <include name="jackson-dataformat-smile-2.1.4.jar"/>
  60 + <include name="jackson-dataformat-xml-2.1.4.jar"/>
  61 + <include name="jackson-dataformat-yaml-2.1.4.jar"/>
  62 + <include name="jackson-dataformat-csv-2.1.4.jar"/>
  63 + <include name="slf4j-api-1.6.4.jar"/>
  64 + <include name="org.restlet-2.2M3.jar"/>
  65 + <include name="org.restlet.ext.jackson-2.2M3.jar"/>
  66 + <include name="org.restlet.ext.simple-2.2M3.jar"/>
  67 + <include name="org.restlet.ext.slf4j-2.2M3.jar"/>
  68 + <include name="simple-5.1.1.jar"/>
  69 + <include name="netty-3.2.6.Final.jar"/>
  70 + <include name="args4j-2.0.16.jar"/>
  71 + <include name="concurrentlinkedhashmap-lru-1.2.jar"/>
  72 + <include name="jython-2.5.2.jar"/>
  73 + <include name="libthrift-0.9.0.jar"/>
  74 + <include name="guava-13.0.1.jar" />
  75 + <include name="findbugs-annotations-2.0.1.jar" />
  76 + <include name="findbugs-jsr305-2.0.1.jar" />
  77 + <include name="derby-10.9.1.0.jar"/>
  78 + </patternset>
  79 +
  80 + <path id="classpath">
  81 + <fileset dir="${lib}">
  82 + <patternset refid="lib"/>
  83 + </fileset>
  84 + </path>
  85 +
  86 + <patternset id="lib-package">
  87 + <include name="jdeb-1.0.1.jar"/>
  88 + </patternset>
  89 + <path id="package-classpath">
  90 + <fileset dir="${lib}">
  91 + <patternset refid="lib-package"/>
  92 + </fileset>
  93 + </path>
  94 +
  95 + <patternset id="lib-cobertura">
  96 + <include name="cobertura-1.9.4.1.jar"/>
  97 + <include name="asm-3.0.jar"/>
  98 + <include name="asm-tree-3.0.jar"/>
  99 + <include name="oro/jakarta-oro-2.0.8.jar"/>
  100 + <include name="log4j-1.2.9.jar"/>
  101 + </patternset>
  102 + <path id="classpath-cobertura">
  103 + <fileset dir="${lib}">
  104 + <patternset refid="lib-cobertura"/>
  105 + </fileset>
  106 + </path>
  107 +
  108 + <patternset id="lib-test">
  109 + <include name="junit-4.8.2.jar"/>
  110 + <include name="org.easymock-3.1.jar"/>
  111 + <include name="objenesis-1.2.jar"/> <!-- required by easymock to mock classes -->
  112 + <include name="cglib-nodep-2.2.2.jar"/> <!-- required by easymock to mock classes -->
  113 + </patternset>
  114 + <path id="classpath-test">
  115 + <fileset dir="${lib}">
  116 + <patternset refid="lib-test"/>
  117 + <patternset refid="lib-cobertura"/>
  118 + <patternset refid="lib"/>
  119 + </fileset>
  120 + </path>
  121 +
  122 + <target name="init">
  123 + <mkdir dir="${build}"/>
  124 + <mkdir dir="${build-test}"/>
  125 + <mkdir dir="${target}/lib"/>
  126 + <mkdir dir="${thrift.out.dir}"/>
  127 + <mkdir dir="${test-output}"/>
  128 + </target>
  129 +
  130 + <target name="compile" depends="init">
  131 + <javac includeAntRuntime="false"
  132 + classpathref="classpath"
  133 + debug="true"
  134 + srcdir="${source}:${thrift.out.dir}"
  135 + destdir="${build}">
  136 + </javac>
  137 + <copy todir="${build}">
  138 + <fileset dir="${resources}" />
  139 + </copy>
  140 + </target>
  141 +
  142 + <target name="compile-tests" depends="compile-test"/>
  143 + <target name="compile-test" depends="compile">
  144 + <javac includeAntRuntime="false" debug="true"
  145 + srcdir="${source-test}"
  146 + classpath="${build}"
  147 + classpathref="classpath-test"
  148 + destdir="${build-test}"/>
  149 + </target>
  150 +
  151 + <target name="gen-thrift" depends="init">
  152 + <echo message="Running thrift on '${thrift.dir}'"/>
  153 + <apply executable="./thrift/compiler/cpp/thrift">
  154 + <fileset dir="${thrift.dir}" casesensitive="yes">
  155 + <include name="**/*.thrift"/>
  156 + </fileset>
  157 + <arg value="--strict"/>
  158 + <arg value="-v"/>
  159 + <arg value="--gen"/>
  160 + <arg value="java"/>
  161 + <arg value="-o"/>
  162 + <arg value="${thrift.out.dir}/.."/>
  163 + </apply>
  164 + <echo message="Adding @SuppressWarning annotations"/>
  165 + <replaceregexp byline="true">
  166 + <regexp pattern="^public "/>
  167 + <substitution expression='@SuppressWarnings("all") public '/>
  168 + <fileset id="thrift.output.files" dir="${thrift.out.dir}/..">
  169 + <include name="**/*.java"/>
  170 + </fileset>
  171 + </replaceregexp>
  172 + </target>
  173 +
  174 + <target name="clean">
  175 + <delete dir="${target}"/>
  176 + </target>
  177 +
  178 + <target name="run" depends="dist">
  179 + <java fork="true" jar="${floodlight-jar}" classpathref="classpath">
  180 + <jvmarg value="-server"/>
  181 + <jvmarg value="-Xms1024M"/>
  182 + <jvmarg value="-Xmx1024M"/>
  183 + </java>
  184 + </target>
  185 +
  186 + <target name="tests" depends="test"/>
  187 + <target name="test" depends="compile-test">
  188 + <junit fork="true" forkmode="once"
  189 + failureproperty="junit.failure"
  190 + printsummary="on">
  191 + <sysproperty key="net.sourceforge.cobertura.datafile"
  192 + file="${target}/cobertura.ser" />
  193 + <classpath>
  194 + <pathelement location="${build-coverage}"/>
  195 + <pathelement location="${build}"/>
  196 + <pathelement location="${resources}"/>
  197 + <pathelement location="${test-resources}"/>
  198 + <pathelement location="${build-test}"/>
  199 + <path refid="classpath-test"/>
  200 + </classpath>
  201 + <formatter type="brief" usefile="true" />
  202 + <batchtest todir="${test-output}">
  203 + <fileset dir="${source-test}">
  204 + <exclude name="**/storage/tests/StorageTest.java"/>
  205 + <include name="**/*Test*.java"/>
  206 + <exclude name="**/core/test/**"/>
  207 + <exclude name="**/core/module/**"/>
  208 + </fileset>
  209 + </batchtest>
  210 + </junit>
  211 + <fail if="junit.failure" message="Unit test(s) failed. See reports!"/>
  212 + </target>
  213 +
  214 + <taskdef classpathref="classpath-cobertura" resource="tasks.properties"/>
  215 + <target name="clean-instrument">
  216 + <delete file="${target}/cobertura.ser"/>
  217 + <delete dir="${build-coverage}"/>
  218 + </target>
  219 + <target name="instrument" depends="compile,compile-test,clean-instrument">
  220 + <cobertura-instrument datafile="${target}/cobertura.ser"
  221 + todir="${build-coverage}"
  222 + classpathref="classpath-cobertura">
  223 + <fileset dir="${build}">
  224 + <include name="**/*.class"/>
  225 + </fileset>
  226 + </cobertura-instrument>
  227 + </target>
  228 + <target name="coverage-report">
  229 + <cobertura-report format="html"
  230 + datafile="${target}/cobertura.ser"
  231 + destdir="${coverage-output}"
  232 + srcdir="${source}"/>
  233 + <cobertura-report format="xml"
  234 + datafile="${target}/cobertura.ser"
  235 + destdir="${coverage-output}"
  236 + srcdir="${source}"/>
  237 + </target>
  238 + <target name="coverage" depends="instrument,test,coverage-report"/>
  239 +
  240 + <target name="dist" depends="compile,compile-test">
  241 + <jar destfile="${floodlight-jar}" filesetmanifest="mergewithoutmain">
  242 + <manifest>
  243 + <attribute name="Main-Class" value="${main-class}"/>
  244 + <attribute name="Class-Path" value="."/>
  245 + </manifest>
  246 + <fileset dir="${build}"/>
  247 + <fileset dir="${resources}"/>
  248 + <fileset dir="${python-src}">
  249 + <include name="**/*.py"/>
  250 + </fileset>
  251 + <zipgroupfileset dir="${lib}">
  252 + <patternset refid="lib"/>
  253 + </zipgroupfileset>
  254 + </jar>
  255 + <jar destfile="${floodlight-test-jar}" filesetmanifest="mergewithoutmain">
  256 + <manifest>
  257 + <attribute name="Class-Path" value="."/>
  258 + </manifest>
  259 + <fileset dir="${build-test}"/>
  260 + <fileset dir="${test-resources}"/>
  261 + <zipgroupfileset dir="${lib}">
  262 + <patternset refid="lib-test"/>
  263 + <patternset refid="lib-cobertura"/>
  264 + </zipgroupfileset>
  265 + </jar>
  266 + </target>
  267 +
  268 + <target name="deb" depends="dist">
  269 + <taskdef name="deb"
  270 + classname="org.vafer.jdeb.ant.DebAntTask"
  271 + classpathref="package-classpath"/>
  272 +
  273 + <copy todir="${target}/debian">
  274 + <fileset dir="debian"/>
  275 + <filterset begintoken="[[" endtoken="]]">
  276 + <filter token="version" value="1.9.0"/>
  277 + <filter token="name" value="${ant.project.name}"/>
  278 + </filterset>
  279 + </copy>
  280 +
  281 + <deb destfile="${target}/floodlight-1.9.0.deb"
  282 + control="${target}/debian/control">
  283 + <data src="${floodlight-jar}" type="file">
  284 + <mapper type="perm" prefix="/usr/share/floodlight/java"/>
  285 + </data>
  286 + <tarfileset dir="debian/misc/bin" prefix="/usr/bin" filemode="755"/>
  287 + <data src="debian/misc/logrotate/floodlight" type="file">
  288 + <mapper type="perm" prefix="/etc/logrotate.d"/>
  289 + </data>
  290 + <data src="debian/misc/init/floodlight.conf" type="file">
  291 + <mapper type="perm" prefix="/etc/init"/>
  292 + </data>
  293 + <data src="debian/misc/logback.xml" type="file">
  294 + <mapper type="perm" prefix="/etc/floodlight"/>
  295 + </data>
  296 + <data src="debian/misc/rsyslog/10-floodlight.conf" type="file">
  297 + <mapper type="perm" prefix="/etc/rsyslog.d"/>
  298 + </data>
  299 + <data src="debian/misc/default/floodlight" type="file">
  300 + <mapper type="perm" prefix="/etc/default"/>
  301 + </data>
  302 + <data src="debian/misc/floodlight.properties" type="file">
  303 + <mapper type="perm" prefix="/etc/floodlight"/>
  304 + </data>
  305 + <tarfileset dir="src/main/resources/apps" prefix="/etc/floodlight/apps.d"/>
  306 + </deb>
  307 + </target>
  308 + <target name="package" depends="deb"/>
  309 +
  310 + <target name="javadoc">
  311 + <javadoc access="protected"
  312 + author="true"
  313 + classpathref="classpath"
  314 + destdir="${docs}"
  315 + doctitle="Floodlight"
  316 + nodeprecated="false"
  317 + nodeprecatedlist="false"
  318 + noindex="false"
  319 + nonavbar="false"
  320 + notree="false"
  321 + source="1.6"
  322 + sourcepath="${source}"
  323 + splitindex="true"
  324 + use="true"
  325 + version="true"/>
  326 + </target>
  327 +
  328 + <target name="eclipse" depends="init">
  329 + <pathconvert property="eclipse-lib">
  330 + <map from="${basedir}/" to=""/>
  331 + <fileset dir="${lib}">
  332 + <patternset refid="lib"/>
  333 + <patternset refid="lib-test"/>
  334 + </fileset>
  335 + </pathconvert>
  336 + <exec executable="${basedir}/setup-eclipse.sh">
  337 + <arg value="${main-class}"/>
  338 + <arg value="${eclipse-lib}"/>
  339 + </exec>
  340 + </target>
  341 +
  342 + <target name="findbugs-xml" depends="init,compile">
  343 + <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${findbugs.home}/lib/findbugs-ant.jar"/>
  344 + <mkdir dir="${findbugs.results}"/>
  345 + <findbugs
  346 + home="${findbugs.home}"
  347 + output="xml"
  348 + excludeFilter="${basedir}/findbugs-exclude.xml"
  349 + jvmargs="-Xmx1024m"
  350 + outputFile="${findbugs.results}/results.xml">
  351 + <sourcePath path="${source}" />
  352 + <sourcePath path="${thrift.out.dir}" />
  353 + <class location="${build}" />
  354 + <auxClasspath>
  355 + <path refid="classpath" />
  356 + </auxClasspath>
  357 + </findbugs>
  358 + </target>
  359 +
  360 + <target name="findbugs" depends="init,compile">
  361 + <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${findbugs.home}/lib/findbugs-ant.jar"/>
  362 + <mkdir dir="${findbugs.results}"/>
  363 + <findbugs
  364 + home="${findbugs.home}"
  365 + output="html"
  366 + excludeFilter="${basedir}/findbugs-exclude.xml"
  367 + jvmargs="-Xmx1024m"
  368 + outputFile="${findbugs.results}/results.html" >
  369 + <sourcePath path="${source}" />
  370 + <sourcePath path="${thrift.out.dir}" />
  371 + <class location="${build}" />
  372 + <auxClasspath>
  373 + <path refid="classpath" />
  374 + </auxClasspath>
  375 + </findbugs>
  376 + </target>
  377 +
  378 +</project>
... ...
debian/control/control 0 โ†’ 100644
  1 +++ a/debian/control/control
  1 +Package: [[name]]
  2 +Version: [[version]]
  3 +Section: net
  4 +Priority: low
  5 +Maintainer: rob.adams@bigswitch.com
  6 +Architecture: all
  7 +Depends: adduser,
  8 + default-jre-headless | java6-runtime-headless
  9 +Description: Floodlight is a high performance Java based OpenFlow controller originally
  10 + written by David Erickson at Stanford University.
  11 + .
  12 + Floodlight supports a broad range of virtual and physical OpenFlow switches
  13 + and has rich support for mixed OpenFlow and non-OpenFlow networks supporting
  14 + management of multiple islands of OpenFlow switches.
... ...
debian/control/dirs 0 โ†’ 100644
  1 +++ a/debian/control/dirs
  1 +/var/log/floodlight
  2 +/var/lib/floodlight
  3 +/etc/floodlight/apps.d
  4 +/etc/floodlight/conf.d
... ...
debian/control/floodlight.1 0 โ†’ 100644
  1 +++ a/debian/control/floodlight.1
  1 +.\" Hey, EMACS: -*- nroff -*-
  2 +.\" First parameter, NAME, should be all caps
  3 +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
  4 +.\" other parameters are allowed: see man(7), man(1)
  5 +.TH FLOODLIGHT 1 "May 14, 2012"
  6 +.\" Please adjust this date whenever revising the manpage.
  7 +.\"
  8 +.\" Some roff macros, for reference:
  9 +.\" .nh disable hyphenation
  10 +.\" .hy enable hyphenation
  11 +.\" .ad l left justify
  12 +.\" .ad b justify to both left and right margins
  13 +.\" .nf disable filling
  14 +.\" .fi enable filling
  15 +.\" .br insert line break
  16 +.\" .sp <n> insert n+1 empty lines
  17 +.\" for manpage-specific macros, see man(7)
  18 +.SH NAME
  19 +floodlight \- An Apache licensed, Java based OpenFlow controller
  20 +.SH SYNOPSIS
  21 +.B floodlight
  22 +.RI [ options ]
  23 +.SH DESCRIPTION
  24 +This manual page documents briefly the
  25 +.B floodlight
  26 +command.
  27 +.PP
  28 +.\" TeX users may be more comfortable with the \fB<whatever>\fP and
  29 +.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
  30 +.\" respectively.
  31 +\fBfloodlight\fP is an Apache licensed, Java based OpenFlow controller.
  32 +.SH OPTIONS
  33 +.TP
  34 +.B \-cf, \-\-configFile FILE
  35 +Floodlight configuration file.
  36 +.SH AUTHOR
  37 +floodlight was written by David Erickson and Big Switch Networks.
  38 +.PP
  39 +This manual page was written by Rich Lane <rlane@bigswitch.com>,
  40 +for the Debian project (and may be used by others).
... ...
debian/control/floodlight.upstart 0 โ†’ 100644
  1 +++ a/debian/control/floodlight.upstart
  1 +# floodlight - A Java-based OpenFlow controller
  2 +#
  3 +# The Floodlight program configures network switches using the OpenFlow protocol.
  4 +# vim: set filetype=upstart :
  5 +
  6 +description "Floodlight controller"
  7 +
  8 +start on filesystem or runlevel [2345]
  9 +stop on runlevel [!2345]
  10 +
  11 +setuid floodlight
  12 +setgid floodlight
  13 +
  14 +respawn
  15 +
  16 +pre-start script
  17 + [ -f /usr/share/floodlight/java/floodlight.jar ] || exit 0
  18 +end script
  19 +
  20 +script
  21 + . /etc/default/floodlight
  22 + exec java ${JVM_OPTS} -Dpython.home=/usr/share/jython \
  23 + -Dlogback.configurationFile=/etc/floodlight/logback.xml \
  24 + -jar /usr/share/floodlight/java/floodlight.jar \
  25 + $DAEMON_OPTS 2>&1 >> /var/log/floodlight/floodlight.log
  26 +end script
... ...
debian/control/manpages 0 โ†’ 100644
  1 +++ a/debian/control/manpages
  1 +debian/floodlight.1
... ...
debian/control/postinst 0 โ†’ 100644
  1 +++ a/debian/control/postinst
  1 +#!/bin/sh -e
  2 +
  3 +NAME=floodlight
  4 +KEYSTORE=/etc/floodlight/auth_credentials.jceks
  5 +KEYSTOREPASS=/etc/floodlight/conf.d/01-keystorepass.properties
  6 +
  7 +case "$1" in
  8 + configure)
  9 + if ! id $NAME > /dev/null 2>&1 ; then
  10 + adduser --quiet --group --system --disabled-password \
  11 + --no-create-home --home /dev/null $NAME
  12 + fi
  13 + mkdir -p /var/log/floodlight
  14 + mkdir -p /var/lib/floodlight
  15 + mkdir -p /etc/floodlight/conf.d
  16 +
  17 + chown -R syslog:adm /var/log/floodlight
  18 + chown -R $NAME:$NAME /var/lib/floodlight
  19 +
  20 + if [ ! -f $KEYSTORE ]; then
  21 + KSPASS=`dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev`
  22 + umask 0077
  23 + echo "org.sdnplatform.sync.internal.SyncManager.keyStorePassword=$KSPASS" > \
  24 + $KEYSTOREPASS
  25 + authtool -a CHALLENGE_RESPONSE \
  26 + -ks $KEYSTORE \
  27 + -kp $KSPASS
  28 + chown $NAME:$NAME $KEYSTORE $KEYSTOREPASS
  29 + fi
  30 +
  31 + service rsyslog restart
  32 + service floodlight restart
  33 + ;;
  34 +
  35 + abort-upgrade|abort-remove|abort-deconfigure)
  36 + ;;
  37 +
  38 + *)
  39 + echo "postinst called with unknown argument \`$1'" >&2
  40 + exit 1
  41 + ;;
  42 +esac
  43 +
  44 +#DEBHELPER#
  45 +
  46 +exit 0
... ...
debian/control/postrm 0 โ†’ 100644
  1 +++ a/debian/control/postrm
  1 +#!/bin/sh -e
  2 +
  3 +NAME=floodlight
  4 +
  5 +case "$1" in
  6 + purge)
  7 + deluser --quiet --system $NAME || true
  8 + delgroup --quiet --system $NAME || true
  9 + rm -f /etc/floodlight/auth_credentials.jceks
  10 + rm -f /etc/floodlight/conf.d/01-keystorepass.properties
  11 + rm -rf /var/lib/floodlight/SyncDB
  12 + ;;
  13 +
  14 + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
  15 + ;;
  16 +
  17 + *)
  18 + echo "postrm called with unknown argument \`$1'" >&2
  19 + exit 1
  20 + ;;
  21 +esac
  22 +
  23 +#DEBHELPER#
  24 +
  25 +exit 0
... ...
debian/control/prerm 0 โ†’ 100644
  1 +++ a/debian/control/prerm
  1 +#!/bin/sh -e
  2 +
  3 +NAME=floodlight
  4 +
  5 +case "$1" in
  6 + remove)
  7 + service floodlight stop || true
  8 + ;;
  9 +
  10 + purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
  11 + ;;
  12 +
  13 + *)
  14 + echo "prerm called with unknown argument \`$1'" >&2
  15 + exit 1
  16 + ;;
  17 +esac
  18 +
  19 +#DEBHELPER#
  20 +
  21 +exit 0
... ...
debian/misc/bin/authtool 0 โ†’ 100644
  1 +++ a/debian/misc/bin/authtool
  1 +#!/bin/sh
  2 +
  3 +exec java -cp '/usr/share/floodlight/java/*' org.sdnplatform.sync.client.AuthTool "$@"
... ...
debian/misc/bin/bootstraptool 0 โ†’ 100644
  1 +++ a/debian/misc/bin/bootstraptool
  1 +#!/bin/sh
  2 +
  3 +exec java -cp '/usr/share/floodlight/java/*' org.sdnplatform.sync.client.BootstrapTool "$@"
... ...
debian/misc/bin/floodlight 0 โ†’ 100755
  1 +++ a/debian/misc/bin/floodlight
  1 +#!/bin/sh
  2 +
  3 +exec java -cp '/usr/share/floodlight/java/*' net.floodlightcontroller.core.Main "$@"
... ...
debian/misc/bin/syncclient 0 โ†’ 100644
  1 +++ a/debian/misc/bin/syncclient
  1 +#!/bin/sh
  2 +
  3 +exec java -cp '/usr/share/floodlight/java/*' org.sdnplatform.sync.client.SyncClient "$@"
... ...
debian/misc/default/floodlight 0 โ†’ 100644
  1 +++ a/debian/misc/default/floodlight
  1 +# Options to pass to Floodlight.
  2 +DAEMON_OPTS="-cf /etc/floodlight/floodlight.properties"
  3 +# Additional options to pass to the JVM
  4 +JVM_OPTS=""
  5 +# Sample performance options taken from upstream
  6 +JVM_OPTS="-server"
  7 +JVM_OPTS="$JVM_OPTS -ea"
  8 +JVM_OPTS="$JVM_OPTS -XX:MaxDirectMemorySize=128M"
  9 +JVM_OPTS="$JVM_OPTS -XX:+UseParNewGC"
  10 +JVM_OPTS="$JVM_OPTS -XX:+UseConcMarkSweepGC"
  11 +JVM_OPTS="$JVM_OPTS -XX:+CMSParallelRemarkEnabled"
  12 +JVM_OPTS="$JVM_OPTS -XX:OnError='kill -9 %p'"
  13 +JVM_OPTS="$JVM_OPTS -XX:OnOutOfMemoryError='kill -9 %p'"
  14 +JVM_OPTS="$JVM_OPTS -Dpython.security.respectJavaAccessibility=false"
  15 +JVM_OPTS="$JVM_OPTS -Dnet.floodlightcontroller.packetstreamer.port=9090"
  16 +JVM_OPTS="$JVM_OPTS -Dlogback.configurationFile=/etc/floodlight/logback.xml"
  17 +JVM_OPTS="$JVM_OPTS -Dnet.floodlightcontroller.core.PTWarningThresholdInMilli=0"
  18 +JVM_OPTS="$JVM_OPTS -Dcom.bigswitch.floodlight.addressspace.EnableNetworkService=0"
... ...
debian/misc/floodlight.properties 0 โ†’ 100644
  1 +++ a/debian/misc/floodlight.properties
  1 +floodlight.confd = /etc/floodlight/conf.d
  2 +floodlight.modules = \
  3 +net.floodlightcontroller.jython.JythonDebugInterface,\
  4 +net.floodlightcontroller.core.module.ApplicationLoader
  5 +net.floodlightcontroller.core.module.ApplicationLoader.appsd=/etc/floodlight/apps.d
  6 +net.floodlightcontroller.core.module.ApplicationLoader.application=simpleforwarding
  7 +net.floodlightcontroller.core.FloodlightProvider.rolepath=/var/lib/floodlight/current_role
  8 +org.sdnplatform.sync.internal.SyncManager.authScheme=CHALLENGE_RESPONSE
  9 +org.sdnplatform.sync.internal.SyncManager.keyStorePath=/etc/floodlight/auth_credentials.jceks
  10 +org.sdnplatform.sync.internal.SyncManager.dbPath=/var/lib/floodlight/
  11 +
... ...
debian/misc/init/floodlight.conf 0 โ†’ 100644
  1 +++ a/debian/misc/init/floodlight.conf
  1 +start on runlevel [2345]
  2 +stop on runlevel [!2345]
  3 +respawn
  4 +kill timeout 30
  5 +setuid floodlight
  6 +setgid floodlight
  7 +
  8 +script
  9 + if [ -f /etc/default/floodlight ]; then
  10 + . /etc/default/floodlight
  11 + fi
  12 + COMMAND="java ${JVM_OPTS} -cp '/usr/share/floodlight/java/*' net.floodlightcontroller.core.Main ${DAEMON_OPTS}"
  13 + exec /bin/bash -c "${COMMAND} 2>&1 | /usr/bin/logger -t floodlight -p user.info"
  14 +end script
... ...
debian/misc/logback.xml 0 โ†’ 100644
  1 +++ a/debian/misc/logback.xml
  1 +<?xml version="1.0"?>
  2 +<configuration scan="true">
  3 + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
  4 + <encoder>
  5 + <pattern>%level [%logger{20}:%thread] %msg%n</pattern>
  6 + </encoder>
  7 + </appender>
  8 + <root level="INFO">
  9 + <appender-ref ref="STDOUT"/>
  10 + </root>
  11 + <logger name="org" level="WARN"/>
  12 + <logger name="LogService" level="WARN"/> <!-- Restlet access logging -->
  13 + <logger name="net.floodlightcontroller" level="INFO"/>
  14 + <logger name="org.sdnplatform" level="INFO"/>
  15 +</configuration>
... ...
debian/misc/logrotate/floodlight 0 โ†’ 100644
  1 +++ a/debian/misc/logrotate/floodlight
  1 +/var/log/floodlight/floodlight.log {
  2 + daily
  3 + copytruncate
  4 + missingok
  5 + rotate 7
  6 + compress
  7 + delaycompress
  8 + notifempty
  9 +}
... ...
debian/misc/rsyslog/10-floodlight.conf 0 โ†’ 100644
  1 +++ a/debian/misc/rsyslog/10-floodlight.conf
  1 +!floodlight
  2 +*.* /var/log/floodlight/floodlight.log
  3 +!*
... ...
example/README 0 โ†’ 100644
  1 +++ a/example/README
  1 +One of Floodlight's main goals is extensibility and flexibility.
  2 +
  3 +To prove that point, this directory includes a number of useful
  4 +utilities as examples of what can do with this extensibility.
  5 +
  6 +UTILITIES:
  7 +--------------------------
  8 +
  9 +graphDeps.py and graphTopo.py
  10 +
  11 + Read the module dependencies (graphDeps.py) or the topology
  12 + from the REST API and output it in the 'dot' format used by the
  13 + popular graphviz (www.graphviz.org) package so that they can
  14 + be visualized.
  15 +
  16 + Example usage:
  17 + ./graphTopo.py $hostname # generate .dot file
  18 + dot -Tpdf -o $hostname.pdf $hostname.dot # convert to PDF
  19 + open $hostname.pdf # open to view topology
  20 +
  21 +
  22 +
  23 +packetStreamerClientExample.py
  24 +
  25 + Example client for the packet streamer server in floodlight.
  26 + Allows you to intercept packets from floodlight's packet_in
  27 + processing chain and read them.
  28 +
... ...
example/cli.py 0 โ†’ 100755
  1 +++ a/example/cli.py
  1 +#!/usr/bin/python
  2 +
  3 +import sys
  4 +import argparse
  5 +import json
  6 +import httplib
  7 +import urllib2
  8 +
  9 +class RestApi(object):
  10 +
  11 + def __init__(self, server,port):
  12 + self.server = server
  13 + self.port = port
  14 +
  15 + def get(self, path):
  16 + #ret = self.rest_call(path, {}, 'GET')
  17 + #return ret[2]
  18 + f = urllib2.urlopen('http://'+self.server+':'+str(self.port)+path)
  19 + ret = f.read()
  20 + return json.loads(ret)
  21 +
  22 + def set(self, path, data):
  23 + ret = self.rest_call(path, data, 'POST')
  24 + return ret[0] == 200
  25 +
  26 + def remove(self, objtype, data):
  27 + #ret = self.rest_call(data, 'DELETE')
  28 + return ret[0] == 200
  29 +
  30 + def rest_call(self, path, data, action):
  31 + headers = {
  32 + 'Content-type': 'application/json',
  33 + 'Accept': 'application/json',
  34 + }
  35 + body = json.dumps(data)
  36 + conn = httplib.HTTPConnection(self.server, self.port)
  37 + conn.request(action, path, body, headers)
  38 + response = conn.getresponse()
  39 + ret = (response.status, response.reason, response.read())
  40 + conn.close()
  41 + print str(ret[2])
  42 + return ret
  43 +
  44 +
  45 +
  46 +usage_desc = """
  47 +Command descriptions:
  48 +
  49 + host [debug]
  50 + link [tunnellinks]
  51 + port <blocked | broadcast>
  52 + memory
  53 + switch
  54 + switchclusters
  55 + counter [DPID] <name>
  56 + switch_stats [DPID] <port | queue | flow | aggregate | desc | table | features | host>
  57 +"""
  58 +
  59 +def lookupPath(cmd):
  60 + path = ''
  61 +
  62 + numargs = len(args.otherargs)
  63 +
  64 + if args.cmd == 'switch_stats':
  65 + if numargs == 1:
  66 + path = '/wm/core/switch/all/'+args.otherargs[0]+'/json'
  67 + elif numargs == 2:
  68 + path = '/wm/core/switch/'+args.otherargs[0]+'/'+args.otherargs[1]+'/json'
  69 + elif args.cmd == 'switch':
  70 + path = '/wm/core/controller/switches/json'
  71 + elif args.cmd == 'counter':
  72 + if numargs == 1:
  73 + path = '/wm/core/counter/'+args.otherargs[0]+'/json'
  74 + elif numargs == 2:
  75 + path = '/wm/core/counter/'+args.otherargs[0]+'/'+args.otherargs[1]+'/json'
  76 + elif args.cmd == 'memory':
  77 + path = '/wm/core/memory/json'
  78 + elif args.cmd == 'link':
  79 + if numargs == 0:
  80 + path = '/wm/topology/links/json'
  81 + elif numargs == 1:
  82 + path = '/wm/topology/'+args.otherargs[0]+'/json'
  83 + elif args.cmd == 'port' and numargs == 1:
  84 + if args.otherargs[0] == "blocked":
  85 + path = '/wm/topology/blockedports/json'
  86 + elif args.otherargs[0] == "broadcast":
  87 + path = '/wm/topology/broadcastdomainports/json'
  88 + elif args.cmd == 'switchclusters':
  89 + path = '/wm/topology/switchclusters/json'
  90 + elif args.cmd == 'host':
  91 + path = '/wm/device/'
  92 + if len(args.otherargs) == 1 and args.otherargs[0] == 'debug':
  93 + path = '/wm/device/debug'
  94 + else:
  95 + print usage_desc
  96 + path = ''
  97 + exit(0)
  98 + return path
  99 +
  100 +parser = argparse.ArgumentParser(description='process args', usage=usage_desc, epilog='foo bar help')
  101 +parser.add_argument('--ip', default='localhost')
  102 +parser.add_argument('--port', default=8080)
  103 +parser.add_argument('cmd')
  104 +parser.add_argument('otherargs', nargs='*')
  105 +args = parser.parse_args()
  106 +
  107 +#print args
  108 +
  109 +rest = RestApi(args.ip, args.port)
  110 +path = lookupPath(args.cmd)
  111 +
  112 +out = rest.get(path)
  113 +print json.dumps(out,sort_keys=True, indent=4)
  114 +print "Number of items: " + str(len(out))
  115 +
... ...
example/graphDeps.py 0 โ†’ 100755
  1 +++ a/example/graphDeps.py
  1 +#!/usr/bin/python
  2 +
  3 +import urllib2
  4 +import json
  5 +import sys
  6 +
  7 +
  8 +def simple_json_get(url):
  9 + return json.loads(urllib2.urlopen(url).read())
  10 +
  11 +
  12 +def shorten(s):
  13 + return s.replace('net.floodlightcontroller','n.f'
  14 + ).replace('com.bigswitch','c.b')
  15 +
  16 +def usage(s):
  17 + sys.stderr.write("Usage:\ngrahDeps.py hostname [port]\n%s" % s)
  18 + sys.stderr.write("\n\n\n\n writes data to 'hostname.dot' for use with graphviz\n")
  19 + sys.exit(1)
  20 +
  21 +
  22 +if __name__ == '__main__':
  23 +
  24 + host='localhost'
  25 + port=8080
  26 +
  27 + if len(sys.argv) == 1 or sys.argv[1] == '-h' or sys.argv[1] == '--help':
  28 + usage("need to specify hostname")
  29 +
  30 + host = sys.argv[1]
  31 + if len(sys.argv) > 2:
  32 + port = int(sys.argv[2])
  33 +
  34 + sys.stderr.write("Connecting to %s:%d ..." % (host,port))
  35 + URL="http://%s:%d/wm/core/module/loaded/json" % (host,port)
  36 +
  37 + deps = simple_json_get(URL)
  38 + serviceMap = {}
  39 + nodeMap = {}
  40 + nodeCount = 0
  41 +
  42 + sys.stderr.write("Writing to %s.dot ..." % (host))
  43 + f = open("%s.dot" % host, 'w')
  44 +
  45 + f.write( "digraph Deps {\n")
  46 +
  47 + for mod, info in deps.iteritems():
  48 + # sys.stderr.write("Discovered module %s\n" % mod)
  49 + nodeMap[mod] = "n%d" % nodeCount
  50 + nodeCount += 1
  51 + label = shorten(mod) + "\\n"
  52 + for service, serviceImpl in info['provides'].iteritems():
  53 + # sys.stderr.write(" Discovered service %s implemented with %s\n" % (service,serviceImpl))
  54 + label += "\\nService=%s" % shorten(service)
  55 + serviceMap[serviceImpl] = mod
  56 + f.write(" %s [ label=\"%s\", color=\"blue\"];\n" % (nodeMap[mod], label))
  57 +
  58 + f.write("\n") # for readability
  59 +
  60 + for mod, info in deps.iteritems():
  61 + for dep, serviceImpl in info['depends'].iteritems():
  62 + f.write(" %s -> %s [ label=\"%s\"];\n" % (
  63 + nodeMap[mod],
  64 + shorten(nodeMap[serviceMap[serviceImpl]]),
  65 + shorten(dep)))
  66 +
  67 +
  68 + f.write("}\n")
  69 + f.close();
  70 + sys.stderr.write("Now type\ndot -Tpdf -o %s.pdf %s.dot\n" % (
  71 + host, host))
  72 +
... ...
example/graphTopo.py 0 โ†’ 100755
  1 +++ a/example/graphTopo.py
  1 +#!/usr/bin/python
  2 +
  3 +import urllib2
  4 +import json
  5 +import sys
  6 +
  7 +
  8 +def simple_json_get(url):
  9 + return json.loads(urllib2.urlopen(url).read())
  10 +
  11 +
  12 +def shorten(s):
  13 + return s.replace('net.floodlightcontroller','n.f'
  14 + ).replace('com.bigswitch','c.b')
  15 +
  16 +def usage(s):
  17 + sys.stderr.write("Usage:\ngrahTopo.py hostname [port]\n%s" % s)
  18 + sys.stderr.write("\n\n\n\n writes data to 'hostname.dot' for use with graphviz\n")
  19 + sys.exit(1)
  20 +
  21 +
  22 +if __name__ == '__main__':
  23 +
  24 + host='localhost'
  25 + port=8080
  26 +
  27 + if len(sys.argv) == 1 or sys.argv[1] == '-h' or sys.argv[1] == '--help':
  28 + usage("need to specify hostname")
  29 +
  30 + host = sys.argv[1]
  31 + if len(sys.argv) > 2:
  32 + port = int(sys.argv[2])
  33 +
  34 + sys.stderr.write("Connecting to %s:%d ..." % (host,port))
  35 + URL="http://%s:%d/wm/topology/links/json" % (host,port)
  36 +
  37 + # {
  38 + # "dst-port": 2,
  39 + # "dst-switch": "00:00:00:00:00:00:00:0a",
  40 + # "src-port": 3,
  41 + # "src-switch": "00:00:00:00:00:00:00:0c"
  42 + # }
  43 +
  44 + links = simple_json_get(URL)
  45 + nodeMap = {}
  46 +
  47 + sys.stderr.write("Writing to %s.dot ..." % (host))
  48 + f = open("%s.dot" % host, 'w')
  49 +
  50 + f.write( "digraph Deps {\n")
  51 +
  52 + for link in links:
  53 + # sys.stderr.write("Discovered module %s\n" % mod)
  54 + if not link['dst-switch'] in nodeMap:
  55 + sw = link['dst-switch']
  56 + nodeMap[sw] = "n%d" % len(nodeMap)
  57 + f.write(" %s [ label=\"dpid=%s\", color=\"blue\"];\n" % (nodeMap[sw], sw))
  58 +
  59 + if not link['src-switch'] in nodeMap:
  60 + sw = link['src-switch']
  61 + nodeMap[sw] = "n%d" % len(nodeMap)
  62 + f.write(" %s [ label=\"dpid=%s\", color=\"blue\"];\n" % (nodeMap[sw], sw))
  63 +
  64 +
  65 + f.write(" %s -> %s [ label=\"%s\"];\n" % (
  66 + nodeMap[link['dst-switch']],
  67 + nodeMap[link['src-switch']],
  68 + "src_port %d --> dst_port %d" % (link['src-port'],link['dst-port'])
  69 + )
  70 + )
  71 +
  72 +
  73 + f.write("}\n")
  74 + f.close();
  75 + sys.stderr.write("Now type\ndot -Tpdf -o %s.pdf %s.dot\n" % (
  76 + host, host))
  77 +
... ...
example/packetStreamerClientExample.py 0 โ†’ 100755
  1 +++ a/example/packetStreamerClientExample.py
  1 +#!/usr/bin/python
  2 +
  3 +import urllib2
  4 +import json
  5 +import re
  6 +import sys
  7 +
  8 +from optparse import OptionParser
  9 +
  10 +sys.path.append('~/floodlight/target/gen-py')
  11 +sys.path.append('~/floodlight/thrift/lib/py')
  12 +
  13 +from packetstreamer import PacketStreamer
  14 +from packetstreamer.ttypes import *
  15 +
  16 +from thrift import Thrift
  17 +from thrift.transport import TSocket
  18 +from thrift.transport import TTransport
  19 +from thrift.protocol import TBinaryProtocol
  20 +
  21 +SESSIONID = 'sessionId'
  22 +usage = "usage: %prog [options]"
  23 +parser = OptionParser(usage=usage, version="%prog 1.0")
  24 +parser.add_option("-c", "--controller", dest="controller", metavar="CONTROLLER_IP",
  25 + default="127.0.0.1", help="controller's IP address")
  26 +parser.add_option("-m", "--mac", dest="mac", metavar="HOST_MAC",
  27 + help="The host mac address to trace the OF packets")
  28 +
  29 +(options, args) = parser.parse_args()
  30 +
  31 +def validateIp(ip):
  32 + ipReg = ("(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
  33 + "\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
  34 + "\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
  35 + "\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)")
  36 + m = re.compile(ipReg).match(ip)
  37 + if m:
  38 + return True
  39 + else :
  40 + return False
  41 +
  42 +def validateMac(mac):
  43 + macReg = '([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}' # same regex as above
  44 + m = re.compile(macReg).match(mac)
  45 + if m:
  46 + return True
  47 + else :
  48 + return False
  49 +
  50 +if not validateIp(options.controller):
  51 + parser.error("Invalid format for ip address.")
  52 +
  53 +if not options.mac:
  54 + parser.error("-m or --mac option is required.")
  55 +
  56 +if not validateMac(options.mac):
  57 + parser.error("Invalid format for mac address. Format: xx:xx:xx:xx:xx:xx")
  58 +
  59 +controller = options.controller
  60 +host = options.mac
  61 +
  62 +url = 'http://%s:8080/wm/core/packettrace/json' % controller
  63 +filter = {'mac':host, 'direction':'both', 'period':1000}
  64 +post_data = json.dumps(filter)
  65 +request = urllib2.Request(url, post_data, {'Content-Type':'application/json'})
  66 +response_text = None
  67 +
  68 +def terminateTrace(sid):
  69 + global controller
  70 +
  71 + filter = {SESSIONID:sid, 'period':-1}
  72 + post_data = json.dumps(filter)
  73 + url = 'http://%s:8080/wm/core/packettrace/json' % controller
  74 + request = urllib2.Request(url, post_data, {'Content-Type':'application/json'})
  75 + try:
  76 + response = urllib2.urlopen(request)
  77 + response_text = response.read()
  78 + except Exception, e:
  79 + # Floodlight may not be running, but we don't want that to be a fatal
  80 + # error, so we just ignore the exception in that case.
  81 + print "Exception:", e
  82 +
  83 +try:
  84 + response = urllib2.urlopen(request)
  85 + response_text = response.read()
  86 +except Exception, e:
  87 + # Floodlight may not be running, but we don't want that to be a fatal
  88 + # error, so we just ignore the exception in that case.
  89 + print "Exception:", e
  90 + exit
  91 +
  92 +if not response_text:
  93 + print "Failed to start a packet trace session"
  94 + sys.exit()
  95 +
  96 +response_text = json.loads(response_text)
  97 +
  98 +sessionId = None
  99 +if SESSIONID in response_text:
  100 + sessionId = response_text[SESSIONID]
  101 +else:
  102 + print "Failed to start a packet trace session"
  103 + sys.exit()
  104 +
  105 +try:
  106 +
  107 + # Make socket
  108 + transport = TSocket.TSocket('localhost', 9090)
  109 +
  110 + # Buffering is critical. Raw sockets are very slow
  111 + transport = TTransport.TFramedTransport(transport)
  112 +
  113 + # Wrap in a protocol
  114 + protocol = TBinaryProtocol.TBinaryProtocol(transport)
  115 +
  116 + # Create a client to use the protocol encoder
  117 + client = PacketStreamer.Client(protocol)
  118 +
  119 + # Connect!
  120 + transport.open()
  121 +
  122 + while 1:
  123 + packets = client.getPackets(sessionId)
  124 + for packet in packets:
  125 + print "Packet: %s"% packet
  126 + if "FilterTimeout" in packet:
  127 + sys.exit()
  128 +
  129 +except Thrift.TException, e:
  130 + print '%s' % (e.message)
  131 + terminateTrace(sessionId)
  132 +
  133 +except KeyboardInterrupt, e:
  134 + terminateTrace(sessionId)
  135 +
  136 +# Close!
  137 +transport.close()
  138 +
... ...
findbugs-exclude.xml 0 โ†’ 100644
  1 +++ a/findbugs-exclude.xml
  1 +<FindBugsFilter>
  2 + <!--- Checks disabled on generated code -->
  3 +
  4 + <Match>
  5 + <!-- don't complain about switch statements / external representation exposed
  6 + by generated parser files -->
  7 + <Class name="~net\.bigdb\.(query|yang)\.parser\..*(Lexer|Parser)" />
  8 + <Or>
  9 + <Bug pattern="SF_SWITCH_NO_DEFAULT,EI_EXPOSE_REP,SBSC_USE_STRINGBUFFER_CONCATENATION" />
  10 + <Bug category="PERFORMANCE,MALICIOUS_CODE" />
  11 + </Or>
  12 + </Match>
  13 +
  14 + <Match>
  15 + <!-- Exclude warnings in generated thrift class files -->
  16 + <Class name="~net\.floodlightcontroller\.packetstreamer\.thrift\..*" />
  17 + <Bug pattern="CN_IDIOM,DLS_DEAD_LOCAL_STORE" />
  18 + </Match>
  19 +
  20 + <!-- checks disabled because of too many false positives -->
  21 + <Match>
  22 + <!-- BC_UNFIRMED_CAST complains about too many pseudo violations, where
  23 + we know an object is of a specific type (e.g., by checking the type field
  24 + of an openflow message -->
  25 + <Bug pattern="BC_UNCONFIRMED_CAST" />
  26 + </Match>
  27 +
  28 + <!-- checks disabled because they are just not important -->
  29 + <Match>
  30 + <!-- RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE is not an important check -->
  31 + <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE" />
  32 + </Match>
  33 +</FindBugsFilter>
... ...
floodlight.sh 0 โ†’ 100755
  1 +++ a/floodlight.sh
  1 +#!/bin/sh
  2 +
  3 +# Set paths
  4 +FL_HOME=`dirname $0`
  5 +FL_JAR="${FL_HOME}/target/floodlight.jar"
  6 +FL_LOGBACK="${FL_HOME}/logback.xml"
  7 +
  8 +# Set JVM options
  9 +JVM_OPTS=""
  10 +JVM_OPTS="$JVM_OPTS -server -d64"
  11 +JVM_OPTS="$JVM_OPTS -Xmx2g -Xms2g -Xmn800m"
  12 +JVM_OPTS="$JVM_OPTS -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods"
  13 +JVM_OPTS="$JVM_OPTS -XX:MaxInlineSize=8192 -XX:FreqInlineSize=8192"
  14 +JVM_OPTS="$JVM_OPTS -XX:CompileThreshold=1500 -XX:PreBlockSpin=8"
  15 +JVM_OPTS="$JVM_OPTS -Dpython.security.respectJavaAccessibility=false"
  16 +
  17 +# Create a logback file if required
  18 +[ -f ${FL_LOGBACK} ] || cat <<EOF_LOGBACK >${FL_LOGBACK}
  19 +<configuration scan="true">
  20 + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
  21 + <encoder>
  22 + <pattern>%level [%logger:%thread] %msg%n</pattern>
  23 + </encoder>
  24 + </appender>
  25 + <root level="INFO">
  26 + <appender-ref ref="STDOUT" />
  27 + </root>
  28 + <logger name="org" level="WARN"/>
  29 + <logger name="LogService" level="WARN"/> <!-- Restlet access logging -->
  30 + <logger name="net.floodlightcontroller" level="INFO"/>
  31 + <logger name="net.floodlightcontroller.logging" level="ERROR"/>
  32 +</configuration>
  33 +EOF_LOGBACK
  34 +
  35 +echo "Starting floodlight server ..."
  36 +java ${JVM_OPTS} -Dlogback.configurationFile=${FL_LOGBACK} -jar ${FL_JAR}
... ...
floodlight_style_settings.xml 0 โ†’ 100644
  1 +++ a/floodlight_style_settings.xml
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<profiles version="12">
  3 +<profile kind="CodeFormatterProfile" name="Floodlight" version="12">
  4 +<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
  5 +<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
  6 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
  7 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
  8 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
  9 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
  10 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
  11 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
  12 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
  13 +<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
  14 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
  15 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
  16 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
  17 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
  18 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
  19 +<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
  20 +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
  21 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
  22 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
  23 +<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
  24 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
  25 +<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
  26 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
  27 +<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
  28 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
  29 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
  30 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="18"/>
  31 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="82"/>
  32 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
  33 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
  34 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
  35 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
  36 +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
  37 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
  38 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
  39 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
  40 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
  41 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
  42 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
  43 +<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
  44 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
  45 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="18"/>
  46 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
  47 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
  48 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
  49 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
  50 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
  51 +<setting id="org.eclipse.jdt.core.compiler.source" value="1.7"/>
  52 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
  53 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
  54 +<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
  55 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
  56 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
  57 +<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
  58 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
  59 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="18"/>
  60 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
  61 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
  62 +<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
  63 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
  64 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
  65 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
  66 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="18"/>
  67 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
  68 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
  69 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
  70 +<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
  71 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
  72 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
  73 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
  74 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
  75 +<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="true"/>
  76 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
  77 +<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="77"/>
  78 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
  79 +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
  80 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
  81 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
  82 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
  83 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
  84 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
  85 +<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
  86 +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
  87 +<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
  88 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
  89 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="20"/>
  90 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="2"/>
  91 +<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
  92 +<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
  93 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
  94 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
  95 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
  96 +<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
  97 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
  98 +<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
  99 +<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
  100 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
  101 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
  102 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="18"/>
  103 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
  104 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
  105 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
  106 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="18"/>
  107 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
  108 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
  109 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
  110 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
  111 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
  112 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
  113 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
  114 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
  115 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
  116 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
  117 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
  118 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
  119 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
  120 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
  121 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
  122 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
  123 +<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
  124 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
  125 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
  126 +<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
  127 +<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
  128 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
  129 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
  130 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
  131 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
  132 +<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
  133 +<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
  134 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
  135 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
  136 +<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
  137 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
  138 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
  139 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
  140 +<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
  141 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
  142 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="18"/>
  143 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
  144 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
  145 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
  146 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
  147 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
  148 +<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
  149 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
  150 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
  151 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
  152 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
  153 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
  154 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
  155 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
  156 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
  157 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
  158 +<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="true"/>
  159 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="20"/>
  160 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
  161 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
  162 +<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
  163 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
  164 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
  165 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
  166 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
  167 +<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
  168 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
  169 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
  170 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
  171 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
  172 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
  173 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="18"/>
  174 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
  175 +<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.7"/>
  176 +<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
  177 +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
  178 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
  179 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="18"/>
  180 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
  181 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
  182 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
  183 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
  184 +<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
  185 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
  186 +<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="true"/>
  187 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
  188 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
  189 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="insert"/>
  190 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
  191 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
  192 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
  193 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="20"/>
  194 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="18"/>
  195 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
  196 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
  197 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
  198 +<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
  199 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
  200 +<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
  201 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
  202 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
  203 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
  204 +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
  205 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
  206 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="18"/>
  207 +<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
  208 +<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
  209 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
  210 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
  211 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
  212 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
  213 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
  214 +<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
  215 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
  216 +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
  217 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
  218 +<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
  219 +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
  220 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
  221 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
  222 +<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
  223 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="18"/>
  224 +<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
  225 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
  226 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
  227 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="18"/>
  228 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
  229 +<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
  230 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
  231 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
  232 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
  233 +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
  234 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
  235 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
  236 +<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
  237 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="18"/>
  238 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
  239 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
  240 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
  241 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
  242 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
  243 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
  244 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
  245 +<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
  246 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
  247 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
  248 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
  249 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="18"/>
  250 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
  251 +<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.7"/>
  252 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="82"/>
  253 +<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
  254 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="82"/>
  255 +<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
  256 +<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
  257 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
  258 +<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="2"/>
  259 +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
  260 +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
  261 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
  262 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
  263 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
  264 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
  265 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
  266 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
  267 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
  268 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
  269 +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
  270 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
  271 +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
  272 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
  273 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
  274 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
  275 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
  276 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
  277 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
  278 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
  279 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
  280 +<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
  281 +<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
  282 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
  283 +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
  284 +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
  285 +<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
  286 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
  287 +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
  288 +<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
  289 +<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
  290 +</profile>
  291 +</profiles>
... ...
lib/args4j-2.0.16.jar 0 โ†’ 100644
No preview for this file type
lib/asm-3.0.jar 0 โ†’ 100644
No preview for this file type
lib/asm-tree-3.0.jar 0 โ†’ 100644
No preview for this file type
lib/cglib-nodep-2.2.2.jar 0 โ†’ 100644
No preview for this file type
lib/cobertura-1.9.4.1.jar 0 โ†’ 100644
No preview for this file type
lib/concurrentlinkedhashmap-lru-1.2.jar 0 โ†’ 100644
No preview for this file type
lib/derby-10.9.1.0.jar 0 โ†’ 100644
No preview for this file type
lib/findbugs-annotations-2.0.1.jar 0 โ†’ 100644
No preview for this file type
lib/findbugs-jsr305-2.0.1.jar 0 โ†’ 100644
No preview for this file type
lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/Constants.java 0 โ†’ 100644
  1 +++ a/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/Constants.java
  1 +/**
  2 + * Autogenerated by Thrift Compiler (0.7.0)
  3 + *
  4 + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  5 + */
  6 +package net.floodlightcontroller.packetstreamer.thrift;
  7 +
  8 +import java.util.List;
  9 +import java.util.ArrayList;
  10 +import java.util.Map;
  11 +import java.util.HashMap;
  12 +import java.util.EnumMap;
  13 +import java.util.Set;
  14 +import java.util.HashSet;
  15 +import java.util.EnumSet;
  16 +import java.util.Collections;
  17 +import java.util.BitSet;
  18 +import java.nio.ByteBuffer;
  19 +import java.util.Arrays;
  20 +import org.slf4j.Logger;
  21 +import org.slf4j.LoggerFactory;
  22 +
  23 +@SuppressWarnings("all") public class Constants {
  24 +
  25 + public static final String VERSION = "0.1.0";
  26 +
  27 +}
... ...
lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/Message.java 0 โ†’ 100644
  1 +++ a/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/Message.java
  1 +/**
  2 + * Autogenerated by Thrift Compiler (0.9.0)
  3 + *
  4 + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  5 + * @generated
  6 + */
  7 +package net.floodlightcontroller.packetstreamer.thrift;
  8 +
  9 +import org.apache.thrift.scheme.IScheme;
  10 +import org.apache.thrift.scheme.SchemeFactory;
  11 +import org.apache.thrift.scheme.StandardScheme;
  12 +
  13 +import org.apache.thrift.scheme.TupleScheme;
  14 +import org.apache.thrift.protocol.TTupleProtocol;
  15 +import org.apache.thrift.protocol.TProtocolException;
  16 +import org.apache.thrift.EncodingUtils;
  17 +import org.apache.thrift.TException;
  18 +import java.util.List;
  19 +import java.util.ArrayList;
  20 +import java.util.Map;
  21 +import java.util.HashMap;
  22 +import java.util.EnumMap;
  23 +import java.util.Set;
  24 +import java.util.HashSet;
  25 +import java.util.EnumSet;
  26 +import java.util.Collections;
  27 +import java.util.BitSet;
  28 +import java.nio.ByteBuffer;
  29 +import java.util.Arrays;
  30 +import org.slf4j.Logger;
  31 +import org.slf4j.LoggerFactory;
  32 +
  33 +@SuppressWarnings("all") public class Message implements org.apache.thrift.TBase<Message, Message._Fields>, java.io.Serializable, Cloneable {
  34 + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Message");
  35 +
  36 + private static final org.apache.thrift.protocol.TField SESSION_IDS_FIELD_DESC = new org.apache.thrift.protocol.TField("sessionIDs", org.apache.thrift.protocol.TType.LIST, (short)1);
  37 + private static final org.apache.thrift.protocol.TField PACKET_FIELD_DESC = new org.apache.thrift.protocol.TField("packet", org.apache.thrift.protocol.TType.STRUCT, (short)2);
  38 +
  39 + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
  40 + static {
  41 + schemes.put(StandardScheme.class, new MessageStandardSchemeFactory());
  42 + schemes.put(TupleScheme.class, new MessageTupleSchemeFactory());
  43 + }
  44 +
  45 + public List<String> sessionIDs; // required
  46 + public Packet packet; // required
  47 +
  48 + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  49 + public enum _Fields implements org.apache.thrift.TFieldIdEnum {
  50 + SESSION_IDS((short)1, "sessionIDs"),
  51 + PACKET((short)2, "packet");
  52 +
  53 + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
  54 +
  55 + static {
  56 + for (_Fields field : EnumSet.allOf(_Fields.class)) {
  57 + byName.put(field.getFieldName(), field);
  58 + }
  59 + }
  60 +
  61 + /**
  62 + * Find the _Fields constant that matches fieldId, or null if its not found.
  63 + */
  64 + public static _Fields findByThriftId(int fieldId) {
  65 + switch(fieldId) {
  66 + case 1: // SESSION_IDS
  67 + return SESSION_IDS;
  68 + case 2: // PACKET
  69 + return PACKET;
  70 + default:
  71 + return null;
  72 + }
  73 + }
  74 +
  75 + /**
  76 + * Find the _Fields constant that matches fieldId, throwing an exception
  77 + * if it is not found.
  78 + */
  79 + public static _Fields findByThriftIdOrThrow(int fieldId) {
  80 + _Fields fields = findByThriftId(fieldId);
  81 + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
  82 + return fields;
  83 + }
  84 +
  85 + /**
  86 + * Find the _Fields constant that matches name, or null if its not found.
  87 + */
  88 + public static _Fields findByName(String name) {
  89 + return byName.get(name);
  90 + }
  91 +
  92 + private final short _thriftId;
  93 + private final String _fieldName;
  94 +
  95 + _Fields(short thriftId, String fieldName) {
  96 + _thriftId = thriftId;
  97 + _fieldName = fieldName;
  98 + }
  99 +
  100 + public short getThriftFieldId() {
  101 + return _thriftId;
  102 + }
  103 +
  104 + public String getFieldName() {
  105 + return _fieldName;
  106 + }
  107 + }
  108 +
  109 + // isset id assignments
  110 + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  111 + static {
  112 + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
  113 + tmpMap.put(_Fields.SESSION_IDS, new org.apache.thrift.meta_data.FieldMetaData("sessionIDs", org.apache.thrift.TFieldRequirementType.DEFAULT,
  114 + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
  115 + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
  116 + tmpMap.put(_Fields.PACKET, new org.apache.thrift.meta_data.FieldMetaData("packet", org.apache.thrift.TFieldRequirementType.DEFAULT,
  117 + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Packet.class)));
  118 + metaDataMap = Collections.unmodifiableMap(tmpMap);
  119 + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Message.class, metaDataMap);
  120 + }
  121 +
  122 + public Message() {
  123 + }
  124 +
  125 + public Message(
  126 + List<String> sessionIDs,
  127 + Packet packet)
  128 + {
  129 + this();
  130 + this.sessionIDs = sessionIDs;
  131 + this.packet = packet;
  132 + }
  133 +
  134 + /**
  135 + * Performs a deep copy on <i>other</i>.
  136 + */
  137 + public Message(Message other) {
  138 + if (other.isSetSessionIDs()) {
  139 + List<String> __this__sessionIDs = new ArrayList<String>();
  140 + for (String other_element : other.sessionIDs) {
  141 + __this__sessionIDs.add(other_element);
  142 + }
  143 + this.sessionIDs = __this__sessionIDs;
  144 + }
  145 + if (other.isSetPacket()) {
  146 + this.packet = new Packet(other.packet);
  147 + }
  148 + }
  149 +
  150 + public Message deepCopy() {
  151 + return new Message(this);
  152 + }
  153 +
  154 + @Override
  155 + public void clear() {
  156 + this.sessionIDs = null;
  157 + this.packet = null;
  158 + }
  159 +
  160 + public int getSessionIDsSize() {
  161 + return (this.sessionIDs == null) ? 0 : this.sessionIDs.size();
  162 + }
  163 +
  164 + public java.util.Iterator<String> getSessionIDsIterator() {
  165 + return (this.sessionIDs == null) ? null : this.sessionIDs.iterator();
  166 + }
  167 +
  168 + public void addToSessionIDs(String elem) {
  169 + if (this.sessionIDs == null) {
  170 + this.sessionIDs = new ArrayList<String>();
  171 + }
  172 + this.sessionIDs.add(elem);
  173 + }
  174 +
  175 + public List<String> getSessionIDs() {
  176 + return this.sessionIDs;
  177 + }
  178 +
  179 + public Message setSessionIDs(List<String> sessionIDs) {
  180 + this.sessionIDs = sessionIDs;
  181 + return this;
  182 + }
  183 +
  184 + public void unsetSessionIDs() {
  185 + this.sessionIDs = null;
  186 + }
  187 +
  188 + /** Returns true if field sessionIDs is set (has been assigned a value) and false otherwise */
  189 + public boolean isSetSessionIDs() {
  190 + return this.sessionIDs != null;
  191 + }
  192 +
  193 + public void setSessionIDsIsSet(boolean value) {
  194 + if (!value) {
  195 + this.sessionIDs = null;
  196 + }
  197 + }
  198 +
  199 + public Packet getPacket() {
  200 + return this.packet;
  201 + }
  202 +
  203 + public Message setPacket(Packet packet) {
  204 + this.packet = packet;
  205 + return this;
  206 + }
  207 +
  208 + public void unsetPacket() {
  209 + this.packet = null;
  210 + }
  211 +
  212 + /** Returns true if field packet is set (has been assigned a value) and false otherwise */
  213 + public boolean isSetPacket() {
  214 + return this.packet != null;
  215 + }
  216 +
  217 + public void setPacketIsSet(boolean value) {
  218 + if (!value) {
  219 + this.packet = null;
  220 + }
  221 + }
  222 +
  223 + public void setFieldValue(_Fields field, Object value) {
  224 + switch (field) {
  225 + case SESSION_IDS:
  226 + if (value == null) {
  227 + unsetSessionIDs();
  228 + } else {
  229 + setSessionIDs((List<String>)value);
  230 + }
  231 + break;
  232 +
  233 + case PACKET:
  234 + if (value == null) {
  235 + unsetPacket();
  236 + } else {
  237 + setPacket((Packet)value);
  238 + }
  239 + break;
  240 +
  241 + }
  242 + }
  243 +
  244 + public Object getFieldValue(_Fields field) {
  245 + switch (field) {
  246 + case SESSION_IDS:
  247 + return getSessionIDs();
  248 +
  249 + case PACKET:
  250 + return getPacket();
  251 +
  252 + }
  253 + throw new IllegalStateException();
  254 + }
  255 +
  256 + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  257 + public boolean isSet(_Fields field) {
  258 + if (field == null) {
  259 + throw new IllegalArgumentException();
  260 + }
  261 +
  262 + switch (field) {
  263 + case SESSION_IDS:
  264 + return isSetSessionIDs();
  265 + case PACKET:
  266 + return isSetPacket();
  267 + }
  268 + throw new IllegalStateException();
  269 + }
  270 +
  271 + @Override
  272 + public boolean equals(Object that) {
  273 + if (that == null)
  274 + return false;
  275 + if (that instanceof Message)
  276 + return this.equals((Message)that);
  277 + return false;
  278 + }
  279 +
  280 + public boolean equals(Message that) {
  281 + if (that == null)
  282 + return false;
  283 +
  284 + boolean this_present_sessionIDs = true && this.isSetSessionIDs();
  285 + boolean that_present_sessionIDs = true && that.isSetSessionIDs();
  286 + if (this_present_sessionIDs || that_present_sessionIDs) {
  287 + if (!(this_present_sessionIDs && that_present_sessionIDs))
  288 + return false;
  289 + if (!this.sessionIDs.equals(that.sessionIDs))
  290 + return false;
  291 + }
  292 +
  293 + boolean this_present_packet = true && this.isSetPacket();
  294 + boolean that_present_packet = true && that.isSetPacket();
  295 + if (this_present_packet || that_present_packet) {
  296 + if (!(this_present_packet && that_present_packet))
  297 + return false;
  298 + if (!this.packet.equals(that.packet))
  299 + return false;
  300 + }
  301 +
  302 + return true;
  303 + }
  304 +
  305 + @Override
  306 + public int hashCode() {
  307 + return 0;
  308 + }
  309 +
  310 + public int compareTo(Message other) {
  311 + if (!getClass().equals(other.getClass())) {
  312 + return getClass().getName().compareTo(other.getClass().getName());
  313 + }
  314 +
  315 + int lastComparison = 0;
  316 + Message typedOther = (Message)other;
  317 +
  318 + lastComparison = Boolean.valueOf(isSetSessionIDs()).compareTo(typedOther.isSetSessionIDs());
  319 + if (lastComparison != 0) {
  320 + return lastComparison;
  321 + }
  322 + if (isSetSessionIDs()) {
  323 + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sessionIDs, typedOther.sessionIDs);
  324 + if (lastComparison != 0) {
  325 + return lastComparison;
  326 + }
  327 + }
  328 + lastComparison = Boolean.valueOf(isSetPacket()).compareTo(typedOther.isSetPacket());
  329 + if (lastComparison != 0) {
  330 + return lastComparison;
  331 + }
  332 + if (isSetPacket()) {
  333 + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.packet, typedOther.packet);
  334 + if (lastComparison != 0) {
  335 + return lastComparison;
  336 + }
  337 + }
  338 + return 0;
  339 + }
  340 +
  341 + public _Fields fieldForId(int fieldId) {
  342 + return _Fields.findByThriftId(fieldId);
  343 + }
  344 +
  345 + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
  346 + schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  347 + }
  348 +
  349 + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
  350 + schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
  351 + }
  352 +
  353 + @Override
  354 + public String toString() {
  355 + StringBuilder sb = new StringBuilder("Message(");
  356 + boolean first = true;
  357 +
  358 + sb.append("sessionIDs:");
  359 + if (this.sessionIDs == null) {
  360 + sb.append("null");
  361 + } else {
  362 + sb.append(this.sessionIDs);
  363 + }
  364 + first = false;
  365 + if (!first) sb.append(", ");
  366 + sb.append("packet:");
  367 + if (this.packet == null) {
  368 + sb.append("null");
  369 + } else {
  370 + sb.append(this.packet);
  371 + }
  372 + first = false;
  373 + sb.append(")");
  374 + return sb.toString();
  375 + }
  376 +
  377 + public void validate() throws org.apache.thrift.TException {
  378 + // check for required fields
  379 + // check for sub-struct validity
  380 + if (packet != null) {
  381 + packet.validate();
  382 + }
  383 + }
  384 +
  385 + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
  386 + try {
  387 + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
  388 + } catch (org.apache.thrift.TException te) {
  389 + throw new java.io.IOException(te);
  390 + }
  391 + }
  392 +
  393 + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
  394 + try {
  395 + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
  396 + } catch (org.apache.thrift.TException te) {
  397 + throw new java.io.IOException(te);
  398 + }
  399 + }
  400 +
  401 + private static class MessageStandardSchemeFactory implements SchemeFactory {
  402 + public MessageStandardScheme getScheme() {
  403 + return new MessageStandardScheme();
  404 + }
  405 + }
  406 +
  407 + private static class MessageStandardScheme extends StandardScheme<Message> {
  408 +
  409 + public void read(org.apache.thrift.protocol.TProtocol iprot, Message struct) throws org.apache.thrift.TException {
  410 + org.apache.thrift.protocol.TField schemeField;
  411 + iprot.readStructBegin();
  412 + while (true)
  413 + {
  414 + schemeField = iprot.readFieldBegin();
  415 + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
  416 + break;
  417 + }
  418 + switch (schemeField.id) {
  419 + case 1: // SESSION_IDS
  420 + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
  421 + {
  422 + org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
  423 + struct.sessionIDs = new ArrayList<String>(_list0.size);
  424 + for (int _i1 = 0; _i1 < _list0.size; ++_i1)
  425 + {
  426 + String _elem2; // required
  427 + _elem2 = iprot.readString();
  428 + struct.sessionIDs.add(_elem2);
  429 + }
  430 + iprot.readListEnd();
  431 + }
  432 + struct.setSessionIDsIsSet(true);
  433 + } else {
  434 + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
  435 + }
  436 + break;
  437 + case 2: // PACKET
  438 + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
  439 + struct.packet = new Packet();
  440 + struct.packet.read(iprot);
  441 + struct.setPacketIsSet(true);
  442 + } else {
  443 + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
  444 + }
  445 + break;
  446 + default:
  447 + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
  448 + }
  449 + iprot.readFieldEnd();
  450 + }
  451 + iprot.readStructEnd();
  452 +
  453 + // check for required fields of primitive type, which can't be checked in the validate method
  454 + struct.validate();
  455 + }
  456 +
  457 + public void write(org.apache.thrift.protocol.TProtocol oprot, Message struct) throws org.apache.thrift.TException {
  458 + struct.validate();
  459 +
  460 + oprot.writeStructBegin(STRUCT_DESC);
  461 + if (struct.sessionIDs != null) {
  462 + oprot.writeFieldBegin(SESSION_IDS_FIELD_DESC);
  463 + {
  464 + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.sessionIDs.size()));
  465 + for (String _iter3 : struct.sessionIDs)
  466 + {
  467 + oprot.writeString(_iter3);
  468 + }
  469 + oprot.writeListEnd();
  470 + }
  471 + oprot.writeFieldEnd();
  472 + }
  473 + if (struct.packet != null) {
  474 + oprot.writeFieldBegin(PACKET_FIELD_DESC);
  475 + struct.packet.write(oprot);
  476 + oprot.writeFieldEnd();
  477 + }
  478 + oprot.writeFieldStop();
  479 + oprot.writeStructEnd();
  480 + }
  481 +
  482 + }
  483 +
  484 + private static class MessageTupleSchemeFactory implements SchemeFactory {
  485 + public MessageTupleScheme getScheme() {
  486 + return new MessageTupleScheme();
  487 + }
  488 + }
  489 +
  490 + private static class MessageTupleScheme extends TupleScheme<Message> {
  491 +
  492 + @Override
  493 + public void write(org.apache.thrift.protocol.TProtocol prot, Message struct) throws org.apache.thrift.TException {
  494 + TTupleProtocol oprot = (TTupleProtocol) prot;
  495 + BitSet optionals = new BitSet();
  496 + if (struct.isSetSessionIDs()) {
  497 + optionals.set(0);
  498 + }
  499 + if (struct.isSetPacket()) {
  500 + optionals.set(1);
  501 + }
  502 + oprot.writeBitSet(optionals, 2);
  503 + if (struct.isSetSessionIDs()) {
  504 + {
  505 + oprot.writeI32(struct.sessionIDs.size());
  506 + for (String _iter4 : struct.sessionIDs)
  507 + {
  508 + oprot.writeString(_iter4);
  509 + }
  510 + }
  511 + }
  512 + if (struct.isSetPacket()) {
  513 + struct.packet.write(oprot);
  514 + }
  515 + }
  516 +
  517 + @Override
  518 + public void read(org.apache.thrift.protocol.TProtocol prot, Message struct) throws org.apache.thrift.TException {
  519 + TTupleProtocol iprot = (TTupleProtocol) prot;
  520 + BitSet incoming = iprot.readBitSet(2);
  521 + if (incoming.get(0)) {
  522 + {
  523 + org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
  524 + struct.sessionIDs = new ArrayList<String>(_list5.size);
  525 + for (int _i6 = 0; _i6 < _list5.size; ++_i6)
  526 + {
  527 + String _elem7; // required
  528 + _elem7 = iprot.readString();
  529 + struct.sessionIDs.add(_elem7);
  530 + }
  531 + }
  532 + struct.setSessionIDsIsSet(true);
  533 + }
  534 + if (incoming.get(1)) {
  535 + struct.packet = new Packet();
  536 + struct.packet.read(iprot);
  537 + struct.setPacketIsSet(true);
  538 + }
  539 + }
  540 + }
  541 +
  542 +}
  543 +
... ...
lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/OFMessageType.java 0 โ†’ 100644
  1 +++ a/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/OFMessageType.java
  1 +/**
  2 + * Autogenerated by Thrift Compiler (0.9.0)
  3 + *
  4 + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  5 + * @generated
  6 + */
  7 +package net.floodlightcontroller.packetstreamer.thrift;
  8 +
  9 +
  10 +import java.util.Map;
  11 +import java.util.HashMap;
  12 +import org.apache.thrift.TEnum;
  13 +
  14 +/**
  15 + * OFMessage type
  16 + *
  17 + */
  18 +@SuppressWarnings("all") public enum OFMessageType implements org.apache.thrift.TEnum {
  19 + HELLO(0),
  20 + ERROR(1),
  21 + ECHO_REQUEST(2),
  22 + ECHO_REPLY(3),
  23 + VENDOR(4),
  24 + FEATURES_REQUEST(5),
  25 + FEATURES_REPLY(6),
  26 + GET_CONFIG_REQUEST(7),
  27 + GET_CONFIG_REPLY(8),
  28 + SET_CONFIG(9),
  29 + PACKET_IN(10),
  30 + FLOW_REMOVED(11),
  31 + PORT_STATUS(12),
  32 + PACKET_OUT(13),
  33 + FLOW_MOD(14),
  34 + PORT_MOD(15),
  35 + STATS_REQUEST(16),
  36 + STATS_REPLY(17),
  37 + BARRIER_REQUEST(18),
  38 + BARRIER_REPLY(19),
  39 + QUEUE_GET_CONFIG_REQUEST(20),
  40 + QUEUE_GET_CONFIG_REPLY(21);
  41 +
  42 + private final int value;
  43 +
  44 + private OFMessageType(int value) {
  45 + this.value = value;
  46 + }
  47 +
  48 + /**
  49 + * Get the integer value of this enum value, as defined in the Thrift IDL.
  50 + */
  51 + public int getValue() {
  52 + return value;
  53 + }
  54 +
  55 + /**
  56 + * Find a the enum type by its integer value, as defined in the Thrift IDL.
  57 + * @return null if the value is not found.
  58 + */
  59 + public static OFMessageType findByValue(int value) {
  60 + switch (value) {
  61 + case 0:
  62 + return HELLO;
  63 + case 1:
  64 + return ERROR;
  65 + case 2:
  66 + return ECHO_REQUEST;
  67 + case 3:
  68 + return ECHO_REPLY;
  69 + case 4:
  70 + return VENDOR;
  71 + case 5:
  72 + return FEATURES_REQUEST;
  73 + case 6:
  74 + return FEATURES_REPLY;
  75 + case 7:
  76 + return GET_CONFIG_REQUEST;
  77 + case 8:
  78 + return GET_CONFIG_REPLY;
  79 + case 9:
  80 + return SET_CONFIG;
  81 + case 10:
  82 + return PACKET_IN;
  83 + case 11:
  84 + return FLOW_REMOVED;
  85 + case 12:
  86 + return PORT_STATUS;
  87 + case 13:
  88 + return PACKET_OUT;
  89 + case 14:
  90 + return FLOW_MOD;
  91 + case 15:
  92 + return PORT_MOD;
  93 + case 16:
  94 + return STATS_REQUEST;
  95 + case 17:
  96 + return STATS_REPLY;
  97 + case 18:
  98 + return BARRIER_REQUEST;
  99 + case 19:
  100 + return BARRIER_REPLY;
  101 + case 20:
  102 + return QUEUE_GET_CONFIG_REQUEST;
  103 + case 21:
  104 + return QUEUE_GET_CONFIG_REPLY;
  105 + default:
  106 + return null;
  107 + }
  108 + }
  109 +}
... ...
lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/Packet.java 0 โ†’ 100644
  1 +++ a/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/Packet.java
  1 +/**
  2 + * Autogenerated by Thrift Compiler (0.9.0)
  3 + *
  4 + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  5 + * @generated
  6 + */
  7 +package net.floodlightcontroller.packetstreamer.thrift;
  8 +
  9 +import org.apache.thrift.scheme.IScheme;
  10 +import org.apache.thrift.scheme.SchemeFactory;
  11 +import org.apache.thrift.scheme.StandardScheme;
  12 +
  13 +import org.apache.thrift.scheme.TupleScheme;
  14 +import org.apache.thrift.protocol.TTupleProtocol;
  15 +import org.apache.thrift.protocol.TProtocolException;
  16 +import org.apache.thrift.EncodingUtils;
  17 +import org.apache.thrift.TException;
  18 +import java.util.List;
  19 +import java.util.ArrayList;
  20 +import java.util.Map;
  21 +import java.util.HashMap;
  22 +import java.util.EnumMap;
  23 +import java.util.Set;
  24 +import java.util.HashSet;
  25 +import java.util.EnumSet;
  26 +import java.util.Collections;
  27 +import java.util.BitSet;
  28 +import java.nio.ByteBuffer;
  29 +import java.util.Arrays;
  30 +import org.slf4j.Logger;
  31 +import org.slf4j.LoggerFactory;
  32 +
  33 +@SuppressWarnings("all") public class Packet implements org.apache.thrift.TBase<Packet, Packet._Fields>, java.io.Serializable, Cloneable {
  34 + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Packet");
  35 +
  36 + private static final org.apache.thrift.protocol.TField MESSAGE_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("messageType", org.apache.thrift.protocol.TType.I32, (short)1);
  37 + private static final org.apache.thrift.protocol.TField SW_PORT_TUPLE_FIELD_DESC = new org.apache.thrift.protocol.TField("swPortTuple", org.apache.thrift.protocol.TType.STRUCT, (short)2);
  38 + private static final org.apache.thrift.protocol.TField DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("data", org.apache.thrift.protocol.TType.STRING, (short)3);
  39 +
  40 + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
  41 + static {
  42 + schemes.put(StandardScheme.class, new PacketStandardSchemeFactory());
  43 + schemes.put(TupleScheme.class, new PacketTupleSchemeFactory());
  44 + }
  45 +
  46 + /**
  47 + *
  48 + * @see OFMessageType
  49 + */
  50 + public OFMessageType messageType; // required
  51 + public SwitchPortTuple swPortTuple; // required
  52 + public ByteBuffer data; // required
  53 +
  54 + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  55 + public enum _Fields implements org.apache.thrift.TFieldIdEnum {
  56 + /**
  57 + *
  58 + * @see OFMessageType
  59 + */
  60 + MESSAGE_TYPE((short)1, "messageType"),
  61 + SW_PORT_TUPLE((short)2, "swPortTuple"),
  62 + DATA((short)3, "data");
  63 +
  64 + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
  65 +
  66 + static {
  67 + for (_Fields field : EnumSet.allOf(_Fields.class)) {
  68 + byName.put(field.getFieldName(), field);
  69 + }
  70 + }
  71 +
  72 + /**
  73 + * Find the _Fields constant that matches fieldId, or null if its not found.
  74 + */
  75 + public static _Fields findByThriftId(int fieldId) {
  76 + switch(fieldId) {
  77 + case 1: // MESSAGE_TYPE
  78 + return MESSAGE_TYPE;
  79 + case 2: // SW_PORT_TUPLE
  80 + return SW_PORT_TUPLE;
  81 + case 3: // DATA
  82 + return DATA;
  83 + default:
  84 + return null;
  85 + }
  86 + }
  87 +
  88 + /**
  89 + * Find the _Fields constant that matches fieldId, throwing an exception
  90 + * if it is not found.
  91 + */
  92 + public static _Fields findByThriftIdOrThrow(int fieldId) {
  93 + _Fields fields = findByThriftId(fieldId);
  94 + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
  95 + return fields;
  96 + }
  97 +
  98 + /**
  99 + * Find the _Fields constant that matches name, or null if its not found.
  100 + */
  101 + public static _Fields findByName(String name) {
  102 + return byName.get(name);
  103 + }
  104 +
  105 + private final short _thriftId;
  106 + private final String _fieldName;
  107 +
  108 + _Fields(short thriftId, String fieldName) {
  109 + _thriftId = thriftId;
  110 + _fieldName = fieldName;
  111 + }
  112 +
  113 + public short getThriftFieldId() {
  114 + return _thriftId;
  115 + }
  116 +
  117 + public String getFieldName() {
  118 + return _fieldName;
  119 + }
  120 + }
  121 +
  122 + // isset id assignments
  123 + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  124 + static {
  125 + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
  126 + tmpMap.put(_Fields.MESSAGE_TYPE, new org.apache.thrift.meta_data.FieldMetaData("messageType", org.apache.thrift.TFieldRequirementType.DEFAULT,
  127 + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, OFMessageType.class)));
  128 + tmpMap.put(_Fields.SW_PORT_TUPLE, new org.apache.thrift.meta_data.FieldMetaData("swPortTuple", org.apache.thrift.TFieldRequirementType.DEFAULT,
  129 + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SwitchPortTuple.class)));
  130 + tmpMap.put(_Fields.DATA, new org.apache.thrift.meta_data.FieldMetaData("data", org.apache.thrift.TFieldRequirementType.DEFAULT,
  131 + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
  132 + metaDataMap = Collections.unmodifiableMap(tmpMap);
  133 + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Packet.class, metaDataMap);
  134 + }
  135 +
  136 + public Packet() {
  137 + }
  138 +
  139 + public Packet(
  140 + OFMessageType messageType,
  141 + SwitchPortTuple swPortTuple,
  142 + ByteBuffer data)
  143 + {
  144 + this();
  145 + this.messageType = messageType;
  146 + this.swPortTuple = swPortTuple;
  147 + this.data = data;
  148 + }
  149 +
  150 + /**
  151 + * Performs a deep copy on <i>other</i>.
  152 + */
  153 + public Packet(Packet other) {
  154 + if (other.isSetMessageType()) {
  155 + this.messageType = other.messageType;
  156 + }
  157 + if (other.isSetSwPortTuple()) {
  158 + this.swPortTuple = new SwitchPortTuple(other.swPortTuple);
  159 + }
  160 + if (other.isSetData()) {
  161 + this.data = org.apache.thrift.TBaseHelper.copyBinary(other.data);
  162 +;
  163 + }
  164 + }
  165 +
  166 + public Packet deepCopy() {
  167 + return new Packet(this);
  168 + }
  169 +
  170 + @Override
  171 + public void clear() {
  172 + this.messageType = null;
  173 + this.swPortTuple = null;
  174 + this.data = null;
  175 + }
  176 +
  177 + /**
  178 + *
  179 + * @see OFMessageType
  180 + */
  181 + public OFMessageType getMessageType() {
  182 + return this.messageType;
  183 + }
  184 +
  185 + /**
  186 + *
  187 + * @see OFMessageType
  188 + */
  189 + public Packet setMessageType(OFMessageType messageType) {
  190 + this.messageType = messageType;
  191 + return this;
  192 + }
  193 +
  194 + public void unsetMessageType() {
  195 + this.messageType = null;
  196 + }
  197 +
  198 + /** Returns true if field messageType is set (has been assigned a value) and false otherwise */
  199 + public boolean isSetMessageType() {
  200 + return this.messageType != null;
  201 + }
  202 +
  203 + public void setMessageTypeIsSet(boolean value) {
  204 + if (!value) {
  205 + this.messageType = null;
  206 + }
  207 + }
  208 +
  209 + public SwitchPortTuple getSwPortTuple() {
  210 + return this.swPortTuple;
  211 + }
  212 +
  213 + public Packet setSwPortTuple(SwitchPortTuple swPortTuple) {
  214 + this.swPortTuple = swPortTuple;
  215 + return this;
  216 + }
  217 +
  218 + public void unsetSwPortTuple() {
  219 + this.swPortTuple = null;
  220 + }
  221 +
  222 + /** Returns true if field swPortTuple is set (has been assigned a value) and false otherwise */
  223 + public boolean isSetSwPortTuple() {
  224 + return this.swPortTuple != null;
  225 + }
  226 +
  227 + public void setSwPortTupleIsSet(boolean value) {
  228 + if (!value) {
  229 + this.swPortTuple = null;
  230 + }
  231 + }
  232 +
  233 + public byte[] getData() {
  234 + setData(org.apache.thrift.TBaseHelper.rightSize(data));
  235 + return data == null ? null : data.array();
  236 + }
  237 +
  238 + public ByteBuffer bufferForData() {
  239 + return data;
  240 + }
  241 +
  242 + public Packet setData(byte[] data) {
  243 + setData(data == null ? (ByteBuffer)null : ByteBuffer.wrap(data));
  244 + return this;
  245 + }
  246 +
  247 + public Packet setData(ByteBuffer data) {
  248 + this.data = data;
  249 + return this;
  250 + }
  251 +
  252 + public void unsetData() {
  253 + this.data = null;
  254 + }
  255 +
  256 + /** Returns true if field data is set (has been assigned a value) and false otherwise */
  257 + public boolean isSetData() {
  258 + return this.data != null;
  259 + }
  260 +
  261 + public void setDataIsSet(boolean value) {
  262 + if (!value) {
  263 + this.data = null;
  264 + }
  265 + }
  266 +
  267 + public void setFieldValue(_Fields field, Object value) {
  268 + switch (field) {
  269 + case MESSAGE_TYPE:
  270 + if (value == null) {
  271 + unsetMessageType();
  272 + } else {
  273 + setMessageType((OFMessageType)value);
  274 + }
  275 + break;
  276 +
  277 + case SW_PORT_TUPLE:
  278 + if (value == null) {
  279 + unsetSwPortTuple();
  280 + } else {
  281 + setSwPortTuple((SwitchPortTuple)value);
  282 + }
  283 + break;
  284 +
  285 + case DATA:
  286 + if (value == null) {
  287 + unsetData();
  288 + } else {
  289 + setData((ByteBuffer)value);
  290 + }
  291 + break;
  292 +
  293 + }
  294 + }
  295 +
  296 + public Object getFieldValue(_Fields field) {
  297 + switch (field) {
  298 + case MESSAGE_TYPE:
  299 + return getMessageType();
  300 +
  301 + case SW_PORT_TUPLE:
  302 + return getSwPortTuple();
  303 +
  304 + case DATA:
  305 + return getData();
  306 +
  307 + }
  308 + throw new IllegalStateException();
  309 + }
  310 +
  311 + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  312 + public boolean isSet(_Fields field) {
  313 + if (field == null) {
  314 + throw new IllegalArgumentException();
  315 + }
  316 +
  317 + switch (field) {
  318 + case MESSAGE_TYPE:
  319 + return isSetMessageType();
  320 + case SW_PORT_TUPLE:
  321 + return isSetSwPortTuple();
  322 + case DATA:
  323 + return isSetData();
  324 + }
  325 + throw new IllegalStateException();
  326 + }
  327 +
  328 + @Override
  329 + public boolean equals(Object that) {
  330 + if (that == null)
  331 + return false;
  332 + if (that instanceof Packet)
  333 + return this.equals((Packet)that);
  334 + return false;
  335 + }
  336 +
  337 + public boolean equals(Packet that) {
  338 + if (that == null)
  339 + return false;
  340 +
  341 + boolean this_present_messageType = true && this.isSetMessageType();
  342 + boolean that_present_messageType = true && that.isSetMessageType();
  343 + if (this_present_messageType || that_present_messageType) {
  344 + if (!(this_present_messageType && that_present_messageType))
  345 + return false;
  346 + if (!this.messageType.equals(that.messageType))
  347 + return false;
  348 + }
  349 +
  350 + boolean this_present_swPortTuple = true && this.isSetSwPortTuple();
  351 + boolean that_present_swPortTuple = true && that.isSetSwPortTuple();
  352 + if (this_present_swPortTuple || that_present_swPortTuple) {
  353 + if (!(this_present_swPortTuple && that_present_swPortTuple))
  354 + return false;
  355 + if (!this.swPortTuple.equals(that.swPortTuple))
  356 + return false;
  357 + }
  358 +
  359 + boolean this_present_data = true && this.isSetData();
  360 + boolean that_present_data = true && that.isSetData();
  361 + if (this_present_data || that_present_data) {
  362 + if (!(this_present_data && that_present_data))
  363 + return false;
  364 + if (!this.data.equals(that.data))
  365 + return false;
  366 + }
  367 +
  368 + return true;
  369 + }
  370 +
  371 + @Override
  372 + public int hashCode() {
  373 + return 0;
  374 + }
  375 +
  376 + public int compareTo(Packet other) {
  377 + if (!getClass().equals(other.getClass())) {
  378 + return getClass().getName().compareTo(other.getClass().getName());
  379 + }
  380 +
  381 + int lastComparison = 0;
  382 + Packet typedOther = (Packet)other;
  383 +
  384 + lastComparison = Boolean.valueOf(isSetMessageType()).compareTo(typedOther.isSetMessageType());
  385 + if (lastComparison != 0) {
  386 + return lastComparison;
  387 + }
  388 + if (isSetMessageType()) {
  389 + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messageType, typedOther.messageType);
  390 + if (lastComparison != 0) {
  391 + return lastComparison;
  392 + }
  393 + }
  394 + lastComparison = Boolean.valueOf(isSetSwPortTuple()).compareTo(typedOther.isSetSwPortTuple());
  395 + if (lastComparison != 0) {
  396 + return lastComparison;
  397 + }
  398 + if (isSetSwPortTuple()) {
  399 + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.swPortTuple, typedOther.swPortTuple);
  400 + if (lastComparison != 0) {
  401 + return lastComparison;
  402 + }
  403 + }
  404 + lastComparison = Boolean.valueOf(isSetData()).compareTo(typedOther.isSetData());
  405 + if (lastComparison != 0) {
  406 + return lastComparison;
  407 + }
  408 + if (isSetData()) {
  409 + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.data, typedOther.data);
  410 + if (lastComparison != 0) {
  411 + return lastComparison;
  412 + }
  413 + }
  414 + return 0;
  415 + }
  416 +
  417 + public _Fields fieldForId(int fieldId) {
  418 + return _Fields.findByThriftId(fieldId);
  419 + }
  420 +
  421 + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
  422 + schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  423 + }
  424 +
  425 + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
  426 + schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
  427 + }
  428 +
  429 + @Override
  430 + public String toString() {
  431 + StringBuilder sb = new StringBuilder("Packet(");
  432 + boolean first = true;
  433 +
  434 + sb.append("messageType:");
  435 + if (this.messageType == null) {
  436 + sb.append("null");
  437 + } else {
  438 + sb.append(this.messageType);
  439 + }
  440 + first = false;
  441 + if (!first) sb.append(", ");
  442 + sb.append("swPortTuple:");
  443 + if (this.swPortTuple == null) {
  444 + sb.append("null");
  445 + } else {
  446 + sb.append(this.swPortTuple);
  447 + }
  448 + first = false;
  449 + if (!first) sb.append(", ");
  450 + sb.append("data:");
  451 + if (this.data == null) {
  452 + sb.append("null");
  453 + } else {
  454 + org.apache.thrift.TBaseHelper.toString(this.data, sb);
  455 + }
  456 + first = false;
  457 + sb.append(")");
  458 + return sb.toString();
  459 + }
  460 +
  461 + public void validate() throws org.apache.thrift.TException {
  462 + // check for required fields
  463 + // check for sub-struct validity
  464 + if (swPortTuple != null) {
  465 + swPortTuple.validate();
  466 + }
  467 + }
  468 +
  469 + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
  470 + try {
  471 + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
  472 + } catch (org.apache.thrift.TException te) {
  473 + throw new java.io.IOException(te);
  474 + }
  475 + }
  476 +
  477 + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
  478 + try {
  479 + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
  480 + } catch (org.apache.thrift.TException te) {
  481 + throw new java.io.IOException(te);
  482 + }
  483 + }
  484 +
  485 + private static class PacketStandardSchemeFactory implements SchemeFactory {
  486 + public PacketStandardScheme getScheme() {
  487 + return new PacketStandardScheme();
  488 + }
  489 + }
  490 +
  491 + private static class PacketStandardScheme extends StandardScheme<Packet> {
  492 +
  493 + public void read(org.apache.thrift.protocol.TProtocol iprot, Packet struct) throws org.apache.thrift.TException {
  494 + org.apache.thrift.protocol.TField schemeField;
  495 + iprot.readStructBegin();
  496 + while (true)
  497 + {
  498 + schemeField = iprot.readFieldBegin();
  499 + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
  500 + break;
  501 + }
  502 + switch (schemeField.id) {
  503 + case 1: // MESSAGE_TYPE
  504 + if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
  505 + struct.messageType = OFMessageType.findByValue(iprot.readI32());
  506 + struct.setMessageTypeIsSet(true);
  507 + } else {
  508 + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
  509 + }
  510 + break;
  511 + case 2: // SW_PORT_TUPLE
  512 + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
  513 + struct.swPortTuple = new SwitchPortTuple();
  514 + struct.swPortTuple.read(iprot);
  515 + struct.setSwPortTupleIsSet(true);
  516 + } else {
  517 + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
  518 + }
  519 + break;
  520 + case 3: // DATA
  521 + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
  522 + struct.data = iprot.readBinary();
  523 + struct.setDataIsSet(true);
  524 + } else {
  525 + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
  526 + }
  527 + break;
  528 + default:
  529 + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
  530 + }
  531 + iprot.readFieldEnd();
  532 + }
  533 + iprot.readStructEnd();
  534 +
  535 + // check for required fields of primitive type, which can't be checked in the validate method
  536 + struct.validate();
  537 + }
  538 +
  539 + public void write(org.apache.thrift.protocol.TProtocol oprot, Packet struct) throws org.apache.thrift.TException {
  540 + struct.validate();
  541 +
  542 + oprot.writeStructBegin(STRUCT_DESC);
  543 + if (struct.messageType != null) {
  544 + oprot.writeFieldBegin(MESSAGE_TYPE_FIELD_DESC);
  545 + oprot.writeI32(struct.messageType.getValue());
  546 + oprot.writeFieldEnd();
  547 + }
  548 + if (struct.swPortTuple != null) {
  549 + oprot.writeFieldBegin(SW_PORT_TUPLE_FIELD_DESC);
  550 + struct.swPortTuple.write(oprot);
  551 + oprot.writeFieldEnd();
  552 + }
  553 + if (struct.data != null) {
  554 + oprot.writeFieldBegin(DATA_FIELD_DESC);
  555 + oprot.writeBinary(struct.data);
  556 + oprot.writeFieldEnd();
  557 + }
  558 + oprot.writeFieldStop();
  559 + oprot.writeStructEnd();
  560 + }
  561 +
  562 + }
  563 +
  564 + private static class PacketTupleSchemeFactory implements SchemeFactory {
  565 + public PacketTupleScheme getScheme() {
  566 + return new PacketTupleScheme();
  567 + }
  568 + }
  569 +
  570 + private static class PacketTupleScheme extends TupleScheme<Packet> {
  571 +
  572 + @Override
  573 + public void write(org.apache.thrift.protocol.TProtocol prot, Packet struct) throws org.apache.thrift.TException {
  574 + TTupleProtocol oprot = (TTupleProtocol) prot;
  575 + BitSet optionals = new BitSet();
  576 + if (struct.isSetMessageType()) {
  577 + optionals.set(0);
  578 + }
  579 + if (struct.isSetSwPortTuple()) {
  580 + optionals.set(1);
  581 + }
  582 + if (struct.isSetData()) {
  583 + optionals.set(2);
  584 + }
  585 + oprot.writeBitSet(optionals, 3);
  586 + if (struct.isSetMessageType()) {
  587 + oprot.writeI32(struct.messageType.getValue());
  588 + }
  589 + if (struct.isSetSwPortTuple()) {
  590 + struct.swPortTuple.write(oprot);
  591 + }
  592 + if (struct.isSetData()) {
  593 + oprot.writeBinary(struct.data);
  594 + }
  595 + }
  596 +
  597 + @Override
  598 + public void read(org.apache.thrift.protocol.TProtocol prot, Packet struct) throws org.apache.thrift.TException {
  599 + TTupleProtocol iprot = (TTupleProtocol) prot;
  600 + BitSet incoming = iprot.readBitSet(3);
  601 + if (incoming.get(0)) {
  602 + struct.messageType = OFMessageType.findByValue(iprot.readI32());
  603 + struct.setMessageTypeIsSet(true);
  604 + }
  605 + if (incoming.get(1)) {
  606 + struct.swPortTuple = new SwitchPortTuple();
  607 + struct.swPortTuple.read(iprot);
  608 + struct.setSwPortTupleIsSet(true);
  609 + }
  610 + if (incoming.get(2)) {
  611 + struct.data = iprot.readBinary();
  612 + struct.setDataIsSet(true);
  613 + }
  614 + }
  615 + }
  616 +
  617 +}
  618 +
... ...